@takeshape/schema 8.35.1 → 8.35.2

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 (75) hide show
  1. package/es/index.js +3 -3
  2. package/es/migration/index.js +82 -0
  3. package/es/migration/to/v3.0.0.js +245 -0
  4. package/es/{migration-utils.js → migration/to/v3.1.0.js} +40 -8
  5. package/es/migration/to/v3.10.0.js +56 -0
  6. package/es/migration/to/v3.11.0.js +99 -0
  7. package/es/migration/to/v3.2.0.js +10 -0
  8. package/es/migration/to/v3.3.0.js +16 -0
  9. package/es/migration/to/v3.4.0.js +10 -0
  10. package/es/migration/to/v3.5.0.js +10 -0
  11. package/es/migration/to/v3.5.1.js +10 -0
  12. package/es/migration/to/v3.6.0.js +10 -0
  13. package/es/migration/to/v3.7.0.js +10 -0
  14. package/es/migration/to/v3.8.0.js +10 -0
  15. package/es/migration/to/v3.9.0.js +83 -0
  16. package/es/migration/types.js +1 -0
  17. package/es/migration/utils.js +23 -0
  18. package/lib/index.d.ts +3 -3
  19. package/lib/index.d.ts.map +1 -1
  20. package/lib/index.js +13 -36
  21. package/lib/migration/index.d.ts +7 -0
  22. package/lib/migration/index.d.ts.map +1 -0
  23. package/lib/migration/index.js +128 -0
  24. package/lib/migration/to/v3.0.0.d.ts +4 -0
  25. package/lib/migration/to/v3.0.0.d.ts.map +1 -0
  26. package/lib/migration/to/v3.0.0.js +260 -0
  27. package/lib/migration/to/v3.1.0.d.ts +5 -0
  28. package/lib/migration/to/v3.1.0.d.ts.map +1 -0
  29. package/lib/{migration-utils.js → migration/to/v3.1.0.js} +40 -10
  30. package/lib/migration/to/v3.10.0.d.ts +4 -0
  31. package/lib/migration/to/v3.10.0.d.ts.map +1 -0
  32. package/lib/migration/to/v3.10.0.js +66 -0
  33. package/lib/migration/to/v3.11.0.d.ts +5 -0
  34. package/lib/migration/to/v3.11.0.d.ts.map +1 -0
  35. package/lib/migration/to/v3.11.0.js +109 -0
  36. package/lib/migration/to/v3.2.0.d.ts +4 -0
  37. package/lib/migration/to/v3.2.0.d.ts.map +1 -0
  38. package/lib/migration/to/v3.2.0.js +18 -0
  39. package/lib/migration/to/v3.3.0.d.ts +5 -0
  40. package/lib/migration/to/v3.3.0.d.ts.map +1 -0
  41. package/lib/migration/to/v3.3.0.js +24 -0
  42. package/lib/migration/to/v3.4.0.d.ts +4 -0
  43. package/lib/migration/to/v3.4.0.d.ts.map +1 -0
  44. package/lib/migration/to/v3.4.0.js +18 -0
  45. package/lib/migration/to/v3.5.0.d.ts +4 -0
  46. package/lib/migration/to/v3.5.0.d.ts.map +1 -0
  47. package/lib/migration/to/v3.5.0.js +18 -0
  48. package/lib/migration/to/v3.5.1.d.ts +4 -0
  49. package/lib/migration/to/v3.5.1.d.ts.map +1 -0
  50. package/lib/migration/to/v3.5.1.js +18 -0
  51. package/lib/migration/to/v3.6.0.d.ts +4 -0
  52. package/lib/migration/to/v3.6.0.d.ts.map +1 -0
  53. package/lib/migration/to/v3.6.0.js +18 -0
  54. package/lib/migration/to/v3.7.0.d.ts +4 -0
  55. package/lib/migration/to/v3.7.0.d.ts.map +1 -0
  56. package/lib/migration/to/v3.7.0.js +18 -0
  57. package/lib/migration/to/v3.8.0.d.ts +4 -0
  58. package/lib/migration/to/v3.8.0.d.ts.map +1 -0
  59. package/lib/migration/to/v3.8.0.js +18 -0
  60. package/lib/migration/to/v3.9.0.d.ts +4 -0
  61. package/lib/migration/to/v3.9.0.d.ts.map +1 -0
  62. package/lib/migration/to/v3.9.0.js +91 -0
  63. package/lib/migration/types.d.ts +14 -0
  64. package/lib/migration/types.d.ts.map +1 -0
  65. package/lib/migration/types.js +5 -0
  66. package/lib/migration/utils.d.ts +5 -0
  67. package/lib/migration/utils.d.ts.map +1 -0
  68. package/lib/migration/utils.js +34 -0
  69. package/package.json +4 -4
  70. package/es/migration.js +0 -677
  71. package/lib/migration-utils.d.ts +0 -18
  72. package/lib/migration-utils.d.ts.map +0 -1
  73. package/lib/migration.d.ts +0 -59
  74. package/lib/migration.d.ts.map +0 -1
  75. package/lib/migration.js +0 -739
@@ -3,12 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.parseV3ServiceStr = parseV3ServiceStr;
7
- exports.updateServiceConfigV3ToV3_1 = updateServiceConfigV3ToV3_1;
6
+ exports.default = void 0;
8
7
 
9
- var _utils = require("./types/utils");
10
-
11
- var _util = require("@takeshape/util");
8
+ var _pReduce = _interopRequireDefault(require("p-reduce"));
12
9
 
13
10
  var _isObject = _interopRequireDefault(require("lodash/isObject"));
14
11
 
@@ -16,11 +13,11 @@ var _isString = _interopRequireDefault(require("lodash/isString"));
16
13
 
17
14
  var _isUndefined = _interopRequireDefault(require("lodash/isUndefined"));
18
15
 
19
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ var _util = require("@takeshape/util");
20
17
 
21
- /**
22
- * This file is a stop-gap for this story: https://app.shortcut.com/takeshape/story/7140/reorganize-schema-migration-ts-into-a-directory
23
- */
18
+ var _utils = require("../../types/utils");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
21
 
25
22
  /**
26
23
  * `graphql:my-key` `my-key`
@@ -200,4 +197,37 @@ function mapAuthType(authType, auth) {
200
197
  }
201
198
 
202
199
  return 'unknown';
203
- }
200
+ }
201
+
202
+ async function migrateToV3_1(context, projectSchema) {
203
+ const {
204
+ encryptFn,
205
+ decryptFn
206
+ } = context;
207
+ let services;
208
+ /**
209
+ * Services can only be migrated if a dataKey is present, otherwise they will need to be discarded.
210
+ */
211
+
212
+ if (projectSchema.services) {
213
+ services = await (0, _pReduce.default)(Object.entries(projectSchema.services), async (serviceMap, [serviceKey, serviceConfig]) => {
214
+ const auth = serviceConfig.auth && decryptFn(serviceConfig.auth);
215
+ const updatedServiceConfig = updateServiceConfigV3ToV3_1({ ...serviceConfig,
216
+ auth
217
+ }, serviceKey);
218
+ const authentication = updatedServiceConfig === null || updatedServiceConfig === void 0 ? void 0 : updatedServiceConfig.authentication;
219
+ serviceMap[serviceKey] = { ...updatedServiceConfig,
220
+ authentication: authentication && (0, _isObject.default)(authentication) ? encryptFn(authentication) : authentication
221
+ };
222
+ return serviceMap;
223
+ }, {});
224
+ }
225
+
226
+ return (0, _util.deepClone)({ ...projectSchema,
227
+ services,
228
+ schemaVersion: '3.1.0'
229
+ });
230
+ }
231
+
232
+ var _default = migrateToV3_1;
233
+ exports.default = _default;
@@ -0,0 +1,4 @@
1
+ import type { ProjectSchemaV3_9_0, ProjectSchemaV3_10_0 } from '../../project-schema';
2
+ declare function migrateToV3_10(projectSchema: ProjectSchemaV3_9_0): ProjectSchemaV3_10_0;
3
+ export default migrateToV3_10;
4
+ //# sourceMappingURL=v3.10.0.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3.10.0.d.ts","sourceRoot":"","sources":["../../../../src/migration/to/v3.10.0.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EAOrB,MAAM,sBAAsB,CAAC;AAuC9B,iBAAS,cAAc,CAAC,aAAa,EAAE,mBAAmB,GAAG,oBAAoB,CAUhF;AAED,eAAe,cAAc,CAAC"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _mapValues = _interopRequireDefault(require("lodash/mapValues"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ function migrateQueryToV3_10(query, queryName) {
13
+ const {
14
+ args,
15
+ shape
16
+ } = query;
17
+
18
+ if (typeof args === 'object' && ('oneOf' in args || 'allOf' in args || '$ref' in args || '@ref' in args)) {
19
+ // As of 11/15/2021 no production schemas contained queries with these args
20
+ throw new Error(`Query "${queryName}" contains an unsupported arg schema ${JSON.stringify(args)}. Please contact support`);
21
+ }
22
+
23
+ if (typeof shape === 'object' && !shape.items['@ref']) {
24
+ // As of 11/15/2021 no production schemas contained queries with array return shapes that are not @refs
25
+ throw new Error(`Query "${queryName}" contains an unsupported shape schema ${JSON.stringify(shape)}. Please contact support`);
26
+ }
27
+
28
+ return query;
29
+ }
30
+
31
+ function migrateShapeToV3_10(shape) {
32
+ const {
33
+ schema,
34
+ ...rest
35
+ } = shape; // As of 11/15/2021 no production schemas contained shapes with array schemas
36
+
37
+ if ('type' in schema && schema.type === 'array') {
38
+ throw new Error(`Shape ${shape.name} uses an unsupported array schema. Please contact support`);
39
+ }
40
+
41
+ const newSchema = '$ref' in schema || '@ref' in schema ? {
42
+ allOf: [schema]
43
+ } : schema;
44
+ return { ...rest,
45
+ schema: newSchema
46
+ };
47
+ }
48
+
49
+ function migrateToV3_10(projectSchema) {
50
+ const {
51
+ queries,
52
+ mutations,
53
+ shapes,
54
+ schemaVersion,
55
+ ...rest
56
+ } = projectSchema;
57
+ return { ...rest,
58
+ queries: (0, _mapValues.default)(queries, migrateQueryToV3_10),
59
+ mutations: (0, _mapValues.default)(mutations, migrateQueryToV3_10),
60
+ shapes: (0, _mapValues.default)(shapes, migrateShapeToV3_10),
61
+ schemaVersion: '3.10.0'
62
+ };
63
+ }
64
+
65
+ var _default = migrateToV3_10;
66
+ exports.default = _default;
@@ -0,0 +1,5 @@
1
+ import type { ProjectSchemaV3_10_0, ProjectSchemaV3_11_0 } from '../../project-schema';
2
+ import type { ProjectSchemaMigrationContext } from '../types';
3
+ declare function migrateToV3_11_0({ decryptFn, encryptFn }: ProjectSchemaMigrationContext, projectSchema: ProjectSchemaV3_10_0): ProjectSchemaV3_11_0;
4
+ export default migrateToV3_11_0;
5
+ //# sourceMappingURL=v3.11.0.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3.11.0.d.ts","sourceRoot":"","sources":["../../../../src/migration/to/v3.11.0.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EAUrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,UAAU,CAAC;AAG5D,iBAAS,gBAAgB,CACvB,EAAC,SAAS,EAAE,SAAS,EAAC,EAAE,6BAA6B,EACrD,aAAa,EAAE,oBAAoB,GAClC,oBAAoB,CA6FtB;AAED,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _fromPairs = _interopRequireDefault(require("lodash/fromPairs"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ function migrateToV3_11_0({
13
+ decryptFn,
14
+ encryptFn
15
+ }, projectSchema) {
16
+ const migratedServices = [];
17
+
18
+ for (const [serviceKey, serviceConfig] of Object.entries(projectSchema.services ?? {})) {
19
+ const {
20
+ authenticationType,
21
+ authentication
22
+ } = serviceConfig; // Migrate authentication, ensuring now required properties
23
+
24
+ if (authentication && authenticationType !== 'unknown' && authenticationType !== 'none') {
25
+ const decrypted = decryptFn(authentication);
26
+
27
+ if (!decrypted) {
28
+ throw new Error(`Service "${serviceKey}" authentication could not be decrypted. Please contact support.`);
29
+ }
30
+
31
+ let migrated;
32
+
33
+ if (authenticationType === 'searchParams') {
34
+ migrated = {
35
+ params: decrypted,
36
+ type: authenticationType
37
+ };
38
+ }
39
+
40
+ if (authenticationType === 'basic') {
41
+ migrated = {
42
+ username: '',
43
+ password: '',
44
+ ...decrypted,
45
+ type: authenticationType
46
+ };
47
+ }
48
+
49
+ if (authenticationType === 'bearer') {
50
+ migrated = {
51
+ token: '',
52
+ ...decrypted,
53
+ type: authenticationType
54
+ };
55
+ }
56
+
57
+ if (authenticationType === 'oauth2Bearer') {
58
+ migrated = {
59
+ token: '',
60
+ ...decrypted,
61
+ type: authenticationType
62
+ };
63
+ }
64
+
65
+ if (authenticationType === 'oauth2') {
66
+ migrated = {
67
+ grantType: 'clientCredentials',
68
+ clientId: '',
69
+ ...decrypted,
70
+ type: authenticationType
71
+ };
72
+ }
73
+
74
+ if (authenticationType === 'aws') {
75
+ migrated = {
76
+ awsAccessKeyId: '',
77
+ awsSecretAccessKey: '',
78
+ ...decrypted,
79
+ type: authenticationType
80
+ };
81
+ }
82
+
83
+ if (authenticationType === 'custom') {
84
+ migrated = { ...decrypted,
85
+ type: authenticationType
86
+ };
87
+ }
88
+
89
+ if (migrated) {
90
+ const migratedServiceConfig = { ...serviceConfig,
91
+ authentication: encryptFn(migrated)
92
+ };
93
+ migratedServices.push([serviceKey, migratedServiceConfig]);
94
+ } else {
95
+ migratedServices.push([serviceKey, serviceConfig]);
96
+ }
97
+ } else {
98
+ migratedServices.push([serviceKey, serviceConfig]);
99
+ }
100
+ }
101
+
102
+ return { ...projectSchema,
103
+ services: (0, _fromPairs.default)(migratedServices),
104
+ schemaVersion: '3.11.0'
105
+ };
106
+ }
107
+
108
+ var _default = migrateToV3_11_0;
109
+ exports.default = _default;
@@ -0,0 +1,4 @@
1
+ import type { ProjectSchemaV3_1_0, ProjectSchemaV3_2_0 } from '../../project-schema';
2
+ declare function migrateToV3_2(projectSchema: ProjectSchemaV3_1_0): ProjectSchemaV3_2_0;
3
+ export default migrateToV3_2;
4
+ //# sourceMappingURL=v3.2.0.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3.2.0.d.ts","sourceRoot":"","sources":["../../../../src/migration/to/v3.2.0.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAEnF,iBAAS,aAAa,CAAC,aAAa,EAAE,mBAAmB,GAAG,mBAAmB,CAQ9E;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ function migrateToV3_2(projectSchema) {
9
+ /**
10
+ * No migration needed all changes are backwards compatible.
11
+ */
12
+ return { ...projectSchema,
13
+ schemaVersion: '3.2.0'
14
+ };
15
+ }
16
+
17
+ var _default = migrateToV3_2;
18
+ exports.default = _default;
@@ -0,0 +1,5 @@
1
+ import type { ProjectSchemaV3_2_0, ProjectSchemaV3_3_0 } from '../../project-schema';
2
+ import type { ProjectSchemaMigrationContext } from '../types';
3
+ declare function migrateToV3_3(context: ProjectSchemaMigrationContext, projectSchema: ProjectSchemaV3_2_0): Promise<ProjectSchemaV3_3_0>;
4
+ export default migrateToV3_3;
5
+ //# sourceMappingURL=v3.3.0.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3.3.0.d.ts","sourceRoot":"","sources":["../../../../src/migration/to/v3.3.0.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AACnF,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,UAAU,CAAC;AAE5D,iBAAe,aAAa,CAC1B,OAAO,EAAE,6BAA6B,EACtC,aAAa,EAAE,mBAAmB,GACjC,OAAO,CAAC,mBAAmB,CAAC,CAY9B;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ async function migrateToV3_3(context, projectSchema) {
9
+ const {
10
+ generateDataKeyFn
11
+ } = context;
12
+ const dataKey = projectSchema.dataKey ? projectSchema.dataKey : await generateDataKeyFn();
13
+ /**
14
+ * Generate a dataKey if none is present.
15
+ */
16
+
17
+ return { ...projectSchema,
18
+ schemaVersion: '3.3.0',
19
+ dataKey
20
+ };
21
+ }
22
+
23
+ var _default = migrateToV3_3;
24
+ exports.default = _default;
@@ -0,0 +1,4 @@
1
+ import type { ProjectSchemaV3_3_0, ProjectSchemaV3_4_0 } from '../../project-schema';
2
+ declare function migrateToV3_4(projectSchema: ProjectSchemaV3_3_0): ProjectSchemaV3_4_0;
3
+ export default migrateToV3_4;
4
+ //# sourceMappingURL=v3.4.0.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3.4.0.d.ts","sourceRoot":"","sources":["../../../../src/migration/to/v3.4.0.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAEnF,iBAAS,aAAa,CAAC,aAAa,EAAE,mBAAmB,GAAG,mBAAmB,CAQ9E;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ function migrateToV3_4(projectSchema) {
9
+ /**
10
+ * No migration needed all changes are backwards compatible.
11
+ */
12
+ return { ...projectSchema,
13
+ schemaVersion: '3.4.0'
14
+ };
15
+ }
16
+
17
+ var _default = migrateToV3_4;
18
+ exports.default = _default;
@@ -0,0 +1,4 @@
1
+ import type { ProjectSchemaV3_4_0, ProjectSchemaV3_5_0 } from '../../project-schema';
2
+ declare function migrateToV3_5(projectSchema: ProjectSchemaV3_4_0): ProjectSchemaV3_5_0;
3
+ export default migrateToV3_5;
4
+ //# sourceMappingURL=v3.5.0.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3.5.0.d.ts","sourceRoot":"","sources":["../../../../src/migration/to/v3.5.0.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAEnF,iBAAS,aAAa,CAAC,aAAa,EAAE,mBAAmB,GAAG,mBAAmB,CAQ9E;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ function migrateToV3_5(projectSchema) {
9
+ /**
10
+ * No migration needed all changes are backwards compatible.
11
+ */
12
+ return { ...projectSchema,
13
+ schemaVersion: '3.5.0'
14
+ };
15
+ }
16
+
17
+ var _default = migrateToV3_5;
18
+ exports.default = _default;
@@ -0,0 +1,4 @@
1
+ import type { ProjectSchemaV3_5_0, ProjectSchemaV3_5_1 } from '../../project-schema';
2
+ declare function migrateToV3_5_1(projectSchema: ProjectSchemaV3_5_0): ProjectSchemaV3_5_1;
3
+ export default migrateToV3_5_1;
4
+ //# sourceMappingURL=v3.5.1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3.5.1.d.ts","sourceRoot":"","sources":["../../../../src/migration/to/v3.5.1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAEnF,iBAAS,eAAe,CAAC,aAAa,EAAE,mBAAmB,GAAG,mBAAmB,CAQhF;AAED,eAAe,eAAe,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ function migrateToV3_5_1(projectSchema) {
9
+ /**
10
+ * No migration needed all changes are backwards compatible.
11
+ */
12
+ return { ...projectSchema,
13
+ schemaVersion: '3.5.1'
14
+ };
15
+ }
16
+
17
+ var _default = migrateToV3_5_1;
18
+ exports.default = _default;
@@ -0,0 +1,4 @@
1
+ import type { ProjectSchemaV3_5_1, ProjectSchemaV3_6_0 } from '../../project-schema';
2
+ declare function migrateToV3_6(projectSchema: ProjectSchemaV3_5_1): ProjectSchemaV3_6_0;
3
+ export default migrateToV3_6;
4
+ //# sourceMappingURL=v3.6.0.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3.6.0.d.ts","sourceRoot":"","sources":["../../../../src/migration/to/v3.6.0.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAEnF,iBAAS,aAAa,CAAC,aAAa,EAAE,mBAAmB,GAAG,mBAAmB,CAQ9E;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ function migrateToV3_6(projectSchema) {
9
+ /**
10
+ * No migration needed all changes are backwards compatible.
11
+ */
12
+ return { ...projectSchema,
13
+ schemaVersion: '3.6.0'
14
+ };
15
+ }
16
+
17
+ var _default = migrateToV3_6;
18
+ exports.default = _default;
@@ -0,0 +1,4 @@
1
+ import type { ProjectSchemaV3_6_0, ProjectSchemaV3_7_0 } from '../../project-schema';
2
+ declare function migrateToV3_7(projectSchema: ProjectSchemaV3_6_0): ProjectSchemaV3_7_0;
3
+ export default migrateToV3_7;
4
+ //# sourceMappingURL=v3.7.0.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3.7.0.d.ts","sourceRoot":"","sources":["../../../../src/migration/to/v3.7.0.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAEnF,iBAAS,aAAa,CAAC,aAAa,EAAE,mBAAmB,GAAG,mBAAmB,CAQ9E;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ function migrateToV3_7(projectSchema) {
9
+ /**
10
+ * No migration needed all changes are backwards compatible.
11
+ */
12
+ return { ...projectSchema,
13
+ schemaVersion: '3.7.0'
14
+ };
15
+ }
16
+
17
+ var _default = migrateToV3_7;
18
+ exports.default = _default;
@@ -0,0 +1,4 @@
1
+ import type { ProjectSchemaV3_7_0, ProjectSchemaV3_8_0 } from '../../project-schema';
2
+ declare function migrateToV3_8(projectSchema: ProjectSchemaV3_7_0): ProjectSchemaV3_8_0;
3
+ export default migrateToV3_8;
4
+ //# sourceMappingURL=v3.8.0.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3.8.0.d.ts","sourceRoot":"","sources":["../../../../src/migration/to/v3.8.0.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAEnF,iBAAS,aAAa,CAAC,aAAa,EAAE,mBAAmB,GAAG,mBAAmB,CAQ9E;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ function migrateToV3_8(projectSchema) {
9
+ /**
10
+ * No migration needed all changes are backwards compatible.
11
+ */
12
+ return { ...projectSchema,
13
+ schemaVersion: '3.8.0'
14
+ };
15
+ }
16
+
17
+ var _default = migrateToV3_8;
18
+ exports.default = _default;
@@ -0,0 +1,4 @@
1
+ import type { ProjectSchemaV3_8_0, ProjectSchemaV3_9_0 } from '../../project-schema';
2
+ declare function migrateToV3_9_0(projectSchema: ProjectSchemaV3_8_0): ProjectSchemaV3_9_0;
3
+ export default migrateToV3_9_0;
4
+ //# sourceMappingURL=v3.9.0.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v3.9.0.d.ts","sourceRoot":"","sources":["../../../../src/migration/to/v3.9.0.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EASpB,MAAM,sBAAsB,CAAC;AAG9B,iBAAS,eAAe,CAAC,aAAa,EAAE,mBAAmB,GAAG,mBAAmB,CAqEhF;AAED,eAAe,eAAe,CAAC"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _util = require("@takeshape/util");
9
+
10
+ function migrateToV3_9_0(projectSchema) {
11
+ /**
12
+ * Resolver props that are guaranteed in this version, and dependent on the
13
+ * resolver type. Ensure they exist.
14
+ */
15
+ const ensureResolverOptions = resolver => {
16
+ if (resolver.name.startsWith('takeshape')) {
17
+ if (!resolver.shapeName) {
18
+ var _resolver$options, _resolver$options2, _resolver$options3, _resolver$options4;
19
+
20
+ resolver.shapeName = ((_resolver$options = resolver.options) === null || _resolver$options === void 0 ? void 0 : _resolver$options.model) ?? ((_resolver$options2 = resolver.options) === null || _resolver$options2 === void 0 ? void 0 : _resolver$options2.indexedShape) ?? '';
21
+ (_resolver$options3 = resolver.options) === null || _resolver$options3 === void 0 ? true : delete _resolver$options3.model;
22
+ (_resolver$options4 = resolver.options) === null || _resolver$options4 === void 0 ? true : delete _resolver$options4.indexedShape;
23
+ }
24
+ }
25
+
26
+ if (resolver.name.startsWith('graphql')) {
27
+ if (!resolver.fieldName) {
28
+ var _resolver$options5, _resolver$options6;
29
+
30
+ resolver.fieldName = ((_resolver$options5 = resolver.options) === null || _resolver$options5 === void 0 ? void 0 : _resolver$options5.fieldName) ?? '';
31
+ (_resolver$options6 = resolver.options) === null || _resolver$options6 === void 0 ? true : delete _resolver$options6.fieldName;
32
+ }
33
+ }
34
+
35
+ if (resolver.name.startsWith('awsLambda')) {
36
+ if (!resolver.functionName) {
37
+ var _resolver$options7, _resolver$options8;
38
+
39
+ resolver.functionName = ((_resolver$options7 = resolver.options) === null || _resolver$options7 === void 0 ? void 0 : _resolver$options7.functionName) ?? '';
40
+ (_resolver$options8 = resolver.options) === null || _resolver$options8 === void 0 ? true : delete _resolver$options8.functionName;
41
+ }
42
+ }
43
+
44
+ if (resolver.name.startsWith('rest')) {
45
+ if (!resolver.path) {
46
+ var _resolver$options11;
47
+
48
+ if (resolver.pathParams) {
49
+ var _resolver$options9;
50
+
51
+ resolver.path = { ...resolver.pathParams,
52
+ serialize: { ...resolver.pathParams.serialize,
53
+ template: (_resolver$options9 = resolver.options) === null || _resolver$options9 === void 0 ? void 0 : _resolver$options9.path
54
+ }
55
+ };
56
+ } else {
57
+ var _resolver$options10;
58
+
59
+ resolver.path = ((_resolver$options10 = resolver.options) === null || _resolver$options10 === void 0 ? void 0 : _resolver$options10.path) ?? '';
60
+ }
61
+
62
+ (_resolver$options11 = resolver.options) === null || _resolver$options11 === void 0 ? true : delete _resolver$options11.path;
63
+ }
64
+ }
65
+ /**
66
+ * `resolver.name` was previously validated with app code and v3.9.0
67
+ * enumerates the previous validation, making this assertion safe.
68
+ */
69
+
70
+
71
+ return resolver;
72
+ };
73
+ /**
74
+ * Function will visit each resolver in the schema and mutate them.
75
+ */
76
+
77
+
78
+ (0, _util.visit)(projectSchema, ['resolver', '@resolver'], resolver => {
79
+ if (resolver.compose) {
80
+ resolver.compose.forEach(ensureResolverOptions);
81
+ } else {
82
+ ensureResolverOptions(resolver);
83
+ }
84
+ });
85
+ return { ...projectSchema,
86
+ schemaVersion: '3.9.0'
87
+ };
88
+ }
89
+
90
+ var _default = migrateToV3_9_0;
91
+ exports.default = _default;
@@ -0,0 +1,14 @@
1
+ import type { ProjectSchema, FormConfig, Workflow, Shape } from '../project-schema';
2
+ import type { EncryptFn, SafeDecryptFn } from '../services';
3
+ export interface ProjectSchemaMigrationContext {
4
+ generateDataKeyFn: () => Promise<string>;
5
+ encryptFn: EncryptFn;
6
+ decryptFn: SafeDecryptFn;
7
+ }
8
+ export interface ProjectSchemaUpdate extends Omit<Partial<ProjectSchema>, 'shapes' | 'forms' | 'workflows'> {
9
+ shapes?: Record<string, Shape | null>;
10
+ forms?: Record<string, FormConfig | null>;
11
+ workflows?: Record<string, Workflow | null>;
12
+ deactivated?: number;
13
+ }
14
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/migration/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAC,SAAS,EAAE,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1D,MAAM,WAAW,6BAA6B;IAC5C,iBAAiB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,WAAW,CAAC;IACzG,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,5 @@
1
+ import type { Relationship, PropertySchema } from '../project-schema';
2
+ export declare function formatDate(timestamp?: number): string;
3
+ export declare function getRelationshipSchema(relationship: Relationship): PropertySchema;
4
+ export declare function normalizeSchemaVersion(version?: string): string;
5
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/migration/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAEpE,wBAAgB,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,YAAY,GAAG,cAAc,CAiBhF;AAED,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/D"}