@takeshape/schema 10.2.23 → 10.3.3

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/dist/api-version.js +2 -4
  2. package/dist/builtin-schema.js +4 -7
  3. package/dist/migration/index.js +2 -4
  4. package/dist/migration/to/v3.0.0.js +1 -2
  5. package/dist/migration/to/v3.1.0.js +1 -2
  6. package/dist/migration/to/v3.10.0.js +1 -2
  7. package/dist/migration/to/v3.11.0.js +1 -2
  8. package/dist/migration/to/v3.12.0.js +1 -2
  9. package/dist/migration/to/v3.12.1.js +1 -2
  10. package/dist/migration/to/v3.12.2.js +1 -2
  11. package/dist/migration/to/v3.12.3.js +1 -2
  12. package/dist/migration/to/v3.13.0.js +1 -2
  13. package/dist/migration/to/v3.14.0.js +1 -2
  14. package/dist/migration/to/v3.15.0.js +1 -2
  15. package/dist/migration/to/v3.16.0.js +1 -2
  16. package/dist/migration/to/v3.17.0.js +1 -2
  17. package/dist/migration/to/v3.17.1.js +1 -2
  18. package/dist/migration/to/v3.18.0.js +1 -2
  19. package/dist/migration/to/v3.18.1.js +1 -2
  20. package/dist/migration/to/v3.18.2.js +1 -2
  21. package/dist/migration/to/v3.19.0.js +1 -2
  22. package/dist/migration/to/v3.2.0.js +1 -2
  23. package/dist/migration/to/v3.20.0.js +1 -2
  24. package/dist/migration/to/v3.21.0.js +1 -2
  25. package/dist/migration/to/v3.22.0.js +1 -2
  26. package/dist/migration/to/v3.23.0.js +1 -2
  27. package/dist/migration/to/v3.24.0.js +1 -2
  28. package/dist/migration/to/v3.25.0.js +1 -2
  29. package/dist/migration/to/v3.26.0.js +1 -2
  30. package/dist/migration/to/v3.27.0.js +1 -2
  31. package/dist/migration/to/v3.28.0.js +1 -2
  32. package/dist/migration/to/v3.29.0.js +1 -2
  33. package/dist/migration/to/v3.3.0.js +1 -2
  34. package/dist/migration/to/v3.30.0.js +1 -2
  35. package/dist/migration/to/v3.31.0.js +1 -2
  36. package/dist/migration/to/v3.32.0.js +1 -2
  37. package/dist/migration/to/v3.33.0.js +1 -2
  38. package/dist/migration/to/v3.34.0.js +1 -2
  39. package/dist/migration/to/v3.35.0.js +1 -2
  40. package/dist/migration/to/v3.36.0.js +1 -2
  41. package/dist/migration/to/v3.37.0.js +1 -2
  42. package/dist/migration/to/v3.38.0.js +1 -2
  43. package/dist/migration/to/v3.39.0.js +1 -2
  44. package/dist/migration/to/v3.4.0.js +1 -2
  45. package/dist/migration/to/v3.5.0.js +1 -2
  46. package/dist/migration/to/v3.5.1.js +1 -2
  47. package/dist/migration/to/v3.6.0.js +1 -2
  48. package/dist/migration/to/v3.7.0.js +1 -2
  49. package/dist/migration/to/v3.8.0.js +1 -2
  50. package/dist/migration/to/v3.9.0.js +1 -2
  51. package/dist/project-schema/index.js +50 -100
  52. package/dist/scalars.js +1 -2
  53. package/dist/schema-util.js +12 -24
  54. package/dist/schemas/index.js +2 -4
  55. package/dist/taxonomies.js +3 -5
  56. package/dist/template-shapes/templates.d.ts.map +1 -1
  57. package/dist/template-shapes/templates.js +24 -41
  58. package/dist/template-shapes/types.js +2 -3
  59. package/dist/template-shapes/where.js +5 -11
  60. package/dist/types/types.js +5 -9
  61. package/dist/unions.js +2 -4
  62. package/dist/util/api-indexing.js +2 -4
  63. package/dist/versions.js +3 -6
  64. package/dist/workflows.js +1 -2
  65. package/es/layers/type-utils.js +1 -0
  66. package/es/services.js +3 -0
  67. package/es/template-shapes/templates.js +5 -2
  68. package/es/template-shapes/where.js +0 -1
  69. package/es/types/types.js +4 -0
  70. package/package.json +6 -6
@@ -88,8 +88,7 @@ var _isArray = _interopRequireDefault(require("lodash/isArray"));
88
88
  var _some = _interopRequireDefault(require("lodash/some"));
89
89
  var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
90
90
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
91
- const SERVICE_OBJECT_PATTERN_NAME = 'pattern:service-object';
92
- exports.SERVICE_OBJECT_PATTERN_NAME = SERVICE_OBJECT_PATTERN_NAME;
91
+ const SERVICE_OBJECT_PATTERN_NAME = exports.SERVICE_OBJECT_PATTERN_NAME = 'pattern:service-object';
93
92
  function isBuiltinShape(shapeName) {
94
93
  return Boolean(_builtinSchema.builtInShapes[shapeName]);
95
94
  }
@@ -104,22 +103,15 @@ function isBuiltinType(projectSchema, refSchema) {
104
103
  const shapeName = (0, _refs.getRefShapeName)(projectSchema, refSchema);
105
104
  return shapeName !== undefined && isBuiltinShape(shapeName);
106
105
  }
107
- const schemaMetadataKeys = ['$comment', 'title', 'description', '@l10n', '@deprecationReason', '@tag', '@tags', '@syncLocaleStructure', '@sensitive'];
108
- exports.schemaMetadataKeys = schemaMetadataKeys;
109
- const commonSchemaKeys = ['type', 'default', 'readOnly', ...schemaMetadataKeys];
110
- exports.commonSchemaKeys = commonSchemaKeys;
111
- const scalarSchemaKeys = [...commonSchemaKeys, 'format', 'oneOf', 'multipleOf', 'maximum', 'exclusiveMaximum', 'minimum', 'exclusiveMinimum', 'maxLength', 'minLength', 'pattern'];
112
- exports.scalarSchemaKeys = scalarSchemaKeys;
113
- const objectSchemaKeys = [...commonSchemaKeys, 'properties', 'required'];
114
- exports.objectSchemaKeys = objectSchemaKeys;
115
- const arraySchemaKeys = [...commonSchemaKeys, 'items', 'additionalItems', 'maxItems', 'minItems', 'uniqueItems'];
116
- exports.arraySchemaKeys = arraySchemaKeys;
117
- const multipleRelationshipSchemaKeys = [...schemaMetadataKeys, 'maxItems', 'minItems'];
106
+ const schemaMetadataKeys = exports.schemaMetadataKeys = ['$comment', 'title', 'description', '@l10n', '@deprecationReason', '@tag', '@tags', '@syncLocaleStructure', '@sensitive'];
107
+ const commonSchemaKeys = exports.commonSchemaKeys = ['type', 'default', 'readOnly', ...schemaMetadataKeys];
108
+ const scalarSchemaKeys = exports.scalarSchemaKeys = [...commonSchemaKeys, 'format', 'oneOf', 'multipleOf', 'maximum', 'exclusiveMaximum', 'minimum', 'exclusiveMinimum', 'maxLength', 'minLength', 'pattern'];
109
+ const objectSchemaKeys = exports.objectSchemaKeys = [...commonSchemaKeys, 'properties', 'required'];
110
+ const arraySchemaKeys = exports.arraySchemaKeys = [...commonSchemaKeys, 'items', 'additionalItems', 'maxItems', 'minItems', 'uniqueItems'];
111
+ const multipleRelationshipSchemaKeys = exports.multipleRelationshipSchemaKeys = [...schemaMetadataKeys, 'maxItems', 'minItems'];
118
112
 
119
113
  // All properties except properties, items, additionalItems
120
- exports.multipleRelationshipSchemaKeys = multipleRelationshipSchemaKeys;
121
- const nonStructuralSchemaKeys = [...scalarSchemaKeys, '@resolver', '@input', '@output', '@backreference', '@args', 'required', 'maxItems', 'minItems', 'uniqueItems'];
122
- exports.nonStructuralSchemaKeys = nonStructuralSchemaKeys;
114
+ const nonStructuralSchemaKeys = exports.nonStructuralSchemaKeys = [...scalarSchemaKeys, '@resolver', '@input', '@output', '@backreference', '@args', 'required', 'maxItems', 'minItems', 'uniqueItems'];
123
115
  function getServiceIdFieldName(serviceFieldName) {
124
116
  return `${serviceFieldName}Id`;
125
117
  }
@@ -319,8 +311,7 @@ function getCommonBuiltInProperties(shape) {
319
311
  }
320
312
  };
321
313
  }
322
- const DEFAULT_ID_FIELD = 'id';
323
- exports.DEFAULT_ID_FIELD = DEFAULT_ID_FIELD;
314
+ const DEFAULT_ID_FIELD = exports.DEFAULT_ID_FIELD = 'id';
324
315
  function getIdField(obj) {
325
316
  return obj?.idField ?? DEFAULT_ID_FIELD;
326
317
  }
@@ -431,13 +422,12 @@ function getBuiltInPropertyNames(profile = BuiltInPropertiesProfile.Model) {
431
422
  }
432
423
  return new Set(keys);
433
424
  }
434
- let BuiltInPropertiesProfile = /*#__PURE__*/function (BuiltInPropertiesProfile) {
425
+ let BuiltInPropertiesProfile = exports.BuiltInPropertiesProfile = /*#__PURE__*/function (BuiltInPropertiesProfile) {
435
426
  BuiltInPropertiesProfile[BuiltInPropertiesProfile["Model"] = 0] = "Model";
436
427
  BuiltInPropertiesProfile[BuiltInPropertiesProfile["Cached"] = 1] = "Cached";
437
428
  BuiltInPropertiesProfile[BuiltInPropertiesProfile["None"] = 2] = "None";
438
429
  return BuiltInPropertiesProfile;
439
430
  }({});
440
- exports.BuiltInPropertiesProfile = BuiltInPropertiesProfile;
441
431
  const BUILT_IN_PROPERTY_NAMES = {
442
432
  [BuiltInPropertiesProfile.Model]: getBuiltInPropertyNames(BuiltInPropertiesProfile.Model),
443
433
  [BuiltInPropertiesProfile.Cached]: getBuiltInPropertyNames(BuiltInPropertiesProfile.Cached),
@@ -1030,7 +1020,7 @@ function collectReferencedShapeNames(context, shapeNames) {
1030
1020
  * Creates a schema property list chainable fn, allowing you to manipulate and
1031
1021
  * iterate the properties in a schema.
1032
1022
  */
1033
- const createSchemaPropertyList = (0, _curry.default)((context, shapeOrSchema) => {
1023
+ const createSchemaPropertyList = exports.createSchemaPropertyList = (0, _curry.default)((context, shapeOrSchema) => {
1034
1024
  const propSchema = isShape(shapeOrSchema) ? shapeOrSchema.schema : shapeOrSchema;
1035
1025
  const schema = (0, _refs.dereferenceSchema)(context, propSchema, isShape(shapeOrSchema) ? ['shapes', shapeOrSchema.name] : undefined);
1036
1026
  const propertyIterator = new Map((0, _utils.isObjectSchema)(schema) ? Object.entries(schema.properties) : undefined);
@@ -1091,7 +1081,6 @@ const createSchemaPropertyList = (0, _curry.default)((context, shapeOrSchema) =>
1091
1081
  };
1092
1082
  return self;
1093
1083
  });
1094
- exports.createSchemaPropertyList = createSchemaPropertyList;
1095
1084
  function isShape(shapeOrSchema) {
1096
1085
  return 'schema' in shapeOrSchema;
1097
1086
  }
@@ -1122,10 +1111,9 @@ class SchemaPropertyAccessor {
1122
1111
  * Creates a schema property accessor, allowing you to safely access schema
1123
1112
  * properties.
1124
1113
  */
1125
- const createSchemaPropertyAccessor = (0, _curry.default)((context, shapeOrSchema) => {
1114
+ const createSchemaPropertyAccessor = exports.createSchemaPropertyAccessor = (0, _curry.default)((context, shapeOrSchema) => {
1126
1115
  return new SchemaPropertyAccessor(context, shapeOrSchema);
1127
1116
  });
1128
- exports.createSchemaPropertyAccessor = createSchemaPropertyAccessor;
1129
1117
  function findQueryHelper(slice, shapeName, resolver, type) {
1130
1118
  const schemaPath = type === 'query' ? 'queries' : 'mutations';
1131
1119
  return Object.keys(slice[schemaPath]).find(queryName => {
@@ -80,7 +80,5 @@ var _v48 = _interopRequireDefault(require("./project-schema/v3.38.0.json"));
80
80
  var _v49 = _interopRequireDefault(require("./project-schema/v4.0.0.json"));
81
81
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
82
82
  // This file is generated by "pnpm json2ts"
83
- const CURRENT_SCHEMA_VERSION = '3.39.0';
84
- exports.CURRENT_SCHEMA_VERSION = CURRENT_SCHEMA_VERSION;
85
- const allProjectSchemas = [_metaSchemaV.default, _v2.default, _metaSchemaV2.default, _v3.default, _metaSchemaV3.default, _v4.default, _metaSchemaV4.default, _v5.default, _metaSchemaV5.default, _v6.default, _metaSchemaV6.default, _v7.default, _metaSchemaV7.default, _v8.default, _metaSchemaV8.default, _v9.default, _metaSchemaV9.default, _v10.default, _metaSchemaV10.default, _v11.default, _metaSchemaV11.default, _v12.default, _metaSchemaV12.default, _v13.default, _v14.default, _v15.default, _v16.default, _v17.default, _v18.default, _v19.default, _v20.default, _v21.default, _v22.default, _v23.default, _v24.default, _v25.default, _v26.default, _v27.default, _v28.default, _v29.default, _v30.default, _v31.default, _v32.default, _v33.default, _v34.default, _v35.default, _v36.default, _v37.default, _v38.default, _v39.default, _v40.default, _v41.default, _v42.default, _v43.default, _v44.default, _v45.default, _v46.default, _v47.default, _v48.default, _v.default, _v49.default];
86
- exports.allProjectSchemas = allProjectSchemas;
83
+ const CURRENT_SCHEMA_VERSION = exports.CURRENT_SCHEMA_VERSION = '3.39.0';
84
+ const allProjectSchemas = exports.allProjectSchemas = [_metaSchemaV.default, _v2.default, _metaSchemaV2.default, _v3.default, _metaSchemaV3.default, _v4.default, _metaSchemaV4.default, _v5.default, _metaSchemaV5.default, _v6.default, _metaSchemaV6.default, _v7.default, _metaSchemaV7.default, _v8.default, _metaSchemaV8.default, _v9.default, _metaSchemaV9.default, _v10.default, _metaSchemaV10.default, _v11.default, _metaSchemaV11.default, _v12.default, _metaSchemaV12.default, _v13.default, _v14.default, _v15.default, _v16.default, _v17.default, _v18.default, _v19.default, _v20.default, _v21.default, _v22.default, _v23.default, _v24.default, _v25.default, _v26.default, _v27.default, _v28.default, _v29.default, _v30.default, _v31.default, _v32.default, _v33.default, _v34.default, _v35.default, _v36.default, _v37.default, _v38.default, _v39.default, _v40.default, _v41.default, _v42.default, _v43.default, _v44.default, _v45.default, _v46.default, _v47.default, _v48.default, _v.default, _v49.default];
@@ -28,9 +28,8 @@ function getFirstStringFieldV3(shape, projectSchema) {
28
28
  key: schemaProperties.getKey(name)
29
29
  } : null;
30
30
  }
31
- const getTaxonomyField = weakMemoize((shape, projectSchema) => shape.model?.type === 'taxonomy' ? getFirstStringFieldV3(shape, projectSchema) : null);
32
- exports.getTaxonomyField = getTaxonomyField;
33
- const getTaxonomies = weakMemoize(projectSchema => {
31
+ const getTaxonomyField = exports.getTaxonomyField = weakMemoize((shape, projectSchema) => shape.model?.type === 'taxonomy' ? getFirstStringFieldV3(shape, projectSchema) : null);
32
+ const getTaxonomies = exports.getTaxonomies = weakMemoize(projectSchema => {
34
33
  const {
35
34
  shapes
36
35
  } = projectSchema;
@@ -45,5 +44,4 @@ const getTaxonomies = weakMemoize(projectSchema => {
45
44
  }
46
45
  return result;
47
46
  }, []);
48
- });
49
- exports.getTaxonomies = getTaxonomies;
47
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/template-shapes/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAqB,cAAc,EAAE,SAAS,EAAc,MAAM,mBAAmB,CAAC;AAC/G,OAAO,KAAK,EAAC,gBAAgB,EAAE,eAAe,EAAC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U,EAAE,YAKxB,CAAC;AAEF,eAAO,MAAM,uBAAuB,WAsBnC,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,GAAG,gBAAgB,CAe1F;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,GAAG,gBAAgB,CAmB1F;AAsBD,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,aAChC,OAAO,SAAS,SAAS,KAAG,gBAAgB,CAU9D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,aAAa,eACxC,MAAM,YAG1B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAM3D;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AA2BD;;GAEG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,uBAM9C,eAAe,SAAS,SAAS,KAAG,gBAAgB,CAkF9E;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,aAAa,aACtC,OAAO,SAAS,SAAS,KAAG,gBAAgB,CAiB9D;AAED,eAAO,MAAM,gBAAgB,EAAE,YAwB9B,CAAC;AAuBF,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,aAC5D,eAAe,SAAS,SAAS,KAAG,gBAAgB,CA0BtE"}
@@ -25,35 +25,21 @@ var _util2 = require("../util");
25
25
  var _createInputSchema = require("../create-input-schema");
26
26
  var _get = _interopRequireDefault(require("lodash/get"));
27
27
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
- const TSGetArgs = getIDQueryArgs('TSGetArgs');
29
- exports.TSGetArgs = TSGetArgs;
30
- const TSGetSingletonArgs = getIDQueryArgs('TSGetSingletonArgs');
31
- exports.TSGetSingletonArgs = TSGetSingletonArgs;
32
- const TSListArgs = getShapeListQueryArgs('TSListArgs', true);
33
- exports.TSListArgs = TSListArgs;
34
- const TSSearchArgs = getShapeListQueryArgs('TSSearchArgs', false);
35
- exports.TSSearchArgs = TSSearchArgs;
36
- const CreateArgs = getMutationArgs('CreateArgs', _types.TemplateVerbs.Create);
37
- exports.CreateArgs = CreateArgs;
38
- const UpdateArgs = getMutationArgs('UpdateArgs', _types.TemplateVerbs.Update);
39
- exports.UpdateArgs = UpdateArgs;
40
- const DuplicateArgs = getMutationArgs('DuplicateArgs', _types.TemplateVerbs.Duplicate);
41
- exports.DuplicateArgs = DuplicateArgs;
42
- const DeleteArgs = getMutationArgs('DeleteArgs', _types.TemplateVerbs.Delete);
43
- exports.DeleteArgs = DeleteArgs;
44
- const PaginatedList = getPaginatedListShape;
45
- exports.PaginatedList = PaginatedList;
46
- const SearchResults = getSearchResultsShape;
47
- exports.SearchResults = SearchResults;
48
- const CreateResult = getMutationResultType(_types.TemplateVerbs.Create);
49
- exports.CreateResult = CreateResult;
50
- const UpdateResult = getMutationResultType(_types.TemplateVerbs.Update);
51
- exports.UpdateResult = UpdateResult;
52
- const DuplicateResult = getMutationResultType(_types.TemplateVerbs.Duplicate);
53
- exports.DuplicateResult = DuplicateResult;
54
- const DeleteResult = getMutationResultType(_types.TemplateVerbs.Delete);
55
- exports.DeleteResult = DeleteResult;
56
- const TSSearchSortInput = (0, _schemaUtil.createShape)('TSSearchSortInput', {
28
+ const TSGetArgs = exports.TSGetArgs = getIDQueryArgs('TSGetArgs');
29
+ const TSGetSingletonArgs = exports.TSGetSingletonArgs = getIDQueryArgs('TSGetSingletonArgs');
30
+ const TSListArgs = exports.TSListArgs = getShapeListQueryArgs('TSListArgs', true);
31
+ const TSSearchArgs = exports.TSSearchArgs = getShapeListQueryArgs('TSSearchArgs', false);
32
+ const CreateArgs = exports.CreateArgs = getMutationArgs('CreateArgs', _types.TemplateVerbs.Create);
33
+ const UpdateArgs = exports.UpdateArgs = getMutationArgs('UpdateArgs', _types.TemplateVerbs.Update);
34
+ const DuplicateArgs = exports.DuplicateArgs = getMutationArgs('DuplicateArgs', _types.TemplateVerbs.Duplicate);
35
+ const DeleteArgs = exports.DeleteArgs = getMutationArgs('DeleteArgs', _types.TemplateVerbs.Delete);
36
+ const PaginatedList = exports.PaginatedList = getPaginatedListShape;
37
+ const SearchResults = exports.SearchResults = getSearchResultsShape;
38
+ const CreateResult = exports.CreateResult = getMutationResultType(_types.TemplateVerbs.Create);
39
+ const UpdateResult = exports.UpdateResult = getMutationResultType(_types.TemplateVerbs.Update);
40
+ const DuplicateResult = exports.DuplicateResult = getMutationResultType(_types.TemplateVerbs.Duplicate);
41
+ const DeleteResult = exports.DeleteResult = getMutationResultType(_types.TemplateVerbs.Delete);
42
+ const TSSearchSortInput = exports.TSSearchSortInput = (0, _schemaUtil.createShape)('TSSearchSortInput', {
57
43
  type: 'object',
58
44
  properties: {
59
45
  field: {
@@ -66,8 +52,7 @@ const TSSearchSortInput = (0, _schemaUtil.createShape)('TSSearchSortInput', {
66
52
  },
67
53
  required: ['field', 'order']
68
54
  });
69
- exports.TSSearchSortInput = TSSearchSortInput;
70
- const commonSearchProps = {
55
+ const commonSearchProps = exports.commonSearchProps = {
71
56
  terms: {
72
57
  type: 'string'
73
58
  },
@@ -91,8 +76,7 @@ const commonSearchProps = {
91
76
  }
92
77
  }
93
78
  };
94
- exports.commonSearchProps = commonSearchProps;
95
- const localeProps = {
79
+ const localeProps = exports.localeProps = {
96
80
  type: 'object',
97
81
  properties: {
98
82
  locale: {
@@ -104,8 +88,7 @@ const localeProps = {
104
88
  }
105
89
  }
106
90
  };
107
- exports.localeProps = localeProps;
108
- const termsProps = {
91
+ const termsProps = exports.termsProps = {
109
92
  type: 'object',
110
93
  properties: {
111
94
  terms: {
@@ -113,8 +96,7 @@ const termsProps = {
113
96
  }
114
97
  }
115
98
  };
116
- exports.termsProps = termsProps;
117
- const TSContentStructureInput = (0, _schemaUtil.createShape)('TSContentStructureInput', {
99
+ const TSContentStructureInput = exports.TSContentStructureInput = (0, _schemaUtil.createShape)('TSContentStructureInput', {
118
100
  type: 'object',
119
101
  properties: {
120
102
  path: {
@@ -133,7 +115,6 @@ const TSContentStructureInput = (0, _schemaUtil.createShape)('TSContentStructure
133
115
  }, {
134
116
  description: 'Describes a structural update to an array of data.'
135
117
  });
136
- exports.TSContentStructureInput = TSContentStructureInput;
137
118
  function getPaginatedListShape(context, shape) {
138
119
  const shapeName = `${shape.name}${_migration.listTypePrefix}`;
139
120
  return {
@@ -312,10 +293,13 @@ function getMutationArgs(templateName, verb) {
312
293
  return true;
313
294
  }).map(shapeName => {
314
295
  const shape = projectSchema.shapes[shapeName];
296
+ if (!shape) {
297
+ return;
298
+ }
315
299
 
316
300
  // We only allow partial input at the top-level
317
301
  return (0, _schemaUtil.createShape)(getInputShapeName(shapeName), rewriteRefs(projectSchema, (0, _createInputSchema.createInputSchema)(shape.schema), getInputShapeName));
318
- }), 'name')),
302
+ }).filter(_util.isDefined), 'name')),
319
303
  ...(addStructure ? {
320
304
  TSContentStructureInput
321
305
  } : {})
@@ -349,7 +333,7 @@ function getMutationResultType(verb) {
349
333
  };
350
334
  };
351
335
  }
352
- const commonSearchArgs = {
336
+ const commonSearchArgs = exports.commonSearchArgs = {
353
337
  type: 'object',
354
338
  properties: {
355
339
  terms: {
@@ -376,7 +360,6 @@ const commonSearchArgs = {
376
360
  }
377
361
  }
378
362
  };
379
- exports.commonSearchArgs = commonSearchArgs;
380
363
  const legacyListArgs = {
381
364
  type: 'object',
382
365
  properties: {
@@ -4,11 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TemplateVerbs = void 0;
7
- let TemplateVerbs = /*#__PURE__*/function (TemplateVerbs) {
7
+ let TemplateVerbs = exports.TemplateVerbs = /*#__PURE__*/function (TemplateVerbs) {
8
8
  TemplateVerbs["Create"] = "create";
9
9
  TemplateVerbs["Update"] = "update";
10
10
  TemplateVerbs["Duplicate"] = "duplicate";
11
11
  TemplateVerbs["Delete"] = "delete";
12
12
  return TemplateVerbs;
13
- }({});
14
- exports.TemplateVerbs = TemplateVerbs;
13
+ }({});
@@ -21,8 +21,7 @@ var _unions = require("../unions");
21
21
  var _utils = require("../types/utils");
22
22
  var _relationships = require("../relationships");
23
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
- const MAX_RELATIONSHIP_DEPTH = 1;
25
- exports.MAX_RELATIONSHIP_DEPTH = MAX_RELATIONSHIP_DEPTH;
24
+ const MAX_RELATIONSHIP_DEPTH = exports.MAX_RELATIONSHIP_DEPTH = 1;
26
25
  const exceededRelationshipDepth = (depth = 0) => depth >= MAX_RELATIONSHIP_DEPTH;
27
26
  exports.exceededRelationshipDepth = exceededRelationshipDepth;
28
27
  class ShapeCache {
@@ -53,7 +52,7 @@ class ShapeCache {
53
52
  return result;
54
53
  }
55
54
  }
56
- const fieldTypeComparison = {
55
+ const fieldTypeComparison = exports.fieldTypeComparison = {
57
56
  id: {
58
57
  comparators: ['eq', 'in'],
59
58
  type: 'string'
@@ -91,8 +90,7 @@ const fieldTypeComparison = {
91
90
  type: 'string'
92
91
  }
93
92
  };
94
- exports.fieldTypeComparison = fieldTypeComparison;
95
- const comparatorDescriptions = {
93
+ const comparatorDescriptions = exports.comparatorDescriptions = {
96
94
  eq: 'Exact match',
97
95
  gt: 'Greater than',
98
96
  gte: 'Greater than or equal',
@@ -102,15 +100,12 @@ const comparatorDescriptions = {
102
100
  match: 'Full text searching with fuzzy matching.',
103
101
  regexp: 'Regular expression string matching. Use of * wildcards could degrade performance.'
104
102
  };
105
- exports.comparatorDescriptions = comparatorDescriptions;
106
- const booleanOperators = ['AND', 'OR', 'NOT'];
107
- exports.booleanOperators = booleanOperators;
108
- const boolOpDescriptionMap = {
103
+ const booleanOperators = exports.booleanOperators = ['AND', 'OR', 'NOT'];
104
+ const boolOpDescriptionMap = exports.boolOpDescriptionMap = {
109
105
  AND: 'AND takes an array of conditions that must appear in the matching results. Nested boolean operators can be used to create complex filters.',
110
106
  OR: 'OR takes an array of conditions that should appear in the matching results. Nested boolean operators can be used to create complex filters.',
111
107
  NOT: 'NOT takes a single condition that must not appear in the matching results.'
112
108
  };
113
- exports.boolOpDescriptionMap = boolOpDescriptionMap;
114
109
  function getConflictingProperties(projectSchema, shapes) {
115
110
  const conflicts = new Set();
116
111
  const allProps = {};
@@ -344,7 +339,6 @@ function getPropertyComparisonType(name, prop, shapeName, context) {
344
339
  ...context,
345
340
  conflictingProperties: undefined // non-union objects have no conflicts
346
341
  };
347
-
348
342
  for (const propName of Object.keys(properties)) {
349
343
  Object.assign(props, getPropertyComparisonType(propName, properties[propName], shapeName, fieldContext));
350
344
  }
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.projectSchemaImportOptionalProps = exports.legacyProjectSchemaImportOptionalProps = exports.RefType = exports.ArgsType = void 0;
7
- const projectSchemaImportOptionalProps = ['projectId', 'locales', 'defaultLocale', 'author'];
8
- exports.projectSchemaImportOptionalProps = projectSchemaImportOptionalProps;
9
- const legacyProjectSchemaImportOptionalProps = ['created', 'updated', 'version', 'dataKey'];
7
+ const projectSchemaImportOptionalProps = exports.projectSchemaImportOptionalProps = ['projectId', 'locales', 'defaultLocale', 'author'];
8
+ const legacyProjectSchemaImportOptionalProps = exports.legacyProjectSchemaImportOptionalProps = ['created', 'updated', 'version', 'dataKey'];
10
9
 
11
10
  /**
12
11
  * Remote service configuration types
@@ -25,11 +24,10 @@ const legacyProjectSchemaImportOptionalProps = ['created', 'updated', 'version',
25
24
  * A type suitable for service object updates, mostly concerns authentication
26
25
  * requirements.
27
26
  */
28
- exports.legacyProjectSchemaImportOptionalProps = legacyProjectSchemaImportOptionalProps;
29
27
  /**
30
28
  * Types of refs
31
29
  */
32
- let RefType = /*#__PURE__*/function (RefType) {
30
+ let RefType = exports.RefType = /*#__PURE__*/function (RefType) {
33
31
  RefType["@ref"] = "@ref";
34
32
  RefType["$ref"] = "$ref";
35
33
  return RefType;
@@ -37,11 +35,10 @@ let RefType = /*#__PURE__*/function (RefType) {
37
35
  /**
38
36
  * Stub of a PropertySchema that may contain a `$ref` or `@ref`.
39
37
  */
40
- exports.RefType = RefType;
41
38
  /**
42
39
  * Types of args
43
40
  */
44
- let ArgsType = /*#__PURE__*/function (ArgsType) {
41
+ let ArgsType = exports.ArgsType = /*#__PURE__*/function (ArgsType) {
45
42
  ArgsType["@args"] = "@args";
46
43
  ArgsType["args"] = "args";
47
44
  return ArgsType;
@@ -60,5 +57,4 @@ let ArgsType = /*#__PURE__*/function (ArgsType) {
60
57
  */
61
58
  /**
62
59
  * The old relationship format, used in client UI.
63
- */
64
- exports.ArgsType = ArgsType;
60
+ */
package/dist/unions.js CHANGED
@@ -127,13 +127,11 @@ function transformOneOf(process) {
127
127
  * See https://github.com/graphql/graphql-spec/pull/825 for more on "GraphQL oneOf"
128
128
  * Opposite of `wrapOneOfObjects`
129
129
  */
130
- const unwrapOneOfObjects = transformOneOf(createUnwrapTransform);
130
+ const unwrapOneOfObjects = exports.unwrapOneOfObjects = transformOneOf(createUnwrapTransform);
131
131
 
132
132
  /**
133
133
  * Wrap oneOf objects in "GraphQL oneOf" style wrapper objects
134
134
  * See https://github.com/graphql/graphql-spec/pull/825 for more on "GraphQL oneOf"
135
135
  * Opposite of `unwrapOneOfObjects`
136
136
  */
137
- exports.unwrapOneOfObjects = unwrapOneOfObjects;
138
- const wrapOneOfObjects = transformOneOf(createWrapTransform);
139
- exports.wrapOneOfObjects = wrapOneOfObjects;
137
+ const wrapOneOfObjects = exports.wrapOneOfObjects = transformOneOf(createWrapTransform);
@@ -71,7 +71,5 @@ function getQueryIndexConfigHelper(op) {
71
71
  }
72
72
  };
73
73
  }
74
- const getListQueryIndexConfigs = getQueryIndexConfigHelper('list');
75
- exports.getListQueryIndexConfigs = getListQueryIndexConfigs;
76
- const getGetQueryIndexConfig = getQueryIndexConfigHelper('get');
77
- exports.getGetQueryIndexConfig = getGetQueryIndexConfig;
74
+ const getListQueryIndexConfigs = exports.getListQueryIndexConfigs = getQueryIndexConfigHelper('list');
75
+ const getGetQueryIndexConfig = exports.getGetQueryIndexConfig = getQueryIndexConfigHelper('get');
package/dist/versions.js CHANGED
@@ -12,9 +12,6 @@ Object.defineProperty(exports, "CURRENT_SCHEMA_VERSION", {
12
12
  });
13
13
  exports.LEGACY_SCHEMA_VERSION = exports.LEGACY_API_VERSION = void 0;
14
14
  var _schemas = require("./schemas");
15
- const LEGACY_SCHEMA_VERSION = '1.0.0';
16
- exports.LEGACY_SCHEMA_VERSION = LEGACY_SCHEMA_VERSION;
17
- const CURRENT_API_VERSION = '2';
18
- exports.CURRENT_API_VERSION = CURRENT_API_VERSION;
19
- const LEGACY_API_VERSION = '1';
20
- exports.LEGACY_API_VERSION = LEGACY_API_VERSION;
15
+ const LEGACY_SCHEMA_VERSION = exports.LEGACY_SCHEMA_VERSION = '1.0.0';
16
+ const CURRENT_API_VERSION = exports.CURRENT_API_VERSION = '2';
17
+ const LEGACY_API_VERSION = exports.LEGACY_API_VERSION = '1';
package/dist/workflows.js CHANGED
@@ -12,7 +12,7 @@ exports.getWorkflow = getWorkflow;
12
12
  exports.getWorkflowStepKeys = getWorkflowStepKeys;
13
13
  exports.statusFallback = statusFallback;
14
14
  var _schemaUtil = require("./schema-util");
15
- const defaultWorkflow = {
15
+ const defaultWorkflow = exports.defaultWorkflow = {
16
16
  name: 'default',
17
17
  title: 'Default',
18
18
  steps: [{
@@ -29,7 +29,6 @@ const defaultWorkflow = {
29
29
  live: true
30
30
  }]
31
31
  };
32
- exports.defaultWorkflow = defaultWorkflow;
33
32
  function getWorkflow(projectSchema, shapeId) {
34
33
  const workflow = (0, _schemaUtil.getShapeById)(projectSchema, shapeId)?.workflow;
35
34
  if (workflow) {
@@ -4,6 +4,7 @@ import isString from 'lodash/isString';
4
4
  import isArray from 'lodash/isArray';
5
5
  import { latestSchemaJson } from '../schemas';
6
6
  /** Resolver Type Utils **/
7
+
7
8
  /**
8
9
  * Only tests that the shape is right, not that the name is correct. That's a job for the validator.
9
10
  */
package/es/services.js CHANGED
@@ -14,12 +14,15 @@ import isEmpty from 'lodash/isEmpty';
14
14
  * Throws an error if decryption fails
15
15
  */
16
16
  // eslint-disable-next-line @typescript-eslint/ban-types
17
+
17
18
  /**
18
19
  * Decrypt an encrypted authentication JSON string
19
20
  * Returns undefined if decryption fails
20
21
  */
21
22
  // eslint-disable-next-line @typescript-eslint/ban-types
23
+
22
24
  // eslint-disable-next-line @typescript-eslint/ban-types
25
+
23
26
  /**
24
27
  * Given a `StoredServiceConfig` returns a usable `ServiceConfig` with the
25
28
  * authentication object decrypted.
@@ -1,6 +1,6 @@
1
1
  import { TemplateVerbs } from './types';
2
2
  import { listTypePrefix } from '../migration';
3
- import { deepClone, formatShapeName, visit } from '@takeshape/util';
3
+ import { deepClone, formatShapeName, isDefined, visit } from '@takeshape/util';
4
4
  import keyBy from 'lodash/keyBy';
5
5
  import { createShape, getShapeDependencies, isCachedShape } from '../schema-util';
6
6
  import { getFlattenedTemplateShapeName, getRef, getRefShapeName, refItemToAtRef, refItemToNamespacedShapeName } from '../refs';
@@ -276,10 +276,13 @@ export function getMutationArgs(templateName, verb) {
276
276
  return true;
277
277
  }).map(shapeName => {
278
278
  const shape = projectSchema.shapes[shapeName];
279
+ if (!shape) {
280
+ return;
281
+ }
279
282
 
280
283
  // We only allow partial input at the top-level
281
284
  return createShape(getInputShapeName(shapeName), rewriteRefs(projectSchema, createInputSchema(shape.schema), getInputShapeName));
282
- }), 'name')),
285
+ }).filter(isDefined), 'name')),
283
286
  ...(addStructure ? {
284
287
  TSContentStructureInput
285
288
  } : {})
@@ -326,7 +326,6 @@ export function getPropertyComparisonType(name, prop, shapeName, context) {
326
326
  ...context,
327
327
  conflictingProperties: undefined // non-union objects have no conflicts
328
328
  };
329
-
330
329
  for (const propName of Object.keys(properties)) {
331
330
  Object.assign(props, getPropertyComparisonType(propName, properties[propName], shapeName, fieldContext));
332
331
  }
package/es/types/types.js CHANGED
@@ -4,17 +4,21 @@ export const legacyProjectSchemaImportOptionalProps = ['created', 'updated', 've
4
4
  /**
5
5
  * Remote service configuration types
6
6
  */
7
+
7
8
  /**
8
9
  * Old service authentication
9
10
  * @deprecated
10
11
  */
12
+
11
13
  /**
12
14
  * Support null sentinels for authentication
13
15
  */
16
+
14
17
  /**
15
18
  * A type suitable for service object updates, mostly concerns authentication
16
19
  * requirements.
17
20
  */
21
+
18
22
  /**
19
23
  * Types of refs
20
24
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeshape/schema",
3
- "version": "10.2.23",
3
+ "version": "10.3.3",
4
4
  "description": "TakeShape Schema",
5
5
  "homepage": "https://www.takeshape.io",
6
6
  "repository": {
@@ -28,9 +28,9 @@
28
28
  "p-reduce": "^2.1.0",
29
29
  "semver": "^7.3.2",
30
30
  "tiny-invariant": "^1.2.0",
31
- "@takeshape/errors": "10.2.23",
32
- "@takeshape/util": "10.2.23",
33
- "@takeshape/json-schema": "10.2.23"
31
+ "@takeshape/errors": "10.3.3",
32
+ "@takeshape/util": "10.3.3",
33
+ "@takeshape/json-schema": "10.3.3"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@takeshape/json-schema-to-typescript": "^11.0.0",
@@ -46,8 +46,8 @@
46
46
  "meow": "^9.0.0",
47
47
  "p-map": "^5.0.0",
48
48
  "shortid": "^2.2.15",
49
- "@takeshape/infra": "10.2.23",
50
- "@takeshape/typescript-jest-junit-reporter": "10.2.23"
49
+ "@takeshape/infra": "10.3.3",
50
+ "@takeshape/typescript-jest-junit-reporter": "10.3.3"
51
51
  },
52
52
  "engines": {
53
53
  "node": ">=18"