@squidcloud/local-backend 1.0.158 → 1.0.159

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 (160) hide show
  1. package/package.json +1 -1
  2. package/dist/internal-common/src/code-executor.types.d.ts +0 -15
  3. package/dist/internal-common/src/code-executor.types.js +0 -3
  4. package/dist/internal-common/src/code-executor.types.js.map +0 -1
  5. package/dist/internal-common/src/local-dev.types.d.ts +0 -54
  6. package/dist/internal-common/src/local-dev.types.js +0 -11
  7. package/dist/internal-common/src/local-dev.types.js.map +0 -1
  8. package/dist/internal-common/src/public-types/ai-chatbot.context.d.ts +0 -13
  9. package/dist/internal-common/src/public-types/ai-chatbot.context.js +0 -20
  10. package/dist/internal-common/src/public-types/ai-chatbot.context.js.map +0 -1
  11. package/dist/internal-common/src/public-types/ai-chatbot.types.d.ts +0 -126
  12. package/dist/internal-common/src/public-types/ai-chatbot.types.js +0 -28
  13. package/dist/internal-common/src/public-types/ai-chatbot.types.js.map +0 -1
  14. package/dist/internal-common/src/public-types/api-call.context.d.ts +0 -13
  15. package/dist/internal-common/src/public-types/api-call.context.js +0 -17
  16. package/dist/internal-common/src/public-types/api-call.context.js.map +0 -1
  17. package/dist/internal-common/src/public-types/api.types.d.ts +0 -22
  18. package/dist/internal-common/src/public-types/api.types.js +0 -3
  19. package/dist/internal-common/src/public-types/api.types.js.map +0 -1
  20. package/dist/internal-common/src/public-types/application.types.d.ts +0 -199
  21. package/dist/internal-common/src/public-types/application.types.js +0 -90
  22. package/dist/internal-common/src/public-types/application.types.js.map +0 -1
  23. package/dist/internal-common/src/public-types/backend-run.types.d.ts +0 -52
  24. package/dist/internal-common/src/public-types/backend-run.types.js +0 -28
  25. package/dist/internal-common/src/public-types/backend-run.types.js.map +0 -1
  26. package/dist/internal-common/src/public-types/bundle-api.types.d.ts +0 -53
  27. package/dist/internal-common/src/public-types/bundle-api.types.js +0 -3
  28. package/dist/internal-common/src/public-types/bundle-api.types.js.map +0 -1
  29. package/dist/internal-common/src/public-types/bundle-data.types.d.ts +0 -75
  30. package/dist/internal-common/src/public-types/bundle-data.types.js +0 -3
  31. package/dist/internal-common/src/public-types/bundle-data.types.js.map +0 -1
  32. package/dist/internal-common/src/public-types/communication.types.d.ts +0 -20
  33. package/dist/internal-common/src/public-types/communication.types.js +0 -42
  34. package/dist/internal-common/src/public-types/communication.types.js.map +0 -1
  35. package/dist/internal-common/src/public-types/context.types.d.ts +0 -24
  36. package/dist/internal-common/src/public-types/context.types.js +0 -3
  37. package/dist/internal-common/src/public-types/context.types.js.map +0 -1
  38. package/dist/internal-common/src/public-types/distributed-lock.context.d.ts +0 -4
  39. package/dist/internal-common/src/public-types/distributed-lock.context.js +0 -10
  40. package/dist/internal-common/src/public-types/distributed-lock.context.js.map +0 -1
  41. package/dist/internal-common/src/public-types/document.types.d.ts +0 -32
  42. package/dist/internal-common/src/public-types/document.types.js +0 -51
  43. package/dist/internal-common/src/public-types/document.types.js.map +0 -1
  44. package/dist/internal-common/src/public-types/graphql.context.d.ts +0 -14
  45. package/dist/internal-common/src/public-types/graphql.context.js +0 -13
  46. package/dist/internal-common/src/public-types/graphql.context.js.map +0 -1
  47. package/dist/internal-common/src/public-types/graphql.types.d.ts +0 -11
  48. package/dist/internal-common/src/public-types/graphql.types.js +0 -35
  49. package/dist/internal-common/src/public-types/graphql.types.js.map +0 -1
  50. package/dist/internal-common/src/public-types/http-status.enum.d.ts +0 -50
  51. package/dist/internal-common/src/public-types/http-status.enum.js +0 -55
  52. package/dist/internal-common/src/public-types/http-status.enum.js.map +0 -1
  53. package/dist/internal-common/src/public-types/integration-types.d.ts +0 -58
  54. package/dist/internal-common/src/public-types/integration-types.js +0 -65
  55. package/dist/internal-common/src/public-types/integration-types.js.map +0 -1
  56. package/dist/internal-common/src/public-types/integrations/ai_chatbot.types.d.ts +0 -32
  57. package/dist/internal-common/src/public-types/integrations/ai_chatbot.types.js +0 -3
  58. package/dist/internal-common/src/public-types/integrations/ai_chatbot.types.js.map +0 -1
  59. package/dist/internal-common/src/public-types/integrations/api.types.d.ts +0 -81
  60. package/dist/internal-common/src/public-types/integrations/api.types.js +0 -3
  61. package/dist/internal-common/src/public-types/integrations/api.types.js.map +0 -1
  62. package/dist/internal-common/src/public-types/integrations/auth.types.d.ts +0 -46
  63. package/dist/internal-common/src/public-types/integrations/auth.types.js +0 -3
  64. package/dist/internal-common/src/public-types/integrations/auth.types.js.map +0 -1
  65. package/dist/internal-common/src/public-types/integrations/database.types.d.ts +0 -275
  66. package/dist/internal-common/src/public-types/integrations/database.types.js +0 -3
  67. package/dist/internal-common/src/public-types/integrations/database.types.js.map +0 -1
  68. package/dist/internal-common/src/public-types/integrations/observability.types.d.ts +0 -24
  69. package/dist/internal-common/src/public-types/integrations/observability.types.js +0 -24
  70. package/dist/internal-common/src/public-types/integrations/observability.types.js.map +0 -1
  71. package/dist/internal-common/src/public-types/integrations/schemas.d.ts +0 -74
  72. package/dist/internal-common/src/public-types/integrations/schemas.js +0 -43
  73. package/dist/internal-common/src/public-types/integrations/schemas.js.map +0 -1
  74. package/dist/internal-common/src/public-types/logger.types.d.ts +0 -21
  75. package/dist/internal-common/src/public-types/logger.types.js +0 -12
  76. package/dist/internal-common/src/public-types/logger.types.js.map +0 -1
  77. package/dist/internal-common/src/public-types/mutation.context.d.ts +0 -13
  78. package/dist/internal-common/src/public-types/mutation.context.js +0 -27
  79. package/dist/internal-common/src/public-types/mutation.context.js.map +0 -1
  80. package/dist/internal-common/src/public-types/mutation.types.d.ts +0 -63
  81. package/dist/internal-common/src/public-types/mutation.types.js +0 -143
  82. package/dist/internal-common/src/public-types/mutation.types.js.map +0 -1
  83. package/dist/internal-common/src/public-types/native-query.context.d.ts +0 -7
  84. package/dist/internal-common/src/public-types/native-query.context.js +0 -12
  85. package/dist/internal-common/src/public-types/native-query.context.js.map +0 -1
  86. package/dist/internal-common/src/public-types/openapi.types.d.ts +0 -26
  87. package/dist/internal-common/src/public-types/openapi.types.js +0 -3
  88. package/dist/internal-common/src/public-types/openapi.types.js.map +0 -1
  89. package/dist/internal-common/src/public-types/query-context.d.ts +0 -47
  90. package/dist/internal-common/src/public-types/query-context.js +0 -160
  91. package/dist/internal-common/src/public-types/query-context.js.map +0 -1
  92. package/dist/internal-common/src/public-types/query.types.d.ts +0 -86
  93. package/dist/internal-common/src/public-types/query.types.js +0 -98
  94. package/dist/internal-common/src/public-types/query.types.js.map +0 -1
  95. package/dist/internal-common/src/public-types/secret.types.d.ts +0 -68
  96. package/dist/internal-common/src/public-types/secret.types.js +0 -6
  97. package/dist/internal-common/src/public-types/secret.types.js.map +0 -1
  98. package/dist/internal-common/src/public-types/socket.types.d.ts +0 -126
  99. package/dist/internal-common/src/public-types/socket.types.js +0 -10
  100. package/dist/internal-common/src/public-types/socket.types.js.map +0 -1
  101. package/dist/internal-common/src/public-types/types.d.ts +0 -21
  102. package/dist/internal-common/src/public-types/types.js +0 -3
  103. package/dist/internal-common/src/public-types/types.js.map +0 -1
  104. package/dist/internal-common/src/schema/schema.types.d.ts +0 -30
  105. package/dist/internal-common/src/schema/schema.types.js +0 -167
  106. package/dist/internal-common/src/schema/schema.types.js.map +0 -1
  107. package/dist/internal-common/src/types/openapi-response.d.ts +0 -6
  108. package/dist/internal-common/src/types/openapi-response.js +0 -3
  109. package/dist/internal-common/src/types/openapi-response.js.map +0 -1
  110. package/dist/internal-common/src/types/security-internal.types.d.ts +0 -20
  111. package/dist/internal-common/src/types/security-internal.types.js +0 -3
  112. package/dist/internal-common/src/types/security-internal.types.js.map +0 -1
  113. package/dist/internal-common/src/utils/assert.d.ts +0 -3
  114. package/dist/internal-common/src/utils/assert.js +0 -15
  115. package/dist/internal-common/src/utils/assert.js.map +0 -1
  116. package/dist/internal-common/src/utils/backend-transforms.d.ts +0 -3
  117. package/dist/internal-common/src/utils/backend-transforms.js +0 -91
  118. package/dist/internal-common/src/utils/backend-transforms.js.map +0 -1
  119. package/dist/internal-common/src/utils/global.utils.d.ts +0 -11
  120. package/dist/internal-common/src/utils/global.utils.js +0 -51
  121. package/dist/internal-common/src/utils/global.utils.js.map +0 -1
  122. package/dist/internal-common/src/utils/http.d.ts +0 -2
  123. package/dist/internal-common/src/utils/http.js +0 -55
  124. package/dist/internal-common/src/utils/http.js.map +0 -1
  125. package/dist/internal-common/src/utils/object.d.ts +0 -5
  126. package/dist/internal-common/src/utils/object.js +0 -76
  127. package/dist/internal-common/src/utils/object.js.map +0 -1
  128. package/dist/internal-common/src/utils/serialization.d.ts +0 -5
  129. package/dist/internal-common/src/utils/serialization.js +0 -74
  130. package/dist/internal-common/src/utils/serialization.js.map +0 -1
  131. package/dist/internal-common/src/utils/validation.d.ts +0 -19
  132. package/dist/internal-common/src/utils/validation.js +0 -210
  133. package/dist/internal-common/src/utils/validation.js.map +0 -1
  134. package/dist/internal-common/src/websocket.impl.d.ts +0 -21
  135. package/dist/internal-common/src/websocket.impl.js +0 -80
  136. package/dist/internal-common/src/websocket.impl.js.map +0 -1
  137. package/dist/local-backend/openapi-template.hbs +0 -1
  138. package/dist/local-backend/package.json +0 -54
  139. package/dist/local-backend/src/index.d.ts +0 -4
  140. package/dist/local-backend/src/index.js.map +0 -1
  141. package/dist/local-backend/src/local-backend-socket.service.d.ts +0 -22
  142. package/dist/local-backend/src/local-backend-socket.service.js +0 -212
  143. package/dist/local-backend/src/local-backend-socket.service.js.map +0 -1
  144. package/dist/local-backend/src/local-backend.app.d.ts +0 -2
  145. package/dist/local-backend/src/local-backend.app.js +0 -26
  146. package/dist/local-backend/src/local-backend.app.js.map +0 -1
  147. package/dist/local-backend/src/local-backend.controller.d.ts +0 -8
  148. package/dist/local-backend/src/local-backend.controller.js +0 -49
  149. package/dist/local-backend/src/local-backend.controller.js.map +0 -1
  150. package/dist/local-backend/src/local-backend.module.d.ts +0 -8
  151. package/dist/local-backend/src/local-backend.module.js +0 -52
  152. package/dist/local-backend/src/local-backend.module.js.map +0 -1
  153. package/dist/local-backend/src/local-backend.service.d.ts +0 -17
  154. package/dist/local-backend/src/local-backend.service.js +0 -175
  155. package/dist/local-backend/src/local-backend.service.js.map +0 -1
  156. package/dist/local-backend/src/utils/shell-runner.d.ts +0 -4
  157. package/dist/local-backend/src/utils/shell-runner.js +0 -28
  158. package/dist/local-backend/src/utils/shell-runner.js.map +0 -1
  159. package/dist/local-backend/tsoa.json +0 -15
  160. package/dist/tsconfig.build.tsbuildinfo +0 -1
@@ -1,167 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findMatchingPropertiesForKey = exports.validateSchema = exports.compileSchema = exports.DATA_SCHEMA_FIELD_TYPES = exports.CUSTOM_FIELD_TYPES = exports.BASIC_FIELD_TYPES = void 0;
4
- const ajv_1 = require("ajv");
5
- const ajv_formats_1 = require("ajv-formats");
6
- const deep_diff_1 = require("deep-diff");
7
- const validation_1 = require("../utils/validation");
8
- const assertic_1 = require("assertic");
9
- const http_status_enum_1 = require("../public-types/http-status.enum");
10
- const ajv = new ajv_1.default({ allErrors: true, allowUnionTypes: false, useDefaults: false });
11
- (0, ajv_formats_1.default)(ajv);
12
- ajv.addKeyword({
13
- keyword: 'isDate',
14
- type: 'object',
15
- validate: (isDate, value) => {
16
- return isDate === value instanceof Date;
17
- },
18
- });
19
- ajv.addKeyword({
20
- keyword: 'isJSON',
21
- type: 'object',
22
- validate: (isJSON, value) => {
23
- try {
24
- const jsonString = JSON.stringify(value);
25
- JSON.parse(jsonString);
26
- return true;
27
- }
28
- catch (_a) {
29
- return false;
30
- }
31
- },
32
- });
33
- ajv.addKeyword({
34
- keyword: 'isComputed',
35
- validate: (isComputed, value) => {
36
- return isComputed ? value !== null : true;
37
- },
38
- });
39
- ajv.addKeyword({
40
- keyword: 'isDefaultComputed',
41
- validate: (isDefaultComputed, value) => {
42
- return isDefaultComputed ? value !== null : true;
43
- },
44
- });
45
- ajv.addKeyword({
46
- keyword: 'primaryKey',
47
- validate: (isPrimaryKey, value) => {
48
- return isPrimaryKey ? value !== null : true;
49
- },
50
- });
51
- ajv.addKeyword({
52
- keyword: 'insertable',
53
- validate: (insertable, value) => {
54
- return insertable ? value !== null : true;
55
- },
56
- });
57
- ajv.addKeyword({
58
- keyword: 'deletable',
59
- validate: (deletable, value) => {
60
- return deletable ? value !== null : true;
61
- },
62
- });
63
- ajv.addKeyword({
64
- keyword: 'applyDefaultValueOn',
65
- validate: (applyDefaultValueOn) => {
66
- return applyDefaultValueOn ? ['always', 'empty', 'updateOrEmpty'].includes(applyDefaultValueOn) : true;
67
- },
68
- });
69
- ajv.addKeyword({
70
- keyword: 'dataType',
71
- validate: () => {
72
- return true;
73
- },
74
- });
75
- exports.BASIC_FIELD_TYPES = ['string', 'integer', 'number', 'boolean', 'map', 'array', 'any'];
76
- exports.CUSTOM_FIELD_TYPES = ['date', 'json', 'objectId'];
77
- exports.DATA_SCHEMA_FIELD_TYPES = [...exports.BASIC_FIELD_TYPES, ...exports.CUSTOM_FIELD_TYPES];
78
- function compileSchema(schema) {
79
- return ajv.compile(schema);
80
- }
81
- exports.compileSchema = compileSchema;
82
- function validateSchema(schema, data, updatedPaths = [], dataBefore = {}) {
83
- const validator = compileSchema(schema);
84
- const isValid = validator(data);
85
- if (!updatedPaths.length && !isValid) {
86
- throw new validation_1.ValidationError(`The data does not conform with the collection schema.`, http_status_enum_1.HttpStatus.BAD_REQUEST, {
87
- errors: validator.errors,
88
- });
89
- }
90
- if (!isValid && updatedPaths.length) {
91
- for (const schemaError of (0, assertic_1.truthy)(validator.errors)) {
92
- let fieldPath = schemaError.instancePath;
93
- if (schemaError.params['missingProperty']) {
94
- fieldPath = `${fieldPath}/${schemaError.params['missingProperty']}`;
95
- }
96
- fieldPath = fieldPath.slice(1).replace(/\//g, '.') + '.';
97
- if (updatedPaths.some(updatedPath => fieldPath.startsWith(updatedPath + '.'))) {
98
- throw new validation_1.ValidationError(`${fieldPath} does not conform with the collection schema.`, http_status_enum_1.HttpStatus.BAD_REQUEST);
99
- }
100
- }
101
- }
102
- const diff = (0, assertic_1.truthy)((0, deep_diff_1.default)(dataBefore, data));
103
- validateRestrictedFieldsForDiff(diff, schema, !!updatedPaths.length);
104
- }
105
- exports.validateSchema = validateSchema;
106
- function validateRestrictedFieldsForDiff(diffs, schema, isUpdateMutation) {
107
- if ((isUpdateMutation && schema.readOnly) || (schema.insertable === false && !isUpdateMutation)) {
108
- throw new validation_1.ValidationError(`The schema does not allow this action`, http_status_enum_1.HttpStatus.BAD_REQUEST);
109
- }
110
- for (const diff of diffs) {
111
- const path = (0, assertic_1.truthy)(diff.path).join('.');
112
- const relevantProperties = getMatchingProperties((0, assertic_1.truthy)(diff.path), schema);
113
- for (const property of relevantProperties.exactMatch) {
114
- if (property.readOnly && diff.kind === 'E') {
115
- throw new validation_1.ValidationError(`${path} is readonly`, http_status_enum_1.HttpStatus.BAD_REQUEST);
116
- }
117
- if (isUpdateMutation && property.deletable === false && diff.kind === 'D') {
118
- throw new validation_1.ValidationError(`${path} is not deletable`, http_status_enum_1.HttpStatus.BAD_REQUEST);
119
- }
120
- if (property.insertable === false && diff.kind === 'N') {
121
- throw new validation_1.ValidationError(`${path} is not insertable`, http_status_enum_1.HttpStatus.BAD_REQUEST);
122
- }
123
- }
124
- for (const property of relevantProperties.parentsMatch) {
125
- if (isUpdateMutation && property.readOnly) {
126
- throw new validation_1.ValidationError(`${path} is readonly`, http_status_enum_1.HttpStatus.BAD_REQUEST);
127
- }
128
- }
129
- }
130
- }
131
- function getMatchingProperties(path, schema) {
132
- const result = {
133
- exactMatch: [],
134
- parentsMatch: [],
135
- };
136
- if (!path.length) {
137
- result.exactMatch.push(schema);
138
- return result;
139
- }
140
- result.parentsMatch.push(schema);
141
- const pathToUse = [...path];
142
- while (pathToUse.length) {
143
- const key = pathToUse.shift();
144
- (0, assertic_1.assertTruthy)(key !== undefined);
145
- const matchingPropertiesForKey = findMatchingPropertiesForKey(schema, key);
146
- for (const property of matchingPropertiesForKey) {
147
- const subMatchingProperties = getMatchingProperties(pathToUse, property);
148
- result.parentsMatch.push(...subMatchingProperties.parentsMatch);
149
- result.exactMatch.push(...subMatchingProperties.exactMatch);
150
- }
151
- }
152
- return result;
153
- }
154
- function findMatchingPropertiesForKey(schema, key) {
155
- var _a, _b;
156
- const matchingProperties = ((_a = schema.properties) === null || _a === void 0 ? void 0 : _a[key]) ? [(_b = schema.properties) === null || _b === void 0 ? void 0 : _b[key]] : [];
157
- if (schema.patternProperties) {
158
- matchingProperties.push(...Object.entries(schema.patternProperties)
159
- .filter(([pattern]) => {
160
- return new RegExp(pattern).test(key);
161
- })
162
- .map(([, matchedProperty]) => matchedProperty));
163
- }
164
- return matchingProperties;
165
- }
166
- exports.findMatchingPropertiesForKey = findMatchingPropertiesForKey;
167
- //# sourceMappingURL=schema.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.types.js","sourceRoot":"","sources":["../../../../../internal-common/src/schema/schema.types.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AACtB,6CAAqC;AACrC,yCAAiC;AAEjC,oDAAsD;AACtD,uCAAgD;AAChD,uEAA8D;AAE9D,MAAM,GAAG,GAAG,IAAI,aAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;AACrF,IAAA,qBAAU,EAAC,GAAG,CAAC,CAAC;AAEhB,GAAG,CAAC,UAAU,CAAC;IACb,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,MAAe,EAAE,KAAc,EAAW,EAAE;QACrD,OAAO,MAAM,KAAK,KAAK,YAAY,IAAI,CAAC;IAC1C,CAAC;CACF,CAAC,CAAC;AAEH,GAAG,CAAC,UAAU,CAAC;IACb,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,MAAe,EAAE,KAAc,EAAW,EAAE;QACrD,IAAI;YACF,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS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;aACD,GAAG,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CACjD,CAAC;KACH;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAfD,oEAeC"}
@@ -1,6 +0,0 @@
1
- export interface OpenApiResponse {
2
- headers: Record<string, any>;
3
- body: any;
4
- statusCode: number;
5
- __isOpenApiResponse__: true;
6
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=openapi-response.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openapi-response.js","sourceRoot":"","sources":["../../../../../internal-common/src/types/openapi-response.ts"],"names":[],"mappings":""}
@@ -1,20 +0,0 @@
1
- import { Auth, RunContext } from '../public-types/context.types';
2
- import { SquidDocId } from '../public-types/document.types';
3
- import { SecretKey } from '../public-types/secret.types';
4
- import { EnvironmentId, SquidDeveloperId } from '../public-types/communication.types';
5
- export type DocHash = string;
6
- export type SecurityResponse = {
7
- docsToHash: Record<SquidDocId, DocHash | undefined>;
8
- rulesPassed: true;
9
- } | {
10
- rulesPassed: false;
11
- };
12
- export interface ServiceConfig {
13
- context: RunContext;
14
- secrets: Record<SecretKey, any>;
15
- backendApiKey: string;
16
- codeDir: string;
17
- auth: Auth | undefined;
18
- squidDeveloperId?: SquidDeveloperId;
19
- environmentId?: EnvironmentId;
20
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=security-internal.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"security-internal.types.js","sourceRoot":"","sources":["../../../../../internal-common/src/types/security-internal.types.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- import { StatusCode } from './validation';
2
- export declare function assertValidateTruthy(value: unknown, message: string, statusCode?: StatusCode, details?: Record<string, any>): asserts value;
3
- export declare function validateTruthy<T>(value: T, message: string, statusCode?: StatusCode, details?: Record<string, any>): NonNullable<T>;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateTruthy = exports.assertValidateTruthy = void 0;
4
- const validation_1 = require("./validation");
5
- const assertic_1 = require("assertic");
6
- const http_status_enum_1 = require("../public-types/http-status.enum");
7
- function assertValidateTruthy(value, message, statusCode = http_status_enum_1.HttpStatus.BAD_REQUEST, details) {
8
- (0, assertic_1.assertTruthy)(value, () => new validation_1.ValidationError(message, statusCode, details));
9
- }
10
- exports.assertValidateTruthy = assertValidateTruthy;
11
- function validateTruthy(value, message, statusCode = http_status_enum_1.HttpStatus.BAD_REQUEST, details) {
12
- return (0, assertic_1.truthy)(value, () => new validation_1.ValidationError(message, statusCode, details));
13
- }
14
- exports.validateTruthy = validateTruthy;
15
- //# sourceMappingURL=assert.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assert.js","sourceRoot":"","sources":["../../../../../internal-common/src/utils/assert.ts"],"names":[],"mappings":";;;AAAA,6CAA2D;AAC3D,uCAAgD;AAChD,uEAA8D;AAG9D,SAAgB,oBAAoB,CAClC,KAAc,EACd,OAAe,EACf,aAAyB,6BAAU,CAAC,WAAW,EAC/C,OAA6B;IAE7B,IAAA,uBAAY,EAAC,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,4BAAe,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;AAC/E,CAAC;AAPD,oDAOC;AAGD,SAAgB,cAAc,CAC5B,KAAQ,EACR,OAAe,EACf,aAAyB,6BAAU,CAAC,WAAW,EAC/C,OAA6B;IAE7B,OAAO,IAAA,iBAAM,EAAC,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,4BAAe,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;AAChF,CAAC;AAPD,wCAOC"}
@@ -1,3 +0,0 @@
1
- import { ExecuteFunctionAnnotationType } from '../public-types/backend-run.types';
2
- export declare function transformParams(params: Array<any>, executeFunctionAnnotationType: ExecuteFunctionAnnotationType): unknown[];
3
- export declare function transformResponse(functionResponse: any, executeFunctionAnnotationType: ExecuteFunctionAnnotationType): any;
@@ -1,91 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformResponse = exports.transformParams = void 0;
4
- const query_context_1 = require("../public-types/query-context");
5
- const mutation_context_1 = require("../public-types/mutation.context");
6
- const native_query_context_1 = require("../public-types/native-query.context");
7
- const distributed_lock_context_1 = require("../public-types/distributed-lock.context");
8
- const graphql_context_1 = require("../public-types/graphql.context");
9
- const api_call_context_1 = require("../public-types/api-call.context");
10
- const backend_run_types_1 = require("../public-types/backend-run.types");
11
- const ai_chatbot_context_1 = require("../public-types/ai-chatbot.context");
12
- function transformParams(params, executeFunctionAnnotationType) {
13
- switch (executeFunctionAnnotationType) {
14
- case 'scheduler':
15
- return [];
16
- case 'secureQuery':
17
- return [new query_context_1.QueryContext(params[0].query)];
18
- case 'secureMutation':
19
- return [new mutation_context_1.MutationContext(params[0].mutation, params[0]['beforeAndAfterDocs'], params[0]['serverTimestamp'])];
20
- case 'secureNativeQuery':
21
- return [new native_query_context_1.NativeQueryContext(params[0], params[1], params[2])];
22
- case 'secureDistributedLock':
23
- return [new distributed_lock_context_1.DistributedLockContext(params[0].mutex)];
24
- case 'secureGraphQL':
25
- return [new graphql_context_1.GraphqlContext(params[0])];
26
- case 'secureApi':
27
- return [new api_call_context_1.ApiCallContext(params[0])];
28
- case 'secureAiChatbotChat':
29
- return [new ai_chatbot_context_1.AiChatbotChatContext(params[0])];
30
- case 'secureAiChatbotMutation':
31
- return [new ai_chatbot_context_1.AiChatbotMutationContext(params[0])];
32
- default:
33
- return params;
34
- }
35
- }
36
- exports.transformParams = transformParams;
37
- function transformResponse(functionResponse, executeFunctionAnnotationType) {
38
- if (backend_run_types_1.ExecuteFunctionSecureAnnotations.includes(executeFunctionAnnotationType)) {
39
- return {
40
- rulesPassed: functionResponse,
41
- docsToHash: functionResponse ? {} : undefined,
42
- };
43
- }
44
- if (executeFunctionAnnotationType === 'webhook') {
45
- if (isWebhookResponse(functionResponse)) {
46
- delete functionResponse['__isWebhookResponse__'];
47
- return functionResponse;
48
- }
49
- functionResponse = functionResponse !== null && functionResponse !== void 0 ? functionResponse : null;
50
- const isStringOrNullBody = functionResponse === null || typeof functionResponse === 'string';
51
- const headers = {
52
- 'content-type': isStringOrNullBody ? 'text/plain' : 'application/json',
53
- 'cache-control': 'no-cache',
54
- };
55
- const body = isStringOrNullBody ? functionResponse || '' : JSON.stringify(functionResponse);
56
- const webhookResponse = {
57
- headers,
58
- body,
59
- statusCode: functionResponse === null ? 204 : 200,
60
- };
61
- return webhookResponse;
62
- }
63
- if (executeFunctionAnnotationType === 'openapi') {
64
- if (isOpenApiResponse(functionResponse)) {
65
- delete functionResponse['__isOpenApiResponse__'];
66
- return functionResponse;
67
- }
68
- functionResponse = functionResponse !== null && functionResponse !== void 0 ? functionResponse : null;
69
- const isStringOrNullBody = functionResponse === null || typeof functionResponse === 'string';
70
- const headers = {
71
- 'content-type': isStringOrNullBody ? 'text/plain' : 'application/json',
72
- 'cache-control': 'no-cache',
73
- };
74
- const body = isStringOrNullBody ? functionResponse || '' : JSON.stringify(functionResponse);
75
- const openApiResponse = {
76
- headers,
77
- body,
78
- statusCode: functionResponse === null ? 204 : 200,
79
- };
80
- return openApiResponse;
81
- }
82
- return functionResponse;
83
- }
84
- exports.transformResponse = transformResponse;
85
- function isWebhookResponse(response) {
86
- return response && response.__isWebhookResponse__;
87
- }
88
- function isOpenApiResponse(response) {
89
- return response && response.__isOpenApiResponse__;
90
- }
91
- //# sourceMappingURL=backend-transforms.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"backend-transforms.js","sourceRoot":"","sources":["../../../../../internal-common/src/utils/backend-transforms.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAC7D,uEAAmE;AACnE,+EAA0E;AAC1E,uFAAkF;AAClF,qEAAiE;AACjE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BAAgB,GAAI,IAAI,CAAC;QAC5C,MAAM,kBAAkB,GAAG,gBAAgB,KAAK,IAAI,IAAI,OAAO,gBAAgB,KAAK,QAAQ,CAAC;QAC7F,MAAM,OAAO,GAAG;YACd,cAAc,EAAE,kBAAkB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,kBAAkB;YACtE,eAAe,EAAE,UAAU;SAC5B,CAAC;QACF,MAAM,IAAI,GAAG,kBAAkB,CAAC,CAAC,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QAG5F,MAAM,eAAe,GAAmD;YACtE,OAAO;YACP,IAAI;YACJ,UAAU,EAAE,gBAAgB,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;SAClD,CAAC;QAEF,OAAO,eAAe,CAAC;KACxB;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAzDD,8CAyDC;AAED,SAAS,iBAAiB,CAAC,QAAa;IACtC,OAAO,QAAQ,IAAI,QAAQ,CAAC,qBAAqB,CAAC;AACpD,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAa;IACtC,OAAO,QAAQ,IAAI,QAAQ,CAAC,qBAAqB,CAAC;AACpD,CAAC"}
@@ -1,11 +0,0 @@
1
- export declare function getGlobal(): any;
2
- export declare function isDebugEnabled(): boolean;
3
- export declare function enableDebugLogs(): void;
4
- export declare class DebugLogger {
5
- static log(...args: any[]): void;
6
- static info(...args: any[]): void;
7
- static warn(...args: any[]): void;
8
- static error(...args: any[]): void;
9
- static debug(...args: any[]): void;
10
- private static getTimestampString;
11
- }
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DebugLogger = exports.enableDebugLogs = exports.isDebugEnabled = exports.getGlobal = void 0;
4
- function getGlobal() {
5
- if (typeof window !== 'undefined') {
6
- return window;
7
- }
8
- if (typeof global !== 'undefined') {
9
- return global;
10
- }
11
- if (typeof self !== 'undefined') {
12
- return self;
13
- }
14
- throw new Error('Unable to locate global object');
15
- }
16
- exports.getGlobal = getGlobal;
17
- function isDebugEnabled() {
18
- const globalObj = getGlobal();
19
- return globalObj && globalObj['SQUID_DEBUG_ENABLED'];
20
- }
21
- exports.isDebugEnabled = isDebugEnabled;
22
- function enableDebugLogs() {
23
- const globalObj = getGlobal();
24
- globalObj['SQUID_DEBUG_ENABLED'] = true;
25
- }
26
- exports.enableDebugLogs = enableDebugLogs;
27
- class DebugLogger {
28
- static log(...args) {
29
- DebugLogger.info(...args);
30
- }
31
- static info(...args) {
32
- console.log(`%c[${DebugLogger.getTimestampString()}] INFO`, 'color:green', ...args);
33
- }
34
- static warn(...args) {
35
- console.warn(`%c[${DebugLogger.getTimestampString()}] WARN`, 'color:yellow', ...args);
36
- }
37
- static error(...args) {
38
- console.error(`%c[${DebugLogger.getTimestampString()}] ERROR`, 'color:red', ...args);
39
- }
40
- static debug(...args) {
41
- if (!isDebugEnabled())
42
- return;
43
- console.log(`%c[${DebugLogger.getTimestampString()}] DEBUG`, 'color:cyan', ...args);
44
- }
45
- static getTimestampString() {
46
- const date = new Date();
47
- return `${date.toLocaleTimeString()}.${date.getMilliseconds()}`;
48
- }
49
- }
50
- exports.DebugLogger = DebugLogger;
51
- //# sourceMappingURL=global.utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"global.utils.js","sourceRoot":"","sources":["../../../../../internal-common/src/utils/global.utils.ts"],"names":[],"mappings":";;;AAKA,SAAgB,SAAS;IACvB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC;KACf;IACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC;KACf;IACD,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAC/B,OAAO,IAAI,CAAC;KACb;IACD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AAC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AAI,CAAC,kBAAkB,EAAE,IAAI,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;IAClE,CAAC;CACF;AA1BD,kCA0BC"}
@@ -1,2 +0,0 @@
1
- export declare function getApplicationUrl(regionPrefix: string, appId: string, path: string): string;
2
- export declare function getApplicationHttpHeaders(regionPrefix: string, appId: string): Record<string, string>;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getApplicationHttpHeaders = exports.getApplicationUrl = void 0;
4
- const kotlinControllers = [
5
- 'query',
6
- 'aiData',
7
- 'api',
8
- 'backend-function',
9
- 'webhooks',
10
- 'ws',
11
- 'quota',
12
- 'named-query',
13
- 'native-query',
14
- 'application-kotlin',
15
- 'openapi',
16
- 'secret',
17
- ];
18
- function getApplicationUrl(regionPrefix, appId, path) {
19
- const baseUrl = 'https://squid.cloud';
20
- const parsedBaseUrl = new URL(baseUrl);
21
- parsedBaseUrl.host = `${appId}.${regionPrefix}.${parsedBaseUrl.host}`;
22
- const controller = path.replace(/^\//g, '').split('/')[0] || '';
23
- if (isLocal(regionPrefix)) {
24
- parsedBaseUrl.protocol = 'http';
25
- parsedBaseUrl.port = kotlinControllers.includes(controller) ? '8001' : '8000';
26
- if (isAndroid(regionPrefix)) {
27
- parsedBaseUrl.host = '10.0.2.2';
28
- }
29
- else if (isIOS(regionPrefix)) {
30
- parsedBaseUrl.host = 'localhost';
31
- }
32
- }
33
- const url = parsedBaseUrl.toString();
34
- path = path.startsWith('/') ? path.slice(1) : path;
35
- return (url.endsWith('/') ? url : url + '/') + path;
36
- }
37
- exports.getApplicationUrl = getApplicationUrl;
38
- function getApplicationHttpHeaders(regionPrefix, appId) {
39
- const headers = {};
40
- if (isLocal(regionPrefix)) {
41
- headers['x-squid-appid'] = appId;
42
- }
43
- return headers;
44
- }
45
- exports.getApplicationHttpHeaders = getApplicationHttpHeaders;
46
- function isLocal(regionPrefix) {
47
- return /^local/.test(regionPrefix);
48
- }
49
- function isAndroid(regionPrefix) {
50
- return /android$/.test(regionPrefix);
51
- }
52
- function isIOS(regionPrefix) {
53
- return /ios$/.test(regionPrefix);
54
- }
55
- //# sourceMappingURL=http.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../../../../../internal-common/src/utils/http.ts"],"names":[],"mappings":";;;AAAA,MAAM,iBAAiB,GAAG;IACxB,OAAO;IACP,QAAQ;IACR,KAAK;IACL,kBAAkB;IAClB,UAAU;IACV,IAAI;IACJ,OAAO;IACP,aAAa;IACb,cAAc;IACd,oBAAoB;IACpB,SAAS;IACT,QAAQ;CACT,CAAC;AAEF,SAAgB,iBAAiB,CAAC,YAAoB,EAAE,KAAa,EAAE,IAAY;IACjF,MAAM,OAAO,GAAG,qBAAqB,CAAC;IACtC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IACvC,aAAa,CAAC,IAAI,GAAG,GAAG,KAAK,IAAI,YAAY,IAAI,aAAa,CAAC,IAAI,EAAE,CAAC;IACtE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAEhE,IAAI,OAAO,CAAC,YAAY,CAAC,EAAE;QACzB,aAAa,CAAC,QAAQ,GAAG,MAAM,CAAC;QAChC,aAAa,CAAC,IAAI,GAAG,iBAAiB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;QAC9E,IAAI,SAAS,CAAC,YAAY,CAAC,EAAE;YAC3B,aAAa,CAAC,IAAI,GAAG,UAAU,CAAC;SACjC;aAAM,IAAI,KAAK,CAAC,YAAY,CAAC,EAAE;YAC9B,aAAa,CAAC,IAAI,GAAG,WAAW,CAAC;SAClC;KACF;IAED,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC;IACrC,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;AACtD,CAAC;AAnBD,8CAmBC;AAED,SAAgB,yBAAyB,CAAC,YAAoB,EAAE,KAAa;IAC3E,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,IAAI,OAAO,CAAC,YAAY,CAAC,EAAE;QACzB,OAAO,CAAC,eAAe,CAAC,GAAG,KAAK,CAAC;KAClC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAPD,8DAOC;AAED,SAAS,OAAO,CAAC,YAAoB;IACnC,OAAO,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,SAAS,CAAC,YAAoB;IACrC,OAAO,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,KAAK,CAAC,YAAoB;IACjC,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AACnC,CAAC"}
@@ -1,5 +0,0 @@
1
- export declare function getInPath(obj: any, path: string, delimiter?: string): any;
2
- export declare function setInPath(obj: any, path: string, value: any, delimiter?: string): void;
3
- export declare function deleteInPath(obj: any, path: string, delimiter?: string): void;
4
- export declare function replaceKeyInMap<K, T>(map: Map<K, T | undefined>, a: K, b: K): void;
5
- export declare function replaceKeyInRecord<K extends keyof any, T>(record: Record<K, T>, a: K, b: K): void;
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceKeyInRecord = exports.replaceKeyInMap = exports.deleteInPath = exports.setInPath = exports.getInPath = void 0;
4
- const _ = require("lodash");
5
- const assertic_1 = require("assertic");
6
- function getInPath(obj, path, delimiter = '.') {
7
- const splitPath = path.split(delimiter);
8
- let value = undefined;
9
- let currentObj = obj;
10
- while (currentObj && splitPath.length) {
11
- const key = (0, assertic_1.truthy)(splitPath.shift());
12
- if (!(currentObj instanceof Object) || !(key in currentObj)) {
13
- return undefined;
14
- }
15
- value = currentObj[key];
16
- currentObj = value;
17
- }
18
- return value;
19
- }
20
- exports.getInPath = getInPath;
21
- function isJsObject(obj) {
22
- if (typeof obj !== 'object')
23
- return false;
24
- return Reflect.getPrototypeOf(obj) === Object.prototype;
25
- }
26
- function setInPath(obj, path, value, delimiter = '.') {
27
- var _a;
28
- const splitPath = path.split(delimiter);
29
- let currentObj = obj;
30
- while (splitPath.length) {
31
- const key = (0, assertic_1.truthy)(splitPath.shift());
32
- if (splitPath.length) {
33
- const newCurrentObj = isJsObject(currentObj[key]) ? (_a = _.clone(currentObj[key])) !== null && _a !== void 0 ? _a : {} : {};
34
- currentObj[key] = newCurrentObj;
35
- currentObj = newCurrentObj;
36
- }
37
- else {
38
- currentObj[key] = value;
39
- }
40
- }
41
- }
42
- exports.setInPath = setInPath;
43
- function deleteInPath(obj, path, delimiter = '.') {
44
- var _a;
45
- const splitPath = path.split(delimiter);
46
- let currentObj = obj;
47
- while (splitPath.length) {
48
- const key = (0, assertic_1.truthy)(splitPath.shift());
49
- if (splitPath.length) {
50
- const newCurrentObj = isJsObject(currentObj[key]) ? (_a = _.clone(currentObj[key])) !== null && _a !== void 0 ? _a : {} : {};
51
- currentObj[key] = newCurrentObj;
52
- currentObj = newCurrentObj;
53
- }
54
- else {
55
- delete currentObj[key];
56
- }
57
- }
58
- }
59
- exports.deleteInPath = deleteInPath;
60
- function replaceKeyInMap(map, a, b) {
61
- if (map.has(a)) {
62
- const value = map.get(a);
63
- map.delete(a);
64
- map.set(b, value);
65
- }
66
- }
67
- exports.replaceKeyInMap = replaceKeyInMap;
68
- function replaceKeyInRecord(record, a, b) {
69
- const value = record[a];
70
- if (typeof value !== 'undefined') {
71
- record[b] = value;
72
- delete record[a];
73
- }
74
- }
75
- exports.replaceKeyInRecord = replaceKeyInRecord;
76
- //# sourceMappingURL=object.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../internal-common/src/utils/object.ts"],"names":[],"mappings":";;;AAAA,4BAA4B;AAC5B,uCAAkC;AAElC,SAAgB,SAAS,CAAC,GAAQ,EAAE,IAAY,EAAE,SAAS,GAAG,GAAG;IAC/D,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACxC,IAAI,KAAK,GAAG,SAAS,CAAC;IACtB,IAAI,UAAU,GAAQ,GAAG,CAAC;IAC1B,OAAO,UAAU,IAAI,SAAS,CAAC,MAAM,EAAE;QACrC,MAAM,GAAG,GAAG,IAAA,iBAAM,EAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC;QACtC,IAAI,CAAC,CAAC,UAAU,YAAY,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,UAAU,CAAC,EAAE;YAC3D,OAAO,SAAS,CAAC;SAClB;QACD,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;QACxB,UAAU,GAAG,KAAK,CAAC;KACpB;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAbD,8BAaC;AAED,SAAS,UAAU,CAAC,GAAQ;IAC1B,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC1C,OAAO,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,SAAS,CAAC;AAC1D,CAAC;AAED,SAAgB,SAAS,CAAC,GAAQ,EAAE,IAAY,EAAE,KAAU,EAAE,SAAS,GAAG,GAAG;;IAC3E,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACxC,IAAI,UAAU,GAAQ,GAAG,CAAC;IAC1B,O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E,CAAI;IAC1E,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACd,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACzB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACd,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;KACnB;AACH,CAAC;AAND,0CAMC;AAED,SAAgB,kBAAkB,CAAyB,MAAoB,EAAE,CAAI,EAAE,CAAI;IACzF,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QAChC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;QAClB,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;KAClB;AACH,CAAC;AAND,gDAMC"}
@@ -1,5 +0,0 @@
1
- export declare function normalizeJsonAsString(json: any): string;
2
- export declare function serializeObj(obj: unknown): string;
3
- export declare function deserializeObj<T = any>(str: string): T;
4
- export declare function encodeValueForMapping(value: any): string;
5
- export declare function decodeValueForMapping(encodedString: string): any;