@takeshape/schema 11.52.0 → 11.56.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.
- package/dist/__tests__/_examples.test.js +77 -0
- package/dist/__tests__/agents.test.js +163 -0
- package/dist/__tests__/api-version.test.js +24 -0
- package/dist/__tests__/builtin-schema.test.js +18 -0
- package/dist/__tests__/content-schema-transform.test.d.ts +1 -0
- package/dist/__tests__/content-schema-transform.test.js +522 -0
- package/dist/__tests__/create-input-schema.test.d.ts +1 -0
- package/dist/__tests__/create-input-schema.test.js +184 -0
- package/dist/__tests__/enum.test.d.ts +1 -0
- package/dist/__tests__/enum.test.js +36 -0
- package/dist/__tests__/flatten-templates.test.d.ts +1 -0
- package/dist/__tests__/flatten-templates.test.js +40 -0
- package/dist/__tests__/get-is-leaf.test.d.ts +1 -0
- package/dist/__tests__/get-is-leaf.test.js +50 -0
- package/dist/__tests__/interfaces.test.d.ts +1 -0
- package/dist/__tests__/interfaces.test.js +219 -0
- package/dist/__tests__/migration.test.d.ts +1 -0
- package/dist/__tests__/migration.test.js +34 -0
- package/dist/__tests__/mocks.test.d.ts +1 -0
- package/dist/__tests__/mocks.test.js +24 -0
- package/dist/__tests__/refs.test.d.ts +1 -0
- package/dist/__tests__/refs.test.js +752 -0
- package/dist/__tests__/relationships.test.d.ts +1 -0
- package/dist/__tests__/relationships.test.js +638 -0
- package/dist/__tests__/schema-transform.test.d.ts +1 -0
- package/dist/__tests__/schema-transform.test.js +205 -0
- package/dist/__tests__/schema-util.test.d.ts +1 -0
- package/dist/__tests__/schema-util.test.js +1731 -0
- package/dist/__tests__/service-dependencies.test.d.ts +1 -0
- package/dist/__tests__/service-dependencies.test.js +360 -0
- package/dist/__tests__/unions.test.d.ts +1 -0
- package/dist/__tests__/unions.test.js +44 -0
- package/dist/__tests__/validate.test.d.ts +1 -0
- package/dist/__tests__/validate.test.js +1926 -0
- package/dist/__tests__/workflows.test.d.ts +3 -0
- package/dist/__tests__/workflows.test.js +149 -0
- package/dist/agents.d.ts +14 -0
- package/dist/auth-schemas.d.ts +125 -0
- package/dist/builtin-schema.d.ts +8 -0
- package/dist/content-schema-transform.d.ts +35 -0
- package/dist/content-schema-transform.js +162 -0
- package/dist/create-input-schema.d.ts +9 -0
- package/dist/enum.d.ts +2 -0
- package/dist/flatten-templates.d.ts +2 -0
- package/dist/flatten-templates.js +20 -0
- package/dist/get-is-leaf.d.ts +3 -0
- package/dist/get-is-leaf.js +56 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +46 -0
- package/dist/interfaces.d.ts +12 -0
- package/dist/interfaces.js +85 -0
- package/dist/layers/__tests__/layers.test.d.ts +1 -0
- package/dist/layers/__tests__/layers.test.js +38 -0
- package/dist/layers/layers.d.ts +26 -0
- package/dist/layers/layers.js +301 -0
- package/dist/layers/refs.d.ts +102 -0
- package/dist/layers/refs.js +220 -0
- package/dist/layers/type-utils.d.ts +59 -0
- package/dist/layers/type-utils.js +118 -0
- package/dist/layers/visitor.d.ts +5 -0
- package/dist/layers/visitor.js +38 -0
- package/dist/migration/index.d.ts +64 -0
- package/dist/migration/index.js +122 -0
- package/dist/migration/to/__tests__/v3.10.0.test.d.ts +1 -0
- package/dist/migration/to/__tests__/v3.10.0.test.js +90 -0
- package/dist/migration/to/__tests__/v3.12.3.test.d.ts +1 -0
- package/dist/migration/to/__tests__/v3.12.3.test.js +103 -0
- package/dist/migration/to/__tests__/v3.17.test.d.ts +1 -0
- package/dist/migration/to/__tests__/v3.17.test.js +71 -0
- package/dist/migration/to/__tests__/v3.34.0.test.d.ts +1 -0
- package/dist/migration/to/__tests__/v3.34.0.test.js +240 -0
- package/dist/migration/to/__tests__/v3.39.0.test.d.ts +1 -0
- package/dist/migration/to/__tests__/v3.39.0.test.js +116 -0
- package/dist/migration/to/__tests__/v3.46.0.test.d.ts +1 -0
- package/dist/migration/to/__tests__/v3.46.0.test.js +59 -0
- package/dist/migration/to/v3.0.0.d.ts +4 -0
- package/dist/migration/to/v3.0.0.js +212 -0
- package/dist/migration/to/v3.1.0.d.ts +4 -0
- package/dist/migration/to/v3.1.0.js +194 -0
- package/dist/migration/to/v3.10.0.d.ts +4 -0
- package/dist/migration/to/v3.11.0.d.ts +4 -0
- package/dist/migration/to/v3.12.0.d.ts +4 -0
- package/dist/migration/to/v3.12.1.d.ts +4 -0
- package/dist/migration/to/v3.12.2.d.ts +4 -0
- package/dist/migration/to/v3.12.3.d.ts +4 -0
- package/dist/migration/to/v3.13.0.d.ts +4 -0
- package/dist/migration/to/v3.14.0.d.ts +4 -0
- package/dist/migration/to/v3.15.0.d.ts +4 -0
- package/dist/migration/to/v3.16.0.d.ts +4 -0
- package/dist/migration/to/v3.17.0.d.ts +4 -0
- package/dist/migration/to/v3.17.1.d.ts +4 -0
- package/dist/migration/to/v3.18.0.d.ts +4 -0
- package/dist/migration/to/v3.18.1.d.ts +4 -0
- package/dist/migration/to/v3.18.2.d.ts +4 -0
- package/dist/migration/to/v3.19.0.d.ts +4 -0
- package/dist/migration/to/v3.2.0.d.ts +4 -0
- package/dist/migration/to/v3.20.0.d.ts +4 -0
- package/dist/migration/to/v3.21.0.d.ts +4 -0
- package/dist/migration/to/v3.22.0.d.ts +4 -0
- package/dist/migration/to/v3.23.0.d.ts +4 -0
- package/dist/migration/to/v3.24.0.d.ts +4 -0
- package/dist/migration/to/v3.25.0.d.ts +4 -0
- package/dist/migration/to/v3.26.0.d.ts +4 -0
- package/dist/migration/to/v3.27.0.d.ts +4 -0
- package/dist/migration/to/v3.28.0.d.ts +4 -0
- package/dist/migration/to/v3.29.0.d.ts +4 -0
- package/dist/migration/to/v3.3.0.d.ts +4 -0
- package/dist/migration/to/v3.30.0.d.ts +4 -0
- package/dist/migration/to/v3.31.0.d.ts +4 -0
- package/dist/migration/to/v3.32.0.d.ts +4 -0
- package/dist/migration/to/v3.32.0.js +59 -0
- package/dist/migration/to/v3.33.0.d.ts +4 -0
- package/dist/migration/to/v3.34.0.d.ts +6 -0
- package/dist/migration/to/v3.34.0.js +116 -0
- package/dist/migration/to/v3.35.0.d.ts +4 -0
- package/dist/migration/to/v3.36.0.d.ts +4 -0
- package/dist/migration/to/v3.37.0.d.ts +4 -0
- package/dist/migration/to/v3.38.0.d.ts +4 -0
- package/dist/migration/to/v3.39.0.d.ts +4 -0
- package/dist/migration/to/v3.39.0.js +45 -0
- package/dist/migration/to/v3.4.0.d.ts +4 -0
- package/dist/migration/to/v3.40.0.d.ts +4 -0
- package/dist/migration/to/v3.41.0.d.ts +4 -0
- package/dist/migration/to/v3.42.0.d.ts +4 -0
- package/dist/migration/to/v3.43.0.d.ts +4 -0
- package/dist/migration/to/v3.44.0.d.ts +4 -0
- package/dist/migration/to/v3.45.0.d.ts +4 -0
- package/dist/migration/to/v3.46.0.d.ts +4 -0
- package/dist/migration/to/v3.47.0.d.ts +4 -0
- package/dist/migration/to/v3.48.0.d.ts +4 -0
- package/dist/migration/to/v3.49.0.d.ts +4 -0
- package/dist/migration/to/v3.5.0.d.ts +4 -0
- package/dist/migration/to/v3.5.1.d.ts +4 -0
- package/dist/migration/to/v3.50.0.d.ts +4 -0
- package/dist/migration/to/v3.51.0.d.ts +4 -0
- package/dist/migration/to/v3.6.0.d.ts +4 -0
- package/dist/migration/to/v3.7.0.d.ts +4 -0
- package/dist/migration/to/v3.8.0.d.ts +4 -0
- package/dist/migration/to/v3.9.0.d.ts +4 -0
- package/dist/migration/types.d.ts +19 -0
- package/dist/migration/types.js +1 -0
- package/dist/mocks.d.ts +13 -0
- package/dist/mocks.js +58 -0
- package/dist/models/__tests__/project-schema.test.d.ts +1 -0
- package/dist/models/__tests__/project-schema.test.js +67 -0
- package/dist/models/__tests__/query.test.d.ts +1 -0
- package/dist/models/__tests__/query.test.js +27 -0
- package/dist/models/__tests__/service.test.d.ts +1 -0
- package/dist/models/__tests__/service.test.js +17 -0
- package/dist/models/__tests__/shape.test.d.ts +1 -0
- package/dist/models/__tests__/shape.test.js +61 -0
- package/dist/models/project-schema.d.ts +35 -0
- package/dist/models/project-schema.js +92 -0
- package/dist/models/query.d.ts +17 -0
- package/dist/models/service.d.ts +12 -0
- package/dist/models/shape.d.ts +41 -0
- package/dist/models/shape.js +85 -0
- package/dist/patterns.js +1 -0
- package/dist/project-schema/index.d.ts +187 -0
- package/dist/project-schema/index.js +75 -0
- package/dist/project-schema/latest.d.ts +2222 -0
- package/dist/project-schema/migrate.d.ts +4 -0
- package/dist/project-schema/migrate.js +194 -0
- package/dist/project-schema/v3.48.0.d.ts +2161 -0
- package/dist/project-schema/v3.49.0.d.ts +2170 -0
- package/dist/project-schema/v3.50.0.d.ts +2222 -0
- package/dist/project-schema/v3.51.0.d.ts +2222 -0
- package/dist/refs.d.ts +226 -0
- package/dist/refs.js +608 -0
- package/dist/relationships.d.ts +40 -0
- package/dist/relationships.js +311 -0
- package/dist/runtime-schema.d.ts +5 -0
- package/dist/runtime-schema.js +80 -0
- package/dist/schema-transform.d.ts +19 -0
- package/dist/schema-transform.js +74 -0
- package/dist/schema-util.d.ts +210 -0
- package/dist/schema-util.js +1077 -0
- package/dist/schemas/auth-schemas.json +365 -0
- package/dist/schemas/index.js +154 -0
- package/dist/schemas/project-schema/experimental.json +1104 -0
- package/dist/service-dependencies.d.ts +13 -0
- package/dist/service-dependencies.js +165 -0
- package/dist/services/__tests__/services.test.d.ts +1 -0
- package/dist/services/__tests__/services.test.js +113 -0
- package/dist/services/services.d.ts +31 -0
- package/dist/services/services.js +145 -0
- package/dist/services/types.js +1 -0
- package/dist/services/util.d.ts +16 -0
- package/dist/taxonomies.d.ts +15 -0
- package/dist/taxonomies.js +24 -0
- package/dist/template-shapes/__tests__/index.test.d.ts +1 -0
- package/dist/template-shapes/__tests__/index.test.js +40 -0
- package/dist/template-shapes/__tests__/names.test.d.ts +1 -0
- package/dist/template-shapes/__tests__/names.test.js +19 -0
- package/dist/template-shapes/__tests__/templates.test.d.ts +1 -0
- package/dist/template-shapes/__tests__/templates.test.js +80 -0
- package/dist/template-shapes/__tests__/where.test.d.ts +1 -0
- package/dist/template-shapes/__tests__/where.test.js +218 -0
- package/dist/template-shapes/index.d.ts +7 -0
- package/dist/template-shapes/names.d.ts +10 -0
- package/dist/template-shapes/templates.d.ts +32 -0
- package/dist/template-shapes/templates.js +319 -0
- package/dist/template-shapes/types.d.ts +15 -0
- package/dist/template-shapes/where.d.ts +37 -0
- package/dist/template-shapes/where.js +402 -0
- package/dist/types/__tests__/utils.test.d.ts +1 -0
- package/dist/types/__tests__/utils.test.js +159 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +2 -0
- package/dist/types/transforms.d.ts +13 -0
- package/dist/types/transforms.js +1 -0
- package/dist/types/types.d.ts +211 -0
- package/dist/types/utils.d.ts +117 -0
- package/dist/types/utils.js +279 -0
- package/dist/unions.d.ts +14 -0
- package/dist/unions.js +77 -0
- package/dist/util/__tests__/api-indexing.test.d.ts +1 -0
- package/dist/util/__tests__/api-indexing.test.js +129 -0
- package/dist/util/__tests__/detect-cycles.test.d.ts +1 -0
- package/dist/util/__tests__/detect-cycles.test.js +193 -0
- package/dist/util/__tests__/find-shape-at-path.test.d.ts +1 -0
- package/dist/util/__tests__/find-shape-at-path.test.js +41 -0
- package/dist/util/__tests__/form-config.test.d.ts +1 -0
- package/dist/util/__tests__/form-config.test.js +196 -0
- package/dist/util/__tests__/get-return-shape.test.d.ts +1 -0
- package/dist/util/__tests__/get-return-shape.test.js +27 -0
- package/dist/util/__tests__/has-args.test.d.ts +1 -0
- package/dist/util/__tests__/has-args.test.js +46 -0
- package/dist/util/__tests__/merge.test.d.ts +1 -0
- package/dist/util/__tests__/merge.test.js +1074 -0
- package/dist/util/__tests__/patch-schema.test.d.ts +1 -0
- package/dist/util/__tests__/patch-schema.test.js +82 -0
- package/dist/util/__tests__/shapes.test.d.ts +1 -0
- package/dist/util/__tests__/shapes.test.js +30 -0
- package/dist/util/ai-tools.d.ts +3 -0
- package/dist/util/api-indexing.d.ts +9 -0
- package/dist/util/api-indexing.js +57 -0
- package/dist/util/detect-cycles.d.ts +7 -0
- package/dist/util/detect-cycles.js +45 -0
- package/dist/util/find-shape-at-path.d.ts +21 -0
- package/dist/util/form-config.d.ts +11 -0
- package/dist/util/form-config.js +62 -0
- package/dist/util/get-conflicting-properties.d.ts +6 -0
- package/dist/util/get-conflicting-properties.js +55 -0
- package/dist/util/get-return-shape.d.ts +4 -0
- package/dist/util/get-return-shape.js +30 -0
- package/dist/util/has-arg.d.ts +4 -0
- package/dist/util/has-arg.js +13 -0
- package/dist/util/merge.d.ts +15 -0
- package/dist/util/merge.js +256 -0
- package/dist/util/patch-schema.d.ts +8 -0
- package/dist/util/shapes.d.ts +5 -0
- package/dist/validate/errors.d.ts +3 -0
- package/dist/validate/errors.js +20 -0
- package/dist/validate/validate.d.ts +73 -0
- package/dist/validate/validate.js +1107 -0
- package/dist/versions.d.ts +4 -0
- package/dist/versions.js +4 -0
- package/dist/workflows.d.ts +14 -0
- package/dist/workflows.js +66 -0
- package/examples/latest/agent-schema.json +12 -4
- package/examples/latest/all-fields-shapes-inline.json +52 -18
- package/examples/latest/all-fields-shapes.json +76 -26
- package/examples/latest/betzino.json +3139 -902
- package/examples/latest/blog-schema.json +28 -8
- package/examples/latest/brewery-schema.json +25 -7
- package/examples/latest/clear-cache-schema.json +7 -3
- package/examples/latest/complex-project-schema.json +359 -98
- package/examples/latest/complex-schema.json +1754 -487
- package/examples/latest/edit-schema.json +11 -4
- package/examples/latest/fabric-ecommerce.json +838 -187
- package/examples/latest/frank-and-fred-schema.json +1753 -486
- package/examples/latest/klirr-schema.json +2411 -682
- package/examples/latest/layers/rick-and-morty-layer.json +32 -11
- package/examples/latest/layers/shopify-layer-2023-01.json +8637 -2206
- package/examples/latest/layers/shopify-storefront-2023-04.json +1714 -404
- package/examples/latest/layers/wordpress-2024-01.json +2746 -691
- package/examples/latest/massive-schema.json +584 -131
- package/examples/latest/mill-components-schema.json +125 -29
- package/examples/latest/nested-shape-arrays.json +19 -7
- package/examples/latest/one-earth.json +1113 -236
- package/examples/latest/pet-oneof-array.json +22 -7
- package/examples/latest/post-schema.json +20 -6
- package/examples/latest/pruned-shopify-product-schema.json +830 -185
- package/examples/latest/rag-example.json +15 -5
- package/examples/latest/real-world-schema.json +56 -14
- package/examples/latest/recursive-repeater-schema.json +11 -4
- package/examples/latest/recursive-schema.json +11 -4
- package/examples/latest/rick-and-morty-ast.json +174 -45
- package/examples/latest/rick-and-morty-graphql.json +100 -25
- package/examples/latest/rick-and-morty-rest.json +7 -3
- package/examples/latest/rick-and-morty-with-indexing.json +13 -5
- package/examples/latest/schema-where-filter.json +40 -11
- package/examples/latest/schema-with-repeater-draftjs.json +8 -3
- package/examples/latest/schema-with-rick-and-morty.json +4 -2
- package/examples/latest/shape-books-v3_2_0.json +71 -17
- package/examples/latest/shape-books.json +71 -17
- package/examples/latest/shape-editor-schema-edited.json +69 -23
- package/examples/latest/shape-editor-schema-initial.json +28 -10
- package/examples/latest/shapedb-crud-every-prop-type.json +22 -8
- package/examples/latest/shopify-lookbook.json +19 -5
- package/examples/latest/shopify-product-2022-07.json +3217 -726
- package/examples/latest/shopify-product-2023-04.json +4496 -1012
- package/examples/latest/shopify-store-with-widget.json +942 -213
- package/examples/latest/stripe-product-runtime-schema.json +277 -81
- package/examples/latest/stripe-starter-resolved.json +1953 -476
- package/examples/latest/user-schema-no-required.json +13 -3
- package/examples/latest/user-schema-with-defaults.json +27 -5
- package/examples/latest/valvoline-ai-demo.json +69 -17
- package/examples/latest/vector-search-schema.json +24 -8
- package/package.json +24 -26
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/src/agents.js +0 -147
- package/dist/cjs/src/api-version.js +0 -24
- package/dist/cjs/src/auth-schemas.js +0 -8
- package/dist/cjs/src/builtin-schema.js +0 -616
- package/dist/cjs/src/constants.js +0 -4
- package/dist/cjs/src/content-schema-transform.js +0 -175
- package/dist/cjs/src/create-input-schema.js +0 -66
- package/dist/cjs/src/enum.js +0 -12
- package/dist/cjs/src/flatten-templates.js +0 -26
- package/dist/cjs/src/get-is-leaf.js +0 -59
- package/dist/cjs/src/index.js +0 -62
- package/dist/cjs/src/interfaces.js +0 -98
- package/dist/cjs/src/layers/layers.js +0 -313
- package/dist/cjs/src/layers/refs.js +0 -243
- package/dist/cjs/src/layers/type-utils.js +0 -145
- package/dist/cjs/src/layers/visitor.js +0 -42
- package/dist/cjs/src/migration/index.js +0 -142
- package/dist/cjs/src/migration/to/v3.0.0.js +0 -217
- package/dist/cjs/src/migration/to/v3.1.0.js +0 -199
- package/dist/cjs/src/migration/to/v3.10.0.js +0 -72
- package/dist/cjs/src/migration/to/v3.11.0.js +0 -90
- package/dist/cjs/src/migration/to/v3.12.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.12.1.js +0 -12
- package/dist/cjs/src/migration/to/v3.12.2.js +0 -12
- package/dist/cjs/src/migration/to/v3.12.3.js +0 -92
- package/dist/cjs/src/migration/to/v3.13.0.js +0 -22
- package/dist/cjs/src/migration/to/v3.14.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.15.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.16.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.17.0.js +0 -27
- package/dist/cjs/src/migration/to/v3.17.1.js +0 -12
- package/dist/cjs/src/migration/to/v3.18.0.js +0 -69
- package/dist/cjs/src/migration/to/v3.18.1.js +0 -20
- package/dist/cjs/src/migration/to/v3.18.2.js +0 -24
- package/dist/cjs/src/migration/to/v3.19.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.2.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.20.0.js +0 -29
- package/dist/cjs/src/migration/to/v3.21.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.22.0.js +0 -30
- package/dist/cjs/src/migration/to/v3.23.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.24.0.js +0 -13
- package/dist/cjs/src/migration/to/v3.25.0.js +0 -13
- package/dist/cjs/src/migration/to/v3.26.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.27.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.28.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.29.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.3.0.js +0 -15
- package/dist/cjs/src/migration/to/v3.30.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.31.0.js +0 -43
- package/dist/cjs/src/migration/to/v3.32.0.js +0 -61
- package/dist/cjs/src/migration/to/v3.33.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.34.0.js +0 -123
- package/dist/cjs/src/migration/to/v3.35.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.36.0.js +0 -27
- package/dist/cjs/src/migration/to/v3.37.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.38.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.39.0.js +0 -47
- package/dist/cjs/src/migration/to/v3.4.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.40.0.js +0 -31
- package/dist/cjs/src/migration/to/v3.41.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.42.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.43.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.44.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.45.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.46.0.js +0 -37
- package/dist/cjs/src/migration/to/v3.47.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.48.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.49.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.5.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.5.1.js +0 -12
- package/dist/cjs/src/migration/to/v3.50.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.51.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.6.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.7.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.8.0.js +0 -12
- package/dist/cjs/src/migration/to/v3.9.0.js +0 -84
- package/dist/cjs/src/migration/types.js +0 -2
- package/dist/cjs/src/migration/utils.js +0 -10
- package/dist/cjs/src/mocks.js +0 -65
- package/dist/cjs/src/models/project-schema.js +0 -99
- package/dist/cjs/src/models/query.js +0 -35
- package/dist/cjs/src/models/service.js +0 -24
- package/dist/cjs/src/models/shape.js +0 -89
- package/dist/cjs/src/patterns.js +0 -2
- package/dist/cjs/src/project-schema/index.js +0 -156
- package/dist/cjs/src/project-schema/latest.js +0 -8
- package/dist/cjs/src/project-schema/migrate.js +0 -198
- package/dist/cjs/src/project-schema/v1.0.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.0.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.1.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.10.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.11.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.12.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.12.1.js +0 -8
- package/dist/cjs/src/project-schema/v3.12.2.js +0 -8
- package/dist/cjs/src/project-schema/v3.12.3.js +0 -8
- package/dist/cjs/src/project-schema/v3.13.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.13.1.js +0 -8
- package/dist/cjs/src/project-schema/v3.14.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.15.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.16.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.17.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.17.1.js +0 -8
- package/dist/cjs/src/project-schema/v3.18.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.18.1.js +0 -8
- package/dist/cjs/src/project-schema/v3.18.2.js +0 -8
- package/dist/cjs/src/project-schema/v3.19.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.2.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.20.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.21.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.22.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.23.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.24.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.25.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.26.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.27.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.28.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.29.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.3.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.30.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.31.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.32.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.33.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.34.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.35.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.36.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.37.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.38.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.39.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.4.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.40.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.41.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.42.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.43.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.44.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.45.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.46.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.47.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.48.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.49.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.5.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.5.1.js +0 -8
- package/dist/cjs/src/project-schema/v3.50.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.51.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.6.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.7.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.8.0.js +0 -8
- package/dist/cjs/src/project-schema/v3.9.0.js +0 -8
- package/dist/cjs/src/project-schema/v4.0.0.js +0 -8
- package/dist/cjs/src/refs.js +0 -671
- package/dist/cjs/src/relationships.js +0 -326
- package/dist/cjs/src/runtime-schema.js +0 -88
- package/dist/cjs/src/scalars.js +0 -8
- package/dist/cjs/src/schema-transform.js +0 -83
- package/dist/cjs/src/schema-util.js +0 -1140
- package/dist/cjs/src/schemas/auth-schemas.json +0 -313
- package/dist/cjs/src/schemas/index.js +0 -162
- package/dist/cjs/src/schemas/project-schema/experimental.json +0 -1101
- package/dist/cjs/src/schemas/user-schema.json +0 -51
- package/dist/cjs/src/service-dependencies.js +0 -172
- package/dist/cjs/src/services/services.js +0 -156
- package/dist/cjs/src/services/types.js +0 -2
- package/dist/cjs/src/services/util.js +0 -45
- package/dist/cjs/src/taxonomies.js +0 -28
- package/dist/cjs/src/template-shapes/index.js +0 -37
- package/dist/cjs/src/template-shapes/names.js +0 -26
- package/dist/cjs/src/template-shapes/templates.js +0 -331
- package/dist/cjs/src/template-shapes/types.js +0 -10
- package/dist/cjs/src/template-shapes/where.js +0 -414
- package/dist/cjs/src/types/index.js +0 -19
- package/dist/cjs/src/types/transforms.js +0 -2
- package/dist/cjs/src/types/types.js +0 -21
- package/dist/cjs/src/types/utils.js +0 -344
- package/dist/cjs/src/unions.js +0 -88
- package/dist/cjs/src/user-schema.js +0 -8
- package/dist/cjs/src/util/ai-tools.js +0 -10
- package/dist/cjs/src/util/api-indexing.js +0 -62
- package/dist/cjs/src/util/detect-cycles.js +0 -48
- package/dist/cjs/src/util/find-shape-at-path.js +0 -57
- package/dist/cjs/src/util/form-config.js +0 -66
- package/dist/cjs/src/util/get-conflicting-properties.js +0 -58
- package/dist/cjs/src/util/get-return-shape.js +0 -34
- package/dist/cjs/src/util/has-arg.js +0 -17
- package/dist/cjs/src/util/merge.js +0 -269
- package/dist/cjs/src/util/patch-schema.js +0 -55
- package/dist/cjs/src/util/shapes.js +0 -31
- package/dist/cjs/src/validate.js +0 -1140
- package/dist/cjs/src/versions.js +0 -8
- package/dist/cjs/src/workflows.js +0 -76
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +0 -1
- package/dist/esm/package.json +0 -1
- package/dist/esm/src/content-schema-transform.js +0 -162
- package/dist/esm/src/flatten-templates.js +0 -20
- package/dist/esm/src/get-is-leaf.js +0 -56
- package/dist/esm/src/index.js +0 -46
- package/dist/esm/src/interfaces.js +0 -85
- package/dist/esm/src/layers/layers.js +0 -301
- package/dist/esm/src/layers/refs.js +0 -220
- package/dist/esm/src/layers/type-utils.js +0 -118
- package/dist/esm/src/layers/visitor.js +0 -38
- package/dist/esm/src/migration/index.js +0 -122
- package/dist/esm/src/migration/to/v3.0.0.js +0 -212
- package/dist/esm/src/migration/to/v3.1.0.js +0 -194
- package/dist/esm/src/migration/to/v3.32.0.js +0 -59
- package/dist/esm/src/migration/to/v3.34.0.js +0 -116
- package/dist/esm/src/migration/to/v3.39.0.js +0 -45
- package/dist/esm/src/mocks.js +0 -58
- package/dist/esm/src/models/project-schema.js +0 -92
- package/dist/esm/src/models/shape.js +0 -85
- package/dist/esm/src/project-schema/index.js +0 -138
- package/dist/esm/src/project-schema/migrate.js +0 -194
- package/dist/esm/src/refs.js +0 -608
- package/dist/esm/src/relationships.js +0 -311
- package/dist/esm/src/runtime-schema.js +0 -80
- package/dist/esm/src/schema-transform.js +0 -74
- package/dist/esm/src/schema-util.js +0 -1077
- package/dist/esm/src/schemas/auth-schemas.json +0 -313
- package/dist/esm/src/schemas/index.js +0 -154
- package/dist/esm/src/schemas/project-schema/experimental.json +0 -1101
- package/dist/esm/src/schemas/project-schema/latest.json +0 -3320
- package/dist/esm/src/schemas/project-schema/meta-schema-v1.0.0.json +0 -193
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.0.0.json +0 -608
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.1.0.json +0 -608
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.2.0.json +0 -612
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.3.0.json +0 -612
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.4.0.json +0 -637
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.5.0.json +0 -626
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.5.1.json +0 -626
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.6.0.json +0 -629
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.7.0.json +0 -1137
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.8.0.json +0 -1137
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.9.0.json +0 -1477
- package/dist/esm/src/schemas/project-schema/v1.0.0.json +0 -321
- package/dist/esm/src/schemas/project-schema/v3.0.0.json +0 -414
- package/dist/esm/src/schemas/project-schema/v3.1.0.json +0 -572
- package/dist/esm/src/schemas/project-schema/v3.10.0.json +0 -2097
- package/dist/esm/src/schemas/project-schema/v3.11.0.json +0 -2141
- package/dist/esm/src/schemas/project-schema/v3.12.0.json +0 -2144
- package/dist/esm/src/schemas/project-schema/v3.12.1.json +0 -2282
- package/dist/esm/src/schemas/project-schema/v3.12.2.json +0 -2304
- package/dist/esm/src/schemas/project-schema/v3.12.3.json +0 -2357
- package/dist/esm/src/schemas/project-schema/v3.13.0.json +0 -2377
- package/dist/esm/src/schemas/project-schema/v3.14.0.json +0 -2385
- package/dist/esm/src/schemas/project-schema/v3.15.0.json +0 -2365
- package/dist/esm/src/schemas/project-schema/v3.16.0.json +0 -2373
- package/dist/esm/src/schemas/project-schema/v3.17.0.json +0 -2378
- package/dist/esm/src/schemas/project-schema/v3.17.1.json +0 -2380
- package/dist/esm/src/schemas/project-schema/v3.18.0.json +0 -2356
- package/dist/esm/src/schemas/project-schema/v3.18.1.json +0 -2357
- package/dist/esm/src/schemas/project-schema/v3.18.2.json +0 -2357
- package/dist/esm/src/schemas/project-schema/v3.19.0.json +0 -2369
- package/dist/esm/src/schemas/project-schema/v3.2.0.json +0 -580
- package/dist/esm/src/schemas/project-schema/v3.20.0.json +0 -2369
- package/dist/esm/src/schemas/project-schema/v3.21.0.json +0 -2376
- package/dist/esm/src/schemas/project-schema/v3.22.0.json +0 -2381
- package/dist/esm/src/schemas/project-schema/v3.23.0.json +0 -2456
- package/dist/esm/src/schemas/project-schema/v3.24.0.json +0 -2556
- package/dist/esm/src/schemas/project-schema/v3.25.0.json +0 -2552
- package/dist/esm/src/schemas/project-schema/v3.26.0.json +0 -2599
- package/dist/esm/src/schemas/project-schema/v3.27.0.json +0 -2611
- package/dist/esm/src/schemas/project-schema/v3.28.0.json +0 -2656
- package/dist/esm/src/schemas/project-schema/v3.29.0.json +0 -2670
- package/dist/esm/src/schemas/project-schema/v3.3.0.json +0 -581
- package/dist/esm/src/schemas/project-schema/v3.30.0.json +0 -2656
- package/dist/esm/src/schemas/project-schema/v3.31.0.json +0 -2714
- package/dist/esm/src/schemas/project-schema/v3.32.0.json +0 -2708
- package/dist/esm/src/schemas/project-schema/v3.33.0.json +0 -2715
- package/dist/esm/src/schemas/project-schema/v3.34.0.json +0 -2715
- package/dist/esm/src/schemas/project-schema/v3.35.0.json +0 -2748
- package/dist/esm/src/schemas/project-schema/v3.36.0.json +0 -2756
- package/dist/esm/src/schemas/project-schema/v3.37.0.json +0 -2821
- package/dist/esm/src/schemas/project-schema/v3.38.0.json +0 -2819
- package/dist/esm/src/schemas/project-schema/v3.39.0.json +0 -2827
- package/dist/esm/src/schemas/project-schema/v3.4.0.json +0 -571
- package/dist/esm/src/schemas/project-schema/v3.40.0.json +0 -2830
- package/dist/esm/src/schemas/project-schema/v3.41.0.json +0 -2830
- package/dist/esm/src/schemas/project-schema/v3.42.0.json +0 -2835
- package/dist/esm/src/schemas/project-schema/v3.43.0.json +0 -2841
- package/dist/esm/src/schemas/project-schema/v3.44.0.json +0 -3013
- package/dist/esm/src/schemas/project-schema/v3.45.0.json +0 -3064
- package/dist/esm/src/schemas/project-schema/v3.46.0.json +0 -3136
- package/dist/esm/src/schemas/project-schema/v3.47.0.json +0 -3189
- package/dist/esm/src/schemas/project-schema/v3.48.0.json +0 -3196
- package/dist/esm/src/schemas/project-schema/v3.49.0.json +0 -3239
- package/dist/esm/src/schemas/project-schema/v3.5.0.json +0 -571
- package/dist/esm/src/schemas/project-schema/v3.5.1.json +0 -571
- package/dist/esm/src/schemas/project-schema/v3.50.0.json +0 -3320
- package/dist/esm/src/schemas/project-schema/v3.51.0.json +0 -3320
- package/dist/esm/src/schemas/project-schema/v3.6.0.json +0 -587
- package/dist/esm/src/schemas/project-schema/v3.7.0.json +0 -587
- package/dist/esm/src/schemas/project-schema/v3.8.0.json +0 -604
- package/dist/esm/src/schemas/project-schema/v3.9.0.json +0 -604
- package/dist/esm/src/schemas/project-schema/v4.0.0.json +0 -2316
- package/dist/esm/src/schemas/project-schema.json +0 -190
- package/dist/esm/src/schemas/user-schema.json +0 -51
- package/dist/esm/src/service-dependencies.js +0 -165
- package/dist/esm/src/services/services.js +0 -145
- package/dist/esm/src/taxonomies.js +0 -24
- package/dist/esm/src/template-shapes/templates.js +0 -319
- package/dist/esm/src/template-shapes/where.js +0 -402
- package/dist/esm/src/types/index.js +0 -3
- package/dist/esm/src/types/utils.js +0 -279
- package/dist/esm/src/unions.js +0 -77
- package/dist/esm/src/user-schema.js +0 -7
- package/dist/esm/src/util/api-indexing.js +0 -57
- package/dist/esm/src/util/detect-cycles.js +0 -45
- package/dist/esm/src/util/form-config.js +0 -62
- package/dist/esm/src/util/get-conflicting-properties.js +0 -55
- package/dist/esm/src/util/get-return-shape.js +0 -30
- package/dist/esm/src/util/has-arg.js +0 -13
- package/dist/esm/src/util/merge.js +0 -256
- package/dist/esm/src/validate.js +0 -1126
- package/dist/esm/src/versions.js +0 -4
- package/dist/esm/src/workflows.js +0 -66
- package/dist/esm/tsconfig.esm.tsbuildinfo +0 -1
- package/dist/types/src/agents.d.ts +0 -14
- package/dist/types/src/auth-schemas.d.ts +0 -104
- package/dist/types/src/builtin-schema.d.ts +0 -8
- package/dist/types/src/content-schema-transform.d.ts +0 -35
- package/dist/types/src/create-input-schema.d.ts +0 -9
- package/dist/types/src/enum.d.ts +0 -2
- package/dist/types/src/flatten-templates.d.ts +0 -2
- package/dist/types/src/get-is-leaf.d.ts +0 -3
- package/dist/types/src/index.d.ts +0 -48
- package/dist/types/src/interfaces.d.ts +0 -12
- package/dist/types/src/layers/layers.d.ts +0 -26
- package/dist/types/src/layers/refs.d.ts +0 -102
- package/dist/types/src/layers/type-utils.d.ts +0 -59
- package/dist/types/src/layers/visitor.d.ts +0 -5
- package/dist/types/src/migration/index.d.ts +0 -64
- package/dist/types/src/migration/to/v3.0.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.1.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.10.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.11.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.12.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.12.1.d.ts +0 -4
- package/dist/types/src/migration/to/v3.12.2.d.ts +0 -4
- package/dist/types/src/migration/to/v3.12.3.d.ts +0 -4
- package/dist/types/src/migration/to/v3.13.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.14.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.15.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.16.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.17.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.17.1.d.ts +0 -4
- package/dist/types/src/migration/to/v3.18.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.18.1.d.ts +0 -4
- package/dist/types/src/migration/to/v3.18.2.d.ts +0 -4
- package/dist/types/src/migration/to/v3.19.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.2.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.20.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.21.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.22.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.23.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.24.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.25.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.26.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.27.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.28.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.29.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.3.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.30.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.31.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.32.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.33.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.34.0.d.ts +0 -6
- package/dist/types/src/migration/to/v3.35.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.36.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.37.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.38.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.39.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.4.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.40.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.41.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.42.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.43.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.44.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.45.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.46.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.47.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.48.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.49.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.5.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.5.1.d.ts +0 -4
- package/dist/types/src/migration/to/v3.50.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.51.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.6.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.7.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.8.0.d.ts +0 -4
- package/dist/types/src/migration/to/v3.9.0.d.ts +0 -4
- package/dist/types/src/migration/types.d.ts +0 -19
- package/dist/types/src/mocks.d.ts +0 -13
- package/dist/types/src/models/project-schema.d.ts +0 -35
- package/dist/types/src/models/query.d.ts +0 -17
- package/dist/types/src/models/service.d.ts +0 -12
- package/dist/types/src/models/shape.d.ts +0 -41
- package/dist/types/src/project-schema/index.d.ts +0 -187
- package/dist/types/src/project-schema/latest.d.ts +0 -2221
- package/dist/types/src/project-schema/migrate.d.ts +0 -4
- package/dist/types/src/project-schema/v3.48.0.d.ts +0 -2160
- package/dist/types/src/project-schema/v3.49.0.d.ts +0 -2169
- package/dist/types/src/project-schema/v3.50.0.d.ts +0 -2221
- package/dist/types/src/project-schema/v3.51.0.d.ts +0 -2221
- package/dist/types/src/refs.d.ts +0 -226
- package/dist/types/src/relationships.d.ts +0 -40
- package/dist/types/src/runtime-schema.d.ts +0 -5
- package/dist/types/src/schema-transform.d.ts +0 -19
- package/dist/types/src/schema-util.d.ts +0 -210
- package/dist/types/src/service-dependencies.d.ts +0 -13
- package/dist/types/src/services/services.d.ts +0 -31
- package/dist/types/src/services/util.d.ts +0 -16
- package/dist/types/src/taxonomies.d.ts +0 -15
- package/dist/types/src/template-shapes/index.d.ts +0 -7
- package/dist/types/src/template-shapes/names.d.ts +0 -10
- package/dist/types/src/template-shapes/templates.d.ts +0 -32
- package/dist/types/src/template-shapes/types.d.ts +0 -15
- package/dist/types/src/template-shapes/where.d.ts +0 -37
- package/dist/types/src/types/index.d.ts +0 -3
- package/dist/types/src/types/transforms.d.ts +0 -13
- package/dist/types/src/types/types.d.ts +0 -211
- package/dist/types/src/types/utils.d.ts +0 -117
- package/dist/types/src/unions.d.ts +0 -14
- package/dist/types/src/user-schema.d.ts +0 -38
- package/dist/types/src/util/ai-tools.d.ts +0 -3
- package/dist/types/src/util/api-indexing.d.ts +0 -9
- package/dist/types/src/util/detect-cycles.d.ts +0 -7
- package/dist/types/src/util/find-shape-at-path.d.ts +0 -21
- package/dist/types/src/util/form-config.d.ts +0 -11
- package/dist/types/src/util/get-conflicting-properties.d.ts +0 -6
- package/dist/types/src/util/get-return-shape.d.ts +0 -4
- package/dist/types/src/util/has-arg.d.ts +0 -4
- package/dist/types/src/util/merge.d.ts +0 -15
- package/dist/types/src/util/patch-schema.d.ts +0 -8
- package/dist/types/src/util/shapes.d.ts +0 -5
- package/dist/types/src/validate.d.ts +0 -75
- package/dist/types/src/versions.d.ts +0 -4
- package/dist/types/src/workflows.d.ts +0 -14
- package/dist/types/tsconfig.types.tsbuildinfo +0 -1
- /package/dist/{esm/src/migration/types.js → __tests__/_examples.test.d.ts} +0 -0
- /package/dist/{esm/src/patterns.js → __tests__/agents.test.d.ts} +0 -0
- /package/dist/{esm/src/services/types.js → __tests__/api-version.test.d.ts} +0 -0
- /package/dist/{esm/src/types/transforms.js → __tests__/builtin-schema.test.d.ts} +0 -0
- /package/dist/{esm/src/agents.js → agents.js} +0 -0
- /package/dist/{types/src/api-version.d.ts → api-version.d.ts} +0 -0
- /package/dist/{esm/src/api-version.js → api-version.js} +0 -0
- /package/dist/{esm/src/auth-schemas.js → auth-schemas.js} +0 -0
- /package/dist/{esm/src/builtin-schema.js → builtin-schema.js} +0 -0
- /package/dist/{types/src/constants.d.ts → constants.d.ts} +0 -0
- /package/dist/{esm/src/constants.js → constants.js} +0 -0
- /package/dist/{esm/src/create-input-schema.js → create-input-schema.js} +0 -0
- /package/dist/{esm/src/enum.js → enum.js} +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.10.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.11.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.12.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.12.1.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.12.2.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.12.3.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.13.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.14.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.15.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.16.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.17.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.17.1.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.18.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.18.1.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.18.2.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.19.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.2.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.20.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.21.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.22.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.23.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.24.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.25.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.26.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.27.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.28.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.29.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.3.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.30.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.31.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.33.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.35.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.36.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.37.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.38.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.4.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.40.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.41.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.42.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.43.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.44.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.45.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.46.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.47.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.48.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.49.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.5.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.5.1.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.50.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.51.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.6.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.7.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.8.0.js +0 -0
- /package/dist/{esm/src/migration → migration}/to/v3.9.0.js +0 -0
- /package/dist/{types/src/migration → migration}/utils.d.ts +0 -0
- /package/dist/{esm/src/migration → migration}/utils.js +0 -0
- /package/dist/{esm/src/models → models}/query.js +0 -0
- /package/dist/{esm/src/models → models}/service.js +0 -0
- /package/dist/{types/src/patterns.d.ts → patterns.d.ts} +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/latest.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v1.0.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v1.0.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.0.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.0.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.1.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.1.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.10.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.10.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.11.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.11.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.12.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.12.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.12.1.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.12.1.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.12.2.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.12.2.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.12.3.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.12.3.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.13.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.13.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.13.1.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.13.1.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.14.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.14.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.15.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.15.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.16.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.16.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.17.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.17.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.17.1.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.17.1.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.18.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.18.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.18.1.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.18.1.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.18.2.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.18.2.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.19.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.19.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.2.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.2.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.20.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.20.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.21.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.21.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.22.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.22.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.23.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.23.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.24.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.24.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.25.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.25.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.26.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.26.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.27.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.27.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.28.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.28.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.29.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.29.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.3.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.3.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.30.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.30.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.31.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.31.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.32.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.32.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.33.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.33.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.34.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.34.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.35.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.35.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.36.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.36.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.37.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.37.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.38.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.38.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.39.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.39.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.4.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.4.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.40.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.40.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.41.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.41.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.42.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.42.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.43.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.43.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.44.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.44.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.45.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.45.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.46.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.46.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.47.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.47.0.js +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.48.0.js +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.49.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.5.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.5.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.5.1.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.5.1.js +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.50.0.js +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.51.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.6.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.6.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.7.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.7.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.8.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.8.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v3.9.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v3.9.0.js +0 -0
- /package/dist/{types/src/project-schema → project-schema}/v4.0.0.d.ts +0 -0
- /package/dist/{esm/src/project-schema → project-schema}/v4.0.0.js +0 -0
- /package/dist/{types/src/scalars.d.ts → scalars.d.ts} +0 -0
- /package/dist/{esm/src/scalars.js → scalars.js} +0 -0
- /package/dist/{types/src/schemas → schemas}/index.d.ts +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/latest.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/meta-schema-v1.0.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/meta-schema-v3.0.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/meta-schema-v3.1.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/meta-schema-v3.2.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/meta-schema-v3.3.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/meta-schema-v3.4.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/meta-schema-v3.5.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/meta-schema-v3.5.1.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/meta-schema-v3.6.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/meta-schema-v3.7.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/meta-schema-v3.8.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/meta-schema-v3.9.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v1.0.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.0.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.1.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.10.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.11.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.12.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.12.1.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.12.2.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.12.3.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.13.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.14.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.15.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.16.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.17.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.17.1.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.18.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.18.1.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.18.2.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.19.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.2.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.20.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.21.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.22.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.23.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.24.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.25.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.26.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.27.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.28.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.29.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.3.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.30.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.31.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.32.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.33.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.34.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.35.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.36.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.37.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.38.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.39.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.4.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.40.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.41.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.42.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.43.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.44.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.45.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.46.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.47.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.48.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.49.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.5.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.5.1.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.50.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.51.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.6.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.7.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.8.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v3.9.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema/v4.0.0.json +0 -0
- /package/dist/{cjs/src/schemas → schemas}/project-schema.json +0 -0
- /package/dist/{types/src/services → services}/types.d.ts +0 -0
- /package/dist/{esm/src/services → services}/util.js +0 -0
- /package/dist/{esm/src/template-shapes → template-shapes}/index.js +0 -0
- /package/dist/{esm/src/template-shapes → template-shapes}/names.js +0 -0
- /package/dist/{esm/src/template-shapes → template-shapes}/types.js +0 -0
- /package/dist/{esm/src/types → types}/types.js +0 -0
- /package/dist/{esm/src/util → util}/ai-tools.js +0 -0
- /package/dist/{esm/src/util → util}/find-shape-at-path.js +0 -0
- /package/dist/{esm/src/util → util}/patch-schema.js +0 -0
- /package/dist/{esm/src/util → util}/shapes.js +0 -0
|
@@ -0,0 +1,1731 @@
|
|
|
1
|
+
import massiveSchemaJson from '@/examples/latest/massive-schema.json';
|
|
2
|
+
import postSchemaJson from '@/examples/latest/post-schema.json';
|
|
3
|
+
import shopifySchema202207 from '@/examples/latest/shopify-product-2022-07.json';
|
|
4
|
+
import shopifyStoreJson from '@/examples/latest/shopify-store-with-widget.json';
|
|
5
|
+
import stripeStarterResolvedJson from '@/examples/latest/stripe-starter-resolved.json';
|
|
6
|
+
import shopifyLayer202301 from '@/examples/source/layers/shopify-layer-2023-01.json';
|
|
7
|
+
import { deepClone } from '@takeshape/util';
|
|
8
|
+
import cloneDeep from 'lodash/cloneDeep.js';
|
|
9
|
+
import get from 'lodash/get.js';
|
|
10
|
+
import keyBy from 'lodash/keyBy.js';
|
|
11
|
+
import pick from 'lodash/pick.js';
|
|
12
|
+
import pickBy from 'lodash/pickBy.js';
|
|
13
|
+
import { describe, expect, it, test, vi } from 'vitest';
|
|
14
|
+
import { createMockSchema } from "../mocks.js";
|
|
15
|
+
import { dereferenceObjectSchema } from "../refs.js";
|
|
16
|
+
import { BuiltInPropertiesProfile, applyBuiltinPropertiesToShape, applyDefaultsToSchema, createSchemaPropertyAccessor, createSchemaPropertyList, emptySchema, ensureMutationByShape, ensureQueryByShape, filterGraphQLServiceMap, getAllNamespaceShapes, getAllRefs, getAllRefsInShapes, getArgsShapeSchema, getBuiltInPropertyNames, getBuiltinsUsed, getDefaultMutationName, getModelBuiltInProperties, getNamespacedShapeNameList, getQueriesShape, getRelevantShapes, getServiceIdFieldName, getShapeByRef, getShapeDependencies, getShapesById, isBuiltInPropertyName, isBuiltinMutation, isBuiltinQuery, isBuiltinShape, isBuiltinType, pathBetween, projectSchemaToJSONSchema, schemaMatchesShapeName, shapeHasArrayPropOfShape, shapeToPropertySchema, visitSchemaProperties } from "../schema-util.js";
|
|
17
|
+
import { getServiceInfo } from "../services/services.js";
|
|
18
|
+
import { isModelShape, isObjectSchema } from "../types/index.js";
|
|
19
|
+
import { getShapeById } from "../util/shapes.js";
|
|
20
|
+
import { CURRENT_SCHEMA_VERSION } from "../versions.js";
|
|
21
|
+
import { defaultWorkflow } from "../workflows.js";
|
|
22
|
+
const stripeStarterResolved = stripeStarterResolvedJson;
|
|
23
|
+
const massiveSchema = applyDefaultsToSchema(massiveSchemaJson);
|
|
24
|
+
const shopifyStoreSchema = applyDefaultsToSchema(shopifyStoreJson);
|
|
25
|
+
const petStoreSchema = applyDefaultsToSchema({
|
|
26
|
+
...emptySchema('project-id'),
|
|
27
|
+
shapes: {
|
|
28
|
+
Cat: {
|
|
29
|
+
id: '-Mogf-9_z',
|
|
30
|
+
name: 'Cat',
|
|
31
|
+
title: 'Cat',
|
|
32
|
+
schema: {
|
|
33
|
+
type: 'object',
|
|
34
|
+
properties: {
|
|
35
|
+
name: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
minLength: 1,
|
|
38
|
+
description: '',
|
|
39
|
+
title: 'Name',
|
|
40
|
+
'@mapping': 'shapedb:Cat.yyBAR4pc9'
|
|
41
|
+
},
|
|
42
|
+
lives: {
|
|
43
|
+
type: 'integer',
|
|
44
|
+
minimum: 0,
|
|
45
|
+
'@l10n': false,
|
|
46
|
+
description: '',
|
|
47
|
+
title: 'Lives',
|
|
48
|
+
'@mapping': 'shapedb:Cat.xfIXJz_ye'
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
required: ['name']
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
Dog: {
|
|
55
|
+
id: 'xGTklNn3G',
|
|
56
|
+
name: 'Dog',
|
|
57
|
+
title: 'Dog',
|
|
58
|
+
schema: {
|
|
59
|
+
type: 'object',
|
|
60
|
+
properties: {
|
|
61
|
+
_shapeId: {
|
|
62
|
+
type: 'string'
|
|
63
|
+
},
|
|
64
|
+
name: {
|
|
65
|
+
type: 'string',
|
|
66
|
+
minLength: 1,
|
|
67
|
+
description: '',
|
|
68
|
+
title: 'Name',
|
|
69
|
+
'@mapping': 'shapedb:Dog.kcQs1FxBF'
|
|
70
|
+
},
|
|
71
|
+
isBestFriend: {
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
default: false,
|
|
74
|
+
'@l10n': false,
|
|
75
|
+
description: '',
|
|
76
|
+
title: 'Is Best Friend',
|
|
77
|
+
'@mapping': 'shapedb:Dog.uhNHuLVds'
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
required: ['name']
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
Homepage: {
|
|
84
|
+
id: 'AXb0RTnjB',
|
|
85
|
+
name: 'Homepage',
|
|
86
|
+
title: 'Homepage',
|
|
87
|
+
workflow: 'default',
|
|
88
|
+
model: { type: 'single' },
|
|
89
|
+
schema: {
|
|
90
|
+
type: 'object',
|
|
91
|
+
properties: {
|
|
92
|
+
pets: {
|
|
93
|
+
type: 'array',
|
|
94
|
+
items: { oneOf: [{ '@ref': 'local:Dog' }, { '@ref': 'local:Cat' }] }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
workflows: {},
|
|
101
|
+
forms: {}
|
|
102
|
+
});
|
|
103
|
+
function getPostSchema() {
|
|
104
|
+
return deepClone(postSchemaJson);
|
|
105
|
+
}
|
|
106
|
+
describe('isBuiltinShape', () => {
|
|
107
|
+
test('it works', () => {
|
|
108
|
+
expect(isBuiltinShape('TSRelationship')).toBe(true);
|
|
109
|
+
expect(isBuiltinShape('Post')).toBe(false);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
describe('isBuiltinType', () => {
|
|
113
|
+
test('it works', () => {
|
|
114
|
+
expect(isBuiltinType(shopifyStoreSchema, {
|
|
115
|
+
$ref: '#/shapes/TSRelationship/schema'
|
|
116
|
+
})).toBe(true);
|
|
117
|
+
expect(isBuiltinType(shopifyStoreSchema, { type: 'string' })).toBe(false);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
describe('isBuiltinQuery', () => {
|
|
121
|
+
test('it works', () => {
|
|
122
|
+
expect(isBuiltinQuery('getAsset')).toBe(true);
|
|
123
|
+
expect(isBuiltinQuery('getDog')).toBe(false);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
describe('isBuiltinMutation', () => {
|
|
127
|
+
test('it works', () => {
|
|
128
|
+
expect(isBuiltinMutation('updateAsset')).toBe(true);
|
|
129
|
+
expect(isBuiltinMutation('updateDog')).toBe(false);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
describe('getShapeById', () => {
|
|
133
|
+
test('it works', () => {
|
|
134
|
+
const postSchema = getPostSchema();
|
|
135
|
+
const shape = postSchema.shapes.Post;
|
|
136
|
+
const shapeId = shape.id;
|
|
137
|
+
expect(getShapeById(postSchema, shapeId)).toEqual(shape);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
describe('getShapeByRef', () => {
|
|
141
|
+
test('it works', () => {
|
|
142
|
+
const postSchema = getPostSchema();
|
|
143
|
+
const shape = postSchema.shapes.Post;
|
|
144
|
+
expect(getShapeByRef(postSchema, 'local:Post')).toEqual(shape);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
describe('applyBuiltInPropertiesToShape', () => {
|
|
148
|
+
test('model shape props applied', () => {
|
|
149
|
+
const projectSchema = getPostSchema();
|
|
150
|
+
const shape = projectSchema.shapes.Post;
|
|
151
|
+
expect(applyBuiltinPropertiesToShape(projectSchema, shape)).toMatchObject({
|
|
152
|
+
...shape,
|
|
153
|
+
schema: {
|
|
154
|
+
...shape.schema,
|
|
155
|
+
properties: {
|
|
156
|
+
...dereferenceObjectSchema(projectSchema, shape.schema).properties,
|
|
157
|
+
...getModelBuiltInProperties(projectSchema, shape),
|
|
158
|
+
_status: {
|
|
159
|
+
type: 'string',
|
|
160
|
+
title: 'Status',
|
|
161
|
+
'@workflow': 'default'
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
test('cached shape props applied', () => {
|
|
168
|
+
const projectSchema = {
|
|
169
|
+
...shopifyLayer202301,
|
|
170
|
+
services: {
|
|
171
|
+
shopify: {
|
|
172
|
+
id: 'shopify',
|
|
173
|
+
provider: 'shopify',
|
|
174
|
+
title: 'Shopify',
|
|
175
|
+
namespace: 'Shopify',
|
|
176
|
+
serviceType: 'graphql',
|
|
177
|
+
authenticationType: 'custom',
|
|
178
|
+
options: {
|
|
179
|
+
shop: 'andrews-takeshape-store',
|
|
180
|
+
endpoint: 'https://andrews-takeshape-store.myshopify.com/admin/api/2023-01/graphql.json'
|
|
181
|
+
},
|
|
182
|
+
authentication: 'secret'
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
// Enable cache
|
|
187
|
+
const shape = cloneDeep(shopifyLayer202301.shapes.Shopify_Product);
|
|
188
|
+
shape.cache = { enabled: true };
|
|
189
|
+
shape.loaders = { list: { query: 'shopify:Query.products' } };
|
|
190
|
+
const schema = applyBuiltinPropertiesToShape(projectSchema, shape).schema;
|
|
191
|
+
expect(pickBy(schema.properties, (_, key) => key.startsWith('_'))).toEqual({
|
|
192
|
+
_id: {
|
|
193
|
+
'@mapping': 'shopify:Product.id',
|
|
194
|
+
title: 'Id',
|
|
195
|
+
type: 'string'
|
|
196
|
+
},
|
|
197
|
+
_shapeId: {
|
|
198
|
+
enum: ['Shopify_Product'],
|
|
199
|
+
title: 'Shape Id',
|
|
200
|
+
type: 'string'
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
test('cached shape props applied preserves custom mapping', () => {
|
|
205
|
+
const shape = {
|
|
206
|
+
name: 'Salsify_Product',
|
|
207
|
+
id: 'Salsify_Product',
|
|
208
|
+
title: 'Salsify_Product',
|
|
209
|
+
cache: { enabled: true },
|
|
210
|
+
loaders: { list: { query: 'shopify:Query.products' } },
|
|
211
|
+
schema: {
|
|
212
|
+
properties: {
|
|
213
|
+
id: {
|
|
214
|
+
type: 'string',
|
|
215
|
+
'@mapping': 'salsify:Product.salsify%3Aid'
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
type: 'object'
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const projectSchema = createMockSchema('project-id', {
|
|
222
|
+
shapes: {
|
|
223
|
+
Salisify_Product: shape
|
|
224
|
+
},
|
|
225
|
+
services: {
|
|
226
|
+
salsify: {
|
|
227
|
+
id: 'salsify',
|
|
228
|
+
provider: 'salsify',
|
|
229
|
+
title: 'Salsify',
|
|
230
|
+
namespace: 'Salsify',
|
|
231
|
+
serviceType: 'rest',
|
|
232
|
+
authenticationType: 'bearer',
|
|
233
|
+
options: {
|
|
234
|
+
organizationId: 'organization-id',
|
|
235
|
+
channelId: 'channel-id',
|
|
236
|
+
endpoint: 'https://app.salsify.com/api/orgs/organization-id'
|
|
237
|
+
},
|
|
238
|
+
authentication: 'secret'
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
const schema = applyBuiltinPropertiesToShape(projectSchema, shape).schema;
|
|
243
|
+
expect(pickBy(schema.properties, (_, key) => key.startsWith('_'))).toEqual({
|
|
244
|
+
_id: {
|
|
245
|
+
'@mapping': 'salsify:Product.salsify%3Aid',
|
|
246
|
+
title: 'Id',
|
|
247
|
+
type: 'string'
|
|
248
|
+
},
|
|
249
|
+
_shapeId: {
|
|
250
|
+
enum: ['Salsify_Product'],
|
|
251
|
+
title: 'Shape Id',
|
|
252
|
+
type: 'string'
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
test('shape with extends schema', () => {
|
|
257
|
+
const projectSchema = getPostSchema();
|
|
258
|
+
const shape = {
|
|
259
|
+
...projectSchema.shapes.Post,
|
|
260
|
+
schema: {
|
|
261
|
+
extends: [
|
|
262
|
+
{
|
|
263
|
+
type: 'object',
|
|
264
|
+
properties: {
|
|
265
|
+
a: { type: 'string' }
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
type: 'object',
|
|
270
|
+
properties: {
|
|
271
|
+
b: { type: 'string' }
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
projectSchema.shapes.Post = shape;
|
|
278
|
+
expect(applyBuiltinPropertiesToShape(projectSchema, shape)).toEqual({
|
|
279
|
+
id: 'postContentTypeId',
|
|
280
|
+
name: 'Post',
|
|
281
|
+
title: 'Post',
|
|
282
|
+
model: {
|
|
283
|
+
type: 'multiple'
|
|
284
|
+
},
|
|
285
|
+
schema: {
|
|
286
|
+
type: 'object',
|
|
287
|
+
properties: expect.objectContaining({
|
|
288
|
+
_id: {
|
|
289
|
+
title: 'Id',
|
|
290
|
+
type: 'string'
|
|
291
|
+
},
|
|
292
|
+
a: {
|
|
293
|
+
type: 'string'
|
|
294
|
+
},
|
|
295
|
+
b: {
|
|
296
|
+
type: 'string'
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
describe('getBuiltInPropertyNames', () => {
|
|
304
|
+
test('default / model properties', () => {
|
|
305
|
+
expect(getBuiltInPropertyNames()).toMatchInlineSnapshot(`
|
|
306
|
+
Set {
|
|
307
|
+
"_id",
|
|
308
|
+
"_shapeId",
|
|
309
|
+
"_version",
|
|
310
|
+
"_shapeName",
|
|
311
|
+
"_createdAt",
|
|
312
|
+
"_createdBy",
|
|
313
|
+
"_updatedAt",
|
|
314
|
+
"_updatedBy",
|
|
315
|
+
"_schemaVersion",
|
|
316
|
+
"_enabled",
|
|
317
|
+
"_enabledAt",
|
|
318
|
+
"_status",
|
|
319
|
+
}
|
|
320
|
+
`);
|
|
321
|
+
});
|
|
322
|
+
test('cached properties', () => {
|
|
323
|
+
expect(getBuiltInPropertyNames(BuiltInPropertiesProfile.Cached)).toMatchInlineSnapshot(`
|
|
324
|
+
Set {
|
|
325
|
+
"_id",
|
|
326
|
+
"_shapeId",
|
|
327
|
+
}
|
|
328
|
+
`);
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
describe('isModelShape', () => {
|
|
332
|
+
test('TS source', () => {
|
|
333
|
+
const postSchema = getPostSchema();
|
|
334
|
+
const shape = postSchema.shapes.Post;
|
|
335
|
+
expect(isModelShape(shape)).toEqual(true);
|
|
336
|
+
});
|
|
337
|
+
test('foreign source', () => {
|
|
338
|
+
const shape = {
|
|
339
|
+
id: 'foreign-shape',
|
|
340
|
+
name: 'Foreign',
|
|
341
|
+
title: 'Foreign',
|
|
342
|
+
schema: {
|
|
343
|
+
type: 'object',
|
|
344
|
+
properties: {
|
|
345
|
+
price: {
|
|
346
|
+
type: 'string',
|
|
347
|
+
'@mapping': 'my-store:product.price'
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
expect(isModelShape(shape)).toBe(false);
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
describe('getBuiltinsUsed', () => {
|
|
356
|
+
test('post', () => {
|
|
357
|
+
expect(Object.keys(getBuiltinsUsed(getPostSchema()))).toEqual([
|
|
358
|
+
'Asset',
|
|
359
|
+
'TSRelationship',
|
|
360
|
+
'TSStaticSite',
|
|
361
|
+
'TSStaticSiteEnvironmentVariables',
|
|
362
|
+
'TSStaticSiteTriggers',
|
|
363
|
+
'TSUser',
|
|
364
|
+
'TSRelationshipArgs'
|
|
365
|
+
]);
|
|
366
|
+
});
|
|
367
|
+
test('massive', () => {
|
|
368
|
+
expect(Object.keys(getBuiltinsUsed(massiveSchema))).toEqual([
|
|
369
|
+
'Asset',
|
|
370
|
+
'TSRelationship',
|
|
371
|
+
'TSStaticSite',
|
|
372
|
+
'TSStaticSiteEnvironmentVariables',
|
|
373
|
+
'TSStaticSiteTriggers',
|
|
374
|
+
'TSUser',
|
|
375
|
+
'TSRelationshipArgs',
|
|
376
|
+
'TSColorHsl',
|
|
377
|
+
'TSColorHsv',
|
|
378
|
+
'TSColorRgb',
|
|
379
|
+
'TSColor'
|
|
380
|
+
]);
|
|
381
|
+
});
|
|
382
|
+
});
|
|
383
|
+
describe('applyDefaultsToSchema', () => {
|
|
384
|
+
test('it works', () => {
|
|
385
|
+
const postSchema = getPostSchema();
|
|
386
|
+
const projectSchema = getPostSchema();
|
|
387
|
+
const result = applyDefaultsToSchema(projectSchema);
|
|
388
|
+
expect(result.workflows).toMatchObject({ default: defaultWorkflow });
|
|
389
|
+
expect(dereferenceObjectSchema(projectSchema, result.shapes.Post.schema).properties).toEqual(expect.objectContaining(getModelBuiltInProperties(postSchema, result.shapes.Post)));
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
describe('applyDefaultsToSchema', () => {
|
|
393
|
+
test('merge built-in', () => {
|
|
394
|
+
const postSchema = getPostSchema();
|
|
395
|
+
const postSchemaWithAsset = {
|
|
396
|
+
...postSchema,
|
|
397
|
+
schemaVersion: CURRENT_SCHEMA_VERSION,
|
|
398
|
+
shapes: {
|
|
399
|
+
Asset: {
|
|
400
|
+
id: 'ASSET',
|
|
401
|
+
name: 'Asset',
|
|
402
|
+
title: 'Asset',
|
|
403
|
+
model: {
|
|
404
|
+
type: 'multiple'
|
|
405
|
+
},
|
|
406
|
+
schema: {
|
|
407
|
+
type: 'object',
|
|
408
|
+
properties: {
|
|
409
|
+
// With only filename and path this schema has removed some built-in fields
|
|
410
|
+
filename: {
|
|
411
|
+
type: 'string',
|
|
412
|
+
title: 'Filename',
|
|
413
|
+
'@l10n': false,
|
|
414
|
+
minLength: 1,
|
|
415
|
+
'@mapping': 'shapedb:Asset.H1oYQOM9'
|
|
416
|
+
},
|
|
417
|
+
path: {
|
|
418
|
+
type: 'string',
|
|
419
|
+
title: 'Path',
|
|
420
|
+
'@l10n': false,
|
|
421
|
+
minLength: 1,
|
|
422
|
+
'@mapping': 'shapedb:Asset.Hk6FQuz5'
|
|
423
|
+
},
|
|
424
|
+
// Override property type
|
|
425
|
+
description: {
|
|
426
|
+
type: 'object',
|
|
427
|
+
title: 'Description',
|
|
428
|
+
'@tag': 'draftjs',
|
|
429
|
+
'@mapping': 'shapedb:Asset.B1Zsra3fx'
|
|
430
|
+
},
|
|
431
|
+
// New custom field
|
|
432
|
+
tag: {
|
|
433
|
+
'@mapping': 'shapedb:Asset.tagsId',
|
|
434
|
+
type: 'array',
|
|
435
|
+
items: {
|
|
436
|
+
oneOf: [
|
|
437
|
+
{
|
|
438
|
+
'@ref': 'local:Tag'
|
|
439
|
+
}
|
|
440
|
+
]
|
|
441
|
+
},
|
|
442
|
+
'@input': {
|
|
443
|
+
type: 'array',
|
|
444
|
+
items: {
|
|
445
|
+
'@ref': 'local:TSRelationship'
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
'@backreference': {
|
|
449
|
+
enabled: true,
|
|
450
|
+
name: 'firstTags'
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
required: ['filename', 'path', 'tags']
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
forms: {
|
|
459
|
+
Asset: {
|
|
460
|
+
default: {
|
|
461
|
+
order: ['filename', 'path', 'tags'],
|
|
462
|
+
properties: {
|
|
463
|
+
filename: {
|
|
464
|
+
widget: 'singleLineText'
|
|
465
|
+
},
|
|
466
|
+
path: {
|
|
467
|
+
widget: 'singleLineText'
|
|
468
|
+
},
|
|
469
|
+
tags: {
|
|
470
|
+
widget: 'relationship'
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
const result = applyDefaultsToSchema(postSchemaWithAsset);
|
|
478
|
+
const assetShape = {
|
|
479
|
+
id: 'ASSET',
|
|
480
|
+
name: 'Asset',
|
|
481
|
+
title: 'Asset',
|
|
482
|
+
model: {
|
|
483
|
+
type: 'multiple'
|
|
484
|
+
},
|
|
485
|
+
schema: {
|
|
486
|
+
type: 'object',
|
|
487
|
+
properties: {
|
|
488
|
+
filename: {
|
|
489
|
+
type: 'string',
|
|
490
|
+
title: 'Filename',
|
|
491
|
+
'@l10n': false,
|
|
492
|
+
minLength: 1,
|
|
493
|
+
'@mapping': 'shapedb:Asset.H1oYQOM9'
|
|
494
|
+
},
|
|
495
|
+
path: {
|
|
496
|
+
type: 'string',
|
|
497
|
+
title: 'Path',
|
|
498
|
+
'@l10n': false,
|
|
499
|
+
minLength: 1,
|
|
500
|
+
'@mapping': 'shapedb:Asset.Hk6FQuz5'
|
|
501
|
+
},
|
|
502
|
+
description: {
|
|
503
|
+
type: 'string',
|
|
504
|
+
title: 'Description',
|
|
505
|
+
'@mapping': 'shapedb:Asset.B1Zsra3fx',
|
|
506
|
+
'@l10n': true
|
|
507
|
+
},
|
|
508
|
+
tag: {
|
|
509
|
+
'@mapping': 'shapedb:Asset.tagsId',
|
|
510
|
+
type: 'array',
|
|
511
|
+
items: {
|
|
512
|
+
oneOf: [
|
|
513
|
+
{
|
|
514
|
+
'@ref': 'local:Tag'
|
|
515
|
+
}
|
|
516
|
+
]
|
|
517
|
+
},
|
|
518
|
+
'@input': {
|
|
519
|
+
type: 'array',
|
|
520
|
+
items: {
|
|
521
|
+
'@ref': 'local:TSRelationship'
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
'@backreference': {
|
|
525
|
+
enabled: true,
|
|
526
|
+
name: 'firstTags'
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
title: {
|
|
530
|
+
type: 'string',
|
|
531
|
+
title: 'Title',
|
|
532
|
+
'@mapping': 'shapedb:Asset.By5tQOMc',
|
|
533
|
+
'@l10n': true
|
|
534
|
+
},
|
|
535
|
+
caption: {
|
|
536
|
+
type: 'object',
|
|
537
|
+
title: 'Caption',
|
|
538
|
+
'@mapping': 'shapedb:Asset.SyWVsd98x',
|
|
539
|
+
'@tag': 'draftjs',
|
|
540
|
+
'@l10n': true
|
|
541
|
+
},
|
|
542
|
+
credit: {
|
|
543
|
+
type: 'object',
|
|
544
|
+
title: 'Credit',
|
|
545
|
+
'@mapping': 'shapedb:Asset.Skn_i_5Ll',
|
|
546
|
+
'@tag': 'draftjs',
|
|
547
|
+
'@l10n': true
|
|
548
|
+
},
|
|
549
|
+
mimeType: {
|
|
550
|
+
type: 'string',
|
|
551
|
+
title: 'MIME type',
|
|
552
|
+
'@l10n': false,
|
|
553
|
+
'@mapping': 'shapedb:Asset.SyCYX_Gq'
|
|
554
|
+
},
|
|
555
|
+
sourceUrl: {
|
|
556
|
+
type: 'string',
|
|
557
|
+
title: 'Source URL',
|
|
558
|
+
'@l10n': false,
|
|
559
|
+
'@mapping': 'shapedb:Asset.SJXSidnXE'
|
|
560
|
+
},
|
|
561
|
+
uploadStatus: {
|
|
562
|
+
type: 'string',
|
|
563
|
+
title: 'Upload status',
|
|
564
|
+
'@l10n': false,
|
|
565
|
+
'@mapping': 'shapedb:Asset.ByeAYXdG9'
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
expect(result.shapes.Asset).toEqual(applyBuiltinPropertiesToShape(postSchemaWithAsset, {
|
|
571
|
+
...assetShape,
|
|
572
|
+
schema: {
|
|
573
|
+
...assetShape.schema,
|
|
574
|
+
properties: {
|
|
575
|
+
...assetShape.schema.properties,
|
|
576
|
+
...getModelBuiltInProperties(postSchemaWithAsset, assetShape)
|
|
577
|
+
},
|
|
578
|
+
required: ['filename', 'path', 'tags']
|
|
579
|
+
}
|
|
580
|
+
}));
|
|
581
|
+
expect(result.forms?.Asset).toEqual({
|
|
582
|
+
default: {
|
|
583
|
+
order: [
|
|
584
|
+
'filename',
|
|
585
|
+
'path',
|
|
586
|
+
'tags',
|
|
587
|
+
'title',
|
|
588
|
+
'description',
|
|
589
|
+
'caption',
|
|
590
|
+
'credit',
|
|
591
|
+
'mimeType',
|
|
592
|
+
'sourceUrl',
|
|
593
|
+
'uploadStatus'
|
|
594
|
+
],
|
|
595
|
+
properties: {
|
|
596
|
+
filename: {
|
|
597
|
+
widget: 'singleLineText'
|
|
598
|
+
},
|
|
599
|
+
path: {
|
|
600
|
+
widget: 'singleLineText'
|
|
601
|
+
},
|
|
602
|
+
tags: {
|
|
603
|
+
widget: 'relationship'
|
|
604
|
+
},
|
|
605
|
+
title: {
|
|
606
|
+
widget: 'singleLineText'
|
|
607
|
+
},
|
|
608
|
+
description: {
|
|
609
|
+
widget: 'paragraphText'
|
|
610
|
+
},
|
|
611
|
+
caption: {
|
|
612
|
+
widget: 'wysiwygSingleLineText'
|
|
613
|
+
},
|
|
614
|
+
credit: {
|
|
615
|
+
widget: 'wysiwygSingleLineText'
|
|
616
|
+
},
|
|
617
|
+
mimeType: {
|
|
618
|
+
widget: 'singleLineText'
|
|
619
|
+
},
|
|
620
|
+
sourceUrl: {
|
|
621
|
+
widget: 'singleLineText'
|
|
622
|
+
},
|
|
623
|
+
uploadStatus: {
|
|
624
|
+
widget: 'singleLineText'
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
});
|
|
630
|
+
});
|
|
631
|
+
describe('shapeToPropertySchema', () => {
|
|
632
|
+
test('it works', () => {
|
|
633
|
+
const propertySchema = shapeToPropertySchema(massiveSchema, massiveSchema.shapes.AboutPage);
|
|
634
|
+
expect(propertySchema).toMatchSnapshot();
|
|
635
|
+
});
|
|
636
|
+
test('workflow validation', () => {
|
|
637
|
+
const projectSchema = applyDefaultsToSchema(getPostSchema());
|
|
638
|
+
const propertySchema = shapeToPropertySchema(projectSchema, projectSchema.shapes.Post);
|
|
639
|
+
const objectSchema = dereferenceObjectSchema(projectSchema, projectSchema.shapes.Post.schema);
|
|
640
|
+
expect(objectSchema.properties._status.oneOf).toBeUndefined();
|
|
641
|
+
expect(propertySchema.properties?._status.oneOf).toEqual([
|
|
642
|
+
{
|
|
643
|
+
enum: ['r1uCfi4ZL', 'disabled'],
|
|
644
|
+
title: 'Disabled'
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
enum: ['rkhRGs4WL', 'enabled'],
|
|
648
|
+
title: 'Enabled'
|
|
649
|
+
}
|
|
650
|
+
]);
|
|
651
|
+
});
|
|
652
|
+
test('oneOf discriminator ', () => {
|
|
653
|
+
const propertySchema = shapeToPropertySchema(petStoreSchema, petStoreSchema.shapes.Homepage);
|
|
654
|
+
expect(propertySchema).toEqual({
|
|
655
|
+
type: 'object',
|
|
656
|
+
title: 'Homepage',
|
|
657
|
+
properties: {
|
|
658
|
+
pets: {
|
|
659
|
+
type: 'array',
|
|
660
|
+
items: {
|
|
661
|
+
discriminator: {
|
|
662
|
+
propertyName: '_shapeId'
|
|
663
|
+
},
|
|
664
|
+
oneOf: [
|
|
665
|
+
{
|
|
666
|
+
$ref: '#/definitions/Dog'
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
$ref: '#/definitions/Cat'
|
|
670
|
+
}
|
|
671
|
+
],
|
|
672
|
+
required: ['_shapeId']
|
|
673
|
+
}
|
|
674
|
+
},
|
|
675
|
+
_id: {
|
|
676
|
+
title: 'Id',
|
|
677
|
+
type: 'string'
|
|
678
|
+
},
|
|
679
|
+
_version: {
|
|
680
|
+
title: 'Version',
|
|
681
|
+
type: 'integer'
|
|
682
|
+
},
|
|
683
|
+
_shapeId: {
|
|
684
|
+
enum: ['AXb0RTnjB'],
|
|
685
|
+
title: 'Shape Id',
|
|
686
|
+
type: 'string'
|
|
687
|
+
},
|
|
688
|
+
_shapeName: {
|
|
689
|
+
title: 'Shape Name',
|
|
690
|
+
type: 'string'
|
|
691
|
+
},
|
|
692
|
+
_createdAt: {
|
|
693
|
+
title: 'Created',
|
|
694
|
+
type: 'string',
|
|
695
|
+
format: 'date-time'
|
|
696
|
+
},
|
|
697
|
+
_createdBy: {
|
|
698
|
+
title: 'Created By',
|
|
699
|
+
$ref: '#/definitions/TSUser',
|
|
700
|
+
'@input': {
|
|
701
|
+
type: 'string'
|
|
702
|
+
},
|
|
703
|
+
'@resolver': {
|
|
704
|
+
name: 'takeshape:getUser',
|
|
705
|
+
service: 'takeshape'
|
|
706
|
+
}
|
|
707
|
+
},
|
|
708
|
+
_updatedAt: {
|
|
709
|
+
title: 'Updated',
|
|
710
|
+
type: 'string',
|
|
711
|
+
format: 'date-time'
|
|
712
|
+
},
|
|
713
|
+
_updatedBy: {
|
|
714
|
+
title: 'Updated By',
|
|
715
|
+
$ref: '#/definitions/TSUser',
|
|
716
|
+
'@input': {
|
|
717
|
+
type: 'string'
|
|
718
|
+
},
|
|
719
|
+
'@resolver': {
|
|
720
|
+
name: 'takeshape:getUser',
|
|
721
|
+
service: 'takeshape'
|
|
722
|
+
}
|
|
723
|
+
},
|
|
724
|
+
_schemaVersion: {
|
|
725
|
+
title: 'Schema Version',
|
|
726
|
+
type: 'number'
|
|
727
|
+
},
|
|
728
|
+
_enabled: {
|
|
729
|
+
title: 'Enabled',
|
|
730
|
+
type: 'boolean',
|
|
731
|
+
'@deprecationReason': 'Use _status instead'
|
|
732
|
+
},
|
|
733
|
+
_enabledAt: {
|
|
734
|
+
title: 'Enabled Date',
|
|
735
|
+
type: 'string',
|
|
736
|
+
format: 'date-time',
|
|
737
|
+
'@deprecationReason': 'Use a custom date field instead'
|
|
738
|
+
},
|
|
739
|
+
_status: {
|
|
740
|
+
type: 'string',
|
|
741
|
+
title: 'Status',
|
|
742
|
+
'@workflow': 'default',
|
|
743
|
+
oneOf: [
|
|
744
|
+
{
|
|
745
|
+
enum: ['r1uCfi4ZL', 'disabled'],
|
|
746
|
+
title: 'Disabled'
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
enum: ['rkhRGs4WL', 'enabled'],
|
|
750
|
+
title: 'Enabled'
|
|
751
|
+
}
|
|
752
|
+
]
|
|
753
|
+
}
|
|
754
|
+
},
|
|
755
|
+
definitions: {
|
|
756
|
+
Dog: {
|
|
757
|
+
title: 'Dog',
|
|
758
|
+
type: 'object',
|
|
759
|
+
properties: {
|
|
760
|
+
name: {
|
|
761
|
+
type: 'string',
|
|
762
|
+
minLength: 1,
|
|
763
|
+
description: '',
|
|
764
|
+
title: 'Name',
|
|
765
|
+
'@mapping': 'shapedb:Dog.kcQs1FxBF'
|
|
766
|
+
},
|
|
767
|
+
isBestFriend: {
|
|
768
|
+
type: 'boolean',
|
|
769
|
+
default: false,
|
|
770
|
+
'@l10n': false,
|
|
771
|
+
description: '',
|
|
772
|
+
title: 'Is Best Friend',
|
|
773
|
+
'@mapping': 'shapedb:Dog.uhNHuLVds'
|
|
774
|
+
},
|
|
775
|
+
_shapeId: {
|
|
776
|
+
type: 'string',
|
|
777
|
+
enum: ['xGTklNn3G']
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
required: ['name']
|
|
781
|
+
},
|
|
782
|
+
Cat: {
|
|
783
|
+
title: 'Cat',
|
|
784
|
+
type: 'object',
|
|
785
|
+
properties: {
|
|
786
|
+
name: {
|
|
787
|
+
type: 'string',
|
|
788
|
+
minLength: 1,
|
|
789
|
+
description: '',
|
|
790
|
+
title: 'Name',
|
|
791
|
+
'@mapping': 'shapedb:Cat.yyBAR4pc9'
|
|
792
|
+
},
|
|
793
|
+
lives: {
|
|
794
|
+
type: 'integer',
|
|
795
|
+
minimum: 0,
|
|
796
|
+
'@l10n': false,
|
|
797
|
+
description: '',
|
|
798
|
+
title: 'Lives',
|
|
799
|
+
'@mapping': 'shapedb:Cat.xfIXJz_ye'
|
|
800
|
+
},
|
|
801
|
+
_shapeId: {
|
|
802
|
+
type: 'string',
|
|
803
|
+
enum: ['-Mogf-9_z']
|
|
804
|
+
}
|
|
805
|
+
},
|
|
806
|
+
required: ['name']
|
|
807
|
+
},
|
|
808
|
+
TSUser: {
|
|
809
|
+
type: 'object',
|
|
810
|
+
title: 'TSUser',
|
|
811
|
+
properties: {
|
|
812
|
+
_shapeId: {
|
|
813
|
+
enum: ['TSUser'],
|
|
814
|
+
type: 'string'
|
|
815
|
+
},
|
|
816
|
+
avatarPath: {
|
|
817
|
+
type: 'string'
|
|
818
|
+
},
|
|
819
|
+
email: {
|
|
820
|
+
type: 'string'
|
|
821
|
+
},
|
|
822
|
+
fullName: {
|
|
823
|
+
type: 'string'
|
|
824
|
+
},
|
|
825
|
+
id: {
|
|
826
|
+
type: 'string'
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
required: ['id', 'email', 'fullName']
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
});
|
|
834
|
+
test('enum shape ', () => {
|
|
835
|
+
const schema = getPostSchema();
|
|
836
|
+
schema.shapes.EnumHaver = {
|
|
837
|
+
id: 'EnumHaver',
|
|
838
|
+
title: 'EnumHaver',
|
|
839
|
+
name: 'EnumHaver',
|
|
840
|
+
description: 'EnumHaver',
|
|
841
|
+
schema: {
|
|
842
|
+
type: 'object',
|
|
843
|
+
properties: {
|
|
844
|
+
value: {
|
|
845
|
+
'@mapping': 'gregs-takeshape-store:EnumHaver.value',
|
|
846
|
+
'@ref': 'self:EnumValue',
|
|
847
|
+
description: 'My value'
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
schema.shapes.EnumValue = {
|
|
853
|
+
id: 'EnumValue',
|
|
854
|
+
title: 'EnumValue',
|
|
855
|
+
name: 'EnumValue',
|
|
856
|
+
description: 'EnumValue',
|
|
857
|
+
schema: {
|
|
858
|
+
enum: ['RED', 'BLUE', 'PURPLE']
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
const propertySchema = shapeToPropertySchema(schema, schema.shapes.EnumHaver);
|
|
862
|
+
expect(propertySchema).toEqual({
|
|
863
|
+
type: 'object',
|
|
864
|
+
title: 'EnumHaver',
|
|
865
|
+
definitions: {
|
|
866
|
+
EnumValue: {
|
|
867
|
+
enum: ['RED', 'BLUE', 'PURPLE']
|
|
868
|
+
}
|
|
869
|
+
},
|
|
870
|
+
properties: {
|
|
871
|
+
value: {
|
|
872
|
+
$ref: '#/definitions/EnumValue',
|
|
873
|
+
'@mapping': 'gregs-takeshape-store:EnumHaver.value',
|
|
874
|
+
description: 'My value'
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
});
|
|
879
|
+
});
|
|
880
|
+
describe('projectSchemaToJSONSchema', () => {
|
|
881
|
+
test('it works', () => {
|
|
882
|
+
const { definitions } = projectSchemaToJSONSchema(petStoreSchema);
|
|
883
|
+
expect(Object.keys(definitions).sort()).toEqual(Object.keys(petStoreSchema.shapes).sort());
|
|
884
|
+
});
|
|
885
|
+
test('oneOf shape', () => {
|
|
886
|
+
const projectSchema = {
|
|
887
|
+
...petStoreSchema,
|
|
888
|
+
shapes: {
|
|
889
|
+
...petStoreSchema.shapes,
|
|
890
|
+
Homepage: {
|
|
891
|
+
id: 'AXb0RTnjB',
|
|
892
|
+
name: 'Homepage',
|
|
893
|
+
title: 'Homepage',
|
|
894
|
+
workflow: 'default',
|
|
895
|
+
model: { type: 'single' },
|
|
896
|
+
schema: {
|
|
897
|
+
oneOf: [{ '@ref': 'local:Dog' }, { '@ref': 'local:Cat' }]
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
const jsonSchema = projectSchemaToJSONSchema(projectSchema);
|
|
903
|
+
expect(jsonSchema.definitions.Homepage).toMatchInlineSnapshot(`
|
|
904
|
+
{
|
|
905
|
+
"oneOf": [
|
|
906
|
+
{
|
|
907
|
+
"$ref": "#/definitions/Dog",
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
"$ref": "#/definitions/Cat",
|
|
911
|
+
},
|
|
912
|
+
],
|
|
913
|
+
}
|
|
914
|
+
`);
|
|
915
|
+
});
|
|
916
|
+
});
|
|
917
|
+
describe('getShapeDependencies', () => {
|
|
918
|
+
test('it works', () => {
|
|
919
|
+
const actual = getShapeDependencies(massiveSchema, massiveSchema.shapes.AboutPage);
|
|
920
|
+
expect(actual.sort()).toEqual([
|
|
921
|
+
'AboutPagePartnerGroups',
|
|
922
|
+
'AboutPageStaff',
|
|
923
|
+
'Asset',
|
|
924
|
+
'Field',
|
|
925
|
+
'Institution',
|
|
926
|
+
'InstitutionSocial',
|
|
927
|
+
'Partner',
|
|
928
|
+
'Person',
|
|
929
|
+
'TSUser',
|
|
930
|
+
'Tag'
|
|
931
|
+
]);
|
|
932
|
+
});
|
|
933
|
+
test('oneOf', () => {
|
|
934
|
+
const actual = getShapeDependencies(petStoreSchema, petStoreSchema.shapes.Homepage);
|
|
935
|
+
expect(actual.sort()).toEqual(['Cat', 'Dog', 'TSUser']);
|
|
936
|
+
});
|
|
937
|
+
});
|
|
938
|
+
describe('getRelevantShapes', () => {
|
|
939
|
+
test('it works', () => {
|
|
940
|
+
const actual = getRelevantShapes(massiveSchema, {
|
|
941
|
+
shapeNames: ['AboutPage']
|
|
942
|
+
});
|
|
943
|
+
expect(actual).toEqual(pick(massiveSchema.shapes, [
|
|
944
|
+
'AboutPage',
|
|
945
|
+
'AboutPagePartnerGroups',
|
|
946
|
+
'AboutPageStaff',
|
|
947
|
+
'Asset',
|
|
948
|
+
'Field',
|
|
949
|
+
'Institution',
|
|
950
|
+
'InstitutionSocial',
|
|
951
|
+
'Partner',
|
|
952
|
+
'Person',
|
|
953
|
+
'TSUser',
|
|
954
|
+
'Tag'
|
|
955
|
+
]));
|
|
956
|
+
});
|
|
957
|
+
test('includeDependencies: false', () => {
|
|
958
|
+
const actual = getRelevantShapes(massiveSchema, {
|
|
959
|
+
shapeNames: ['AboutPage'],
|
|
960
|
+
includeDependencies: false
|
|
961
|
+
});
|
|
962
|
+
expect(actual).toEqual(pick(massiveSchema.shapes, ['AboutPage']));
|
|
963
|
+
});
|
|
964
|
+
test('byId', () => {
|
|
965
|
+
const actual = getRelevantShapes(massiveSchema, {
|
|
966
|
+
shapeNames: ['AboutPage'],
|
|
967
|
+
byId: true
|
|
968
|
+
});
|
|
969
|
+
const shapesById = keyBy(massiveSchema.shapes, 'id');
|
|
970
|
+
expect(actual).toEqual(pick(shapesById, [
|
|
971
|
+
'ASSET',
|
|
972
|
+
'B1qlk4qjf',
|
|
973
|
+
'HkxZBVcoG',
|
|
974
|
+
'ByJqVEcjG',
|
|
975
|
+
'HJKRv2oKe',
|
|
976
|
+
'SyUu3bgTe',
|
|
977
|
+
'r1a9-NCYx',
|
|
978
|
+
'rkfMnju1-',
|
|
979
|
+
'rkzZb6QWE',
|
|
980
|
+
'ryuQTWgTl',
|
|
981
|
+
'TSUser'
|
|
982
|
+
]));
|
|
983
|
+
});
|
|
984
|
+
test('empty', () => {
|
|
985
|
+
const actual = getRelevantShapes(massiveSchema, {});
|
|
986
|
+
expect(actual).toEqual({});
|
|
987
|
+
});
|
|
988
|
+
});
|
|
989
|
+
describe('getServiceInfo', () => {
|
|
990
|
+
test('success, no generator version in schema', () => {
|
|
991
|
+
const schema = cloneDeep(shopifyStoreSchema);
|
|
992
|
+
schema.shapes.Product.schema.properties.gregsTakeshapeStore['@tag'] = undefined;
|
|
993
|
+
expect(getServiceInfo(schema, schema.shapes.Product)).toEqual({
|
|
994
|
+
shopify: [
|
|
995
|
+
{
|
|
996
|
+
service: 'gregs-takeshape-store',
|
|
997
|
+
fieldName: 'gregsTakeshapeStore',
|
|
998
|
+
path: [],
|
|
999
|
+
generators: {}
|
|
1000
|
+
}
|
|
1001
|
+
]
|
|
1002
|
+
});
|
|
1003
|
+
});
|
|
1004
|
+
test('success, existing generator version in schema', () => {
|
|
1005
|
+
const schema = cloneDeep(shopifyStoreSchema);
|
|
1006
|
+
schema.shapes.Product.schema.properties.gregsTakeshapeStore['@tag'] =
|
|
1007
|
+
'pattern:service-object:1';
|
|
1008
|
+
expect(getServiceInfo(schema, schema.shapes.Product)).toEqual({
|
|
1009
|
+
shopify: [
|
|
1010
|
+
{
|
|
1011
|
+
service: 'gregs-takeshape-store',
|
|
1012
|
+
fieldName: 'gregsTakeshapeStore',
|
|
1013
|
+
path: [],
|
|
1014
|
+
generators: {
|
|
1015
|
+
'pattern:service-object': {
|
|
1016
|
+
currentVersion: '1',
|
|
1017
|
+
idFieldName: 'gregsTakeshapeStoreId',
|
|
1018
|
+
serviceObjectType: 'product',
|
|
1019
|
+
version: '1'
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
]
|
|
1024
|
+
});
|
|
1025
|
+
});
|
|
1026
|
+
test('none found', () => {
|
|
1027
|
+
expect(getServiceInfo(massiveSchema, massiveSchema.shapes.Article)).toEqual({});
|
|
1028
|
+
});
|
|
1029
|
+
test('multiple fields found', () => {
|
|
1030
|
+
const projectSchema = deepClone(shopifyStoreSchema);
|
|
1031
|
+
const shapeSchema = dereferenceObjectSchema(projectSchema, projectSchema.shapes.Product.schema);
|
|
1032
|
+
shapeSchema.properties = {
|
|
1033
|
+
...shapeSchema.properties,
|
|
1034
|
+
andrewsTakeshapeStore: shapeSchema.properties.gregsTakeshapeStore,
|
|
1035
|
+
andrewsTakeshapeStoreId: shapeSchema.properties.gregsTakeshapeStoreId
|
|
1036
|
+
};
|
|
1037
|
+
expect(getServiceInfo(projectSchema, projectSchema.shapes.Product)).toEqual({
|
|
1038
|
+
shopify: [
|
|
1039
|
+
{
|
|
1040
|
+
fieldName: 'gregsTakeshapeStore',
|
|
1041
|
+
generators: {
|
|
1042
|
+
'pattern:service-object': {
|
|
1043
|
+
currentVersion: '1',
|
|
1044
|
+
idFieldName: 'gregsTakeshapeStoreId',
|
|
1045
|
+
serviceObjectType: 'product',
|
|
1046
|
+
version: '1'
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
path: [],
|
|
1050
|
+
service: 'gregs-takeshape-store'
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
fieldName: 'andrewsTakeshapeStore',
|
|
1054
|
+
generators: {
|
|
1055
|
+
'pattern:service-object': {
|
|
1056
|
+
currentVersion: '1',
|
|
1057
|
+
idFieldName: 'andrewsTakeshapeStoreId',
|
|
1058
|
+
serviceObjectType: 'product',
|
|
1059
|
+
version: '1'
|
|
1060
|
+
}
|
|
1061
|
+
},
|
|
1062
|
+
path: [],
|
|
1063
|
+
service: 'gregs-takeshape-store'
|
|
1064
|
+
}
|
|
1065
|
+
]
|
|
1066
|
+
});
|
|
1067
|
+
});
|
|
1068
|
+
test('dedupes two way reference', () => {
|
|
1069
|
+
const projectSchema = deepClone(shopifyStoreSchema);
|
|
1070
|
+
projectSchema.shapes.Shopify_Product.schema.properties.takeshapeProduct = {
|
|
1071
|
+
'@ref': 'local:Product',
|
|
1072
|
+
'@resolver': {
|
|
1073
|
+
name: 'shapedb:find',
|
|
1074
|
+
service: 'shapedb',
|
|
1075
|
+
shapeName: 'Product',
|
|
1076
|
+
argsMapping: {
|
|
1077
|
+
'where.shopifyProductId.eq': [['get', { path: 'source.id' }]]
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
expect(getServiceInfo(projectSchema, projectSchema.shapes.Product)).toEqual({
|
|
1082
|
+
shopify: [
|
|
1083
|
+
{
|
|
1084
|
+
fieldName: 'gregsTakeshapeStore',
|
|
1085
|
+
generators: {
|
|
1086
|
+
'pattern:service-object': {
|
|
1087
|
+
currentVersion: '1',
|
|
1088
|
+
idFieldName: 'gregsTakeshapeStoreId',
|
|
1089
|
+
serviceObjectType: 'product',
|
|
1090
|
+
version: '1'
|
|
1091
|
+
}
|
|
1092
|
+
},
|
|
1093
|
+
path: [],
|
|
1094
|
+
service: 'gregs-takeshape-store'
|
|
1095
|
+
}
|
|
1096
|
+
]
|
|
1097
|
+
});
|
|
1098
|
+
});
|
|
1099
|
+
test('stripe starter - inline object with oneOf', () => {
|
|
1100
|
+
const projectSchema = deepClone(stripeStarterResolved);
|
|
1101
|
+
expect(getServiceInfo(projectSchema, projectSchema.shapes.Profile)).toEqual({
|
|
1102
|
+
stripe: [
|
|
1103
|
+
{
|
|
1104
|
+
fieldName: 'stripeCustomer',
|
|
1105
|
+
generators: {},
|
|
1106
|
+
path: [],
|
|
1107
|
+
service: 'stripe'
|
|
1108
|
+
}
|
|
1109
|
+
]
|
|
1110
|
+
});
|
|
1111
|
+
});
|
|
1112
|
+
test('penny - does not follow oneOf relationship', () => {
|
|
1113
|
+
const projectSchema = createMockSchema('project-id', {
|
|
1114
|
+
shapes: {
|
|
1115
|
+
Navigation: {
|
|
1116
|
+
id: 'Go7s7M7Ij',
|
|
1117
|
+
name: 'Navigation',
|
|
1118
|
+
title: 'Navigation',
|
|
1119
|
+
workflow: 'default',
|
|
1120
|
+
model: { type: 'single' },
|
|
1121
|
+
schema: {
|
|
1122
|
+
type: 'object',
|
|
1123
|
+
properties: {
|
|
1124
|
+
message: {
|
|
1125
|
+
type: 'object',
|
|
1126
|
+
'@tag': 'draftjs',
|
|
1127
|
+
description: '',
|
|
1128
|
+
title: 'Message',
|
|
1129
|
+
'@mapping': 'shapedb:Navigation.PL-G7Y5Vx'
|
|
1130
|
+
},
|
|
1131
|
+
sections: {
|
|
1132
|
+
title: 'Sections',
|
|
1133
|
+
description: '',
|
|
1134
|
+
items: { '@ref': 'local:NavigationSections' },
|
|
1135
|
+
type: 'array',
|
|
1136
|
+
'@mapping': 'shapedb:Navigation.yDgLbdGqy'
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
},
|
|
1141
|
+
NavigationSections: {
|
|
1142
|
+
id: 'yDgLbdGqy',
|
|
1143
|
+
name: 'NavigationSections',
|
|
1144
|
+
title: 'Navigation Sections',
|
|
1145
|
+
schema: {
|
|
1146
|
+
type: 'object',
|
|
1147
|
+
properties: {
|
|
1148
|
+
name: {
|
|
1149
|
+
minLength: 1,
|
|
1150
|
+
type: 'string',
|
|
1151
|
+
description: '',
|
|
1152
|
+
title: 'Name',
|
|
1153
|
+
'@mapping': 'shapedb:NavigationSections.epnGSC2k1'
|
|
1154
|
+
},
|
|
1155
|
+
link: {
|
|
1156
|
+
description: '',
|
|
1157
|
+
'@args': 'TSRelationshipArgs',
|
|
1158
|
+
'@resolver': {
|
|
1159
|
+
name: 'shapedb:getRelated',
|
|
1160
|
+
service: 'shapedb',
|
|
1161
|
+
options: { nullable: true }
|
|
1162
|
+
},
|
|
1163
|
+
oneOf: [{ '@ref': 'local:Product' }],
|
|
1164
|
+
'@input': { '@ref': 'local:TSRelationship' },
|
|
1165
|
+
title: 'Link',
|
|
1166
|
+
'@backreference': { enabled: false },
|
|
1167
|
+
'@mapping': 'shapedb:NavigationSections.u2cRNa3wf'
|
|
1168
|
+
}
|
|
1169
|
+
},
|
|
1170
|
+
required: ['name']
|
|
1171
|
+
}
|
|
1172
|
+
},
|
|
1173
|
+
Product: {
|
|
1174
|
+
id: 'oseWW7gAF',
|
|
1175
|
+
name: 'Product',
|
|
1176
|
+
title: 'Product',
|
|
1177
|
+
workflow: 'default',
|
|
1178
|
+
model: { type: 'multiple' },
|
|
1179
|
+
schema: {
|
|
1180
|
+
type: 'object',
|
|
1181
|
+
properties: {
|
|
1182
|
+
name: {
|
|
1183
|
+
type: 'string',
|
|
1184
|
+
description: 'Initialized with title from shopify',
|
|
1185
|
+
title: 'Name',
|
|
1186
|
+
'@mapping': 'shapedb:Product.O17SLDB3vK'
|
|
1187
|
+
},
|
|
1188
|
+
shopifyProductId: {
|
|
1189
|
+
type: 'string',
|
|
1190
|
+
'@mapping': 'shapedb:Product.shopifyProductId',
|
|
1191
|
+
title: 'shopify product',
|
|
1192
|
+
minLength: 1,
|
|
1193
|
+
pattern: '(^gid://shopify/Product/\\d+$)'
|
|
1194
|
+
},
|
|
1195
|
+
shopifyProduct: {
|
|
1196
|
+
'@ref': 'shopify:Product',
|
|
1197
|
+
'@resolver': {
|
|
1198
|
+
name: 'graphql:query',
|
|
1199
|
+
service: 'shopify',
|
|
1200
|
+
fieldName: 'product',
|
|
1201
|
+
args: {
|
|
1202
|
+
ops: [{ path: 'id', mapping: '$source.shopifyProductId' }]
|
|
1203
|
+
}
|
|
1204
|
+
},
|
|
1205
|
+
'@tag': 'pattern:service-object:1'
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
},
|
|
1211
|
+
services: {
|
|
1212
|
+
shopify: {
|
|
1213
|
+
id: 'shopify',
|
|
1214
|
+
title: 'Shopify',
|
|
1215
|
+
provider: 'shopify',
|
|
1216
|
+
serviceType: 'graphql',
|
|
1217
|
+
authenticationType: 'none'
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
});
|
|
1221
|
+
expect(getServiceInfo(projectSchema, projectSchema.shapes.Navigation)).toEqual({});
|
|
1222
|
+
});
|
|
1223
|
+
});
|
|
1224
|
+
describe('getServiceIdFieldName', () => {
|
|
1225
|
+
test('it works', () => {
|
|
1226
|
+
expect(getServiceIdFieldName('dog')).toBe('dogId');
|
|
1227
|
+
});
|
|
1228
|
+
});
|
|
1229
|
+
describe('getNamespacedShapeNameList', () => {
|
|
1230
|
+
test('it works', () => {
|
|
1231
|
+
const schema = {
|
|
1232
|
+
...emptySchema('project-id'),
|
|
1233
|
+
services: {
|
|
1234
|
+
'my-example': {
|
|
1235
|
+
title: 'My Example',
|
|
1236
|
+
id: 'my-example',
|
|
1237
|
+
provider: 'graphql',
|
|
1238
|
+
namespace: 'Example',
|
|
1239
|
+
serviceType: 'graphql',
|
|
1240
|
+
authenticationType: 'oauth2Bearer',
|
|
1241
|
+
authentication: 'supasecret',
|
|
1242
|
+
options: {
|
|
1243
|
+
endpoint: 'https://example.com'
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
},
|
|
1247
|
+
queries: {
|
|
1248
|
+
getFoo: {
|
|
1249
|
+
shape: 'Example_Foo',
|
|
1250
|
+
resolver: {
|
|
1251
|
+
name: 'graphql:query',
|
|
1252
|
+
service: 'my-example',
|
|
1253
|
+
fieldName: 'foo'
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
},
|
|
1257
|
+
shapes: {
|
|
1258
|
+
Taco: {
|
|
1259
|
+
id: 'taco-id',
|
|
1260
|
+
name: 'Taco',
|
|
1261
|
+
title: 'Taco',
|
|
1262
|
+
schema: {
|
|
1263
|
+
type: 'object',
|
|
1264
|
+
properties: {
|
|
1265
|
+
getBar: {
|
|
1266
|
+
$ref: '#/shapes/Example_Bar/schema'
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1273
|
+
const expected = new Set(['Example_Foo', 'Example_Bar']);
|
|
1274
|
+
const actual = getNamespacedShapeNameList(schema);
|
|
1275
|
+
expect(actual).toEqual(expected);
|
|
1276
|
+
});
|
|
1277
|
+
// Test instance where a shape in the schema has the same name as a
|
|
1278
|
+
// shape derived from a remote type should exclude the conflicting shape name
|
|
1279
|
+
test('with collision', () => {
|
|
1280
|
+
const schema = deepClone(shopifyStoreSchema);
|
|
1281
|
+
schema.shapes = {
|
|
1282
|
+
MyShape: {
|
|
1283
|
+
id: 'taco-id',
|
|
1284
|
+
name: 'Taco',
|
|
1285
|
+
title: 'Taco',
|
|
1286
|
+
schema: {
|
|
1287
|
+
type: 'object',
|
|
1288
|
+
properties: {
|
|
1289
|
+
getBar: {
|
|
1290
|
+
'@ref': 'gregs-takeshape-store:Egg'
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1296
|
+
const expected = new Set(['Shopify_Egg']);
|
|
1297
|
+
const actual = getNamespacedShapeNameList(schema);
|
|
1298
|
+
expect(actual).toEqual(expected);
|
|
1299
|
+
});
|
|
1300
|
+
// Test instance where a shape in the schema has the same name as a
|
|
1301
|
+
// shape derived from a remote type should exclude the conflicting shape name
|
|
1302
|
+
test('with @ref in item array', () => {
|
|
1303
|
+
const schema = deepClone(shopifyStoreSchema);
|
|
1304
|
+
const shapeWithItems = {
|
|
1305
|
+
id: 'ShapeWithItems',
|
|
1306
|
+
name: 'ShapeWithItems',
|
|
1307
|
+
title: 'ShapeWithItems',
|
|
1308
|
+
schema: {
|
|
1309
|
+
type: 'object',
|
|
1310
|
+
properties: {
|
|
1311
|
+
variants: {
|
|
1312
|
+
type: 'array',
|
|
1313
|
+
items: {
|
|
1314
|
+
'@ref': 'gregs-takeshape-store:Egg'
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
};
|
|
1320
|
+
schema.shapes = {
|
|
1321
|
+
...schema.shapes,
|
|
1322
|
+
ShapeWithItems: shapeWithItems
|
|
1323
|
+
};
|
|
1324
|
+
const expected = new Set(['Shopify_Egg']);
|
|
1325
|
+
const actual = getNamespacedShapeNameList(schema);
|
|
1326
|
+
expect(actual).toEqual(expected);
|
|
1327
|
+
});
|
|
1328
|
+
});
|
|
1329
|
+
describe('filterGraphQLServiceMap', () => {
|
|
1330
|
+
test('returns only GraphQL services', () => {
|
|
1331
|
+
const service = Object.values(shopifyStoreSchema.services)[0];
|
|
1332
|
+
const serviceConfig = service;
|
|
1333
|
+
const serviceConfigNoGraphQL = deepClone(serviceConfig);
|
|
1334
|
+
serviceConfigNoGraphQL.serviceType = 'rest';
|
|
1335
|
+
const serviceMap = new Map();
|
|
1336
|
+
serviceMap.set('graphql:my-service', serviceConfig);
|
|
1337
|
+
serviceMap.set('nographql:my-service', serviceConfigNoGraphQL);
|
|
1338
|
+
const expected = new Map();
|
|
1339
|
+
expected.set('graphql:my-service', serviceConfig);
|
|
1340
|
+
const actual = filterGraphQLServiceMap(serviceMap);
|
|
1341
|
+
expect(actual).toEqual(expected);
|
|
1342
|
+
});
|
|
1343
|
+
});
|
|
1344
|
+
describe('pathBetween', () => {
|
|
1345
|
+
test('it works', () => {
|
|
1346
|
+
expect(pathBetween(massiveSchema.shapes.Report, massiveSchema.shapes.TSColor, massiveSchema)).toEqual([
|
|
1347
|
+
'primaryColor'
|
|
1348
|
+
]);
|
|
1349
|
+
});
|
|
1350
|
+
test('oneOf array', () => {
|
|
1351
|
+
expect(pathBetween(petStoreSchema.shapes.Homepage, petStoreSchema.shapes.Dog, petStoreSchema)).toEqual(['pets']);
|
|
1352
|
+
});
|
|
1353
|
+
test('we need to go deeper', () => {
|
|
1354
|
+
expect(pathBetween(massiveSchema.shapes.ResourceNavigation, massiveSchema.shapes.ResourceNavigationSectionsSubsections, massiveSchema)).toEqual(['sections', 'subsections']);
|
|
1355
|
+
});
|
|
1356
|
+
test('throws when it reaches depth limit', () => {
|
|
1357
|
+
expect(() => pathBetween(massiveSchema.shapes.ResourceNavigation, massiveSchema.shapes.ResourceNavigationSectionsSubsections, massiveSchema, 1)).toThrow('No path between ResourceNavigation and ResourceNavigationSectionsSubsections');
|
|
1358
|
+
});
|
|
1359
|
+
test('no path', () => {
|
|
1360
|
+
expect(() => pathBetween(massiveSchema.shapes.AboutPage, massiveSchema.shapes.Report, massiveSchema)).toThrow('No path between AboutPage and Report');
|
|
1361
|
+
});
|
|
1362
|
+
test('repeater', () => {
|
|
1363
|
+
expect(pathBetween(massiveSchema.shapes.ResourceNavigation, massiveSchema.shapes.ResourceNavigationExternalResources, massiveSchema)).toEqual(['externalResources']);
|
|
1364
|
+
});
|
|
1365
|
+
});
|
|
1366
|
+
describe('emptySchema', () => {
|
|
1367
|
+
test('correct project id', () => {
|
|
1368
|
+
const projectId = 'myProjectId';
|
|
1369
|
+
expect(emptySchema(projectId).projectId).toEqual(projectId);
|
|
1370
|
+
});
|
|
1371
|
+
test('creates schema', () => {
|
|
1372
|
+
expect(emptySchema('myProjectId').schemaVersion).toMatch('3');
|
|
1373
|
+
});
|
|
1374
|
+
});
|
|
1375
|
+
describe('getShapesById', () => {
|
|
1376
|
+
test('it works', () => {
|
|
1377
|
+
const product = {
|
|
1378
|
+
name: 'Product',
|
|
1379
|
+
id: 'abc'
|
|
1380
|
+
};
|
|
1381
|
+
const productInput = {
|
|
1382
|
+
name: 'ProductInput',
|
|
1383
|
+
id: 'xyz'
|
|
1384
|
+
};
|
|
1385
|
+
const schema = {
|
|
1386
|
+
shapes: {
|
|
1387
|
+
Product: product,
|
|
1388
|
+
ProductInput: productInput
|
|
1389
|
+
}
|
|
1390
|
+
};
|
|
1391
|
+
const expected = {
|
|
1392
|
+
abc: product,
|
|
1393
|
+
xyz: productInput
|
|
1394
|
+
};
|
|
1395
|
+
const actual = getShapesById(schema);
|
|
1396
|
+
expect(actual).toEqual(expected);
|
|
1397
|
+
});
|
|
1398
|
+
});
|
|
1399
|
+
describe('getArgsShapeSchema', () => {
|
|
1400
|
+
test('it works', () => {
|
|
1401
|
+
const productShape = {
|
|
1402
|
+
schema: {
|
|
1403
|
+
type: 'object'
|
|
1404
|
+
}
|
|
1405
|
+
};
|
|
1406
|
+
const createProductArgs = {
|
|
1407
|
+
type: 'object'
|
|
1408
|
+
};
|
|
1409
|
+
const schema = {
|
|
1410
|
+
shapes: {
|
|
1411
|
+
Product: productShape
|
|
1412
|
+
},
|
|
1413
|
+
queries: {
|
|
1414
|
+
getProduct: {
|
|
1415
|
+
args: 'Product'
|
|
1416
|
+
}
|
|
1417
|
+
},
|
|
1418
|
+
mutations: {
|
|
1419
|
+
createProduct: {
|
|
1420
|
+
args: createProductArgs
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
};
|
|
1424
|
+
const actualGetProductResult = getArgsShapeSchema(schema, schema.queries.getProduct);
|
|
1425
|
+
expect(productShape.schema).toEqual(actualGetProductResult);
|
|
1426
|
+
const actualCreateProductResult = getArgsShapeSchema(schema, schema.mutations.createProduct);
|
|
1427
|
+
expect(createProductArgs).toEqual(actualCreateProductResult);
|
|
1428
|
+
});
|
|
1429
|
+
});
|
|
1430
|
+
describe('schema property utilities', () => {
|
|
1431
|
+
const productShape = {
|
|
1432
|
+
schema: {
|
|
1433
|
+
type: 'object',
|
|
1434
|
+
properties: {
|
|
1435
|
+
a: {
|
|
1436
|
+
type: 'string',
|
|
1437
|
+
'@mapping': 'shapedb:Product.a'
|
|
1438
|
+
},
|
|
1439
|
+
b: {
|
|
1440
|
+
type: 'string'
|
|
1441
|
+
},
|
|
1442
|
+
c: {
|
|
1443
|
+
type: 'number'
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
};
|
|
1448
|
+
const sourceShape = cloneDeep(productShape);
|
|
1449
|
+
const targetShapeWithRef = {
|
|
1450
|
+
schema: {
|
|
1451
|
+
'@ref': 'local:SourceShape'
|
|
1452
|
+
}
|
|
1453
|
+
};
|
|
1454
|
+
const targetShapeWithAllOf = {
|
|
1455
|
+
schema: {
|
|
1456
|
+
allOf: [
|
|
1457
|
+
{
|
|
1458
|
+
'@ref': 'local:SourceShape'
|
|
1459
|
+
}
|
|
1460
|
+
]
|
|
1461
|
+
}
|
|
1462
|
+
};
|
|
1463
|
+
const schema = {
|
|
1464
|
+
shapes: {
|
|
1465
|
+
Product: productShape,
|
|
1466
|
+
SourceShape: sourceShape,
|
|
1467
|
+
TargetShapeWithRef: targetShapeWithRef,
|
|
1468
|
+
TargetShapeWithAllOf: targetShapeWithAllOf
|
|
1469
|
+
}
|
|
1470
|
+
};
|
|
1471
|
+
it('returns property lists from simple shapes', () => {
|
|
1472
|
+
const schemaPropertyList = createSchemaPropertyList(schema, schema.shapes.Product.schema);
|
|
1473
|
+
expect(schemaPropertyList.getNodes()).toEqual(Object.entries(productShape.schema.properties));
|
|
1474
|
+
expect(schemaPropertyList.getObject()).toEqual(productShape.schema.properties);
|
|
1475
|
+
expect(schemaPropertyList.getNames()).toEqual(Object.keys(productShape.schema.properties));
|
|
1476
|
+
expect(schemaPropertyList.getValues()).toEqual(Object.values(productShape.schema.properties));
|
|
1477
|
+
});
|
|
1478
|
+
it('returns property lists from shapes using ref', () => {
|
|
1479
|
+
const schemaPropertyList = createSchemaPropertyList(schema, schema.shapes.TargetShapeWithRef.schema);
|
|
1480
|
+
expect(schemaPropertyList.getNodes()).toEqual(Object.entries(sourceShape.schema.properties));
|
|
1481
|
+
});
|
|
1482
|
+
it('returns property lists from shapes using allOf', () => {
|
|
1483
|
+
const schemaPropertyList = createSchemaPropertyList(schema, schema.shapes.TargetShapeWithAllOf.schema);
|
|
1484
|
+
expect(schemaPropertyList.getNodes()).toEqual(Object.entries(sourceShape.schema.properties));
|
|
1485
|
+
});
|
|
1486
|
+
it('filters property lists', () => {
|
|
1487
|
+
const schemaPropertyList = createSchemaPropertyList(schema, schema.shapes.Product.schema);
|
|
1488
|
+
expect(schemaPropertyList.filterBy(([k]) => k === 'a').getNodes()).toEqual([
|
|
1489
|
+
['a', productShape.schema.properties.a]
|
|
1490
|
+
]);
|
|
1491
|
+
});
|
|
1492
|
+
it('orders property lists', () => {
|
|
1493
|
+
const schemaPropertyList = createSchemaPropertyList(schema, schema.shapes.Product.schema);
|
|
1494
|
+
expect(schemaPropertyList.orderBy([([k]) => k], ['desc']).getNames()).toEqual(['c', 'b', 'a']);
|
|
1495
|
+
});
|
|
1496
|
+
it('allows callbacks to be called forEach property', () => {
|
|
1497
|
+
const schemaPropertyList = createSchemaPropertyList(schema, schema.shapes.Product.schema);
|
|
1498
|
+
const forEachResults = ['c', 'b', 'a'];
|
|
1499
|
+
// biome-ignore lint/complexity/noForEach: Types from orderBy don't line up
|
|
1500
|
+
schemaPropertyList.orderBy([([k]) => k], ['desc']).forEach(([k]) => {
|
|
1501
|
+
expect(k).toBe(forEachResults[0]);
|
|
1502
|
+
forEachResults.shift();
|
|
1503
|
+
});
|
|
1504
|
+
});
|
|
1505
|
+
it('allows property lists to be assigned to variables', () => {
|
|
1506
|
+
const schemaPropertyList = createSchemaPropertyList(schema, schema.shapes.Product.schema);
|
|
1507
|
+
const ordered = schemaPropertyList.orderBy([([k]) => k], ['desc']);
|
|
1508
|
+
expect(ordered.getNames()).toEqual(['c', 'b', 'a']);
|
|
1509
|
+
});
|
|
1510
|
+
it('allows property lists to be sorted with a user-supplied comparator', () => {
|
|
1511
|
+
const schemaPropertyList = createSchemaPropertyList(schema, schema.shapes.Product.schema);
|
|
1512
|
+
expect(schemaPropertyList
|
|
1513
|
+
.sortWith(([nameA], [nameB]) => {
|
|
1514
|
+
if (nameA < nameB) {
|
|
1515
|
+
return 1;
|
|
1516
|
+
}
|
|
1517
|
+
if (nameA > nameB) {
|
|
1518
|
+
return -1;
|
|
1519
|
+
}
|
|
1520
|
+
// Names must be equal
|
|
1521
|
+
return 0;
|
|
1522
|
+
})
|
|
1523
|
+
.getNodes()).toEqual([
|
|
1524
|
+
['c', productShape.schema.properties.c],
|
|
1525
|
+
['b', productShape.schema.properties.b],
|
|
1526
|
+
['a', productShape.schema.properties.a]
|
|
1527
|
+
]);
|
|
1528
|
+
});
|
|
1529
|
+
it('allows property lists to be sorted by an array of property names', () => {
|
|
1530
|
+
const schemaPropertyList = createSchemaPropertyList(schema, schema.shapes.Product.schema);
|
|
1531
|
+
expect(schemaPropertyList.sortByNamesWithList(['c', 'a']).getNodes()).toEqual([
|
|
1532
|
+
['c', productShape.schema.properties.c],
|
|
1533
|
+
['a', productShape.schema.properties.a]
|
|
1534
|
+
]);
|
|
1535
|
+
});
|
|
1536
|
+
it('allows properties to accessed in simple shapes', () => {
|
|
1537
|
+
const schemaPropertyAccessor = createSchemaPropertyAccessor(schema, schema.shapes.Product.schema);
|
|
1538
|
+
expect(schemaPropertyAccessor.getValue('a')).toEqual(productShape.schema.properties.a);
|
|
1539
|
+
});
|
|
1540
|
+
it('allows properties to accessed in shapes using ref', () => {
|
|
1541
|
+
const schemaPropertyAccessor = createSchemaPropertyAccessor(schema, schema.shapes.TargetShapeWithRef.schema);
|
|
1542
|
+
expect(schemaPropertyAccessor.getValue('a')).toEqual(sourceShape.schema.properties.a);
|
|
1543
|
+
});
|
|
1544
|
+
it('allows properties to accessed in shapes using allOf', () => {
|
|
1545
|
+
const schemaPropertyAccessor = createSchemaPropertyAccessor(schema, schema.shapes.TargetShapeWithAllOf.schema);
|
|
1546
|
+
expect(schemaPropertyAccessor.getValue('a')).toEqual(sourceShape.schema.properties.a);
|
|
1547
|
+
});
|
|
1548
|
+
it('allows property values to be found in shapes', () => {
|
|
1549
|
+
const schemaPropertyAccessor = createSchemaPropertyAccessor(schema, schema.shapes.Product.schema);
|
|
1550
|
+
expect(schemaPropertyAccessor.findValue(([, value]) => value.type === 'number')).toEqual(sourceShape.schema.properties.c);
|
|
1551
|
+
});
|
|
1552
|
+
it('allows property names to be found in shapes', () => {
|
|
1553
|
+
const schemaPropertyAccessor = createSchemaPropertyAccessor(schema, schema.shapes.Product.schema);
|
|
1554
|
+
expect(schemaPropertyAccessor.findName(([, value]) => value.type === 'number')).toEqual('c');
|
|
1555
|
+
});
|
|
1556
|
+
it('allows property keys from @mapping to be generated for properties', () => {
|
|
1557
|
+
const schemaPropertyAccessor = createSchemaPropertyAccessor(schema, schema.shapes.Product.schema);
|
|
1558
|
+
expect(schemaPropertyAccessor.getKey('a')).toEqual('a');
|
|
1559
|
+
});
|
|
1560
|
+
it('can find query by shape and resolver', () => {
|
|
1561
|
+
expect(ensureQueryByShape(getPostSchema(), 'Post', 'shapedb:get')).toEqual('getPost');
|
|
1562
|
+
});
|
|
1563
|
+
it('can find mutation by shape and resolver', () => {
|
|
1564
|
+
expect(ensureMutationByShape(getPostSchema(), 'Post', 'shapedb:update')).toEqual('updatePost');
|
|
1565
|
+
});
|
|
1566
|
+
it('throws error if cannot find query by shape and resolver', () => {
|
|
1567
|
+
expect(() => {
|
|
1568
|
+
ensureQueryByShape(getPostSchema(), 'Egg', 'shapedb:get');
|
|
1569
|
+
}).toThrowError('Failed to find a "shapedb:get" query for shape "Egg"');
|
|
1570
|
+
});
|
|
1571
|
+
it('can get default mutation by name', () => {
|
|
1572
|
+
expect(getDefaultMutationName('Asset', 'shapedb:create')).toBe('createAsset');
|
|
1573
|
+
});
|
|
1574
|
+
});
|
|
1575
|
+
describe('getAllNamespaceShapes', () => {
|
|
1576
|
+
test('shopify schema snapshot', () => {
|
|
1577
|
+
expect(getAllNamespaceShapes(shopifyStoreSchema)).toMatchSnapshot();
|
|
1578
|
+
});
|
|
1579
|
+
});
|
|
1580
|
+
describe('getAllRefs', () => {
|
|
1581
|
+
test('shopify schema snapshot', () => {
|
|
1582
|
+
expect(getAllRefs(shopifyStoreSchema)).toMatchSnapshot();
|
|
1583
|
+
});
|
|
1584
|
+
test('predicate', () => {
|
|
1585
|
+
expect(getAllRefs(shopifyStoreSchema, (ref) => !ref.isForeign)).toMatchSnapshot();
|
|
1586
|
+
});
|
|
1587
|
+
});
|
|
1588
|
+
describe('getQueriesShape', () => {
|
|
1589
|
+
test('shopify schema', () => {
|
|
1590
|
+
const shape = getQueriesShape(shopifySchema202207, 'query');
|
|
1591
|
+
expect(isObjectSchema(shape.schema)).toBe(true);
|
|
1592
|
+
const objectSchema = shape.schema;
|
|
1593
|
+
expect(Object.keys(objectSchema.properties).sort()).toEqual(Object.keys(shopifySchema202207.queries).sort());
|
|
1594
|
+
expect(objectSchema.properties.Shopify_products).toEqual({
|
|
1595
|
+
'@args': expect.objectContaining({
|
|
1596
|
+
type: 'object'
|
|
1597
|
+
}),
|
|
1598
|
+
'@mapping': 'shopify:Query.products',
|
|
1599
|
+
'@ref': 'shopify:ProductConnection',
|
|
1600
|
+
'@resolver': {
|
|
1601
|
+
fieldName: 'products',
|
|
1602
|
+
name: 'graphql:query',
|
|
1603
|
+
service: 'shopify'
|
|
1604
|
+
}
|
|
1605
|
+
});
|
|
1606
|
+
});
|
|
1607
|
+
});
|
|
1608
|
+
describe('schemaMatchesShapeName', () => {
|
|
1609
|
+
const ref = { '@ref': 'local:Post' };
|
|
1610
|
+
test('yes', () => {
|
|
1611
|
+
expect(schemaMatchesShapeName(postSchemaJson, ref, 'Post')).toEqual(true);
|
|
1612
|
+
});
|
|
1613
|
+
test('no', () => {
|
|
1614
|
+
expect(schemaMatchesShapeName(postSchemaJson, ref, 'Potato')).toEqual(false);
|
|
1615
|
+
});
|
|
1616
|
+
});
|
|
1617
|
+
describe('shapeHasArrayPropOfShape', () => {
|
|
1618
|
+
test('yes', () => {
|
|
1619
|
+
expect(shapeHasArrayPropOfShape(postSchemaJson, postSchemaJson.shapes.Post, 'Tag')).toEqual(true);
|
|
1620
|
+
});
|
|
1621
|
+
test('no', () => {
|
|
1622
|
+
expect(shapeHasArrayPropOfShape(postSchemaJson, postSchemaJson.shapes.Post, 'Onion')).toEqual(false);
|
|
1623
|
+
});
|
|
1624
|
+
});
|
|
1625
|
+
describe('getAllRefsInShapes', () => {
|
|
1626
|
+
test('finds interfaces that are refs', () => {
|
|
1627
|
+
expect(getAllRefsInShapes({
|
|
1628
|
+
shapes: {
|
|
1629
|
+
Dog: {
|
|
1630
|
+
id: 'Dog',
|
|
1631
|
+
name: 'Dog',
|
|
1632
|
+
title: 'Dog',
|
|
1633
|
+
schema: { type: 'object' },
|
|
1634
|
+
interfaces: ['Animal', 'shopify:Friend']
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
})).toEqual([
|
|
1638
|
+
{
|
|
1639
|
+
isForeign: false,
|
|
1640
|
+
path: ['shapes', 'Dog', 'interfaces', 0],
|
|
1641
|
+
serviceKey: 'local',
|
|
1642
|
+
typeName: 'Animal',
|
|
1643
|
+
isValidService: true
|
|
1644
|
+
},
|
|
1645
|
+
{
|
|
1646
|
+
isForeign: false,
|
|
1647
|
+
path: ['shapes', 'Dog', 'interfaces', 1],
|
|
1648
|
+
serviceKey: 'shopify',
|
|
1649
|
+
typeName: 'Friend',
|
|
1650
|
+
isValidService: false
|
|
1651
|
+
}
|
|
1652
|
+
]);
|
|
1653
|
+
});
|
|
1654
|
+
});
|
|
1655
|
+
describe('isBuiltInPropertyName', () => {
|
|
1656
|
+
test('not a builtin', () => {
|
|
1657
|
+
expect(isBuiltInPropertyName('name')).toEqual(false);
|
|
1658
|
+
});
|
|
1659
|
+
test('universal builtin property model profile', () => {
|
|
1660
|
+
expect(isBuiltInPropertyName('_id')).toEqual(true);
|
|
1661
|
+
});
|
|
1662
|
+
test('model property model profile', () => {
|
|
1663
|
+
expect(isBuiltInPropertyName('_updatedBy')).toEqual(true);
|
|
1664
|
+
});
|
|
1665
|
+
test('universal builtin property none profile', () => {
|
|
1666
|
+
expect(isBuiltInPropertyName('_id', BuiltInPropertiesProfile.None)).toEqual(true);
|
|
1667
|
+
});
|
|
1668
|
+
test('model property none profile', () => {
|
|
1669
|
+
expect(isBuiltInPropertyName('_updatedBy', BuiltInPropertiesProfile.None)).toEqual(false);
|
|
1670
|
+
});
|
|
1671
|
+
});
|
|
1672
|
+
describe('visitSchemaProperties', () => {
|
|
1673
|
+
const schema = {
|
|
1674
|
+
required: ['data'],
|
|
1675
|
+
type: 'object',
|
|
1676
|
+
properties: {
|
|
1677
|
+
data: {
|
|
1678
|
+
type: 'array',
|
|
1679
|
+
items: {
|
|
1680
|
+
allOf: [
|
|
1681
|
+
{
|
|
1682
|
+
'@ref': 'klayvio:ObjectResource'
|
|
1683
|
+
},
|
|
1684
|
+
{
|
|
1685
|
+
type: 'object',
|
|
1686
|
+
properties: {
|
|
1687
|
+
relationships: {
|
|
1688
|
+
'@ref': 'klayvio:GetSegmentListResponseCollectionCompoundDocumentDataRelationships'
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
]
|
|
1693
|
+
}
|
|
1694
|
+
},
|
|
1695
|
+
links: {
|
|
1696
|
+
'@ref': 'klayvio:CollectionLinks'
|
|
1697
|
+
},
|
|
1698
|
+
included: {
|
|
1699
|
+
type: 'array',
|
|
1700
|
+
items: {
|
|
1701
|
+
'@ref': 'klayvio:TagResponseObjectResource'
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
};
|
|
1706
|
+
const expectVisited = (callback, path) => {
|
|
1707
|
+
const item = get(schema, path);
|
|
1708
|
+
expect(callback).toHaveBeenCalledWith(item, path);
|
|
1709
|
+
};
|
|
1710
|
+
test('works', () => {
|
|
1711
|
+
const callback = vi.fn();
|
|
1712
|
+
visitSchemaProperties(schema, [], callback);
|
|
1713
|
+
expect(callback).toHaveBeenCalledTimes(8);
|
|
1714
|
+
expectVisited(callback, ['properties', 'data']);
|
|
1715
|
+
expectVisited(callback, ['properties', 'data', 'items']);
|
|
1716
|
+
expectVisited(callback, ['properties', 'data', 'items', 'allOf', '0']);
|
|
1717
|
+
expectVisited(callback, ['properties', 'data', 'items', 'allOf', '1']);
|
|
1718
|
+
expectVisited(callback, ['properties', 'data', 'items', 'allOf', '1', 'properties', 'relationships']);
|
|
1719
|
+
expectVisited(callback, ['properties', 'links']);
|
|
1720
|
+
expectVisited(callback, ['properties', 'included']);
|
|
1721
|
+
expectVisited(callback, ['properties', 'included', 'items']);
|
|
1722
|
+
});
|
|
1723
|
+
test('cancels iteration correctly', () => {
|
|
1724
|
+
const callback = vi.fn((prop) => prop.type !== 'array');
|
|
1725
|
+
visitSchemaProperties(schema, [], callback);
|
|
1726
|
+
expect(callback).toHaveBeenCalledTimes(3);
|
|
1727
|
+
expectVisited(callback, ['properties', 'data']);
|
|
1728
|
+
expectVisited(callback, ['properties', 'links']);
|
|
1729
|
+
expectVisited(callback, ['properties', 'included']);
|
|
1730
|
+
});
|
|
1731
|
+
});
|