@takeshape/schema 8.68.7 → 8.72.0

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 (131) hide show
  1. package/es/index.js +1 -0
  2. package/es/migration/index.js +33 -107
  3. package/es/migration/to/v3.0.0.js +3 -3
  4. package/es/migration/to/v3.1.0.js +3 -3
  5. package/es/migration/to/v3.10.0.js +3 -3
  6. package/es/migration/to/v3.11.0.js +7 -6
  7. package/es/migration/to/v3.12.0.js +3 -3
  8. package/es/migration/to/v3.12.1.js +3 -3
  9. package/es/migration/to/v3.12.2.js +3 -3
  10. package/es/migration/to/v3.12.3.js +4 -4
  11. package/es/migration/to/v3.13.0.js +3 -3
  12. package/es/migration/to/v3.14.0.js +3 -3
  13. package/es/migration/to/v3.15.0.js +3 -3
  14. package/es/migration/to/v3.2.0.js +3 -3
  15. package/es/migration/to/v3.3.0.js +3 -3
  16. package/es/migration/to/v3.4.0.js +3 -3
  17. package/es/migration/to/v3.5.0.js +3 -3
  18. package/es/migration/to/v3.5.1.js +3 -3
  19. package/es/migration/to/v3.6.0.js +3 -3
  20. package/es/migration/to/v3.7.0.js +3 -3
  21. package/es/migration/to/v3.8.0.js +3 -3
  22. package/es/migration/to/v3.9.0.js +3 -3
  23. package/es/project-schema/index.js +64 -22
  24. package/es/project-schema/migrate.js +102 -0
  25. package/es/schema-util.js +1 -1
  26. package/es/schemas/index.js +34 -34
  27. package/es/schemas/index.ts +66 -66
  28. package/es/schemas/project-schema/latest.json +2359 -0
  29. package/es/schemas/project-schema/v1.0.0.json +1 -1
  30. package/es/schemas/project-schema/v3.0.0.json +1 -1
  31. package/es/schemas/project-schema/v3.15.0.json +7 -7
  32. package/es/schemas/project-schema.json +66 -19
  33. package/es/taxonomies.js +1 -1
  34. package/es/template-shapes/where.js +2 -2
  35. package/es/types/utils.js +1 -51
  36. package/es/validate.js +0 -16
  37. package/lib/index.d.ts +1 -0
  38. package/lib/index.d.ts.map +1 -1
  39. package/lib/index.js +14 -0
  40. package/lib/migration/index.d.ts +23 -4
  41. package/lib/migration/index.d.ts.map +1 -1
  42. package/lib/migration/index.js +32 -111
  43. package/lib/migration/to/v3.0.0.d.ts +3 -2
  44. package/lib/migration/to/v3.0.0.d.ts.map +1 -1
  45. package/lib/migration/to/v3.0.0.js +3 -3
  46. package/lib/migration/to/v3.1.0.d.ts +3 -3
  47. package/lib/migration/to/v3.1.0.d.ts.map +1 -1
  48. package/lib/migration/to/v3.1.0.js +3 -3
  49. package/lib/migration/to/v3.10.0.d.ts +3 -2
  50. package/lib/migration/to/v3.10.0.d.ts.map +1 -1
  51. package/lib/migration/to/v3.10.0.js +3 -3
  52. package/lib/migration/to/v3.11.0.d.ts +3 -3
  53. package/lib/migration/to/v3.11.0.d.ts.map +1 -1
  54. package/lib/migration/to/v3.11.0.js +7 -6
  55. package/lib/migration/to/v3.12.0.d.ts +3 -2
  56. package/lib/migration/to/v3.12.0.d.ts.map +1 -1
  57. package/lib/migration/to/v3.12.0.js +3 -3
  58. package/lib/migration/to/v3.12.1.d.ts +3 -2
  59. package/lib/migration/to/v3.12.1.d.ts.map +1 -1
  60. package/lib/migration/to/v3.12.1.js +3 -3
  61. package/lib/migration/to/v3.12.2.d.ts +3 -2
  62. package/lib/migration/to/v3.12.2.d.ts.map +1 -1
  63. package/lib/migration/to/v3.12.2.js +3 -3
  64. package/lib/migration/to/v3.12.3.d.ts +3 -2
  65. package/lib/migration/to/v3.12.3.d.ts.map +1 -1
  66. package/lib/migration/to/v3.12.3.js +4 -4
  67. package/lib/migration/to/v3.13.0.d.ts +3 -2
  68. package/lib/migration/to/v3.13.0.d.ts.map +1 -1
  69. package/lib/migration/to/v3.13.0.js +3 -3
  70. package/lib/migration/to/v3.14.0.d.ts +3 -2
  71. package/lib/migration/to/v3.14.0.d.ts.map +1 -1
  72. package/lib/migration/to/v3.14.0.js +3 -3
  73. package/lib/migration/to/v3.15.0.d.ts +3 -2
  74. package/lib/migration/to/v3.15.0.d.ts.map +1 -1
  75. package/lib/migration/to/v3.15.0.js +3 -3
  76. package/lib/migration/to/v3.2.0.d.ts +3 -2
  77. package/lib/migration/to/v3.2.0.d.ts.map +1 -1
  78. package/lib/migration/to/v3.2.0.js +3 -3
  79. package/lib/migration/to/v3.3.0.d.ts +3 -3
  80. package/lib/migration/to/v3.3.0.d.ts.map +1 -1
  81. package/lib/migration/to/v3.3.0.js +3 -3
  82. package/lib/migration/to/v3.4.0.d.ts +3 -2
  83. package/lib/migration/to/v3.4.0.d.ts.map +1 -1
  84. package/lib/migration/to/v3.4.0.js +3 -3
  85. package/lib/migration/to/v3.5.0.d.ts +3 -2
  86. package/lib/migration/to/v3.5.0.d.ts.map +1 -1
  87. package/lib/migration/to/v3.5.0.js +3 -3
  88. package/lib/migration/to/v3.5.1.d.ts +3 -2
  89. package/lib/migration/to/v3.5.1.d.ts.map +1 -1
  90. package/lib/migration/to/v3.5.1.js +3 -3
  91. package/lib/migration/to/v3.6.0.d.ts +3 -2
  92. package/lib/migration/to/v3.6.0.d.ts.map +1 -1
  93. package/lib/migration/to/v3.6.0.js +3 -3
  94. package/lib/migration/to/v3.7.0.d.ts +3 -2
  95. package/lib/migration/to/v3.7.0.d.ts.map +1 -1
  96. package/lib/migration/to/v3.7.0.js +3 -3
  97. package/lib/migration/to/v3.8.0.d.ts +3 -2
  98. package/lib/migration/to/v3.8.0.d.ts.map +1 -1
  99. package/lib/migration/to/v3.8.0.js +3 -3
  100. package/lib/migration/to/v3.9.0.d.ts +3 -2
  101. package/lib/migration/to/v3.9.0.d.ts.map +1 -1
  102. package/lib/migration/to/v3.9.0.js +3 -3
  103. package/lib/migration/types.d.ts +1 -0
  104. package/lib/migration/types.d.ts.map +1 -1
  105. package/lib/project-schema/index.d.ts +66 -43
  106. package/lib/project-schema/index.d.ts.map +1 -1
  107. package/lib/project-schema/index.js +139 -23
  108. package/lib/project-schema/migrate.d.ts +5 -0
  109. package/lib/project-schema/migrate.d.ts.map +1 -0
  110. package/lib/project-schema/migrate.js +113 -0
  111. package/lib/project-schema/v1.0.0.d.ts +1 -1
  112. package/lib/project-schema/v1.0.0.d.ts.map +1 -1
  113. package/lib/project-schema/v3.0.0.d.ts +1 -1
  114. package/lib/project-schema/v3.0.0.d.ts.map +1 -1
  115. package/lib/schema-util.js +1 -1
  116. package/lib/schemas/index.d.ts +7009 -7009
  117. package/lib/schemas/index.js +34 -34
  118. package/lib/schemas/index.ts +66 -66
  119. package/lib/schemas/project-schema/latest.json +2359 -0
  120. package/lib/schemas/project-schema/v1.0.0.json +1 -1
  121. package/lib/schemas/project-schema/v3.0.0.json +1 -1
  122. package/lib/schemas/project-schema/v3.15.0.json +7 -7
  123. package/lib/schemas/project-schema.json +66 -19
  124. package/lib/taxonomies.js +1 -1
  125. package/lib/template-shapes/where.js +2 -2
  126. package/lib/types/utils.d.ts +1 -29
  127. package/lib/types/utils.d.ts.map +1 -1
  128. package/lib/types/utils.js +0 -80
  129. package/lib/validate.d.ts.map +1 -1
  130. package/lib/validate.js +0 -16
  131. package/package.json +5 -5
package/es/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  export * from './content-schema-transform';
3
3
  export * from './get-is-leaf';
4
4
  export * from './project-schema';
5
+ export * from './project-schema/migrate';
5
6
  export * from './schema-util';
6
7
  export * from './services';
7
8
  export * from './template-shapes';
@@ -1,16 +1,15 @@
1
- import { isLatestProjectSchema, isProjectSchemaV1, isProjectSchemaV3, isProjectSchemaV3_1, isProjectSchemaV3_2, isProjectSchemaV3_3, isProjectSchemaV3_4, isProjectSchemaV3_5, isProjectSchemaV3_5_1, isProjectSchemaV3_6, isProjectSchemaV3_7, isProjectSchemaV3_8, isProjectSchemaV3_9, isProjectSchemaV3_10, isProjectSchemaV3_11, isProjectSchemaV3_12, isProjectSchemaV3_12_1, isProjectSchemaV3_12_2, isProjectSchemaV3_12_3, isProjectSchemaV3_13_0, isProjectSchemaV3_14_0 } from '../types/utils';
2
- import migrateToV3 from './to/v3.0.0';
3
- import migrateToV3_1 from './to/v3.1.0';
4
- import migrateToV3_2 from './to/v3.2.0';
5
- import migrateToV3_3 from './to/v3.3.0';
6
- import migrateToV3_4 from './to/v3.4.0';
7
- import migrateToV3_5 from './to/v3.5.0';
1
+ import migrateToV3_0_0 from './to/v3.0.0';
2
+ import migrateToV3_1_0 from './to/v3.1.0';
3
+ import migrateToV3_2_0 from './to/v3.2.0';
4
+ import migrateToV3_3_0 from './to/v3.3.0';
5
+ import migrateToV3_4_0 from './to/v3.4.0';
6
+ import migrateToV3_5_0 from './to/v3.5.0';
8
7
  import migrateToV3_5_1 from './to/v3.5.1';
9
- import migrateToV3_6 from './to/v3.6.0';
10
- import migrateToV3_7 from './to/v3.7.0';
11
- import migrateToV3_8 from './to/v3.8.0';
8
+ import migrateToV3_6_0 from './to/v3.6.0';
9
+ import migrateToV3_7_0 from './to/v3.7.0';
10
+ import migrateToV3_8_0 from './to/v3.8.0';
12
11
  import migrateToV3_9_0 from './to/v3.9.0';
13
- import migrateToV3_10 from './to/v3.10.0';
12
+ import migrateToV3_10_0 from './to/v3.10.0';
14
13
  import migrateToV3_11_0 from './to/v3.11.0';
15
14
  import migrateToV3_12_0 from './to/v3.12.0';
16
15
  import migrateToV3_12_1 from './to/v3.12.1';
@@ -19,100 +18,27 @@ import migrateToV3_12_3 from './to/v3.12.3';
19
18
  import migrateToV3_13_0 from './to/v3.13.0';
20
19
  import migrateToV3_14_0 from './to/v3.14.0';
21
20
  import migrateToV3_15_0 from './to/v3.15.0';
21
+ export const migrateTo = {
22
+ 'v3.0.0': migrateToV3_0_0,
23
+ 'v3.1.0': migrateToV3_1_0,
24
+ 'v3.2.0': migrateToV3_2_0,
25
+ 'v3.3.0': migrateToV3_3_0,
26
+ 'v3.4.0': migrateToV3_4_0,
27
+ 'v3.5.0': migrateToV3_5_0,
28
+ 'v3.5.1': migrateToV3_5_1,
29
+ 'v3.6.0': migrateToV3_6_0,
30
+ 'v3.7.0': migrateToV3_7_0,
31
+ 'v3.8.0': migrateToV3_8_0,
32
+ 'v3.9.0': migrateToV3_9_0,
33
+ 'v3.10.0': migrateToV3_10_0,
34
+ 'v3.11.0': migrateToV3_11_0,
35
+ 'v3.12.0': migrateToV3_12_0,
36
+ 'v3.12.1': migrateToV3_12_1,
37
+ 'v3.12.2': migrateToV3_12_2,
38
+ 'v3.12.3': migrateToV3_12_3,
39
+ 'v3.13.0': migrateToV3_13_0,
40
+ 'v3.14.0': migrateToV3_14_0,
41
+ 'v3.15.0': migrateToV3_15_0
42
+ };
22
43
  export * from './utils';
23
- export const listTypePrefix = 'PaginatedList'; // eslint-disable-next-line complexity
24
-
25
- export async function migrateToLatestProjectSchema(context, projectSchema) {
26
- if (projectSchema.schemaVersion === '4.0.0') {
27
- throw new Error('You are using an unreleased schema version. Migration is not possible');
28
- }
29
-
30
- if (isProjectSchemaV1(projectSchema)) {
31
- projectSchema = migrateToV3(projectSchema);
32
- }
33
-
34
- if (isProjectSchemaV3(projectSchema)) {
35
- projectSchema = await migrateToV3_1(context, projectSchema);
36
- }
37
-
38
- if (isProjectSchemaV3_1(projectSchema)) {
39
- projectSchema = migrateToV3_2(projectSchema);
40
- }
41
-
42
- if (isProjectSchemaV3_2(projectSchema)) {
43
- projectSchema = await migrateToV3_3(context, projectSchema);
44
- }
45
-
46
- if (isProjectSchemaV3_3(projectSchema)) {
47
- projectSchema = migrateToV3_4(projectSchema);
48
- }
49
-
50
- if (isProjectSchemaV3_4(projectSchema)) {
51
- projectSchema = migrateToV3_5(projectSchema);
52
- }
53
-
54
- if (isProjectSchemaV3_5(projectSchema)) {
55
- projectSchema = migrateToV3_5_1(projectSchema);
56
- }
57
-
58
- if (isProjectSchemaV3_5_1(projectSchema)) {
59
- projectSchema = migrateToV3_6(projectSchema);
60
- }
61
-
62
- if (isProjectSchemaV3_6(projectSchema)) {
63
- projectSchema = migrateToV3_7(projectSchema);
64
- }
65
-
66
- if (isProjectSchemaV3_7(projectSchema)) {
67
- projectSchema = migrateToV3_8(projectSchema);
68
- }
69
-
70
- if (isProjectSchemaV3_8(projectSchema)) {
71
- projectSchema = migrateToV3_9_0(projectSchema);
72
- }
73
-
74
- if (isProjectSchemaV3_9(projectSchema)) {
75
- projectSchema = migrateToV3_10(projectSchema);
76
- }
77
-
78
- if (isProjectSchemaV3_10(projectSchema)) {
79
- projectSchema = migrateToV3_11_0(context, projectSchema);
80
- }
81
-
82
- if (isProjectSchemaV3_11(projectSchema)) {
83
- projectSchema = migrateToV3_12_0(projectSchema);
84
- }
85
-
86
- if (isProjectSchemaV3_12(projectSchema)) {
87
- projectSchema = migrateToV3_12_1(projectSchema);
88
- }
89
-
90
- if (isProjectSchemaV3_12_1(projectSchema)) {
91
- projectSchema = migrateToV3_12_2(projectSchema);
92
- }
93
-
94
- if (isProjectSchemaV3_12_2(projectSchema)) {
95
- projectSchema = migrateToV3_12_3(projectSchema);
96
- }
97
-
98
- if (isProjectSchemaV3_12_3(projectSchema)) {
99
- projectSchema = migrateToV3_13_0(projectSchema);
100
- }
101
-
102
- if (isProjectSchemaV3_13_0(projectSchema)) {
103
- projectSchema = migrateToV3_14_0(projectSchema);
104
- }
105
-
106
- if (isProjectSchemaV3_14_0(projectSchema)) {
107
- projectSchema = migrateToV3_15_0(projectSchema);
108
- }
109
-
110
- return projectSchema;
111
- }
112
- export async function ensureLatest(context, schema) {
113
- if (!schema || isLatestProjectSchema(schema)) {
114
- return schema;
115
- }
116
-
117
- return migrateToLatestProjectSchema(context, schema);
118
- }
44
+ export const listTypePrefix = 'PaginatedList';
@@ -233,7 +233,7 @@ function contentTypeToShape(contentType, contentTypeId) {
233
233
  };
234
234
  }
235
235
 
236
- function migrateToV3_0_0(projectSchema) {
236
+ const migrate = async (_, projectSchema) => {
237
237
  const {
238
238
  contentTypes,
239
239
  created,
@@ -258,6 +258,6 @@ function migrateToV3_0_0(projectSchema) {
258
258
  shapes,
259
259
  forms
260
260
  });
261
- }
261
+ };
262
262
 
263
- export default migrateToV3_0_0;
263
+ export default migrate;
@@ -185,7 +185,7 @@ function mapAuthType(authType, auth) {
185
185
  return 'unknown';
186
186
  }
187
187
 
188
- async function migrateToV3_1(context, projectSchema) {
188
+ const migrate = async (context, projectSchema) => {
189
189
  const {
190
190
  encryptFn,
191
191
  decryptFn
@@ -213,6 +213,6 @@ async function migrateToV3_1(context, projectSchema) {
213
213
  services,
214
214
  schemaVersion: '3.1.0'
215
215
  });
216
- }
216
+ };
217
217
 
218
- export default migrateToV3_1;
218
+ export default migrate;
@@ -75,7 +75,7 @@ function migrateShapeToV3_10(shape) {
75
75
  };
76
76
  }
77
77
 
78
- function migrateToV3_10(projectSchema) {
78
+ const migrate = async (_, projectSchema) => {
79
79
  const {
80
80
  queries,
81
81
  mutations,
@@ -90,6 +90,6 @@ function migrateToV3_10(projectSchema) {
90
90
  shapes: mapValues(shapes, migrateShapeToV3_10),
91
91
  schemaVersion: '3.10.0'
92
92
  };
93
- }
93
+ };
94
94
 
95
- export default migrateToV3_10;
95
+ export default migrate;
@@ -1,9 +1,10 @@
1
1
  import fromPairs from 'lodash/fromPairs';
2
2
 
3
- function migrateToV3_11_0({
4
- decryptFn,
5
- encryptFn
6
- }, projectSchema) {
3
+ const migrate = async (context, projectSchema) => {
4
+ const {
5
+ decryptFn,
6
+ encryptFn
7
+ } = context;
7
8
  const migratedServices = [];
8
9
 
9
10
  for (const [serviceKey, serviceConfig] of Object.entries(projectSchema.services ?? {})) {
@@ -94,6 +95,6 @@ function migrateToV3_11_0({
94
95
  services: fromPairs(migratedServices),
95
96
  schemaVersion: '3.11.0'
96
97
  };
97
- }
98
+ };
98
99
 
99
- export default migrateToV3_11_0;
100
+ export default migrate;
@@ -1,10 +1,10 @@
1
- function migrateToV3_12_0(projectSchema) {
1
+ const migrate = async (_, projectSchema) => {
2
2
  /**
3
3
  * No migration needed all changes are backwards compatible.
4
4
  */
5
5
  return { ...projectSchema,
6
6
  schemaVersion: '3.12.0'
7
7
  };
8
- }
8
+ };
9
9
 
10
- export default migrateToV3_12_0;
10
+ export default migrate;
@@ -1,10 +1,10 @@
1
- function migrateToV3_12_1(projectSchema) {
1
+ const migrate = async (_, projectSchema) => {
2
2
  /**
3
3
  * No migration needed all changes are backwards compatible.
4
4
  */
5
5
  return { ...projectSchema,
6
6
  schemaVersion: '3.12.1'
7
7
  };
8
- }
8
+ };
9
9
 
10
- export default migrateToV3_12_1;
10
+ export default migrate;
@@ -1,10 +1,10 @@
1
- function migrateToV3_12_2(projectSchema) {
1
+ const migrate = async (_, projectSchema) => {
2
2
  /**
3
3
  * No migration needed all changes are backwards compatible.
4
4
  */
5
5
  return { ...projectSchema,
6
6
  schemaVersion: '3.12.2'
7
7
  };
8
- }
8
+ };
9
9
 
10
- export default migrateToV3_12_2;
10
+ export default migrate;
@@ -13,10 +13,10 @@ function hasWebhook(projectSchema, config) {
13
13
  return resolver && 'service' in resolver && (projectSchema === null || projectSchema === void 0 ? void 0 : (_projectSchema$servic = projectSchema.services) === null || _projectSchema$servic === void 0 ? void 0 : _projectSchema$servic[resolver.service].provider) === 'shopify';
14
14
  }
15
15
 
16
- function migrateToV3_12_3({
16
+ const migrate = async (_, {
17
17
  indexedShapes: oldIndexedShapes,
18
18
  ...projectSchema
19
- }) {
19
+ }) => {
20
20
  if (!oldIndexedShapes) {
21
21
  return { ...projectSchema,
22
22
  schemaVersion: '3.12.3'
@@ -76,6 +76,6 @@ function migrateToV3_12_3({
76
76
  schemaVersion: '3.12.3',
77
77
  indexedShapes
78
78
  };
79
- }
79
+ };
80
80
 
81
- export default migrateToV3_12_3;
81
+ export default migrate;
@@ -1,7 +1,7 @@
1
1
  import { visit } from '@takeshape/util';
2
2
  import get from 'lodash/get';
3
3
 
4
- function migrateToV3_13_0(projectSchema) {
4
+ const migrate = async (_, projectSchema) => {
5
5
  visit(projectSchema, ['@relationship'], (relationship, path) => {
6
6
  const parent = get(projectSchema, path.slice(0, -1));
7
7
  parent['@backreference'] = {
@@ -16,6 +16,6 @@ function migrateToV3_13_0(projectSchema) {
16
16
  return { ...projectSchema,
17
17
  schemaVersion: '3.13.0'
18
18
  };
19
- }
19
+ };
20
20
 
21
- export default migrateToV3_13_0;
21
+ export default migrate;
@@ -1,10 +1,10 @@
1
- function migrateToV3_14_0(projectSchema) {
1
+ const migrate = async (_, projectSchema) => {
2
2
  /**
3
3
  * No migration needed all changes are backwards compatible.
4
4
  */
5
5
  return { ...projectSchema,
6
6
  schemaVersion: '3.14.0'
7
7
  };
8
- }
8
+ };
9
9
 
10
- export default migrateToV3_14_0;
10
+ export default migrate;
@@ -1,10 +1,10 @@
1
- function migrateToV3_15_0(projectSchema) {
1
+ const migrate = async (_, projectSchema) => {
2
2
  /**
3
3
  * No migration needed all changes are backwards compatible.
4
4
  */
5
5
  return { ...projectSchema,
6
6
  schemaVersion: '3.15.0'
7
7
  };
8
- }
8
+ };
9
9
 
10
- export default migrateToV3_15_0;
10
+ export default migrate;
@@ -1,10 +1,10 @@
1
- function migrateToV3_2(projectSchema) {
1
+ const migrate = async (_, projectSchema) => {
2
2
  /**
3
3
  * No migration needed all changes are backwards compatible.
4
4
  */
5
5
  return { ...projectSchema,
6
6
  schemaVersion: '3.2.0'
7
7
  };
8
- }
8
+ };
9
9
 
10
- export default migrateToV3_2;
10
+ export default migrate;
@@ -1,4 +1,4 @@
1
- async function migrateToV3_3(context, projectSchema) {
1
+ const migrate = async (context, projectSchema) => {
2
2
  const {
3
3
  generateDataKeyFn
4
4
  } = context;
@@ -11,6 +11,6 @@ async function migrateToV3_3(context, projectSchema) {
11
11
  schemaVersion: '3.3.0',
12
12
  dataKey
13
13
  };
14
- }
14
+ };
15
15
 
16
- export default migrateToV3_3;
16
+ export default migrate;
@@ -1,10 +1,10 @@
1
- function migrateToV3_4(projectSchema) {
1
+ const migrate = async (_, projectSchema) => {
2
2
  /**
3
3
  * No migration needed all changes are backwards compatible.
4
4
  */
5
5
  return { ...projectSchema,
6
6
  schemaVersion: '3.4.0'
7
7
  };
8
- }
8
+ };
9
9
 
10
- export default migrateToV3_4;
10
+ export default migrate;
@@ -1,10 +1,10 @@
1
- function migrateToV3_5(projectSchema) {
1
+ const migrate = async (_, projectSchema) => {
2
2
  /**
3
3
  * No migration needed all changes are backwards compatible.
4
4
  */
5
5
  return { ...projectSchema,
6
6
  schemaVersion: '3.5.0'
7
7
  };
8
- }
8
+ };
9
9
 
10
- export default migrateToV3_5;
10
+ export default migrate;
@@ -1,10 +1,10 @@
1
- function migrateToV3_5_1(projectSchema) {
1
+ const migrate = async (_, projectSchema) => {
2
2
  /**
3
3
  * No migration needed all changes are backwards compatible.
4
4
  */
5
5
  return { ...projectSchema,
6
6
  schemaVersion: '3.5.1'
7
7
  };
8
- }
8
+ };
9
9
 
10
- export default migrateToV3_5_1;
10
+ export default migrate;
@@ -1,10 +1,10 @@
1
- function migrateToV3_6(projectSchema) {
1
+ const migrate = async (_, projectSchema) => {
2
2
  /**
3
3
  * No migration needed all changes are backwards compatible.
4
4
  */
5
5
  return { ...projectSchema,
6
6
  schemaVersion: '3.6.0'
7
7
  };
8
- }
8
+ };
9
9
 
10
- export default migrateToV3_6;
10
+ export default migrate;
@@ -1,10 +1,10 @@
1
- function migrateToV3_7(projectSchema) {
1
+ const migrate = async (_, projectSchema) => {
2
2
  /**
3
3
  * No migration needed all changes are backwards compatible.
4
4
  */
5
5
  return { ...projectSchema,
6
6
  schemaVersion: '3.7.0'
7
7
  };
8
- }
8
+ };
9
9
 
10
- export default migrateToV3_7;
10
+ export default migrate;
@@ -1,10 +1,10 @@
1
- function migrateToV3_8(projectSchema) {
1
+ const migrate = async (_, projectSchema) => {
2
2
  /**
3
3
  * No migration needed all changes are backwards compatible.
4
4
  */
5
5
  return { ...projectSchema,
6
6
  schemaVersion: '3.8.0'
7
7
  };
8
- }
8
+ };
9
9
 
10
- export default migrateToV3_8;
10
+ export default migrate;
@@ -1,6 +1,6 @@
1
1
  import { visit } from '@takeshape/util';
2
2
 
3
- function migrateToV3_9_0(projectSchema) {
3
+ const migrate = async (_, projectSchema) => {
4
4
  /**
5
5
  * Resolver props that are guaranteed in this version, and dependent on the
6
6
  * resolver type. Ensure they exist.
@@ -78,6 +78,6 @@ function migrateToV3_9_0(projectSchema) {
78
78
  return { ...projectSchema,
79
79
  schemaVersion: '3.9.0'
80
80
  };
81
- }
81
+ };
82
82
 
83
- export default migrateToV3_9_0;
83
+ export default migrate;
@@ -1,25 +1,67 @@
1
1
  // This file is generated by "pnpm json2ts"
2
2
  export * from './latest';
3
- export * from './v4.0.0';
4
- export * from './v3.15.0';
5
- export * from './v3.14.0';
6
- export * from './v3.13.0';
7
- export * from './v3.12.3';
8
- export * from './v3.12.2';
9
- export * from './v3.12.1';
10
- export * from './v3.12.0';
11
- export * from './v3.11.0';
12
- export * from './v3.10.0';
13
- export * from './v3.9.0';
14
- export * from './v3.8.0';
15
- export * from './v3.7.0';
16
- export * from './v3.6.0';
17
- export * from './v3.5.1';
18
- export * from './v3.5.0';
19
- export * from './v3.4.0';
20
- export * from './v3.3.0';
21
- export * from './v3.2.0';
22
- export * from './v3.1.0';
23
- export * from './v3.0.0';
24
3
  export * from './v1.0.0';
25
- export {};
4
+ export * from './v3.0.0';
5
+ export * from './v3.1.0';
6
+ export * from './v3.2.0';
7
+ export * from './v3.3.0';
8
+ export * from './v3.4.0';
9
+ export * from './v3.5.0';
10
+ export * from './v3.5.1';
11
+ export * from './v3.6.0';
12
+ export * from './v3.7.0';
13
+ export * from './v3.8.0';
14
+ export * from './v3.9.0';
15
+ export * from './v3.10.0';
16
+ export * from './v3.11.0';
17
+ export * from './v3.12.0';
18
+ export * from './v3.12.1';
19
+ export * from './v3.12.2';
20
+ export * from './v3.12.3';
21
+ export * from './v3.13.0';
22
+ export * from './v3.14.0';
23
+ export * from './v3.15.0';
24
+ export * from './v4.0.0';
25
+
26
+ // Schema type utilities
27
+ function createVersionPredicate(expectedVersion) {
28
+ return projectSchema => {
29
+ let {
30
+ schemaVersion
31
+ } = projectSchema;
32
+
33
+ if (!schemaVersion || schemaVersion === '1') {
34
+ schemaVersion = '1.0.0';
35
+ }
36
+
37
+ if (schemaVersion === '3') {
38
+ schemaVersion = '3.0.0';
39
+ }
40
+
41
+ return Boolean(expectedVersion && schemaVersion && expectedVersion === schemaVersion);
42
+ };
43
+ }
44
+
45
+ export const isProjectSchemaV1_0_0 = createVersionPredicate('1.0.0');
46
+ export const isProjectSchemaV3_0_0 = createVersionPredicate('3.0.0');
47
+ export const isProjectSchemaV3_1_0 = createVersionPredicate('3.1.0');
48
+ export const isProjectSchemaV3_2_0 = createVersionPredicate('3.2.0');
49
+ export const isProjectSchemaV3_3_0 = createVersionPredicate('3.3.0');
50
+ export const isProjectSchemaV3_4_0 = createVersionPredicate('3.4.0');
51
+ export const isProjectSchemaV3_5_0 = createVersionPredicate('3.5.0');
52
+ export const isProjectSchemaV3_5_1 = createVersionPredicate('3.5.1');
53
+ export const isProjectSchemaV3_6_0 = createVersionPredicate('3.6.0');
54
+ export const isProjectSchemaV3_7_0 = createVersionPredicate('3.7.0');
55
+ export const isProjectSchemaV3_8_0 = createVersionPredicate('3.8.0');
56
+ export const isProjectSchemaV3_9_0 = createVersionPredicate('3.9.0');
57
+ export const isProjectSchemaV3_10_0 = createVersionPredicate('3.10.0');
58
+ export const isProjectSchemaV3_11_0 = createVersionPredicate('3.11.0');
59
+ export const isProjectSchemaV3_12_0 = createVersionPredicate('3.12.0');
60
+ export const isProjectSchemaV3_12_1 = createVersionPredicate('3.12.1');
61
+ export const isProjectSchemaV3_12_2 = createVersionPredicate('3.12.2');
62
+ export const isProjectSchemaV3_12_3 = createVersionPredicate('3.12.3');
63
+ export const isProjectSchemaV3_13_0 = createVersionPredicate('3.13.0');
64
+ export const isProjectSchemaV3_14_0 = createVersionPredicate('3.14.0');
65
+ export const isProjectSchemaV3_15_0 = createVersionPredicate('3.15.0');
66
+ export const isLatestProjectSchema = createVersionPredicate('3.15.0');
67
+ export const isProjectSchemaV4_0_0 = createVersionPredicate('4.0.0');