@takeshape/schema 8.130.2 → 8.132.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"where.d.ts","sourceRoot":"","sources":["../../../src/template-shapes/where.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,EAAY,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAC,cAAc,EAAE,aAAa,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAI5E,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAczD,OAAO,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAKzC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,yBAAyB,sBAAgB,OAA0C,CAAC;AAEjG,aAAK,qBAAqB,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE5F,aAAK,UAAU,GAAG,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC;AAExC,cAAM,UAAU;IACd,MAAM,0BAAiC;IACvC,UAAU,cAAqB;IAE/B,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAI/B,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI;IAO/C,UAAU,IAAI,QAAQ;CAiBvB;AAED,eAAO,MAAM,mBAAmB,EAAE,MAAM,CACtC,MAAM,EACN;IAAC,WAAW,EAAE,qBAAqB,EAAE,CAAC;IAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAA;CAAC,CAW1F,CAAC;AACF,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CASzD,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAAuB,CAA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B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAwBD,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CA2BrH;AAYD,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,cAAc,EACpB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,eAAe,GACvB,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAyFvC;AAkED,wBAAgB,aAAa,CAAC,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,KAAK,EAAE,GAAG,gBAAgB,CA4BrG;AAED,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,KAAK,EAAE,GACtB;IAAC,MAAM,EAAE,YAAY,CAAC;IAAC,YAAY,EAAE,QAAQ,CAAA;CAAC,CAchD"}
@@ -291,8 +291,14 @@ function getTypeName(name, prop, shapeName, context) {
291
291
  return `TSWhere${(0, _util.pascalCase)(type)}`;
292
292
  }
293
293
 
294
- function skipField(name, prop, projectSchema, exceededRelationshipDepth) {
295
- return Boolean(prop['@sensitive'] || prop['@resolver'] || prop['@relationship'] && exceededRelationshipDepth || (name === '_enabled' || name === '_enabledAt') && (0, _apiVersion.workflowsEnabled)(projectSchema.apiVersion));
294
+ function skipField({
295
+ name,
296
+ prop,
297
+ workflowsEnabled,
298
+ exceededRelationshipDepth,
299
+ isIndexedShape
300
+ }) {
301
+ return Boolean(prop['@sensitive'] || !isIndexedShape && prop['@resolver'] || prop['@relationship'] && exceededRelationshipDepth || (name === '_enabled' || name === '_enabledAt') && workflowsEnabled);
296
302
  }
297
303
 
298
304
  function getFields(typeName, shapes, context) {
@@ -309,7 +315,13 @@ function getFields(typeName, shapes, context) {
309
315
  };
310
316
 
311
317
  for (const shape of shapes) {
312
- const nodes = (0, _schemaUtil.createSchemaPropertyList)(projectSchema, shape).filterBy(([name, property]) => !skipField(name, property, projectSchema, tooDeep)).getNodes();
318
+ const nodes = (0, _schemaUtil.createSchemaPropertyList)(projectSchema, shape).filterBy(([name, prop]) => !skipField({
319
+ name,
320
+ prop,
321
+ workflowsEnabled: (0, _apiVersion.workflowsEnabled)(projectSchema.apiVersion),
322
+ isIndexedShape: (0, _schemaUtil.isIndexedRemoteShape)(projectSchema, shape),
323
+ exceededRelationshipDepth: exceededRelationshipDepth(relationshipDepth)
324
+ })).getNodes();
313
325
 
314
326
  for (const [name, property] of nodes) {
315
327
  Object.assign(result, getPropertyComparisonType(name, property, shape.name, fieldContext));
@@ -343,7 +355,13 @@ function getPropertyComparisonType(name, prop, shapeName, context) {
343
355
  conflictingProperties
344
356
  } = context;
345
357
 
346
- if (skipField(name, prop, projectSchema, exceededRelationshipDepth(relationshipDepth))) {
358
+ if (skipField({
359
+ name,
360
+ prop,
361
+ workflowsEnabled: (0, _apiVersion.workflowsEnabled)(projectSchema.apiVersion),
362
+ isIndexedShape: (0, _schemaUtil.isIndexedRemoteShape)(projectSchema, projectSchema.shapes[shapeName]),
363
+ exceededRelationshipDepth: exceededRelationshipDepth(relationshipDepth)
364
+ })) {
347
365
  return undefined;
348
366
  }
349
367
 
@@ -381,7 +399,6 @@ function getPropertyComparisonType(name, prop, shapeName, context) {
381
399
  } else if ((0, _unions.isUnionSchema)(propOrItems)) {
382
400
  const shapes = (0, _unions.enumerateOneOfKeys)(projectSchema, propOrItems.oneOf).map(option => projectSchema.shapes[option.shapeName]);
383
401
  props = getFields(typeName, shapes, { ...context,
384
- relationshipDepth,
385
402
  booleanOperators: false
386
403
  });
387
404
  } else if (fieldType === 'object' || fieldType === 'array' && ((_prop$items = prop.items) === null || _prop$items === void 0 ? void 0 : _prop$items.type) === 'object') {
@@ -1,7 +1,7 @@
1
1
  import { pascalCase, isDefined } from '@takeshape/util';
2
2
  import unset from 'lodash/unset';
3
3
  import isFunction from 'lodash/isFunction';
4
- import { createSchemaPropertyList, createShape, getAllRefsInShapes, getShapeById } from '../schema-util';
4
+ import { createSchemaPropertyList, createShape, getAllRefsInShapes, getShapeById, isIndexedRemoteShape } from '../schema-util';
5
5
  import { workflowsEnabled } from '../api-version';
6
6
  import { followRef, getRef, getRefOrItemsRef, hasRefProperty, hasResolvableRef, refItemToShape, refItemToShapeName } from '../refs';
7
7
  import { enumerateOneOfKeys, isUnionSchema } from '../unions';
@@ -258,8 +258,14 @@ function getTypeName(name, prop, shapeName, context) {
258
258
  return `TSWhere${pascalCase(type)}`;
259
259
  }
260
260
 
261
- function skipField(name, prop, projectSchema, exceededRelationshipDepth) {
262
- return Boolean(prop['@sensitive'] || prop['@resolver'] || prop['@relationship'] && exceededRelationshipDepth || (name === '_enabled' || name === '_enabledAt') && workflowsEnabled(projectSchema.apiVersion));
261
+ function skipField({
262
+ name,
263
+ prop,
264
+ workflowsEnabled,
265
+ exceededRelationshipDepth,
266
+ isIndexedShape
267
+ }) {
268
+ return Boolean(prop['@sensitive'] || !isIndexedShape && prop['@resolver'] || prop['@relationship'] && exceededRelationshipDepth || (name === '_enabled' || name === '_enabledAt') && workflowsEnabled);
263
269
  }
264
270
 
265
271
  export function getFields(typeName, shapes, context) {
@@ -276,7 +282,13 @@ export function getFields(typeName, shapes, context) {
276
282
  };
277
283
 
278
284
  for (const shape of shapes) {
279
- const nodes = createSchemaPropertyList(projectSchema, shape).filterBy(([name, property]) => !skipField(name, property, projectSchema, tooDeep)).getNodes();
285
+ const nodes = createSchemaPropertyList(projectSchema, shape).filterBy(([name, prop]) => !skipField({
286
+ name,
287
+ prop,
288
+ workflowsEnabled: workflowsEnabled(projectSchema.apiVersion),
289
+ isIndexedShape: isIndexedRemoteShape(projectSchema, shape),
290
+ exceededRelationshipDepth: exceededRelationshipDepth(relationshipDepth)
291
+ })).getNodes();
280
292
 
281
293
  for (const [name, property] of nodes) {
282
294
  Object.assign(result, getPropertyComparisonType(name, property, shape.name, fieldContext));
@@ -310,7 +322,13 @@ export function getPropertyComparisonType(name, prop, shapeName, context) {
310
322
  conflictingProperties
311
323
  } = context;
312
324
 
313
- if (skipField(name, prop, projectSchema, exceededRelationshipDepth(relationshipDepth))) {
325
+ if (skipField({
326
+ name,
327
+ prop,
328
+ workflowsEnabled: workflowsEnabled(projectSchema.apiVersion),
329
+ isIndexedShape: isIndexedRemoteShape(projectSchema, projectSchema.shapes[shapeName]),
330
+ exceededRelationshipDepth: exceededRelationshipDepth(relationshipDepth)
331
+ })) {
314
332
  return undefined;
315
333
  }
316
334
 
@@ -348,7 +366,6 @@ export function getPropertyComparisonType(name, prop, shapeName, context) {
348
366
  } else if (isUnionSchema(propOrItems)) {
349
367
  const shapes = enumerateOneOfKeys(projectSchema, propOrItems.oneOf).map(option => projectSchema.shapes[option.shapeName]);
350
368
  props = getFields(typeName, shapes, { ...context,
351
- relationshipDepth,
352
369
  booleanOperators: false
353
370
  });
354
371
  } else if (fieldType === 'object' || fieldType === 'array' && ((_prop$items = prop.items) === null || _prop$items === void 0 ? void 0 : _prop$items.type) === 'object') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeshape/schema",
3
- "version": "8.130.2",
3
+ "version": "8.132.0",
4
4
  "description": "TakeShape Schema",
5
5
  "homepage": "https://www.takeshape.io",
6
6
  "repository": {
@@ -21,9 +21,9 @@
21
21
  "examples"
22
22
  ],
23
23
  "dependencies": {
24
- "@takeshape/errors": "8.130.2",
25
- "@takeshape/json-schema": "8.130.2",
26
- "@takeshape/util": "8.130.2",
24
+ "@takeshape/errors": "8.132.0",
25
+ "@takeshape/json-schema": "8.132.0",
26
+ "@takeshape/util": "8.132.0",
27
27
  "ajv": "^8.10.0",
28
28
  "ajv-formats": "^2.1.1",
29
29
  "blueimp-md5": "^2.10.0",