@squidcloud/local-backend 1.0.48 → 1.0.50

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 (182) hide show
  1. package/dist/common/src/ai-assistant.context.d.ts +13 -13
  2. package/dist/common/src/ai-assistant.context.js +19 -19
  3. package/dist/common/src/ai-assistant.schemas.d.ts +243 -207
  4. package/dist/common/src/ai-assistant.schemas.js +210 -196
  5. package/dist/common/src/ai-assistant.schemas.js.map +1 -1
  6. package/dist/common/src/ai-assistant.types.d.ts +90 -80
  7. package/dist/common/src/ai-assistant.types.js +11 -11
  8. package/dist/common/src/api-call.context.d.ts +13 -13
  9. package/dist/common/src/api-call.context.js +16 -16
  10. package/dist/common/src/api.types.d.ts +23 -23
  11. package/dist/common/src/api.types.js +2 -2
  12. package/dist/common/src/application.schemas.d.ts +1168 -1168
  13. package/dist/common/src/application.schemas.js +741 -741
  14. package/dist/common/src/application.types.d.ts +228 -228
  15. package/dist/common/src/application.types.js +89 -89
  16. package/dist/common/src/backend-function.schemas.d.ts +3 -3
  17. package/dist/common/src/backend-function.schemas.js +12 -12
  18. package/dist/common/src/backend-function.types.d.ts +6 -6
  19. package/dist/common/src/backend-function.types.js +2 -2
  20. package/dist/common/src/backend-run.types.d.ts +54 -54
  21. package/dist/common/src/backend-run.types.js +73 -73
  22. package/dist/common/src/bundle-api.types.d.ts +62 -71
  23. package/dist/common/src/bundle-api.types.js +2 -2
  24. package/dist/common/src/bundle-data.types.d.ts +59 -59
  25. package/dist/common/src/bundle-data.types.js +2 -2
  26. package/dist/common/src/communication.types.d.ts +18 -18
  27. package/dist/common/src/communication.types.js +40 -40
  28. package/dist/common/src/context.types.d.ts +24 -24
  29. package/dist/common/src/context.types.js +2 -2
  30. package/dist/common/src/distributed-lock.context.d.ts +5 -5
  31. package/dist/common/src/distributed-lock.context.js +10 -10
  32. package/dist/common/src/document.types.d.ts +32 -32
  33. package/dist/common/src/document.types.js +50 -50
  34. package/dist/common/src/graphql.context.d.ts +14 -14
  35. package/dist/common/src/graphql.context.js +12 -12
  36. package/dist/common/src/graphql.types.d.ts +11 -11
  37. package/dist/common/src/graphql.types.js +34 -34
  38. package/dist/common/src/heartbeat.types.d.ts +4 -4
  39. package/dist/common/src/heartbeat.types.js +16 -16
  40. package/dist/common/src/http-status.enum.d.ts +50 -50
  41. package/dist/common/src/http-status.enum.js +54 -54
  42. package/dist/common/src/index.d.ts +53 -53
  43. package/dist/common/src/index.js +69 -69
  44. package/dist/common/src/integrations/ai_assistant.types.d.ts +30 -30
  45. package/dist/common/src/integrations/ai_assistant.types.js +2 -2
  46. package/dist/common/src/integrations/api.types.d.ts +80 -80
  47. package/dist/common/src/integrations/api.types.js +2 -2
  48. package/dist/common/src/integrations/auth.types.d.ts +39 -39
  49. package/dist/common/src/integrations/auth.types.js +2 -2
  50. package/dist/common/src/integrations/database.types.d.ts +236 -236
  51. package/dist/common/src/integrations/database.types.js +2 -2
  52. package/dist/common/src/integrations/index.d.ts +101 -101
  53. package/dist/common/src/integrations/index.js +105 -105
  54. package/dist/common/src/integrations/observability.types.d.ts +23 -23
  55. package/dist/common/src/integrations/observability.types.js +23 -23
  56. package/dist/common/src/integrations/observability.types.js.map +1 -1
  57. package/dist/common/src/logger.types.d.ts +21 -21
  58. package/dist/common/src/logger.types.js +11 -11
  59. package/dist/common/src/metrics.types.d.ts +73 -73
  60. package/dist/common/src/metrics.types.js +11 -11
  61. package/dist/common/src/mutation.context.d.ts +13 -13
  62. package/dist/common/src/mutation.context.js +26 -26
  63. package/dist/common/src/mutation.schemas.d.ts +5 -5
  64. package/dist/common/src/mutation.schemas.js +114 -114
  65. package/dist/common/src/mutation.types.d.ts +63 -63
  66. package/dist/common/src/mutation.types.js +142 -142
  67. package/dist/common/src/named-query.context.d.ts +4 -4
  68. package/dist/common/src/named-query.context.js +9 -9
  69. package/dist/common/src/named-query.schemas.d.ts +3 -3
  70. package/dist/common/src/named-query.schemas.js +13 -13
  71. package/dist/common/src/named-query.types.d.ts +8 -8
  72. package/dist/common/src/named-query.types.js +2 -2
  73. package/dist/common/src/query/base-query-builder.d.ts +65 -63
  74. package/dist/common/src/query/base-query-builder.js +294 -294
  75. package/dist/common/src/query/base-query-builder.js.map +1 -1
  76. package/dist/common/src/query/index.d.ts +3 -2
  77. package/dist/common/src/query/index.js +19 -18
  78. package/dist/common/src/query/index.js.map +1 -1
  79. package/dist/common/src/query/query-context.d.ts +47 -47
  80. package/dist/common/src/query/query-context.js +159 -159
  81. package/dist/common/src/query/serialized-query.types.d.ts +24 -0
  82. package/dist/common/src/query/serialized-query.types.js +3 -0
  83. package/dist/common/src/query/serialized-query.types.js.map +1 -0
  84. package/dist/common/src/query.types.d.ts +81 -74
  85. package/dist/common/src/query.types.js +153 -153
  86. package/dist/common/src/query.types.js.map +1 -1
  87. package/dist/common/src/regions.d.ts +21 -21
  88. package/dist/common/src/regions.js +46 -46
  89. package/dist/common/src/schema/schema.types.d.ts +30 -30
  90. package/dist/common/src/schema/schema.types.js +172 -172
  91. package/dist/common/src/secret.schemas.d.ts +6 -6
  92. package/dist/common/src/secret.schemas.js +32 -32
  93. package/dist/common/src/secret.types.d.ts +49 -49
  94. package/dist/common/src/secret.types.js +5 -5
  95. package/dist/common/src/security.types.d.ts +3 -3
  96. package/dist/common/src/security.types.js +2 -2
  97. package/dist/common/src/socket.schemas.d.ts +3 -3
  98. package/dist/common/src/socket.schemas.js +58 -58
  99. package/dist/common/src/socket.types.d.ts +108 -108
  100. package/dist/common/src/socket.types.js +2 -2
  101. package/dist/common/src/time-units.d.ts +5 -5
  102. package/dist/common/src/time-units.js +8 -8
  103. package/dist/common/src/trigger.types.d.ts +15 -15
  104. package/dist/common/src/trigger.types.js +2 -2
  105. package/dist/common/src/types.d.ts +21 -21
  106. package/dist/common/src/types.js +2 -2
  107. package/dist/common/src/utils/array.d.ts +8 -8
  108. package/dist/common/src/utils/array.js +51 -51
  109. package/dist/common/src/utils/assert.d.ts +8 -8
  110. package/dist/common/src/utils/assert.js +49 -49
  111. package/dist/common/src/utils/error.d.ts +4 -4
  112. package/dist/common/src/utils/error.js +10 -10
  113. package/dist/common/src/utils/http.d.ts +2 -2
  114. package/dist/common/src/utils/http.js +38 -38
  115. package/dist/common/src/utils/id.d.ts +2 -2
  116. package/dist/common/src/utils/id.js +21 -21
  117. package/dist/common/src/utils/lock.manager.d.ts +9 -9
  118. package/dist/common/src/utils/lock.manager.js +39 -39
  119. package/dist/common/src/utils/nullish.d.ts +2 -1
  120. package/dist/common/src/utils/nullish.js +11 -7
  121. package/dist/common/src/utils/nullish.js.map +1 -1
  122. package/dist/common/src/utils/object.d.ts +6 -6
  123. package/dist/common/src/utils/object.js +89 -89
  124. package/dist/common/src/utils/serialization.d.ts +6 -6
  125. package/dist/common/src/utils/serialization.js +77 -77
  126. package/dist/common/src/utils/transforms.d.ts +18 -18
  127. package/dist/common/src/utils/transforms.js +92 -92
  128. package/dist/common/src/utils/url.d.ts +1 -1
  129. package/dist/common/src/utils/url.js +15 -15
  130. package/dist/common/src/utils/validation.d.ts +17 -17
  131. package/dist/common/src/utils/validation.js +209 -209
  132. package/dist/common/src/utils/validation.js.map +1 -1
  133. package/dist/common/src/webhook-response.d.ts +7 -7
  134. package/dist/common/src/webhook-response.js +7 -7
  135. package/dist/internal-common/src/async-queue.d.ts +4 -4
  136. package/dist/internal-common/src/async-queue.js +17 -17
  137. package/dist/internal-common/src/code-executor.types.d.ts +13 -13
  138. package/dist/internal-common/src/code-executor.types.js +2 -2
  139. package/dist/internal-common/src/environment/environment.types.d.ts +74 -74
  140. package/dist/internal-common/src/environment/environment.types.js +2 -2
  141. package/dist/internal-common/src/environment/index.d.ts +6 -6
  142. package/dist/internal-common/src/environment/index.js +27 -27
  143. package/dist/internal-common/src/environment/local.environment.d.ts +2 -2
  144. package/dist/internal-common/src/environment/local.environment.js +62 -62
  145. package/dist/internal-common/src/filters/custom-exception.filter.d.ts +6 -6
  146. package/dist/internal-common/src/filters/custom-exception.filter.js +44 -44
  147. package/dist/internal-common/src/index.d.ts +14 -14
  148. package/dist/internal-common/src/index.js +32 -32
  149. package/dist/internal-common/src/interceptors/body.interceptor.d.ts +5 -5
  150. package/dist/internal-common/src/interceptors/body.interceptor.js +24 -24
  151. package/dist/internal-common/src/kafka/kafka.manager.d.ts +22 -22
  152. package/dist/internal-common/src/kafka/kafka.manager.js +129 -128
  153. package/dist/internal-common/src/kafka/kafka.manager.js.map +1 -1
  154. package/dist/internal-common/src/kafka/kafka.types.d.ts +17 -17
  155. package/dist/internal-common/src/kafka/kafka.types.js +2 -2
  156. package/dist/internal-common/src/kafka-observability-publisher.d.ts +11 -11
  157. package/dist/internal-common/src/kafka-observability-publisher.js +20 -20
  158. package/dist/internal-common/src/local-dev.types.d.ts +31 -31
  159. package/dist/internal-common/src/local-dev.types.js +2 -2
  160. package/dist/internal-common/src/observability-publisher.d.ts +9 -9
  161. package/dist/internal-common/src/observability-publisher.js +58 -58
  162. package/dist/internal-common/src/observability.types.d.ts +17 -17
  163. package/dist/internal-common/src/observability.types.js +2 -2
  164. package/dist/internal-common/src/shutdown.manager.d.ts +20 -20
  165. package/dist/internal-common/src/shutdown.manager.js +75 -75
  166. package/dist/internal-common/src/utils.d.ts +5 -5
  167. package/dist/internal-common/src/utils.js +29 -29
  168. package/dist/local-backend/src/index.d.ts +4 -4
  169. package/dist/local-backend/src/index.js +20 -20
  170. package/dist/local-backend/src/local-backend-socket.service.d.ts +18 -18
  171. package/dist/local-backend/src/local-backend-socket.service.js +107 -108
  172. package/dist/local-backend/src/local-backend-socket.service.js.map +1 -1
  173. package/dist/local-backend/src/local-backend.app.d.ts +2 -2
  174. package/dist/local-backend/src/local-backend.app.js +19 -19
  175. package/dist/local-backend/src/local-backend.controller.d.ts +8 -8
  176. package/dist/local-backend/src/local-backend.controller.js +49 -49
  177. package/dist/local-backend/src/local-backend.module.d.ts +8 -8
  178. package/dist/local-backend/src/local-backend.module.js +53 -53
  179. package/dist/local-backend/src/local-backend.service.d.ts +15 -15
  180. package/dist/local-backend/src/local-backend.service.js +165 -165
  181. package/dist/tsconfig.build.tsbuildinfo +1 -1
  182. package/package.json +2 -1
@@ -1,73 +1,73 @@
1
- export type MetricType = 'count' | 'gauge';
2
- export type AggregationPeriod = '1m' | '5m' | '15m' | '1h' | '1d' | '1w';
3
- export declare const aggregationPeriodMap: Record<AggregationPeriod, number>;
4
- export interface SnowflakeCountMetricHistogramData {
5
- STEPINTERVAL: number;
6
- SUMINSTEP: number;
7
- CUMULATIVESUM: number;
8
- RATE: number;
9
- }
10
- export interface CountMetricHistogramData {
11
- stepInterval: number;
12
- sumInStep: number;
13
- cumulativeSum: number;
14
- rate: number;
15
- }
16
- export interface CountMetricSummary {
17
- cumulativeRate: number;
18
- cumulativeSum: number;
19
- }
20
- export interface SnowflakeGaugeMetricHistogramData {
21
- STEPINTERVAL: number;
22
- SUMINSTEP: number;
23
- COUNTINSTEP: number;
24
- MININSTEP: number;
25
- MAXINSTEP: number;
26
- AVGINSTEP: number;
27
- MEDIANINSTEP: number;
28
- }
29
- export interface GaugeMetricHistogramData {
30
- stepInterval: number;
31
- sumInStep: number;
32
- countInStep: number;
33
- minInStep: number;
34
- maxInStep: number;
35
- avgInStep: number;
36
- medianInStep: number;
37
- }
38
- export interface GaugeMetricSummary {
39
- cumulativeSum: number;
40
- cumulativeMin: number;
41
- cumulativeMax: number;
42
- cumulativeAvg: number;
43
- cumulativeCount: number;
44
- }
45
- interface BaseMetricResponse {
46
- type: MetricType;
47
- }
48
- export interface CountMetricResponse extends BaseMetricResponse {
49
- type: 'count';
50
- histogram: Array<CountMetricHistogramData>;
51
- summary: CountMetricSummary;
52
- }
53
- export interface GaugeMetricResponse extends BaseMetricResponse {
54
- type: 'gauge';
55
- histogram: Array<GaugeMetricHistogramData>;
56
- summary: GaugeMetricSummary;
57
- }
58
- export type MetricResponse = CountMetricResponse | GaugeMetricResponse;
59
- export interface GetSingleMetricRequest {
60
- metricName: string;
61
- tagFilters: Record<string, string | Array<string>>;
62
- metricType: MetricType;
63
- }
64
- export interface GetMetricsRequest {
65
- requests: Array<GetSingleMetricRequest>;
66
- from: number;
67
- to: number;
68
- aggregationPeriod: AggregationPeriod;
69
- }
70
- export interface GetMetricsResponse {
71
- responses: Array<MetricResponse>;
72
- }
73
- export {};
1
+ export type MetricType = 'count' | 'gauge';
2
+ export type AggregationPeriod = '1m' | '5m' | '15m' | '1h' | '1d' | '1w';
3
+ export declare const aggregationPeriodMap: Record<AggregationPeriod, number>;
4
+ export interface SnowflakeCountMetricHistogramData {
5
+ STEPINTERVAL: number;
6
+ SUMINSTEP: number;
7
+ CUMULATIVESUM: number;
8
+ RATE: number;
9
+ }
10
+ export interface CountMetricHistogramData {
11
+ stepInterval: number;
12
+ sumInStep: number;
13
+ cumulativeSum: number;
14
+ rate: number;
15
+ }
16
+ export interface CountMetricSummary {
17
+ cumulativeRate: number;
18
+ cumulativeSum: number;
19
+ }
20
+ export interface SnowflakeGaugeMetricHistogramData {
21
+ STEPINTERVAL: number;
22
+ SUMINSTEP: number;
23
+ COUNTINSTEP: number;
24
+ MININSTEP: number;
25
+ MAXINSTEP: number;
26
+ AVGINSTEP: number;
27
+ MEDIANINSTEP: number;
28
+ }
29
+ export interface GaugeMetricHistogramData {
30
+ stepInterval: number;
31
+ sumInStep: number;
32
+ countInStep: number;
33
+ minInStep: number;
34
+ maxInStep: number;
35
+ avgInStep: number;
36
+ medianInStep: number;
37
+ }
38
+ export interface GaugeMetricSummary {
39
+ cumulativeSum: number;
40
+ cumulativeMin: number;
41
+ cumulativeMax: number;
42
+ cumulativeAvg: number;
43
+ cumulativeCount: number;
44
+ }
45
+ interface BaseMetricResponse {
46
+ type: MetricType;
47
+ }
48
+ export interface CountMetricResponse extends BaseMetricResponse {
49
+ type: 'count';
50
+ histogram: Array<CountMetricHistogramData>;
51
+ summary: CountMetricSummary;
52
+ }
53
+ export interface GaugeMetricResponse extends BaseMetricResponse {
54
+ type: 'gauge';
55
+ histogram: Array<GaugeMetricHistogramData>;
56
+ summary: GaugeMetricSummary;
57
+ }
58
+ export type MetricResponse = CountMetricResponse | GaugeMetricResponse;
59
+ export interface GetSingleMetricRequest {
60
+ metricName: string;
61
+ tagFilters: Record<string, string | Array<string>>;
62
+ metricType: MetricType;
63
+ }
64
+ export interface GetMetricsRequest {
65
+ requests: Array<GetSingleMetricRequest>;
66
+ from: number;
67
+ to: number;
68
+ aggregationPeriod: AggregationPeriod;
69
+ }
70
+ export interface GetMetricsResponse {
71
+ responses: Array<MetricResponse>;
72
+ }
73
+ export {};
@@ -1,12 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.aggregationPeriodMap = void 0;
4
- exports.aggregationPeriodMap = {
5
- '1m': 1,
6
- '5m': 5,
7
- '15m': 15,
8
- '1h': 60,
9
- '1d': 1440,
10
- '1w': 10080,
11
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.aggregationPeriodMap = void 0;
4
+ exports.aggregationPeriodMap = {
5
+ '1m': 1,
6
+ '5m': 5,
7
+ '15m': 15,
8
+ '1h': 60,
9
+ '1d': 1440,
10
+ '1w': 10080,
11
+ };
12
12
  //# sourceMappingURL=metrics.types.js.map
@@ -1,13 +1,13 @@
1
- import { BeforeAndAfterDocs } from './document.types';
2
- import { Mutation, MutationType } from './mutation.types';
3
- import { Paths } from './types';
4
- export declare class MutationContext<T = any> {
5
- readonly mutation: Mutation<T>;
6
- readonly beforeAndAfterDocs: BeforeAndAfterDocs<T>;
7
- readonly serverTimeStamp: Date;
8
- constructor(mutation: Mutation<T>, beforeAndAfterDocs: BeforeAndAfterDocs<T>, serverTimeStamp: Date);
9
- getMutationType(): MutationType;
10
- get before(): T | undefined;
11
- get after(): T | undefined;
12
- affectsPath(path: Paths<T>): boolean;
13
- }
1
+ import { BeforeAndAfterDocs } from './document.types';
2
+ import { Mutation, MutationType } from './mutation.types';
3
+ import { Paths } from './types';
4
+ export declare class MutationContext<T = any> {
5
+ readonly mutation: Mutation<T>;
6
+ readonly beforeAndAfterDocs: BeforeAndAfterDocs<T>;
7
+ readonly serverTimeStamp: Date;
8
+ constructor(mutation: Mutation<T>, beforeAndAfterDocs: BeforeAndAfterDocs<T>, serverTimeStamp: Date);
9
+ getMutationType(): MutationType;
10
+ get before(): T | undefined;
11
+ get after(): T | undefined;
12
+ affectsPath(path: Paths<T>): boolean;
13
+ }
@@ -1,27 +1,27 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MutationContext = void 0;
4
- const _ = require("lodash");
5
- class MutationContext {
6
- constructor(mutation, beforeAndAfterDocs, serverTimeStamp) {
7
- this.mutation = mutation;
8
- this.beforeAndAfterDocs = beforeAndAfterDocs;
9
- this.serverTimeStamp = serverTimeStamp;
10
- }
11
- getMutationType() {
12
- return this.mutation.type;
13
- }
14
- get before() {
15
- return this.beforeAndAfterDocs.before;
16
- }
17
- get after() {
18
- return this.beforeAndAfterDocs.after;
19
- }
20
- affectsPath(path) {
21
- const before = this.before ? _.get(this.before, path) : undefined;
22
- const after = this.after ? _.get(this.after, path) : undefined;
23
- return !_.isEqual(before, after);
24
- }
25
- }
26
- exports.MutationContext = MutationContext;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MutationContext = void 0;
4
+ const _ = require("lodash");
5
+ class MutationContext {
6
+ constructor(mutation, beforeAndAfterDocs, serverTimeStamp) {
7
+ this.mutation = mutation;
8
+ this.beforeAndAfterDocs = beforeAndAfterDocs;
9
+ this.serverTimeStamp = serverTimeStamp;
10
+ }
11
+ getMutationType() {
12
+ return this.mutation.type;
13
+ }
14
+ get before() {
15
+ return this.beforeAndAfterDocs.before;
16
+ }
17
+ get after() {
18
+ return this.beforeAndAfterDocs.after;
19
+ }
20
+ affectsPath(path) {
21
+ const before = this.before ? _.get(this.before, path) : undefined;
22
+ const after = this.after ? _.get(this.after, path) : undefined;
23
+ return !_.isEqual(before, after);
24
+ }
25
+ }
26
+ exports.MutationContext = MutationContext;
27
27
  //# sourceMappingURL=mutation.context.js.map
@@ -1,5 +1,5 @@
1
- import { JSONSchemaType } from 'ajv';
2
- import { MutateRequest } from './mutation.types';
3
- type DocumentBase = Record<string, any>;
4
- export declare const MutationRequestSchema: JSONSchemaType<MutateRequest<DocumentBase>>;
5
- export {};
1
+ import { JSONSchemaType } from 'ajv';
2
+ import { MutateRequest } from './mutation.types';
3
+ type DocumentBase = Record<string, any>;
4
+ export declare const MutationRequestSchema: JSONSchemaType<MutateRequest<DocumentBase>>;
5
+ export {};
@@ -1,115 +1,115 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MutationRequestSchema = void 0;
4
- const Anything = {};
5
- const AnyString = {
6
- type: 'string',
7
- };
8
- const DocumentSchema = {
9
- type: 'object',
10
- };
11
- const DocIdSchema = {
12
- type: 'object',
13
- required: ['docId', 'integrationId', 'collectionName'],
14
- properties: {
15
- docId: AnyString,
16
- integrationId: AnyString,
17
- collectionName: AnyString,
18
- },
19
- };
20
- const InsertSchema = {
21
- type: 'object',
22
- required: ['type', 'properties', 'squidDocIdObj'],
23
- properties: {
24
- type: { type: 'string', const: 'insert' },
25
- properties: DocumentSchema,
26
- squidDocIdObj: DocIdSchema,
27
- },
28
- };
29
- const DeleteSchema = {
30
- type: 'object',
31
- required: ['type', 'squidDocIdObj'],
32
- properties: {
33
- type: { type: 'string', const: 'delete' },
34
- squidDocIdObj: DocIdSchema,
35
- },
36
- };
37
- const ValueUpdateProperties = {
38
- type: { type: 'string', const: 'update' },
39
- value: Anything,
40
- };
41
- const PropertyMutationSchema = {
42
- oneOf: [
43
- {
44
- type: 'object',
45
- required: ['type', 'fn', 'value'],
46
- properties: {
47
- type: { type: 'string', const: 'applyNumericFn' },
48
- fn: { type: 'string', const: 'increment' },
49
- value: { type: 'number' },
50
- },
51
- },
52
- {
53
- type: 'object',
54
- required: ['type'],
55
- properties: {
56
- type: { type: 'string', const: 'removeProperty' },
57
- },
58
- },
59
- {
60
- type: 'object',
61
- required: ['type', 'value'],
62
- properties: ValueUpdateProperties,
63
- },
64
- {
65
- type: 'object',
66
- required: ['type', 'fn', 'value'],
67
- properties: {
68
- type: { type: 'string', const: 'applyStringFn' },
69
- fn: { type: 'string', const: 'extendString' },
70
- value: AnyString,
71
- },
72
- },
73
- {
74
- type: 'object',
75
- required: ['type', 'fn'],
76
- properties: {
77
- type: { type: 'string', const: 'applyStringFn' },
78
- fn: { type: 'string', const: 'trim' },
79
- },
80
- },
81
- ],
82
- };
83
- const UpdateSchema = {
84
- type: 'object',
85
- required: [],
86
- properties: {
87
- type: { type: 'string', const: 'update' },
88
- squidDocIdObj: DocIdSchema,
89
- properties: {
90
- type: 'object',
91
- patternProperties: {
92
- '[0-9a-zA-Z\\$_\\-\\.]+': {
93
- type: 'array',
94
- minItems: 1,
95
- items: PropertyMutationSchema,
96
- },
97
- },
98
- },
99
- },
100
- };
101
- const MutationSchema = {
102
- oneOf: [InsertSchema, DeleteSchema, UpdateSchema],
103
- };
104
- exports.MutationRequestSchema = {
105
- type: 'object',
106
- required: ['integrationId', 'mutations'],
107
- properties: {
108
- integrationId: AnyString,
109
- mutations: {
110
- type: 'array',
111
- items: MutationSchema,
112
- },
113
- },
114
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MutationRequestSchema = void 0;
4
+ const Anything = {};
5
+ const AnyString = {
6
+ type: 'string',
7
+ };
8
+ const DocumentSchema = {
9
+ type: 'object',
10
+ };
11
+ const DocIdSchema = {
12
+ type: 'object',
13
+ required: ['docId', 'integrationId', 'collectionName'],
14
+ properties: {
15
+ docId: AnyString,
16
+ integrationId: AnyString,
17
+ collectionName: AnyString,
18
+ },
19
+ };
20
+ const InsertSchema = {
21
+ type: 'object',
22
+ required: ['type', 'properties', 'squidDocIdObj'],
23
+ properties: {
24
+ type: { type: 'string', const: 'insert' },
25
+ properties: DocumentSchema,
26
+ squidDocIdObj: DocIdSchema,
27
+ },
28
+ };
29
+ const DeleteSchema = {
30
+ type: 'object',
31
+ required: ['type', 'squidDocIdObj'],
32
+ properties: {
33
+ type: { type: 'string', const: 'delete' },
34
+ squidDocIdObj: DocIdSchema,
35
+ },
36
+ };
37
+ const ValueUpdateProperties = {
38
+ type: { type: 'string', const: 'update' },
39
+ value: Anything,
40
+ };
41
+ const PropertyMutationSchema = {
42
+ oneOf: [
43
+ {
44
+ type: 'object',
45
+ required: ['type', 'fn', 'value'],
46
+ properties: {
47
+ type: { type: 'string', const: 'applyNumericFn' },
48
+ fn: { type: 'string', const: 'increment' },
49
+ value: { type: 'number' },
50
+ },
51
+ },
52
+ {
53
+ type: 'object',
54
+ required: ['type'],
55
+ properties: {
56
+ type: { type: 'string', const: 'removeProperty' },
57
+ },
58
+ },
59
+ {
60
+ type: 'object',
61
+ required: ['type', 'value'],
62
+ properties: ValueUpdateProperties,
63
+ },
64
+ {
65
+ type: 'object',
66
+ required: ['type', 'fn', 'value'],
67
+ properties: {
68
+ type: { type: 'string', const: 'applyStringFn' },
69
+ fn: { type: 'string', const: 'extendString' },
70
+ value: AnyString,
71
+ },
72
+ },
73
+ {
74
+ type: 'object',
75
+ required: ['type', 'fn'],
76
+ properties: {
77
+ type: { type: 'string', const: 'applyStringFn' },
78
+ fn: { type: 'string', const: 'trim' },
79
+ },
80
+ },
81
+ ],
82
+ };
83
+ const UpdateSchema = {
84
+ type: 'object',
85
+ required: [],
86
+ properties: {
87
+ type: { type: 'string', const: 'update' },
88
+ squidDocIdObj: DocIdSchema,
89
+ properties: {
90
+ type: 'object',
91
+ patternProperties: {
92
+ '[0-9a-zA-Z\\$_\\-\\.]+': {
93
+ type: 'array',
94
+ minItems: 1,
95
+ items: PropertyMutationSchema,
96
+ },
97
+ },
98
+ },
99
+ },
100
+ };
101
+ const MutationSchema = {
102
+ oneOf: [InsertSchema, DeleteSchema, UpdateSchema],
103
+ };
104
+ exports.MutationRequestSchema = {
105
+ type: 'object',
106
+ required: ['integrationId', 'mutations'],
107
+ properties: {
108
+ integrationId: AnyString,
109
+ mutations: {
110
+ type: 'array',
111
+ items: MutationSchema,
112
+ },
113
+ },
114
+ };
115
115
  //# sourceMappingURL=mutation.schemas.js.map
@@ -1,63 +1,63 @@
1
- import { IntegrationId } from './communication.types';
2
- import { DocTimestamp, FieldName, SquidDocId, SquidDocIdObj, SquidDocument } from './document.types';
3
- export interface MutateRequest<T = any> {
4
- integrationId: IntegrationId;
5
- mutations: Array<Mutation<T>>;
6
- }
7
- export interface ExecuteMutationsResponse {
8
- timestamp: DocTimestamp;
9
- idResolutionMap?: IdResolutionMap;
10
- afterDocs: Record<SquidDocId, SquidDocument>;
11
- }
12
- export interface MutateResponse extends Omit<ExecuteMutationsResponse, 'afterDocs'> {
13
- refreshList: Array<SquidDocId>;
14
- }
15
- export type IdResolutionMap = Record<SquidDocId, SquidDocId>;
16
- export type Mutation<T = any> = UpdateMutation<T> | InsertMutation<T> | DeleteMutation;
17
- export type MutationType = 'insert' | 'update' | 'delete';
18
- interface BaseMutation {
19
- type: MutationType;
20
- squidDocIdObj: SquidDocIdObj;
21
- }
22
- export interface DeleteMutation extends BaseMutation {
23
- type: 'delete';
24
- }
25
- export interface UpdateMutation<T = any> extends BaseMutation {
26
- type: 'update';
27
- properties: {
28
- [key in keyof T & string]?: Array<PropertyMutation<T[key]>>;
29
- };
30
- }
31
- export interface InsertMutation<T = any> extends BaseMutation {
32
- type: 'insert';
33
- properties: T;
34
- }
35
- export type PropertyMutation<Value = any> = ApplyNumericFnPropertyMutation | ApplyStringFnPropertyMutation | ValueUpdatePropertyMutation<Value> | RemovePropertyMutation;
36
- export interface ValueUpdatePropertyMutation<Value = any> {
37
- type: 'update';
38
- value: Value;
39
- }
40
- export interface ApplyNumericFnPropertyMutation {
41
- type: 'applyNumericFn';
42
- fn: 'increment';
43
- value: number;
44
- }
45
- export interface RemovePropertyMutation {
46
- type: 'removeProperty';
47
- }
48
- interface ApplyExtendString {
49
- type: 'applyStringFn';
50
- fn: 'extendString';
51
- value: string;
52
- }
53
- interface ApplyTrimString {
54
- type: 'applyStringFn';
55
- fn: 'trim';
56
- }
57
- export type ApplyStringFnPropertyMutation = ApplyExtendString | ApplyTrimString;
58
- export declare function sortUpdateMutationProperties(updateMutation: UpdateMutation): Array<[FieldName, Array<PropertyMutation>]>;
59
- export declare function mergeMutations(mutationA: Mutation, mutationB: Mutation): Mutation;
60
- export declare function applyUpdateMutation<T extends SquidDocument>(doc: T, updateMutation: UpdateMutation<T>): T | undefined;
61
- export declare function convertInsertToUpdate(insertMutation: InsertMutation): UpdateMutation;
62
- export declare function reduceMutations(mutations: Array<Mutation<unknown>>): Array<Mutation<unknown>>;
63
- export {};
1
+ import { IntegrationId } from './communication.types';
2
+ import { DocTimestamp, FieldName, SquidDocId, SquidDocIdObj, SquidDocument } from './document.types';
3
+ export interface MutateRequest<T = any> {
4
+ integrationId: IntegrationId;
5
+ mutations: Array<Mutation<T>>;
6
+ }
7
+ export interface ExecuteMutationsResponse {
8
+ timestamp: DocTimestamp;
9
+ idResolutionMap?: IdResolutionMap;
10
+ afterDocs: Record<SquidDocId, SquidDocument>;
11
+ }
12
+ export interface MutateResponse extends Omit<ExecuteMutationsResponse, 'afterDocs'> {
13
+ refreshList: Array<SquidDocId>;
14
+ }
15
+ export type IdResolutionMap = Record<SquidDocId, SquidDocId>;
16
+ export type Mutation<T = any> = UpdateMutation<T> | InsertMutation<T> | DeleteMutation;
17
+ export type MutationType = 'insert' | 'update' | 'delete';
18
+ interface BaseMutation {
19
+ type: MutationType;
20
+ squidDocIdObj: SquidDocIdObj;
21
+ }
22
+ export interface DeleteMutation extends BaseMutation {
23
+ type: 'delete';
24
+ }
25
+ export interface UpdateMutation<T = any> extends BaseMutation {
26
+ type: 'update';
27
+ properties: {
28
+ [key in keyof T & string]?: Array<PropertyMutation<T[key]>>;
29
+ };
30
+ }
31
+ export interface InsertMutation<T = any> extends BaseMutation {
32
+ type: 'insert';
33
+ properties: T;
34
+ }
35
+ export type PropertyMutation<Value = any> = ApplyNumericFnPropertyMutation | ApplyStringFnPropertyMutation | ValueUpdatePropertyMutation<Value> | RemovePropertyMutation;
36
+ export interface ValueUpdatePropertyMutation<Value = any> {
37
+ type: 'update';
38
+ value: Value;
39
+ }
40
+ export interface ApplyNumericFnPropertyMutation {
41
+ type: 'applyNumericFn';
42
+ fn: 'increment';
43
+ value: number;
44
+ }
45
+ export interface RemovePropertyMutation {
46
+ type: 'removeProperty';
47
+ }
48
+ interface ApplyExtendString {
49
+ type: 'applyStringFn';
50
+ fn: 'extendString';
51
+ value: string;
52
+ }
53
+ interface ApplyTrimString {
54
+ type: 'applyStringFn';
55
+ fn: 'trim';
56
+ }
57
+ export type ApplyStringFnPropertyMutation = ApplyExtendString | ApplyTrimString;
58
+ export declare function sortUpdateMutationProperties(updateMutation: UpdateMutation): Array<[FieldName, Array<PropertyMutation>]>;
59
+ export declare function mergeMutations(mutationA: Mutation, mutationB: Mutation): Mutation;
60
+ export declare function applyUpdateMutation<T extends SquidDocument>(doc: T, updateMutation: UpdateMutation<T>): T | undefined;
61
+ export declare function convertInsertToUpdate(insertMutation: InsertMutation): UpdateMutation;
62
+ export declare function reduceMutations(mutations: Array<Mutation<unknown>>): Array<Mutation<unknown>>;
63
+ export {};