@keystrokehq/salesforce 0.0.10 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/_official/index.d.mts +2 -6
  2. package/dist/_official/index.mjs +1 -1
  3. package/dist/accounts.d.mts +5 -21
  4. package/dist/accounts.mjs +1 -1
  5. package/dist/associations.d.mts +2 -9
  6. package/dist/associations.mjs +2 -2
  7. package/dist/campaign-members.d.mts +5 -21
  8. package/dist/campaign-members.mjs +1 -1
  9. package/dist/campaigns.d.mts +5 -21
  10. package/dist/campaigns.mjs +1 -1
  11. package/dist/cases.d.mts +5 -21
  12. package/dist/cases.mjs +1 -1
  13. package/dist/client.d.mts +1 -1
  14. package/dist/client.mjs +1 -1
  15. package/dist/connection.d.mts +1 -1
  16. package/dist/connection.mjs +1 -1
  17. package/dist/contacts.d.mts +5 -21
  18. package/dist/contacts.mjs +1 -1
  19. package/dist/dashboards.d.mts +3 -13
  20. package/dist/dashboards.mjs +1 -1
  21. package/dist/{factory-Dt72AT6c.mjs → factory-BGHapzgT.mjs} +1 -1
  22. package/dist/integration-BDDBjdNG.d.mts +30 -0
  23. package/dist/integration-BzLQsPf-.mjs +60 -0
  24. package/dist/leads.d.mts +5 -21
  25. package/dist/leads.mjs +1 -1
  26. package/dist/notes.d.mts +5 -21
  27. package/dist/notes.mjs +1 -1
  28. package/dist/objects.d.mts +2 -9
  29. package/dist/objects.mjs +1 -1
  30. package/dist/opportunities.d.mts +5 -21
  31. package/dist/opportunities.mjs +1 -1
  32. package/dist/opportunity-line-items.d.mts +5 -21
  33. package/dist/opportunity-line-items.mjs +1 -1
  34. package/dist/ownership.d.mts +1 -5
  35. package/dist/ownership.mjs +2 -2
  36. package/dist/reports.d.mts +4 -17
  37. package/dist/reports.mjs +1 -1
  38. package/dist/{shared-Cp54E0DL.mjs → shared-CM1r3Nii.mjs} +1 -1
  39. package/dist/soql.d.mts +2 -9
  40. package/dist/soql.mjs +2 -2
  41. package/dist/tasks.d.mts +5 -21
  42. package/dist/tasks.mjs +1 -1
  43. package/dist/triggers.d.mts +1 -1
  44. package/dist/triggers.mjs +2 -2
  45. package/dist/users.d.mts +1 -5
  46. package/dist/users.mjs +1 -1
  47. package/package.json +4 -5
  48. package/dist/integration-B4z5pRJ7.d.mts +0 -62
  49. package/dist/integration-DFFhYLhB.mjs +0 -131
@@ -1,62 +0,0 @@
1
- import * as _keystrokehq_integration_authoring_official0 from "@keystrokehq/integration-authoring/official";
2
- import { z } from "zod";
3
- import * as _keystrokehq_core0 from "@keystrokehq/core";
4
- import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
5
- import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
6
-
7
- //#region src/integration.d.ts
8
- declare const salesforceOfficialIntegration: {
9
- id: "salesforce";
10
- name: string;
11
- description: string;
12
- auth: z.ZodObject<{
13
- SALESFORCE_ACCESS_TOKEN: z.ZodString;
14
- SALESFORCE_INSTANCE_URL: z.ZodURL;
15
- }, z.core.$strip>;
16
- proxy: {
17
- hosts: string[];
18
- };
19
- connections: {
20
- kind: "oauth";
21
- tokenType: "refreshable";
22
- authUrl: "https://login.salesforce.com/services/oauth2/authorize";
23
- tokenUrl: "https://login.salesforce.com/services/oauth2/token";
24
- revokeUrl: null;
25
- scopes: readonly ["api", "refresh_token", "offline_access"];
26
- vault: {
27
- readonly accessToken: "SALESFORCE_ACCESS_TOKEN";
28
- readonly instanceUrl: "SALESFORCE_INSTANCE_URL";
29
- };
30
- buildAuthUrl: ({
31
- oauthClient,
32
- redirectUri,
33
- state,
34
- connection,
35
- requestedScopes
36
- }: _keystrokehq_core_credential_set0.BuildAuthUrlContext) => string;
37
- exchangeCode: ({
38
- oauthClient,
39
- code,
40
- redirectUri
41
- }: _keystrokehq_core_credential_set0.ExchangeCodeContext) => Promise<_keystrokehq_core_credential_set0.TokenResult>;
42
- refreshToken: ({
43
- oauthClient,
44
- refreshToken
45
- }: _keystrokehq_core_credential_set0.RefreshTokenContext) => Promise<_keystrokehq_core_credential_set0.TokenResult>;
46
- id: string;
47
- }[];
48
- };
49
- declare const salesforceBundle: _keystrokehq_integration_authoring_official0.OfficialIntegrationBundle<"salesforce", z.ZodObject<{
50
- SALESFORCE_ACCESS_TOKEN: z.ZodString;
51
- SALESFORCE_INSTANCE_URL: z.ZodURL;
52
- }, z.core.$strip>>;
53
- declare const salesforce: _keystrokehq_core0.CredentialSet<"keystroke:salesforce", z.ZodObject<{
54
- SALESFORCE_ACCESS_TOKEN: z.ZodString;
55
- SALESFORCE_INSTANCE_URL: z.ZodURL;
56
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
57
- SALESFORCE_ACCESS_TOKEN: z.ZodString;
58
- SALESFORCE_INSTANCE_URL: z.ZodURL;
59
- }, z.core.$strip>>[] | undefined>;
60
- type SalesforceCredentials = InferCredentialSetAuth<typeof salesforce>;
61
- //#endregion
62
- export { salesforceOfficialIntegration as i, salesforce as n, salesforceBundle as r, SalesforceCredentials as t };
@@ -1,131 +0,0 @@
1
- import { defineOfficialIntegration, officialCredentialSetId } from "@keystrokehq/integration-authoring/official";
2
- import { z } from "zod";
3
- import { CredentialSet } from "@keystrokehq/core";
4
- import { oauthDefaults } from "@keystrokehq/credential-connection";
5
-
6
- //#region src/_official/provider-app.ts
7
- const salesforceAppCredentialSet = new CredentialSet({
8
- id: officialCredentialSetId("salesforce-app"),
9
- exposure: "platform-only",
10
- name: "Salesforce Connected App",
11
- auth: z.object({
12
- clientId: z.string().min(1),
13
- clientSecret: z.string().min(1)
14
- })
15
- });
16
- const salesforceOfficialProviderSeed = {
17
- provider: "salesforce",
18
- appRef: "salesforce-platform",
19
- displayName: "Salesforce Platform",
20
- credentialSetName: "Keystroke Salesforce Platform App",
21
- envShape: {
22
- KEYSTROKE_OFFICIAL_SALESFORCE_CLIENT_ID: z.string().optional(),
23
- KEYSTROKE_OFFICIAL_SALESFORCE_CLIENT_SECRET: z.string().optional(),
24
- KEYSTROKE_OFFICIAL_SALESFORCE_ENVIRONMENT: z.enum(["production", "sandbox"]).optional(),
25
- KEYSTROKE_OFFICIAL_SALESFORCE_LOGIN_BASE_URL: z.string().url().optional()
26
- },
27
- requiredEnvKeys: ["KEYSTROKE_OFFICIAL_SALESFORCE_CLIENT_ID", "KEYSTROKE_OFFICIAL_SALESFORCE_CLIENT_SECRET"],
28
- externalAppIdEnvKey: "KEYSTROKE_OFFICIAL_SALESFORCE_CLIENT_ID",
29
- buildCredentials: (env) => ({
30
- clientId: env.KEYSTROKE_OFFICIAL_SALESFORCE_CLIENT_ID,
31
- clientSecret: env.KEYSTROKE_OFFICIAL_SALESFORCE_CLIENT_SECRET
32
- }),
33
- buildMetadata: (env) => env.KEYSTROKE_OFFICIAL_SALESFORCE_ENVIRONMENT || env.KEYSTROKE_OFFICIAL_SALESFORCE_LOGIN_BASE_URL ? {
34
- ...env.KEYSTROKE_OFFICIAL_SALESFORCE_ENVIRONMENT ? { environment: env.KEYSTROKE_OFFICIAL_SALESFORCE_ENVIRONMENT } : {},
35
- ...env.KEYSTROKE_OFFICIAL_SALESFORCE_LOGIN_BASE_URL ? { loginBaseUrl: env.KEYSTROKE_OFFICIAL_SALESFORCE_LOGIN_BASE_URL } : {}
36
- } : void 0
37
- };
38
-
39
- //#endregion
40
- //#region src/oauth-connection.ts
41
- function getMetadataValue(metadata, key) {
42
- if (!metadata || typeof metadata !== "object" || !(key in metadata)) return;
43
- const value = metadata[key];
44
- if (typeof value === "string" || typeof value === "boolean") return value;
45
- }
46
- function resolveSalesforceLoginBaseUrl(metadata) {
47
- const explicitBaseUrl = getMetadataValue(metadata, "loginBaseUrl");
48
- if (typeof explicitBaseUrl === "string" && explicitBaseUrl.length > 0) return explicitBaseUrl;
49
- if (getMetadataValue(metadata, "environment") === "sandbox") return "https://test.salesforce.com";
50
- if (getMetadataValue(metadata, "sandbox") === true) return "https://test.salesforce.com";
51
- return "https://login.salesforce.com";
52
- }
53
- function buildSalesforceUrl(metadata, path) {
54
- return new URL(path, resolveSalesforceLoginBaseUrl(metadata)).toString();
55
- }
56
- const salesforceOAuthConnection = {
57
- kind: "oauth",
58
- tokenType: "refreshable",
59
- authUrl: "https://login.salesforce.com/services/oauth2/authorize",
60
- tokenUrl: "https://login.salesforce.com/services/oauth2/token",
61
- revokeUrl: null,
62
- scopes: [
63
- "api",
64
- "refresh_token",
65
- "offline_access"
66
- ],
67
- vault: {
68
- accessToken: "SALESFORCE_ACCESS_TOKEN",
69
- instanceUrl: "SALESFORCE_INSTANCE_URL"
70
- },
71
- buildAuthUrl({ oauthClient, redirectUri, state, connection, requestedScopes }) {
72
- const scopes = requestedScopes ?? connection.scopes;
73
- const url = new URL(buildSalesforceUrl(oauthClient.metadata, "/services/oauth2/authorize"));
74
- url.searchParams.set("client_id", oauthClient.clientId);
75
- url.searchParams.set("scope", scopes.join(" "));
76
- url.searchParams.set("redirect_uri", redirectUri);
77
- url.searchParams.set("state", state);
78
- url.searchParams.set("response_type", "code");
79
- return url.toString();
80
- },
81
- async exchangeCode({ oauthClient, code, redirectUri }) {
82
- if (!code) throw new Error("Missing authorization code");
83
- return oauthDefaults.exchangeToken({
84
- tokenUrl: buildSalesforceUrl(oauthClient.metadata, "/services/oauth2/token"),
85
- body: new URLSearchParams({
86
- code,
87
- client_id: oauthClient.clientId,
88
- client_secret: oauthClient.clientSecret,
89
- redirect_uri: redirectUri,
90
- grant_type: "authorization_code"
91
- })
92
- });
93
- },
94
- async refreshToken({ oauthClient, refreshToken }) {
95
- return oauthDefaults.exchangeToken({
96
- tokenUrl: buildSalesforceUrl(oauthClient.metadata, "/services/oauth2/token"),
97
- body: new URLSearchParams({
98
- grant_type: "refresh_token",
99
- refresh_token: refreshToken,
100
- client_id: oauthClient.clientId,
101
- client_secret: oauthClient.clientSecret
102
- })
103
- });
104
- }
105
- };
106
-
107
- //#endregion
108
- //#region src/integration.ts
109
- const salesforceAuthSchema = z.object({
110
- SALESFORCE_ACCESS_TOKEN: z.string().min(1),
111
- SALESFORCE_INSTANCE_URL: z.url()
112
- });
113
- const salesforceOfficialIntegration = {
114
- id: "salesforce",
115
- name: "Salesforce",
116
- description: "Salesforce CRM and platform automation",
117
- auth: salesforceAuthSchema,
118
- proxy: { hosts: ["*.salesforce.com", "*.force.com"] },
119
- connections: [{
120
- id: "oauth",
121
- ...salesforceOAuthConnection
122
- }]
123
- };
124
- const salesforceBundle = defineOfficialIntegration({
125
- ...salesforceOfficialIntegration,
126
- internal: { providerApp: salesforceAppCredentialSet }
127
- });
128
- const salesforce = salesforceBundle.credentialSet;
129
-
130
- //#endregion
131
- export { salesforceOfficialProviderSeed as a, salesforceAppCredentialSet as i, salesforceBundle as n, salesforceOfficialIntegration as r, salesforce as t };