-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: consolidate authentication and service activities / implement a…
…uthorize code flow (#1) * feat: revisions based on feedback * feat: clean up request * fix: correct result properties * feat: consolidate authorization in service - test for expired token and refresh when necessary - use authorization code flow * chore: changed sObject display name * fix: correct empty response logic * fix: Updates based on feedback * fix: improve regex matcher * fix: updates from feedback * fix: fix token test on Delete * modified: src/activities/SendSalesforceRequest.ts modified: src/request.ts * fix: correct success path for delete - ensure paths are correct * fix: simplify request pattern and better handle token refresh
- Loading branch information
Showing
13 changed files
with
345 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
export class SalesforceRequestError extends Error { | ||
readonly error?: Record<string, any>; | ||
readonly errors?: Record<string, any>[]; | ||
readonly statusCode: number; | ||
|
||
constructor( | ||
statusCode: number, | ||
error?: Record<string, any>, | ||
errors?: Record<string, any>[], | ||
message?: string | ||
) { | ||
super(message || "Salesforce request failed."); | ||
this.error = error; | ||
this.errors = errors; | ||
this.statusCode = statusCode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
export interface SalesforceService { | ||
accessToken: string; | ||
token: SalesforceToken; | ||
instanceUrl: string; | ||
version: string; | ||
|
||
} | ||
clientId: string; | ||
redirectUri: string; | ||
} | ||
|
||
export interface SalesforceToken { | ||
access_token: string; | ||
refresh_token: string; | ||
signature: string; | ||
scope: string; | ||
id_token: string; | ||
instance_url: string; | ||
id: string; | ||
token_type: string; | ||
issued_at: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.