@takeshape/schema 10.1.0 → 10.2.4
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.
- package/dist/content-schema-transform.js +4 -5
- package/dist/interfaces.js +3 -4
- package/dist/layers/layers.js +4 -8
- package/dist/layers/refs.js +1 -2
- package/dist/layers/type-utils.js +2 -2
- package/dist/migration/to/v3.1.0.js +1 -1
- package/dist/migration/to/v3.12.3.js +4 -6
- package/dist/migration/to/v3.9.0.js +5 -10
- package/dist/models/service.js +1 -2
- package/dist/models/shape.js +1 -2
- package/dist/refs.js +3 -7
- package/dist/relationships.js +6 -9
- package/dist/schema-transform.js +1 -1
- package/dist/schema-util.d.ts +1 -0
- package/dist/schema-util.d.ts.map +1 -1
- package/dist/schema-util.js +20 -13
- package/dist/services.js +3 -6
- package/dist/taxonomies.js +3 -10
- package/dist/template-shapes/templates.js +1 -2
- package/dist/template-shapes/where.js +5 -8
- package/dist/types/utils.js +10 -12
- package/dist/unions.js +1 -2
- package/dist/util/api-indexing.js +3 -4
- package/dist/util/form-config.js +1 -2
- package/dist/util/has-arg.js +1 -2
- package/dist/util/merge.js +5 -7
- package/dist/validate.js +16 -25
- package/dist/workflows.js +1 -2
- package/es/content-schema-transform.js +4 -5
- package/es/interfaces.js +3 -4
- package/es/layers/layers.js +4 -8
- package/es/layers/refs.js +1 -2
- package/es/layers/type-utils.js +2 -2
- package/es/migration/to/v3.1.0.js +1 -1
- package/es/migration/to/v3.12.3.js +4 -6
- package/es/migration/to/v3.9.0.js +5 -10
- package/es/models/service.js +1 -2
- package/es/models/shape.js +1 -2
- package/es/refs.js +3 -7
- package/es/relationships.js +6 -9
- package/es/schema-transform.js +1 -1
- package/es/schema-util.js +16 -12
- package/es/services.js +3 -6
- package/es/taxonomies.js +3 -10
- package/es/template-shapes/templates.js +1 -2
- package/es/template-shapes/where.js +5 -8
- package/es/types/utils.js +10 -12
- package/es/unions.js +1 -2
- package/es/util/api-indexing.js +3 -4
- package/es/util/form-config.js +1 -2
- package/es/util/has-arg.js +1 -2
- package/es/util/merge.js +5 -7
- package/es/validate.js +13 -22
- package/es/workflows.js +1 -2
- package/package.json +7 -7
|
@@ -97,11 +97,11 @@ function getContentTransform({
|
|
|
97
97
|
(0, _forEach.default)(schema.properties, (fieldSchema, name) => {
|
|
98
98
|
const sourceKeys = ensureArray(sourceKeyTransform(name, fieldSchema, obj));
|
|
99
99
|
for (const sourceKey of sourceKeys) {
|
|
100
|
-
const value = prepare(fieldSchema, obj
|
|
100
|
+
const value = prepare(fieldSchema, obj?.[sourceKey], name);
|
|
101
101
|
if (value !== undefined) {
|
|
102
102
|
assigned.add(sourceKey);
|
|
103
103
|
const transform = findTransforms(transforms, (0, _refs.dereferenceSchema)(projectSchema, fieldSchema), name);
|
|
104
|
-
const getKey = transform
|
|
104
|
+
const getKey = transform?.keyTransform ? transform.keyTransform : keyTransform;
|
|
105
105
|
result[getKey(name, fieldSchema, sourceKey)] = value;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -134,7 +134,7 @@ function getContentTransform({
|
|
|
134
134
|
}
|
|
135
135
|
function transformKey(transforms, propSchema, name, transform = preferKey) {
|
|
136
136
|
const schemaTransform = findTransforms(transforms, propSchema, name);
|
|
137
|
-
if (schemaTransform
|
|
137
|
+
if (schemaTransform?.keyTransform) {
|
|
138
138
|
transform = schemaTransform.keyTransform;
|
|
139
139
|
}
|
|
140
140
|
return transform(name, propSchema);
|
|
@@ -148,9 +148,8 @@ function getPropertyInfo(context, schema, path) {
|
|
|
148
148
|
const result = [];
|
|
149
149
|
const findProperty = (currentSchema, name, rest, path) => {
|
|
150
150
|
if ((0, _utils.isObjectSchema)(currentSchema)) {
|
|
151
|
-
var _currentSchema$requir;
|
|
152
151
|
const propSchema = currentSchema.properties[name];
|
|
153
|
-
const isRequired =
|
|
152
|
+
const isRequired = currentSchema.required?.includes(name) ?? false;
|
|
154
153
|
if (!propSchema) {
|
|
155
154
|
return;
|
|
156
155
|
}
|
package/dist/interfaces.js
CHANGED
|
@@ -17,7 +17,7 @@ var _unions = require("./unions");
|
|
|
17
17
|
var _util = require("@takeshape/util");
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
function isInterfaceShape(shape) {
|
|
20
|
-
return
|
|
20
|
+
return shape?.type === 'interface';
|
|
21
21
|
}
|
|
22
22
|
function isInterfaceRef(context, propertySchema) {
|
|
23
23
|
const ref = (0, _refs.getRef)(context, propertySchema);
|
|
@@ -50,7 +50,7 @@ function pruneUnusedInterfaces(projectSchema, shapeMap) {
|
|
|
50
50
|
const {
|
|
51
51
|
interfaces
|
|
52
52
|
} = shape;
|
|
53
|
-
if (interfaces
|
|
53
|
+
if (interfaces?.length) {
|
|
54
54
|
const filteredInterfaces = interfaces.filter(refExpression => shapeMap[(0, _refs.refItemToNamespacedShapeName)((0, _refs.refExpressionToRefItem)(projectSchema, refExpression))]);
|
|
55
55
|
if (interfaces.length !== filteredInterfaces.length) {
|
|
56
56
|
return {
|
|
@@ -69,8 +69,7 @@ function getImplementingShapes(context, interfaceRef) {
|
|
|
69
69
|
const shapeMap = context.shapes;
|
|
70
70
|
const implementingShapes = [];
|
|
71
71
|
for (const shape of Object.values(shapeMap)) {
|
|
72
|
-
|
|
73
|
-
if ((_shape$interfaces = shape.interfaces) !== null && _shape$interfaces !== void 0 && _shape$interfaces.find(interfaceRefExpression => compareRefItems((0, _refs.refExpressionToRefItem)(context, interfaceRefExpression), interfaceRef))) {
|
|
72
|
+
if (shape.interfaces?.find(interfaceRefExpression => compareRefItems((0, _refs.refExpressionToRefItem)(context, interfaceRefExpression), interfaceRef))) {
|
|
74
73
|
implementingShapes.push(shape);
|
|
75
74
|
}
|
|
76
75
|
}
|
package/dist/layers/layers.js
CHANGED
|
@@ -183,9 +183,8 @@ function collectServiceRefs(flattenedSchema, getLayer) {
|
|
|
183
183
|
for (const ref of refs) {
|
|
184
184
|
const [layerId, shapeName] = (0, _refs.splitAtRef)(ref);
|
|
185
185
|
if (layerId !== 'local') {
|
|
186
|
-
var _layer$shapes;
|
|
187
186
|
const layer = getLayer(layerId);
|
|
188
|
-
const shape = layer
|
|
187
|
+
const shape = layer?.shapes?.[shapeName];
|
|
189
188
|
if (shape) {
|
|
190
189
|
(0, _visitor.visitSchemaProperties)(shape.schema, ['schema'], collectReferencedShapeNames(layerId, refs));
|
|
191
190
|
}
|
|
@@ -268,7 +267,6 @@ function flattenSchema(projectSchema, getLayer) {
|
|
|
268
267
|
forms: {}
|
|
269
268
|
};
|
|
270
269
|
const filteredLayers = layers.reverse().map(layer => {
|
|
271
|
-
var _config$visibility;
|
|
272
270
|
const config = typeof layer === 'string' ? {
|
|
273
271
|
...layerDefaults,
|
|
274
272
|
id: layer
|
|
@@ -277,15 +275,14 @@ function flattenSchema(projectSchema, getLayer) {
|
|
|
277
275
|
if (!layerSchema) {
|
|
278
276
|
throw new Error(`Unable to flatten schema for project ${projectSchema.projectId}. Cannot get layer ${config.id}`);
|
|
279
277
|
}
|
|
280
|
-
return
|
|
278
|
+
return config.visibility?.length ? filterLayer(layerSchema, config.visibility) : undefined;
|
|
281
279
|
}).filter(_util.isDefined);
|
|
282
280
|
for (const filteredLayer of filteredLayers) {
|
|
283
|
-
var _projectSchema$servic;
|
|
284
281
|
const {
|
|
285
282
|
layerId
|
|
286
283
|
} = filteredLayer;
|
|
287
284
|
// Preserve original queries
|
|
288
|
-
if (
|
|
285
|
+
if (projectSchema.services?.[layerId]) {
|
|
289
286
|
const serviceLayer = ensureServiceLayer(flattenedSchema, layerId);
|
|
290
287
|
if (serviceLayer.queries && filteredLayer.queries) {
|
|
291
288
|
Object.assign(serviceLayer.queries, filteredLayer.queries);
|
|
@@ -317,8 +314,7 @@ function flattenSchema(projectSchema, getLayer) {
|
|
|
317
314
|
for (const refStr of collectServiceRefs(flattenedSchema, getLayer)) {
|
|
318
315
|
const [layerId, shapeName] = (0, _refs.splitAtRef)(refStr);
|
|
319
316
|
if (layerId !== 'local') {
|
|
320
|
-
|
|
321
|
-
const shape = (_getLayer = getLayer(layerId)) === null || _getLayer === void 0 ? void 0 : (_getLayer$shapes = _getLayer.shapes) === null || _getLayer$shapes === void 0 ? void 0 : _getLayer$shapes[shapeName];
|
|
317
|
+
const shape = getLayer(layerId)?.shapes?.[shapeName];
|
|
322
318
|
if (shape) {
|
|
323
319
|
const serviceLayer = ensureServiceLayer(flattenedSchema, layerId);
|
|
324
320
|
if (!serviceLayer.shapes) {
|
package/dist/layers/refs.js
CHANGED
|
@@ -167,8 +167,7 @@ exports.omitRefAndExtend = omitRefAndExtend;
|
|
|
167
167
|
function followRef(shapes, contentSchema) {
|
|
168
168
|
const refItem = getRef(contentSchema);
|
|
169
169
|
if (refItem) {
|
|
170
|
-
|
|
171
|
-
const referencedSchema = (_refItemToShape = refItemToShape(shapes, refItem)) === null || _refItemToShape === void 0 ? void 0 : _refItemToShape.schema;
|
|
170
|
+
const referencedSchema = refItemToShape(shapes, refItem)?.schema;
|
|
172
171
|
if (referencedSchema) {
|
|
173
172
|
return omitRefAndExtend(contentSchema, referencedSchema);
|
|
174
173
|
}
|
|
@@ -37,10 +37,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
37
37
|
* Only tests that the shape is right, not that the name is correct. That's a job for the validator.
|
|
38
38
|
*/
|
|
39
39
|
function isBasicResolver(resolver) {
|
|
40
|
-
return (0, _isString.default)(resolver
|
|
40
|
+
return (0, _isString.default)(resolver?.name) && (0, _isString.default)(resolver.service);
|
|
41
41
|
}
|
|
42
42
|
function isComposeResolver(resolver) {
|
|
43
|
-
return Boolean((0, _isArray.default)(resolver
|
|
43
|
+
return Boolean((0, _isArray.default)(resolver?.compose) && resolver.compose.length && resolver.compose.every(isBasicResolver));
|
|
44
44
|
}
|
|
45
45
|
const {
|
|
46
46
|
definitions: {
|
|
@@ -189,7 +189,7 @@ const migrate = async (context, projectSchema) => {
|
|
|
189
189
|
...serviceConfig,
|
|
190
190
|
auth
|
|
191
191
|
}, serviceKey);
|
|
192
|
-
const authentication = updatedServiceConfig
|
|
192
|
+
const authentication = updatedServiceConfig?.authentication;
|
|
193
193
|
serviceMap[serviceKey] = {
|
|
194
194
|
...updatedServiceConfig,
|
|
195
195
|
authentication: authentication && (0, _isObject.default)(authentication) ? encryptFn(authentication) : authentication
|
|
@@ -7,13 +7,12 @@ exports.default = void 0;
|
|
|
7
7
|
var _omit = _interopRequireDefault(require("lodash/omit"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
9
|
function hasWebhook(projectSchema, config) {
|
|
10
|
-
|
|
11
|
-
const queryName = (_config$queries = config.queries) === null || _config$queries === void 0 ? void 0 : (_config$queries$singl = _config$queries.single) === null || _config$queries$singl === void 0 ? void 0 : _config$queries$singl.name;
|
|
10
|
+
const queryName = config.queries?.single?.name;
|
|
12
11
|
if (!queryName) {
|
|
13
12
|
return false;
|
|
14
13
|
}
|
|
15
|
-
const resolver = projectSchema
|
|
16
|
-
return resolver && 'service' in resolver &&
|
|
14
|
+
const resolver = projectSchema?.queries[queryName]?.resolver;
|
|
15
|
+
return resolver && 'service' in resolver && projectSchema?.services?.[resolver.service].provider === 'shopify';
|
|
17
16
|
}
|
|
18
17
|
const migrate = async (_, {
|
|
19
18
|
indexedShapes: oldIndexedShapes,
|
|
@@ -26,7 +25,6 @@ const migrate = async (_, {
|
|
|
26
25
|
};
|
|
27
26
|
}
|
|
28
27
|
const indexedShapes = Object.fromEntries(Object.entries(oldIndexedShapes).map(([shapeName, config]) => {
|
|
29
|
-
var _config$queries$all;
|
|
30
28
|
const queries = {};
|
|
31
29
|
const triggers = [];
|
|
32
30
|
if (!config.queries) {
|
|
@@ -45,7 +43,7 @@ const migrate = async (_, {
|
|
|
45
43
|
events: ['products/create', 'products/update', 'products/delete']
|
|
46
44
|
});
|
|
47
45
|
}
|
|
48
|
-
const oldPagination =
|
|
46
|
+
const oldPagination = config.queries.all?.pagination;
|
|
49
47
|
const pagination = oldPagination === undefined ? undefined : oldPagination.type === 'cursor' ? {
|
|
50
48
|
...oldPagination,
|
|
51
49
|
itemsToIndexPath: oldPagination.itemsPath,
|
|
@@ -26,39 +26,34 @@ const migrate = async (_, projectSchema) => {
|
|
|
26
26
|
const ensureResolverOptions = resolver => {
|
|
27
27
|
if (resolver.name.startsWith('takeshape')) {
|
|
28
28
|
if (!resolver.shapeName) {
|
|
29
|
-
|
|
30
|
-
resolver.shapeName = ((_resolver$options = resolver.options) === null || _resolver$options === void 0 ? void 0 : _resolver$options.model) ?? ((_resolver$options2 = resolver.options) === null || _resolver$options2 === void 0 ? void 0 : _resolver$options2.indexedShape) ?? '';
|
|
29
|
+
resolver.shapeName = resolver.options?.model ?? resolver.options?.indexedShape ?? '';
|
|
31
30
|
omitOptions(resolver, ['model', 'indexedShape']);
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
33
|
if (resolver.name.startsWith('graphql')) {
|
|
35
34
|
if (!resolver.fieldName) {
|
|
36
|
-
|
|
37
|
-
resolver.fieldName = ((_resolver$options3 = resolver.options) === null || _resolver$options3 === void 0 ? void 0 : _resolver$options3.fieldName) ?? '';
|
|
35
|
+
resolver.fieldName = resolver.options?.fieldName ?? '';
|
|
38
36
|
omitOptions(resolver, ['fieldName']);
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
if (resolver.name.startsWith('awsLambda')) {
|
|
42
40
|
if (!resolver.functionName) {
|
|
43
|
-
|
|
44
|
-
resolver.functionName = ((_resolver$options4 = resolver.options) === null || _resolver$options4 === void 0 ? void 0 : _resolver$options4.functionName) ?? '';
|
|
41
|
+
resolver.functionName = resolver.options?.functionName ?? '';
|
|
45
42
|
omitOptions(resolver, ['functionName']);
|
|
46
43
|
}
|
|
47
44
|
}
|
|
48
45
|
if (resolver.name.startsWith('rest')) {
|
|
49
46
|
if (!resolver.path) {
|
|
50
47
|
if (resolver.pathParams) {
|
|
51
|
-
var _resolver$options5;
|
|
52
48
|
resolver.path = {
|
|
53
49
|
...resolver.pathParams,
|
|
54
50
|
serialize: {
|
|
55
51
|
...resolver.pathParams.serialize,
|
|
56
|
-
template:
|
|
52
|
+
template: resolver.options?.path
|
|
57
53
|
}
|
|
58
54
|
};
|
|
59
55
|
} else {
|
|
60
|
-
|
|
61
|
-
resolver.path = ((_resolver$options6 = resolver.options) === null || _resolver$options6 === void 0 ? void 0 : _resolver$options6.path) ?? '';
|
|
56
|
+
resolver.path = resolver.options?.path ?? '';
|
|
62
57
|
}
|
|
63
58
|
omitOptions(resolver, ['path']);
|
|
64
59
|
}
|
package/dist/models/service.js
CHANGED
|
@@ -9,9 +9,8 @@ exports.ServiceConfig = void 0;
|
|
|
9
9
|
*/
|
|
10
10
|
class ServiceConfig {
|
|
11
11
|
constructor(projectSchemaModel, _serviceId) {
|
|
12
|
-
var _projectSchemaModel$j;
|
|
13
12
|
this._serviceId = _serviceId;
|
|
14
|
-
if (!
|
|
13
|
+
if (!projectSchemaModel.json.services?.[_serviceId]) {
|
|
15
14
|
throw new Error(`Could not create service model for ${_serviceId}`);
|
|
16
15
|
}
|
|
17
16
|
this._storedServiceConfig = projectSchemaModel.json.services[_serviceId];
|
package/dist/models/shape.js
CHANGED
|
@@ -65,8 +65,7 @@ class ShapeModel {
|
|
|
65
65
|
return this._shapeRefItem.serviceKey;
|
|
66
66
|
}
|
|
67
67
|
get modelType() {
|
|
68
|
-
|
|
69
|
-
return (_this$_rawShape$model = this._rawShape.model) === null || _this$_rawShape$model === void 0 ? void 0 : _this$_rawShape$model.type;
|
|
68
|
+
return this._rawShape.model?.type;
|
|
70
69
|
}
|
|
71
70
|
get interfaces() {
|
|
72
71
|
return this._rawShape.interfaces;
|
package/dist/refs.js
CHANGED
|
@@ -246,12 +246,11 @@ function splitAtRef(atRef) {
|
|
|
246
246
|
* the type.
|
|
247
247
|
*/
|
|
248
248
|
function atRefToRefItem(context, atRef, template) {
|
|
249
|
-
var _context$services;
|
|
250
249
|
const [serviceKey, typeName] = splitAtRef(atRef);
|
|
251
250
|
// It's possible the service doesn't have a namespace, or is local and has
|
|
252
251
|
// no service config.
|
|
253
|
-
const serviceConfig =
|
|
254
|
-
const serviceNamespace = serviceConfig
|
|
252
|
+
const serviceConfig = context.services?.[serviceKey];
|
|
253
|
+
const serviceNamespace = serviceConfig?.namespace;
|
|
255
254
|
return {
|
|
256
255
|
typeName,
|
|
257
256
|
serviceKey,
|
|
@@ -546,10 +545,7 @@ function dereferenceObjectSchema(context, shapeOrFieldSchema, schemaPath = []) {
|
|
|
546
545
|
return schema;
|
|
547
546
|
}
|
|
548
547
|
function createGetNamespace(context) {
|
|
549
|
-
return serviceId =>
|
|
550
|
-
var _context$services2, _context$services2$se;
|
|
551
|
-
return (_context$services2 = context.services) === null || _context$services2 === void 0 ? void 0 : (_context$services2$se = _context$services2[serviceId]) === null || _context$services2$se === void 0 ? void 0 : _context$services2$se.namespace;
|
|
552
|
-
};
|
|
548
|
+
return serviceId => context.services?.[serviceId]?.namespace;
|
|
553
549
|
}
|
|
554
550
|
function parsePropertyRef(refStr) {
|
|
555
551
|
const index = refStr.lastIndexOf(':');
|
package/dist/relationships.js
CHANGED
|
@@ -128,14 +128,13 @@ function getLegacyRelationship(projectSchema, relationship) {
|
|
|
128
128
|
* Get relationship details from a PropertySchema.
|
|
129
129
|
*/
|
|
130
130
|
function getRelationship(propertySchema) {
|
|
131
|
-
var _propertySchema$Back, _propertySchema$Back2;
|
|
132
131
|
propertySchema = propertySchema['@output'] ?? propertySchema;
|
|
133
132
|
if (!(0, _types.isPropertySchemaWithRelationship)(propertySchema)) {
|
|
134
133
|
return;
|
|
135
134
|
}
|
|
136
135
|
const isMultiple = propertySchema.type === 'array';
|
|
137
|
-
const hasBackreference = Boolean(
|
|
138
|
-
const backreferenceName =
|
|
136
|
+
const hasBackreference = Boolean(propertySchema['@backreference']?.enabled);
|
|
137
|
+
const backreferenceName = propertySchema['@backreference']?.name;
|
|
139
138
|
const refs = getRelationshipShapeRefs(propertySchema);
|
|
140
139
|
return {
|
|
141
140
|
isMultiple,
|
|
@@ -158,17 +157,15 @@ function findExistingRelationships(projectSchema, shapes) {
|
|
|
158
157
|
const findRelationships = (schema, path, parentShapeName) => {
|
|
159
158
|
const relationship = getRelationship(schema);
|
|
160
159
|
if (relationship) {
|
|
161
|
-
var _schema$Backreferenc;
|
|
162
160
|
const relatedShapeIds = getRelationshipShapeIds(shapes, relationship.refs);
|
|
163
|
-
const relatedName =
|
|
161
|
+
const relatedName = schema['@backreference']?.name;
|
|
164
162
|
for (const shapeId of relatedShapeIds) {
|
|
165
163
|
if (shapeIds.has(shapeId)) {
|
|
166
|
-
var _schema$Backreferenc2;
|
|
167
164
|
addRelationship(relationships, shapeId, {
|
|
168
165
|
relatedName,
|
|
169
166
|
path: path.slice(1),
|
|
170
167
|
shapeId: path[0],
|
|
171
|
-
hasBackreference: Boolean(
|
|
168
|
+
hasBackreference: Boolean(schema['@backreference']?.enabled),
|
|
172
169
|
schema,
|
|
173
170
|
shapeName: parentShapeName
|
|
174
171
|
});
|
|
@@ -225,11 +222,11 @@ function isEqualRelationship(a, b) {
|
|
|
225
222
|
if (!relationshipA && !relationshipB) {
|
|
226
223
|
return true;
|
|
227
224
|
}
|
|
228
|
-
const refsA = relationshipA
|
|
225
|
+
const refsA = relationshipA?.refs;
|
|
229
226
|
if (!refsA) {
|
|
230
227
|
return false;
|
|
231
228
|
}
|
|
232
|
-
const refsB = relationshipB
|
|
229
|
+
const refsB = relationshipB?.refs;
|
|
233
230
|
if (!refsB || refsA.length !== refsB.length) {
|
|
234
231
|
return false;
|
|
235
232
|
}
|
package/dist/schema-transform.js
CHANGED
|
@@ -21,7 +21,7 @@ function createPropertiesPredicate(propertyNames) {
|
|
|
21
21
|
}
|
|
22
22
|
return (shapeName, name) => {
|
|
23
23
|
const blacklist = byShape.get(byShape.has(shapeName) ? shapeName : '*');
|
|
24
|
-
return Boolean(blacklist
|
|
24
|
+
return Boolean(blacklist?.has(name));
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
function removePropertiesTransform(propertyNames) {
|
package/dist/schema-util.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export declare enum BuiltInPropertiesProfile {
|
|
|
36
36
|
Cached = 1,
|
|
37
37
|
None = 2
|
|
38
38
|
}
|
|
39
|
+
export declare const isBuiltInPropertyName: (name: string, profile?: BuiltInPropertiesProfile) => boolean;
|
|
39
40
|
export declare function applyBuiltinPropertiesToShape(projectSchema: ProjectSchemaJSON, shape: ShapeJSON): ShapeJSON;
|
|
40
41
|
/**
|
|
41
42
|
* Get all built-in shapes that are depended on by the given project schema.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-util.d.ts","sourceRoot":"","sources":["../../src/schema-util.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EAEd,SAAS,EAET,SAAS,EACT,QAAQ,EACR,aAAa,EAGb,WAAW,EAEX,YAAY,EACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,+BAA+B,EAC/B,UAAU,EACV,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAElB,UAAU,EACV,aAAa,EACb,WAAW,EACZ,MAAM,eAAe,CAAC;AAQvB,OAAO,EAAC,KAAK,EAA4C,MAAM,iBAAiB,CAAC;AAiBjF,OAAO,EASL,OAAO,EAIP,eAAe,EACf,eAAe,EACf,qBAAqB,EAMtB,MAAM,QAAQ,CAAC;AAUhB,eAAO,MAAM,2BAA2B,2BAA2B,CAAC;AAEpE,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEzD;AAID,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,wBAAgB,aAAa,CAAC,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAE,aAAa,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,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAEvH;;GAEG;AACH,eAAO,MAAM,sBAAsB,cAAe,MAAM,YAAY,2BAA2B,KAAG,MAGjG,CAAC;AAEF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CAQnG;AAED,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,GAAG,cAAc,CAgBxG;AAED,wBAAgB,eAAe,CAAC,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAO5G;AAED,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAMxF;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,gBACpB,iBAAiB,iBACf,aAAa,aACjB,MAAM,YAMlB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,kBACpB,iBAAiB,SACzB,SAAS,aACL,MAAM,KAChB,OAiBF,CAAC"}
|
package/dist/schema-util.js
CHANGED
|
@@ -47,6 +47,7 @@ exports.getShapeDependencies = getShapeDependencies;
|
|
|
47
47
|
exports.getShapeQueriesAndMutations = getShapeQueriesAndMutations;
|
|
48
48
|
exports.getShapesById = getShapesById;
|
|
49
49
|
exports.getStorageKey = getStorageKey;
|
|
50
|
+
exports.isBuiltInPropertyName = void 0;
|
|
50
51
|
exports.isBuiltinMutation = isBuiltinMutation;
|
|
51
52
|
exports.isBuiltinQuery = isBuiltinQuery;
|
|
52
53
|
exports.isBuiltinShape = isBuiltinShape;
|
|
@@ -151,7 +152,7 @@ function getServiceInfo(projectSchema, shape) {
|
|
|
151
152
|
} = serviceConfig;
|
|
152
153
|
const generators = {};
|
|
153
154
|
const tag = value['@tag'];
|
|
154
|
-
if (tag
|
|
155
|
+
if (tag?.startsWith(SERVICE_OBJECT_PATTERN_NAME)) {
|
|
155
156
|
const idFieldName = getServiceIdFieldName(key);
|
|
156
157
|
const version = tag.substr(tag.lastIndexOf(':') + 1);
|
|
157
158
|
generators[SERVICE_OBJECT_PATTERN_NAME] = {
|
|
@@ -321,14 +322,13 @@ function getCommonBuiltInProperties(shape) {
|
|
|
321
322
|
const DEFAULT_ID_FIELD = 'id';
|
|
322
323
|
exports.DEFAULT_ID_FIELD = DEFAULT_ID_FIELD;
|
|
323
324
|
function getIdField(obj) {
|
|
324
|
-
return
|
|
325
|
+
return obj?.idField ?? DEFAULT_ID_FIELD;
|
|
325
326
|
}
|
|
326
327
|
|
|
327
328
|
/**
|
|
328
329
|
* Get properties necessary for cached / remote data to work with the TSSearchable interface.
|
|
329
330
|
*/
|
|
330
331
|
function getCachedBuiltInProperties(projectSchema, shape, properties) {
|
|
331
|
-
var _properties$idField;
|
|
332
332
|
const idField = getIdField(shape.cache);
|
|
333
333
|
|
|
334
334
|
// TODO Implement `searchSummary` and `_shapeId` here, and remove `getRemoteShapeTSSearchableFields`
|
|
@@ -337,7 +337,7 @@ function getCachedBuiltInProperties(projectSchema, shape, properties) {
|
|
|
337
337
|
title: 'Id',
|
|
338
338
|
type: 'string',
|
|
339
339
|
...properties._id,
|
|
340
|
-
...(
|
|
340
|
+
...(properties[idField]?.['@mapping'] ? {
|
|
341
341
|
'@mapping': properties[idField]['@mapping']
|
|
342
342
|
} : {})
|
|
343
343
|
}
|
|
@@ -437,10 +437,20 @@ let BuiltInPropertiesProfile = /*#__PURE__*/function (BuiltInPropertiesProfile)
|
|
|
437
437
|
BuiltInPropertiesProfile[BuiltInPropertiesProfile["None"] = 2] = "None";
|
|
438
438
|
return BuiltInPropertiesProfile;
|
|
439
439
|
}({});
|
|
440
|
+
exports.BuiltInPropertiesProfile = BuiltInPropertiesProfile;
|
|
441
|
+
const BUILT_IN_PROPERTY_NAMES = {
|
|
442
|
+
[BuiltInPropertiesProfile.Model]: getBuiltInPropertyNames(BuiltInPropertiesProfile.Model),
|
|
443
|
+
[BuiltInPropertiesProfile.Cached]: getBuiltInPropertyNames(BuiltInPropertiesProfile.Cached),
|
|
444
|
+
[BuiltInPropertiesProfile.None]: getBuiltInPropertyNames(BuiltInPropertiesProfile.None)
|
|
445
|
+
};
|
|
446
|
+
const isBuiltInPropertyName = (name, profile = BuiltInPropertiesProfile.Model) => {
|
|
447
|
+
return BUILT_IN_PROPERTY_NAMES[profile].has(name);
|
|
448
|
+
};
|
|
449
|
+
|
|
440
450
|
/**
|
|
441
451
|
* Get the profile to use for loading built-in properties
|
|
442
452
|
*/
|
|
443
|
-
exports.
|
|
453
|
+
exports.isBuiltInPropertyName = isBuiltInPropertyName;
|
|
444
454
|
function getBuiltInPropertiesProfile(shape) {
|
|
445
455
|
if (isModelShape(shape)) {
|
|
446
456
|
return BuiltInPropertiesProfile.Model;
|
|
@@ -563,8 +573,7 @@ function isModelShape(shape) {
|
|
|
563
573
|
return Boolean(shape.model);
|
|
564
574
|
}
|
|
565
575
|
function isCachedShape(shape) {
|
|
566
|
-
|
|
567
|
-
return ((_shape$cache = shape.cache) === null || _shape$cache === void 0 ? void 0 : _shape$cache.enabled) === true && shape.loaders !== undefined;
|
|
576
|
+
return shape.cache?.enabled === true && shape.loaders !== undefined;
|
|
568
577
|
}
|
|
569
578
|
function getArgsReference(projectSchema, argsSchema) {
|
|
570
579
|
const args = (0, _util2.getArgs)(argsSchema);
|
|
@@ -720,7 +729,7 @@ function getRelevantShapes(projectSchema, params) {
|
|
|
720
729
|
byId = false,
|
|
721
730
|
includeDependencies = true
|
|
722
731
|
} = params;
|
|
723
|
-
if (shapeNames
|
|
732
|
+
if (shapeNames?.length || shapeIds?.length) {
|
|
724
733
|
const ids = new Set(shapeIds);
|
|
725
734
|
const names = new Set(shapeNames);
|
|
726
735
|
const shapes = {};
|
|
@@ -910,7 +919,7 @@ function getStorageKey(schema) {
|
|
|
910
919
|
}
|
|
911
920
|
function getPropertyService(schema) {
|
|
912
921
|
const first = getFirstMapping(schema);
|
|
913
|
-
const split = first
|
|
922
|
+
const split = first?.split(':');
|
|
914
923
|
return split ? `${split[0]}:${split[1]}` : undefined;
|
|
915
924
|
}
|
|
916
925
|
function emptySchema(projectId) {
|
|
@@ -1097,12 +1106,10 @@ class SchemaPropertyAccessor {
|
|
|
1097
1106
|
return this.properties.get(propertyName);
|
|
1098
1107
|
}
|
|
1099
1108
|
findValue(predicate) {
|
|
1100
|
-
|
|
1101
|
-
return (_this$entries$find = this.entries.find(predicate)) === null || _this$entries$find === void 0 ? void 0 : _this$entries$find[1];
|
|
1109
|
+
return this.entries.find(predicate)?.[1];
|
|
1102
1110
|
}
|
|
1103
1111
|
findName(predicate) {
|
|
1104
|
-
|
|
1105
|
-
return (_this$entries$find2 = this.entries.find(predicate)) === null || _this$entries$find2 === void 0 ? void 0 : _this$entries$find2[0];
|
|
1112
|
+
return this.entries.find(predicate)?.[0];
|
|
1106
1113
|
}
|
|
1107
1114
|
getKey(propertyName) {
|
|
1108
1115
|
const value = this.properties.get(propertyName);
|
package/dist/services.js
CHANGED
|
@@ -82,11 +82,10 @@ const serviceConfigValidator = createServiceConfigValidator();
|
|
|
82
82
|
* Validates a `ServiceConfig` validator based on the JSON-schema.
|
|
83
83
|
*/
|
|
84
84
|
function validateServiceConfig(maybeServiceConfig) {
|
|
85
|
-
var _serviceConfigValidat;
|
|
86
85
|
if (serviceConfigValidator(maybeServiceConfig)) {
|
|
87
86
|
return maybeServiceConfig;
|
|
88
87
|
}
|
|
89
|
-
throw new _errors.SchemaValidationError('ServiceConfig was invalid',
|
|
88
|
+
throw new _errors.SchemaValidationError('ServiceConfig was invalid', serviceConfigValidator.errors?.map(_validate.formatError));
|
|
90
89
|
}
|
|
91
90
|
|
|
92
91
|
/**
|
|
@@ -132,8 +131,7 @@ function prepareServiceUpdate(encryptFn, decryptFn, projectSchema, serviceConfig
|
|
|
132
131
|
* Get a service config from a project schema.
|
|
133
132
|
*/
|
|
134
133
|
function getStoredServiceConfig(projectSchema, serviceKey) {
|
|
135
|
-
|
|
136
|
-
return (_projectSchema$servic = projectSchema.services) === null || _projectSchema$servic === void 0 ? void 0 : _projectSchema$servic[serviceKey];
|
|
134
|
+
return projectSchema.services?.[serviceKey];
|
|
137
135
|
}
|
|
138
136
|
|
|
139
137
|
/**
|
|
@@ -150,8 +148,7 @@ function getServiceNamespaces(context) {
|
|
|
150
148
|
} = context;
|
|
151
149
|
if (services) {
|
|
152
150
|
Object.keys(services).forEach(serviceKey => {
|
|
153
|
-
|
|
154
|
-
const namespace = (_services$serviceKey = services[serviceKey]) === null || _services$serviceKey === void 0 ? void 0 : _services$serviceKey.namespace;
|
|
151
|
+
const namespace = services[serviceKey]?.namespace;
|
|
155
152
|
if (namespace) {
|
|
156
153
|
namespaces.set(namespace, serviceKey);
|
|
157
154
|
}
|
package/dist/taxonomies.js
CHANGED
|
@@ -14,8 +14,7 @@ function weakMemoize(fn) {
|
|
|
14
14
|
return memoized;
|
|
15
15
|
}
|
|
16
16
|
function getFirstStringFieldV3(shape, projectSchema) {
|
|
17
|
-
|
|
18
|
-
const forms = (_projectSchema$forms = projectSchema.forms) === null || _projectSchema$forms === void 0 ? void 0 : _projectSchema$forms[shape.name];
|
|
17
|
+
const forms = projectSchema.forms?.[shape.name];
|
|
19
18
|
if (!forms || !forms.default) {
|
|
20
19
|
return null;
|
|
21
20
|
}
|
|
@@ -23,19 +22,13 @@ function getFirstStringFieldV3(shape, projectSchema) {
|
|
|
23
22
|
const {
|
|
24
23
|
order
|
|
25
24
|
} = forms.default;
|
|
26
|
-
const name = order.find(name =>
|
|
27
|
-
var _schemaProperties$get;
|
|
28
|
-
return ((_schemaProperties$get = schemaProperties.getValue(name)) === null || _schemaProperties$get === void 0 ? void 0 : _schemaProperties$get.type) === 'string';
|
|
29
|
-
});
|
|
25
|
+
const name = order.find(name => schemaProperties.getValue(name)?.type === 'string');
|
|
30
26
|
return name ? {
|
|
31
27
|
name,
|
|
32
28
|
key: schemaProperties.getKey(name)
|
|
33
29
|
} : null;
|
|
34
30
|
}
|
|
35
|
-
const getTaxonomyField = weakMemoize((shape, projectSchema) =>
|
|
36
|
-
var _shape$model;
|
|
37
|
-
return ((_shape$model = shape.model) === null || _shape$model === void 0 ? void 0 : _shape$model.type) === 'taxonomy' ? getFirstStringFieldV3(shape, projectSchema) : null;
|
|
38
|
-
});
|
|
31
|
+
const getTaxonomyField = weakMemoize((shape, projectSchema) => shape.model?.type === 'taxonomy' ? getFirstStringFieldV3(shape, projectSchema) : null);
|
|
39
32
|
exports.getTaxonomyField = getTaxonomyField;
|
|
40
33
|
const getTaxonomies = weakMemoize(projectSchema => {
|
|
41
34
|
const {
|
|
@@ -204,8 +204,7 @@ const idSchema = {
|
|
|
204
204
|
};
|
|
205
205
|
function getIDQueryArgs(templateName) {
|
|
206
206
|
return (context, shape) => {
|
|
207
|
-
|
|
208
|
-
const schema = ((_shape$model = shape.model) === null || _shape$model === void 0 ? void 0 : _shape$model.type) !== 'single' ? (0, _util2.mergeSchemaProperties)(idSchema, localeProps) : localeProps;
|
|
207
|
+
const schema = shape.model?.type !== 'single' ? (0, _util2.mergeSchemaProperties)(idSchema, localeProps) : localeProps;
|
|
209
208
|
const shapeName = (0, _refs.getFlattenedTemplateShapeName)(shape.name, templateName);
|
|
210
209
|
return {
|
|
211
210
|
shapeName,
|
|
@@ -229,7 +229,7 @@ function getTypeName(name, prop, shapeName, context) {
|
|
|
229
229
|
}
|
|
230
230
|
if (type === 'object' || type === 'array') {
|
|
231
231
|
const prefix = `TS${relationshipDepth >= MAX_RELATIONSHIP_DEPTH ? 'Shallow' : ''}Where`;
|
|
232
|
-
const fieldName = `${conflictingProperties
|
|
232
|
+
const fieldName = `${conflictingProperties?.has(name) ? '_' : ''}${(0, _util.formatShapeName)(name)}`;
|
|
233
233
|
const refItem = (0, _refs.getRefOrItemsRef)(projectSchema, prop);
|
|
234
234
|
const suffix = refItem ? (0, _refs.refItemToNamespacedShapeName)(refItem) : `${shapeName}${fieldName}`;
|
|
235
235
|
return `${prefix}${suffix}`;
|
|
@@ -320,7 +320,6 @@ function getPropertyComparisonType(name, prop, shapeName, context) {
|
|
|
320
320
|
}
|
|
321
321
|
if (!shapeCache.has(typeName) && !projectSchema.shapes[typeName]) {
|
|
322
322
|
shapeCache.set(typeName, () => {
|
|
323
|
-
var _prop$items;
|
|
324
323
|
let props;
|
|
325
324
|
const propOrItems = prop.items ?? prop;
|
|
326
325
|
if (isId(name)) {
|
|
@@ -337,9 +336,8 @@ function getPropertyComparisonType(name, prop, shapeName, context) {
|
|
|
337
336
|
...context,
|
|
338
337
|
booleanOperators: false
|
|
339
338
|
});
|
|
340
|
-
} else if (fieldType === 'object' || fieldType === 'array' &&
|
|
341
|
-
|
|
342
|
-
const properties = ((_prop$items2 = prop.items) === null || _prop$items2 === void 0 ? void 0 : _prop$items2.properties) ?? prop.properties;
|
|
339
|
+
} else if (fieldType === 'object' || fieldType === 'array' && prop.items?.type === 'object') {
|
|
340
|
+
const properties = prop.items?.properties ?? prop.properties;
|
|
343
341
|
if (properties) {
|
|
344
342
|
props = props ?? {};
|
|
345
343
|
const fieldContext = {
|
|
@@ -352,10 +350,9 @@ function getPropertyComparisonType(name, prop, shapeName, context) {
|
|
|
352
350
|
}
|
|
353
351
|
}
|
|
354
352
|
} else {
|
|
355
|
-
var _prop$items3;
|
|
356
353
|
// Treat non-object arrays as their base type
|
|
357
354
|
let type;
|
|
358
|
-
if (typeof
|
|
355
|
+
if (typeof prop.items?.type === 'string') {
|
|
359
356
|
type = prop.items.type;
|
|
360
357
|
} else {
|
|
361
358
|
type = fieldType;
|
|
@@ -369,7 +366,7 @@ function getPropertyComparisonType(name, prop, shapeName, context) {
|
|
|
369
366
|
});
|
|
370
367
|
}
|
|
371
368
|
if (shapeCache.has(typeName) || projectSchema.shapes[typeName]) {
|
|
372
|
-
const fieldName = `${conflictingProperties
|
|
369
|
+
const fieldName = `${conflictingProperties?.has(name) ? `${shapeName}_` : ''}${name}`;
|
|
373
370
|
return {
|
|
374
371
|
[fieldName]: {
|
|
375
372
|
'@ref': `local:${typeName}`
|