@takeshape/schema 8.45.2 → 8.48.1

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 (70) hide show
  1. package/es/flatten-templates.js +1 -1
  2. package/es/migration/index.js +6 -1
  3. package/es/migration/to/v3.12.0.js +10 -0
  4. package/es/project-schema/index.js +1 -0
  5. package/es/project-schema/v3.12.0.js +1 -0
  6. package/es/refs.js +5 -1
  7. package/es/schemas/index.js +4 -3
  8. package/es/schemas/index.ts +4 -2
  9. package/es/schemas/project-schema/v3.12.0.json +2143 -0
  10. package/es/schemas/project-schema.json +3 -1
  11. package/es/template-shapes/templates.js +6 -3
  12. package/es/template-shapes/where.js +39 -30
  13. package/es/types/utils.js +2 -1
  14. package/examples/latest/blog-schema.json +1 -1
  15. package/examples/latest/brewery-schema.json +1 -1
  16. package/examples/latest/complex-project-schema.json +1 -1
  17. package/examples/latest/fabric-ecommerce.json +1 -1
  18. package/examples/latest/frank-and-fred-schema.json +1 -1
  19. package/examples/latest/massive-schema.json +1 -1
  20. package/examples/latest/mill-components-schema.json +1 -1
  21. package/examples/latest/pet-oneof-array.json +1 -1
  22. package/examples/latest/post-schema.json +1 -1
  23. package/examples/latest/pruned-shopify-product-schema.json +1 -1
  24. package/examples/latest/real-world-schema.json +1 -1
  25. package/examples/latest/recursive-repeater-schema.json +1 -1
  26. package/examples/latest/recursive-schema.json +1 -1
  27. package/examples/latest/rick-and-morty-ast.json +1 -1
  28. package/examples/latest/rick-and-morty-graphql.json +1 -1
  29. package/examples/latest/rick-and-morty-rest.json +1 -1
  30. package/examples/latest/schema-with-repeater-draftjs.json +1 -1
  31. package/examples/latest/shape-books-v3_2_0.json +1 -1
  32. package/examples/latest/shape-books.json +1 -1
  33. package/examples/latest/shopify-lookbook.json +1 -1
  34. package/examples/latest/shopify-store-with-widget.json +1 -1
  35. package/examples/latest/stripe-starter-resolved.json +1 -1
  36. package/examples/latest/user-schema-no-required.json +1 -1
  37. package/examples/latest/user-schema-with-defaults.json +1 -1
  38. package/lib/flatten-templates.js +1 -1
  39. package/lib/migration/index.d.ts.map +1 -1
  40. package/lib/migration/index.js +6 -0
  41. package/lib/migration/to/v3.12.0.d.ts +4 -0
  42. package/lib/migration/to/v3.12.0.d.ts.map +1 -0
  43. package/lib/migration/to/v3.12.0.js +18 -0
  44. package/lib/project-schema/index.d.ts +3 -1
  45. package/lib/project-schema/index.d.ts.map +1 -1
  46. package/lib/project-schema/index.js +27 -14
  47. package/lib/project-schema/latest.d.ts +7 -3
  48. package/lib/project-schema/latest.d.ts.map +1 -1
  49. package/lib/project-schema/v3.12.0.d.ts +1215 -0
  50. package/lib/project-schema/v3.12.0.d.ts.map +1 -0
  51. package/lib/project-schema/v3.12.0.js +5 -0
  52. package/lib/refs.d.ts.map +1 -1
  53. package/lib/refs.js +5 -1
  54. package/lib/schemas/index.d.ts +375 -375
  55. package/lib/schemas/index.d.ts.map +1 -1
  56. package/lib/schemas/index.js +18 -16
  57. package/lib/schemas/index.ts +4 -2
  58. package/lib/schemas/project-schema/v3.12.0.json +2143 -0
  59. package/lib/schemas/project-schema.json +3 -1
  60. package/lib/template-shapes/templates.d.ts.map +1 -1
  61. package/lib/template-shapes/templates.js +5 -2
  62. package/lib/template-shapes/where.d.ts +2 -2
  63. package/lib/template-shapes/where.d.ts.map +1 -1
  64. package/lib/template-shapes/where.js +39 -28
  65. package/lib/types/types.d.ts +2 -2
  66. package/lib/types/types.d.ts.map +1 -1
  67. package/lib/types/utils.d.ts +1 -0
  68. package/lib/types/utils.d.ts.map +1 -1
  69. package/lib/types/utils.js +4 -2
  70. package/package.json +6 -4
@@ -18,7 +18,7 @@ export function flattenTemplates(projectSchema) {
18
18
  shapeName,
19
19
  dependencies
20
20
  } = resolveTemplate(projectSchema, ref.template, refItemToShapeName(ref));
21
- set(newSchema, ref.path, shapeName);
21
+ set(newSchema, ref.path, ref.path[ref.path.length - 1] === '@ref' ? `local:${shapeName}` : shapeName);
22
22
  Object.assign(newSchema.shapes, dependencies);
23
23
  }
24
24
  }
@@ -1,4 +1,4 @@
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 } from '../types/utils';
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 } from '../types/utils';
2
2
  import migrateToV3 from './to/v3.0.0';
3
3
  import migrateToV3_1 from './to/v3.1.0';
4
4
  import migrateToV3_2 from './to/v3.2.0';
@@ -12,6 +12,7 @@ import migrateToV3_8 from './to/v3.8.0';
12
12
  import migrateToV3_9_0 from './to/v3.9.0';
13
13
  import migrateToV3_10 from './to/v3.10.0';
14
14
  import migrateToV3_11_0 from './to/v3.11.0';
15
+ import migrateToV3_12_0 from './to/v3.12.0';
15
16
  export * from './utils';
16
17
  export const listTypePrefix = 'PaginatedList';
17
18
  export async function migrateToLatestProjectSchema(context, projectSchema) {
@@ -71,6 +72,10 @@ export async function migrateToLatestProjectSchema(context, projectSchema) {
71
72
  projectSchema = migrateToV3_11_0(context, projectSchema);
72
73
  }
73
74
 
75
+ if (isProjectSchemaV3_11(projectSchema)) {
76
+ projectSchema = migrateToV3_12_0(projectSchema);
77
+ }
78
+
74
79
  return projectSchema;
75
80
  }
76
81
  export async function ensureLatest(context, schema) {
@@ -0,0 +1,10 @@
1
+ function migrateToV3_12_0(projectSchema) {
2
+ /**
3
+ * No migration needed all changes are backwards compatible.
4
+ */
5
+ return { ...projectSchema,
6
+ schemaVersion: '3.12.0'
7
+ };
8
+ }
9
+
10
+ export default migrateToV3_12_0;
@@ -1,6 +1,7 @@
1
1
  // This file is generated by "pnpm json2ts"
2
2
  export * from './latest';
3
3
  export * from './v4.0.0';
4
+ export * from './v3.12.0';
4
5
  export * from './v3.11.0';
5
6
  export * from './v3.10.0';
6
7
  export * from './v3.9.0';
@@ -0,0 +1 @@
1
+ export {};
package/es/refs.js CHANGED
@@ -206,7 +206,11 @@ export function refToRefItem(context, $ref, template) {
206
206
  export function getRef(context, refSchema) {
207
207
  if (refSchema['@ref']) {
208
208
  // @ref: my-service:ShapeName
209
- return atRefToRefItem(context, refSchema['@ref']);
209
+ const {
210
+ shapeName,
211
+ template
212
+ } = parseTemplateShape(refSchema['@ref']);
213
+ return atRefToRefItem(context, shapeName, template);
210
214
  }
211
215
 
212
216
  if (refSchema.$ref) {
@@ -1,8 +1,9 @@
1
1
  // This file is generated by "pnpm json2ts"
2
- export const CURRENT_SCHEMA_VERSION = '3.11.0';
2
+ export const CURRENT_SCHEMA_VERSION = '3.12.0';
3
3
  export { default as anyProjectSchema } from './project-schema.json';
4
- export { default as latestSchemaJson } from './project-schema/v3.11.0.json';
4
+ export { default as latestSchemaJson } from './project-schema/v3.12.0.json';
5
5
  import projectSchemaV4_0_0 from './project-schema/v4.0.0.json';
6
+ import projectSchemaV3_12_0 from './project-schema/v3.12.0.json';
6
7
  import projectSchemaV3_11_0 from './project-schema/v3.11.0.json';
7
8
  import projectSchemaV3_10_0 from './project-schema/v3.10.0.json';
8
9
  import projectSchemaV3_9_0 from './project-schema/v3.9.0.json';
@@ -29,4 +30,4 @@ import projectSchemaV3_0_0 from './project-schema/v3.0.0.json';
29
30
  import metaSchemaV3_0_0 from './project-schema/meta-schema-v3.0.0.json';
30
31
  import projectSchemaV1_0_0 from './project-schema/v1.0.0.json';
31
32
  import metaSchemaV1_0_0 from './project-schema/meta-schema-v1.0.0.json';
32
- export const allProjectSchemas = [projectSchemaV4_0_0, projectSchemaV3_11_0, projectSchemaV3_10_0, projectSchemaV3_9_0, metaSchemaV3_9_0, projectSchemaV3_8_0, metaSchemaV3_8_0, projectSchemaV3_7_0, metaSchemaV3_7_0, projectSchemaV3_6_0, metaSchemaV3_6_0, projectSchemaV3_5_1, metaSchemaV3_5_1, projectSchemaV3_5_0, metaSchemaV3_5_0, projectSchemaV3_4_0, metaSchemaV3_4_0, projectSchemaV3_3_0, metaSchemaV3_3_0, projectSchemaV3_2_0, metaSchemaV3_2_0, projectSchemaV3_1_0, metaSchemaV3_1_0, projectSchemaV3_0_0, metaSchemaV3_0_0, projectSchemaV1_0_0, metaSchemaV1_0_0];
33
+ export const allProjectSchemas = [projectSchemaV4_0_0, projectSchemaV3_12_0, projectSchemaV3_11_0, projectSchemaV3_10_0, projectSchemaV3_9_0, metaSchemaV3_9_0, projectSchemaV3_8_0, metaSchemaV3_8_0, projectSchemaV3_7_0, metaSchemaV3_7_0, projectSchemaV3_6_0, metaSchemaV3_6_0, projectSchemaV3_5_1, metaSchemaV3_5_1, projectSchemaV3_5_0, metaSchemaV3_5_0, projectSchemaV3_4_0, metaSchemaV3_4_0, projectSchemaV3_3_0, metaSchemaV3_3_0, projectSchemaV3_2_0, metaSchemaV3_2_0, projectSchemaV3_1_0, metaSchemaV3_1_0, projectSchemaV3_0_0, metaSchemaV3_0_0, projectSchemaV1_0_0, metaSchemaV1_0_0];
@@ -1,8 +1,9 @@
1
1
  // This file is generated by "pnpm json2ts"
2
- export const CURRENT_SCHEMA_VERSION = '3.11.0';
2
+ export const CURRENT_SCHEMA_VERSION = '3.12.0';
3
3
  export {default as anyProjectSchema} from './project-schema.json';
4
- export {default as latestSchemaJson} from './project-schema/v3.11.0.json';
4
+ export {default as latestSchemaJson} from './project-schema/v3.12.0.json';
5
5
  import projectSchemaV4_0_0 from './project-schema/v4.0.0.json';
6
+ import projectSchemaV3_12_0 from './project-schema/v3.12.0.json';
6
7
  import projectSchemaV3_11_0 from './project-schema/v3.11.0.json';
7
8
  import projectSchemaV3_10_0 from './project-schema/v3.10.0.json';
8
9
  import projectSchemaV3_9_0 from './project-schema/v3.9.0.json';
@@ -31,6 +32,7 @@ import projectSchemaV1_0_0 from './project-schema/v1.0.0.json';
31
32
  import metaSchemaV1_0_0 from './project-schema/meta-schema-v1.0.0.json';
32
33
  export const allProjectSchemas = [
33
34
  projectSchemaV4_0_0,
35
+ projectSchemaV3_12_0,
34
36
  projectSchemaV3_11_0,
35
37
  projectSchemaV3_10_0,
36
38
  projectSchemaV3_9_0,