@takeshape/schema 9.38.1 → 9.40.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 (109) hide show
  1. package/dist/content-schema-transform.d.ts +1 -1
  2. package/dist/content-schema-transform.d.ts.map +1 -1
  3. package/dist/content-schema-transform.js +1 -1
  4. package/dist/migration/index.d.ts +1 -0
  5. package/dist/migration/index.d.ts.map +1 -1
  6. package/dist/migration/index.js +4 -1
  7. package/dist/migration/to/v3.32.0.d.ts +5 -0
  8. package/dist/migration/to/v3.32.0.d.ts.map +1 -0
  9. package/dist/migration/to/v3.32.0.js +107 -0
  10. package/dist/migration/types.d.ts +1 -3
  11. package/dist/migration/types.d.ts.map +1 -1
  12. package/dist/mocks.d.ts +3 -2
  13. package/dist/mocks.d.ts.map +1 -1
  14. package/dist/mocks.js +14 -0
  15. package/dist/project-schema/index.d.ts +4 -1
  16. package/dist/project-schema/index.d.ts.map +1 -1
  17. package/dist/project-schema/index.js +20 -3
  18. package/dist/project-schema/latest.d.ts +79 -88
  19. package/dist/project-schema/latest.d.ts.map +1 -1
  20. package/dist/project-schema/migrate.d.ts.map +1 -1
  21. package/dist/project-schema/migrate.js +4 -0
  22. package/dist/project-schema/v3.31.0.d.ts +1 -1
  23. package/dist/project-schema/v3.31.0.d.ts.map +1 -1
  24. package/dist/project-schema/v3.32.0.d.ts +1440 -0
  25. package/dist/project-schema/v3.32.0.d.ts.map +1 -0
  26. package/dist/project-schema/v3.32.0.js +5 -0
  27. package/dist/refs.d.ts +20 -1
  28. package/dist/refs.d.ts.map +1 -1
  29. package/dist/refs.js +90 -17
  30. package/dist/schema-util.d.ts +12 -10
  31. package/dist/schema-util.d.ts.map +1 -1
  32. package/dist/schema-util.js +31 -23
  33. package/dist/schemas/index.d.ts +2 -2
  34. package/dist/schemas/index.d.ts.map +1 -1
  35. package/dist/schemas/index.js +6 -4
  36. package/dist/schemas/index.ts +4 -2
  37. package/dist/schemas/project-schema/latest.json +59 -67
  38. package/dist/schemas/project-schema/v3.31.0.json +1 -4
  39. package/dist/schemas/project-schema/v3.32.0.json +3081 -0
  40. package/dist/schemas/project-schema.json +3 -0
  41. package/dist/template-shapes/templates.js +1 -1
  42. package/dist/template-shapes/where.js +2 -2
  43. package/dist/types/types.d.ts +6 -4
  44. package/dist/types/types.d.ts.map +1 -1
  45. package/dist/types/utils.d.ts +4 -2
  46. package/dist/types/utils.d.ts.map +1 -1
  47. package/dist/types/utils.js +22 -1
  48. package/dist/util/api-indexing.d.ts +4 -5
  49. package/dist/util/api-indexing.d.ts.map +1 -1
  50. package/dist/util/api-indexing.js +25 -16
  51. package/dist/util/merge.js +1 -1
  52. package/dist/util/patch-schema.d.ts.map +1 -1
  53. package/dist/util/patch-schema.js +1 -1
  54. package/dist/validate.d.ts.map +1 -1
  55. package/dist/validate.js +97 -31
  56. package/es/content-schema-transform.js +1 -1
  57. package/es/migration/index.js +3 -1
  58. package/es/migration/to/v3.32.0.js +98 -0
  59. package/es/mocks.js +12 -0
  60. package/es/project-schema/index.js +3 -1
  61. package/es/project-schema/migrate.js +5 -1
  62. package/es/project-schema/v3.32.0.js +1 -0
  63. package/es/refs.js +78 -17
  64. package/es/schema-util.js +24 -17
  65. package/es/schemas/index.js +4 -3
  66. package/es/schemas/index.ts +4 -2
  67. package/es/schemas/project-schema/latest.json +59 -67
  68. package/es/schemas/project-schema/v3.31.0.json +1 -4
  69. package/es/schemas/project-schema/v3.32.0.json +3081 -0
  70. package/es/schemas/project-schema.json +3 -0
  71. package/es/template-shapes/templates.js +2 -2
  72. package/es/template-shapes/where.js +3 -3
  73. package/es/types/utils.js +15 -0
  74. package/es/util/api-indexing.js +23 -16
  75. package/es/util/merge.js +1 -1
  76. package/es/util/patch-schema.js +1 -1
  77. package/es/validate.js +96 -31
  78. package/examples/latest/betzino.json +1 -1
  79. package/examples/latest/blog-schema.json +1 -1
  80. package/examples/latest/brewery-schema.json +1 -1
  81. package/examples/latest/complex-project-schema.json +1 -1
  82. package/examples/latest/complex-schema.json +1 -1
  83. package/examples/latest/fabric-ecommerce.json +1 -1
  84. package/examples/latest/frank-and-fred-schema.json +1 -1
  85. package/examples/latest/klirr-schema.json +1 -1
  86. package/examples/latest/massive-schema.json +1 -1
  87. package/examples/latest/mill-components-schema.json +1 -1
  88. package/examples/latest/one-earth.json +1 -1
  89. package/examples/latest/pet-oneof-array.json +1 -1
  90. package/examples/latest/post-schema.json +1 -1
  91. package/examples/latest/pruned-shopify-product-schema.json +1 -1
  92. package/examples/latest/real-world-schema.json +1 -1
  93. package/examples/latest/recursive-repeater-schema.json +1 -1
  94. package/examples/latest/recursive-schema.json +1 -1
  95. package/examples/latest/rick-and-morty-ast.json +1 -1
  96. package/examples/latest/rick-and-morty-graphql.json +1 -1
  97. package/examples/latest/rick-and-morty-rest.json +1 -1
  98. package/examples/latest/schema-with-repeater-draftjs.json +1 -1
  99. package/examples/latest/shape-books-v3_2_0.json +1 -1
  100. package/examples/latest/shape-books.json +1 -1
  101. package/examples/latest/shopify-lookbook.json +1 -1
  102. package/examples/latest/shopify-product-2022-07.json +1 -1
  103. package/examples/latest/shopify-product-2023-04.json +1 -1
  104. package/examples/latest/shopify-store-with-widget.json +1 -1
  105. package/examples/latest/stripe-product-runtime-schema.json +22 -23
  106. package/examples/latest/stripe-starter-resolved.json +1 -1
  107. package/examples/latest/user-schema-no-required.json +1 -1
  108. package/examples/latest/user-schema-with-defaults.json +1 -1
  109. package/package.json +5 -5
@@ -0,0 +1,98 @@
1
+ import { shapeNameToRef } from '../../refs';
2
+ import { createShape } from '../../schema-util';
3
+
4
+ function migrateListQuery(listConfig) {
5
+ const {
6
+ pagination,
7
+ name,
8
+ ...restConfig
9
+ } = listConfig;
10
+ const result = { ...restConfig,
11
+ query: name
12
+ };
13
+
14
+ if (pagination) {
15
+ const {
16
+ itemsToIndexPath,
17
+ ...restPagination
18
+ } = pagination;
19
+ result.pagination = { ...restPagination,
20
+ itemsPath: itemsToIndexPath
21
+ };
22
+ }
23
+
24
+ return result;
25
+ }
26
+
27
+ function queriesToLoaders(queries) {
28
+ if (queries.list) {
29
+ const loaders = {
30
+ list: Array.isArray(queries.list) ? queries.list.map(migrateListQuery) : migrateListQuery(queries.list)
31
+ };
32
+
33
+ if (queries.get) {
34
+ const {
35
+ name,
36
+ ...restGet
37
+ } = queries.get;
38
+ loaders.get = { ...restGet,
39
+ query: name
40
+ };
41
+ }
42
+
43
+ return loaders;
44
+ }
45
+ }
46
+
47
+ function migrateTrigger(trigger) {
48
+ const {
49
+ query,
50
+ ...rest
51
+ } = trigger;
52
+ return { ...rest,
53
+ loader: query
54
+ };
55
+ }
56
+
57
+ const migrate = async (_, projectSchema) => {
58
+ const updatedShapes = { ...projectSchema.shapes
59
+ };
60
+ const {
61
+ indexedShapes,
62
+ ...rest
63
+ } = projectSchema;
64
+
65
+ if (indexedShapes) {
66
+ for (const [name, config] of Object.entries(indexedShapes)) {
67
+ let shape = updatedShapes[name];
68
+
69
+ if (!shape) {
70
+ shape = createShape(name, {
71
+ extends: [{
72
+ '@ref': shapeNameToRef(projectSchema, name)
73
+ }]
74
+ });
75
+ }
76
+
77
+ const loaders = queriesToLoaders(config.queries);
78
+
79
+ if (loaders) {
80
+ shape.loaders = loaders;
81
+ }
82
+
83
+ shape.cache = {
84
+ enabled: true,
85
+ fragment: config.query,
86
+ triggers: config.triggers.map(migrateTrigger)
87
+ };
88
+ updatedShapes[name] = shape;
89
+ }
90
+ }
91
+
92
+ return { ...rest,
93
+ shapes: updatedShapes,
94
+ schemaVersion: '3.32.0'
95
+ };
96
+ };
97
+
98
+ export default migrate;
package/es/mocks.js CHANGED
@@ -43,4 +43,16 @@ export function createMockStoredServiceConfig(serviceKey, serviceConfig) {
43
43
  authentication: 'encrypted-abc123',
44
44
  ...serviceConfig
45
45
  };
46
+ }
47
+ export function addMockIndexingConfig(shape) {
48
+ return { ...shape,
49
+ loaders: {
50
+ list: {
51
+ query: `Query.get${shape.name}List`
52
+ }
53
+ },
54
+ cache: {
55
+ enabled: true
56
+ }
57
+ };
46
58
  }
@@ -40,6 +40,7 @@ export * from './v3.28.0';
40
40
  export * from './v3.29.0';
41
41
  export * from './v3.30.0';
42
42
  export * from './v3.31.0';
43
+ export * from './v3.32.0';
43
44
  export * from './v4.0.0';
44
45
 
45
46
  // Schema type utilities
@@ -101,5 +102,6 @@ export const isProjectSchemaV3_28_0 = createVersionPredicate('3.28.0');
101
102
  export const isProjectSchemaV3_29_0 = createVersionPredicate('3.29.0');
102
103
  export const isProjectSchemaV3_30_0 = createVersionPredicate('3.30.0');
103
104
  export const isProjectSchemaV3_31_0 = createVersionPredicate('3.31.0');
104
- export const isLatestProjectSchema = createVersionPredicate('3.31.0');
105
+ export const isProjectSchemaV3_32_0 = createVersionPredicate('3.32.0');
106
+ export const isLatestProjectSchema = createVersionPredicate('3.32.0');
105
107
  export const isProjectSchemaV4_0_0 = createVersionPredicate('4.0.0');
@@ -1,6 +1,6 @@
1
1
  // This file is generated by "pnpm json2ts"
2
2
  import { migrateTo } from '../migration';
3
- import { isProjectSchemaV1_0_0, isProjectSchemaV3_0_0, isProjectSchemaV3_1_0, isProjectSchemaV3_2_0, isProjectSchemaV3_3_0, isProjectSchemaV3_4_0, isProjectSchemaV3_5_0, isProjectSchemaV3_5_1, isProjectSchemaV3_6_0, isProjectSchemaV3_7_0, isProjectSchemaV3_8_0, isProjectSchemaV3_9_0, isProjectSchemaV3_10_0, isProjectSchemaV3_11_0, isProjectSchemaV3_12_0, isProjectSchemaV3_12_1, isProjectSchemaV3_12_2, isProjectSchemaV3_12_3, isProjectSchemaV3_13_0, isProjectSchemaV3_14_0, isProjectSchemaV3_15_0, isProjectSchemaV3_16_0, isProjectSchemaV3_17_0, isProjectSchemaV3_17_1, isProjectSchemaV3_18_0, isProjectSchemaV3_18_1, isProjectSchemaV3_18_2, isProjectSchemaV3_19_0, isProjectSchemaV3_20_0, isProjectSchemaV3_21_0, isProjectSchemaV3_22_0, isProjectSchemaV3_23_0, isProjectSchemaV3_24_0, isProjectSchemaV3_25_0, isProjectSchemaV3_26_0, isProjectSchemaV3_27_0, isProjectSchemaV3_28_0, isProjectSchemaV3_29_0, isProjectSchemaV3_30_0, isProjectSchemaV4_0_0, isLatestProjectSchema } from './index'; // eslint-disable-next-line complexity
3
+ import { isProjectSchemaV1_0_0, isProjectSchemaV3_0_0, isProjectSchemaV3_1_0, isProjectSchemaV3_2_0, isProjectSchemaV3_3_0, isProjectSchemaV3_4_0, isProjectSchemaV3_5_0, isProjectSchemaV3_5_1, isProjectSchemaV3_6_0, isProjectSchemaV3_7_0, isProjectSchemaV3_8_0, isProjectSchemaV3_9_0, isProjectSchemaV3_10_0, isProjectSchemaV3_11_0, isProjectSchemaV3_12_0, isProjectSchemaV3_12_1, isProjectSchemaV3_12_2, isProjectSchemaV3_12_3, isProjectSchemaV3_13_0, isProjectSchemaV3_14_0, isProjectSchemaV3_15_0, isProjectSchemaV3_16_0, isProjectSchemaV3_17_0, isProjectSchemaV3_17_1, isProjectSchemaV3_18_0, isProjectSchemaV3_18_1, isProjectSchemaV3_18_2, isProjectSchemaV3_19_0, isProjectSchemaV3_20_0, isProjectSchemaV3_21_0, isProjectSchemaV3_22_0, isProjectSchemaV3_23_0, isProjectSchemaV3_24_0, isProjectSchemaV3_25_0, isProjectSchemaV3_26_0, isProjectSchemaV3_27_0, isProjectSchemaV3_28_0, isProjectSchemaV3_29_0, isProjectSchemaV3_30_0, isProjectSchemaV3_31_0, isProjectSchemaV4_0_0, isLatestProjectSchema } from './index'; // eslint-disable-next-line complexity
4
4
 
5
5
  export async function migrateToLatestProjectSchema(context, projectSchema) {
6
6
  if (isLatestProjectSchema(projectSchema)) {
@@ -163,6 +163,10 @@ export async function migrateToLatestProjectSchema(context, projectSchema) {
163
163
  projectSchema = await migrateTo['v3.31.0'](context, projectSchema);
164
164
  }
165
165
 
166
+ if (isProjectSchemaV3_31_0(projectSchema)) {
167
+ projectSchema = await migrateTo['v3.32.0'](context, projectSchema);
168
+ }
169
+
166
170
  if (isProjectSchemaV4_0_0(projectSchema)) {
167
171
  throw new Error('You are using an unreleased schema version. Migration is not possible');
168
172
  }
@@ -0,0 +1 @@
1
+ export {};
package/es/refs.js CHANGED
@@ -8,6 +8,7 @@ import { mergeObjectSchemas } from './util/merge';
8
8
  import { resolveSchema } from 'ajv/dist/compile';
9
9
  import isString from 'lodash/isString';
10
10
  import { isScalar } from './scalars';
11
+ import { NotFoundError } from '@takeshape/errors';
11
12
 
12
13
  /**
13
14
  * Guard for RefItemWithPath. Tests for presence of all required props.
@@ -213,29 +214,40 @@ export function atRefToRefItem(context, atRef, template) {
213
214
  export function refToRefItem(context, $ref, template) {
214
215
  return shapeNameToRefItem(context, $refToShapeName($ref), template);
215
216
  }
216
- export function shapeNameToRefItem(context, shapeName, template) {
217
- const shapeNameParts = shapeName.split('_');
218
- let typeName;
219
- let serviceKey;
220
- let serviceNamespace;
217
+
218
+ /**
219
+ * Parse a name (query, shape, etc) that might have a namespace and find the corresponding service layer id
220
+ */
221
+ export function parseName(context, name) {
222
+ const shapeNameParts = name.split('_');
223
+ let serviceId;
224
+ let namespace;
221
225
 
222
226
  if (shapeNameParts.length > 1) {
223
227
  const namespaces = getServiceNamespaces(context);
224
228
  const maybeNamespace = shapeNameParts[0];
225
- serviceKey = namespaces.get(maybeNamespace);
229
+ serviceId = namespaces.get(maybeNamespace);
226
230
 
227
- if (serviceKey) {
228
- typeName = shapeNameParts.slice(1).join('_');
229
- serviceNamespace = maybeNamespace;
231
+ if (serviceId) {
232
+ name = shapeNameParts.slice(1).join('_');
233
+ namespace = maybeNamespace;
230
234
  }
231
235
  }
232
236
 
233
237
  return {
234
- typeName: typeName ?? shapeName,
235
- serviceKey: serviceKey ?? 'local',
236
- serviceNamespace,
238
+ name,
239
+ serviceId: serviceId ?? 'local',
240
+ namespace
241
+ };
242
+ }
243
+ export function shapeNameToRefItem(context, shapeName, template) {
244
+ const parsed = parseName(context, shapeName);
245
+ return {
246
+ typeName: parsed.name,
247
+ serviceKey: parsed.serviceId,
248
+ serviceNamespace: parsed.namespace,
237
249
  template,
238
- isForeign: Boolean(serviceKey)
250
+ isForeign: parsed.serviceId !== 'local'
239
251
  };
240
252
  }
241
253
  /**
@@ -522,6 +534,14 @@ export function parsePropertyRef(refStr) {
522
534
  const coordinate = index === -1 ? refStr : refStr.substring(index + 1);
523
535
  const coordinateParts = coordinate.split('.');
524
536
 
537
+ if (coordinateParts.length === 1) {
538
+ return {
539
+ serviceId,
540
+ shapeName: 'Query',
541
+ propertyName: coordinateParts[0]
542
+ };
543
+ }
544
+
525
545
  if (coordinateParts.length === 2) {
526
546
  return {
527
547
  serviceId,
@@ -530,6 +550,12 @@ export function parsePropertyRef(refStr) {
530
550
  };
531
551
  }
532
552
  }
553
+ export function serializePropertyRef(propertyRef) {
554
+ return `${propertyRef.serviceId}:${propertyRef.shapeName}.${propertyRef.propertyName}`;
555
+ }
556
+ export function applyNamespace(namespace, name) {
557
+ return namespace ? `${namespace}_${name}` : name;
558
+ }
533
559
  export function propertyRefItemToResolverPath(getNamespace, item) {
534
560
  const path = propertyRefItemToPath(getNamespace, item);
535
561
  return path.concat(path[0] === 'shapes' ? '@resolver' : 'resolver');
@@ -538,6 +564,19 @@ export function propertyRefItemToArgsPath(getNamespace, item) {
538
564
  const path = propertyRefItemToPath(getNamespace, item);
539
565
  return path.concat(path[0] === 'shapes' ? '@args' : 'args');
540
566
  }
567
+ export function propertyRefItemToLocalName(getNamespace, item) {
568
+ const {
569
+ shapeName,
570
+ serviceId,
571
+ propertyName
572
+ } = item;
573
+
574
+ if (shapeName === 'Query' || shapeName === 'Mutation') {
575
+ return applyNamespace(getNamespace(serviceId), propertyName);
576
+ }
577
+
578
+ return propertyName;
579
+ }
541
580
  export function propertyRefItemToPath(getNamespace, item) {
542
581
  const {
543
582
  shapeName,
@@ -546,13 +585,11 @@ export function propertyRefItemToPath(getNamespace, item) {
546
585
  } = item;
547
586
  const namespace = getNamespace(serviceId);
548
587
 
549
- const applyNamespace = name => namespace ? `${namespace}_${name}` : name;
550
-
551
588
  if (shapeName === 'Query' || shapeName === 'Mutation') {
552
- return [shapeName === 'Query' ? 'queries' : 'mutations', applyNamespace(propertyName)];
589
+ return [shapeName === 'Query' ? 'queries' : 'mutations', applyNamespace(namespace, propertyName)];
553
590
  }
554
591
 
555
- return ['shapes', applyNamespace(shapeName), 'schema', 'properties', propertyName];
592
+ return ['shapes', applyNamespace(namespace, shapeName), 'schema', 'properties', propertyName];
556
593
  }
557
594
  export function propertyRefToArgs(projectSchema, ref) {
558
595
  const parsed = typeof ref === 'object' ? ref : parsePropertyRef(ref);
@@ -583,4 +620,28 @@ export function getAllPropertyRefs(projectSchema) {
583
620
  }
584
621
  });
585
622
  return result;
623
+ }
624
+ export function getQuery(projectSchema, queryRef) {
625
+ const propertyRef = parsePropertyRef(queryRef);
626
+
627
+ if (!propertyRef || propertyRef.shapeName !== 'Query' && propertyRef.shapeName !== 'Mutation') {
628
+ throw new Error(`Invalid query ref "${queryRef}"`);
629
+ }
630
+
631
+ const path = propertyRefItemToPath(createGetNamespace(projectSchema), propertyRef);
632
+ const query = get(projectSchema, path);
633
+ return query ? {
634
+ name: path[path.length - 1],
635
+ query,
636
+ ref: propertyRef
637
+ } : undefined;
638
+ }
639
+ export function ensureQuery(projectSchema, queryRef) {
640
+ const query = getQuery(projectSchema, queryRef);
641
+
642
+ if (!query) {
643
+ throw new NotFoundError(`Query "${query}" not found`);
644
+ }
645
+
646
+ return query;
586
647
  }
package/es/schema-util.js CHANGED
@@ -6,14 +6,14 @@ import isObject from 'lodash/isObject';
6
6
  import curry from 'lodash/fp/curry';
7
7
  import orderBy from 'lodash/fp/orderBy';
8
8
  import uniq from 'lodash/uniq';
9
- import { deepClone, isDefined, visit, pascalCase } from '@takeshape/util';
9
+ import { deepClone, isDefined, visit, pascalCase, ensureArray } from '@takeshape/util';
10
10
  import { defaultWorkflow, getStatusField } from './workflows';
11
11
  import { CURRENT_API_VERSION, CURRENT_SCHEMA_VERSION } from './versions';
12
12
  import { workflowsEnabled } from './api-version';
13
13
  import { builtInShapes, builtInForms } from './builtin-schema';
14
14
  import { getArgsType, isObjectSchema, isAllOfSchema, isOneOfSchema, isExtendsSchema, isArraySchema, isServiceResolver, isGraphqlResolver, isRefSchema } from './types/utils';
15
15
  import { getStoredServiceConfig } from './services';
16
- import { createTemplateShapeName, dereferenceObjectSchema, dereferenceSchema, getRef, getRefOrItemsRef, getRefShapeName, parseReturnShape, refExpressionToRefItem, refItemToShape, refItemToShapeName, refItemToShapeSchema, atRefToRefItem, refToRefItem, parseTemplateShape, isRefItemWithPath, returnShapeToSchema } from './refs';
16
+ import { createTemplateShapeName, dereferenceObjectSchema, dereferenceSchema, getRef, getRefOrItemsRef, getRefShapeName, parseReturnShape, refExpressionToRefItem, refItemToShape, refItemToShapeName, refItemToShapeSchema, atRefToRefItem, refToRefItem, parseTemplateShape, isRefItemWithPath, returnShapeToSchema, serializePropertyRef } from './refs';
17
17
  import isEqual from 'lodash/isEqual';
18
18
  import isString from 'lodash/isString';
19
19
  import { isUnionSchema } from './unions';
@@ -164,11 +164,11 @@ export function pathBetween(fromShape, toShape, projectSchema, depthLimit = 4) {
164
164
 
165
165
  return shortestPath;
166
166
  }
167
- export function getShapeQueriesAndMutations(shapeList) {
167
+ export function getShapeQueriesAndMutations(shapes) {
168
168
  const queries = {};
169
169
  const mutations = {};
170
170
 
171
- for (const shape of shapeList) {
171
+ for (const shape of ensureArray(shapes)) {
172
172
  const {
173
173
  name,
174
174
  model
@@ -248,12 +248,12 @@ export function getShapeQueriesAndMutations(shapeList) {
248
248
  mutations
249
249
  };
250
250
  }
251
- export function getBuiltinPropertiesSet(context, shape) {
251
+ export function getBuiltinPropertiesSet(shape) {
252
252
  if (isModelShape(shape)) {
253
253
  return 'model';
254
254
  }
255
255
 
256
- if (isIndexedRemoteShape(context, shape)) {
256
+ if (isCachedShape(shape)) {
257
257
  return 'indexed';
258
258
  }
259
259
 
@@ -345,7 +345,7 @@ export function getBuiltinProperties(shapeId, builtinPropertiesSet, apiVersion =
345
345
 
346
346
  export const getBuiltinPropertyNames = (builtinPropertiesSet, apiVersion = CURRENT_API_VERSION) => new Set([...Object.keys(getBuiltinProperties('shape-id', builtinPropertiesSet, apiVersion)), workflowsEnabled(apiVersion) ? '_status' : undefined].filter(isDefined));
347
347
  export function applyBuiltinPropertiesToShape(projectSchema, shape) {
348
- const builtinSet = getBuiltinPropertiesSet(projectSchema, shape);
348
+ const builtinSet = getBuiltinPropertiesSet(shape);
349
349
 
350
350
  if (builtinSet === 'none') {
351
351
  return shape;
@@ -437,14 +437,17 @@ export function ensureShapeById(projectSchema, shapeId) {
437
437
 
438
438
  return shape;
439
439
  }
440
+ export function getShape(context, name) {
441
+ return context.shapes[name];
442
+ }
440
443
  export function isModelShape(shape) {
441
444
  return Boolean(shape.model);
442
445
  }
443
- export const isIndexedRemoteShape = curry(({
444
- indexedShapes
445
- }, shape) => {
446
- return Boolean(indexedShapes === null || indexedShapes === void 0 ? void 0 : indexedShapes[shape.name]);
447
- });
446
+ export function isCachedShape(shape) {
447
+ var _shape$cache;
448
+
449
+ return ((_shape$cache = shape.cache) === null || _shape$cache === void 0 ? void 0 : _shape$cache.enabled) === true && shape.loaders !== undefined;
450
+ }
448
451
  export function getArgsReference(projectSchema, argsSchema) {
449
452
  const args = getArgs(argsSchema);
450
453
 
@@ -1088,24 +1091,24 @@ function ensureQueryHelper(slice, shapeName, resolver, type) {
1088
1091
  */
1089
1092
 
1090
1093
 
1091
- export const findQuery = (projectSchema, shapeName, resolver) => findQueryHelper(projectSchema, shapeName, resolver, 'query');
1094
+ export const findQueryByShape = (projectSchema, shapeName, resolver) => findQueryHelper(projectSchema, shapeName, resolver, 'query');
1092
1095
  /**
1093
1096
  * Find the query in the schema that corresponds to the given shape and resolver.
1094
1097
  */
1095
1098
 
1096
- export const findMutation = (projectSchema, shapeName, resolver) => findQueryHelper(projectSchema, shapeName, resolver, 'mutation');
1099
+ export const findMutationByShape = (projectSchema, shapeName, resolver) => findQueryHelper(projectSchema, shapeName, resolver, 'mutation');
1097
1100
  /**
1098
1101
  * Find the query in the schema that corresponds to the given shape and resolver.
1099
1102
  * Throw an error if that query does not exist
1100
1103
  */
1101
1104
 
1102
- export const ensureQuery = (projectSchema, shapeName, resolver) => ensureQueryHelper(projectSchema, shapeName, resolver, 'query');
1105
+ export const ensureQueryByShape = (projectSchema, shapeName, resolver) => ensureQueryHelper(projectSchema, shapeName, resolver, 'query');
1103
1106
  /**
1104
1107
  * Find the mutation in the schema that corresponds to the given shape and resolver.
1105
1108
  * Throw an error if that mutation does not exist
1106
1109
  */
1107
1110
 
1108
- export const ensureMutation = (projectSchema, shapeName, resolver) => ensureQueryHelper(projectSchema, shapeName, resolver, 'mutation');
1111
+ export const ensureMutationByShape = (projectSchema, shapeName, resolver) => ensureQueryHelper(projectSchema, shapeName, resolver, 'mutation');
1109
1112
 
1110
1113
  /**
1111
1114
  * Find the query in the schema that corresponds to the given shape and resolver.
@@ -1127,7 +1130,11 @@ export function queryToPropertySchema(projectSchema, query) {
1127
1130
  let mapping;
1128
1131
 
1129
1132
  if (isGraphqlResolver(query.resolver)) {
1130
- mapping = `${query.resolver.service}:Query.${query.resolver.fieldName}`;
1133
+ mapping = serializePropertyRef({
1134
+ serviceId: query.resolver.service,
1135
+ shapeName: 'Query',
1136
+ propertyName: query.resolver.fieldName
1137
+ });
1131
1138
  }
1132
1139
 
1133
1140
  return { ...returnShapeToSchema(projectSchema, query.shape),
@@ -1,7 +1,7 @@
1
1
  // This file is generated by "pnpm json2ts"
2
- export const CURRENT_SCHEMA_VERSION = '3.31.0';
2
+ export const CURRENT_SCHEMA_VERSION = '3.32.0';
3
3
  export { default as anyProjectSchema } from './project-schema.json';
4
- export { default as latestSchemaJson } from './project-schema/v3.31.0.json';
4
+ export { default as latestSchemaJson } from './project-schema/v3.32.0.json';
5
5
  import metaSchemaV1_0_0 from './project-schema/meta-schema-v1.0.0.json';
6
6
  import projectSchemaV1_0_0 from './project-schema/v1.0.0.json';
7
7
  import metaSchemaV3_0_0 from './project-schema/meta-schema-v3.0.0.json';
@@ -54,5 +54,6 @@ import projectSchemaV3_28_0 from './project-schema/v3.28.0.json';
54
54
  import projectSchemaV3_29_0 from './project-schema/v3.29.0.json';
55
55
  import projectSchemaV3_30_0 from './project-schema/v3.30.0.json';
56
56
  import projectSchemaV3_31_0 from './project-schema/v3.31.0.json';
57
+ import projectSchemaV3_32_0 from './project-schema/v3.32.0.json';
57
58
  import projectSchemaV4_0_0 from './project-schema/v4.0.0.json';
58
- export const allProjectSchemas = [metaSchemaV1_0_0, projectSchemaV1_0_0, metaSchemaV3_0_0, projectSchemaV3_0_0, metaSchemaV3_1_0, projectSchemaV3_1_0, metaSchemaV3_2_0, projectSchemaV3_2_0, metaSchemaV3_3_0, projectSchemaV3_3_0, metaSchemaV3_4_0, projectSchemaV3_4_0, metaSchemaV3_5_0, projectSchemaV3_5_0, metaSchemaV3_5_1, projectSchemaV3_5_1, metaSchemaV3_6_0, projectSchemaV3_6_0, metaSchemaV3_7_0, projectSchemaV3_7_0, metaSchemaV3_8_0, projectSchemaV3_8_0, metaSchemaV3_9_0, projectSchemaV3_9_0, projectSchemaV3_10_0, projectSchemaV3_11_0, projectSchemaV3_12_0, projectSchemaV3_12_1, projectSchemaV3_12_2, projectSchemaV3_12_3, projectSchemaV3_13_0, projectSchemaV3_14_0, projectSchemaV3_15_0, projectSchemaV3_16_0, projectSchemaV3_17_0, projectSchemaV3_17_1, projectSchemaV3_18_0, projectSchemaV3_18_1, projectSchemaV3_18_2, projectSchemaV3_19_0, projectSchemaV3_20_0, projectSchemaV3_21_0, projectSchemaV3_22_0, projectSchemaV3_23_0, projectSchemaV3_24_0, projectSchemaV3_25_0, projectSchemaV3_26_0, projectSchemaV3_27_0, projectSchemaV3_28_0, projectSchemaV3_29_0, projectSchemaV3_30_0, projectSchemaV3_31_0, projectSchemaV4_0_0];
59
+ export const allProjectSchemas = [metaSchemaV1_0_0, projectSchemaV1_0_0, metaSchemaV3_0_0, projectSchemaV3_0_0, metaSchemaV3_1_0, projectSchemaV3_1_0, metaSchemaV3_2_0, projectSchemaV3_2_0, metaSchemaV3_3_0, projectSchemaV3_3_0, metaSchemaV3_4_0, projectSchemaV3_4_0, metaSchemaV3_5_0, projectSchemaV3_5_0, metaSchemaV3_5_1, projectSchemaV3_5_1, metaSchemaV3_6_0, projectSchemaV3_6_0, metaSchemaV3_7_0, projectSchemaV3_7_0, metaSchemaV3_8_0, projectSchemaV3_8_0, metaSchemaV3_9_0, projectSchemaV3_9_0, projectSchemaV3_10_0, projectSchemaV3_11_0, projectSchemaV3_12_0, projectSchemaV3_12_1, projectSchemaV3_12_2, projectSchemaV3_12_3, projectSchemaV3_13_0, projectSchemaV3_14_0, projectSchemaV3_15_0, projectSchemaV3_16_0, projectSchemaV3_17_0, projectSchemaV3_17_1, projectSchemaV3_18_0, projectSchemaV3_18_1, projectSchemaV3_18_2, projectSchemaV3_19_0, projectSchemaV3_20_0, projectSchemaV3_21_0, projectSchemaV3_22_0, projectSchemaV3_23_0, projectSchemaV3_24_0, projectSchemaV3_25_0, projectSchemaV3_26_0, projectSchemaV3_27_0, projectSchemaV3_28_0, projectSchemaV3_29_0, projectSchemaV3_30_0, projectSchemaV3_31_0, projectSchemaV3_32_0, projectSchemaV4_0_0];
@@ -1,7 +1,7 @@
1
1
  // This file is generated by "pnpm json2ts"
2
- export const CURRENT_SCHEMA_VERSION = '3.31.0';
2
+ export const CURRENT_SCHEMA_VERSION = '3.32.0';
3
3
  export {default as anyProjectSchema} from './project-schema.json';
4
- export {default as latestSchemaJson} from './project-schema/v3.31.0.json';
4
+ export {default as latestSchemaJson} from './project-schema/v3.32.0.json';
5
5
  import metaSchemaV1_0_0 from './project-schema/meta-schema-v1.0.0.json';
6
6
  import projectSchemaV1_0_0 from './project-schema/v1.0.0.json';
7
7
  import metaSchemaV3_0_0 from './project-schema/meta-schema-v3.0.0.json';
@@ -54,6 +54,7 @@ import projectSchemaV3_28_0 from './project-schema/v3.28.0.json';
54
54
  import projectSchemaV3_29_0 from './project-schema/v3.29.0.json';
55
55
  import projectSchemaV3_30_0 from './project-schema/v3.30.0.json';
56
56
  import projectSchemaV3_31_0 from './project-schema/v3.31.0.json';
57
+ import projectSchemaV3_32_0 from './project-schema/v3.32.0.json';
57
58
  import projectSchemaV4_0_0 from './project-schema/v4.0.0.json';
58
59
  export const allProjectSchemas = [
59
60
  metaSchemaV1_0_0,
@@ -108,5 +109,6 @@ export const allProjectSchemas = [
108
109
  projectSchemaV3_29_0,
109
110
  projectSchemaV3_30_0,
110
111
  projectSchemaV3_31_0,
112
+ projectSchemaV3_32_0,
111
113
  projectSchemaV4_0_0
112
114
  ];