@takeshape/schema 11.72.0 → 11.74.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/models/runtime-schema.js +1 -0
  2. package/dist/project-schema/latest.d.ts +6 -1
  3. package/dist/project-schema/v3.48.0.d.ts +6 -1
  4. package/dist/project-schema/v3.49.0.d.ts +6 -1
  5. package/dist/project-schema/v3.50.0.d.ts +6 -1
  6. package/dist/project-schema/v3.51.0.d.ts +6 -1
  7. package/dist/project-schema/v3.52.0.d.ts +6 -1
  8. package/dist/project-schema/v3.53.0.d.ts +6 -1
  9. package/dist/project-schema/v3.54.0.d.ts +6 -1
  10. package/dist/schemas/project-schema/experimental.json +20 -0
  11. package/dist/util/expressions.js +2 -2
  12. package/package.json +6 -6
  13. package/dist/__tests__/_examples.test.d.ts +0 -1
  14. package/dist/__tests__/_examples.test.js +0 -77
  15. package/dist/__tests__/agents.test.d.ts +0 -1
  16. package/dist/__tests__/agents.test.js +0 -163
  17. package/dist/__tests__/api-version.test.d.ts +0 -1
  18. package/dist/__tests__/api-version.test.js +0 -24
  19. package/dist/__tests__/builtin-schema.test.d.ts +0 -1
  20. package/dist/__tests__/builtin-schema.test.js +0 -18
  21. package/dist/__tests__/content-schema-transform.test.d.ts +0 -1
  22. package/dist/__tests__/content-schema-transform.test.js +0 -522
  23. package/dist/__tests__/create-input-schema.test.d.ts +0 -1
  24. package/dist/__tests__/create-input-schema.test.js +0 -184
  25. package/dist/__tests__/enum.test.d.ts +0 -1
  26. package/dist/__tests__/enum.test.js +0 -36
  27. package/dist/__tests__/flatten-templates.test.d.ts +0 -1
  28. package/dist/__tests__/flatten-templates.test.js +0 -40
  29. package/dist/__tests__/get-is-leaf.test.d.ts +0 -1
  30. package/dist/__tests__/get-is-leaf.test.js +0 -50
  31. package/dist/__tests__/interfaces.test.d.ts +0 -1
  32. package/dist/__tests__/interfaces.test.js +0 -219
  33. package/dist/__tests__/migration.test.d.ts +0 -1
  34. package/dist/__tests__/migration.test.js +0 -34
  35. package/dist/__tests__/mocks.test.d.ts +0 -1
  36. package/dist/__tests__/mocks.test.js +0 -24
  37. package/dist/__tests__/refs.test.d.ts +0 -1
  38. package/dist/__tests__/refs.test.js +0 -813
  39. package/dist/__tests__/relationships.test.d.ts +0 -1
  40. package/dist/__tests__/relationships.test.js +0 -638
  41. package/dist/__tests__/schema-transform.test.d.ts +0 -1
  42. package/dist/__tests__/schema-transform.test.js +0 -205
  43. package/dist/__tests__/schema-util.test.d.ts +0 -1
  44. package/dist/__tests__/schema-util.test.js +0 -1731
  45. package/dist/__tests__/service-dependencies.test.d.ts +0 -1
  46. package/dist/__tests__/service-dependencies.test.js +0 -360
  47. package/dist/__tests__/unions.test.d.ts +0 -1
  48. package/dist/__tests__/unions.test.js +0 -44
  49. package/dist/__tests__/validate.test.d.ts +0 -1
  50. package/dist/__tests__/validate.test.js +0 -1980
  51. package/dist/__tests__/workflows.test.d.ts +0 -3
  52. package/dist/__tests__/workflows.test.js +0 -149
  53. package/dist/layers/__tests__/layers.test.d.ts +0 -1
  54. package/dist/layers/__tests__/layers.test.js +0 -38
  55. package/dist/migration/to/__tests__/v3.10.0.test.d.ts +0 -1
  56. package/dist/migration/to/__tests__/v3.10.0.test.js +0 -90
  57. package/dist/migration/to/__tests__/v3.12.3.test.d.ts +0 -1
  58. package/dist/migration/to/__tests__/v3.12.3.test.js +0 -103
  59. package/dist/migration/to/__tests__/v3.17.test.d.ts +0 -1
  60. package/dist/migration/to/__tests__/v3.17.test.js +0 -71
  61. package/dist/migration/to/__tests__/v3.34.0.test.d.ts +0 -1
  62. package/dist/migration/to/__tests__/v3.34.0.test.js +0 -240
  63. package/dist/migration/to/__tests__/v3.39.0.test.d.ts +0 -1
  64. package/dist/migration/to/__tests__/v3.39.0.test.js +0 -116
  65. package/dist/migration/to/__tests__/v3.46.0.test.d.ts +0 -1
  66. package/dist/migration/to/__tests__/v3.46.0.test.js +0 -59
  67. package/dist/models/__tests__/fixtures.d.ts +0 -15
  68. package/dist/models/__tests__/fixtures.js +0 -56
  69. package/dist/models/__tests__/query.test.d.ts +0 -1
  70. package/dist/models/__tests__/query.test.js +0 -19
  71. package/dist/models/__tests__/runtime-schema.test.d.ts +0 -1
  72. package/dist/models/__tests__/runtime-schema.test.js +0 -43
  73. package/dist/models/__tests__/shape.test.d.ts +0 -1
  74. package/dist/models/__tests__/shape.test.js +0 -24
  75. package/dist/resolvers/ai/__tests__/rag-query.test.d.ts +0 -1
  76. package/dist/resolvers/ai/__tests__/rag-query.test.js +0 -49
  77. package/dist/services/__tests__/services.test.d.ts +0 -1
  78. package/dist/services/__tests__/services.test.js +0 -113
  79. package/dist/template-shapes/__tests__/index.test.d.ts +0 -1
  80. package/dist/template-shapes/__tests__/index.test.js +0 -40
  81. package/dist/template-shapes/__tests__/names.test.d.ts +0 -1
  82. package/dist/template-shapes/__tests__/names.test.js +0 -19
  83. package/dist/template-shapes/__tests__/templates.test.d.ts +0 -1
  84. package/dist/template-shapes/__tests__/templates.test.js +0 -80
  85. package/dist/template-shapes/__tests__/where.test.d.ts +0 -1
  86. package/dist/template-shapes/__tests__/where.test.js +0 -218
  87. package/dist/types/__tests__/utils.test.d.ts +0 -1
  88. package/dist/types/__tests__/utils.test.js +0 -159
  89. package/dist/util/__tests__/api-indexing.test.d.ts +0 -1
  90. package/dist/util/__tests__/api-indexing.test.js +0 -129
  91. package/dist/util/__tests__/detect-cycles.test.d.ts +0 -1
  92. package/dist/util/__tests__/detect-cycles.test.js +0 -193
  93. package/dist/util/__tests__/expressions.test.d.ts +0 -1
  94. package/dist/util/__tests__/expressions.test.js +0 -172
  95. package/dist/util/__tests__/find-shape-at-path.test.d.ts +0 -1
  96. package/dist/util/__tests__/find-shape-at-path.test.js +0 -41
  97. package/dist/util/__tests__/form-config.test.d.ts +0 -1
  98. package/dist/util/__tests__/form-config.test.js +0 -196
  99. package/dist/util/__tests__/get-return-shape.test.d.ts +0 -1
  100. package/dist/util/__tests__/get-return-shape.test.js +0 -27
  101. package/dist/util/__tests__/has-args.test.d.ts +0 -1
  102. package/dist/util/__tests__/has-args.test.js +0 -46
  103. package/dist/util/__tests__/merge.test.d.ts +0 -1
  104. package/dist/util/__tests__/merge.test.js +0 -1074
  105. package/dist/util/__tests__/patch-schema.test.d.ts +0 -1
  106. package/dist/util/__tests__/patch-schema.test.js +0 -82
  107. package/dist/util/__tests__/shapes.test.d.ts +0 -1
  108. package/dist/util/__tests__/shapes.test.js +0 -30
@@ -1 +0,0 @@
1
- export {};
@@ -1,82 +0,0 @@
1
- import omit from 'lodash/omit.js';
2
- import set from 'lodash/set.js';
3
- import { describe, expect, test } from 'vitest';
4
- import shopifyStoreJson from '@/examples/latest/shopify-store-with-widget.json';
5
- import { applyDefaultsToSchema } from "../../schema-util.js";
6
- import { patchSchema } from "../patch-schema.js";
7
- const shopifyStoreSchema = applyDefaultsToSchema(shopifyStoreJson);
8
- describe('patchSchema', () => {
9
- test('delete shape', () => {
10
- expect(patchSchema(shopifyStoreSchema, {
11
- shapes: {
12
- Product: null
13
- }
14
- })).toEqual({
15
- ...shopifyStoreSchema,
16
- shapes: {
17
- ...omit(shopifyStoreSchema.shapes, ['Product'])
18
- }
19
- });
20
- });
21
- test('add shape', () => {
22
- const Dog = {
23
- name: 'Dog',
24
- id: 'Dog',
25
- title: 'Dog',
26
- schema: {
27
- type: 'object',
28
- properties: {}
29
- }
30
- };
31
- expect(patchSchema(shopifyStoreSchema, {
32
- shapes: {
33
- Dog
34
- }
35
- })).toEqual({
36
- ...shopifyStoreSchema,
37
- shapes: {
38
- ...shopifyStoreSchema.shapes,
39
- Dog
40
- }
41
- });
42
- });
43
- test('nested paths', () => {
44
- const agentJson = { api: { type: 'chat' } };
45
- const aiExperimentalSchema = set(shopifyStoreSchema, 'ai-experimental.agents', { foo: agentJson });
46
- expect(patchSchema(aiExperimentalSchema, {
47
- 'ai-experimental.agents': {
48
- foo: null,
49
- bar: agentJson
50
- }
51
- })).toEqual({
52
- ...aiExperimentalSchema,
53
- 'ai-experimental': {
54
- agents: {
55
- bar: agentJson
56
- }
57
- }
58
- });
59
- });
60
- test('preserving unpatched props', () => {
61
- const agentJson = { api: { type: 'chat' } };
62
- const aiExperimental = {
63
- agents: { foo: agentJson },
64
- someOtherPropertyThatIsNotTouched: 'foo'
65
- };
66
- const aiExperimentalSchema = set(shopifyStoreSchema, 'ai-experimental', aiExperimental);
67
- expect(patchSchema(aiExperimentalSchema, {
68
- 'ai-experimental.agents': {
69
- foo: null,
70
- bar: agentJson
71
- }
72
- })).toEqual({
73
- ...aiExperimentalSchema,
74
- 'ai-experimental': {
75
- ...aiExperimental,
76
- agents: {
77
- bar: agentJson
78
- }
79
- }
80
- });
81
- });
82
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,30 +0,0 @@
1
- import { deepClone } from '@takeshape/util';
2
- import { describe, expect, test } from 'vitest';
3
- import postSchemaJson from '@/examples/latest/post-schema.json';
4
- import { ensureShape, ensureShapeById } from "../shapes.js";
5
- function getPostSchema() {
6
- return deepClone(postSchemaJson);
7
- }
8
- describe('ensureShape', () => {
9
- test('success', () => {
10
- const postSchema = getPostSchema();
11
- const shape = postSchema.shapes.Post;
12
- expect(ensureShape(postSchema, shape.name)).toEqual(shape);
13
- });
14
- test('missing', () => {
15
- const postSchema = getPostSchema();
16
- expect(() => ensureShape(postSchema, 'Bogus')).toThrowErrorMatchingInlineSnapshot(`[NotFoundError: Shape "Bogus" Not found]`);
17
- });
18
- });
19
- describe('ensureShapeById', () => {
20
- test('success', () => {
21
- const postSchema = getPostSchema();
22
- const shape = postSchema.shapes.Post;
23
- const shapeId = shape.id;
24
- expect(ensureShapeById(postSchema, shapeId)).toEqual(shape);
25
- });
26
- test('missing', () => {
27
- const postSchema = getPostSchema();
28
- expect(() => ensureShapeById(postSchema, 'bogus')).toThrowErrorMatchingInlineSnapshot(`[NotFoundError: Shape with id "bogus" Not found]`);
29
- });
30
- });