@takeshape/schema 9.36.4 → 9.38.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 (84) hide show
  1. package/dist/builtin-schema.js +20 -20
  2. package/dist/migration/index.d.ts +1 -0
  3. package/dist/migration/index.d.ts.map +1 -1
  4. package/dist/migration/index.js +4 -1
  5. package/dist/migration/to/v3.31.0.d.ts +5 -0
  6. package/dist/migration/to/v3.31.0.d.ts.map +1 -0
  7. package/dist/migration/to/v3.31.0.js +53 -0
  8. package/dist/project-schema/index.d.ts +4 -1
  9. package/dist/project-schema/index.d.ts.map +1 -1
  10. package/dist/project-schema/index.js +20 -3
  11. package/dist/project-schema/latest.d.ts +43 -18
  12. package/dist/project-schema/latest.d.ts.map +1 -1
  13. package/dist/project-schema/migrate.d.ts.map +1 -1
  14. package/dist/project-schema/migrate.js +4 -0
  15. package/dist/project-schema/v3.31.0.d.ts +1449 -0
  16. package/dist/project-schema/v3.31.0.d.ts.map +1 -0
  17. package/dist/project-schema/v3.31.0.js +5 -0
  18. package/dist/relationships.js +2 -2
  19. package/dist/schema-util.d.ts +2 -2
  20. package/dist/schema-util.d.ts.map +1 -1
  21. package/dist/schema-util.js +12 -12
  22. package/dist/schemas/index.d.ts +2 -2
  23. package/dist/schemas/index.d.ts.map +1 -1
  24. package/dist/schemas/index.js +6 -4
  25. package/dist/schemas/index.ts +4 -2
  26. package/dist/schemas/project-schema/latest.json +89 -32
  27. package/dist/schemas/project-schema/v3.31.0.json +3089 -0
  28. package/dist/schemas/project-schema.json +7 -1
  29. package/dist/types/types.d.ts +4 -4
  30. package/dist/types/types.d.ts.map +1 -1
  31. package/dist/types/utils.d.ts +4 -3
  32. package/dist/types/utils.d.ts.map +1 -1
  33. package/dist/types/utils.js +9 -3
  34. package/dist/validate.d.ts.map +1 -1
  35. package/dist/validate.js +13 -3
  36. package/es/builtin-schema.js +20 -20
  37. package/es/migration/index.js +3 -1
  38. package/es/migration/to/v3.31.0.js +38 -0
  39. package/es/project-schema/index.js +3 -1
  40. package/es/project-schema/migrate.js +5 -1
  41. package/es/project-schema/v3.31.0.js +1 -0
  42. package/es/relationships.js +2 -2
  43. package/es/schema-util.js +12 -12
  44. package/es/schemas/index.js +4 -3
  45. package/es/schemas/index.ts +4 -2
  46. package/es/schemas/project-schema/latest.json +89 -32
  47. package/es/schemas/project-schema/v3.31.0.json +3089 -0
  48. package/es/schemas/project-schema.json +7 -1
  49. package/es/types/utils.js +7 -3
  50. package/es/validate.js +13 -3
  51. package/examples/dependencies/stripe-starter-resolved.json +210 -210
  52. package/examples/latest/betzino.json +4383 -4383
  53. package/examples/latest/blog-schema.json +49 -49
  54. package/examples/latest/brewery-schema.json +39 -39
  55. package/examples/latest/complex-project-schema.json +412 -412
  56. package/examples/latest/complex-schema.json +1166 -1166
  57. package/examples/latest/fabric-ecommerce.json +17 -17
  58. package/examples/latest/frank-and-fred-schema.json +2242 -2242
  59. package/examples/latest/klirr-schema.json +3254 -3254
  60. package/examples/latest/massive-schema.json +785 -785
  61. package/examples/latest/mill-components-schema.json +215 -215
  62. package/examples/latest/one-earth.json +1394 -1394
  63. package/examples/latest/pet-oneof-array.json +33 -33
  64. package/examples/latest/post-schema.json +32 -32
  65. package/examples/latest/pruned-shopify-product-schema.json +1 -1
  66. package/examples/latest/real-world-schema.json +94 -94
  67. package/examples/latest/recursive-repeater-schema.json +17 -17
  68. package/examples/latest/recursive-schema.json +17 -17
  69. package/examples/latest/rick-and-morty-ast.json +180 -180
  70. package/examples/latest/rick-and-morty-graphql.json +133 -133
  71. package/examples/latest/rick-and-morty-rest.json +1 -1
  72. package/examples/latest/schema-with-repeater-draftjs.json +48 -48
  73. package/examples/latest/shape-books-v3_2_0.json +137 -137
  74. package/examples/latest/shape-books.json +137 -137
  75. package/examples/latest/shopify-lookbook.json +41 -41
  76. package/examples/latest/shopify-product-2022-07.json +124 -124
  77. package/examples/latest/shopify-product-2023-04.json +125 -125
  78. package/examples/latest/shopify-store-with-widget.json +94 -94
  79. package/examples/latest/stripe-product-runtime-schema.json +127 -130
  80. package/examples/latest/stripe-starter-resolved.json +300 -509
  81. package/examples/latest/user-schema-no-required.json +22 -22
  82. package/examples/latest/user-schema-with-defaults.json +23 -23
  83. package/package.json +5 -5
  84. package/examples/latest/shopify-namespace-schema.json +0 -364
@@ -114,11 +114,17 @@
114
114
  {
115
115
  "$ref": "https://schema.takeshape.io/project-schema/v3.28.0#"
116
116
  },
117
+ {
118
+ "$ref": "https://schema.takeshape.io/project-schema/v3.29.0#"
119
+ },
117
120
  {
118
121
  "$ref": "https://schema.takeshape.io/project-schema/v3.30.0#"
119
122
  },
123
+ {
124
+ "$ref": "https://schema.takeshape.io/project-schema/v3.31.0#"
125
+ },
120
126
  {
121
127
  "$ref": "https://schema.takeshape.io/project-schema/v4.0.0#"
122
128
  }
123
129
  ]
124
- }
130
+ }
package/es/types/utils.js CHANGED
@@ -26,6 +26,7 @@ export function isComposeResolver(resolver) {
26
26
  const {
27
27
  definitions: {
28
28
  takeshapeResolver,
29
+ shapedbResolver,
29
30
  utilResolver,
30
31
  graphqlResolver,
31
32
  restResolver,
@@ -35,6 +36,9 @@ const {
35
36
  export function isTakeshapeResolver(resolver) {
36
37
  return isBasicResolver(resolver) && takeshapeResolver.properties.name.enum.includes(resolver.name);
37
38
  }
39
+ export function isShapedbResolver(resolver) {
40
+ return isBasicResolver(resolver) && shapedbResolver.properties.name.enum.includes(resolver.name);
41
+ }
38
42
  export function isGraphqlResolver(resolver) {
39
43
  return isBasicResolver(resolver) && graphqlResolver.properties.name.enum.includes(resolver.name);
40
44
  }
@@ -166,7 +170,7 @@ export function isAllOfSchema(propertySchema) {
166
170
  return isArray(propertySchema.allOf);
167
171
  }
168
172
  export function isExtendsSchema(propertySchema) {
169
- return isArray(propertySchema.extends);
173
+ return isRecord(propertySchema) && isArray(propertySchema.extends);
170
174
  }
171
175
  export function isOneOfSchema(propertySchema) {
172
176
  return isArray(propertySchema.oneOf);
@@ -181,7 +185,7 @@ export function isReturnShapeArraySchema(returnShape) {
181
185
  return typeof returnShape === 'object' && returnShape.type === 'array';
182
186
  }
183
187
  export function isObjectSchema(propertySchema) {
184
- return propertySchema.type === 'object' && isRecord(propertySchema.properties);
188
+ return isRecord(propertySchema) && propertySchema.type === 'object' && isRecord(propertySchema.properties);
185
189
  }
186
190
  /** Service Config Utils **/
187
191
 
@@ -274,5 +278,5 @@ export const getRefType = refSchema => {
274
278
  export function isPropertySchemaWithRelationship(schema) {
275
279
  var _schema$Resolver;
276
280
 
277
- return ((_schema$Resolver = schema['@resolver']) === null || _schema$Resolver === void 0 ? void 0 : _schema$Resolver.name) === 'takeshape:getRelated';
281
+ return ((_schema$Resolver = schema['@resolver']) === null || _schema$Resolver === void 0 ? void 0 : _schema$Resolver.name) === 'shapedb:getRelated';
278
282
  }
package/es/validate.js CHANGED
@@ -184,7 +184,8 @@ function enumerateBasicResolvers(resolver, path) {
184
184
 
185
185
  visit(resolver, path);
186
186
  return results;
187
- }
187
+ } // eslint-disable-next-line complexity
188
+
188
189
 
189
190
  function validateResolver(projectSchema, basePath, baseResolver) {
190
191
  const errors = [];
@@ -228,13 +229,22 @@ function validateResolver(projectSchema, basePath, baseResolver) {
228
229
  };
229
230
 
230
231
  const isLessThanV3_9_0 = lt(getSemver(projectSchema.schemaVersion), '3.9.0');
232
+ const isLessThanV3_31_0 = lt(getSemver(projectSchema.schemaVersion), '3.31.0');
231
233
  const getNamespace = createGetNamespace(projectSchema);
232
234
 
233
235
  for (const [resolver, path] of enumerateBasicResolvers(baseResolver, basePath)) {
234
236
  if (isBasicResolver(resolver)) {
235
- var _projectSchema$servic;
237
+ var _projectSchema$servic, _projectSchema$servic2;
238
+
239
+ if (isLessThanV3_31_0 && 'service' in resolver && resolver.service !== 'takeshape:local' && !((_projectSchema$servic = projectSchema.services) !== null && _projectSchema$servic !== void 0 && _projectSchema$servic[resolver.service])) {
240
+ errors.push({
241
+ type: 'notFound',
242
+ path: path.concat(['service']),
243
+ message: `Invalid service "${resolver.service}"`
244
+ });
245
+ }
236
246
 
237
- if ('service' in resolver && resolver.service !== 'takeshape:local' && !((_projectSchema$servic = projectSchema.services) !== null && _projectSchema$servic !== void 0 && _projectSchema$servic[resolver.service])) {
247
+ if (!isLessThanV3_31_0 && 'service' in resolver && resolver.service !== 'shapedb' && resolver.service !== 'takeshape' && !((_projectSchema$servic2 = projectSchema.services) !== null && _projectSchema$servic2 !== void 0 && _projectSchema$servic2[resolver.service])) {
238
248
  errors.push({
239
249
  type: 'notFound',
240
250
  path: path.concat(['service']),