@membranehq/sdk 0.17.4 → 0.17.6

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 (72) hide show
  1. package/dist/bundle.d.ts +27 -7
  2. package/dist/bundle.js +5247 -5235
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/dts/accessors/action-instances-accessors.d.ts +1 -1
  5. package/dist/dts/accessors/actions-accessors.d.ts +1 -1
  6. package/dist/dts/accessors/app-data-schema-instances-accessors.d.ts +1 -1
  7. package/dist/dts/accessors/app-data-schemas-accessors.d.ts +1 -1
  8. package/dist/dts/accessors/app-event-subscriptions-accessors.d.ts +1 -1
  9. package/dist/dts/accessors/app-event-types-accessors.d.ts +1 -1
  10. package/dist/dts/accessors/connections-accessors.d.ts +6 -5
  11. package/dist/dts/accessors/customers-accessors.d.ts +1 -1
  12. package/dist/dts/accessors/data-link-table-instances-accessors.d.ts +1 -1
  13. package/dist/dts/accessors/data-link-tables-accessors.d.ts +1 -1
  14. package/dist/dts/accessors/data-sources-accessors.d.ts +1 -1
  15. package/dist/dts/accessors/external-event-subscriptions-accessors.d.ts +1 -1
  16. package/dist/dts/accessors/field-mapping-instances-accessors.d.ts +1 -1
  17. package/dist/dts/accessors/field-mappings-accessors.d.ts +1 -1
  18. package/dist/dts/accessors/flow-instances-accessors.d.ts +1 -1
  19. package/dist/dts/accessors/flows-accessors.d.ts +1 -1
  20. package/dist/dts/accessors/integrations-accessors.d.ts +6 -5
  21. package/dist/dts/accessors/scenarios-accessors.d.ts +1 -1
  22. package/dist/dts/accessors/screens-accessors.d.ts +1 -1
  23. package/dist/dts/agent/worker-contracts.d.ts +1 -0
  24. package/dist/dts/alerts/utils.d.ts +1 -1
  25. package/dist/dts/client.d.ts +1 -1
  26. package/dist/dts/data-filter/index.d.ts +1 -1
  27. package/dist/dts/formulas/base.d.ts +1 -1
  28. package/dist/dts/formulas/eval.d.ts +1 -1
  29. package/dist/dts/formulas/findAppRecordId.d.ts +1 -1
  30. package/dist/dts/formulas/findExternalRecordId.d.ts +1 -1
  31. package/dist/dts/formulas/index.d.ts +26 -4
  32. package/dist/dts/formulas/record.d.ts +1 -1
  33. package/dist/dts/workspace-elements/api/action-run-log-records-api.d.ts +2 -0
  34. package/dist/dts/workspace-elements/api/actions-api.d.ts +1 -1
  35. package/dist/dts/workspace-elements/api/connections-api.d.ts +17 -1
  36. package/dist/dts/workspace-elements/api/data-link-table-instances-api.d.ts +2 -1
  37. package/dist/dts/workspace-elements/api/data-sources-api.d.ts +4 -2
  38. package/dist/dts/workspace-elements/api/external-api-logs-api.d.ts +1 -0
  39. package/dist/dts/workspace-elements/api/external-event-log-records-api.d.ts +1 -0
  40. package/dist/dts/workspace-elements/api/external-event-pulls-api.d.ts +1 -0
  41. package/dist/dts/workspace-elements/api/external-event-subscriptions-api.d.ts +1 -0
  42. package/dist/dts/workspace-elements/api/field-mapping-instances-api.d.ts +1 -1
  43. package/dist/dts/workspace-elements/api/field-mappings-api.d.ts +3 -1
  44. package/dist/dts/workspace-elements/api/flow-runs-api.d.ts +2 -0
  45. package/dist/dts/workspace-elements/api/flows-api.d.ts +3 -1
  46. package/dist/dts/workspace-elements/api/incoming-webhooks-api.d.ts +1 -0
  47. package/dist/dts/workspace-elements/api/integrations-api.d.ts +1 -0
  48. package/dist/dts/workspace-elements/base/actions/index.d.ts +2 -2
  49. package/dist/dts/workspace-elements/base/connection-requests/index.d.ts +2 -0
  50. package/dist/dts/workspace-elements/base/connections/index.d.ts +3 -0
  51. package/dist/dts/workspace-elements/base/connectors/auth.d.ts +1 -1
  52. package/dist/dts/workspace-elements/base/connectors/functions.d.ts +1 -1
  53. package/dist/dts/workspace-elements/base/connectors/operations/handlers.d.ts +1 -1
  54. package/dist/dts/workspace-elements/base/data-collections/data-locations/collections/events/methods.d.ts +1 -1
  55. package/dist/dts/workspace-elements/base/data-collections/schemas.d.ts +1 -1
  56. package/dist/dts/workspace-elements/base/data-collections/udm/index.d.ts +1 -1
  57. package/dist/dts/workspace-elements/base/data-collections/utils.d.ts +1 -1
  58. package/dist/dts/workspace-elements-catalog/index.d.ts +1 -0
  59. package/dist/dts/workspaces/compare.d.ts +1 -1
  60. package/dist/index.browser.d.mts +733 -691
  61. package/dist/index.browser.d.ts +733 -691
  62. package/dist/index.browser.js +1157 -1113
  63. package/dist/index.browser.js.map +1 -1
  64. package/dist/index.browser.mjs +1132 -1114
  65. package/dist/index.browser.mjs.map +1 -1
  66. package/dist/index.node.d.mts +733 -691
  67. package/dist/index.node.d.ts +733 -691
  68. package/dist/index.node.js +1157 -1113
  69. package/dist/index.node.js.map +1 -1
  70. package/dist/index.node.mjs +1132 -1114
  71. package/dist/index.node.mjs.map +1 -1
  72. package/package.json +1 -1
@@ -3955,6 +3955,7 @@ const CreateConnectionRequestPayload = z.z.object({
3955
3955
  integrationId: z.z.string().optional(),
3956
3956
  integrationKey: z.z.string().optional(),
3957
3957
  connectorId: z.z.string().optional(),
3958
+ connectorKey: z.z.string().optional(),
3958
3959
  connectorVersion: z.z.string().optional(),
3959
3960
  connectionId: z.z.string().optional(),
3960
3961
  name: z.z.string().optional(),
@@ -3968,6 +3969,7 @@ const ConnectionRequest = z.z.object({
3968
3969
  integrationId: z.z.string().optional(),
3969
3970
  integrationKey: z.z.string().optional(),
3970
3971
  connectorId: z.z.string().optional(),
3972
+ connectorKey: z.z.string().optional(),
3971
3973
  connectorVersion: z.z.string().optional(),
3972
3974
  connectionId: z.z.string().optional(),
3973
3975
  name: z.z.string().optional(),
@@ -3985,6 +3987,8 @@ const ConnectionEditableProperties = z.z.object({
3985
3987
  name: z.z.string().optional(),
3986
3988
  meta: z.z.record(z.z.string(), z.z.any()).optional(),
3987
3989
  authOptionKey: z.z.string().optional(),
3990
+ externalAppId: z.z.string().optional(),
3991
+ externalAppUuid: z.z.string().optional(),
3988
3992
  credentials: z.z.unknown().optional(),
3989
3993
  connectorParameters: z.z.unknown().optional(),
3990
3994
  input: z.z.unknown().optional(),
@@ -3999,6 +4003,7 @@ const BaseConnection = BaseWorkspaceElement.extend({
3999
4003
  error: ErrorDataSchema.optional(),
4000
4004
  integrationId: z.z.string().optional(),
4001
4005
  connectorId: z.z.string().optional(),
4006
+ externalAppId: z.z.string().optional(),
4002
4007
  connectorVersion: z.z.string().optional(),
4003
4008
  authOptionKey: z.z.string().optional(),
4004
4009
  createdAt: z.z.string(),
@@ -4019,6 +4024,97 @@ class ConnectionSpec {
4019
4024
  }
4020
4025
  }
4021
4026
 
4027
+ exports.FunctionType = void 0;
4028
+ (function (FunctionType) {
4029
+ FunctionType["mapping"] = "mapping";
4030
+ FunctionType["operationMapping"] = "operation-mapping";
4031
+ FunctionType["restApiMapping"] = "rest-api-mapping";
4032
+ FunctionType["graphqlApiMapping"] = "graphql-api-mapping";
4033
+ FunctionType["javascript"] = "javascript";
4034
+ })(exports.FunctionType || (exports.FunctionType = {}));
4035
+ const BaseFunctionDefinition = z.z.object({
4036
+ type: z.z.enum([
4037
+ exports.FunctionType.mapping,
4038
+ exports.FunctionType.operationMapping,
4039
+ exports.FunctionType.restApiMapping,
4040
+ exports.FunctionType.graphqlApiMapping,
4041
+ exports.FunctionType.javascript,
4042
+ ]),
4043
+ });
4044
+ const GenericFunctionDefinition = z.z
4045
+ .object({
4046
+ type: z.z.enum(['mapping', 'operation-mapping', 'rest-api-mapping', 'graphql-api-mapping', 'javascript']).optional(),
4047
+ })
4048
+ .loose();
4049
+
4050
+ const GraphQLFieldMappingSchema = z.z.lazy(() => z.z.object({
4051
+ field: z.z.string(),
4052
+ args: z.z.record(z.z.string(), z.z.any()).optional(),
4053
+ subFields: z.z.array(GraphQLFieldMappingSchema).optional(),
4054
+ }));
4055
+ const GraphQLApiMappingSchema = z.z.object({
4056
+ path: z.z.string(),
4057
+ operationType: z.z.enum(['query', 'mutation']),
4058
+ requestMapping: z.z.array(GraphQLFieldMappingSchema),
4059
+ responseMapping: z.z.any().optional(),
4060
+ });
4061
+ const GraphqlApiMappingFunction = z.z.object({
4062
+ type: z.z.literal(exports.FunctionType.graphqlApiMapping),
4063
+ mapping: GraphQLApiMappingSchema,
4064
+ });
4065
+
4066
+ const JavascriptFunction = z.z.object({
4067
+ type: z.z.literal(exports.FunctionType.javascript),
4068
+ code: z.z.string(),
4069
+ });
4070
+
4071
+ const MappingSchema = z.z.any();
4072
+ const MappingFunction = z.z.object({
4073
+ type: z.z.literal(exports.FunctionType.mapping),
4074
+ mapping: MappingSchema,
4075
+ });
4076
+
4077
+ const OperationMappingSchema = z.z.object({
4078
+ operationKey: z.z.string(),
4079
+ inputMapping: z.z.any().optional(),
4080
+ outputMapping: z.z.any().optional(),
4081
+ });
4082
+ const OperationMappingFunction = z.z.object({
4083
+ type: z.z.literal(exports.FunctionType.operationMapping),
4084
+ mapping: OperationMappingSchema,
4085
+ });
4086
+
4087
+ const RequestMappingSchema = z.z.object({
4088
+ pathParameters: z.z.any().optional(),
4089
+ query: z.z.any().optional(),
4090
+ data: z.z.any().optional(),
4091
+ headers: z.z.any().optional(),
4092
+ });
4093
+ const RestApiMappingSchema = z.z.object({
4094
+ path: z.z.string(),
4095
+ method: z.z.string(),
4096
+ requestMapping: RequestMappingSchema,
4097
+ responseMapping: z.z.any().optional(),
4098
+ });
4099
+ const OpenapiMappingSchema = z.z.object({
4100
+ path: z.z.string(),
4101
+ method: z.z.string(),
4102
+ requestMapping: RequestMappingSchema,
4103
+ responseMapping: z.z.any().optional(),
4104
+ });
4105
+ const RestApiMappingFunction = z.z.object({
4106
+ type: z.z.literal(exports.FunctionType.restApiMapping),
4107
+ mapping: RestApiMappingSchema,
4108
+ });
4109
+
4110
+ const FunctionDefinition = z.z.union([
4111
+ MappingFunction,
4112
+ OperationMappingFunction,
4113
+ RestApiMappingFunction,
4114
+ GraphqlApiMappingFunction,
4115
+ JavascriptFunction,
4116
+ ]);
4117
+
4022
4118
  exports.ConnectorMethodImplementationType = void 0;
4023
4119
  (function (ConnectorMethodImplementationType) {
4024
4120
  ConnectorMethodImplementationType["mapping"] = "mapping";
@@ -4415,97 +4511,6 @@ const REST_API_CLIENT_SCHEMA$1 = {
4415
4511
  },
4416
4512
  };
4417
4513
 
4418
- exports.FunctionType = void 0;
4419
- (function (FunctionType) {
4420
- FunctionType["mapping"] = "mapping";
4421
- FunctionType["operationMapping"] = "operation-mapping";
4422
- FunctionType["restApiMapping"] = "rest-api-mapping";
4423
- FunctionType["graphqlApiMapping"] = "graphql-api-mapping";
4424
- FunctionType["javascript"] = "javascript";
4425
- })(exports.FunctionType || (exports.FunctionType = {}));
4426
- const BaseFunctionDefinition = z.z.object({
4427
- type: z.z.enum([
4428
- exports.FunctionType.mapping,
4429
- exports.FunctionType.operationMapping,
4430
- exports.FunctionType.restApiMapping,
4431
- exports.FunctionType.graphqlApiMapping,
4432
- exports.FunctionType.javascript,
4433
- ]),
4434
- });
4435
- const GenericFunctionDefinition = z.z
4436
- .object({
4437
- type: z.z.enum(['mapping', 'operation-mapping', 'rest-api-mapping', 'graphql-api-mapping', 'javascript']).optional(),
4438
- })
4439
- .loose();
4440
-
4441
- const GraphQLFieldMappingSchema = z.z.lazy(() => z.z.object({
4442
- field: z.z.string(),
4443
- args: z.z.record(z.z.string(), z.z.any()).optional(),
4444
- subFields: z.z.array(GraphQLFieldMappingSchema).optional(),
4445
- }));
4446
- const GraphQLApiMappingSchema = z.z.object({
4447
- path: z.z.string(),
4448
- operationType: z.z.enum(['query', 'mutation']),
4449
- requestMapping: z.z.array(GraphQLFieldMappingSchema),
4450
- responseMapping: z.z.any().optional(),
4451
- });
4452
- const GraphqlApiMappingFunction = z.z.object({
4453
- type: z.z.literal(exports.FunctionType.graphqlApiMapping),
4454
- mapping: GraphQLApiMappingSchema,
4455
- });
4456
-
4457
- const JavascriptFunction = z.z.object({
4458
- type: z.z.literal(exports.FunctionType.javascript),
4459
- code: z.z.string(),
4460
- });
4461
-
4462
- const MappingSchema = z.z.any();
4463
- const MappingFunction = z.z.object({
4464
- type: z.z.literal(exports.FunctionType.mapping),
4465
- mapping: MappingSchema,
4466
- });
4467
-
4468
- const OperationMappingSchema = z.z.object({
4469
- operationKey: z.z.string(),
4470
- inputMapping: z.z.any().optional(),
4471
- outputMapping: z.z.any().optional(),
4472
- });
4473
- const OperationMappingFunction = z.z.object({
4474
- type: z.z.literal(exports.FunctionType.operationMapping),
4475
- mapping: OperationMappingSchema,
4476
- });
4477
-
4478
- const RequestMappingSchema = z.z.object({
4479
- pathParameters: z.z.any().optional(),
4480
- query: z.z.any().optional(),
4481
- data: z.z.any().optional(),
4482
- headers: z.z.any().optional(),
4483
- });
4484
- const RestApiMappingSchema = z.z.object({
4485
- path: z.z.string(),
4486
- method: z.z.string(),
4487
- requestMapping: RequestMappingSchema,
4488
- responseMapping: z.z.any().optional(),
4489
- });
4490
- const OpenapiMappingSchema = z.z.object({
4491
- path: z.z.string(),
4492
- method: z.z.string(),
4493
- requestMapping: RequestMappingSchema,
4494
- responseMapping: z.z.any().optional(),
4495
- });
4496
- const RestApiMappingFunction = z.z.object({
4497
- type: z.z.literal(exports.FunctionType.restApiMapping),
4498
- mapping: RestApiMappingSchema,
4499
- });
4500
-
4501
- const FunctionDefinition = z.z.union([
4502
- MappingFunction,
4503
- OperationMappingFunction,
4504
- RestApiMappingFunction,
4505
- GraphqlApiMappingFunction,
4506
- JavascriptFunction,
4507
- ]);
4508
-
4509
4514
  const CONNECTOR_DATA_DIR = 'data';
4510
4515
  const CONNECTOR_OPERATIONS_DIR = 'operations';
4511
4516
  const CONNECTOR_DOCS_DIR = 'docs';
@@ -4681,369 +4686,528 @@ exports.DataCollectionEventType = void 0;
4681
4686
  DataCollectionEventType["DELETED"] = "deleted";
4682
4687
  })(exports.DataCollectionEventType || (exports.DataCollectionEventType = {}));
4683
4688
 
4684
- const DataLocationMethodImplementationTypes = [
4685
- exports.ConnectorMethodImplementationType.operationMapping,
4686
- exports.ConnectorMethodImplementationType.restApiMapping,
4687
- exports.ConnectorMethodImplementationType.graphqlApiMapping,
4688
- exports.ConnectorMethodImplementationType.javascript,
4689
- exports.ConnectorMethodImplementationType.notSupported,
4690
- ];
4689
+ const structuredClone$1 = (structuredClonePolyfill === null || structuredClonePolyfill === void 0 ? void 0 : structuredClonePolyfill.default) || structuredClonePolyfill;
4690
+ function isNil(value) {
4691
+ return value == null;
4692
+ }
4693
+ function omitBy(obj, check) {
4694
+ obj = { ...obj };
4695
+ Object.entries(obj).forEach(([key, value]) => check(value) && delete obj[key]);
4696
+ return obj;
4697
+ }
4698
+ function isEmptyValue(value) {
4699
+ if (isNil(value)) {
4700
+ return true;
4701
+ }
4702
+ if (typeof value === 'symbol') {
4703
+ return true;
4704
+ }
4705
+ if (typeof value === 'boolean') {
4706
+ return false;
4707
+ }
4708
+ if (typeof value === 'number') {
4709
+ return isNaN(value);
4710
+ }
4711
+ if (typeof value === 'string') {
4712
+ return value.trim().length === 0;
4713
+ }
4714
+ const tag = value.toString();
4715
+ if (tag === '[object Map]' || tag === '[object Set]') {
4716
+ return !value.size;
4717
+ }
4718
+ return typeof value === 'object' && Object.keys(value).length === 0;
4719
+ }
4720
+ const simpleUniqueId = () => {
4721
+ return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)
4722
+ .toString(36)
4723
+ .padStart(11, '0')
4724
+ .substring(0, 11);
4725
+ };
4691
4726
 
4692
- const DataCollectionMethodCreate = {
4693
- name: 'Create',
4694
- description: 'Create a new data record in the collection',
4695
- getConfigSchema: ({ collectionSpec }) => {
4696
- var _a, _b;
4697
- const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
4698
- return {
4699
- type: 'object',
4700
- properties: {
4701
- fields: {
4702
- type: 'array',
4703
- items: { type: 'string', enum: fields },
4704
- },
4705
- excludedFields: {
4706
- type: 'array',
4707
- items: { type: 'string', enum: fields },
4708
- },
4709
- },
4710
- };
4711
- },
4712
- getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
4713
- var _a;
4714
- let fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
4715
- if (method === null || method === void 0 ? void 0 : method.fields) {
4716
- fieldsSchema = pickFieldsFromSchema(fieldsSchema, method.fields);
4717
- }
4718
- if (method === null || method === void 0 ? void 0 : method.excludedFields) {
4719
- fieldsSchema = excludeFieldsFromSchema(fieldsSchema, method.excludedFields);
4727
+ function getDataLocationMethodPath(locationKey, methodKey) {
4728
+ return `data/${locationKey}/${jsConvertCase.toKebabCase(methodKey)}`;
4729
+ }
4730
+ function dataLocationParametersMatch({ locationParameters, targetParameters, }) {
4731
+ targetParameters = typeof targetParameters === 'object' && targetParameters ? targetParameters : {};
4732
+ locationParameters = typeof locationParameters === 'object' && locationParameters ? locationParameters : {};
4733
+ for (const [key, value] of Object.entries(targetParameters)) {
4734
+ if (locationParameters[key] !== value) {
4735
+ return false;
4736
+ }
4737
+ }
4738
+ return true;
4739
+ }
4740
+ function parseDataLocationPath(path) {
4741
+ if (!path) {
4742
+ return undefined;
4743
+ }
4744
+ if (path.startsWith('/')) {
4745
+ path = path.slice(1);
4746
+ }
4747
+ if (!path.startsWith('data/')) {
4748
+ throw new Error(`Invalid data location path: ${path}. It should start with "data/"`);
4749
+ }
4750
+ path = path.slice(5);
4751
+ const [key, query] = path.split('?');
4752
+ const parameters = Object.fromEntries(new URLSearchParams(query).entries());
4753
+ return { key, parameters };
4754
+ }
4755
+ function makeDataLocationPath(pointer) {
4756
+ var _a;
4757
+ const normalizedPointer = normalizePointer(pointer);
4758
+ if (normalizedPointer === null || normalizedPointer === void 0 ? void 0 : normalizedPointer.key) {
4759
+ let path = `/data/${normalizedPointer.key}`;
4760
+ const parameters = omitBy((_a = normalizedPointer.parameters) !== null && _a !== void 0 ? _a : {}, isNil);
4761
+ if (Object.keys(parameters).length > 0) {
4762
+ path += `?${new URLSearchParams(parameters).toString()}`;
4720
4763
  }
4764
+ return path;
4765
+ }
4766
+ else {
4767
+ return undefined;
4768
+ }
4769
+ }
4770
+ function normalizePointer(pointer) {
4771
+ if (typeof pointer === 'string' && pointer.startsWith('/data/')) {
4721
4772
  return {
4722
- type: 'object',
4723
- properties: nonEmptyObjectProperties({
4724
- fields: (_a = transformVariablesWith(fieldsSchema, (locator) => `fields.${locatorToField(locator)}`)) !== null && _a !== void 0 ? _a : {
4725
- type: 'object',
4726
- },
4727
- credentials: credentialsSchema,
4728
- }),
4773
+ key: pointer.slice(6),
4729
4774
  };
4730
- },
4731
- getOutputSchema: ({}) => ({
4732
- type: 'object',
4733
- properties: {
4734
- id: { type: 'string' },
4735
- },
4736
- }),
4737
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4738
- };
4775
+ }
4776
+ return pointer;
4777
+ }
4778
+ function makeDataLocationOperationPath(collectionPath, operation) {
4779
+ const [path, query] = (collectionPath !== null && collectionPath !== void 0 ? collectionPath : '').split('?');
4780
+ return urljoin(path, operation, query ? `?${query}` : '');
4781
+ }
4782
+ function isSameDataLocation(location1, location2) {
4783
+ if (location1.key !== location2.key) {
4784
+ return false;
4785
+ }
4786
+ const cleanParameters1 = location1.parameters && Object.keys(location1.parameters).length > 0 ? location1.parameters : undefined;
4787
+ const cleanParameters2 = location2.parameters && Object.keys(location2.parameters).length > 0 ? location2.parameters : undefined;
4788
+ if (!deepEqual(cleanParameters1, cleanParameters2)) {
4789
+ return false;
4790
+ }
4791
+ return true;
4792
+ }
4793
+ function isDataLocationMethodSupported(location, methodKey) {
4794
+ var _a;
4795
+ const method = (_a = location === null || location === void 0 ? void 0 : location.methods) === null || _a === void 0 ? void 0 : _a[methodKey];
4796
+ return method && method.implementationType !== exports.ConnectorMethodImplementationType.notSupported;
4797
+ }
4798
+ function getDataCollectionCreateFields(spec) {
4799
+ if (!spec)
4800
+ return undefined;
4801
+ if (!spec.fieldsSchema)
4802
+ return undefined;
4803
+ if (!spec.create)
4804
+ return undefined;
4805
+ let schema = excludeReadOnlyFieldsFromSchema(spec.fieldsSchema);
4806
+ if (spec.create.fields) {
4807
+ schema = pickFieldsFromSchema(schema, spec.create.fields);
4808
+ }
4809
+ if (spec.create.excludedFields) {
4810
+ schema = excludeFieldsFromSchema(schema, spec.create.excludedFields);
4811
+ }
4812
+ return schema;
4813
+ }
4814
+ function getDataCollectionUpdateFields(spec) {
4815
+ if (!spec)
4816
+ return undefined;
4817
+ if (!spec.fieldsSchema)
4818
+ return undefined;
4819
+ if (!spec.update)
4820
+ return undefined;
4821
+ let schema = excludeReadOnlyFieldsFromSchema(spec.fieldsSchema);
4822
+ if (spec.update.fields) {
4823
+ schema = pickFieldsFromSchema(schema, spec.update.fields);
4824
+ }
4825
+ if (spec.update.excludedFields) {
4826
+ schema = excludeFieldsFromSchema(schema, spec.update.excludedFields);
4827
+ }
4828
+ return schema;
4829
+ }
4830
+ function getWritableFieldsSchema(spec) {
4831
+ if (!spec)
4832
+ return undefined;
4833
+ if (!spec.fieldsSchema)
4834
+ return undefined;
4835
+ return mergeSchemas([getDataCollectionCreateFields(spec), getDataCollectionUpdateFields(spec)]);
4836
+ }
4837
+ function getReferenceCollectionPointerForSchema(schema) {
4838
+ if ((schema === null || schema === void 0 ? void 0 : schema.referenceCollection) && schema.referenceCollection.key) {
4839
+ return schema.referenceCollection;
4840
+ }
4841
+ else if (schema === null || schema === void 0 ? void 0 : schema.referenceCollectionPath) {
4842
+ return parseDataLocationPath(schema.referenceCollectionPath);
4843
+ }
4844
+ else if (schema === null || schema === void 0 ? void 0 : schema.referenceCollectionUri) {
4845
+ return parseDataLocationPath(schema.referenceCollectionUri);
4846
+ }
4847
+ else {
4848
+ return undefined;
4849
+ }
4850
+ }
4851
+ function getReferenceCollectionPathForSchema(schema) {
4852
+ const pointer = getReferenceCollectionPointerForSchema(schema);
4853
+ return makeDataLocationPath(pointer);
4854
+ }
4739
4855
 
4740
- const DataCollectionMethodDelete = {
4741
- name: 'Delete',
4742
- description: 'Delete a data record from the collection by id',
4743
- getInputSchema: ({ collectionHandler, parameters, credentialsSchema }) => {
4744
- return {
4745
- type: 'object',
4746
- properties: nonEmptyObjectProperties({
4747
- id: {
4748
- type: 'string',
4749
- referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
4856
+ const FIELDS_SCHEMA$G = {
4857
+ type: 'object',
4858
+ properties: {
4859
+ id: { type: 'string', readOnly: true },
4860
+ title: { type: 'string' },
4861
+ description: { type: 'string' },
4862
+ type: { type: 'string' },
4863
+ durationSeconds: { type: 'number' },
4864
+ location: { type: 'string' },
4865
+ isRecurrent: { type: 'boolean' },
4866
+ participants: {
4867
+ type: 'array',
4868
+ items: {
4869
+ type: 'object',
4870
+ properties: {
4871
+ userId: { type: 'string' },
4872
+ contactId: { type: 'string' },
4750
4873
  },
4751
- credentials: credentialsSchema,
4752
- }),
4753
- };
4874
+ },
4875
+ },
4876
+ status: { type: 'string' },
4877
+ contactId: {
4878
+ type: 'string',
4879
+ referenceUdm: 'contacts',
4880
+ },
4881
+ companyId: {
4882
+ type: 'string',
4883
+ referenceUdm: 'companies',
4884
+ },
4885
+ dealId: {
4886
+ type: 'string',
4887
+ referenceUdm: 'deals',
4888
+ },
4889
+ leadId: {
4890
+ type: 'string',
4891
+ referenceUdm: 'leads',
4892
+ },
4893
+ ownerId: {
4894
+ type: 'string',
4895
+ referenceUdm: 'users',
4896
+ },
4897
+ startTime: {
4898
+ type: 'string',
4899
+ format: 'date-time',
4900
+ },
4901
+ endTime: {
4902
+ type: 'string',
4903
+ format: 'date-time',
4904
+ },
4905
+ dueTime: {
4906
+ type: 'string',
4907
+ format: 'date-time',
4908
+ },
4909
+ createdTime: {
4910
+ type: 'string',
4911
+ format: 'date-time',
4912
+ readOnly: true,
4913
+ },
4914
+ createdBy: {
4915
+ type: 'string',
4916
+ referenceUdm: 'users',
4917
+ readOnly: true,
4918
+ },
4919
+ updatedTime: {
4920
+ type: 'string',
4921
+ format: 'date-time',
4922
+ readOnly: true,
4923
+ },
4924
+ updatedBy: {
4925
+ type: 'string',
4926
+ referenceUdm: 'users',
4927
+ readOnly: true,
4928
+ },
4754
4929
  },
4755
- getOutputSchema: () => null,
4756
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4757
4930
  };
4758
-
4759
- const DataCollectionMethodFind = {
4760
- isDeprecated: true,
4761
- name: 'Find',
4762
- description: 'Find a list of data records in the collection',
4763
- getConfigSchema: ({ collectionSpec }) => {
4764
- var _a, _b;
4765
- const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
4766
- return {
4767
- type: 'object',
4768
- properties: {
4769
- queryFields: {
4770
- type: 'array',
4771
- items: { type: 'string', enum: fields },
4772
- },
4773
- },
4774
- };
4931
+ const FallbackFieldsMap = {
4932
+ fromActivitiesToTasks: {
4933
+ subject: {
4934
+ $var: 'title',
4935
+ },
4936
+ content: {
4937
+ $var: 'description',
4938
+ },
4775
4939
  },
4776
- getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
4777
- const queryFieldsSchema = pickFieldsFromSchema(collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema, method === null || method === void 0 ? void 0 : method.queryFields);
4778
- const schema = {
4779
- type: 'object',
4780
- properties: nonEmptyObjectProperties({
4781
- cursor: { type: 'string' },
4782
- credentials: credentialsSchema,
4783
- }),
4784
- };
4785
- if (queryFieldsSchema === null || queryFieldsSchema === void 0 ? void 0 : queryFieldsSchema.properties) {
4786
- schema.properties = {
4787
- ...schema.properties,
4788
- query: transformVariablesWith(queryFieldsSchema, (locator) => `query.${locatorToField(locator)}`),
4789
- };
4790
- }
4791
- return schema;
4940
+ fromTasksToActivities: {
4941
+ title: {
4942
+ $var: 'subject',
4943
+ },
4944
+ description: {
4945
+ $var: 'content',
4946
+ },
4792
4947
  },
4793
- getOutputSchema: ({ collectionSpec }) => {
4794
- var _a;
4795
- return ({
4796
- type: 'object',
4797
- properties: {
4798
- records: {
4799
- type: 'array',
4800
- items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
4801
- },
4802
- cursor: {
4803
- type: 'string',
4804
- },
4805
- },
4806
- });
4948
+ fromActivitiesToNotes: {
4949
+ content: {
4950
+ $var: 'description',
4951
+ },
4952
+ },
4953
+ fromNotesToActivities: {
4954
+ description: {
4955
+ $var: 'content',
4956
+ },
4957
+ },
4958
+ fromActivitiesToEmails: {
4959
+ subject: {
4960
+ $var: 'title',
4961
+ },
4962
+ body: {
4963
+ $var: 'description',
4964
+ },
4965
+ },
4966
+ fromEmailsToActivities: {
4967
+ title: {
4968
+ $var: 'subject',
4969
+ },
4970
+ description: {
4971
+ $var: 'body',
4972
+ },
4807
4973
  },
4808
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4809
4974
  };
4810
-
4811
- const DataCollectionMethodFindById = {
4812
- name: 'Find by ID',
4813
- description: 'Find a single data record in the collection by its id',
4814
- getInputSchema: ({ collectionHandler, parameters, credentialsSchema }) => ({
4815
- type: 'object',
4816
- properties: nonEmptyObjectProperties({
4817
- id: {
4818
- type: 'string',
4819
- referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
4820
- },
4821
- credentials: credentialsSchema,
4822
- }),
4823
- }),
4824
- getOutputSchema: ({ collectionSpec }) => {
4825
- var _a;
4826
- return ({
4827
- type: 'object',
4828
- properties: {
4829
- record: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
4830
- },
4831
- });
4975
+ const udm$G = {
4976
+ singularName: 'activity',
4977
+ pluralName: 'activities',
4978
+ fieldsSchema: FIELDS_SCHEMA$G,
4979
+ list: {
4980
+ filterFields: ['type', 'companyId', 'contactId', 'dealId', 'leadId', 'ownerId'],
4832
4981
  },
4833
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4982
+ match: {
4983
+ fields: ['type', 'companyId', 'contactId', 'dealId', 'leadId', 'ownerId'],
4984
+ },
4985
+ populateFields,
4986
+ udmFallbacks: [
4987
+ {
4988
+ udm: 'tasks',
4989
+ importFields: FallbackFieldsMap.fromTasksToActivities,
4990
+ exportFields: FallbackFieldsMap.fromActivitiesToTasks,
4991
+ },
4992
+ {
4993
+ udm: 'meetings',
4994
+ },
4995
+ {
4996
+ udm: 'notes',
4997
+ importFields: FallbackFieldsMap.fromNotesToActivities,
4998
+ exportFields: FallbackFieldsMap.fromActivitiesToNotes,
4999
+ },
5000
+ {
5001
+ udm: 'emails',
5002
+ importFields: FallbackFieldsMap.fromEmailsToActivities,
5003
+ exportFields: FallbackFieldsMap.fromActivitiesToEmails,
5004
+ },
5005
+ ],
4834
5006
  };
5007
+ function populateFields(fields) {
5008
+ const result = JSON.parse(JSON.stringify(fields));
5009
+ if (!result.dueTime) {
5010
+ result.dueTime = result.endTime || result.startTime;
5011
+ }
5012
+ if (!result.startTime) {
5013
+ result.startTime = result.dueTime || result.endTime;
5014
+ }
5015
+ if (!result.endTime) {
5016
+ result.endTime = result.dueTime || result.startTime;
5017
+ }
5018
+ return result;
5019
+ }
4835
5020
 
4836
- const DataCollectionMethodList = {
4837
- name: 'List',
4838
- description: 'Return all data records from the collection',
4839
- getConfigSchema: ({ collectionSpec }) => {
4840
- var _a, _b;
4841
- const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
4842
- return {
4843
- type: 'object',
4844
- properties: {
4845
- filterFields: {
4846
- type: 'array',
4847
- items: { type: 'string', enum: fields },
5021
+ const FIELDS_SCHEMA$F = {
5022
+ type: 'object',
5023
+ properties: {
5024
+ id: { type: 'string', readOnly: true },
5025
+ number: { type: 'string' },
5026
+ name: { type: 'string' },
5027
+ memo: { type: 'string' },
5028
+ status: { type: 'string' },
5029
+ paymentMethod: { type: 'string' },
5030
+ supplierId: { type: 'string', referenceUdm: 'suppliers' },
5031
+ currency: { type: 'string' },
5032
+ payments: {
5033
+ type: 'array',
5034
+ items: {
5035
+ type: 'string',
5036
+ referenceUdm: 'payments',
5037
+ },
5038
+ },
5039
+ lineItems: {
5040
+ type: 'array',
5041
+ items: {
5042
+ type: 'object',
5043
+ properties: {
5044
+ id: { type: 'string' },
5045
+ itemName: { type: 'string' },
5046
+ description: { type: 'string' },
5047
+ code: { type: 'string' },
5048
+ type: { type: 'string' },
5049
+ companyId: { type: 'string', referenceUdm: 'companies' },
5050
+ ledgerAccountId: { type: 'string', referenceUdm: 'ledger-accounts' },
5051
+ quantity: { type: 'number' },
5052
+ unitPrice: { type: 'number' },
5053
+ unitOfMeasure: { type: 'string' },
5054
+ purchasePrice: { type: 'number' },
5055
+ salesPrice: { type: 'number' },
5056
+ taxable: { type: 'boolean' },
5057
+ taxAmount: { type: 'number' },
5058
+ totalAmount: { type: 'number' },
4848
5059
  },
4849
5060
  },
4850
- };
5061
+ },
5062
+ totalAmount: { type: 'number' },
5063
+ totalTax: { type: 'number' },
5064
+ exchangeRate: { type: 'number' },
5065
+ totalDiscount: { type: 'number' },
5066
+ subTotal: { type: 'number' },
5067
+ balance: { type: 'number' },
5068
+ ledgerAccountId: { type: 'string', referenceUdm: 'ledger-accounts' },
5069
+ issueDate: {
5070
+ type: 'string',
5071
+ format: 'date-time',
5072
+ },
5073
+ dueDate: {
5074
+ type: 'string',
5075
+ format: 'date-time',
5076
+ },
5077
+ paidOnDate: {
5078
+ type: 'string',
5079
+ format: 'date-time',
5080
+ },
5081
+ createdTime: { type: 'string', format: 'date-time', readOnly: true },
5082
+ createdBy: { type: 'string', referenceUdm: 'users', readOnly: true },
5083
+ updatedTime: { type: 'string', format: 'date-time', readOnly: true },
5084
+ updatedBy: { type: 'string', referenceUdm: 'users', readOnly: true },
4851
5085
  },
4852
- getInputSchema: ({ method, collectionSpec, credentialsSchema }) => {
4853
- const fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
4854
- let filterSchema;
4855
- if (method === null || method === void 0 ? void 0 : method.filterFields) {
4856
- filterSchema = pickFieldsFromSchema(fieldsSchema, method.filterFields);
4857
- }
4858
- return {
4859
- type: 'object',
4860
- properties: nonEmptyObjectProperties({
4861
- filter: filterSchema,
4862
- cursor: {
4863
- type: 'string',
4864
- description: 'Cursor returned in response to the previous "list" request',
4865
- },
4866
- credentials: credentialsSchema,
4867
- }),
4868
- };
5086
+ };
5087
+ const udm$F = {
5088
+ singularName: 'bill',
5089
+ pluralName: 'bills',
5090
+ fieldsSchema: FIELDS_SCHEMA$F,
5091
+ list: {
5092
+ filterFields: ['name', 'number', 'status', 'supplierId'],
4869
5093
  },
4870
- getOutputSchema: ({ collectionSpec }) => {
4871
- var _a;
4872
- return ({
4873
- type: 'object',
4874
- properties: {
4875
- records: {
4876
- type: 'array',
4877
- items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
4878
- },
4879
- cursor: {
4880
- type: 'string',
4881
- description: 'Cursor to request the next page of results',
4882
- },
4883
- },
4884
- });
5094
+ match: {
5095
+ fields: ['name', 'number', 'status', 'supplierId'],
4885
5096
  },
4886
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4887
5097
  };
4888
5098
 
4889
- const DataCollectionMethodMatch = {
4890
- name: 'Match',
4891
- description: 'Find a single matching record in a data collection by a set of fields',
4892
- getConfigSchema: ({ collectionSpec }) => {
4893
- var _a, _b;
4894
- const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
4895
- return {
4896
- type: 'object',
4897
- properties: {
4898
- fields: {
4899
- type: 'array',
4900
- items: { type: 'string', enum: fields },
4901
- },
4902
- },
4903
- };
4904
- },
4905
- getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
4906
- const fieldsSchema = pickFieldsFromSchema(collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema, method === null || method === void 0 ? void 0 : method.fields);
4907
- return {
4908
- type: 'object',
4909
- properties: nonEmptyObjectProperties({
4910
- query: transformVariablesWith(fieldsSchema !== null && fieldsSchema !== void 0 ? fieldsSchema : {}, (locator) => `query.${locatorToField(locator)}`),
4911
- credentials: credentialsSchema,
4912
- }),
4913
- };
4914
- },
4915
- getOutputSchema: ({ collectionSpec }) => {
4916
- var _a;
4917
- return ({
4918
- type: 'object',
4919
- properties: {
4920
- record: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
4921
- },
4922
- });
4923
- },
4924
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4925
- };
4926
-
4927
- const DataCollectionMethodSearch = {
4928
- name: 'Search',
4929
- description: 'Find data records in a collection by a string query',
4930
- getInputSchema: ({ credentialsSchema }) => ({
4931
- type: 'object',
4932
- properties: nonEmptyObjectProperties({
4933
- query: { type: 'string' },
4934
- cursor: { type: 'string' },
4935
- credentials: credentialsSchema,
4936
- }),
4937
- }),
4938
- getOutputSchema: ({ collectionSpec }) => {
4939
- var _a;
4940
- return ({
4941
- type: 'object',
4942
- properties: {
4943
- records: {
4944
- type: 'array',
4945
- items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
4946
- },
4947
- cursor: { type: 'string' },
4948
- },
4949
- });
5099
+ const FIELDS_SCHEMA$E = {
5100
+ type: 'object',
5101
+ properties: {
5102
+ id: { type: 'string', readOnly: true },
5103
+ fullName: { type: 'string' },
5104
+ firstName: { type: 'string' },
5105
+ lastName: { type: 'string' },
5106
+ primaryEmail: { type: 'string' },
5107
+ campaignId: {
5108
+ type: 'string',
5109
+ referenceUdm: 'campaigns',
5110
+ },
5111
+ contactId: {
5112
+ type: 'string',
5113
+ referenceUdm: 'contacts',
5114
+ },
5115
+ leadId: {
5116
+ type: 'string',
5117
+ referenceUdm: 'leads',
5118
+ },
5119
+ source: { type: 'string' },
5120
+ status: { type: 'string' },
5121
+ companyId: {
5122
+ type: 'string',
5123
+ referenceUdm: 'companies',
5124
+ },
5125
+ jobTitle: { type: 'string' },
5126
+ hasOptedOutOfEmail: { type: 'boolean' },
5127
+ createdTime: {
5128
+ type: 'string',
5129
+ format: 'date-time',
5130
+ },
5131
+ createdBy: {
5132
+ type: 'string',
5133
+ readOnly: true,
5134
+ referenceUdm: 'users',
5135
+ },
5136
+ updatedTime: {
5137
+ type: 'string',
5138
+ readOnly: true,
5139
+ format: 'date-time',
5140
+ },
5141
+ updatedBy: {
5142
+ type: 'string',
5143
+ readOnly: true,
5144
+ referenceUdm: 'users',
5145
+ },
4950
5146
  },
4951
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
4952
5147
  };
4953
-
4954
- const DataCollectionMethodUpdate = {
4955
- name: 'Update',
4956
- description: 'Update one data record in the collection by its id',
4957
- getConfigSchema: ({ collectionSpec }) => {
4958
- var _a, _b;
4959
- const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
4960
- return {
4961
- type: 'object',
4962
- properties: {
4963
- fields: {
4964
- type: 'array',
4965
- items: { type: 'string', enum: fields },
4966
- },
4967
- excludedFields: {
4968
- type: 'array',
4969
- items: { type: 'string', enum: fields },
4970
- },
4971
- },
4972
- };
5148
+ const udm$E = {
5149
+ singularName: 'campaign-member',
5150
+ pluralName: 'campaign-members',
5151
+ fieldsSchema: FIELDS_SCHEMA$E,
5152
+ list: {
5153
+ filterFields: [
5154
+ 'primaryEmail',
5155
+ 'fullName',
5156
+ 'firstName',
5157
+ 'lastName',
5158
+ 'campaignId',
5159
+ 'contactId',
5160
+ 'leadId',
5161
+ 'companyId',
5162
+ ],
4973
5163
  },
4974
- getInputSchema: ({ collectionSpec, collectionHandler, credentialsSchema, method, parameters }) => {
4975
- var _a;
4976
- let fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
4977
- if (method === null || method === void 0 ? void 0 : method.fields) {
4978
- fieldsSchema = pickFieldsFromSchema(fieldsSchema, method.fields);
4979
- }
4980
- if (method === null || method === void 0 ? void 0 : method.excludedFields) {
4981
- fieldsSchema = excludeFieldsFromSchema(fieldsSchema, method.excludedFields);
4982
- }
4983
- return {
4984
- type: 'object',
4985
- properties: nonEmptyObjectProperties({
4986
- id: {
4987
- type: 'string',
4988
- referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
4989
- },
4990
- fields: (_a = transformVariablesWith(fieldsSchema, (locator) => `fields.${locatorToField(locator)}`)) !== null && _a !== void 0 ? _a : {
4991
- type: 'object',
4992
- },
4993
- credentials: credentialsSchema,
4994
- }),
4995
- };
5164
+ match: {
5165
+ fields: ['primaryEmail', 'fullName', 'firstName', 'lastName', 'campaignId', 'contactId', 'leadId', 'companyId'],
4996
5166
  },
4997
- getOutputSchema: ({}) => ({
4998
- type: 'object',
4999
- properties: {
5000
- id: { type: 'string' },
5001
- },
5002
- }),
5003
- supportedImplementationTypes: DataLocationMethodImplementationTypes,
5004
5167
  };
5005
5168
 
5006
- const FIELDS_SCHEMA$G = {
5169
+ const FIELDS_SCHEMA$D = {
5007
5170
  type: 'object',
5008
5171
  properties: {
5009
5172
  id: { type: 'string', readOnly: true },
5010
- title: { type: 'string' },
5011
- description: { type: 'string' },
5012
- type: { type: 'string' },
5013
- durationSeconds: { type: 'number' },
5014
- location: { type: 'string' },
5015
- isRecurrent: { type: 'boolean' },
5016
- participants: {
5017
- type: 'array',
5018
- items: {
5019
- type: 'object',
5020
- properties: {
5021
- userId: { type: 'string' },
5022
- contactId: { type: 'string' },
5023
- },
5024
- },
5173
+ name: {
5174
+ type: 'string',
5025
5175
  },
5026
- status: { type: 'string' },
5027
- contactId: {
5176
+ cost: {
5177
+ type: 'number',
5178
+ },
5179
+ description: {
5028
5180
  type: 'string',
5029
- referenceUdm: 'contacts',
5030
5181
  },
5031
- companyId: {
5182
+ source: {
5032
5183
  type: 'string',
5033
- referenceUdm: 'companies',
5034
5184
  },
5035
- dealId: {
5185
+ stage: {
5036
5186
  type: 'string',
5037
- referenceUdm: 'deals',
5038
5187
  },
5039
- leadId: {
5188
+ type: {
5040
5189
  type: 'string',
5041
- referenceUdm: 'leads',
5042
5190
  },
5043
5191
  ownerId: {
5044
5192
  type: 'string',
5045
5193
  referenceUdm: 'users',
5046
5194
  },
5195
+ sentCount: {
5196
+ type: 'number',
5197
+ readOnly: true,
5198
+ },
5199
+ replyCount: {
5200
+ type: 'number',
5201
+ readOnly: true,
5202
+ },
5203
+ openCount: {
5204
+ type: 'number',
5205
+ readOnly: true,
5206
+ },
5207
+ clickCount: {
5208
+ type: 'number',
5209
+ readOnly: true,
5210
+ },
5047
5211
  startTime: {
5048
5212
  type: 'string',
5049
5213
  format: 'date-time',
@@ -5052,10 +5216,6 @@ const FIELDS_SCHEMA$G = {
5052
5216
  type: 'string',
5053
5217
  format: 'date-time',
5054
5218
  },
5055
- dueTime: {
5056
- type: 'string',
5057
- format: 'date-time',
5058
- },
5059
5219
  createdTime: {
5060
5220
  type: 'string',
5061
5221
  format: 'date-time',
@@ -5076,477 +5236,167 @@ const FIELDS_SCHEMA$G = {
5076
5236
  referenceUdm: 'users',
5077
5237
  readOnly: true,
5078
5238
  },
5239
+ lastActivityTime: {
5240
+ type: 'string',
5241
+ format: 'date-time',
5242
+ readOnly: true,
5243
+ },
5079
5244
  },
5080
5245
  };
5081
- const FallbackFieldsMap = {
5082
- fromActivitiesToTasks: {
5083
- subject: {
5084
- $var: 'title',
5085
- },
5086
- content: {
5087
- $var: 'description',
5088
- },
5246
+ const MODIFIABLE_FIELDS$2 = ['name', 'description', 'ownerId', 'startTime', 'endTime', 'cost', 'source', 'stage', 'type'];
5247
+ const udm$D = {
5248
+ singularName: 'campaign',
5249
+ pluralName: 'campaigns',
5250
+ fieldsSchema: FIELDS_SCHEMA$D,
5251
+ categories: ['Marketing Automation', 'Sales', 'CRM', 'Ads'],
5252
+ list: {
5253
+ filterFields: ['name', 'source', 'stage', 'type', 'ownerId'],
5089
5254
  },
5090
- fromTasksToActivities: {
5091
- title: {
5092
- $var: 'subject',
5093
- },
5094
- description: {
5095
- $var: 'content',
5096
- },
5255
+ find: {
5256
+ queryFields: ['name', 'source', 'stage', 'type', 'ownerId'],
5097
5257
  },
5098
- fromActivitiesToNotes: {
5099
- content: {
5100
- $var: 'description',
5101
- },
5258
+ match: {
5259
+ fields: ['name', 'source', 'stage', 'type', 'ownerId'],
5102
5260
  },
5103
- fromNotesToActivities: {
5104
- description: {
5105
- $var: 'content',
5106
- },
5107
- },
5108
- fromActivitiesToEmails: {
5109
- subject: {
5110
- $var: 'title',
5111
- },
5112
- body: {
5113
- $var: 'description',
5114
- },
5261
+ create: {
5262
+ fields: MODIFIABLE_FIELDS$2,
5115
5263
  },
5116
- fromEmailsToActivities: {
5117
- title: {
5118
- $var: 'subject',
5119
- },
5120
- description: {
5121
- $var: 'body',
5122
- },
5264
+ update: {
5265
+ fields: MODIFIABLE_FIELDS$2,
5123
5266
  },
5124
5267
  };
5125
- const udm$G = {
5126
- singularName: 'activity',
5127
- pluralName: 'activities',
5128
- fieldsSchema: FIELDS_SCHEMA$G,
5129
- list: {
5130
- filterFields: ['type', 'companyId', 'contactId', 'dealId', 'leadId', 'ownerId'],
5268
+
5269
+ const AddressSchema = {
5270
+ type: 'object',
5271
+ properties: {
5272
+ type: { type: 'string' },
5273
+ full: { type: 'string' },
5274
+ street: { type: 'string' },
5275
+ city: { type: 'string' },
5276
+ state: { type: 'string' },
5277
+ country: { type: 'string' },
5278
+ zip: { type: 'string' },
5131
5279
  },
5132
- match: {
5133
- fields: ['type', 'companyId', 'contactId', 'dealId', 'leadId', 'ownerId'],
5280
+ };
5281
+ const PhoneEmailSchema = {
5282
+ type: 'object',
5283
+ properties: {
5284
+ value: { type: 'string' },
5285
+ type: { type: 'string' },
5134
5286
  },
5135
- populateFields,
5136
- udmFallbacks: [
5137
- {
5138
- udm: 'tasks',
5139
- importFields: FallbackFieldsMap.fromTasksToActivities,
5140
- exportFields: FallbackFieldsMap.fromActivitiesToTasks,
5141
- },
5142
- {
5143
- udm: 'meetings',
5144
- },
5145
- {
5146
- udm: 'notes',
5147
- importFields: FallbackFieldsMap.fromNotesToActivities,
5148
- exportFields: FallbackFieldsMap.fromActivitiesToNotes,
5149
- },
5150
- {
5151
- udm: 'emails',
5152
- importFields: FallbackFieldsMap.fromEmailsToActivities,
5153
- exportFields: FallbackFieldsMap.fromActivitiesToEmails,
5154
- },
5155
- ],
5156
5287
  };
5157
- function populateFields(fields) {
5158
- const result = JSON.parse(JSON.stringify(fields));
5159
- if (!result.dueTime) {
5160
- result.dueTime = result.endTime || result.startTime;
5161
- }
5162
- if (!result.startTime) {
5163
- result.startTime = result.dueTime || result.endTime;
5164
- }
5165
- if (!result.endTime) {
5166
- result.endTime = result.dueTime || result.startTime;
5167
- }
5168
- return result;
5169
- }
5170
5288
 
5171
- const FIELDS_SCHEMA$F = {
5289
+ const FIELDS_SCHEMA$C = {
5172
5290
  type: 'object',
5173
5291
  properties: {
5174
5292
  id: { type: 'string', readOnly: true },
5175
- number: { type: 'string' },
5176
- name: { type: 'string' },
5177
- memo: { type: 'string' },
5178
- status: { type: 'string' },
5179
- paymentMethod: { type: 'string' },
5180
- supplierId: { type: 'string', referenceUdm: 'suppliers' },
5181
- currency: { type: 'string' },
5182
- payments: {
5183
- type: 'array',
5184
- items: {
5185
- type: 'string',
5186
- referenceUdm: 'payments',
5187
- },
5293
+ name: {
5294
+ type: 'string',
5188
5295
  },
5189
- lineItems: {
5296
+ websiteUrl: {
5297
+ type: 'string',
5298
+ },
5299
+ phones: {
5190
5300
  type: 'array',
5191
- items: {
5192
- type: 'object',
5193
- properties: {
5194
- id: { type: 'string' },
5195
- itemName: { type: 'string' },
5196
- description: { type: 'string' },
5197
- code: { type: 'string' },
5198
- type: { type: 'string' },
5199
- companyId: { type: 'string', referenceUdm: 'companies' },
5200
- ledgerAccountId: { type: 'string', referenceUdm: 'ledger-accounts' },
5201
- quantity: { type: 'number' },
5202
- unitPrice: { type: 'number' },
5203
- unitOfMeasure: { type: 'string' },
5204
- purchasePrice: { type: 'number' },
5205
- salesPrice: { type: 'number' },
5206
- taxable: { type: 'boolean' },
5207
- taxAmount: { type: 'number' },
5208
- totalAmount: { type: 'number' },
5209
- },
5210
- },
5301
+ items: PhoneEmailSchema,
5211
5302
  },
5212
- totalAmount: { type: 'number' },
5213
- totalTax: { type: 'number' },
5214
- exchangeRate: { type: 'number' },
5215
- totalDiscount: { type: 'number' },
5216
- subTotal: { type: 'number' },
5217
- balance: { type: 'number' },
5218
- ledgerAccountId: { type: 'string', referenceUdm: 'ledger-accounts' },
5219
- issueDate: {
5303
+ primaryPhone: {
5220
5304
  type: 'string',
5221
- format: 'date-time',
5222
5305
  },
5223
- dueDate: {
5306
+ description: {
5224
5307
  type: 'string',
5225
- format: 'date-time',
5226
5308
  },
5227
- paidOnDate: {
5309
+ currency: {
5228
5310
  type: 'string',
5229
- format: 'date-time',
5230
5311
  },
5231
- createdTime: { type: 'string', format: 'date-time', readOnly: true },
5232
- createdBy: { type: 'string', referenceUdm: 'users', readOnly: true },
5233
- updatedTime: { type: 'string', format: 'date-time', readOnly: true },
5234
- updatedBy: { type: 'string', referenceUdm: 'users', readOnly: true },
5235
- },
5236
- };
5237
- const udm$F = {
5238
- singularName: 'bill',
5239
- pluralName: 'bills',
5240
- fieldsSchema: FIELDS_SCHEMA$F,
5241
- list: {
5242
- filterFields: ['name', 'number', 'status', 'supplierId'],
5243
- },
5244
- match: {
5245
- fields: ['name', 'number', 'status', 'supplierId'],
5246
- },
5247
- };
5248
-
5249
- const FIELDS_SCHEMA$E = {
5250
- type: 'object',
5251
- properties: {
5252
- id: { type: 'string', readOnly: true },
5253
- fullName: { type: 'string' },
5254
- firstName: { type: 'string' },
5255
- lastName: { type: 'string' },
5256
- primaryEmail: { type: 'string' },
5257
- campaignId: {
5312
+ industry: {
5258
5313
  type: 'string',
5259
- referenceUdm: 'campaigns',
5260
5314
  },
5261
- contactId: {
5315
+ ownerId: {
5262
5316
  type: 'string',
5263
- referenceUdm: 'contacts',
5317
+ referenceUdm: 'users',
5264
5318
  },
5265
- leadId: {
5266
- type: 'string',
5267
- referenceUdm: 'leads',
5319
+ primaryAddress: AddressSchema,
5320
+ addresses: {
5321
+ type: 'array',
5322
+ items: AddressSchema,
5268
5323
  },
5269
- source: { type: 'string' },
5270
- status: { type: 'string' },
5271
- companyId: {
5272
- type: 'string',
5273
- referenceUdm: 'companies',
5324
+ numberOfEmployees: {
5325
+ type: 'number',
5274
5326
  },
5275
- jobTitle: { type: 'string' },
5276
- hasOptedOutOfEmail: { type: 'boolean' },
5277
5327
  createdTime: {
5278
5328
  type: 'string',
5279
5329
  format: 'date-time',
5280
5330
  },
5281
5331
  createdBy: {
5282
5332
  type: 'string',
5283
- readOnly: true,
5284
5333
  referenceUdm: 'users',
5334
+ readOnly: true,
5285
5335
  },
5286
5336
  updatedTime: {
5287
5337
  type: 'string',
5288
- readOnly: true,
5289
5338
  format: 'date-time',
5339
+ readOnly: true,
5290
5340
  },
5291
5341
  updatedBy: {
5292
5342
  type: 'string',
5293
- readOnly: true,
5294
5343
  referenceUdm: 'users',
5344
+ readOnly: true,
5345
+ },
5346
+ lastActivityTime: {
5347
+ type: 'string',
5348
+ format: 'date-time',
5349
+ readOnly: true,
5295
5350
  },
5296
5351
  },
5297
5352
  };
5298
- const udm$E = {
5299
- singularName: 'campaign-member',
5300
- pluralName: 'campaign-members',
5301
- fieldsSchema: FIELDS_SCHEMA$E,
5353
+ const udm$C = {
5354
+ singularName: 'company',
5355
+ pluralName: 'companies',
5356
+ fieldsSchema: FIELDS_SCHEMA$C,
5302
5357
  list: {
5303
- filterFields: [
5304
- 'primaryEmail',
5305
- 'fullName',
5306
- 'firstName',
5307
- 'lastName',
5308
- 'campaignId',
5309
- 'contactId',
5310
- 'leadId',
5311
- 'companyId',
5312
- ],
5358
+ filterFields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5359
+ },
5360
+ find: {
5361
+ queryFields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5313
5362
  },
5314
5363
  match: {
5315
- fields: ['primaryEmail', 'fullName', 'firstName', 'lastName', 'campaignId', 'contactId', 'leadId', 'companyId'],
5364
+ fields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5365
+ },
5366
+ fieldFallbacks: {
5367
+ 'primaryAddress.full': [
5368
+ {
5369
+ $concat: {
5370
+ values: [
5371
+ { $var: 'primaryAddress.street' },
5372
+ { $var: 'primaryAddress.city' },
5373
+ { $var: 'primaryAddress.state' },
5374
+ { $var: 'primaryAddress.zip' },
5375
+ { $var: 'primaryAddress.country' },
5376
+ ],
5377
+ delimiter: ', ',
5378
+ },
5379
+ },
5380
+ ],
5316
5381
  },
5317
5382
  };
5318
5383
 
5319
- const FIELDS_SCHEMA$D = {
5384
+ const FIELDS_SCHEMA$B = {
5320
5385
  type: 'object',
5321
5386
  properties: {
5322
5387
  id: { type: 'string', readOnly: true },
5323
- name: {
5388
+ name: { type: 'string' },
5389
+ description: { type: 'string' },
5390
+ source: { type: 'string' },
5391
+ type: { type: 'string' },
5392
+ ownerId: {
5324
5393
  type: 'string',
5394
+ referenceUdm: 'users',
5325
5395
  },
5326
- cost: {
5327
- type: 'number',
5328
- },
5329
- description: {
5396
+ createdTime: {
5330
5397
  type: 'string',
5331
- },
5332
- source: {
5333
- type: 'string',
5334
- },
5335
- stage: {
5336
- type: 'string',
5337
- },
5338
- type: {
5339
- type: 'string',
5340
- },
5341
- ownerId: {
5342
- type: 'string',
5343
- referenceUdm: 'users',
5344
- },
5345
- sentCount: {
5346
- type: 'number',
5347
- readOnly: true,
5348
- },
5349
- replyCount: {
5350
- type: 'number',
5351
- readOnly: true,
5352
- },
5353
- openCount: {
5354
- type: 'number',
5355
- readOnly: true,
5356
- },
5357
- clickCount: {
5358
- type: 'number',
5359
- readOnly: true,
5360
- },
5361
- startTime: {
5362
- type: 'string',
5363
- format: 'date-time',
5364
- },
5365
- endTime: {
5366
- type: 'string',
5367
- format: 'date-time',
5368
- },
5369
- createdTime: {
5370
- type: 'string',
5371
- format: 'date-time',
5372
- readOnly: true,
5373
- },
5374
- createdBy: {
5375
- type: 'string',
5376
- referenceUdm: 'users',
5377
- readOnly: true,
5378
- },
5379
- updatedTime: {
5380
- type: 'string',
5381
- format: 'date-time',
5382
- readOnly: true,
5383
- },
5384
- updatedBy: {
5385
- type: 'string',
5386
- referenceUdm: 'users',
5387
- readOnly: true,
5388
- },
5389
- lastActivityTime: {
5390
- type: 'string',
5391
- format: 'date-time',
5392
- readOnly: true,
5393
- },
5394
- },
5395
- };
5396
- const MODIFIABLE_FIELDS$2 = ['name', 'description', 'ownerId', 'startTime', 'endTime', 'cost', 'source', 'stage', 'type'];
5397
- const udm$D = {
5398
- singularName: 'campaign',
5399
- pluralName: 'campaigns',
5400
- fieldsSchema: FIELDS_SCHEMA$D,
5401
- categories: ['Marketing Automation', 'Sales', 'CRM', 'Ads'],
5402
- list: {
5403
- filterFields: ['name', 'source', 'stage', 'type', 'ownerId'],
5404
- },
5405
- find: {
5406
- queryFields: ['name', 'source', 'stage', 'type', 'ownerId'],
5407
- },
5408
- match: {
5409
- fields: ['name', 'source', 'stage', 'type', 'ownerId'],
5410
- },
5411
- create: {
5412
- fields: MODIFIABLE_FIELDS$2,
5413
- },
5414
- update: {
5415
- fields: MODIFIABLE_FIELDS$2,
5416
- },
5417
- };
5418
-
5419
- const AddressSchema = {
5420
- type: 'object',
5421
- properties: {
5422
- type: { type: 'string' },
5423
- full: { type: 'string' },
5424
- street: { type: 'string' },
5425
- city: { type: 'string' },
5426
- state: { type: 'string' },
5427
- country: { type: 'string' },
5428
- zip: { type: 'string' },
5429
- },
5430
- };
5431
- const PhoneEmailSchema = {
5432
- type: 'object',
5433
- properties: {
5434
- value: { type: 'string' },
5435
- type: { type: 'string' },
5436
- },
5437
- };
5438
-
5439
- const FIELDS_SCHEMA$C = {
5440
- type: 'object',
5441
- properties: {
5442
- id: { type: 'string', readOnly: true },
5443
- name: {
5444
- type: 'string',
5445
- },
5446
- websiteUrl: {
5447
- type: 'string',
5448
- },
5449
- phones: {
5450
- type: 'array',
5451
- items: PhoneEmailSchema,
5452
- },
5453
- primaryPhone: {
5454
- type: 'string',
5455
- },
5456
- description: {
5457
- type: 'string',
5458
- },
5459
- currency: {
5460
- type: 'string',
5461
- },
5462
- industry: {
5463
- type: 'string',
5464
- },
5465
- ownerId: {
5466
- type: 'string',
5467
- referenceUdm: 'users',
5468
- },
5469
- primaryAddress: AddressSchema,
5470
- addresses: {
5471
- type: 'array',
5472
- items: AddressSchema,
5473
- },
5474
- numberOfEmployees: {
5475
- type: 'number',
5476
- },
5477
- createdTime: {
5478
- type: 'string',
5479
- format: 'date-time',
5480
- },
5481
- createdBy: {
5482
- type: 'string',
5483
- referenceUdm: 'users',
5484
- readOnly: true,
5485
- },
5486
- updatedTime: {
5487
- type: 'string',
5488
- format: 'date-time',
5489
- readOnly: true,
5490
- },
5491
- updatedBy: {
5492
- type: 'string',
5493
- referenceUdm: 'users',
5494
- readOnly: true,
5495
- },
5496
- lastActivityTime: {
5497
- type: 'string',
5498
- format: 'date-time',
5499
- readOnly: true,
5500
- },
5501
- },
5502
- };
5503
- const udm$C = {
5504
- singularName: 'company',
5505
- pluralName: 'companies',
5506
- fieldsSchema: FIELDS_SCHEMA$C,
5507
- list: {
5508
- filterFields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5509
- },
5510
- find: {
5511
- queryFields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5512
- },
5513
- match: {
5514
- fields: ['ownerId', 'name', 'websiteUrl', 'industry'],
5515
- },
5516
- fieldFallbacks: {
5517
- 'primaryAddress.full': [
5518
- {
5519
- $concat: {
5520
- values: [
5521
- { $var: 'primaryAddress.street' },
5522
- { $var: 'primaryAddress.city' },
5523
- { $var: 'primaryAddress.state' },
5524
- { $var: 'primaryAddress.zip' },
5525
- { $var: 'primaryAddress.country' },
5526
- ],
5527
- delimiter: ', ',
5528
- },
5529
- },
5530
- ],
5531
- },
5532
- };
5533
-
5534
- const FIELDS_SCHEMA$B = {
5535
- type: 'object',
5536
- properties: {
5537
- id: { type: 'string', readOnly: true },
5538
- name: { type: 'string' },
5539
- description: { type: 'string' },
5540
- source: { type: 'string' },
5541
- type: { type: 'string' },
5542
- ownerId: {
5543
- type: 'string',
5544
- referenceUdm: 'users',
5545
- },
5546
- createdTime: {
5547
- type: 'string',
5548
- format: 'date-time',
5549
- readOnly: true,
5398
+ format: 'date-time',
5399
+ readOnly: true,
5550
5400
  },
5551
5401
  createdBy: {
5552
5402
  type: 'string',
@@ -7964,173 +7814,6 @@ const udm = {
7964
7814
  },
7965
7815
  };
7966
7816
 
7967
- const structuredClone$1 = (structuredClonePolyfill === null || structuredClonePolyfill === void 0 ? void 0 : structuredClonePolyfill.default) || structuredClonePolyfill;
7968
- function isNil(value) {
7969
- return value == null;
7970
- }
7971
- function omitBy(obj, check) {
7972
- obj = { ...obj };
7973
- Object.entries(obj).forEach(([key, value]) => check(value) && delete obj[key]);
7974
- return obj;
7975
- }
7976
- function isEmptyValue(value) {
7977
- if (isNil(value)) {
7978
- return true;
7979
- }
7980
- if (typeof value === 'symbol') {
7981
- return true;
7982
- }
7983
- if (typeof value === 'boolean') {
7984
- return false;
7985
- }
7986
- if (typeof value === 'number') {
7987
- return isNaN(value);
7988
- }
7989
- if (typeof value === 'string') {
7990
- return value.trim().length === 0;
7991
- }
7992
- const tag = value.toString();
7993
- if (tag === '[object Map]' || tag === '[object Set]') {
7994
- return !value.size;
7995
- }
7996
- return typeof value === 'object' && Object.keys(value).length === 0;
7997
- }
7998
- const simpleUniqueId = () => {
7999
- return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)
8000
- .toString(36)
8001
- .padStart(11, '0')
8002
- .substring(0, 11);
8003
- };
8004
-
8005
- function getDataLocationMethodPath(locationKey, methodKey) {
8006
- return `data/${locationKey}/${jsConvertCase.toKebabCase(methodKey)}`;
8007
- }
8008
- function dataLocationParametersMatch({ locationParameters, targetParameters, }) {
8009
- targetParameters = typeof targetParameters === 'object' && targetParameters ? targetParameters : {};
8010
- locationParameters = typeof locationParameters === 'object' && locationParameters ? locationParameters : {};
8011
- for (const [key, value] of Object.entries(targetParameters)) {
8012
- if (locationParameters[key] !== value) {
8013
- return false;
8014
- }
8015
- }
8016
- return true;
8017
- }
8018
- function parseDataLocationPath(path) {
8019
- if (!path) {
8020
- return undefined;
8021
- }
8022
- if (path.startsWith('/')) {
8023
- path = path.slice(1);
8024
- }
8025
- if (!path.startsWith('data/')) {
8026
- throw new Error(`Invalid data location path: ${path}. It should start with "data/"`);
8027
- }
8028
- path = path.slice(5);
8029
- const [key, query] = path.split('?');
8030
- const parameters = Object.fromEntries(new URLSearchParams(query).entries());
8031
- return { key, parameters };
8032
- }
8033
- function makeDataLocationPath(pointer) {
8034
- var _a;
8035
- const normalizedPointer = normalizePointer(pointer);
8036
- if (normalizedPointer === null || normalizedPointer === void 0 ? void 0 : normalizedPointer.key) {
8037
- let path = `/data/${normalizedPointer.key}`;
8038
- const parameters = omitBy((_a = normalizedPointer.parameters) !== null && _a !== void 0 ? _a : {}, isNil);
8039
- if (Object.keys(parameters).length > 0) {
8040
- path += `?${new URLSearchParams(parameters).toString()}`;
8041
- }
8042
- return path;
8043
- }
8044
- else {
8045
- return undefined;
8046
- }
8047
- }
8048
- function normalizePointer(pointer) {
8049
- if (typeof pointer === 'string' && pointer.startsWith('/data/')) {
8050
- return {
8051
- key: pointer.slice(6),
8052
- };
8053
- }
8054
- return pointer;
8055
- }
8056
- function makeDataLocationOperationPath(collectionPath, operation) {
8057
- const [path, query] = (collectionPath !== null && collectionPath !== void 0 ? collectionPath : '').split('?');
8058
- return urljoin(path, operation, query ? `?${query}` : '');
8059
- }
8060
- function isSameDataLocation(location1, location2) {
8061
- if (location1.key !== location2.key) {
8062
- return false;
8063
- }
8064
- const cleanParameters1 = location1.parameters && Object.keys(location1.parameters).length > 0 ? location1.parameters : undefined;
8065
- const cleanParameters2 = location2.parameters && Object.keys(location2.parameters).length > 0 ? location2.parameters : undefined;
8066
- if (!deepEqual(cleanParameters1, cleanParameters2)) {
8067
- return false;
8068
- }
8069
- return true;
8070
- }
8071
- function isDataLocationMethodSupported(location, methodKey) {
8072
- var _a;
8073
- const method = (_a = location === null || location === void 0 ? void 0 : location.methods) === null || _a === void 0 ? void 0 : _a[methodKey];
8074
- return method && method.implementationType !== exports.ConnectorMethodImplementationType.notSupported;
8075
- }
8076
- function getDataCollectionCreateFields(spec) {
8077
- if (!spec)
8078
- return undefined;
8079
- if (!spec.fieldsSchema)
8080
- return undefined;
8081
- if (!spec.create)
8082
- return undefined;
8083
- let schema = excludeReadOnlyFieldsFromSchema(spec.fieldsSchema);
8084
- if (spec.create.fields) {
8085
- schema = pickFieldsFromSchema(schema, spec.create.fields);
8086
- }
8087
- if (spec.create.excludedFields) {
8088
- schema = excludeFieldsFromSchema(schema, spec.create.excludedFields);
8089
- }
8090
- return schema;
8091
- }
8092
- function getDataCollectionUpdateFields(spec) {
8093
- if (!spec)
8094
- return undefined;
8095
- if (!spec.fieldsSchema)
8096
- return undefined;
8097
- if (!spec.update)
8098
- return undefined;
8099
- let schema = excludeReadOnlyFieldsFromSchema(spec.fieldsSchema);
8100
- if (spec.update.fields) {
8101
- schema = pickFieldsFromSchema(schema, spec.update.fields);
8102
- }
8103
- if (spec.update.excludedFields) {
8104
- schema = excludeFieldsFromSchema(schema, spec.update.excludedFields);
8105
- }
8106
- return schema;
8107
- }
8108
- function getWritableFieldsSchema(spec) {
8109
- if (!spec)
8110
- return undefined;
8111
- if (!spec.fieldsSchema)
8112
- return undefined;
8113
- return mergeSchemas([getDataCollectionCreateFields(spec), getDataCollectionUpdateFields(spec)]);
8114
- }
8115
- function getReferenceCollectionPointerForSchema(schema) {
8116
- if ((schema === null || schema === void 0 ? void 0 : schema.referenceCollection) && schema.referenceCollection.key) {
8117
- return schema.referenceCollection;
8118
- }
8119
- else if (schema === null || schema === void 0 ? void 0 : schema.referenceCollectionPath) {
8120
- return parseDataLocationPath(schema.referenceCollectionPath);
8121
- }
8122
- else if (schema === null || schema === void 0 ? void 0 : schema.referenceCollectionUri) {
8123
- return parseDataLocationPath(schema.referenceCollectionUri);
8124
- }
8125
- else {
8126
- return undefined;
8127
- }
8128
- }
8129
- function getReferenceCollectionPathForSchema(schema) {
8130
- const pointer = getReferenceCollectionPointerForSchema(schema);
8131
- return makeDataLocationPath(pointer);
8132
- }
8133
-
8134
7817
  exports.UDM = void 0;
8135
7818
  (function (UDM) {
8136
7819
  UDM["ACTIVITIES"] = "activities";
@@ -8265,113 +7948,435 @@ function findUdmDefaultCollection(spec, udm, useFallback = true) {
8265
7948
  }
8266
7949
  if ((_h = (_g = (_f = (_e = spec.udm) === null || _e === void 0 ? void 0 : _e[udm]) === null || _f === void 0 ? void 0 : _f.collectionMappings) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.key) {
8267
7950
  return {
8268
- key: spec.udm[udm].collectionMappings[0].key,
7951
+ key: spec.udm[udm].collectionMappings[0].key,
7952
+ };
7953
+ }
7954
+ const udmSpec = UNIFIED_DATA_MODELS[udm];
7955
+ if (!udmSpec) {
7956
+ throw new BadRequestError(`Unknown UDM: ${udm}`);
7957
+ }
7958
+ if (useFallback) {
7959
+ for (const fallback of (_j = udmSpec.udmFallbacks) !== null && _j !== void 0 ? _j : []) {
7960
+ const pointer = findUdmDefaultCollection(spec, fallback.udm, false);
7961
+ if (pointer) {
7962
+ return pointer;
7963
+ }
7964
+ }
7965
+ }
7966
+ return undefined;
7967
+ }
7968
+ function addUdmFallbackFields(fields, udm) {
7969
+ if (!udm) {
7970
+ return fields;
7971
+ }
7972
+ const udmSpec = UNIFIED_DATA_MODELS[udm];
7973
+ if (!udmSpec) {
7974
+ throw new BadRequestError(`Unknown UDM: ${udm}`);
7975
+ }
7976
+ if (!udmSpec.fieldFallbacks) {
7977
+ return fields;
7978
+ }
7979
+ let result = structuredClone$1(fields);
7980
+ for (const fieldKeyWithFallbacks of Object.keys(udmSpec.fieldFallbacks)) {
7981
+ const currentValue = getValueAtLocator(fields, fieldKeyWithFallbacks);
7982
+ if (currentValue !== undefined)
7983
+ continue;
7984
+ for (const fallbackValue of udmSpec.fieldFallbacks[fieldKeyWithFallbacks]) {
7985
+ const varFormulaLocators = getVariableLocators(fallbackValue);
7986
+ const varLocators = [];
7987
+ for (const varFormulaLocator of varFormulaLocators) {
7988
+ const formula = exports.getFormula(getValueAtLocator(fallbackValue, varFormulaLocator));
7989
+ varLocators.push(formula.locator);
7990
+ }
7991
+ const fallbackValueHasDependencies = varLocators.some((locator) => getValueAtLocator(fields, locator) !== undefined);
7992
+ if (fallbackValueHasDependencies) {
7993
+ result = setValueAtLocator(result, fieldKeyWithFallbacks, transformVars(fallbackValue, fields));
7994
+ break;
7995
+ }
7996
+ }
7997
+ }
7998
+ return result;
7999
+ }
8000
+
8001
+ const DATA_RECORD_SCHEMA = {
8002
+ type: 'object',
8003
+ properties: {
8004
+ id: {
8005
+ type: 'string',
8006
+ },
8007
+ name: {
8008
+ type: 'string',
8009
+ },
8010
+ uri: {
8011
+ type: 'string',
8012
+ format: 'url',
8013
+ },
8014
+ createdTime: {
8015
+ type: 'string',
8016
+ format: 'datetime',
8017
+ },
8018
+ updatedTime: {
8019
+ type: 'string',
8020
+ format: 'datetime',
8021
+ },
8022
+ deletedTime: {
8023
+ type: 'string',
8024
+ format: 'datetime',
8025
+ },
8026
+ createdById: {
8027
+ type: 'string',
8028
+ },
8029
+ updatedById: {
8030
+ type: 'string',
8031
+ },
8032
+ },
8033
+ };
8034
+ function makeDataRecordSchema({ fieldsSchema, udm, rawFieldsSchema, }) {
8035
+ var _a, _b, _c;
8036
+ const schema = structuredClone$1(DATA_RECORD_SCHEMA);
8037
+ schema.properties = {
8038
+ ...((_a = schema.properties) !== null && _a !== void 0 ? _a : {}),
8039
+ fields: fieldsSchema !== null && fieldsSchema !== void 0 ? fieldsSchema : { type: 'object' },
8040
+ };
8041
+ if (udm) {
8042
+ const unifiedModel = UNIFIED_DATA_MODELS[udm];
8043
+ if (unifiedModel === null || unifiedModel === void 0 ? void 0 : unifiedModel.fieldsSchema) {
8044
+ schema.properties = {
8045
+ ...((_b = schema.properties) !== null && _b !== void 0 ? _b : {}),
8046
+ unifiedFields: unifiedModel.fieldsSchema,
8047
+ };
8048
+ }
8049
+ }
8050
+ if (rawFieldsSchema) {
8051
+ schema.properties = {
8052
+ ...((_c = schema.properties) !== null && _c !== void 0 ? _c : {}),
8053
+ rawFields: rawFieldsSchema,
8054
+ };
8055
+ }
8056
+ return schema;
8057
+ }
8058
+
8059
+ const DataLocationMethodImplementationTypes = [
8060
+ exports.ConnectorMethodImplementationType.operationMapping,
8061
+ exports.ConnectorMethodImplementationType.restApiMapping,
8062
+ exports.ConnectorMethodImplementationType.graphqlApiMapping,
8063
+ exports.ConnectorMethodImplementationType.javascript,
8064
+ exports.ConnectorMethodImplementationType.notSupported,
8065
+ ];
8066
+
8067
+ const DataCollectionMethodCreate = {
8068
+ name: 'Create',
8069
+ description: 'Create a new data record in the collection',
8070
+ getConfigSchema: ({ collectionSpec }) => {
8071
+ var _a, _b;
8072
+ const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
8073
+ return {
8074
+ type: 'object',
8075
+ properties: {
8076
+ fields: {
8077
+ type: 'array',
8078
+ items: { type: 'string', enum: fields },
8079
+ },
8080
+ excludedFields: {
8081
+ type: 'array',
8082
+ items: { type: 'string', enum: fields },
8083
+ },
8084
+ },
8085
+ };
8086
+ },
8087
+ getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
8088
+ var _a;
8089
+ let fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
8090
+ if (method === null || method === void 0 ? void 0 : method.fields) {
8091
+ fieldsSchema = pickFieldsFromSchema(fieldsSchema, method.fields);
8092
+ }
8093
+ if (method === null || method === void 0 ? void 0 : method.excludedFields) {
8094
+ fieldsSchema = excludeFieldsFromSchema(fieldsSchema, method.excludedFields);
8095
+ }
8096
+ return {
8097
+ type: 'object',
8098
+ properties: nonEmptyObjectProperties({
8099
+ fields: (_a = transformVariablesWith(fieldsSchema, (locator) => `fields.${locatorToField(locator)}`)) !== null && _a !== void 0 ? _a : {
8100
+ type: 'object',
8101
+ },
8102
+ credentials: credentialsSchema,
8103
+ }),
8104
+ };
8105
+ },
8106
+ getOutputSchema: ({}) => ({
8107
+ type: 'object',
8108
+ properties: {
8109
+ id: { type: 'string' },
8110
+ },
8111
+ }),
8112
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8113
+ };
8114
+
8115
+ const DataCollectionMethodDelete = {
8116
+ name: 'Delete',
8117
+ description: 'Delete a data record from the collection by id',
8118
+ getInputSchema: ({ collectionHandler, parameters, credentialsSchema }) => {
8119
+ return {
8120
+ type: 'object',
8121
+ properties: nonEmptyObjectProperties({
8122
+ id: {
8123
+ type: 'string',
8124
+ referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
8125
+ },
8126
+ credentials: credentialsSchema,
8127
+ }),
8128
+ };
8129
+ },
8130
+ getOutputSchema: () => null,
8131
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8132
+ };
8133
+
8134
+ const DataCollectionMethodFind = {
8135
+ isDeprecated: true,
8136
+ name: 'Find',
8137
+ description: 'Find a list of data records in the collection',
8138
+ getConfigSchema: ({ collectionSpec }) => {
8139
+ var _a, _b;
8140
+ const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
8141
+ return {
8142
+ type: 'object',
8143
+ properties: {
8144
+ queryFields: {
8145
+ type: 'array',
8146
+ items: { type: 'string', enum: fields },
8147
+ },
8148
+ },
8149
+ };
8150
+ },
8151
+ getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
8152
+ const queryFieldsSchema = pickFieldsFromSchema(collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema, method === null || method === void 0 ? void 0 : method.queryFields);
8153
+ const schema = {
8154
+ type: 'object',
8155
+ properties: nonEmptyObjectProperties({
8156
+ cursor: { type: 'string' },
8157
+ credentials: credentialsSchema,
8158
+ }),
8159
+ };
8160
+ if (queryFieldsSchema === null || queryFieldsSchema === void 0 ? void 0 : queryFieldsSchema.properties) {
8161
+ schema.properties = {
8162
+ ...schema.properties,
8163
+ query: transformVariablesWith(queryFieldsSchema, (locator) => `query.${locatorToField(locator)}`),
8164
+ };
8165
+ }
8166
+ return schema;
8167
+ },
8168
+ getOutputSchema: ({ collectionSpec }) => {
8169
+ var _a;
8170
+ return ({
8171
+ type: 'object',
8172
+ properties: {
8173
+ records: {
8174
+ type: 'array',
8175
+ items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
8176
+ },
8177
+ cursor: {
8178
+ type: 'string',
8179
+ },
8180
+ },
8181
+ });
8182
+ },
8183
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8184
+ };
8185
+
8186
+ const DataCollectionMethodFindById = {
8187
+ name: 'Find by ID',
8188
+ description: 'Find a single data record in the collection by its id',
8189
+ getInputSchema: ({ collectionHandler, parameters, credentialsSchema }) => ({
8190
+ type: 'object',
8191
+ properties: nonEmptyObjectProperties({
8192
+ id: {
8193
+ type: 'string',
8194
+ referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
8195
+ },
8196
+ credentials: credentialsSchema,
8197
+ }),
8198
+ }),
8199
+ getOutputSchema: ({ collectionSpec }) => {
8200
+ var _a;
8201
+ return ({
8202
+ type: 'object',
8203
+ properties: {
8204
+ record: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
8205
+ },
8206
+ });
8207
+ },
8208
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8209
+ };
8210
+
8211
+ const DataCollectionMethodList = {
8212
+ name: 'List',
8213
+ description: 'Return all data records from the collection',
8214
+ getConfigSchema: ({ collectionSpec }) => {
8215
+ var _a, _b;
8216
+ const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
8217
+ return {
8218
+ type: 'object',
8219
+ properties: {
8220
+ filterFields: {
8221
+ type: 'array',
8222
+ items: { type: 'string', enum: fields },
8223
+ },
8224
+ },
8225
+ };
8226
+ },
8227
+ getInputSchema: ({ method, collectionSpec, credentialsSchema }) => {
8228
+ const fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
8229
+ let filterSchema;
8230
+ if (method === null || method === void 0 ? void 0 : method.filterFields) {
8231
+ filterSchema = pickFieldsFromSchema(fieldsSchema, method.filterFields);
8232
+ }
8233
+ return {
8234
+ type: 'object',
8235
+ properties: nonEmptyObjectProperties({
8236
+ filter: filterSchema,
8237
+ cursor: {
8238
+ type: 'string',
8239
+ description: 'Cursor returned in response to the previous "list" request',
8240
+ },
8241
+ credentials: credentialsSchema,
8242
+ }),
8243
+ };
8244
+ },
8245
+ getOutputSchema: ({ collectionSpec }) => {
8246
+ var _a;
8247
+ return ({
8248
+ type: 'object',
8249
+ properties: {
8250
+ records: {
8251
+ type: 'array',
8252
+ items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
8253
+ },
8254
+ cursor: {
8255
+ type: 'string',
8256
+ description: 'Cursor to request the next page of results',
8257
+ },
8258
+ },
8259
+ });
8260
+ },
8261
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8262
+ };
8263
+
8264
+ const DataCollectionMethodMatch = {
8265
+ name: 'Match',
8266
+ description: 'Find a single matching record in a data collection by a set of fields',
8267
+ getConfigSchema: ({ collectionSpec }) => {
8268
+ var _a, _b;
8269
+ const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
8270
+ return {
8271
+ type: 'object',
8272
+ properties: {
8273
+ fields: {
8274
+ type: 'array',
8275
+ items: { type: 'string', enum: fields },
8276
+ },
8277
+ },
8269
8278
  };
8270
- }
8271
- const udmSpec = UNIFIED_DATA_MODELS[udm];
8272
- if (!udmSpec) {
8273
- throw new BadRequestError(`Unknown UDM: ${udm}`);
8274
- }
8275
- if (useFallback) {
8276
- for (const fallback of (_j = udmSpec.udmFallbacks) !== null && _j !== void 0 ? _j : []) {
8277
- const pointer = findUdmDefaultCollection(spec, fallback.udm, false);
8278
- if (pointer) {
8279
- return pointer;
8280
- }
8281
- }
8282
- }
8283
- return undefined;
8284
- }
8285
- function addUdmFallbackFields(fields, udm) {
8286
- if (!udm) {
8287
- return fields;
8288
- }
8289
- const udmSpec = UNIFIED_DATA_MODELS[udm];
8290
- if (!udmSpec) {
8291
- throw new BadRequestError(`Unknown UDM: ${udm}`);
8292
- }
8293
- if (!udmSpec.fieldFallbacks) {
8294
- return fields;
8295
- }
8296
- let result = structuredClone$1(fields);
8297
- for (const fieldKeyWithFallbacks of Object.keys(udmSpec.fieldFallbacks)) {
8298
- const currentValue = getValueAtLocator(fields, fieldKeyWithFallbacks);
8299
- if (currentValue !== undefined)
8300
- continue;
8301
- for (const fallbackValue of udmSpec.fieldFallbacks[fieldKeyWithFallbacks]) {
8302
- const varFormulaLocators = getVariableLocators(fallbackValue);
8303
- const varLocators = [];
8304
- for (const varFormulaLocator of varFormulaLocators) {
8305
- const formula = exports.getFormula(getValueAtLocator(fallbackValue, varFormulaLocator));
8306
- varLocators.push(formula.locator);
8307
- }
8308
- const fallbackValueHasDependencies = varLocators.some((locator) => getValueAtLocator(fields, locator) !== undefined);
8309
- if (fallbackValueHasDependencies) {
8310
- result = setValueAtLocator(result, fieldKeyWithFallbacks, transformVars(fallbackValue, fields));
8311
- break;
8312
- }
8313
- }
8314
- }
8315
- return result;
8316
- }
8279
+ },
8280
+ getInputSchema: ({ collectionSpec, method, credentialsSchema }) => {
8281
+ const fieldsSchema = pickFieldsFromSchema(collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema, method === null || method === void 0 ? void 0 : method.fields);
8282
+ return {
8283
+ type: 'object',
8284
+ properties: nonEmptyObjectProperties({
8285
+ query: transformVariablesWith(fieldsSchema !== null && fieldsSchema !== void 0 ? fieldsSchema : {}, (locator) => `query.${locatorToField(locator)}`),
8286
+ credentials: credentialsSchema,
8287
+ }),
8288
+ };
8289
+ },
8290
+ getOutputSchema: ({ collectionSpec }) => {
8291
+ var _a;
8292
+ return ({
8293
+ type: 'object',
8294
+ properties: {
8295
+ record: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
8296
+ },
8297
+ });
8298
+ },
8299
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8300
+ };
8317
8301
 
8318
- const DATA_RECORD_SCHEMA = {
8319
- type: 'object',
8320
- properties: {
8321
- id: {
8322
- type: 'string',
8323
- },
8324
- name: {
8325
- type: 'string',
8326
- },
8327
- uri: {
8328
- type: 'string',
8329
- format: 'url',
8330
- },
8331
- createdTime: {
8332
- type: 'string',
8333
- format: 'datetime',
8334
- },
8335
- updatedTime: {
8336
- type: 'string',
8337
- format: 'datetime',
8338
- },
8339
- deletedTime: {
8340
- type: 'string',
8341
- format: 'datetime',
8342
- },
8343
- createdById: {
8344
- type: 'string',
8345
- },
8346
- updatedById: {
8347
- type: 'string',
8348
- },
8302
+ const DataCollectionMethodSearch = {
8303
+ name: 'Search',
8304
+ description: 'Find data records in a collection by a string query',
8305
+ getInputSchema: ({ credentialsSchema }) => ({
8306
+ type: 'object',
8307
+ properties: nonEmptyObjectProperties({
8308
+ query: { type: 'string' },
8309
+ cursor: { type: 'string' },
8310
+ credentials: credentialsSchema,
8311
+ }),
8312
+ }),
8313
+ getOutputSchema: ({ collectionSpec }) => {
8314
+ var _a;
8315
+ return ({
8316
+ type: 'object',
8317
+ properties: {
8318
+ records: {
8319
+ type: 'array',
8320
+ items: (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) !== null && _a !== void 0 ? _a : { type: 'object' },
8321
+ },
8322
+ cursor: { type: 'string' },
8323
+ },
8324
+ });
8349
8325
  },
8326
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8350
8327
  };
8351
- function makeDataRecordSchema({ fieldsSchema, udm, rawFieldsSchema, }) {
8352
- var _a, _b, _c;
8353
- const schema = structuredClone$1(DATA_RECORD_SCHEMA);
8354
- schema.properties = {
8355
- ...((_a = schema.properties) !== null && _a !== void 0 ? _a : {}),
8356
- fields: fieldsSchema !== null && fieldsSchema !== void 0 ? fieldsSchema : { type: 'object' },
8357
- };
8358
- if (udm) {
8359
- const unifiedModel = UNIFIED_DATA_MODELS[udm];
8360
- if (unifiedModel === null || unifiedModel === void 0 ? void 0 : unifiedModel.fieldsSchema) {
8361
- schema.properties = {
8362
- ...((_b = schema.properties) !== null && _b !== void 0 ? _b : {}),
8363
- unifiedFields: unifiedModel.fieldsSchema,
8364
- };
8328
+
8329
+ const DataCollectionMethodUpdate = {
8330
+ name: 'Update',
8331
+ description: 'Update one data record in the collection by its id',
8332
+ getConfigSchema: ({ collectionSpec }) => {
8333
+ var _a, _b;
8334
+ const fields = Object.keys((_b = (_a = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {}).map(locatorToField);
8335
+ return {
8336
+ type: 'object',
8337
+ properties: {
8338
+ fields: {
8339
+ type: 'array',
8340
+ items: { type: 'string', enum: fields },
8341
+ },
8342
+ excludedFields: {
8343
+ type: 'array',
8344
+ items: { type: 'string', enum: fields },
8345
+ },
8346
+ },
8347
+ };
8348
+ },
8349
+ getInputSchema: ({ collectionSpec, collectionHandler, credentialsSchema, method, parameters }) => {
8350
+ var _a;
8351
+ let fieldsSchema = collectionSpec === null || collectionSpec === void 0 ? void 0 : collectionSpec.fieldsSchema;
8352
+ if (method === null || method === void 0 ? void 0 : method.fields) {
8353
+ fieldsSchema = pickFieldsFromSchema(fieldsSchema, method.fields);
8365
8354
  }
8366
- }
8367
- if (rawFieldsSchema) {
8368
- schema.properties = {
8369
- ...((_c = schema.properties) !== null && _c !== void 0 ? _c : {}),
8370
- rawFields: rawFieldsSchema,
8355
+ if (method === null || method === void 0 ? void 0 : method.excludedFields) {
8356
+ fieldsSchema = excludeFieldsFromSchema(fieldsSchema, method.excludedFields);
8357
+ }
8358
+ return {
8359
+ type: 'object',
8360
+ properties: nonEmptyObjectProperties({
8361
+ id: {
8362
+ type: 'string',
8363
+ referenceCollection: { key: collectionHandler === null || collectionHandler === void 0 ? void 0 : collectionHandler.key, parameters },
8364
+ },
8365
+ fields: (_a = transformVariablesWith(fieldsSchema, (locator) => `fields.${locatorToField(locator)}`)) !== null && _a !== void 0 ? _a : {
8366
+ type: 'object',
8367
+ },
8368
+ credentials: credentialsSchema,
8369
+ }),
8371
8370
  };
8372
- }
8373
- return schema;
8374
- }
8371
+ },
8372
+ getOutputSchema: ({}) => ({
8373
+ type: 'object',
8374
+ properties: {
8375
+ id: { type: 'string' },
8376
+ },
8377
+ }),
8378
+ supportedImplementationTypes: DataLocationMethodImplementationTypes,
8379
+ };
8375
8380
 
8376
8381
  const GetEventConfig = {
8377
8382
  fileKey: 'connector-event-get-event-config',
@@ -10332,6 +10337,10 @@ const FindConnectionsQuery = PaginationQuery.merge(SearchQuery)
10332
10337
  .string()
10333
10338
  .optional()
10334
10339
  .meta({ hidden: true }),
10340
+ externalAppId: z.z.string().optional().meta({
10341
+ filterTitle: 'External App',
10342
+ referenceElementType: exports.WorkspaceElementType.App,
10343
+ }),
10335
10344
  integrationKey: z.z
10336
10345
  .string()
10337
10346
  .optional()
@@ -10342,9 +10351,12 @@ const FindConnectionsQuery = PaginationQuery.merge(SearchQuery)
10342
10351
  });
10343
10352
  const CreateConnectionRequest = ConnectionEditableProperties.extend({
10344
10353
  integrationId: z.z.string().optional(),
10354
+ integrationUuid: z.z.string().optional(),
10355
+ integrationKey: z.z.string().optional(),
10345
10356
  connectorId: z.z.string().optional(),
10357
+ connectorUuid: z.z.string().optional(),
10358
+ connectorKey: z.z.string().optional(),
10346
10359
  connectorVersion: z.z.string().optional(),
10347
- externalAppId: z.z.string().optional(),
10348
10360
  });
10349
10361
  const UpdateConnectionRequest = ConnectionEditableProperties;
10350
10362
  const ConnectionExportProperties = ConnectionEditableProperties.omit({
@@ -10407,6 +10419,7 @@ const GenerateOptionsRequest = z.z.object({
10407
10419
  integrationId: z.z.string().optional(),
10408
10420
  integrationKey: z.z.string().optional(),
10409
10421
  connectorId: z.z.string().optional(),
10422
+ connectorKey: z.z.string().optional(),
10410
10423
  connectionId: z.z.string().optional(),
10411
10424
  connectorParameters: z.z.any().optional(),
10412
10425
  connectorVersion: z.z.string().optional(),
@@ -10416,6 +10429,7 @@ const ConnectPayload = z.z.object({
10416
10429
  integrationKey: z.z.string().optional(),
10417
10430
  integrationId: z.z.string().optional(),
10418
10431
  connectorId: z.z.string().optional(),
10432
+ connectorKey: z.z.string().optional(),
10419
10433
  connectorVersion: z.z.string().optional(),
10420
10434
  connectionId: z.z.string().optional(),
10421
10435
  name: z.z.string().optional(),
@@ -11705,6 +11719,7 @@ const WorkspaceElementSpecs = {
11705
11719
  name: 'App',
11706
11720
  namePlural: 'Apps',
11707
11721
  hasKey: true,
11722
+ hasPublicLayer: true,
11708
11723
  },
11709
11724
  [exports.WorkspaceElementType.Integration]: {
11710
11725
  type: exports.WorkspaceElementType.Integration,
@@ -11722,6 +11737,7 @@ const WorkspaceElementSpecs = {
11722
11737
  namePlural: 'Connectors',
11723
11738
  exportPropertiesSchema: ConnectorExportProperties,
11724
11739
  hasKey: true,
11740
+ hasPublicLayer: true,
11725
11741
  },
11726
11742
  [exports.WorkspaceElementType.Connection]: {
11727
11743
  type: exports.WorkspaceElementType.Connection,
@@ -11745,6 +11761,7 @@ const WorkspaceElementSpecs = {
11745
11761
  isIntegrationLevel: true,
11746
11762
  hasKey: true,
11747
11763
  hasParentChildRelationship: true,
11764
+ hasPublicLayer: true,
11748
11765
  isProOnly: true,
11749
11766
  },
11750
11767
  [exports.WorkspaceElementType.ActionInstance]: {
@@ -11771,6 +11788,7 @@ const WorkspaceElementSpecs = {
11771
11788
  canBeAddedToPackage: true,
11772
11789
  hasParentChildRelationship: true,
11773
11790
  hasKey: true,
11791
+ hasPublicLayer: true,
11774
11792
  },
11775
11793
  [exports.WorkspaceElementType.ActionRunLogRecord]: {
11776
11794
  type: exports.WorkspaceElementType.ActionRunLogRecord,
@@ -15473,25 +15491,6 @@ const CreateClusterRequest = z.z.object({
15473
15491
  });
15474
15492
  const ListClustersQuery = PaginationQuery;
15475
15493
 
15476
- class UI {
15477
- constructor(client) {
15478
- this.client = client;
15479
- }
15480
- async connect(options = {}) {
15481
- const { url, postData } = await this.client.getScreensPostData('connect', {
15482
- ...options,
15483
- allowMultipleConnections: options.allowMultipleConnections ? '1' : '',
15484
- connectorParameters: options.connectorParameters ? JSON.stringify(options.connectorParameters) : undefined,
15485
- });
15486
- return new Promise((resolve) => {
15487
- return openIframeWithPost(url, postData, {
15488
- onClose: () => resolve(null),
15489
- onSuccess: (connection) => resolve(connection),
15490
- });
15491
- });
15492
- }
15493
- }
15494
-
15495
15494
  const API_VERSIONS = {
15496
15495
  LEGACY: 'legacy',
15497
15496
  '2025-10-21': '2025-10-21',
@@ -15743,6 +15742,25 @@ class MembraneApiClient {
15743
15742
  }
15744
15743
  }
15745
15744
 
15745
+ class UI {
15746
+ constructor(client) {
15747
+ this.client = client;
15748
+ }
15749
+ async connect(options = {}) {
15750
+ const { url, postData } = await this.client.getScreensPostData('connect', {
15751
+ ...options,
15752
+ allowMultipleConnections: options.allowMultipleConnections ? '1' : '',
15753
+ connectorParameters: options.connectorParameters ? JSON.stringify(options.connectorParameters) : undefined,
15754
+ });
15755
+ return new Promise((resolve) => {
15756
+ return openIframeWithPost(url, postData, {
15757
+ onClose: () => resolve(null),
15758
+ onSuccess: (connection) => resolve(connection),
15759
+ });
15760
+ });
15761
+ }
15762
+ }
15763
+
15746
15764
  class MembraneClient extends MembraneApiClient {
15747
15765
  constructor(options) {
15748
15766
  super(options);
@@ -15937,6 +15955,7 @@ exports.Alert = Alert;
15937
15955
  exports.AlertDeliverySettingsSchema = AlertDeliverySettingsSchema;
15938
15956
  exports.AlertSchema = AlertSchema;
15939
15957
  exports.AlertTypeDeliverySettingsSchema = AlertTypeDeliverySettingsSchema;
15958
+ exports.And = And;
15940
15959
  exports.ApiRequestSpec = ApiRequestSpec;
15941
15960
  exports.AppDataSchemaAccessor = AppDataSchemaAccessor;
15942
15961
  exports.AppDataSchemaApiResponse = AppDataSchemaApiResponse;
@@ -16133,6 +16152,23 @@ exports.DEFAULT_ALERT_DELIVERY_SETTINGS = DEFAULT_ALERT_DELIVERY_SETTINGS;
16133
16152
  exports.DEFAULT_ALERT_TYPE_DELIVERY_SETTINGS = DEFAULT_ALERT_TYPE_DELIVERY_SETTINGS;
16134
16153
  exports.DEFAULT_FULL_SYNC_INTERVAL_SECONDS = DEFAULT_FULL_SYNC_INTERVAL_SECONDS;
16135
16154
  exports.DEFAULT_PULL_UPDATES_INTERVAL_SECONDS = DEFAULT_PULL_UPDATES_INTERVAL_SECONDS;
16155
+ exports.DataBuilderFormulaBase = DataBuilderFormulaBase;
16156
+ exports.DataBuilderFormulaCase = DataBuilderFormulaCase;
16157
+ exports.DataBuilderFormulaConcat = DataBuilderFormulaConcat;
16158
+ exports.DataBuilderFormulaCopy = DataBuilderFormulaCopy;
16159
+ exports.DataBuilderFormulaExtractDate = DataBuilderFormulaExtractDate;
16160
+ exports.DataBuilderFormulaExtractTime = DataBuilderFormulaExtractTime;
16161
+ exports.DataBuilderFormulaFindAppRecordId = DataBuilderFormulaFindAppRecordId;
16162
+ exports.DataBuilderFormulaFindExternalRecordId = DataBuilderFormulaFindExternalRecordId;
16163
+ exports.DataBuilderFormulaFirstName = DataBuilderFormulaFirstName;
16164
+ exports.DataBuilderFormulaIterate = DataBuilderFormulaIterate;
16165
+ exports.DataBuilderFormulaLastName = DataBuilderFormulaLastName;
16166
+ exports.DataBuilderFormulaLookup = DataBuilderFormulaLookup;
16167
+ exports.DataBuilderFormulaMap = DataBuilderFormulaMap;
16168
+ exports.DataBuilderFormulaPlain = DataBuilderFormulaPlain;
16169
+ exports.DataBuilderFormulaRecord = DataBuilderFormulaRecord;
16170
+ exports.DataBuilderFormulaTpl = DataBuilderFormulaTpl;
16171
+ exports.DataBuilderFormulaVar = DataBuilderFormulaVar;
16136
16172
  exports.DataCollectionCreateRequest = DataCollectionCreateRequest;
16137
16173
  exports.DataCollectionCreateResponse = DataCollectionCreateResponse;
16138
16174
  exports.DataCollectionCreateSpec = DataCollectionCreateSpec;
@@ -16186,6 +16222,7 @@ exports.DataLocatorStepArrayItem = DataLocatorStepArrayItem;
16186
16222
  exports.DataLocatorStepObjectProperty = DataLocatorStepObjectProperty;
16187
16223
  exports.DataRecordSchema = DataRecordSchema;
16188
16224
  exports.DataSchema = DataSchema;
16225
+ exports.DataSchemaRef = DataSchemaRef;
16189
16226
  exports.DataSourceAccessor = DataSourceAccessor;
16190
16227
  exports.DataSourceApiResponse = DataSourceApiResponse;
16191
16228
  exports.DataSourceEditableProperties = DataSourceEditableProperties;
@@ -16197,6 +16234,7 @@ exports.DataSourceUnitConfig = DataSourceUnitConfig;
16197
16234
  exports.DataSourcesAccessor = DataSourcesAccessor;
16198
16235
  exports.DbBackedCountsSchema = DbBackedCountsSchema;
16199
16236
  exports.DependencyError = DependencyError;
16237
+ exports.DomainFromEmail = DomainFromEmail;
16200
16238
  exports.DownstreamFlowNodeRunSchema = DownstreamFlowNodeRunSchema;
16201
16239
  exports.EDITABLE_LIMITS = EDITABLE_LIMITS;
16202
16240
  exports.ElementAccessor = ElementAccessor;
@@ -16208,6 +16246,7 @@ exports.EngineCreditsProjectionResponse = EngineCreditsProjectionResponse;
16208
16246
  exports.EngineWorkspaceSettingsSchema = EngineWorkspaceSettingsSchema;
16209
16247
  exports.ErrorData = ErrorData;
16210
16248
  exports.ErrorDataSchema = ErrorDataSchema;
16249
+ exports.Eval = Eval;
16211
16250
  exports.ExternalApiLogApiResponse = ExternalApiLogApiResponse;
16212
16251
  exports.ExternalEvent = ExternalEvent;
16213
16252
  exports.ExternalEventLogRecordApiResponse = ExternalEventLogRecordApiResponse;
@@ -16265,6 +16304,7 @@ exports.FindOrgWorkspacesQuery = FindOrgWorkspacesQuery;
16265
16304
  exports.FindOrgsQuery = FindOrgsQuery;
16266
16305
  exports.FindPackagesQuery = FindPackagesQuery;
16267
16306
  exports.FindScreensQuery = FindScreensQuery;
16307
+ exports.FirstNotEmpty = FirstNotEmpty;
16268
16308
  exports.FlowAccessor = FlowAccessor;
16269
16309
  exports.FlowApiResponse = FlowApiResponse;
16270
16310
  exports.FlowEditableProperties = FlowEditableProperties;
@@ -16293,6 +16333,7 @@ exports.FlowRunsAccessor = FlowRunsAccessor;
16293
16333
  exports.FlowRunsStatsQuery = FlowRunsStatsQuery;
16294
16334
  exports.FlowsAccessor = FlowsAccessor;
16295
16335
  exports.Formula = Formula;
16336
+ exports.FormulaFormula = FormulaFormula;
16296
16337
  exports.FullOrgUser = FullOrgUser;
16297
16338
  exports.FullPlatformUser = FullPlatformUser;
16298
16339
  exports.FunctionDefinition = FunctionDefinition;
@@ -16333,6 +16374,7 @@ exports.IntegrationsAccessor = IntegrationsAccessor;
16333
16374
  exports.InternalError = InternalError;
16334
16375
  exports.InvalidLocatorError = InvalidLocatorError;
16335
16376
  exports.JavascriptFunction = JavascriptFunction;
16377
+ exports.JsonataFormula = JsonataFormula;
16336
16378
  exports.ListActionInstancesForConnectionQuery = ListActionInstancesForConnectionQuery;
16337
16379
  exports.ListAppEventLogRecordsQuery = ListAppEventLogRecordsQuery;
16338
16380
  exports.ListClustersQuery = ListClustersQuery;
@@ -16357,6 +16399,7 @@ exports.MembraneAxiosInstance = axios;
16357
16399
  exports.MembraneClient = MembraneClient;
16358
16400
  exports.MembraneElementLayer = MembraneElementLayer;
16359
16401
  exports.MembraneError = MembraneError;
16402
+ exports.MergeObjects = MergeObjects;
16360
16403
  exports.MinimalConnector = MinimalConnector;
16361
16404
  exports.NotAuthenticatedError = NotAuthenticatedError;
16362
16405
  exports.NotFoundError = NotFoundError;
@@ -16370,6 +16413,7 @@ exports.OpenRouterNotConfiguredError = OpenRouterNotConfiguredError;
16370
16413
  exports.OpenapiMappingSchema = OpenapiMappingSchema;
16371
16414
  exports.OperationMappingFunction = OperationMappingFunction;
16372
16415
  exports.OperationMappingSchema = OperationMappingSchema;
16416
+ exports.Or = Or;
16373
16417
  exports.Org = Org;
16374
16418
  exports.OrgInvitation = OrgInvitation;
16375
16419
  exports.OrgLimits = OrgLimits;