@takeshape/schema 11.73.0 → 11.76.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.
Files changed (109) hide show
  1. package/dist/builtin-schema.js +1 -0
  2. package/dist/models/runtime-schema.js +1 -0
  3. package/dist/project-schema/latest.d.ts +6 -1
  4. package/dist/project-schema/v3.48.0.d.ts +6 -1
  5. package/dist/project-schema/v3.49.0.d.ts +6 -1
  6. package/dist/project-schema/v3.50.0.d.ts +6 -1
  7. package/dist/project-schema/v3.51.0.d.ts +6 -1
  8. package/dist/project-schema/v3.52.0.d.ts +6 -1
  9. package/dist/project-schema/v3.53.0.d.ts +6 -1
  10. package/dist/project-schema/v3.54.0.d.ts +6 -1
  11. package/dist/schemas/project-schema/experimental.json +20 -0
  12. package/dist/util/expressions.js +2 -2
  13. package/package.json +6 -6
  14. package/dist/__tests__/_examples.test.d.ts +0 -1
  15. package/dist/__tests__/_examples.test.js +0 -77
  16. package/dist/__tests__/agents.test.d.ts +0 -1
  17. package/dist/__tests__/agents.test.js +0 -163
  18. package/dist/__tests__/api-version.test.d.ts +0 -1
  19. package/dist/__tests__/api-version.test.js +0 -24
  20. package/dist/__tests__/builtin-schema.test.d.ts +0 -1
  21. package/dist/__tests__/builtin-schema.test.js +0 -18
  22. package/dist/__tests__/content-schema-transform.test.d.ts +0 -1
  23. package/dist/__tests__/content-schema-transform.test.js +0 -522
  24. package/dist/__tests__/create-input-schema.test.d.ts +0 -1
  25. package/dist/__tests__/create-input-schema.test.js +0 -184
  26. package/dist/__tests__/enum.test.d.ts +0 -1
  27. package/dist/__tests__/enum.test.js +0 -36
  28. package/dist/__tests__/flatten-templates.test.d.ts +0 -1
  29. package/dist/__tests__/flatten-templates.test.js +0 -40
  30. package/dist/__tests__/get-is-leaf.test.d.ts +0 -1
  31. package/dist/__tests__/get-is-leaf.test.js +0 -50
  32. package/dist/__tests__/interfaces.test.d.ts +0 -1
  33. package/dist/__tests__/interfaces.test.js +0 -219
  34. package/dist/__tests__/migration.test.d.ts +0 -1
  35. package/dist/__tests__/migration.test.js +0 -34
  36. package/dist/__tests__/mocks.test.d.ts +0 -1
  37. package/dist/__tests__/mocks.test.js +0 -24
  38. package/dist/__tests__/refs.test.d.ts +0 -1
  39. package/dist/__tests__/refs.test.js +0 -813
  40. package/dist/__tests__/relationships.test.d.ts +0 -1
  41. package/dist/__tests__/relationships.test.js +0 -638
  42. package/dist/__tests__/schema-transform.test.d.ts +0 -1
  43. package/dist/__tests__/schema-transform.test.js +0 -205
  44. package/dist/__tests__/schema-util.test.d.ts +0 -1
  45. package/dist/__tests__/schema-util.test.js +0 -1731
  46. package/dist/__tests__/service-dependencies.test.d.ts +0 -1
  47. package/dist/__tests__/service-dependencies.test.js +0 -360
  48. package/dist/__tests__/unions.test.d.ts +0 -1
  49. package/dist/__tests__/unions.test.js +0 -44
  50. package/dist/__tests__/validate.test.d.ts +0 -1
  51. package/dist/__tests__/validate.test.js +0 -1980
  52. package/dist/__tests__/workflows.test.d.ts +0 -3
  53. package/dist/__tests__/workflows.test.js +0 -149
  54. package/dist/layers/__tests__/layers.test.d.ts +0 -1
  55. package/dist/layers/__tests__/layers.test.js +0 -38
  56. package/dist/migration/to/__tests__/v3.10.0.test.d.ts +0 -1
  57. package/dist/migration/to/__tests__/v3.10.0.test.js +0 -90
  58. package/dist/migration/to/__tests__/v3.12.3.test.d.ts +0 -1
  59. package/dist/migration/to/__tests__/v3.12.3.test.js +0 -103
  60. package/dist/migration/to/__tests__/v3.17.test.d.ts +0 -1
  61. package/dist/migration/to/__tests__/v3.17.test.js +0 -71
  62. package/dist/migration/to/__tests__/v3.34.0.test.d.ts +0 -1
  63. package/dist/migration/to/__tests__/v3.34.0.test.js +0 -240
  64. package/dist/migration/to/__tests__/v3.39.0.test.d.ts +0 -1
  65. package/dist/migration/to/__tests__/v3.39.0.test.js +0 -116
  66. package/dist/migration/to/__tests__/v3.46.0.test.d.ts +0 -1
  67. package/dist/migration/to/__tests__/v3.46.0.test.js +0 -59
  68. package/dist/models/__tests__/fixtures.d.ts +0 -15
  69. package/dist/models/__tests__/fixtures.js +0 -56
  70. package/dist/models/__tests__/query.test.d.ts +0 -1
  71. package/dist/models/__tests__/query.test.js +0 -19
  72. package/dist/models/__tests__/runtime-schema.test.d.ts +0 -1
  73. package/dist/models/__tests__/runtime-schema.test.js +0 -43
  74. package/dist/models/__tests__/shape.test.d.ts +0 -1
  75. package/dist/models/__tests__/shape.test.js +0 -24
  76. package/dist/resolvers/ai/__tests__/rag-query.test.d.ts +0 -1
  77. package/dist/resolvers/ai/__tests__/rag-query.test.js +0 -49
  78. package/dist/services/__tests__/services.test.d.ts +0 -1
  79. package/dist/services/__tests__/services.test.js +0 -113
  80. package/dist/template-shapes/__tests__/index.test.d.ts +0 -1
  81. package/dist/template-shapes/__tests__/index.test.js +0 -40
  82. package/dist/template-shapes/__tests__/names.test.d.ts +0 -1
  83. package/dist/template-shapes/__tests__/names.test.js +0 -19
  84. package/dist/template-shapes/__tests__/templates.test.d.ts +0 -1
  85. package/dist/template-shapes/__tests__/templates.test.js +0 -80
  86. package/dist/template-shapes/__tests__/where.test.d.ts +0 -1
  87. package/dist/template-shapes/__tests__/where.test.js +0 -218
  88. package/dist/types/__tests__/utils.test.d.ts +0 -1
  89. package/dist/types/__tests__/utils.test.js +0 -159
  90. package/dist/util/__tests__/api-indexing.test.d.ts +0 -1
  91. package/dist/util/__tests__/api-indexing.test.js +0 -129
  92. package/dist/util/__tests__/detect-cycles.test.d.ts +0 -1
  93. package/dist/util/__tests__/detect-cycles.test.js +0 -193
  94. package/dist/util/__tests__/expressions.test.d.ts +0 -1
  95. package/dist/util/__tests__/expressions.test.js +0 -172
  96. package/dist/util/__tests__/find-shape-at-path.test.d.ts +0 -1
  97. package/dist/util/__tests__/find-shape-at-path.test.js +0 -41
  98. package/dist/util/__tests__/form-config.test.d.ts +0 -1
  99. package/dist/util/__tests__/form-config.test.js +0 -196
  100. package/dist/util/__tests__/get-return-shape.test.d.ts +0 -1
  101. package/dist/util/__tests__/get-return-shape.test.js +0 -27
  102. package/dist/util/__tests__/has-args.test.d.ts +0 -1
  103. package/dist/util/__tests__/has-args.test.js +0 -46
  104. package/dist/util/__tests__/merge.test.d.ts +0 -1
  105. package/dist/util/__tests__/merge.test.js +0 -1074
  106. package/dist/util/__tests__/patch-schema.test.d.ts +0 -1
  107. package/dist/util/__tests__/patch-schema.test.js +0 -82
  108. package/dist/util/__tests__/shapes.test.d.ts +0 -1
  109. 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
- });