@awell-health/awell-extensions 1.1.57 → 1.1.58

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. package/dist/extensions/markdown.json +1 -1
  2. package/dist/extensions/sfdc/actions/index.d.ts +59 -0
  3. package/dist/extensions/sfdc/actions/index.js +2 -0
  4. package/dist/extensions/sfdc/actions/index.js.map +1 -1
  5. package/dist/extensions/sfdc/actions/updateLead/config/datapoints.d.ts +1 -0
  6. package/dist/extensions/sfdc/actions/updateLead/config/datapoints.js +5 -0
  7. package/dist/extensions/sfdc/actions/updateLead/config/datapoints.js.map +1 -0
  8. package/dist/extensions/sfdc/actions/updateLead/config/fields.d.ts +28 -0
  9. package/dist/extensions/sfdc/actions/updateLead/config/fields.js +52 -0
  10. package/dist/extensions/sfdc/actions/updateLead/config/fields.js.map +1 -0
  11. package/dist/extensions/sfdc/actions/updateLead/config/index.d.ts +2 -0
  12. package/dist/extensions/sfdc/actions/updateLead/config/index.js +9 -0
  13. package/dist/extensions/sfdc/actions/updateLead/config/index.js.map +1 -0
  14. package/dist/extensions/sfdc/actions/updateLead/index.d.ts +1 -0
  15. package/dist/extensions/sfdc/actions/updateLead/index.js +6 -0
  16. package/dist/extensions/sfdc/actions/updateLead/index.js.map +1 -0
  17. package/dist/extensions/sfdc/actions/updateLead/updateLead.d.ts +4 -0
  18. package/dist/extensions/sfdc/actions/updateLead/updateLead.js +28 -0
  19. package/dist/extensions/sfdc/actions/updateLead/updateLead.js.map +1 -0
  20. package/dist/extensions/sfdc/actions/updateLead/updateLead.test.d.ts +1 -0
  21. package/dist/extensions/sfdc/actions/updateLead/updateLead.test.js +33 -0
  22. package/dist/extensions/sfdc/actions/updateLead/updateLead.test.js.map +1 -0
  23. package/dist/extensions/sfdc/api/client.d.ts +3 -1
  24. package/dist/extensions/sfdc/api/client.js +14 -0
  25. package/dist/extensions/sfdc/api/client.js.map +1 -1
  26. package/dist/extensions/sfdc/api/schema/record.schema.d.ts +22 -0
  27. package/dist/extensions/sfdc/api/schema/record.schema.js +13 -1
  28. package/dist/extensions/sfdc/api/schema/record.schema.js.map +1 -1
  29. package/package.json +1 -1
@@ -116,7 +116,7 @@
116
116
  "changelog": "# Sendgrid changelog\n\n## July 7, 2023\n\nAdded \"Add Email to Suppression Lists\" and \"Remove Email from Suppression Lists\" actions.\n\n## July 15, 2023\n\nUpdated \"Add or Update Contact\" acction to create a datapoint of the Job ID.\n\nAdded \"Check Import Status\" action.\n\n## July 27, 2023\n\nAdds \"Finished At\" data point to the importStatus action."
117
117
  },
118
118
  "sfdc": {
119
- "readme": "---\ntitle: Salesforce\ndescription: SFDC is a cloud-based customer relationship management (CRM) software used to manage customer data, sales processes, marketing campaigns, and customer service activities\n---\n\n## Salesforce\n\nSFDC is a cloud-based customer relationship management (CRM) software used to manage customer data, sales processes, marketing campaigns, and customer service activities\n\n## Extension settings\n\nFor this extension to work, you will need to provide the below settings:\n\n- Salesforce subdomain (https://<SUBDOMAIN>.my.salesforce.com/services/oauth2/token)\n- Client ID\n- Client secret\n- Username*\n- Password*\n\nUsername and password are optional. When specified, the Password grant will be used to authenticate with the Salesforce API. When left blank, the Client Credentials grant will be used.\n\n## Actions\n\n### Create a Lead\n\nA lead is a standard Salesforce object (sObject). You can use this action to create a Lead object.",
119
+ "readme": "---\ntitle: Salesforce\ndescription: SFDC is a cloud-based customer relationship management (CRM) software used to manage customer data, sales processes, marketing campaigns, and customer service activities\n---\n\n## Salesforce\n\nSFDC is a cloud-based customer relationship management (CRM) software used to manage customer data, sales processes, marketing campaigns, and customer service activities\n\n## Extension settings\n\nFor this extension to work, you will need to provide the below settings:\n\n- Salesforce subdomain (https://<SUBDOMAIN>.my.salesforce.com/services/oauth2/token)\n- Client ID\n- Client secret\n- Username*\n- Password*\n\nUsername and password are optional. When specified, the Password grant will be used to authenticate with the Salesforce API. When left blank, the Client Credentials grant will be used.\n\n## Actions\n\n### Create a Lead\n\nA lead is a standard Salesforce object (sObject). You can use this action to create a Lead object.\n\n### Update a lead\n\nUpdates a Lead record based on the specified data and provided Lead record ID. Field values provided replace the existing values in the Lead record (PATCH).",
120
120
  "changelog": "# Salesforce changelog"
121
121
  },
122
122
  "stripe": {
@@ -51,5 +51,64 @@ declare const actions: {
51
51
  description: string;
52
52
  };
53
53
  }, "createdLeadId">;
54
+ updateLead: import("@awell-health/extensions-core").Action<{
55
+ sObjectId: {
56
+ id: string;
57
+ label: string;
58
+ description: string;
59
+ type: import("@awell-health/extensions-core").FieldType.STRING;
60
+ required: true;
61
+ };
62
+ data: {
63
+ id: string;
64
+ label: string;
65
+ description: string;
66
+ type: import("@awell-health/extensions-core").FieldType.JSON;
67
+ required: true;
68
+ };
69
+ }, {
70
+ salesforceSubdomain: {
71
+ key: string;
72
+ label: string;
73
+ obfuscated: false;
74
+ required: true;
75
+ description: string;
76
+ };
77
+ clientId: {
78
+ key: string;
79
+ label: string;
80
+ obfuscated: false;
81
+ required: true;
82
+ description: string;
83
+ };
84
+ clientSecret: {
85
+ key: string;
86
+ label: string;
87
+ obfuscated: true;
88
+ required: true;
89
+ description: string;
90
+ };
91
+ username: {
92
+ key: string;
93
+ label: string;
94
+ obfuscated: false;
95
+ required: false;
96
+ description: string;
97
+ };
98
+ password: {
99
+ key: string;
100
+ label: string;
101
+ obfuscated: true;
102
+ required: false;
103
+ description: string;
104
+ };
105
+ apiVersion: {
106
+ key: string;
107
+ label: string;
108
+ obfuscated: false;
109
+ required: false;
110
+ description: string;
111
+ };
112
+ }, never>;
54
113
  };
55
114
  export default actions;
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const createLead_1 = require("./createLead");
4
+ const updateLead_1 = require("./updateLead");
4
5
  const actions = {
5
6
  createLead: createLead_1.createLead,
7
+ updateLead: updateLead_1.updateLead,
6
8
  };
7
9
  exports.default = actions;
8
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/sfdc/actions/index.ts"],"names":[],"mappings":";;AAAA,6CAAyC;AAEzC,MAAM,OAAO,GAAG;IACd,UAAU,EAAV,uBAAU;CACX,CAAA;AAED,kBAAe,OAAO,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/sfdc/actions/index.ts"],"names":[],"mappings":";;AAAA,6CAAyC;AACzC,6CAAyC;AAEzC,MAAM,OAAO,GAAG;IACd,UAAU,EAAV,uBAAU;IACV,UAAU,EAAV,uBAAU;CACX,CAAA;AAED,kBAAe,OAAO,CAAA"}
@@ -0,0 +1 @@
1
+ export declare const dataPoints: {};
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dataPoints = void 0;
4
+ exports.dataPoints = {};
5
+ //# sourceMappingURL=datapoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datapoints.js","sourceRoot":"","sources":["../../../../../../extensions/sfdc/actions/updateLead/config/datapoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,EAAgD,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { FieldType } from '@awell-health/extensions-core';
2
+ import z from 'zod';
3
+ export declare const fields: {
4
+ sObjectId: {
5
+ id: string;
6
+ label: string;
7
+ description: string;
8
+ type: FieldType.STRING;
9
+ required: true;
10
+ };
11
+ data: {
12
+ id: string;
13
+ label: string;
14
+ description: string;
15
+ type: FieldType.JSON;
16
+ required: true;
17
+ };
18
+ };
19
+ export declare const FieldsValidationSchema: z.ZodObject<{
20
+ sObjectId: z.ZodString;
21
+ data: z.ZodPipeline<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, any, string>, any, string>, any, string>, any, string>, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ data: Record<string, unknown>;
24
+ sObjectId: string;
25
+ }, {
26
+ data: string;
27
+ sObjectId: string;
28
+ }>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FieldsValidationSchema = exports.fields = void 0;
7
+ const extensions_core_1 = require("@awell-health/extensions-core");
8
+ const zod_1 = __importDefault(require("zod"));
9
+ exports.fields = {
10
+ sObjectId: {
11
+ id: 'sObjectId',
12
+ label: 'Lead ID',
13
+ description: 'The object ID of the Lead in Salesforce to update',
14
+ type: extensions_core_1.FieldType.STRING,
15
+ required: true,
16
+ },
17
+ data: {
18
+ id: 'data',
19
+ label: 'Data',
20
+ description: 'Information used to update the Lead',
21
+ type: extensions_core_1.FieldType.JSON,
22
+ required: true,
23
+ },
24
+ };
25
+ exports.FieldsValidationSchema = zod_1.default.object({
26
+ sObjectId: zod_1.default.string().min(1),
27
+ data: zod_1.default
28
+ .string()
29
+ .transform((str) => {
30
+ try {
31
+ return JSON.parse(str);
32
+ }
33
+ catch (e) {
34
+ throw new Error('Invalid JSON string');
35
+ }
36
+ })
37
+ .refine((obj) => typeof obj === 'object' && obj !== null && !Array.isArray(obj), {
38
+ message: 'Parsed value is not an object',
39
+ })
40
+ .refine((obj) => {
41
+ return Object.keys(obj).every((key) => typeof key === 'string');
42
+ }, {
43
+ message: 'All keys must be strings',
44
+ })
45
+ .refine((obj) => {
46
+ return Object.values(obj).every((value) => typeof value !== 'undefined');
47
+ }, {
48
+ message: 'All values must be defined',
49
+ })
50
+ .pipe(zod_1.default.record(zod_1.default.unknown())),
51
+ });
52
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/sfdc/actions/updateLead/config/fields.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAqE;AACrE,8CAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,SAAS;QAChB,W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QACE,OAAO,EAAE,4BAA4B;KACtC,CACF;SACA,IAAI,CAAC,aAAC,CAAC,MAAM,CAAC,aAAC,CAAC,OAAO,EAAE,CAAC,CAAC;CACmB,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { fields, FieldsValidationSchema } from './fields';
2
+ export { dataPoints } from './datapoints';
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dataPoints = exports.FieldsValidationSchema = exports.fields = void 0;
4
+ var fields_1 = require("./fields");
5
+ Object.defineProperty(exports, "fields", { enumerable: true, get: function () { return fields_1.fields; } });
6
+ Object.defineProperty(exports, "FieldsValidationSchema", { enumerable: true, get: function () { return fields_1.FieldsValidationSchema; } });
7
+ var datapoints_1 = require("./datapoints");
8
+ Object.defineProperty(exports, "dataPoints", { enumerable: true, get: function () { return datapoints_1.dataPoints; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/sfdc/actions/updateLead/config/index.ts"],"names":[],"mappings":";;;AAAA,mCAAyD;AAAhD,gGAAA,MAAM,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AACvC,2CAAyC;AAAhC,wGAAA,UAAU,OAAA"}
@@ -0,0 +1 @@
1
+ export { updateLead } from './updateLead';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateLead = void 0;
4
+ var updateLead_1 = require("./updateLead");
5
+ Object.defineProperty(exports, "updateLead", { enumerable: true, get: function () { return updateLead_1.updateLead; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/sfdc/actions/updateLead/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,wGAAA,UAAU,OAAA"}
@@ -0,0 +1,4 @@
1
+ import { type Action } from '@awell-health/extensions-core';
2
+ import { type settings } from '../../settings';
3
+ import { fields, dataPoints } from './config';
4
+ export declare const updateLead: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateLead = void 0;
4
+ const extensions_core_1 = require("@awell-health/extensions-core");
5
+ const config_1 = require("./config");
6
+ const lib_1 = require("../../lib");
7
+ exports.updateLead = {
8
+ key: 'updateLead',
9
+ category: extensions_core_1.Category.CUSTOMER_SUPPORT,
10
+ title: 'Update lead',
11
+ description: 'Updates an existing lead object in Salesforce',
12
+ fields: config_1.fields,
13
+ previewable: false,
14
+ dataPoints: config_1.dataPoints,
15
+ onActivityCreated: async (payload, onComplete, onError) => {
16
+ const { fields, salesforceClient } = await (0, lib_1.validatePayloadAndCreateClient)({
17
+ fieldsSchema: config_1.FieldsValidationSchema,
18
+ payload,
19
+ });
20
+ await salesforceClient.updateRecord({
21
+ sObject: 'Lead',
22
+ sObjectId: fields.sObjectId,
23
+ data: fields.data,
24
+ });
25
+ await onComplete();
26
+ },
27
+ };
28
+ //# sourceMappingURL=updateLead.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateLead.js","sourceRoot":"","sources":["../../../../../extensions/sfdc/actions/updateLead/updateLead.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AAErE,qCAAqE;AACrE,mCAA0D;AAE7C,QAAA,UAAU,GAInB;IACF,GAAG,EAAE,YAAY;IACjB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,+CAA+C;IAC5D,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,EAAE;QACvE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,IAAA,oCAA8B,EAAC;YACxE,YAAY,EAAE,+BAAsB;YACpC,OAAO;SACR,CAAC,CAAA;QAEF,MAAM,gBAAgB,CAAC,YAAY,CAAC;YAClC,OAAO,EAAE,MAAM;YACf,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,CAAC,CAAA;QAEF,MAAM,UAAU,EAAE,CAAA;IACpB,CAAC;CACF,CAAA"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const _1 = require(".");
4
+ const tests_1 = require("../../../../src/tests");
5
+ const __mocks__1 = require("../../api/__mocks__");
6
+ jest.mock('../../api/client');
7
+ describe('Salesforce - Update Lead', () => {
8
+ const onComplete = jest.fn();
9
+ const onError = jest.fn();
10
+ beforeEach(() => {
11
+ jest.clearAllMocks();
12
+ });
13
+ test('Should update a Lead', async () => {
14
+ const mockOnActivityCreateParams = (0, tests_1.generateTestPayload)({
15
+ fields: {
16
+ sObjectId: 'some-lead-id',
17
+ data: JSON.stringify({
18
+ RecordTypeId: '0125w000000BRDxAAO',
19
+ LeadSource: 'Website',
20
+ Referral_Type__c: 'Online Search',
21
+ LastName: 'Doe',
22
+ Email: 'johndoe@example.com',
23
+ Phone: '123-456-7890',
24
+ Status: 'New',
25
+ }),
26
+ },
27
+ settings: __mocks__1.mockSettings,
28
+ });
29
+ await _1.updateLead.onActivityCreated(mockOnActivityCreateParams, onComplete, onError);
30
+ expect(onComplete).toHaveBeenCalled();
31
+ });
32
+ });
33
+ //# sourceMappingURL=updateLead.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateLead.test.js","sourceRoot":"","sources":["../../../../../extensions/sfdc/actions/updateLead/updateLead.test.ts"],"names":[],"mappings":";;AAAA,wBAA8B;AAC9B,iDAA2D;AAC3D,kDAAkD;AAElD,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;AAE7B,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAEzB,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACtC,MAAM,0BAA0B,GAAG,IAAA,2BAAmB,EAAC;YACrD,MAAM,EAAE;gBACN,SAAS,EAAE,cAAc;gBACzB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,YAAY,EAAE,oBAAoB;oBAClC,UAAU,EAAE,SAAS;oBACrB,gBAAgB,EAAE,eAAe;oBACjC,QAAQ,EAAE,KAAK;oBACf,KAAK,EAAE,qBAAqB;oBAC5B,KAAK,EAAE,cAAc;oBACrB,MAAM,EAAE,KAAK;iBACd,CAAC;aACH;YACD,QAAQ,EAAE,uBAAY;SACvB,CAAC,CAAA;QAEF,MAAM,aAAU,CAAC,iBAAiB,CAChC,0BAA0B,EAC1B,UAAU,EACV,OAAO,CACR,CAAA;QAED,MAAM,CAAC,UAAU,CAAC,CAAC,gBAAgB,EAAE,CAAA;IACvC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,11 +1,12 @@
1
1
  import { APIClient, DataWrapper, type DataWrapperCtor, type OAuthGrantRequest } from '@awell-health/extensions-core';
2
- import { type CreateRecordInputType, type CreateRecordResponseType } from './schema';
2
+ import { type UpdateRecordInputType, type UpdateRecordResponseType, type CreateRecordInputType, type CreateRecordResponseType } from './schema';
3
3
  export declare class SalesforceDataWrapper extends DataWrapper {
4
4
  private readonly apiVersion;
5
5
  constructor(token: string, baseUrl: string, opts: {
6
6
  apiVersion: string;
7
7
  });
8
8
  createRecord(input: CreateRecordInputType): Promise<CreateRecordResponseType>;
9
+ updateRecord(input: UpdateRecordInputType): Promise<UpdateRecordResponseType>;
9
10
  getRecordShape(sObject: string): Promise<unknown>;
10
11
  }
11
12
  interface SalesforceConstructorProps {
@@ -19,6 +20,7 @@ export declare class SalesforceRestAPIClient extends APIClient<SalesforceDataWra
19
20
  readonly ctor: DataWrapperCtor<SalesforceDataWrapper>;
20
21
  constructor({ authUrl, requestConfig, ...opts }: SalesforceConstructorProps);
21
22
  createRecord(input: CreateRecordInputType): Promise<CreateRecordResponseType>;
23
+ updateRecord(input: UpdateRecordInputType): Promise<UpdateRecordResponseType>;
22
24
  getRecordShape(sObject: string): Promise<unknown>;
23
25
  }
24
26
  export {};
@@ -19,6 +19,17 @@ class SalesforceDataWrapper extends extensions_core_1.DataWrapper {
19
19
  });
20
20
  return res;
21
21
  }
22
+ async updateRecord(input) {
23
+ const res = await this.Request({
24
+ method: 'PATCH',
25
+ url: `/services/data/${this.apiVersion}/sobjects/${input.sObject}/${input.sObjectId}`,
26
+ headers: {
27
+ 'Content-Type': 'application/json',
28
+ },
29
+ data: JSON.stringify(input.data),
30
+ });
31
+ return res;
32
+ }
22
33
  async getRecordShape(sObject) {
23
34
  const res = await this.Request({
24
35
  method: 'GET',
@@ -60,6 +71,9 @@ class SalesforceRestAPIClient extends extensions_core_1.APIClient {
60
71
  async createRecord(input) {
61
72
  return await this.FetchData(async (dw) => await dw.createRecord(input));
62
73
  }
74
+ async updateRecord(input) {
75
+ return await this.FetchData(async (dw) => await dw.updateRecord(input));
76
+ }
63
77
  async getRecordShape(sObject) {
64
78
  return await this.FetchData(async (dw) => await dw.getRecordShape(sObject));
65
79
  }
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../extensions/sfdc/api/client.ts"],"names":[],"mappings":";;;AAAA,mEASsC;AACtC,iDAAuD;AAMvD,MAAa,qBAAsB,SAAQ,6BAAW;IAGpD,YACE,KAAa,EACb,OAAe,EACf,IAEC;QAED,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAErB,IAAI,CAAC,UAAU,GA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ED,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,IAAI,EAAE,OAAO,EAAE;SAChB,CAAC,CAAA;QAvCK,SAAI,GAA2C,CACtD,KAAa,EACb,OAAe,EACf,EAAE,CACF,IAAI,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;QAqC1E,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;IACnC,CAAC;IAEM,KAAK,CAAC,YAAY,CACvB,KAA4B;QAE5B,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;IACzE,CAAC;IAEM,KAAK,CAAC,YAAY,CACvB,KAA4B;QAE5B,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;IACzE,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,OAAe;QACzC,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAA;IAC7E,CAAC;CACF;AA9DD,0DA8DC"}
@@ -1,4 +1,7 @@
1
1
  import { z } from 'zod';
2
+ /**
3
+ * Create a record
4
+ */
2
5
  export declare const CreateRecordInputSchema: z.ZodObject<{
3
6
  sObject: z.ZodString;
4
7
  data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -24,3 +27,22 @@ export declare const CreateRecordResponseSchema: z.ZodObject<{
24
27
  errors: unknown[];
25
28
  }>;
26
29
  export type CreateRecordResponseType = z.infer<typeof CreateRecordResponseSchema>;
30
+ /**
31
+ * Update a record
32
+ */
33
+ export declare const UpdateRecordInputSchema: z.ZodObject<{
34
+ sObject: z.ZodString;
35
+ sObjectId: z.ZodString;
36
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ data: Record<string, unknown>;
39
+ sObject: string;
40
+ sObjectId: string;
41
+ }, {
42
+ data: Record<string, unknown>;
43
+ sObject: string;
44
+ sObjectId: string;
45
+ }>;
46
+ export type UpdateRecordInputType = z.infer<typeof UpdateRecordInputSchema>;
47
+ export declare const UpdateRecordResponseSchema: z.ZodUndefined;
48
+ export type UpdateRecordResponseType = z.infer<typeof UpdateRecordResponseSchema>;
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CreateRecordResponseSchema = exports.CreateRecordInputSchema = void 0;
3
+ exports.UpdateRecordResponseSchema = exports.UpdateRecordInputSchema = exports.CreateRecordResponseSchema = exports.CreateRecordInputSchema = void 0;
4
4
  const zod_1 = require("zod");
5
+ /**
6
+ * Create a record
7
+ */
5
8
  exports.CreateRecordInputSchema = zod_1.z.object({
6
9
  sObject: zod_1.z.string().min(1),
7
10
  data: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
@@ -11,4 +14,13 @@ exports.CreateRecordResponseSchema = zod_1.z.object({
11
14
  errors: zod_1.z.array(zod_1.z.unknown()),
12
15
  success: zod_1.z.boolean(),
13
16
  });
17
+ /**
18
+ * Update a record
19
+ */
20
+ exports.UpdateRecordInputSchema = zod_1.z.object({
21
+ sObject: zod_1.z.string().min(1),
22
+ sObjectId: zod_1.z.string().min(1),
23
+ data: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
24
+ });
25
+ exports.UpdateRecordResponseSchema = zod_1.z.undefined();
14
26
  //# sourceMappingURL=record.schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"record.schema.js","sourceRoot":"","sources":["../../../../../extensions/sfdc/api/schema/record.schema.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEV,QAAA,uBAAuB,G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,CAAC,CAAC,CAAC;IAC5B,IAAI,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC;CACxC,CAAC,CAAA;AAIW,QAAA,0BAA0B,GAAG,OAAC,CAAC,SAAS,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/awell-extensions",
3
- "version": "1.1.57",
3
+ "version": "1.1.58",
4
4
  "packageManager": "yarn@3.4.1",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": {