@takeshape/schema 11.87.0 → 11.88.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.
Files changed (92) hide show
  1. package/dist/builtin-schema.js +29 -68
  2. package/dist/create-input-schema.js +13 -5
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +1 -0
  5. package/dist/migration/index.d.ts +1 -0
  6. package/dist/migration/index.js +3 -1
  7. package/dist/migration/to/v3.55.0.d.ts +4 -0
  8. package/dist/migration/to/v3.55.0.js +10 -0
  9. package/dist/models/query.d.ts +2 -2
  10. package/dist/models/query.js +3 -3
  11. package/dist/models/runtime-schema.d.ts +8 -8
  12. package/dist/models/runtime-schema.js +36 -17
  13. package/dist/models/shape.d.ts +2 -2
  14. package/dist/models/shape.js +3 -3
  15. package/dist/models/types.d.ts +1 -1
  16. package/dist/project-schema/index.d.ts +4 -1
  17. package/dist/project-schema/index.js +2 -1
  18. package/dist/project-schema/latest.d.ts +2 -2
  19. package/dist/project-schema/migrate.js +4 -1
  20. package/dist/project-schema/v3.55.0.d.ts +2344 -0
  21. package/dist/project-schema/v3.55.0.js +7 -0
  22. package/dist/refs.d.ts +2 -1
  23. package/dist/refs.js +12 -6
  24. package/dist/resolvers/takeshape/assets/asset-image-meta.d.ts +77 -0
  25. package/dist/resolvers/takeshape/assets/asset-image-meta.js +95 -0
  26. package/dist/resolvers/takeshape/assets/asset-image-params.d.ts +899 -0
  27. package/dist/resolvers/takeshape/assets/asset-image-params.js +723 -0
  28. package/dist/resolvers/takeshape/assets/asset-image.d.ts +15 -0
  29. package/dist/resolvers/takeshape/assets/asset-image.js +12 -0
  30. package/dist/resolvers/takeshape/assets/asset.d.ts +123 -0
  31. package/dist/resolvers/takeshape/assets/asset.js +105 -0
  32. package/dist/resolvers/takeshape/assets/constants.d.ts +11 -0
  33. package/dist/resolvers/takeshape/assets/constants.js +11 -0
  34. package/dist/runtime-schema.js +2 -1
  35. package/dist/schema-util.js +9 -2
  36. package/dist/schemas/index.d.ts +2 -2
  37. package/dist/schemas/index.js +4 -2
  38. package/dist/schemas/project-schema/latest.json +6 -3
  39. package/dist/schemas/project-schema/v3.55.0.json +3515 -0
  40. package/dist/schemas/project-schema.json +3 -0
  41. package/examples/latest/agent-schema.json +1 -1
  42. package/examples/latest/all-fields-shapes-inline.json +1 -1
  43. package/examples/latest/all-fields-shapes.json +1 -1
  44. package/examples/latest/betzino.json +1 -1
  45. package/examples/latest/blog-schema.json +1 -1
  46. package/examples/latest/brewery-schema.json +1 -1
  47. package/examples/latest/clear-cache-schema.json +1 -1
  48. package/examples/latest/complex-project-schema.json +1 -1
  49. package/examples/latest/complex-schema.json +1 -1
  50. package/examples/latest/edit-schema.json +1 -1
  51. package/examples/latest/fabric-ecommerce.json +1 -1
  52. package/examples/latest/frank-and-fred-schema.json +1 -1
  53. package/examples/latest/klirr-schema.json +1 -1
  54. package/examples/latest/layers/rick-and-morty-layer.json +1 -1
  55. package/examples/latest/layers/shopify-layer-2023-01.json +1 -1
  56. package/examples/latest/layers/shopify-storefront-2023-04.json +1 -1
  57. package/examples/latest/layers/wordpress-2024-01.json +1 -1
  58. package/examples/latest/massive-schema.json +1 -1
  59. package/examples/latest/mill-components-schema.json +1 -1
  60. package/examples/latest/nested-shape-arrays.json +1 -1
  61. package/examples/latest/one-earth.json +1 -1
  62. package/examples/latest/pet-oneof-array.json +1 -1
  63. package/examples/latest/post-schema.json +1 -1
  64. package/examples/latest/pruned-shopify-product-schema.json +1 -1
  65. package/examples/latest/rag-example.json +1 -1
  66. package/examples/latest/real-world-schema.json +1 -1
  67. package/examples/latest/recursive-repeater-schema.json +1 -1
  68. package/examples/latest/recursive-schema.json +1 -1
  69. package/examples/latest/rick-and-morty-ast.json +1 -1
  70. package/examples/latest/rick-and-morty-graphql.json +1 -1
  71. package/examples/latest/rick-and-morty-rest.json +1 -1
  72. package/examples/latest/rick-and-morty-user-schema.json +1 -1
  73. package/examples/latest/rick-and-morty-with-indexing.json +1 -1
  74. package/examples/latest/schema-where-filter.json +1 -1
  75. package/examples/latest/schema-with-repeater-draftjs.json +1 -1
  76. package/examples/latest/schema-with-rick-and-morty.json +1 -1
  77. package/examples/latest/shape-books-v3_2_0.json +1 -1
  78. package/examples/latest/shape-books.json +1 -1
  79. package/examples/latest/shape-editor-schema-edited.json +1 -1
  80. package/examples/latest/shape-editor-schema-initial.json +1 -1
  81. package/examples/latest/shapedb-crud-every-prop-type.json +1 -1
  82. package/examples/latest/shopify-lookbook.json +1 -1
  83. package/examples/latest/shopify-product-2022-07.json +1 -1
  84. package/examples/latest/shopify-product-2023-04.json +1 -1
  85. package/examples/latest/shopify-store-with-widget.json +1 -1
  86. package/examples/latest/stripe-product-runtime-schema.json +1 -1
  87. package/examples/latest/stripe-starter-resolved.json +1 -1
  88. package/examples/latest/user-schema-no-required.json +1 -1
  89. package/examples/latest/user-schema-with-defaults.json +1 -1
  90. package/examples/latest/valvoline-ai-demo.json +1 -1
  91. package/examples/latest/vector-search-schema.json +1 -1
  92. package/package.json +5 -5
@@ -0,0 +1,15 @@
1
+ import type { FromSchema } from 'json-schema-to-ts';
2
+ export declare const schema: {
3
+ readonly type: "object";
4
+ readonly properties: {
5
+ readonly url: {
6
+ readonly type: "string";
7
+ };
8
+ };
9
+ readonly required: ["url"];
10
+ readonly additionalProperties: false;
11
+ };
12
+ export type AssetImage = FromSchema<typeof schema>;
13
+ export declare const validate: import("ajv").ValidateFunction<{
14
+ url: string;
15
+ }>;
@@ -0,0 +1,12 @@
1
+ import { createTypedValidator } from '@takeshape/json-schema';
2
+ export const schema = {
3
+ type: 'object',
4
+ properties: {
5
+ url: {
6
+ type: 'string'
7
+ }
8
+ },
9
+ required: ['url'],
10
+ additionalProperties: false
11
+ };
12
+ export const validate = createTypedValidator(schema);
@@ -0,0 +1,123 @@
1
+ import type { FromSchema } from 'json-schema-to-ts';
2
+ export declare const schema: {
3
+ readonly type: "object";
4
+ readonly properties: {
5
+ readonly title: {
6
+ readonly type: "string";
7
+ readonly title: "Title";
8
+ readonly '@mapping': "shapedb:Asset.By5tQOMc";
9
+ readonly '@l10n': true;
10
+ };
11
+ readonly description: {
12
+ readonly type: "string";
13
+ readonly title: "Description";
14
+ readonly '@mapping': "shapedb:Asset.B1Zsra3fx";
15
+ readonly '@l10n': true;
16
+ };
17
+ readonly filename: {
18
+ readonly type: "string";
19
+ readonly title: "Filename";
20
+ readonly '@l10n': false;
21
+ readonly minLength: 1;
22
+ readonly '@mapping': "shapedb:Asset.H1oYQOM9";
23
+ };
24
+ readonly caption: {
25
+ readonly type: "object";
26
+ readonly title: "Caption";
27
+ readonly '@mapping': "shapedb:Asset.SyWVsd98x";
28
+ readonly '@tag': "draftjs";
29
+ readonly '@l10n': true;
30
+ };
31
+ readonly credit: {
32
+ readonly type: "object";
33
+ readonly title: "Credit";
34
+ readonly '@mapping': "shapedb:Asset.Skn_i_5Ll";
35
+ readonly '@tag': "draftjs";
36
+ readonly '@l10n': true;
37
+ };
38
+ readonly path: {
39
+ readonly type: "string";
40
+ readonly title: "Path";
41
+ readonly '@l10n': false;
42
+ readonly minLength: 1;
43
+ readonly '@mapping': "shapedb:Asset.Hk6FQuz5";
44
+ };
45
+ readonly mimeType: {
46
+ readonly type: "string";
47
+ readonly title: "MIME type";
48
+ readonly '@l10n': false;
49
+ readonly '@mapping': "shapedb:Asset.SyCYX_Gq";
50
+ };
51
+ readonly sourceUrl: {
52
+ readonly type: "string";
53
+ readonly title: "Source URL";
54
+ readonly '@l10n': false;
55
+ readonly '@mapping': "shapedb:Asset.SJXSidnXE";
56
+ };
57
+ readonly uploadStatus: {
58
+ readonly type: "string";
59
+ readonly title: "Upload status";
60
+ readonly '@l10n': false;
61
+ readonly '@mapping': "shapedb:Asset.ByeAYXdG9";
62
+ };
63
+ readonly url: {
64
+ readonly type: "string";
65
+ readonly title: "URL";
66
+ readonly '@l10n': false;
67
+ readonly '@dependencies': "{path mimeType uploadStatus filename _id}";
68
+ readonly '@resolver': {
69
+ readonly name: "takeshape:assetUrl";
70
+ readonly service: "takeshape";
71
+ };
72
+ };
73
+ readonly image: {
74
+ readonly title: "Image";
75
+ readonly '@l10n': false;
76
+ readonly '@dependencies': "{path mimeType uploadStatus filename _id}";
77
+ readonly '@resolver': {
78
+ readonly name: "takeshape:assetImage";
79
+ readonly service: "takeshape";
80
+ };
81
+ readonly '@args': {
82
+ readonly type: "object";
83
+ readonly properties: {
84
+ readonly params: {
85
+ readonly '@ref': "TSAssetImageParams";
86
+ };
87
+ };
88
+ };
89
+ readonly '@ref': "TSAssetImage";
90
+ };
91
+ readonly imageMeta: {
92
+ readonly title: "Image metadata";
93
+ readonly '@l10n': false;
94
+ readonly '@dependencies': "{path mimeType uploadStatus filename _id}";
95
+ readonly '@resolver': {
96
+ readonly name: "takeshape:assetImageMeta";
97
+ readonly service: "takeshape";
98
+ };
99
+ readonly '@ref': "TSAssetImageMeta";
100
+ };
101
+ };
102
+ readonly required: ["filename", "path", "url"];
103
+ };
104
+ export type Asset = FromSchema<typeof schema>;
105
+ export declare const validate: import("ajv").ValidateFunction<{
106
+ [x: string]: unknown;
107
+ description?: string | undefined;
108
+ title?: string | undefined;
109
+ caption?: {
110
+ [x: string]: unknown;
111
+ } | undefined;
112
+ credit?: {
113
+ [x: string]: unknown;
114
+ } | undefined;
115
+ mimeType?: string | undefined;
116
+ sourceUrl?: string | undefined;
117
+ uploadStatus?: string | undefined;
118
+ image?: unknown;
119
+ imageMeta?: unknown;
120
+ filename: string;
121
+ path: string;
122
+ url: string;
123
+ }>;
@@ -0,0 +1,105 @@
1
+ import { createTypedValidator } from '@takeshape/json-schema';
2
+ import { ASSET_IMAGE_META_SHAPE_NAME, ASSET_IMAGE_PARAMS_SHAPE_NAME, ASSET_IMAGE_SHAPE_NAME } from "./constants.js";
3
+ export const schema = {
4
+ type: 'object',
5
+ properties: {
6
+ title: {
7
+ type: 'string',
8
+ title: 'Title',
9
+ '@mapping': 'shapedb:Asset.By5tQOMc',
10
+ '@l10n': true
11
+ },
12
+ description: {
13
+ type: 'string',
14
+ title: 'Description',
15
+ '@mapping': 'shapedb:Asset.B1Zsra3fx',
16
+ '@l10n': true
17
+ },
18
+ filename: {
19
+ type: 'string',
20
+ title: 'Filename',
21
+ '@l10n': false,
22
+ minLength: 1,
23
+ '@mapping': 'shapedb:Asset.H1oYQOM9'
24
+ },
25
+ caption: {
26
+ type: 'object',
27
+ title: 'Caption',
28
+ '@mapping': 'shapedb:Asset.SyWVsd98x',
29
+ '@tag': 'draftjs',
30
+ '@l10n': true
31
+ },
32
+ credit: {
33
+ type: 'object',
34
+ title: 'Credit',
35
+ '@mapping': 'shapedb:Asset.Skn_i_5Ll',
36
+ '@tag': 'draftjs',
37
+ '@l10n': true
38
+ },
39
+ path: {
40
+ type: 'string',
41
+ title: 'Path',
42
+ '@l10n': false,
43
+ minLength: 1,
44
+ '@mapping': 'shapedb:Asset.Hk6FQuz5'
45
+ },
46
+ mimeType: {
47
+ type: 'string',
48
+ title: 'MIME type',
49
+ '@l10n': false,
50
+ '@mapping': 'shapedb:Asset.SyCYX_Gq'
51
+ },
52
+ sourceUrl: {
53
+ type: 'string',
54
+ title: 'Source URL',
55
+ '@l10n': false,
56
+ '@mapping': 'shapedb:Asset.SJXSidnXE'
57
+ },
58
+ uploadStatus: {
59
+ type: 'string',
60
+ title: 'Upload status',
61
+ '@l10n': false,
62
+ '@mapping': 'shapedb:Asset.ByeAYXdG9'
63
+ },
64
+ url: {
65
+ type: 'string',
66
+ title: 'URL',
67
+ '@l10n': false,
68
+ '@dependencies': '{path mimeType uploadStatus filename _id}',
69
+ '@resolver': {
70
+ name: 'takeshape:assetUrl',
71
+ service: 'takeshape'
72
+ }
73
+ },
74
+ image: {
75
+ title: 'Image',
76
+ '@l10n': false,
77
+ '@dependencies': '{path mimeType uploadStatus filename _id}',
78
+ '@resolver': {
79
+ name: 'takeshape:assetImage',
80
+ service: 'takeshape'
81
+ },
82
+ '@args': {
83
+ type: 'object',
84
+ properties: {
85
+ params: {
86
+ '@ref': ASSET_IMAGE_PARAMS_SHAPE_NAME
87
+ }
88
+ }
89
+ },
90
+ '@ref': ASSET_IMAGE_SHAPE_NAME
91
+ },
92
+ imageMeta: {
93
+ title: 'Image metadata',
94
+ '@l10n': false,
95
+ '@dependencies': '{path mimeType uploadStatus filename _id}',
96
+ '@resolver': {
97
+ name: 'takeshape:assetImageMeta',
98
+ service: 'takeshape'
99
+ },
100
+ '@ref': ASSET_IMAGE_META_SHAPE_NAME
101
+ }
102
+ },
103
+ required: ['filename', 'path', 'url']
104
+ };
105
+ export const validate = createTypedValidator(schema);
@@ -0,0 +1,11 @@
1
+ export declare const ASSET_SHAPE_NAME = "Asset";
2
+ export declare const ASSET_SHAPE_ID = "ASSET";
3
+ export declare const ASSET_IMAGE_PARAMS_SHAPE_NAME = "TSAssetImageParams";
4
+ export declare const ASSET_IMAGE_PARAMS_SHAPE_ID = "TSAssetImageParams";
5
+ export declare const ASSET_IMAGE_SHAPE_NAME = "TSAssetImage";
6
+ export declare const ASSET_IMAGE_SHAPE_ID = "TSAssetImage";
7
+ export declare const ASSET_IMAGE_META_SHAPE_NAME = "TSAssetImageMeta";
8
+ export declare const ASSET_IMAGE_META_SHAPE_ID = "TSAssetImageMeta";
9
+ export declare const ASSET_UPLOAD_STATUS_PENDING = "PENDING";
10
+ export declare const ASSET_UPLOAD_STATUS_COMPLETE = "COMPLETE";
11
+ export declare const ASSET_UPLOAD_STATUS_FAILED = "FAILED";
@@ -0,0 +1,11 @@
1
+ export const ASSET_SHAPE_NAME = 'Asset';
2
+ export const ASSET_SHAPE_ID = 'ASSET';
3
+ export const ASSET_IMAGE_PARAMS_SHAPE_NAME = 'TSAssetImageParams';
4
+ export const ASSET_IMAGE_PARAMS_SHAPE_ID = 'TSAssetImageParams';
5
+ export const ASSET_IMAGE_SHAPE_NAME = 'TSAssetImage';
6
+ export const ASSET_IMAGE_SHAPE_ID = 'TSAssetImage';
7
+ export const ASSET_IMAGE_META_SHAPE_NAME = 'TSAssetImageMeta';
8
+ export const ASSET_IMAGE_META_SHAPE_ID = 'TSAssetImageMeta';
9
+ export const ASSET_UPLOAD_STATUS_PENDING = 'PENDING';
10
+ export const ASSET_UPLOAD_STATUS_COMPLETE = 'COMPLETE';
11
+ export const ASSET_UPLOAD_STATUS_FAILED = 'FAILED';
@@ -6,6 +6,7 @@ import set from 'lodash/set.js';
6
6
  import { addAiQueries } from "./agents.js";
7
7
  import { flattenTemplates } from "./flatten-templates.js";
8
8
  import { addRelatedFields, findExistingRelationships } from "./relationships.js";
9
+ import { ASSET_SHAPE_NAME } from "./resolvers/takeshape/assets/constants.js";
9
10
  import { applyDefaultsToSchema, createShape } from "./schema-util.js";
10
11
  import { resolveSchemaShapeDependencies } from "./service-dependencies.js";
11
12
  import { isModelShape } from "./types/index.js";
@@ -34,7 +35,7 @@ export function applyLegacyCompatibilityTweaks(projectSchema) {
34
35
  };
35
36
  }
36
37
  }
37
- if (shapeName === 'Asset') {
38
+ if (shapeName === ASSET_SHAPE_NAME) {
38
39
  // Magic s3Key field to provide V1 compatibility with old projects until the field is
39
40
  // formally removed and users are notified
40
41
  set(shape, ['schema', 'properties', 's3Key'], {
@@ -592,7 +592,6 @@ export function getShapeDependencies(projectSchema, shape, predicate) {
592
592
  const findDependencies = (schema) => {
593
593
  const shouldFollow = Boolean(!predicate || predicate(schema));
594
594
  if (shouldFollow) {
595
- schema = schema.items ?? schema;
596
595
  const refItem = getRef(projectSchema, schema);
597
596
  if (refItem) {
598
597
  const refShape = refItemToShape(projectSchema, refItem);
@@ -601,9 +600,17 @@ export function getShapeDependencies(projectSchema, shape, predicate) {
601
600
  findDependencies(dereferenceSchema(projectSchema, refShape.schema, ['shapes', refShape.name]));
602
601
  }
603
602
  }
604
- else if (isObjectSchema(schema) || isAllOfSchema(schema) || isOneOfSchema(schema)) {
603
+ else if (isObjectSchema(schema) ||
604
+ isAllOfSchema(schema) ||
605
+ isOneOfSchema(schema) ||
606
+ isExtendsSchema(schema) ||
607
+ isArraySchema(schema)) {
605
608
  visitSchemaProperties(schema, [], findDependencies);
606
609
  }
610
+ const args = schema['@args'];
611
+ if (args) {
612
+ findDependencies(typeof args === 'string' ? { '@ref': args } : args);
613
+ }
607
614
  }
608
615
  return shouldFollow;
609
616
  };
@@ -1,4 +1,4 @@
1
- export declare const CURRENT_SCHEMA_VERSION = "3.54.0";
1
+ export declare const CURRENT_SCHEMA_VERSION = "3.55.0";
2
2
  export { default as anyProjectSchema } from './project-schema.json';
3
- export { default as latestSchemaJson } from './project-schema/v3.54.0.json';
3
+ export { default as latestSchemaJson } from './project-schema/v3.55.0.json';
4
4
  export declare const allProjectSchemas: any[];
@@ -1,7 +1,7 @@
1
1
  // This file is generated by "pnpm json2ts"
2
- export const CURRENT_SCHEMA_VERSION = '3.54.0';
2
+ export const CURRENT_SCHEMA_VERSION = '3.55.0';
3
3
  export { default as anyProjectSchema } from './project-schema.json' with { type: 'json' };
4
- export { default as latestSchemaJson } from './project-schema/v3.54.0.json' with { type: 'json' };
4
+ export { default as latestSchemaJson } from './project-schema/v3.55.0.json' with { type: 'json' };
5
5
  import experimentalSchemaJson from './project-schema/experimental.json' with { type: 'json' };
6
6
  import metaSchemaV1_0_0 from './project-schema/meta-schema-v1.0.0.json' with { type: 'json' };
7
7
  import projectSchemaV1_0_0 from './project-schema/v1.0.0.json' with { type: 'json' };
@@ -78,6 +78,7 @@ import projectSchemaV3_51_0 from './project-schema/v3.51.0.json' with { type: 'j
78
78
  import projectSchemaV3_52_0 from './project-schema/v3.52.0.json' with { type: 'json' };
79
79
  import projectSchemaV3_53_0 from './project-schema/v3.53.0.json' with { type: 'json' };
80
80
  import projectSchemaV3_54_0 from './project-schema/v3.54.0.json' with { type: 'json' };
81
+ import projectSchemaV3_55_0 from './project-schema/v3.55.0.json' with { type: 'json' };
81
82
  import projectSchemaV4_0_0 from './project-schema/v4.0.0.json' with { type: 'json' };
82
83
  export const allProjectSchemas = [
83
84
  experimentalSchemaJson,
@@ -156,5 +157,6 @@ export const allProjectSchemas = [
156
157
  projectSchemaV3_52_0,
157
158
  projectSchemaV3_53_0,
158
159
  projectSchemaV3_54_0,
160
+ projectSchemaV3_55_0,
159
161
  projectSchemaV4_0_0
160
162
  ];
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://schema.takeshape.io/project-schema/v3.54.0#",
3
+ "$id": "https://schema.takeshape.io/project-schema/v3.55.0#",
4
4
  "title": "Project Schema JSON",
5
5
  "definitions": {
6
6
  "schemaArray": {
@@ -1833,7 +1833,10 @@
1833
1833
  "takeshape:getUser",
1834
1834
  "takeshape:search",
1835
1835
  "takeshape:vectorSearch",
1836
- "takeshape:queryApiIndex"
1836
+ "takeshape:queryApiIndex",
1837
+ "takeshape:assetUrl",
1838
+ "takeshape:assetImage",
1839
+ "takeshape:assetImageMeta"
1837
1840
  ]
1838
1841
  },
1839
1842
  "service": {
@@ -3439,7 +3442,7 @@
3439
3442
  },
3440
3443
  "schemaVersion": {
3441
3444
  "type": "string",
3442
- "enum": ["3.54.0"],
3445
+ "enum": ["3.55.0"],
3443
3446
  "description": "The version of the schema format your project is using. We increase the version as we make breaking changes to the schema format."
3444
3447
  },
3445
3448
  "projectId": {