@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,1107 @@
|
|
|
1
|
+
import { SchemaValidationError } from '@takeshape/errors';
|
|
2
|
+
import { createAjv } from '@takeshape/json-schema';
|
|
3
|
+
import { DEFAULT_MIN_SCHEDULE_TRIGGER_INTERVAL, ensureArray, isIntegerLike, isRecord, value } from '@takeshape/util';
|
|
4
|
+
import { JSONPath } from 'jsonpath-plus';
|
|
5
|
+
import { flatten } from 'lodash';
|
|
6
|
+
import get from 'lodash/get.js';
|
|
7
|
+
import initial from 'lodash/initial.js';
|
|
8
|
+
import isEqual from 'lodash/isEqual.js';
|
|
9
|
+
import isUndefined from 'lodash/isUndefined.js';
|
|
10
|
+
import last from 'lodash/last.js';
|
|
11
|
+
import pick from 'lodash/pick.js';
|
|
12
|
+
import size from 'lodash/size.js';
|
|
13
|
+
import uniqBy from 'lodash/uniqBy.js';
|
|
14
|
+
import pMap from 'p-map';
|
|
15
|
+
import coerce from 'semver/functions/coerce.js';
|
|
16
|
+
import gte from 'semver/functions/gte.js';
|
|
17
|
+
import lt from 'semver/functions/lt.js';
|
|
18
|
+
import neq from 'semver/functions/neq.js';
|
|
19
|
+
import { builtInShapes } from "../builtin-schema.js";
|
|
20
|
+
import { isEnumLikeSchema } from "../enum.js";
|
|
21
|
+
import { isLatestProjectSchemaJSON } from "../project-schema/index.js";
|
|
22
|
+
import { atRefToRefItem, createGetNamespace, getRefShapeName, parsePropertyRef, propertyRefItemToPath, propertyRefItemToResolverPath, refItemToAtRef, refItemToNamespacedShapeName, refItemToShape } from "../refs.js";
|
|
23
|
+
import { getRelationship } from "../relationships.js";
|
|
24
|
+
import { scalars } from "../scalars.js";
|
|
25
|
+
import { getAllRefs } from "../schema-util.js";
|
|
26
|
+
import authSchemas from '../schemas/auth-schemas.json' with { type: 'json' };
|
|
27
|
+
import { allProjectSchemas } from "../schemas/index.js";
|
|
28
|
+
import { isValidTemplate } from "../template-shapes/index.js";
|
|
29
|
+
import { legacyProjectSchemaImportOptionalProps, projectSchemaImportOptionalProps } from "../types/types.js";
|
|
30
|
+
import { isAIResolver, isBasicResolver, isComposeResolver, isExtendsSchema, isObjectSchema } from "../types/utils.js";
|
|
31
|
+
import { isUnionSchema } from "../unions.js";
|
|
32
|
+
import { getToolRef } from "../util/ai-tools.js";
|
|
33
|
+
import { getShape } from "../util/shapes.js";
|
|
34
|
+
import { CURRENT_SCHEMA_VERSION, LEGACY_API_VERSION, LEGACY_SCHEMA_VERSION } from "../versions.js";
|
|
35
|
+
import { defaultWorkflow } from "../workflows.js";
|
|
36
|
+
import { formatError } from "./errors.js";
|
|
37
|
+
export const builtInShapeNames = new Set([...Object.keys(builtInShapes), ...scalars, 'object']);
|
|
38
|
+
function findDuplicates(items) {
|
|
39
|
+
const seen = {};
|
|
40
|
+
for (const item of items) {
|
|
41
|
+
if (seen[item.value]) {
|
|
42
|
+
seen[item.value].push(item.path);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
seen[item.value] = [item.path];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return Object.entries(seen)
|
|
49
|
+
.filter((entry) => entry[1].length > 1)
|
|
50
|
+
.flatMap((entry) => ({ value: entry[0], paths: entry[1] }));
|
|
51
|
+
}
|
|
52
|
+
function checkShapeIds(shapes) {
|
|
53
|
+
const items = Object.entries(shapes).map((entry) => ({
|
|
54
|
+
path: ['shapes', entry[0], 'id'],
|
|
55
|
+
value: entry[1].id
|
|
56
|
+
}));
|
|
57
|
+
return findDuplicates(items).flatMap((dupe) => dupe.paths.map((path) => ({
|
|
58
|
+
path,
|
|
59
|
+
type: 'conflict',
|
|
60
|
+
message: `Shapes must have unique ids. "${dupe.value}" is not unique.`
|
|
61
|
+
})));
|
|
62
|
+
}
|
|
63
|
+
function checkShapeNames(shapes) {
|
|
64
|
+
Object.entries(shapes).map((entry) => ({
|
|
65
|
+
path: ['shapes', entry[0], 'id'],
|
|
66
|
+
value: entry[1].id
|
|
67
|
+
}));
|
|
68
|
+
return Object.entries(shapes)
|
|
69
|
+
.filter(([name, shape]) => name !== shape.name)
|
|
70
|
+
.map(([name, shape]) => ({
|
|
71
|
+
path: ['shapes', name, 'name'],
|
|
72
|
+
type: 'conflict',
|
|
73
|
+
message: `Shape.name "${shape.name}" must match key "${name}".`
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
function checkWorkflowStepNames(workflows) {
|
|
77
|
+
return Object.entries(workflows).flatMap(([name, workflow]) => {
|
|
78
|
+
const items = workflow.steps.map((step, i) => ({
|
|
79
|
+
path: ['workflows', name, 'steps', i, 'name'],
|
|
80
|
+
value: step.name.toLowerCase()
|
|
81
|
+
}));
|
|
82
|
+
return findDuplicates(items).flatMap((dupe) => dupe.paths.map((path) => ({
|
|
83
|
+
path,
|
|
84
|
+
type: 'conflict',
|
|
85
|
+
message: `Workflow steps must have unique names. "${dupe.value}" is not unique in workflow "${workflow.name}."`
|
|
86
|
+
})));
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function checkWorkflowStepKeys(workflows) {
|
|
90
|
+
const items = Object.entries(workflows).flatMap(([name, workflow]) => workflow.steps.map((step, i) => ({
|
|
91
|
+
path: ['workflows', name, 'steps', i, 'key'],
|
|
92
|
+
value: step.key
|
|
93
|
+
})));
|
|
94
|
+
return findDuplicates(items).flatMap((dupe) => dupe.paths.map((path) => ({
|
|
95
|
+
path,
|
|
96
|
+
type: 'conflict',
|
|
97
|
+
message: `Workflow keys must be unique at the schema level. Key "${dupe.value}" is not unique.`
|
|
98
|
+
})));
|
|
99
|
+
}
|
|
100
|
+
function validateWorkflowVersion(projectSchema) {
|
|
101
|
+
const errors = [];
|
|
102
|
+
if (projectSchema.apiVersion === LEGACY_API_VERSION && Object.keys(projectSchema.workflows).length) {
|
|
103
|
+
errors.push({
|
|
104
|
+
path: ['workflows'],
|
|
105
|
+
type: 'invalidVersion',
|
|
106
|
+
message: `apiVersion ${projectSchema.apiVersion} does not support workflows`
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return errors;
|
|
110
|
+
}
|
|
111
|
+
function validateWorkflows(projectSchema) {
|
|
112
|
+
const errors = validateWorkflowVersion(projectSchema);
|
|
113
|
+
for (const name of Object.keys(projectSchema.shapes)) {
|
|
114
|
+
const shape = projectSchema.shapes[name];
|
|
115
|
+
if (shape.workflow && shape.workflow !== defaultWorkflow.name && !projectSchema.workflows[shape.workflow]) {
|
|
116
|
+
errors.push({
|
|
117
|
+
type: 'notFound',
|
|
118
|
+
path: ['shapes', name, 'workflow'],
|
|
119
|
+
message: `Invalid Workflow "${shape.workflow}" for shape "${shape.name}"`
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return errors;
|
|
124
|
+
}
|
|
125
|
+
function getSemver(schemaVersion) {
|
|
126
|
+
return coerce(schemaVersion) ?? LEGACY_SCHEMA_VERSION;
|
|
127
|
+
}
|
|
128
|
+
function pushErrors(errors, error) {
|
|
129
|
+
if (error) {
|
|
130
|
+
errors.push(error);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function enumerateBasicResolvers(resolver, path) {
|
|
134
|
+
const results = [];
|
|
135
|
+
const visit = (resolver, path) => {
|
|
136
|
+
if (isComposeResolver(resolver)) {
|
|
137
|
+
resolver.compose.forEach((resolver, i) => {
|
|
138
|
+
visit(resolver, [...path, 'compose', i]);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
results.push([resolver, path]);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
visit(resolver, path);
|
|
146
|
+
return results;
|
|
147
|
+
}
|
|
148
|
+
const isValidAgentMutation = (projectSchema, mutationName) => {
|
|
149
|
+
return Boolean(projectSchema['ai-experimental']?.agents?.[mutationName]);
|
|
150
|
+
};
|
|
151
|
+
const validateAIToolConfig = (projectSchema, getNamespace, tool, basePath) => {
|
|
152
|
+
const toolRef = getToolRef(tool);
|
|
153
|
+
const path = typeof tool === 'string' ? basePath : basePath.concat('ref');
|
|
154
|
+
const parsed = parsePropertyRef(toolRef);
|
|
155
|
+
if (!parsed) {
|
|
156
|
+
return {
|
|
157
|
+
type: 'conflict',
|
|
158
|
+
path,
|
|
159
|
+
message: `Unable to parse property ref "${toolRef}"`
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
if (parsed.serviceId !== 'local') {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const propertyPath = propertyRefItemToPath(getNamespace, parsed);
|
|
166
|
+
if (propertyPath[0] !== 'queries' && propertyPath[0] !== 'mutations') {
|
|
167
|
+
return {
|
|
168
|
+
type: 'conflict',
|
|
169
|
+
path,
|
|
170
|
+
message: 'Tools must be a query or mutation'
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
const property = get(projectSchema, propertyPath);
|
|
174
|
+
if (propertyPath[0] === 'mutations' && isValidAgentMutation(projectSchema, propertyPath[1])) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (!property) {
|
|
178
|
+
return {
|
|
179
|
+
type: 'notFound',
|
|
180
|
+
path,
|
|
181
|
+
message: `Missing tool ${propertyPath[0] === 'queries' ? 'query' : 'mutation'} "${toolRef}"`
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
function validateResolver(projectSchema, basePath, baseResolver) {
|
|
186
|
+
const errors = [];
|
|
187
|
+
const isValidShapeName = (shapeName) => {
|
|
188
|
+
if (!shapeName) {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
const shape = getShape(projectSchema, shapeName) ?? getShape({ shapes: builtInShapes }, shapeName);
|
|
192
|
+
if (shape?.model) {
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
return Boolean(shape?.cache?.enabled && shape.loaders);
|
|
196
|
+
};
|
|
197
|
+
const validateDeletgateResolver = (resolver, path) => {
|
|
198
|
+
const parsed = parsePropertyRef(resolver.to);
|
|
199
|
+
if (!parsed) {
|
|
200
|
+
return {
|
|
201
|
+
type: 'conflict',
|
|
202
|
+
path: path.concat('to'),
|
|
203
|
+
message: `Unable to parse property ref "${resolver.to}"`
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
if (parsed.serviceId !== 'local') {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const targetResolver = get(projectSchema, propertyRefItemToResolverPath(getNamespace, parsed));
|
|
210
|
+
if (!isBasicResolver(targetResolver) && !isComposeResolver(targetResolver)) {
|
|
211
|
+
return {
|
|
212
|
+
type: 'notFound',
|
|
213
|
+
path: basePath.concat('to'),
|
|
214
|
+
message: `Missing resolver config at property ref "${resolver.to}"`
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
const validateAITGuardrail = (guardrail, basePath) => {
|
|
219
|
+
if (guardrail.name === 'similarity') {
|
|
220
|
+
if (!isValidShapeName(guardrail.shape)) {
|
|
221
|
+
return {
|
|
222
|
+
type: 'notFound',
|
|
223
|
+
path: basePath.concat('shape'),
|
|
224
|
+
message: `Invalid shape "${guardrail.shape}" for ${guardrail.shape}, must use an indexed shape`
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
const validateAIGenerateTextResolver = (resolver, path) => {
|
|
230
|
+
if (resolver.tools) {
|
|
231
|
+
for (let i = 0, n = resolver.tools.length; i < n; i++) {
|
|
232
|
+
pushErrors(errors, validateAIToolConfig(projectSchema, getNamespace, resolver.tools[i], path.concat(['tools', i])));
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (resolver.guardrails) {
|
|
236
|
+
for (let i = 0, n = resolver.guardrails.length; i < n; i++) {
|
|
237
|
+
pushErrors(errors, validateAITGuardrail(resolver.guardrails[i], path.concat(['guardrails', i])));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const { toolChoice } = resolver.options ?? {};
|
|
241
|
+
if (toolChoice === 'required') {
|
|
242
|
+
if (!resolver.tools?.length) {
|
|
243
|
+
errors.push({
|
|
244
|
+
type: 'notFound',
|
|
245
|
+
path: path.concat(['options', 'toolChoice']),
|
|
246
|
+
message: `Must have at least one tool configured to specify "required"`
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
else if (toolChoice && toolChoice !== 'auto' && toolChoice !== 'none') {
|
|
251
|
+
const parsed = parsePropertyRef(toolChoice);
|
|
252
|
+
if (parsed) {
|
|
253
|
+
const matchingTool = resolver.tools?.find((tool) => isEqual(parsed, parsePropertyRef(getToolRef(tool))));
|
|
254
|
+
if (!matchingTool) {
|
|
255
|
+
errors.push({
|
|
256
|
+
type: 'notFound',
|
|
257
|
+
path: path.concat(['options', 'toolChoice']),
|
|
258
|
+
message: `Missing tool "${toolChoice}" must be specified in "tools" array`
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
errors.push({
|
|
264
|
+
type: 'conflict',
|
|
265
|
+
path: path.concat(['options', 'toolChoice']),
|
|
266
|
+
message: `Unable to parse property ref "${toolChoice}"`
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
const getNamespace = createGetNamespace(projectSchema);
|
|
272
|
+
for (const [resolver, path] of enumerateBasicResolvers(baseResolver, basePath)) {
|
|
273
|
+
if (isBasicResolver(resolver)) {
|
|
274
|
+
if ('service' in resolver &&
|
|
275
|
+
resolver.service !== 'shapedb' &&
|
|
276
|
+
resolver.service !== 'takeshape' &&
|
|
277
|
+
!projectSchema.services?.[resolver.service]) {
|
|
278
|
+
errors.push({
|
|
279
|
+
type: 'notFound',
|
|
280
|
+
path: path.concat(['service']),
|
|
281
|
+
message: `Invalid service "${resolver.service}"`
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
if (resolver.shapeName) {
|
|
285
|
+
const { shapeName } = resolver;
|
|
286
|
+
if (!isValidShapeName(shapeName)) {
|
|
287
|
+
errors.push({
|
|
288
|
+
type: 'notFound',
|
|
289
|
+
path: path.concat(['shapeName']),
|
|
290
|
+
message: `Invalid Model Shape "${shapeName ?? ''}"`
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (resolver.name === 'delegate') {
|
|
295
|
+
pushErrors(errors, validateDeletgateResolver(resolver, path));
|
|
296
|
+
}
|
|
297
|
+
else if (isAIResolver(resolver)) {
|
|
298
|
+
validateAIGenerateTextResolver(resolver, path);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
errors.push({
|
|
303
|
+
type: 'notFound',
|
|
304
|
+
path,
|
|
305
|
+
message: 'Invalid resolver'
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return errors;
|
|
310
|
+
}
|
|
311
|
+
function validateLocalQueryConfig(projectSchema, query, operation, name) {
|
|
312
|
+
const location = operation === 'query' ? 'queries' : 'mutations';
|
|
313
|
+
return validateResolver(projectSchema, [location, name, 'resolver'], query.resolver);
|
|
314
|
+
}
|
|
315
|
+
const operationProps = [['query', 'queries'], ['mutation', 'mutations']];
|
|
316
|
+
function validateLocalQueryConfigs(projectSchema) {
|
|
317
|
+
const errors = [];
|
|
318
|
+
for (const [operation, prop] of operationProps) {
|
|
319
|
+
for (const name of Object.keys(projectSchema[prop])) {
|
|
320
|
+
errors.push(...validateLocalQueryConfig(projectSchema, projectSchema[prop][name], operation, name));
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return errors;
|
|
324
|
+
}
|
|
325
|
+
function allowDisconnected(context, status) {
|
|
326
|
+
return Boolean(context.allowDisconnectedLayers) && status !== 'notAvailable';
|
|
327
|
+
}
|
|
328
|
+
function isValidShapeReference(context, layerState, shapeName) {
|
|
329
|
+
if (layerState.status !== 'ok') {
|
|
330
|
+
return allowDisconnected(context, layerState.status);
|
|
331
|
+
}
|
|
332
|
+
return Boolean(layerState.schema.shapes[shapeName]);
|
|
333
|
+
}
|
|
334
|
+
async function validateResolverReferences(context, projectSchema, basePath, baseResolver) {
|
|
335
|
+
const errors = [];
|
|
336
|
+
const isInvalidPropertyRef = async (refStr) => {
|
|
337
|
+
const ref = parsePropertyRef(refStr);
|
|
338
|
+
// ref string format and local refs are validated in validateResolver()
|
|
339
|
+
if (!ref || ref.serviceId === 'local') {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
const layerState = await context.resolveLayer(ref.serviceId);
|
|
343
|
+
return layerState.status === 'ok'
|
|
344
|
+
? !get(layerState.schema, propertyRefItemToPath(value(''), ref))
|
|
345
|
+
: !allowDisconnected(context, layerState.status);
|
|
346
|
+
};
|
|
347
|
+
await pMap(enumerateBasicResolvers(baseResolver, basePath), async ([resolver, path]) => {
|
|
348
|
+
if (resolver.name === 'graphql:query' || resolver.name === 'graphql:mutation') {
|
|
349
|
+
const { service, fieldName } = resolver;
|
|
350
|
+
const prop = resolver.name === 'graphql:query' ? 'queries' : 'mutations';
|
|
351
|
+
const layerState = await context.resolveLayer(service);
|
|
352
|
+
const valid = layerState.status === 'ok'
|
|
353
|
+
? Boolean(layerState.schema[prop][fieldName])
|
|
354
|
+
: allowDisconnected(context, layerState.status);
|
|
355
|
+
if (!valid) {
|
|
356
|
+
const operation = resolver.name === 'graphql:query' ? 'query' : 'mutation';
|
|
357
|
+
errors.push({
|
|
358
|
+
type: 'notFound',
|
|
359
|
+
path: path.concat('fieldName'),
|
|
360
|
+
message: `Missing ${operation} "${resolver.fieldName}" in service layer "${service}"`
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
else if (resolver.name === 'delegate') {
|
|
365
|
+
if (await isInvalidPropertyRef(resolver.to)) {
|
|
366
|
+
errors.push({
|
|
367
|
+
type: 'notFound',
|
|
368
|
+
path: path.concat('to'),
|
|
369
|
+
message: `Missing resolver config at property ref "${resolver.to}"`
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
else if (isAIResolver(resolver)) {
|
|
374
|
+
if (resolver.tools) {
|
|
375
|
+
await pMap(resolver.tools, async (tool, i) => {
|
|
376
|
+
const toolRef = getToolRef(tool);
|
|
377
|
+
if (await isInvalidPropertyRef(toolRef)) {
|
|
378
|
+
errors.push({
|
|
379
|
+
type: 'notFound',
|
|
380
|
+
path: path.concat(typeof tool === 'string' ? ['tools', i] : ['tools', i, 'ref']),
|
|
381
|
+
message: `Invalid ref "${toolRef}"`
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
return errors;
|
|
389
|
+
}
|
|
390
|
+
async function validateQueryConfig(context, projectSchema, { query, name, operation }) {
|
|
391
|
+
const location = operation === 'query' ? 'queries' : 'mutations';
|
|
392
|
+
return validateResolverReferences(context, projectSchema, [location, name, 'resolver'], query.resolver);
|
|
393
|
+
}
|
|
394
|
+
async function validateQueryConfigs(context, projectSchema) {
|
|
395
|
+
const isLessThanV3_9_0 = lt(getSemver(projectSchema.schemaVersion), '3.9.0');
|
|
396
|
+
if (isLessThanV3_9_0) {
|
|
397
|
+
return [];
|
|
398
|
+
}
|
|
399
|
+
const promises = [];
|
|
400
|
+
for (const [operation, prop] of operationProps) {
|
|
401
|
+
for (const name of Object.keys(projectSchema[prop])) {
|
|
402
|
+
promises.push(validateQueryConfig(context, projectSchema, {
|
|
403
|
+
query: projectSchema[prop][name],
|
|
404
|
+
operation,
|
|
405
|
+
name
|
|
406
|
+
}));
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return flatten(await Promise.all(promises));
|
|
410
|
+
}
|
|
411
|
+
function listShapeJoins(projectSchema) {
|
|
412
|
+
const joins = [];
|
|
413
|
+
for (const shapeKey of Object.keys(projectSchema.shapes)) {
|
|
414
|
+
const shape = projectSchema.shapes[shapeKey];
|
|
415
|
+
if (shape.joins) {
|
|
416
|
+
for (const joinRef of Object.keys(shape.joins)) {
|
|
417
|
+
const join = shape.joins[joinRef];
|
|
418
|
+
joins.push({
|
|
419
|
+
ref: joinRef,
|
|
420
|
+
path: ['shapes', shapeKey, 'joins', joinRef],
|
|
421
|
+
join
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return joins;
|
|
427
|
+
}
|
|
428
|
+
function validateLocalShapeJoinRef(projectSchema, item) {
|
|
429
|
+
const refItem = atRefToRefItem(projectSchema, item.ref);
|
|
430
|
+
if (refItem.serviceKey === 'local') {
|
|
431
|
+
const shape = refItemToShape(projectSchema, refItem);
|
|
432
|
+
if (!shape) {
|
|
433
|
+
return [
|
|
434
|
+
{
|
|
435
|
+
type: 'notFound',
|
|
436
|
+
path: item.path,
|
|
437
|
+
message: `Invalid join "${item.ref}" not found`
|
|
438
|
+
}
|
|
439
|
+
];
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return [];
|
|
443
|
+
}
|
|
444
|
+
function validateLocalShapeJoins(projectSchema) {
|
|
445
|
+
return listShapeJoins(projectSchema).flatMap((item) => validateLocalShapeJoinRef(projectSchema, item).concat(validateResolver(projectSchema, item.path.concat('resolver'), item.join.resolver)));
|
|
446
|
+
}
|
|
447
|
+
async function validateShapeJoinRef(context, projectSchema, item) {
|
|
448
|
+
const refItem = atRefToRefItem(projectSchema, item.ref);
|
|
449
|
+
if (refItem) {
|
|
450
|
+
const layer = await context.resolveLayer(refItem.serviceKey);
|
|
451
|
+
const valid = isValidRef(context, projectSchema, layer, refItem);
|
|
452
|
+
if (!valid) {
|
|
453
|
+
return [
|
|
454
|
+
{
|
|
455
|
+
type: 'notFound',
|
|
456
|
+
path: item.path,
|
|
457
|
+
message: `Invalid join "${item.ref}" not found`
|
|
458
|
+
}
|
|
459
|
+
];
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return [];
|
|
463
|
+
}
|
|
464
|
+
async function validateShapeJoins(context, projectSchema) {
|
|
465
|
+
const promises = [];
|
|
466
|
+
for (const item of listShapeJoins(projectSchema)) {
|
|
467
|
+
promises.push(validateShapeJoinRef(context, projectSchema, item), validateResolverReferences(context, projectSchema, item.path, item.join.resolver));
|
|
468
|
+
}
|
|
469
|
+
return flatten(await Promise.all(promises));
|
|
470
|
+
}
|
|
471
|
+
function validateShapeLoaders(context, projectSchema, shape) {
|
|
472
|
+
const errors = [];
|
|
473
|
+
if (shape.loaders) {
|
|
474
|
+
const getNamespace = createGetNamespace(projectSchema);
|
|
475
|
+
const listLoader = shape.loaders.list;
|
|
476
|
+
if (listLoader) {
|
|
477
|
+
ensureArray(listLoader).forEach((config, i) => {
|
|
478
|
+
const ref = parsePropertyRef(config.query);
|
|
479
|
+
const query = ref && get(projectSchema, propertyRefItemToPath(getNamespace, ref));
|
|
480
|
+
if (!query) {
|
|
481
|
+
errors.push({
|
|
482
|
+
path: Array.isArray(listLoader)
|
|
483
|
+
? ['shapes', shape.name, 'loaders', 'list', i, 'query']
|
|
484
|
+
: ['shapes', shape.name, 'loaders', 'list', 'query'],
|
|
485
|
+
type: 'notFound',
|
|
486
|
+
message: `Invalid query "${config.query}"`
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
const getLoader = shape.loaders.get;
|
|
492
|
+
if (getLoader) {
|
|
493
|
+
const ref = parsePropertyRef(getLoader.query);
|
|
494
|
+
const query = ref && get(projectSchema, propertyRefItemToPath(getNamespace, ref));
|
|
495
|
+
if (!query) {
|
|
496
|
+
errors.push({
|
|
497
|
+
path: ['shapes', shape.name, 'loaders', 'get', 'query'],
|
|
498
|
+
type: 'notFound',
|
|
499
|
+
message: `Invalid query "${getLoader.query}"`
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
if (shape.cache?.triggers && !context.ignoreEntitlements) {
|
|
505
|
+
const min = context.entitlements.minScheduleTriggerInterval ?? DEFAULT_MIN_SCHEDULE_TRIGGER_INTERVAL;
|
|
506
|
+
for (let i = 0; i < shape.cache.triggers.length; i++) {
|
|
507
|
+
const trigger = shape.cache.triggers[i];
|
|
508
|
+
if (trigger.type === 'schedule' && trigger.interval < min) {
|
|
509
|
+
errors.push({
|
|
510
|
+
path: ['shapes', shape.name, 'cache', 'triggers', i, 'interval'],
|
|
511
|
+
type: 'entitlement',
|
|
512
|
+
message: `Trigger interval ${trigger.interval} is below minimum ${min}`
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
return errors;
|
|
518
|
+
}
|
|
519
|
+
function visitProperties(projectSchema, callback) {
|
|
520
|
+
JSONPath('$..properties.*', projectSchema, (property, _type, { path: propertyPath }) => {
|
|
521
|
+
callback(property, propertyPath.slice(3, -2).split(`']['`));
|
|
522
|
+
}, undefined);
|
|
523
|
+
}
|
|
524
|
+
function validateIndexedShapes(context, projectSchema) {
|
|
525
|
+
const errors = [];
|
|
526
|
+
const { shapes } = projectSchema;
|
|
527
|
+
for (const shape of Object.values(shapes)) {
|
|
528
|
+
const newErrors = validateShapeLoaders(context, projectSchema, shape);
|
|
529
|
+
if (newErrors.length) {
|
|
530
|
+
errors.push(...newErrors);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
let nestedCount = 0;
|
|
534
|
+
visitProperties(projectSchema, (property, propertyPath) => {
|
|
535
|
+
const indexed = property['@indexed'];
|
|
536
|
+
if (isRecord(indexed) && indexed.nested) {
|
|
537
|
+
nestedCount += 1;
|
|
538
|
+
if (property.type !== 'array') {
|
|
539
|
+
errors.push({
|
|
540
|
+
path: propertyPath,
|
|
541
|
+
type: 'location',
|
|
542
|
+
message: 'Nested indexes may only appear next to fields of type: "array"'
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
if (nestedCount > 50) {
|
|
548
|
+
errors.push({
|
|
549
|
+
path: ['shapes'],
|
|
550
|
+
type: 'tooMany',
|
|
551
|
+
message: `${nestedCount} nested indexes found`
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
return errors;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Verify the path has an allOf schema and not just prop named "allOf"
|
|
558
|
+
*/
|
|
559
|
+
function isAllOfPath(path) {
|
|
560
|
+
const index = path.indexOf('allOf');
|
|
561
|
+
return index !== -1 && isIntegerLike(path[index + 1]);
|
|
562
|
+
}
|
|
563
|
+
function validateLocalRefs(projectSchema) {
|
|
564
|
+
const errors = [];
|
|
565
|
+
const shapeNames = new Set([...builtInShapeNames, ...Object.keys(projectSchema.shapes)]);
|
|
566
|
+
const refs = getAllRefs(projectSchema).filter((item) => !item.isForeign);
|
|
567
|
+
for (const item of refs) {
|
|
568
|
+
if (item.template && !isValidTemplate(item.template)) {
|
|
569
|
+
errors.push({
|
|
570
|
+
type: 'notFound',
|
|
571
|
+
path: item.path,
|
|
572
|
+
message: `Invalid template "${item.template}"`
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
const shapeName = refItemToNamespacedShapeName(item);
|
|
576
|
+
if (!shapeNames.has(shapeName)) {
|
|
577
|
+
const invalidRef = get(projectSchema, item.path);
|
|
578
|
+
const path = invalidRef.items ? [...item.path, 'items', '@ref'] : item.path;
|
|
579
|
+
const ref = get(projectSchema, path);
|
|
580
|
+
errors.push({
|
|
581
|
+
type: 'notFound',
|
|
582
|
+
path,
|
|
583
|
+
message: `Invalid ref "${ref}"`
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
// Make sure refs inside allOf don't refer to their own Shape
|
|
587
|
+
if (item.path[1] === shapeName && isAllOfPath(item.path)) {
|
|
588
|
+
errors.push({
|
|
589
|
+
type: 'conflict',
|
|
590
|
+
path: item.path,
|
|
591
|
+
message: 'allOf cannot be self-referential'
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
const parentPath = initial(item.path);
|
|
595
|
+
const parentSchema = get(projectSchema, parentPath);
|
|
596
|
+
const propName = last(item.path);
|
|
597
|
+
if (propName === '@ref' && parentSchema.$ref) {
|
|
598
|
+
errors.push({
|
|
599
|
+
type: 'conflict',
|
|
600
|
+
path: parentPath,
|
|
601
|
+
message: 'Ref cannot have both @ref and $ref'
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
return errors;
|
|
606
|
+
}
|
|
607
|
+
function isValidRef(context, projectSchema, layer, item) {
|
|
608
|
+
const { serviceKey: layerId } = item;
|
|
609
|
+
const shapeName = refItemToNamespacedShapeName(item);
|
|
610
|
+
const localShapeExists = Boolean(projectSchema.shapes[shapeName]) || builtInShapeNames.has(shapeName);
|
|
611
|
+
return (item.isValidService &&
|
|
612
|
+
(layerId === 'local' ? localShapeExists : localShapeExists || isValidShapeReference(context, layer, shapeName)));
|
|
613
|
+
}
|
|
614
|
+
function mustBeInterface({ path }) {
|
|
615
|
+
return path[0] === 'shapes' && path[2] === 'interfaces';
|
|
616
|
+
}
|
|
617
|
+
async function validateRefs(context, projectSchema) {
|
|
618
|
+
const { resolveLayer } = context;
|
|
619
|
+
const errors = [];
|
|
620
|
+
const refs = getAllRefs(projectSchema);
|
|
621
|
+
const layerIds = new Set();
|
|
622
|
+
for (const item of refs) {
|
|
623
|
+
if (item.serviceKey !== 'local') {
|
|
624
|
+
layerIds.add(item.serviceKey);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
const layersById = Object.fromEntries(await pMap(layerIds, async (layerId) => [layerId, await resolveLayer(layerId)]));
|
|
628
|
+
for (const item of refs) {
|
|
629
|
+
if (item.template && !isValidTemplate(item.template)) {
|
|
630
|
+
errors.push({
|
|
631
|
+
type: 'notFound',
|
|
632
|
+
path: item.path,
|
|
633
|
+
message: `Invalid template "${item.path}"`
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
const { serviceKey: layerId } = item;
|
|
637
|
+
const layer = layersById[layerId];
|
|
638
|
+
const valid = isValidRef(context, projectSchema, layer, item);
|
|
639
|
+
if (!valid) {
|
|
640
|
+
errors.push({
|
|
641
|
+
type: 'notFound',
|
|
642
|
+
path: item.path,
|
|
643
|
+
message: `Invalid ref "${get(projectSchema, item.path)}"`
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
else if (mustBeInterface(item) && (layerId === 'local' || layer?.status === 'ok')) {
|
|
647
|
+
// only validate interfaces with connected layers isValidRef above handles when allowDisconnectedLayers false
|
|
648
|
+
const context = layer?.schema ?? projectSchema;
|
|
649
|
+
const shape = get(context, item.path.slice(0, 2));
|
|
650
|
+
errors.push(...validateShapeImplementsInterface(context, shape, item, item.path));
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
return errors;
|
|
654
|
+
}
|
|
655
|
+
function visitShapePropertiesJson(projectSchema, callback) {
|
|
656
|
+
JSONPath('shapes.*.schema.properties.*', projectSchema, (property, _type, { path: propertyPath }) => {
|
|
657
|
+
callback(property, propertyPath.slice(3, -2).split(`']['`));
|
|
658
|
+
}, undefined);
|
|
659
|
+
}
|
|
660
|
+
function validateDirectives(projectSchema) {
|
|
661
|
+
const errors = [];
|
|
662
|
+
visitShapePropertiesJson(projectSchema, (property, propertyPath) => {
|
|
663
|
+
const resolver = property['@resolver'];
|
|
664
|
+
if (resolver) {
|
|
665
|
+
const propPath = propertyPath.concat('@resolver');
|
|
666
|
+
const resolverErrors = validateResolver(projectSchema, propPath, resolver);
|
|
667
|
+
if (resolverErrors) {
|
|
668
|
+
errors.push(...resolverErrors);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
return errors;
|
|
673
|
+
}
|
|
674
|
+
function validateOneOfs(projectSchema) {
|
|
675
|
+
const errors = [];
|
|
676
|
+
visitShapePropertiesJson(projectSchema, (property, propertyPath) => {
|
|
677
|
+
const oneOfPath = property.items ? ['items', 'oneOf'] : ['oneOf'];
|
|
678
|
+
const relationship = getRelationship(property);
|
|
679
|
+
const schema = (property.items ? property.items : property);
|
|
680
|
+
const isUnion = isUnionSchema(schema);
|
|
681
|
+
if (schema.oneOf && !relationship && !isUnion && !isEnumLikeSchema(schema)) {
|
|
682
|
+
errors.push({
|
|
683
|
+
type: 'conflict',
|
|
684
|
+
path: propertyPath.concat(oneOfPath),
|
|
685
|
+
message: 'Invalid oneOf must contain only @ref or title + enum/const schemas'
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
if (isUnion &&
|
|
689
|
+
schema.oneOf.length !== uniqBy(schema.oneOf, (refSchema) => getRefShapeName(projectSchema, refSchema)).length) {
|
|
690
|
+
errors.push({
|
|
691
|
+
type: 'conflict',
|
|
692
|
+
path: propertyPath.concat(oneOfPath),
|
|
693
|
+
message: 'Invalid oneOf must not contain duplicate references'
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
return errors;
|
|
698
|
+
}
|
|
699
|
+
function validateLocales(projectSchema) {
|
|
700
|
+
const { locales, defaultLocale } = projectSchema;
|
|
701
|
+
const errors = [];
|
|
702
|
+
if (locales && !locales.includes(defaultLocale)) {
|
|
703
|
+
errors.push({
|
|
704
|
+
type: 'notFound',
|
|
705
|
+
path: ['locales'],
|
|
706
|
+
message: `Default locale "${defaultLocale}" missing from locales`
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
return errors;
|
|
710
|
+
}
|
|
711
|
+
const importantFields = ['type', '@ref', 'allOf', 'oneOf', 'anyOf', 'extends', 'items', '@tag'];
|
|
712
|
+
function isSchemaEqual(a, b) {
|
|
713
|
+
return isEqual(pick(a, importantFields), pick(b, importantFields));
|
|
714
|
+
}
|
|
715
|
+
function matchesInterface(shape, interfaceShape, path) {
|
|
716
|
+
const errors = [];
|
|
717
|
+
const { schema } = shape;
|
|
718
|
+
const interfaceSchema = interfaceShape.schema;
|
|
719
|
+
for (const name of Object.keys(interfaceSchema.properties)) {
|
|
720
|
+
const propSchema = schema.properties[name];
|
|
721
|
+
const interfacePropSchema = interfaceSchema.properties[name];
|
|
722
|
+
if (!propSchema) {
|
|
723
|
+
errors.push({
|
|
724
|
+
type: 'notFound',
|
|
725
|
+
path,
|
|
726
|
+
message: `"${shape.name}" is missing property "${name}" required by interface "${interfaceShape.name}"`
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
else if (!isSchemaEqual(propSchema, interfacePropSchema)) {
|
|
730
|
+
errors.push({
|
|
731
|
+
type: 'conflict',
|
|
732
|
+
path: [...path, name],
|
|
733
|
+
message: `"${shape.name}.${name}" must match "${interfaceShape.name}.${name}"`
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
else {
|
|
737
|
+
const propRequired = Boolean(schema.required?.includes(name));
|
|
738
|
+
const interfacePropRequired = Boolean(interfaceSchema.required?.includes(name));
|
|
739
|
+
if (interfacePropRequired !== propRequired) {
|
|
740
|
+
errors.push({
|
|
741
|
+
type: 'conflict',
|
|
742
|
+
path: [...path, name],
|
|
743
|
+
message: `"${shape.name}.${name}" must ${interfacePropRequired ? '' : 'not '}be required to match "${interfaceShape.name}.${name}"`
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
return errors;
|
|
749
|
+
}
|
|
750
|
+
function validateShapeImplementsInterface(projectSchema, shape, interfaceRefItem, path) {
|
|
751
|
+
const errors = [];
|
|
752
|
+
const interfaceShape = refItemToShape(projectSchema, interfaceRefItem);
|
|
753
|
+
if (!interfaceShape) {
|
|
754
|
+
errors.push({
|
|
755
|
+
type: 'notFound',
|
|
756
|
+
path,
|
|
757
|
+
message: `Invalid interface "${refItemToAtRef(interfaceRefItem)}" not found`
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
else if (interfaceShape.type !== 'interface') {
|
|
761
|
+
errors.push({
|
|
762
|
+
type: 'conflict',
|
|
763
|
+
path,
|
|
764
|
+
message: `"${shape.name}" cannot implement non-interface "${interfaceShape.name}"`
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
else if (isExtendsSchema(shape.schema)) {
|
|
768
|
+
// TODO stricter extends validation needs https://app.shortcut.com/takeshape/story/9783/use-service-schemas-during-schema-validation
|
|
769
|
+
}
|
|
770
|
+
else if (isObjectSchema(shape.schema) && isObjectSchema(interfaceShape.schema)) {
|
|
771
|
+
const matchErrors = matchesInterface(shape, interfaceShape, [
|
|
772
|
+
'shapes',
|
|
773
|
+
shape.name,
|
|
774
|
+
'schema',
|
|
775
|
+
'properties'
|
|
776
|
+
]);
|
|
777
|
+
if (matchErrors.length) {
|
|
778
|
+
errors.push(...matchErrors);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
return errors;
|
|
782
|
+
}
|
|
783
|
+
function validateInterfaceImplementations(projectSchema) {
|
|
784
|
+
const errors = [];
|
|
785
|
+
for (const shape of Object.values(projectSchema.shapes)) {
|
|
786
|
+
if (shape.interfaces?.length) {
|
|
787
|
+
if (!isObjectSchema(shape.schema) && !isExtendsSchema(shape.schema)) {
|
|
788
|
+
return [
|
|
789
|
+
{
|
|
790
|
+
path: ['shapes', shape.name, 'schema'],
|
|
791
|
+
type: 'conflict',
|
|
792
|
+
message: `"${shape.name}" must have an object or extends schema to implement interfaces`
|
|
793
|
+
}
|
|
794
|
+
];
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
return errors;
|
|
799
|
+
}
|
|
800
|
+
function validateAgents(projectSchema) {
|
|
801
|
+
const getNamespace = createGetNamespace(projectSchema);
|
|
802
|
+
const errors = [];
|
|
803
|
+
const guards = projectSchema['ai-experimental']?.guards;
|
|
804
|
+
const agents = projectSchema['ai-experimental']?.agents;
|
|
805
|
+
if (!agents) {
|
|
806
|
+
return errors;
|
|
807
|
+
}
|
|
808
|
+
for (const [agentName, agent] of Object.entries(agents)) {
|
|
809
|
+
const stateNames = new Set();
|
|
810
|
+
const agentPath = ['ai-experimental', 'agents', agentName];
|
|
811
|
+
for (const [stateId, state] of Object.entries(agent.states)) {
|
|
812
|
+
const statePath = [...agentPath, 'states', stateId];
|
|
813
|
+
if (stateNames.has(state.name)) {
|
|
814
|
+
errors.push({
|
|
815
|
+
path: [...statePath, 'name'],
|
|
816
|
+
type: 'conflict',
|
|
817
|
+
message: `Duplicate state name "${state.name}"`
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
else {
|
|
821
|
+
stateNames.add(state.name);
|
|
822
|
+
}
|
|
823
|
+
if (state.execution.type === 'generate' || state.execution.type === 'chat') {
|
|
824
|
+
if (!state.execution.tools) {
|
|
825
|
+
continue;
|
|
826
|
+
}
|
|
827
|
+
state.execution.tools.forEach((tool, toolIndex) => {
|
|
828
|
+
pushErrors(errors, validateAIToolConfig(projectSchema, getNamespace, tool, [
|
|
829
|
+
...statePath,
|
|
830
|
+
'execution',
|
|
831
|
+
'tools',
|
|
832
|
+
toolIndex,
|
|
833
|
+
'ref'
|
|
834
|
+
]));
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
if (agent.guards) {
|
|
839
|
+
const invalidGuards = agent.guards.filter(({ guardId }) => !guards?.[guardId]);
|
|
840
|
+
if (invalidGuards.length) {
|
|
841
|
+
const guardPath = [...agentPath, 'guards'];
|
|
842
|
+
errors.push(...invalidGuards.map(({ guardId }, index) => ({
|
|
843
|
+
path: [...guardPath, index, 'guardId'],
|
|
844
|
+
type: 'notFound',
|
|
845
|
+
message: `Invalid guardId "${guardId}"`
|
|
846
|
+
})));
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
return errors;
|
|
851
|
+
}
|
|
852
|
+
function validateInterfaces(projectSchema) {
|
|
853
|
+
const errors = [];
|
|
854
|
+
// Validate interface shapes must be an object schema with at least one property
|
|
855
|
+
for (const shape of Object.values(projectSchema.shapes)) {
|
|
856
|
+
if (shape.type === 'interface') {
|
|
857
|
+
if (shape.model) {
|
|
858
|
+
errors.push({
|
|
859
|
+
path: ['shapes', shape.name, 'model'],
|
|
860
|
+
type: 'conflict',
|
|
861
|
+
message: `"${shape.name}" may not be both an interface and model. Create a separate model shape which implements this interface.`
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
else if (isObjectSchema(shape.schema)) {
|
|
865
|
+
if (size(shape.schema.properties) === 0) {
|
|
866
|
+
errors.push({
|
|
867
|
+
path: ['shapes', shape.name, 'schema', 'properties'],
|
|
868
|
+
type: 'conflict',
|
|
869
|
+
message: `Interface "${shape.name}" must define at least one property`
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
else {
|
|
874
|
+
errors.push({
|
|
875
|
+
path: ['shapes', shape.name, 'schema'],
|
|
876
|
+
type: 'conflict',
|
|
877
|
+
message: `Interface "${shape.name}" must define an object schema`
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return errors;
|
|
883
|
+
}
|
|
884
|
+
function isValidateReferencesContext(context) {
|
|
885
|
+
return Boolean(context.resolveLayer);
|
|
886
|
+
}
|
|
887
|
+
const ajv = createAjv();
|
|
888
|
+
function validateStructure(schemaVersion, context, schema, ref) {
|
|
889
|
+
const coerced = coerce(schemaVersion);
|
|
890
|
+
const versionStr = coerced?.format();
|
|
891
|
+
const hasExperimental = Boolean(coerced && gte(coerced, '3.48.0'));
|
|
892
|
+
const relevantSchemas = allProjectSchemas.filter((metaSchema) => (hasExperimental && metaSchema.$id.endsWith('experimental#')) || metaSchema.$id.endsWith(`v${versionStr}#`));
|
|
893
|
+
for (const relevantSchema of relevantSchemas) {
|
|
894
|
+
if (!ajv.getSchema(relevantSchema.$id)) {
|
|
895
|
+
ajv.addSchema(relevantSchema);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
ajv.validate(`https://schema.takeshape.io/project-schema/v${versionStr}#${ref ?? ''}`, schema);
|
|
899
|
+
let errors = ajv.errors?.map(formatError) ?? [];
|
|
900
|
+
const { suppressErrorPaths } = context;
|
|
901
|
+
if (errors.length && suppressErrorPaths) {
|
|
902
|
+
errors = errors.filter((error) => {
|
|
903
|
+
return !suppressErrorPaths.includes(error.path.join('.'));
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
if (errors.length) {
|
|
907
|
+
return {
|
|
908
|
+
valid: false,
|
|
909
|
+
schema: undefined,
|
|
910
|
+
errors
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
return {
|
|
914
|
+
valid: true,
|
|
915
|
+
schema: schema,
|
|
916
|
+
errors: undefined
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
function validateGuards(context, schema) {
|
|
920
|
+
const errors = [];
|
|
921
|
+
if (context.ignoreEntitlements) {
|
|
922
|
+
return errors;
|
|
923
|
+
}
|
|
924
|
+
const numOfGuards = schema['ai-experimental']?.guards ? Object.keys(schema['ai-experimental']?.guards).length : 0;
|
|
925
|
+
const entitledToGuards = context.entitlements.guards ?? 0;
|
|
926
|
+
if (numOfGuards > entitledToGuards) {
|
|
927
|
+
errors.push({
|
|
928
|
+
type: 'entitlement',
|
|
929
|
+
message: `Number of guards exceeds your entitled limit of ${entitledToGuards}`,
|
|
930
|
+
path: ['ai-experimental', 'guards']
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
return errors;
|
|
934
|
+
}
|
|
935
|
+
function formatValidationResult(context, errors, schema) {
|
|
936
|
+
const { suppressErrorPaths } = context;
|
|
937
|
+
if (suppressErrorPaths) {
|
|
938
|
+
errors = errors.filter((error) => {
|
|
939
|
+
return !suppressErrorPaths.includes(error.path.join('.'));
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
return errors.length ? { valid: false, schema: undefined, errors } : { valid: true, schema, errors: undefined };
|
|
943
|
+
}
|
|
944
|
+
function validateSyntax(context, schema) {
|
|
945
|
+
let errors = [];
|
|
946
|
+
errors = errors
|
|
947
|
+
.concat(checkShapeNames(schema.shapes))
|
|
948
|
+
.concat(checkShapeIds(schema.shapes))
|
|
949
|
+
.concat(validateWorkflows(schema))
|
|
950
|
+
.concat(validateLocalQueryConfigs(schema))
|
|
951
|
+
.concat(validateLocalRefs(schema))
|
|
952
|
+
.concat(validateLocalShapeJoins(schema))
|
|
953
|
+
.concat(validateDirectives(schema))
|
|
954
|
+
.concat(validateLocales(schema))
|
|
955
|
+
.concat(checkWorkflowStepNames(schema.workflows))
|
|
956
|
+
.concat(checkWorkflowStepKeys(schema.workflows))
|
|
957
|
+
.concat(validateOneOfs(schema))
|
|
958
|
+
.concat(validateIndexedShapes(context, schema))
|
|
959
|
+
.concat(validateInterfaces(schema))
|
|
960
|
+
.concat(validateInterfaceImplementations(schema))
|
|
961
|
+
.concat(validateAgents(schema))
|
|
962
|
+
.concat(validateGuards(context, schema));
|
|
963
|
+
return formatValidationResult(context, errors, schema);
|
|
964
|
+
}
|
|
965
|
+
async function validateReferences(context, schema) {
|
|
966
|
+
const errors = flatten(await Promise.all([
|
|
967
|
+
validateRefs(context, schema),
|
|
968
|
+
validateQueryConfigs(context, schema),
|
|
969
|
+
validateShapeJoins(context, schema)
|
|
970
|
+
]));
|
|
971
|
+
return formatValidationResult(context, errors, schema);
|
|
972
|
+
}
|
|
973
|
+
const schemaUndefinedResult = {
|
|
974
|
+
valid: false,
|
|
975
|
+
schema: undefined,
|
|
976
|
+
errors: [{ path: [], type: 'undefined', message: 'Schema is undefined' }]
|
|
977
|
+
};
|
|
978
|
+
const invalidVersionResult = {
|
|
979
|
+
valid: false,
|
|
980
|
+
schema: undefined,
|
|
981
|
+
errors: [{ path: [], type: 'invalidVersion', message: 'Unknown schema version' }]
|
|
982
|
+
};
|
|
983
|
+
function normalizeSchemaVersion(obj) {
|
|
984
|
+
if (isRecord(obj)) {
|
|
985
|
+
return typeof obj.schemaVersion === 'string' ? obj.schemaVersion : '1';
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
export function validateSchemaSyntax(obj, options = {}) {
|
|
989
|
+
if (isUndefined(obj)) {
|
|
990
|
+
return schemaUndefinedResult;
|
|
991
|
+
}
|
|
992
|
+
const schemaVersion = normalizeSchemaVersion(obj);
|
|
993
|
+
if (!schemaVersion) {
|
|
994
|
+
return invalidVersionResult;
|
|
995
|
+
}
|
|
996
|
+
return validateStructure(schemaVersion, options, obj);
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Validates a schema using a matching validation based on the `schemaVersion` property.
|
|
1000
|
+
*/
|
|
1001
|
+
export async function validateSchema(context, obj) {
|
|
1002
|
+
if (isUndefined(obj)) {
|
|
1003
|
+
return schemaUndefinedResult;
|
|
1004
|
+
}
|
|
1005
|
+
const contextWithDefaults = {
|
|
1006
|
+
allowDisconnectedLayers: true,
|
|
1007
|
+
...context
|
|
1008
|
+
};
|
|
1009
|
+
const schemaVersion = normalizeSchemaVersion(obj);
|
|
1010
|
+
if (!schemaVersion) {
|
|
1011
|
+
return invalidVersionResult;
|
|
1012
|
+
}
|
|
1013
|
+
const structuralValidation = validateStructure(schemaVersion, contextWithDefaults, obj);
|
|
1014
|
+
if (!structuralValidation.valid) {
|
|
1015
|
+
return structuralValidation;
|
|
1016
|
+
}
|
|
1017
|
+
const { schema } = structuralValidation;
|
|
1018
|
+
if (!isLatestProjectSchemaJSON(schema)) {
|
|
1019
|
+
return invalidVersionResult;
|
|
1020
|
+
}
|
|
1021
|
+
const syntaxValidation = validateSyntax(contextWithDefaults, schema);
|
|
1022
|
+
if (!syntaxValidation.valid || !isValidateReferencesContext(contextWithDefaults)) {
|
|
1023
|
+
return syntaxValidation;
|
|
1024
|
+
}
|
|
1025
|
+
return validateReferences(contextWithDefaults, schema);
|
|
1026
|
+
}
|
|
1027
|
+
export function ensureValidLatestSchemaSyntax(obj) {
|
|
1028
|
+
const { valid, schema, errors } = validateSchemaSyntax(obj);
|
|
1029
|
+
if (!valid && errors) {
|
|
1030
|
+
throw new Error(`Invalid Schema "${errors[0].path.join(',')}": "${errors[0].message}"`);
|
|
1031
|
+
}
|
|
1032
|
+
if (isUndefined(schema)) {
|
|
1033
|
+
throw new Error('Invalid schema: schema is undefined');
|
|
1034
|
+
}
|
|
1035
|
+
if (neq(CURRENT_SCHEMA_VERSION, coerce(schema.schemaVersion) ?? LEGACY_SCHEMA_VERSION)) {
|
|
1036
|
+
throw new Error(`Expected schemaVersion: "${CURRENT_SCHEMA_VERSION}", got "${schema.schemaVersion}"`);
|
|
1037
|
+
}
|
|
1038
|
+
return schema;
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* The roles import validator ensures required properties, and strips several
|
|
1042
|
+
* which might exist in an export but wouldn't apply to an import operation.
|
|
1043
|
+
*/
|
|
1044
|
+
function createRoleInputValidator() {
|
|
1045
|
+
const validator = createAjv({ useDefaults: true, removeAdditional: true });
|
|
1046
|
+
const { RoleInput, ...definitions } = authSchemas.definitions;
|
|
1047
|
+
return validator.compile({
|
|
1048
|
+
$id: 'RoleInput',
|
|
1049
|
+
definitions,
|
|
1050
|
+
...RoleInput
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Validates and returns a `RoleInput`, which is a subset of the `Role`
|
|
1055
|
+
* type's properties suitable for importing.
|
|
1056
|
+
*/
|
|
1057
|
+
export function validateRoleInput(maybeRoleInput) {
|
|
1058
|
+
const validate = createRoleInputValidator();
|
|
1059
|
+
if (validate(maybeRoleInput)) {
|
|
1060
|
+
return maybeRoleInput;
|
|
1061
|
+
}
|
|
1062
|
+
throw new SchemaValidationError('RoleInput was invalid', validate.errors?.map(formatError));
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* The roles import validator ensures required properties, and strips several
|
|
1066
|
+
* which might exist in an export but wouldn't apply to an import operation.
|
|
1067
|
+
*/
|
|
1068
|
+
function createRoleImportValidator() {
|
|
1069
|
+
const validator = createAjv({ useDefaults: true, removeAdditional: true });
|
|
1070
|
+
const { RoleImport, ...definitions } = authSchemas.definitions;
|
|
1071
|
+
return validator.compile({
|
|
1072
|
+
$id: 'RoleImport',
|
|
1073
|
+
definitions,
|
|
1074
|
+
...RoleImport
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* Validates and returns a `RoleImport` array, which is a collection of `RoleInput`s.
|
|
1079
|
+
*/
|
|
1080
|
+
export function ensureValidRoleImport(maybeRoles) {
|
|
1081
|
+
const validate = createRoleImportValidator();
|
|
1082
|
+
if (validate(maybeRoles)) {
|
|
1083
|
+
return maybeRoles;
|
|
1084
|
+
}
|
|
1085
|
+
throw new SchemaValidationError('Roles were invalid', validate.errors?.map(formatError));
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* Only use when validating an imported schema! ignore fields optional when importing
|
|
1089
|
+
*/
|
|
1090
|
+
export function validateProjectSchemaImport(maybeSchema) {
|
|
1091
|
+
return validateSchemaSyntax(maybeSchema, {
|
|
1092
|
+
suppressErrorPaths: [...projectSchemaImportOptionalProps, ...legacyProjectSchemaImportOptionalProps]
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Only use when validating an imported schema!
|
|
1097
|
+
*
|
|
1098
|
+
* New style validation for parity with the `validateRoleImport` fn. Returns
|
|
1099
|
+
* a valid, clean `ImportProjectSchema` or throws a `SchemaValidationError`.
|
|
1100
|
+
*/
|
|
1101
|
+
export function ensureValidProjectSchemaImport(maybeSchema) {
|
|
1102
|
+
const validateResult = validateProjectSchemaImport(maybeSchema);
|
|
1103
|
+
if (validateResult.valid) {
|
|
1104
|
+
return validateResult.schema;
|
|
1105
|
+
}
|
|
1106
|
+
throw new SchemaValidationError('ProjectSchema could not be validated', validateResult.errors);
|
|
1107
|
+
}
|