@takeshape/schema 11.45.5 → 11.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/src/agents.js +6 -6
- package/dist/cjs/src/api-version.js +1 -1
- package/dist/cjs/src/content-schema-transform.js +12 -12
- package/dist/cjs/src/create-input-schema.js +1 -1
- package/dist/cjs/src/enum.js +1 -1
- package/dist/cjs/src/flatten-templates.js +4 -4
- package/dist/cjs/src/get-is-leaf.js +1 -1
- package/dist/cjs/src/interfaces.js +11 -9
- package/dist/cjs/src/layers/layers.js +11 -5
- package/dist/cjs/src/layers/refs.js +3 -3
- package/dist/cjs/src/layers/type-utils.js +1 -1
- package/dist/cjs/src/migration/index.js +3 -1
- package/dist/cjs/src/migration/to/v3.0.0.js +20 -8
- package/dist/cjs/src/migration/to/v3.1.0.js +6 -4
- package/dist/cjs/src/migration/to/v3.10.0.js +1 -1
- package/dist/cjs/src/migration/to/v3.13.0.js +1 -1
- package/dist/cjs/src/migration/to/v3.17.0.js +1 -1
- package/dist/cjs/src/migration/to/v3.18.0.js +4 -4
- package/dist/cjs/src/migration/to/v3.18.1.js +1 -1
- package/dist/cjs/src/migration/to/v3.18.2.js +1 -1
- package/dist/cjs/src/migration/to/v3.20.0.js +5 -2
- package/dist/cjs/src/migration/to/v3.22.0.js +1 -1
- package/dist/cjs/src/migration/to/v3.31.0.js +2 -2
- package/dist/cjs/src/migration/to/v3.32.0.js +3 -1
- package/dist/cjs/src/migration/to/v3.34.0.js +6 -9
- package/dist/cjs/src/migration/to/v3.36.0.js +1 -1
- package/dist/cjs/src/migration/to/v3.39.0.js +8 -8
- package/dist/cjs/src/migration/to/v3.40.0.js +1 -1
- package/dist/cjs/src/migration/to/v3.46.0.js +1 -1
- package/dist/cjs/src/migration/to/v3.51.0.js +12 -0
- package/dist/cjs/src/migration/to/v3.9.0.js +3 -3
- package/dist/cjs/src/models/project-schema.js +4 -4
- package/dist/cjs/src/models/shape.js +2 -2
- package/dist/cjs/src/project-schema/index.js +4 -2
- package/dist/cjs/src/project-schema/migrate.js +3 -1
- package/dist/cjs/src/project-schema/v3.51.0.js +8 -0
- package/dist/cjs/src/refs.js +28 -18
- package/dist/cjs/src/relationships.js +25 -20
- package/dist/cjs/src/runtime-schema.js +16 -9
- package/dist/cjs/src/schema-transform.js +3 -3
- package/dist/cjs/src/schema-util.js +38 -30
- package/dist/cjs/src/schemas/auth-schemas.json +18 -78
- package/dist/cjs/src/schemas/index.js +18 -16
- package/dist/cjs/src/schemas/project-schema/experimental.json +7 -20
- package/dist/cjs/src/schemas/project-schema/latest.json +166 -566
- package/dist/cjs/src/schemas/project-schema/meta-schema-v1.0.0.json +3 -17
- package/dist/cjs/src/schemas/project-schema/meta-schema-v3.0.0.json +4 -4
- package/dist/cjs/src/schemas/project-schema/meta-schema-v3.1.0.json +4 -4
- package/dist/cjs/src/schemas/project-schema/meta-schema-v3.2.0.json +5 -5
- package/dist/cjs/src/schemas/project-schema/meta-schema-v3.3.0.json +5 -5
- package/dist/cjs/src/schemas/project-schema/meta-schema-v3.4.0.json +11 -43
- package/dist/cjs/src/schemas/project-schema/meta-schema-v3.5.0.json +7 -7
- package/dist/cjs/src/schemas/project-schema/meta-schema-v3.5.1.json +8 -11
- package/dist/cjs/src/schemas/project-schema/meta-schema-v3.6.0.json +8 -11
- package/dist/cjs/src/schemas/project-schema/meta-schema-v3.7.0.json +11 -9
- package/dist/cjs/src/schemas/project-schema/meta-schema-v3.8.0.json +11 -9
- package/dist/cjs/src/schemas/project-schema/meta-schema-v3.9.0.json +24 -22
- package/dist/cjs/src/schemas/project-schema/v1.0.0.json +3 -3
- package/dist/cjs/src/schemas/project-schema/v3.0.0.json +1 -1
- package/dist/cjs/src/schemas/project-schema/v3.1.0.json +2 -2
- package/dist/cjs/src/schemas/project-schema/v3.10.0.json +32 -30
- package/dist/cjs/src/schemas/project-schema/v3.11.0.json +32 -30
- package/dist/cjs/src/schemas/project-schema/v3.12.0.json +33 -36
- package/dist/cjs/src/schemas/project-schema/v3.12.1.json +33 -36
- package/dist/cjs/src/schemas/project-schema/v3.12.2.json +2122 -2125
- package/dist/cjs/src/schemas/project-schema/v3.12.3.json +2175 -2178
- package/dist/cjs/src/schemas/project-schema/v3.13.0.json +32 -30
- package/dist/cjs/src/schemas/project-schema/v3.14.0.json +32 -30
- package/dist/cjs/src/schemas/project-schema/v3.15.0.json +40 -38
- package/dist/cjs/src/schemas/project-schema/v3.16.0.json +40 -38
- package/dist/cjs/src/schemas/project-schema/v3.17.0.json +47 -39
- package/dist/cjs/src/schemas/project-schema/v3.17.1.json +2204 -2196
- package/dist/cjs/src/schemas/project-schema/v3.18.0.json +40 -38
- package/dist/cjs/src/schemas/project-schema/v3.18.1.json +40 -38
- package/dist/cjs/src/schemas/project-schema/v3.18.2.json +40 -38
- package/dist/cjs/src/schemas/project-schema/v3.19.0.json +40 -38
- package/dist/cjs/src/schemas/project-schema/v3.2.0.json +1 -1
- package/dist/cjs/src/schemas/project-schema/v3.20.0.json +40 -38
- package/dist/cjs/src/schemas/project-schema/v3.21.0.json +41 -39
- package/dist/cjs/src/schemas/project-schema/v3.22.0.json +41 -39
- package/dist/cjs/src/schemas/project-schema/v3.23.0.json +43 -43
- package/dist/cjs/src/schemas/project-schema/v3.24.0.json +105 -458
- package/dist/cjs/src/schemas/project-schema/v3.25.0.json +105 -458
- package/dist/cjs/src/schemas/project-schema/v3.26.0.json +107 -466
- package/dist/cjs/src/schemas/project-schema/v3.27.0.json +107 -466
- package/dist/cjs/src/schemas/project-schema/v3.28.0.json +112 -471
- package/dist/cjs/src/schemas/project-schema/v3.29.0.json +112 -471
- package/dist/cjs/src/schemas/project-schema/v3.3.0.json +1 -1
- package/dist/cjs/src/schemas/project-schema/v3.30.0.json +112 -472
- package/dist/cjs/src/schemas/project-schema/v3.31.0.json +112 -486
- package/dist/cjs/src/schemas/project-schema/v3.32.0.json +113 -488
- package/dist/cjs/src/schemas/project-schema/v3.33.0.json +113 -488
- package/dist/cjs/src/schemas/project-schema/v3.34.0.json +113 -488
- package/dist/cjs/src/schemas/project-schema/v3.35.0.json +114 -491
- package/dist/cjs/src/schemas/project-schema/v3.36.0.json +114 -491
- package/dist/cjs/src/schemas/project-schema/v3.37.0.json +118 -511
- package/dist/cjs/src/schemas/project-schema/v3.38.0.json +118 -511
- package/dist/cjs/src/schemas/project-schema/v3.39.0.json +118 -511
- package/dist/cjs/src/schemas/project-schema/v3.4.0.json +1 -1
- package/dist/cjs/src/schemas/project-schema/v3.40.0.json +118 -512
- package/dist/cjs/src/schemas/project-schema/v3.41.0.json +118 -512
- package/dist/cjs/src/schemas/project-schema/v3.42.0.json +118 -512
- package/dist/cjs/src/schemas/project-schema/v3.43.0.json +118 -512
- package/dist/cjs/src/schemas/project-schema/v3.44.0.json +125 -540
- package/dist/cjs/src/schemas/project-schema/v3.45.0.json +128 -554
- package/dist/cjs/src/schemas/project-schema/v3.46.0.json +129 -560
- package/dist/cjs/src/schemas/project-schema/v3.47.0.json +131 -568
- package/dist/cjs/src/schemas/project-schema/v3.48.0.json +132 -572
- package/dist/cjs/src/schemas/project-schema/v3.49.0.json +132 -558
- package/dist/cjs/src/schemas/project-schema/v3.5.0.json +1 -1
- package/dist/cjs/src/schemas/project-schema/v3.5.1.json +1 -1
- package/dist/cjs/src/schemas/project-schema/v3.50.0.json +165 -565
- package/dist/cjs/src/schemas/project-schema/v3.51.0.json +3320 -0
- package/dist/cjs/src/schemas/project-schema/v3.6.0.json +1 -1
- package/dist/cjs/src/schemas/project-schema/v3.7.0.json +1 -1
- package/dist/cjs/src/schemas/project-schema/v3.8.0.json +1 -1
- package/dist/cjs/src/schemas/project-schema/v3.9.0.json +1 -1
- package/dist/cjs/src/schemas/project-schema/v4.0.0.json +31 -29
- package/dist/cjs/src/schemas/project-schema.json +3 -0
- package/dist/cjs/src/schemas/user-schema.json +2 -9
- package/dist/cjs/src/service-dependencies.js +15 -9
- package/dist/cjs/src/services/services.js +12 -11
- package/dist/cjs/src/services/util.js +4 -4
- package/dist/cjs/src/template-shapes/templates.js +18 -12
- package/dist/cjs/src/template-shapes/where.js +23 -14
- package/dist/cjs/src/types/utils.js +3 -3
- package/dist/cjs/src/unions.js +6 -8
- package/dist/cjs/src/util/api-indexing.js +4 -4
- package/dist/cjs/src/util/detect-cycles.js +2 -2
- package/dist/cjs/src/util/find-shape-at-path.js +1 -1
- package/dist/cjs/src/util/form-config.js +0 -1
- package/dist/cjs/src/util/get-conflicting-properties.js +1 -1
- package/dist/cjs/src/util/merge.js +22 -13
- package/dist/cjs/src/util/patch-schema.js +2 -2
- package/dist/cjs/src/util/shapes.js +2 -2
- package/dist/cjs/src/validate.js +64 -47
- package/dist/cjs/src/workflows.js +4 -4
- package/dist/esm/src/agents.js +6 -6
- package/dist/esm/src/api-version.js +1 -1
- package/dist/esm/src/content-schema-transform.js +12 -12
- package/dist/esm/src/create-input-schema.js +1 -1
- package/dist/esm/src/enum.js +1 -1
- package/dist/esm/src/flatten-templates.js +4 -4
- package/dist/esm/src/get-is-leaf.js +1 -1
- package/dist/esm/src/interfaces.js +12 -10
- package/dist/esm/src/layers/layers.js +12 -6
- package/dist/esm/src/layers/refs.js +3 -3
- package/dist/esm/src/layers/type-utils.js +1 -1
- package/dist/esm/src/migration/index.js +3 -1
- package/dist/esm/src/migration/to/v3.0.0.js +20 -8
- package/dist/esm/src/migration/to/v3.1.0.js +6 -4
- package/dist/esm/src/migration/to/v3.10.0.js +1 -1
- package/dist/esm/src/migration/to/v3.13.0.js +1 -1
- package/dist/esm/src/migration/to/v3.17.0.js +1 -1
- package/dist/esm/src/migration/to/v3.18.0.js +4 -4
- package/dist/esm/src/migration/to/v3.18.1.js +1 -1
- package/dist/esm/src/migration/to/v3.18.2.js +1 -1
- package/dist/esm/src/migration/to/v3.20.0.js +5 -2
- package/dist/esm/src/migration/to/v3.22.0.js +1 -1
- package/dist/esm/src/migration/to/v3.31.0.js +2 -2
- package/dist/esm/src/migration/to/v3.32.0.js +3 -1
- package/dist/esm/src/migration/to/v3.34.0.js +6 -9
- package/dist/esm/src/migration/to/v3.36.0.js +1 -1
- package/dist/esm/src/migration/to/v3.39.0.js +8 -8
- package/dist/esm/src/migration/to/v3.40.0.js +1 -1
- package/dist/esm/src/migration/to/v3.46.0.js +1 -1
- package/dist/esm/src/migration/to/v3.51.0.js +10 -0
- package/dist/esm/src/migration/to/v3.9.0.js +3 -3
- package/dist/esm/src/mocks.js +1 -1
- package/dist/esm/src/models/project-schema.js +4 -4
- package/dist/esm/src/models/shape.js +2 -2
- package/dist/esm/src/project-schema/index.js +3 -1
- package/dist/esm/src/project-schema/migrate.js +4 -2
- package/dist/esm/src/project-schema/v3.51.0.js +7 -0
- package/dist/esm/src/refs.js +29 -19
- package/dist/esm/src/relationships.js +26 -21
- package/dist/esm/src/runtime-schema.js +16 -9
- package/dist/esm/src/schema-transform.js +3 -3
- package/dist/esm/src/schema-util.js +40 -32
- package/dist/esm/src/schemas/auth-schemas.json +18 -78
- package/dist/esm/src/schemas/index.js +15 -13
- package/dist/esm/src/schemas/project-schema/experimental.json +7 -20
- package/dist/esm/src/schemas/project-schema/latest.json +166 -566
- package/dist/esm/src/schemas/project-schema/meta-schema-v1.0.0.json +3 -17
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.0.0.json +4 -4
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.1.0.json +4 -4
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.2.0.json +5 -5
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.3.0.json +5 -5
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.4.0.json +11 -43
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.5.0.json +7 -7
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.5.1.json +8 -11
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.6.0.json +8 -11
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.7.0.json +11 -9
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.8.0.json +11 -9
- package/dist/esm/src/schemas/project-schema/meta-schema-v3.9.0.json +24 -22
- package/dist/esm/src/schemas/project-schema/v1.0.0.json +3 -3
- package/dist/esm/src/schemas/project-schema/v3.0.0.json +1 -1
- package/dist/esm/src/schemas/project-schema/v3.1.0.json +2 -2
- package/dist/esm/src/schemas/project-schema/v3.10.0.json +32 -30
- package/dist/esm/src/schemas/project-schema/v3.11.0.json +32 -30
- package/dist/esm/src/schemas/project-schema/v3.12.0.json +33 -36
- package/dist/esm/src/schemas/project-schema/v3.12.1.json +33 -36
- package/dist/esm/src/schemas/project-schema/v3.12.2.json +2122 -2125
- package/dist/esm/src/schemas/project-schema/v3.12.3.json +2175 -2178
- package/dist/esm/src/schemas/project-schema/v3.13.0.json +32 -30
- package/dist/esm/src/schemas/project-schema/v3.14.0.json +32 -30
- package/dist/esm/src/schemas/project-schema/v3.15.0.json +40 -38
- package/dist/esm/src/schemas/project-schema/v3.16.0.json +40 -38
- package/dist/esm/src/schemas/project-schema/v3.17.0.json +47 -39
- package/dist/esm/src/schemas/project-schema/v3.17.1.json +2204 -2196
- package/dist/esm/src/schemas/project-schema/v3.18.0.json +40 -38
- package/dist/esm/src/schemas/project-schema/v3.18.1.json +40 -38
- package/dist/esm/src/schemas/project-schema/v3.18.2.json +40 -38
- package/dist/esm/src/schemas/project-schema/v3.19.0.json +40 -38
- package/dist/esm/src/schemas/project-schema/v3.2.0.json +1 -1
- package/dist/esm/src/schemas/project-schema/v3.20.0.json +40 -38
- package/dist/esm/src/schemas/project-schema/v3.21.0.json +41 -39
- package/dist/esm/src/schemas/project-schema/v3.22.0.json +41 -39
- package/dist/esm/src/schemas/project-schema/v3.23.0.json +43 -43
- package/dist/esm/src/schemas/project-schema/v3.24.0.json +105 -458
- package/dist/esm/src/schemas/project-schema/v3.25.0.json +105 -458
- package/dist/esm/src/schemas/project-schema/v3.26.0.json +107 -466
- package/dist/esm/src/schemas/project-schema/v3.27.0.json +107 -466
- package/dist/esm/src/schemas/project-schema/v3.28.0.json +112 -471
- package/dist/esm/src/schemas/project-schema/v3.29.0.json +112 -471
- package/dist/esm/src/schemas/project-schema/v3.3.0.json +1 -1
- package/dist/esm/src/schemas/project-schema/v3.30.0.json +112 -472
- package/dist/esm/src/schemas/project-schema/v3.31.0.json +112 -486
- package/dist/esm/src/schemas/project-schema/v3.32.0.json +113 -488
- package/dist/esm/src/schemas/project-schema/v3.33.0.json +113 -488
- package/dist/esm/src/schemas/project-schema/v3.34.0.json +113 -488
- package/dist/esm/src/schemas/project-schema/v3.35.0.json +114 -491
- package/dist/esm/src/schemas/project-schema/v3.36.0.json +114 -491
- package/dist/esm/src/schemas/project-schema/v3.37.0.json +118 -511
- package/dist/esm/src/schemas/project-schema/v3.38.0.json +118 -511
- package/dist/esm/src/schemas/project-schema/v3.39.0.json +118 -511
- package/dist/esm/src/schemas/project-schema/v3.4.0.json +1 -1
- package/dist/esm/src/schemas/project-schema/v3.40.0.json +118 -512
- package/dist/esm/src/schemas/project-schema/v3.41.0.json +118 -512
- package/dist/esm/src/schemas/project-schema/v3.42.0.json +118 -512
- package/dist/esm/src/schemas/project-schema/v3.43.0.json +118 -512
- package/dist/esm/src/schemas/project-schema/v3.44.0.json +125 -540
- package/dist/esm/src/schemas/project-schema/v3.45.0.json +128 -554
- package/dist/esm/src/schemas/project-schema/v3.46.0.json +129 -560
- package/dist/esm/src/schemas/project-schema/v3.47.0.json +131 -568
- package/dist/esm/src/schemas/project-schema/v3.48.0.json +132 -572
- package/dist/esm/src/schemas/project-schema/v3.49.0.json +132 -558
- package/dist/esm/src/schemas/project-schema/v3.5.0.json +1 -1
- package/dist/esm/src/schemas/project-schema/v3.5.1.json +1 -1
- package/dist/esm/src/schemas/project-schema/v3.50.0.json +165 -565
- package/dist/esm/src/schemas/project-schema/v3.51.0.json +3320 -0
- package/dist/esm/src/schemas/project-schema/v3.6.0.json +1 -1
- package/dist/esm/src/schemas/project-schema/v3.7.0.json +1 -1
- package/dist/esm/src/schemas/project-schema/v3.8.0.json +1 -1
- package/dist/esm/src/schemas/project-schema/v3.9.0.json +1 -1
- package/dist/esm/src/schemas/project-schema/v4.0.0.json +31 -29
- package/dist/esm/src/schemas/project-schema.json +3 -0
- package/dist/esm/src/schemas/user-schema.json +2 -9
- package/dist/esm/src/service-dependencies.js +17 -11
- package/dist/esm/src/services/services.js +12 -11
- package/dist/esm/src/services/util.js +4 -4
- package/dist/esm/src/template-shapes/templates.js +18 -12
- package/dist/esm/src/template-shapes/where.js +24 -15
- package/dist/esm/src/types/utils.js +3 -3
- package/dist/esm/src/unions.js +6 -8
- package/dist/esm/src/util/api-indexing.js +4 -4
- package/dist/esm/src/util/detect-cycles.js +2 -2
- package/dist/esm/src/util/find-shape-at-path.js +1 -1
- package/dist/esm/src/util/form-config.js +0 -1
- package/dist/esm/src/util/get-conflicting-properties.js +1 -1
- package/dist/esm/src/util/merge.js +23 -14
- package/dist/esm/src/util/patch-schema.js +2 -2
- package/dist/esm/src/util/shapes.js +2 -2
- package/dist/esm/src/validate.js +64 -47
- package/dist/esm/src/workflows.js +4 -4
- package/dist/types/src/agents.d.ts +1 -1
- package/dist/types/src/builtin-schema.d.ts +2 -2
- package/dist/types/src/content-schema-transform.d.ts +1 -1
- package/dist/types/src/create-input-schema.d.ts +1 -1
- package/dist/types/src/enum.d.ts +1 -1
- package/dist/types/src/flatten-templates.d.ts +1 -1
- package/dist/types/src/layers/layers.d.ts +1 -1
- package/dist/types/src/layers/refs.d.ts +1 -1
- package/dist/types/src/layers/type-utils.d.ts +1 -1
- package/dist/types/src/layers/visitor.d.ts +2 -2
- package/dist/types/src/migration/index.d.ts +1 -0
- package/dist/types/src/migration/to/v3.17.1.d.ts +1 -1
- package/dist/types/src/migration/to/v3.19.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.21.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.22.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.23.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.24.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.25.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.26.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.27.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.28.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.29.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.30.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.31.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.32.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.33.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.34.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.35.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.36.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.37.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.38.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.39.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.40.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.41.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.42.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.43.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.44.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.45.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.46.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.47.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.48.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.49.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.50.0.d.ts +1 -1
- package/dist/types/src/migration/to/v3.51.0.d.ts +4 -0
- package/dist/types/src/migration/types.d.ts +1 -1
- package/dist/types/src/mocks.d.ts +1 -1
- package/dist/types/src/models/project-schema.d.ts +3 -3
- package/dist/types/src/models/query.d.ts +2 -2
- package/dist/types/src/models/service.d.ts +2 -2
- package/dist/types/src/models/shape.d.ts +2 -2
- package/dist/types/src/project-schema/index.d.ts +4 -1
- package/dist/types/src/project-schema/latest.d.ts +28 -10
- package/dist/types/src/project-schema/v3.50.0.d.ts +27 -9
- package/dist/types/src/project-schema/v3.51.0.d.ts +2189 -0
- package/dist/types/src/refs.d.ts +1 -1
- package/dist/types/src/relationships.d.ts +2 -2
- package/dist/types/src/runtime-schema.d.ts +1 -1
- package/dist/types/src/schema-transform.d.ts +1 -1
- package/dist/types/src/schema-util.d.ts +2 -2
- package/dist/types/src/schemas/index.d.ts +2 -2
- package/dist/types/src/service-dependencies.d.ts +2 -2
- package/dist/types/src/services/services.d.ts +3 -3
- package/dist/types/src/services/util.d.ts +2 -2
- package/dist/types/src/template-shapes/index.d.ts +2 -2
- package/dist/types/src/template-shapes/names.d.ts +1 -1
- package/dist/types/src/template-shapes/types.d.ts +2 -2
- package/dist/types/src/template-shapes/where.d.ts +1 -1
- package/dist/types/src/types/transforms.d.ts +1 -1
- package/dist/types/src/types/types.d.ts +4 -4
- package/dist/types/src/types/utils.d.ts +2 -2
- package/dist/types/src/unions.d.ts +2 -2
- package/dist/types/src/util/ai-tools.d.ts +1 -1
- package/dist/types/src/util/api-indexing.d.ts +1 -1
- package/dist/types/src/util/detect-cycles.d.ts +1 -1
- package/dist/types/src/util/find-shape-at-path.d.ts +1 -1
- package/dist/types/src/util/form-config.d.ts +1 -1
- package/dist/types/src/util/get-conflicting-properties.d.ts +1 -1
- package/dist/types/src/util/get-return-shape.d.ts +1 -1
- package/dist/types/src/util/has-arg.d.ts +2 -2
- package/dist/types/src/util/merge.d.ts +1 -1
- package/dist/types/src/util/patch-schema.d.ts +2 -2
- package/dist/types/src/util/shapes.d.ts +1 -1
- package/dist/types/src/validate.d.ts +4 -4
- package/dist/types/src/workflows.d.ts +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/examples/latest/agent-schema.json +5 -13
- package/examples/latest/all-fields-shapes-inline.json +19 -53
- package/examples/latest/all-fields-shapes.json +27 -77
- package/examples/latest/betzino.json +903 -3140
- package/examples/latest/blog-schema.json +9 -29
- package/examples/latest/brewery-schema.json +8 -26
- package/examples/latest/clear-cache-schema.json +4 -8
- package/examples/latest/complex-project-schema.json +99 -360
- package/examples/latest/complex-schema.json +487 -1754
- package/examples/latest/edit-schema.json +5 -12
- package/examples/latest/fabric-ecommerce.json +188 -839
- package/examples/latest/frank-and-fred-schema.json +489 -1756
- package/examples/latest/klirr-schema.json +683 -2412
- package/examples/latest/layers/rick-and-morty-layer.json +12 -33
- package/examples/latest/layers/shopify-layer-2023-01.json +2207 -8638
- package/examples/latest/layers/shopify-storefront-2023-04.json +403 -1713
- package/examples/latest/layers/wordpress-2024-01.json +689 -2744
- package/examples/latest/massive-schema.json +132 -585
- package/examples/latest/mill-components-schema.json +30 -126
- package/examples/latest/nested-shape-arrays.json +8 -20
- package/examples/latest/one-earth.json +237 -1114
- package/examples/latest/pet-oneof-array.json +8 -23
- package/examples/latest/post-schema.json +7 -21
- package/examples/latest/pruned-shopify-product-schema.json +186 -831
- package/examples/latest/rag-example.json +6 -16
- package/examples/latest/real-world-schema.json +15 -57
- package/examples/latest/recursive-repeater-schema.json +5 -12
- package/examples/latest/recursive-schema.json +5 -12
- package/examples/latest/rick-and-morty-ast.json +46 -175
- package/examples/latest/rick-and-morty-graphql.json +26 -101
- package/examples/latest/rick-and-morty-rest.json +4 -8
- package/examples/latest/rick-and-morty-with-indexing.json +6 -14
- package/examples/latest/schema-where-filter.json +12 -41
- package/examples/latest/schema-with-repeater-draftjs.json +4 -9
- package/examples/latest/schema-with-rick-and-morty.json +3 -5
- package/examples/latest/shape-books-v3_2_0.json +18 -72
- package/examples/latest/shape-books.json +18 -72
- package/examples/latest/shape-editor-schema-edited.json +24 -70
- package/examples/latest/shape-editor-schema-initial.json +11 -29
- package/examples/latest/shapedb-crud-every-prop-type.json +9 -23
- package/examples/latest/shopify-lookbook.json +6 -20
- package/examples/latest/shopify-product-2022-07.json +727 -3218
- package/examples/latest/shopify-product-2023-04.json +1013 -4497
- package/examples/latest/shopify-store-with-widget.json +214 -943
- package/examples/latest/stripe-product-runtime-schema.json +82 -278
- package/examples/latest/stripe-starter-resolved.json +477 -1954
- package/examples/latest/user-schema-no-required.json +4 -14
- package/examples/latest/user-schema-with-defaults.json +6 -28
- package/examples/latest/valvoline-ai-demo.json +18 -70
- package/examples/latest/vector-search-schema.json +9 -25
- package/examples/source/agent-schema.json +29 -16
- package/examples/source/all-fields-shapes-inline.json +21 -30
- package/examples/source/all-fields-shapes.json +26 -76
- package/examples/source/betzino.json +1501 -4960
- package/examples/source/blog-schema.json +1 -1
- package/examples/source/brewery-schema.json +1 -1
- package/examples/source/clear-cache-schema.json +4 -4
- package/examples/source/complex-project-schema.json +196 -688
- package/examples/source/edit-schema.json +3 -3
- package/examples/source/fabric-ecommerce.json +186 -837
- package/examples/source/frank-and-fred-schema.json +1136 -3929
- package/examples/source/layers/rick-and-morty-layer.json +10 -31
- package/examples/source/layers/shopify-layer-2023-01.json +2205 -8636
- package/examples/source/layers/shopify-storefront-2023-04.json +401 -1711
- package/examples/source/layers/wordpress-2024-01.json +689 -2743
- package/examples/source/massive-schema.json +386 -1455
- package/examples/source/nested-shape-arrays.json +12 -12
- package/examples/source/pet-oneof-array.json +31 -29
- package/examples/source/post-schema.json +1 -1
- package/examples/source/pruned-shopify-product-schema.json +184 -829
- package/examples/source/rag-example.json +5 -15
- package/examples/source/real-world-schema.json +32 -119
- package/examples/source/recursive-repeater-schema.json +3 -8
- package/examples/source/recursive-schema.json +1 -1
- package/examples/source/rick-and-morty-ast.json +66 -251
- package/examples/source/rick-and-morty-graphql.json +41 -162
- package/examples/source/rick-and-morty-rest.json +24 -6
- package/examples/source/rick-and-morty-with-indexing.json +25 -25
- package/examples/source/schema-where-filter.json +29 -50
- package/examples/source/schema-with-repeater-draftjs.json +9 -31
- package/examples/source/schema-with-rick-and-morty.json +4 -4
- package/examples/source/shape-books.json +49 -181
- package/examples/source/shape-editor-schema-edited.json +22 -68
- package/examples/source/shape-editor-schema-initial.json +9 -27
- package/examples/source/shapedb-crud-every-prop-type.json +20 -29
- package/examples/source/shopify-product-2022-07.json +736 -3261
- package/examples/source/shopify-product-2023-04.json +1022 -4540
- package/examples/source/shopify-store-with-widget.json +212 -941
- package/examples/source/stripe-product-runtime-schema.json +91 -321
- package/examples/source/stripe-starter-resolved.json +475 -1952
- package/examples/source/user-schema-with-defaults.json +1 -9
- package/examples/source/valvoline-ai-demo.json +175 -219
- package/examples/source/vector-search-schema.json +37 -38
- package/examples/v4_0_0/rick-and-morty-notes/flattened-schema.json +15 -49
- package/examples/v4_0_0/rick-and-morty-notes/layers/character-notes.json +8 -8
- package/examples/v4_0_0/rick-and-morty-notes/layers/takeshape-builtins.json +1 -3
- package/examples/v4_0_0/rick-and-morty-notes/layers/takeshape-static-sites.json +19 -79
- package/examples/v4_0_0/rick-and-morty-notes/schema.json +8 -5
- package/examples/v4_0_0/shopify-lookbook/flattened-schema.json +190 -851
- package/examples/v4_0_0/shopify-lookbook/layers/andrews-store.json +1103 -4431
- package/examples/v4_0_0/shopify-lookbook/layers/lookbook.json +64 -56
- package/examples/v4_0_0/shopify-lookbook/layers/takeshape-assets.json +1 -4
- package/examples/v4_0_0/shopify-lookbook/layers/takeshape-builtins.json +1 -3
- package/examples/v4_0_0/shopify-lookbook/schema.json +3 -10
- package/package.json +12 -9
package/dist/cjs/src/unions.js
CHANGED
|
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createWrapTransform = exports.createUnwrapTransform = exports.oneOfToObject = exports.isUnionSchema = exports.enumerateOneOfKeys = void 0;
|
|
7
|
+
const errors_1 = require("@takeshape/errors");
|
|
7
8
|
const util_1 = require("@takeshape/util");
|
|
8
9
|
const omit_js_1 = __importDefault(require("lodash/omit.js"));
|
|
9
|
-
const errors_1 = require("@takeshape/errors");
|
|
10
10
|
const refs_1 = require("./refs");
|
|
11
|
+
const names_1 = require("./template-shapes/names");
|
|
11
12
|
const utils_1 = require("./types/utils");
|
|
12
13
|
const shapes_1 = require("./util/shapes");
|
|
13
|
-
const names_1 = require("./template-shapes/names");
|
|
14
14
|
function enumerateOneOfKeys(projectSchema, oneOf) {
|
|
15
15
|
const result = [];
|
|
16
16
|
for (const child of oneOf) {
|
|
@@ -50,15 +50,14 @@ function oneOfToObject(projectSchema, schema) {
|
|
|
50
50
|
}
|
|
51
51
|
exports.oneOfToObject = oneOfToObject;
|
|
52
52
|
function formatKeys(keys) {
|
|
53
|
-
return keys.map(k => `"${k}"`).join(', ');
|
|
53
|
+
return keys.map((k) => `"${k}"`).join(', ');
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
const createUnwrapTransform = projectSchema => (obj, schema, name, shape, next) => {
|
|
55
|
+
const createUnwrapTransform = (projectSchema) => (obj, schema, name, shape, next) => {
|
|
57
56
|
if ((0, util_1.isRecord)(obj)) {
|
|
58
57
|
const oneOfKeys = enumerateOneOfKeys(projectSchema, getOneOf(schema));
|
|
59
58
|
const objectKeys = Object.keys(obj);
|
|
60
59
|
if (objectKeys.length !== 1) {
|
|
61
|
-
const propNames = oneOfKeys.map(k => k.propName);
|
|
60
|
+
const propNames = oneOfKeys.map((k) => k.propName);
|
|
62
61
|
throw new errors_1.BadDataError(`Object should only specify one of the following keys: ${formatKeys(propNames)}, but found keys: ${formatKeys(objectKeys)}`);
|
|
63
62
|
}
|
|
64
63
|
for (const { propName, shapeId, propSchema } of oneOfKeys) {
|
|
@@ -76,8 +75,7 @@ const createUnwrapTransform = projectSchema => (obj, schema, name, shape, next)
|
|
|
76
75
|
}
|
|
77
76
|
};
|
|
78
77
|
exports.createUnwrapTransform = createUnwrapTransform;
|
|
79
|
-
|
|
80
|
-
const createWrapTransform = projectSchema => (obj, schema, name, shape, next) => {
|
|
78
|
+
const createWrapTransform = (projectSchema) => (obj, schema, name, shape, next) => {
|
|
81
79
|
if ((0, util_1.isRecord)(obj) && typeof obj._shapeId === 'string') {
|
|
82
80
|
const shape = (0, shapes_1.getShapeById)(projectSchema, obj._shapeId);
|
|
83
81
|
if (shape) {
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getGetQueryIndexConfig = exports.getListQueryIndexConfigs = exports.getIndexedServices = exports.serviceHasIndexedShapes = void 0;
|
|
4
4
|
const util_1 = require("@takeshape/util");
|
|
5
|
-
const types_1 = require("../types");
|
|
6
|
-
const util_2 = require("../services/util");
|
|
7
|
-
const schema_util_1 = require("../schema-util");
|
|
8
5
|
const refs_1 = require("../refs");
|
|
6
|
+
const schema_util_1 = require("../schema-util");
|
|
7
|
+
const util_2 = require("../services/util");
|
|
8
|
+
const types_1 = require("../types");
|
|
9
9
|
function serviceHasIndexedShapes(schema, serviceId) {
|
|
10
10
|
for (const shape of Object.values(schema.shapes ?? {})) {
|
|
11
11
|
const indexingEnabled = (0, types_1.isCachedShape)(shape);
|
|
@@ -31,7 +31,7 @@ function getIndexedServices(projectSchema, configs) {
|
|
|
31
31
|
exports.getIndexedServices = getIndexedServices;
|
|
32
32
|
function flattenListQueryConfigs(base, queryConfig, maybeConfigArray) {
|
|
33
33
|
return (maybeConfigArray &&
|
|
34
|
-
(0, util_1.ensureArray)(maybeConfigArray).flatMap(config => (0, util_1.ensureArray)(config.args).map(args => ({
|
|
34
|
+
(0, util_1.ensureArray)(maybeConfigArray).flatMap((config) => (0, util_1.ensureArray)(config.args).map((args) => ({
|
|
35
35
|
...base,
|
|
36
36
|
...queryConfig,
|
|
37
37
|
...config,
|
|
@@ -30,14 +30,14 @@ function hasCycle(projectSchema, schema, predicate = (0, util_1.value)(true)) {
|
|
|
30
30
|
}
|
|
31
31
|
const combo = schema.oneOf ?? schema.allOf ?? schema.extends;
|
|
32
32
|
if (combo) {
|
|
33
|
-
return combo.some(childSchema => hasCycleHelper(childSchema, shapesSeen, shapeName, propName));
|
|
33
|
+
return combo.some((childSchema) => hasCycleHelper(childSchema, shapesSeen, shapeName, propName));
|
|
34
34
|
}
|
|
35
35
|
if (schema.items) {
|
|
36
36
|
return hasCycleHelper(schema.items, shapesSeen, shapeName, propName);
|
|
37
37
|
}
|
|
38
38
|
const { properties } = schema;
|
|
39
39
|
if (properties) {
|
|
40
|
-
return Object.keys(properties).some(name => {
|
|
40
|
+
return Object.keys(properties).some((name) => {
|
|
41
41
|
const propSchema = properties[name];
|
|
42
42
|
return hasCycleHelper(propSchema, shapesSeen, shapeName, name);
|
|
43
43
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findShapeAtPath = exports.findSchemaAtPath = void 0;
|
|
4
|
-
const types_1 = require("../types");
|
|
5
4
|
const refs_1 = require("../refs");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
8
|
* @param projectSchema
|
|
@@ -16,7 +16,6 @@ function normalizeForms(projectSchema) {
|
|
|
16
16
|
if (!forms[shapeName]) {
|
|
17
17
|
normalizedForms[shapeName] ||= { default: (0, util_1.deepClone)(formConfig) };
|
|
18
18
|
// Remove prop now that it has been normalized
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
20
19
|
delete normalizedForms[shapeName].default.properties[propName];
|
|
21
20
|
}
|
|
22
21
|
};
|
|
@@ -11,7 +11,7 @@ function getRefStrings(context, propertySchema) {
|
|
|
11
11
|
const schema = propertySchema.items ?? propertySchema;
|
|
12
12
|
const schemas = schema.oneOf ? schema.oneOf : [schema];
|
|
13
13
|
return schemas
|
|
14
|
-
.map(propertySchema => {
|
|
14
|
+
.map((propertySchema) => {
|
|
15
15
|
const ref = (0, refs_1.getRef)(context, propertySchema);
|
|
16
16
|
return ref ? (0, refs_1.refItemToAtRef)(ref) : undefined;
|
|
17
17
|
})
|
|
@@ -5,26 +5,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.mergeProjectSchemas = exports.mergeFormConfigs = exports.rebaseFormProperties = exports.mergeFormProperties = exports.rebaseSchemaProperties = exports.mergeSchemaProperties = exports.mergeDeepObjectSchemas = exports.mergeObjectSchemas = void 0;
|
|
7
7
|
const util_1 = require("@takeshape/util");
|
|
8
|
-
const
|
|
8
|
+
const lodash_1 = require("lodash");
|
|
9
9
|
const difference_js_1 = __importDefault(require("lodash/difference.js"));
|
|
10
10
|
const isEqual_js_1 = __importDefault(require("lodash/isEqual.js"));
|
|
11
|
-
const unset_js_1 = __importDefault(require("lodash/unset.js"));
|
|
12
|
-
const set_js_1 = __importDefault(require("lodash/set.js"));
|
|
13
11
|
const last_js_1 = __importDefault(require("lodash/last.js"));
|
|
14
12
|
const omit_js_1 = __importDefault(require("lodash/omit.js"));
|
|
15
13
|
const pickBy_js_1 = __importDefault(require("lodash/pickBy.js"));
|
|
16
|
-
const
|
|
14
|
+
const set_js_1 = __importDefault(require("lodash/set.js"));
|
|
15
|
+
const union_js_1 = __importDefault(require("lodash/union.js"));
|
|
16
|
+
const unset_js_1 = __importDefault(require("lodash/unset.js"));
|
|
17
17
|
const types_1 = require("../types");
|
|
18
18
|
function mergeObjectSchemas(...args) {
|
|
19
|
-
return args
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
return args.filter(util_1.isDefined).reduce((parent, schemas) => mergeSchemaProperties(parent, schemas), {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {}
|
|
22
|
+
});
|
|
22
23
|
}
|
|
23
24
|
exports.mergeObjectSchemas = mergeObjectSchemas;
|
|
24
25
|
function mergeDeepObjectSchemas(...args) {
|
|
25
|
-
return args
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
return args.filter(util_1.isDefined).reduce((parent, schemas) => mergeSchemaProperties(parent, schemas, true), {
|
|
27
|
+
type: 'object',
|
|
28
|
+
properties: {}
|
|
29
|
+
});
|
|
28
30
|
}
|
|
29
31
|
exports.mergeDeepObjectSchemas = mergeDeepObjectSchemas;
|
|
30
32
|
function mergeSchemaProperties(parent, overrides, deep = false) {
|
|
@@ -34,6 +36,10 @@ function mergeSchemaProperties(parent, overrides, deep = false) {
|
|
|
34
36
|
? (0, lodash_1.assignWith)({}, parent.properties, overrides.properties, (objValue, srcValue) => {
|
|
35
37
|
// merge objects if possible
|
|
36
38
|
if (objValue !== undefined && srcValue !== undefined) {
|
|
39
|
+
// skip merging if they are equal this avoids allOf with duplicate refs
|
|
40
|
+
if ((0, isEqual_js_1.default)(objValue, srcValue)) {
|
|
41
|
+
return objValue;
|
|
42
|
+
}
|
|
37
43
|
if ((0, types_1.isObjectSchema)(objValue) && (0, types_1.isObjectSchema)(srcValue)) {
|
|
38
44
|
return mergeObjectSchemas(objValue, srcValue);
|
|
39
45
|
}
|
|
@@ -127,7 +133,7 @@ function compareSection(section, original, updated) {
|
|
|
127
133
|
return changes;
|
|
128
134
|
}
|
|
129
135
|
function compareSections(parent, branch) {
|
|
130
|
-
return mergeableSections.flatMap(section => parent[section] ?? branch[section] ? compareSection(section, parent[section] ?? {}, branch[section] ?? {}) : []);
|
|
136
|
+
return mergeableSections.flatMap((section) => (parent[section] ?? branch[section]) ? compareSection(section, parent[section] ?? {}, branch[section] ?? {}) : []);
|
|
131
137
|
}
|
|
132
138
|
function findChangedShape(schema, change) {
|
|
133
139
|
return schema.shapes[change.path[1]];
|
|
@@ -230,7 +236,7 @@ function mergeProjectSchemas(base, parent, head) {
|
|
|
230
236
|
const changesFrom = compareSections(parent, head);
|
|
231
237
|
const mergedSchema = (0, util_1.deepClone)(base);
|
|
232
238
|
for (let change of changesFrom) {
|
|
233
|
-
const potentialConflict = changesTo.find(changeTo => (0, isEqual_js_1.default)(changeTo.path, change.path));
|
|
239
|
+
const potentialConflict = changesTo.find((changeTo) => (0, isEqual_js_1.default)(changeTo.path, change.path));
|
|
234
240
|
if (potentialConflict) {
|
|
235
241
|
if (potentialConflict.op === 'remove' && change.op !== 'remove') {
|
|
236
242
|
return {
|
|
@@ -244,7 +250,10 @@ function mergeProjectSchemas(base, parent, head) {
|
|
|
244
250
|
const mergedValue = attemptToMerge(base, parent, head, change);
|
|
245
251
|
// eslint-disable-next-line max-depth
|
|
246
252
|
if (!mergedValue) {
|
|
247
|
-
return {
|
|
253
|
+
return {
|
|
254
|
+
error: `Unable to merge ${change.path.join('.')} schemas conflict`,
|
|
255
|
+
mergedSchema: undefined
|
|
256
|
+
};
|
|
248
257
|
}
|
|
249
258
|
change = { ...change, op: 'add', value: mergedValue };
|
|
250
259
|
}
|
|
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.patchSchema = void 0;
|
|
7
|
-
const omit_js_1 = __importDefault(require("lodash/omit.js"));
|
|
8
|
-
const get_js_1 = __importDefault(require("lodash/get.js"));
|
|
9
7
|
const set_js_1 = __importDefault(require("lodash/fp/set.js"));
|
|
8
|
+
const get_js_1 = __importDefault(require("lodash/get.js"));
|
|
9
|
+
const omit_js_1 = __importDefault(require("lodash/omit.js"));
|
|
10
10
|
const unset_js_1 = __importDefault(require("lodash/unset.js"));
|
|
11
11
|
/**
|
|
12
12
|
* Array of lodash.get paths to keys that are merged when applying a schema update.
|
|
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ensureShapeById = exports.ensureShape = exports.getShape = exports.getShapeById = void 0;
|
|
7
|
-
const find_js_1 = __importDefault(require("lodash/find.js"));
|
|
8
7
|
const errors_1 = require("@takeshape/errors");
|
|
8
|
+
const find_js_1 = __importDefault(require("lodash/find.js"));
|
|
9
9
|
function getShapeById(projectSchema, shapeId) {
|
|
10
|
-
return (0, find_js_1.default)(projectSchema.shapes, shape => shape.id === shapeId);
|
|
10
|
+
return (0, find_js_1.default)(projectSchema.shapes, (shape) => shape.id === shapeId);
|
|
11
11
|
}
|
|
12
12
|
exports.getShapeById = getShapeById;
|
|
13
13
|
function getShape(context, name) {
|
package/dist/cjs/src/validate.js
CHANGED
|
@@ -4,41 +4,41 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ensureValidProjectSchemaImport = exports.validateProjectSchemaImport = exports.ensureValidRoleImport = exports.validateRoleInput = exports.ensureValidLatestSchemaSyntax = exports.validateSchema = exports.validateSchemaSyntax = exports.formatError = exports.builtInShapeNames = void 0;
|
|
7
|
-
const jsonpath_plus_1 = require("jsonpath-plus");
|
|
8
|
-
const json_schema_1 = require("@takeshape/json-schema");
|
|
9
7
|
const errors_1 = require("@takeshape/errors");
|
|
10
|
-
const
|
|
11
|
-
const neq_js_1 = __importDefault(require("semver/functions/neq.js"));
|
|
12
|
-
const lt_js_1 = __importDefault(require("semver/functions/lt.js"));
|
|
13
|
-
const gte_js_1 = __importDefault(require("semver/functions/gte.js"));
|
|
14
|
-
const isUndefined_js_1 = __importDefault(require("lodash/isUndefined.js"));
|
|
8
|
+
const json_schema_1 = require("@takeshape/json-schema");
|
|
15
9
|
const util_1 = require("@takeshape/util");
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const last_js_1 = __importDefault(require("lodash/last.js"));
|
|
10
|
+
const jsonpath_plus_1 = require("jsonpath-plus");
|
|
11
|
+
const lodash_1 = require("lodash");
|
|
19
12
|
const get_js_1 = __importDefault(require("lodash/get.js"));
|
|
20
|
-
const
|
|
13
|
+
const initial_js_1 = __importDefault(require("lodash/initial.js"));
|
|
21
14
|
const isEqual_js_1 = __importDefault(require("lodash/isEqual.js"));
|
|
15
|
+
const isUndefined_js_1 = __importDefault(require("lodash/isUndefined.js"));
|
|
16
|
+
const last_js_1 = __importDefault(require("lodash/last.js"));
|
|
22
17
|
const pick_js_1 = __importDefault(require("lodash/pick.js"));
|
|
18
|
+
const size_js_1 = __importDefault(require("lodash/size.js"));
|
|
19
|
+
const uniqBy_js_1 = __importDefault(require("lodash/uniqBy.js"));
|
|
23
20
|
const p_map_1 = __importDefault(require("p-map"));
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
21
|
+
const coerce_js_1 = __importDefault(require("semver/functions/coerce.js"));
|
|
22
|
+
const gte_js_1 = __importDefault(require("semver/functions/gte.js"));
|
|
23
|
+
const lt_js_1 = __importDefault(require("semver/functions/lt.js"));
|
|
24
|
+
const neq_js_1 = __importDefault(require("semver/functions/neq.js"));
|
|
25
|
+
const builtin_schema_1 = require("./builtin-schema");
|
|
26
|
+
const enum_1 = require("./enum");
|
|
27
|
+
const project_schema_1 = require("./project-schema");
|
|
28
|
+
const refs_1 = require("./refs");
|
|
29
|
+
const relationships_1 = require("./relationships");
|
|
30
|
+
const scalars_1 = require("./scalars");
|
|
31
|
+
const schema_util_1 = require("./schema-util");
|
|
27
32
|
const schemas_1 = require("./schemas");
|
|
28
33
|
const auth_schemas_json_1 = __importDefault(require("./schemas/auth-schemas.json"));
|
|
29
|
-
const schema_util_1 = require("./schema-util");
|
|
30
|
-
const builtin_schema_1 = require("./builtin-schema");
|
|
31
34
|
const template_shapes_1 = require("./template-shapes");
|
|
35
|
+
const types_1 = require("./types/types");
|
|
32
36
|
const utils_1 = require("./types/utils");
|
|
33
|
-
const refs_1 = require("./refs");
|
|
34
|
-
const scalars_1 = require("./scalars");
|
|
35
37
|
const unions_1 = require("./unions");
|
|
36
|
-
const enum_1 = require("./enum");
|
|
37
|
-
const relationships_1 = require("./relationships");
|
|
38
|
-
const types_1 = require("./types/types");
|
|
39
|
-
const project_schema_1 = require("./project-schema");
|
|
40
|
-
const shapes_1 = require("./util/shapes");
|
|
41
38
|
const ai_tools_1 = require("./util/ai-tools");
|
|
39
|
+
const shapes_1 = require("./util/shapes");
|
|
40
|
+
const versions_1 = require("./versions");
|
|
41
|
+
const workflows_1 = require("./workflows");
|
|
42
42
|
exports.builtInShapeNames = new Set([...Object.keys(builtin_schema_1.builtInShapes), ...scalars_1.scalars, 'object']);
|
|
43
43
|
function findDuplicates(items) {
|
|
44
44
|
const seen = {};
|
|
@@ -51,19 +51,25 @@ function findDuplicates(items) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
return Object.entries(seen)
|
|
54
|
-
.filter(entry => entry[1].length > 1)
|
|
55
|
-
.flatMap(entry => ({ value: entry[0], paths: entry[1] }));
|
|
54
|
+
.filter((entry) => entry[1].length > 1)
|
|
55
|
+
.flatMap((entry) => ({ value: entry[0], paths: entry[1] }));
|
|
56
56
|
}
|
|
57
57
|
function checkShapeIds(shapes) {
|
|
58
|
-
const items = Object.entries(shapes).map(entry => ({
|
|
59
|
-
|
|
58
|
+
const items = Object.entries(shapes).map((entry) => ({
|
|
59
|
+
path: ['shapes', entry[0], 'id'],
|
|
60
|
+
value: entry[1].id
|
|
61
|
+
}));
|
|
62
|
+
return findDuplicates(items).flatMap((dupe) => dupe.paths.map((path) => ({
|
|
60
63
|
path,
|
|
61
64
|
type: 'conflict',
|
|
62
65
|
message: `Shapes must have unique ids. "${dupe.value}" is not unique.`
|
|
63
66
|
})));
|
|
64
67
|
}
|
|
65
68
|
function checkShapeNames(shapes) {
|
|
66
|
-
Object.entries(shapes).map(entry => ({
|
|
69
|
+
Object.entries(shapes).map((entry) => ({
|
|
70
|
+
path: ['shapes', entry[0], 'id'],
|
|
71
|
+
value: entry[1].id
|
|
72
|
+
}));
|
|
67
73
|
return Object.entries(shapes)
|
|
68
74
|
.filter(([name, shape]) => name !== shape.name)
|
|
69
75
|
.map(([name, shape]) => ({
|
|
@@ -78,7 +84,7 @@ function checkWorkflowStepNames(workflows) {
|
|
|
78
84
|
path: ['workflows', name, 'steps', i, 'name'],
|
|
79
85
|
value: step.name.toLowerCase()
|
|
80
86
|
}));
|
|
81
|
-
return findDuplicates(items).flatMap(dupe => dupe.paths.map(path => ({
|
|
87
|
+
return findDuplicates(items).flatMap((dupe) => dupe.paths.map((path) => ({
|
|
82
88
|
path,
|
|
83
89
|
type: 'conflict',
|
|
84
90
|
message: `Workflow steps must have unique names. "${dupe.value}" is not unique in workflow "${workflow.name}."`
|
|
@@ -86,8 +92,11 @@ function checkWorkflowStepNames(workflows) {
|
|
|
86
92
|
});
|
|
87
93
|
}
|
|
88
94
|
function checkWorkflowStepKeys(workflows) {
|
|
89
|
-
const items = Object.entries(workflows).flatMap(([name, workflow]) => workflow.steps.map((step, i) => ({
|
|
90
|
-
|
|
95
|
+
const items = Object.entries(workflows).flatMap(([name, workflow]) => workflow.steps.map((step, i) => ({
|
|
96
|
+
path: ['workflows', name, 'steps', i, 'key'],
|
|
97
|
+
value: step.key
|
|
98
|
+
})));
|
|
99
|
+
return findDuplicates(items).flatMap((dupe) => dupe.paths.map((path) => ({
|
|
91
100
|
path,
|
|
92
101
|
type: 'conflict',
|
|
93
102
|
message: `Workflow keys must be unique at the schema level. Key "${dupe.value}" is not unique.`
|
|
@@ -163,7 +172,7 @@ const validateAIToolConfig = (projectSchema, getNamespace, tool, basePath) => {
|
|
|
163
172
|
return {
|
|
164
173
|
type: 'conflict',
|
|
165
174
|
path,
|
|
166
|
-
message:
|
|
175
|
+
message: 'Tools must be a query or mutation'
|
|
167
176
|
};
|
|
168
177
|
}
|
|
169
178
|
const property = (0, get_js_1.default)(projectSchema, propertyPath);
|
|
@@ -246,7 +255,7 @@ function validateResolver(projectSchema, basePath, baseResolver) {
|
|
|
246
255
|
else if (toolChoice && toolChoice !== 'auto' && toolChoice !== 'none') {
|
|
247
256
|
const parsed = (0, refs_1.parsePropertyRef)(toolChoice);
|
|
248
257
|
if (parsed) {
|
|
249
|
-
const matchingTool = resolver.tools?.find(tool => (0, isEqual_js_1.default)(parsed, (0, refs_1.parsePropertyRef)((0, ai_tools_1.getToolRef)(tool))));
|
|
258
|
+
const matchingTool = resolver.tools?.find((tool) => (0, isEqual_js_1.default)(parsed, (0, refs_1.parsePropertyRef)((0, ai_tools_1.getToolRef)(tool))));
|
|
250
259
|
if (!matchingTool) {
|
|
251
260
|
errors.push({
|
|
252
261
|
type: 'notFound',
|
|
@@ -298,7 +307,7 @@ function validateResolver(projectSchema, basePath, baseResolver) {
|
|
|
298
307
|
errors.push({
|
|
299
308
|
type: 'notFound',
|
|
300
309
|
path,
|
|
301
|
-
message:
|
|
310
|
+
message: 'Invalid resolver'
|
|
302
311
|
});
|
|
303
312
|
}
|
|
304
313
|
}
|
|
@@ -411,7 +420,11 @@ function listShapeJoins(projectSchema) {
|
|
|
411
420
|
if (shape.joins) {
|
|
412
421
|
for (const joinRef of Object.keys(shape.joins)) {
|
|
413
422
|
const join = shape.joins[joinRef];
|
|
414
|
-
joins.push({
|
|
423
|
+
joins.push({
|
|
424
|
+
ref: joinRef,
|
|
425
|
+
path: ['shapes', shapeKey, 'joins', joinRef],
|
|
426
|
+
join
|
|
427
|
+
});
|
|
415
428
|
}
|
|
416
429
|
}
|
|
417
430
|
}
|
|
@@ -434,7 +447,7 @@ function validateLocalShapeJoinRef(projectSchema, item) {
|
|
|
434
447
|
return [];
|
|
435
448
|
}
|
|
436
449
|
function validateLocalShapeJoins(projectSchema) {
|
|
437
|
-
return listShapeJoins(projectSchema).flatMap(item => validateLocalShapeJoinRef(projectSchema, item).concat(validateResolver(projectSchema, item.path.concat('resolver'), item.join.resolver)));
|
|
450
|
+
return listShapeJoins(projectSchema).flatMap((item) => validateLocalShapeJoinRef(projectSchema, item).concat(validateResolver(projectSchema, item.path.concat('resolver'), item.join.resolver)));
|
|
438
451
|
}
|
|
439
452
|
async function validateShapeJoinRef(context, projectSchema, item) {
|
|
440
453
|
const refItem = (0, refs_1.atRefToRefItem)(projectSchema, item.ref);
|
|
@@ -555,7 +568,7 @@ function isAllOfPath(path) {
|
|
|
555
568
|
function validateLocalRefs(projectSchema) {
|
|
556
569
|
const errors = [];
|
|
557
570
|
const shapeNames = new Set([...exports.builtInShapeNames, ...Object.keys(projectSchema.shapes)]);
|
|
558
|
-
const refs = (0, schema_util_1.getAllRefs)(projectSchema).filter(item => !item.isForeign);
|
|
571
|
+
const refs = (0, schema_util_1.getAllRefs)(projectSchema).filter((item) => !item.isForeign);
|
|
559
572
|
for (const item of refs) {
|
|
560
573
|
if (item.template && !(0, template_shapes_1.isValidTemplate)(item.template)) {
|
|
561
574
|
errors.push({
|
|
@@ -580,7 +593,7 @@ function validateLocalRefs(projectSchema) {
|
|
|
580
593
|
errors.push({
|
|
581
594
|
type: 'conflict',
|
|
582
595
|
path: item.path,
|
|
583
|
-
message:
|
|
596
|
+
message: 'allOf cannot be self-referential'
|
|
584
597
|
});
|
|
585
598
|
}
|
|
586
599
|
const parentPath = (0, initial_js_1.default)(item.path);
|
|
@@ -590,7 +603,7 @@ function validateLocalRefs(projectSchema) {
|
|
|
590
603
|
errors.push({
|
|
591
604
|
type: 'conflict',
|
|
592
605
|
path: parentPath,
|
|
593
|
-
message:
|
|
606
|
+
message: 'Ref cannot have both @ref and $ref'
|
|
594
607
|
});
|
|
595
608
|
}
|
|
596
609
|
}
|
|
@@ -674,15 +687,15 @@ function validateOneOfs(projectSchema) {
|
|
|
674
687
|
errors.push({
|
|
675
688
|
type: 'conflict',
|
|
676
689
|
path: propertyPath.concat(oneOfPath),
|
|
677
|
-
message:
|
|
690
|
+
message: 'Invalid oneOf must contain only @ref or title + enum/const schemas'
|
|
678
691
|
});
|
|
679
692
|
}
|
|
680
693
|
if (isUnion &&
|
|
681
|
-
schema.oneOf.length !== (0, uniqBy_js_1.default)(schema.oneOf, refSchema => (0, refs_1.getRefShapeName)(projectSchema, refSchema)).length) {
|
|
694
|
+
schema.oneOf.length !== (0, uniqBy_js_1.default)(schema.oneOf, (refSchema) => (0, refs_1.getRefShapeName)(projectSchema, refSchema)).length) {
|
|
682
695
|
errors.push({
|
|
683
696
|
type: 'conflict',
|
|
684
697
|
path: propertyPath.concat(oneOfPath),
|
|
685
|
-
message:
|
|
698
|
+
message: 'Invalid oneOf must not contain duplicate references'
|
|
686
699
|
});
|
|
687
700
|
}
|
|
688
701
|
});
|
|
@@ -902,7 +915,7 @@ function validateStructure(schemaVersion, context, schema, ref) {
|
|
|
902
915
|
const coerced = (0, coerce_js_1.default)(schemaVersion);
|
|
903
916
|
const versionStr = coerced?.format();
|
|
904
917
|
const hasExperimental = Boolean(coerced && (0, gte_js_1.default)(coerced, '3.48.0'));
|
|
905
|
-
const relevantSchemas = schemas_1.allProjectSchemas.filter(metaSchema => (hasExperimental && metaSchema.$id.endsWith('experimental#')) || metaSchema.$id.endsWith(`v${versionStr}#`));
|
|
918
|
+
const relevantSchemas = schemas_1.allProjectSchemas.filter((metaSchema) => (hasExperimental && metaSchema.$id.endsWith('experimental#')) || metaSchema.$id.endsWith(`v${versionStr}#`));
|
|
906
919
|
for (const relevantSchema of relevantSchemas) {
|
|
907
920
|
if (!ajv.getSchema(relevantSchema.$id)) {
|
|
908
921
|
ajv.addSchema(relevantSchema);
|
|
@@ -912,7 +925,7 @@ function validateStructure(schemaVersion, context, schema, ref) {
|
|
|
912
925
|
let errors = ajv.errors?.map(formatError) ?? [];
|
|
913
926
|
const { suppressErrorPaths } = context;
|
|
914
927
|
if (errors.length && suppressErrorPaths) {
|
|
915
|
-
errors = errors.filter(error => {
|
|
928
|
+
errors = errors.filter((error) => {
|
|
916
929
|
return !suppressErrorPaths.includes(error.path.join('.'));
|
|
917
930
|
});
|
|
918
931
|
}
|
|
@@ -923,7 +936,11 @@ function validateStructure(schemaVersion, context, schema, ref) {
|
|
|
923
936
|
errors
|
|
924
937
|
};
|
|
925
938
|
}
|
|
926
|
-
return {
|
|
939
|
+
return {
|
|
940
|
+
valid: true,
|
|
941
|
+
schema: schema,
|
|
942
|
+
errors: undefined
|
|
943
|
+
};
|
|
927
944
|
}
|
|
928
945
|
function validateGuards(context, schema) {
|
|
929
946
|
const errors = [];
|
|
@@ -944,7 +961,7 @@ function validateGuards(context, schema) {
|
|
|
944
961
|
function formatValidationResult(context, errors, schema) {
|
|
945
962
|
const { suppressErrorPaths } = context;
|
|
946
963
|
if (suppressErrorPaths) {
|
|
947
|
-
errors = errors.filter(error => {
|
|
964
|
+
errors = errors.filter((error) => {
|
|
948
965
|
return !suppressErrorPaths.includes(error.path.join('.'));
|
|
949
966
|
});
|
|
950
967
|
}
|
|
@@ -1041,7 +1058,7 @@ function ensureValidLatestSchemaSyntax(obj) {
|
|
|
1041
1058
|
throw new Error(`Invalid Schema "${errors[0].path.join(',')}": "${errors[0].message}"`);
|
|
1042
1059
|
}
|
|
1043
1060
|
if ((0, isUndefined_js_1.default)(schema)) {
|
|
1044
|
-
throw new Error(
|
|
1061
|
+
throw new Error('Invalid schema: schema is undefined');
|
|
1045
1062
|
}
|
|
1046
1063
|
if ((0, neq_js_1.default)(versions_1.CURRENT_SCHEMA_VERSION, (0, coerce_js_1.default)(schema.schemaVersion) ?? versions_1.LEGACY_SCHEMA_VERSION)) {
|
|
1047
1064
|
throw new Error(`Expected schemaVersion: "${versions_1.CURRENT_SCHEMA_VERSION}", got "${schema.schemaVersion}"`);
|
|
@@ -31,11 +31,11 @@ function getWorkflow(projectSchema, shapeId) {
|
|
|
31
31
|
}
|
|
32
32
|
exports.getWorkflow = getWorkflow;
|
|
33
33
|
function statusFallback(workflow, enabled) {
|
|
34
|
-
return workflow.steps.find(workflow => workflow.live === enabled) ?? workflow.steps[0];
|
|
34
|
+
return workflow.steps.find((workflow) => workflow.live === enabled) ?? workflow.steps[0];
|
|
35
35
|
}
|
|
36
36
|
exports.statusFallback = statusFallback;
|
|
37
37
|
function findWorkflowStep(workflow, keyOrName) {
|
|
38
|
-
const index = workflow.steps.findIndex(workflow => workflow.key === keyOrName || workflow.name === keyOrName);
|
|
38
|
+
const index = workflow.steps.findIndex((workflow) => workflow.key === keyOrName || workflow.name === keyOrName);
|
|
39
39
|
return index === -1 ? undefined : { index, step: workflow.steps[index] };
|
|
40
40
|
}
|
|
41
41
|
exports.findWorkflowStep = findWorkflowStep;
|
|
@@ -67,10 +67,10 @@ function getWorkflowStepKeys(workflow, stepKey, op) {
|
|
|
67
67
|
throw new Error(`Cannot find step "${stepKey}" in workflow "${workflow.title}"`);
|
|
68
68
|
}
|
|
69
69
|
const { index } = context;
|
|
70
|
-
return getStepRange(workflow.steps, index, op).map(step => step.key);
|
|
70
|
+
return getStepRange(workflow.steps, index, op).map((step) => step.key);
|
|
71
71
|
}
|
|
72
72
|
exports.getWorkflowStepKeys = getWorkflowStepKeys;
|
|
73
73
|
function getLiveStepKeys(workflow) {
|
|
74
|
-
return workflow.steps.filter(step => step.live).map(step => step.key);
|
|
74
|
+
return workflow.steps.filter((step) => step.live).map((step) => step.key);
|
|
75
75
|
}
|
|
76
76
|
exports.getLiveStepKeys = getLiveStepKeys;
|
package/dist/esm/src/agents.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import upperFirst from 'lodash/upperFirst.js';
|
|
2
1
|
import uniq from 'lodash/uniq.js';
|
|
3
2
|
import uniqBy from 'lodash/uniqBy.js';
|
|
3
|
+
import upperFirst from 'lodash/upperFirst.js';
|
|
4
4
|
export const END_AGENT_EXECUTION = 'endAgentExecution';
|
|
5
5
|
export const BUILT_IN_CHAT_ARGS = [
|
|
6
6
|
{
|
|
@@ -13,7 +13,7 @@ export const BUILT_IN_CHAT_ARGS = [
|
|
|
13
13
|
argType: 'sessionId'
|
|
14
14
|
}
|
|
15
15
|
];
|
|
16
|
-
export const BUILT_IN_CHAT_ARG_NAMES = BUILT_IN_CHAT_ARGS.map(arg => arg.argName);
|
|
16
|
+
export const BUILT_IN_CHAT_ARG_NAMES = BUILT_IN_CHAT_ARGS.map((arg) => arg.argName);
|
|
17
17
|
const transitionCanEnd = (transition, includeSuspend = false) => {
|
|
18
18
|
if (!transition || transition.length === 0) {
|
|
19
19
|
return true;
|
|
@@ -50,10 +50,10 @@ export const getInspectAgentSessionQueryName = (agentName) => {
|
|
|
50
50
|
return `inspect${upperFirst(agentName)}`;
|
|
51
51
|
};
|
|
52
52
|
export const removeBuiltInArgs = (args) => {
|
|
53
|
-
return args.filter(arg => !BUILT_IN_CHAT_ARG_NAMES.includes(arg.argName));
|
|
53
|
+
return args.filter((arg) => !BUILT_IN_CHAT_ARG_NAMES.includes(arg.argName));
|
|
54
54
|
};
|
|
55
55
|
export const createArgs = (agent) => {
|
|
56
|
-
let apiArguments = uniqBy(agent.api.arguments ?? [], arg => arg.argName);
|
|
56
|
+
let apiArguments = uniqBy(agent.api.arguments ?? [], (arg) => arg.argName);
|
|
57
57
|
if (agent.api.type === 'chat') {
|
|
58
58
|
apiArguments = removeBuiltInArgs(apiArguments).concat(BUILT_IN_CHAT_ARGS);
|
|
59
59
|
}
|
|
@@ -66,7 +66,7 @@ export const createArgs = (agent) => {
|
|
|
66
66
|
};
|
|
67
67
|
return acc;
|
|
68
68
|
}, {}),
|
|
69
|
-
required: apiArguments.filter(arg => arg.required).map(arg => arg.argName)
|
|
69
|
+
required: apiArguments.filter((arg) => arg.required).map((arg) => arg.argName)
|
|
70
70
|
}
|
|
71
71
|
: undefined;
|
|
72
72
|
};
|
|
@@ -85,7 +85,7 @@ export function addAiQueries(projectSchema) {
|
|
|
85
85
|
// TODO In the future the agent will have a return type defined and we will instead validate
|
|
86
86
|
// that all the return states will return the correct shape.
|
|
87
87
|
const returnStates = [...getAgentEndStates(agent, true)];
|
|
88
|
-
const returnTypes = uniq(returnStates.map(stateId => {
|
|
88
|
+
const returnTypes = uniq(returnStates.map((stateId) => {
|
|
89
89
|
const { execution } = agent.states[stateId];
|
|
90
90
|
if (execution.type === 'chat') {
|
|
91
91
|
return 'TSChatResponse';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import gte from 'semver/functions/gte.js';
|
|
2
1
|
import coerce from 'semver/functions/coerce.js';
|
|
2
|
+
import gte from 'semver/functions/gte.js';
|
|
3
3
|
export const createVersionPredicate = (featureVersion, comparison) => {
|
|
4
4
|
const coercedFeatureVersion = coerce(featureVersion);
|
|
5
5
|
if (!coercedFeatureVersion) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import forEach from "lodash/forEach.js";
|
|
2
1
|
import difference from "lodash/difference.js";
|
|
3
|
-
import
|
|
2
|
+
import forEach from "lodash/forEach.js";
|
|
4
3
|
import get from "lodash/get.js";
|
|
4
|
+
import pick from "lodash/pick.js";
|
|
5
|
+
import { dereferenceSchema, getRefShapeName } from "./refs.js";
|
|
5
6
|
import { getStorageKey } from "./schema-util.js";
|
|
6
7
|
import { isArraySchema, isObjectSchema } from "./types/utils.js";
|
|
7
|
-
import { getRefShapeName, dereferenceSchema } from "./refs.js";
|
|
8
8
|
import { enumerateOneOfKeys, isUnionSchema } from "./unions.js";
|
|
9
9
|
const typeCache = new WeakMap();
|
|
10
10
|
export function getType(schema) {
|
|
@@ -15,9 +15,9 @@ export function getType(schema) {
|
|
|
15
15
|
type = schema.type;
|
|
16
16
|
// Handle nullable types for example: ['object', 'null']
|
|
17
17
|
if (Array.isArray(type)) {
|
|
18
|
-
const filtered = type.filter(name => name !== "null");
|
|
18
|
+
const filtered = type.filter((name) => name !== "null");
|
|
19
19
|
if (!filtered.length) {
|
|
20
|
-
throw new Error(
|
|
20
|
+
throw new Error("Invalid schema");
|
|
21
21
|
}
|
|
22
22
|
type = filtered[0];
|
|
23
23
|
}
|
|
@@ -33,15 +33,15 @@ export function preferKey(name, schema) {
|
|
|
33
33
|
/**
|
|
34
34
|
* A key transform to select the field name
|
|
35
35
|
*/
|
|
36
|
-
export const preferName = name => name;
|
|
36
|
+
export const preferName = (name) => name;
|
|
37
37
|
function getLocalizedKey(key, locale) {
|
|
38
38
|
return locale ? `${key}:${locale}` : key;
|
|
39
39
|
}
|
|
40
40
|
function getNonDefaultLocales(projectSchema) {
|
|
41
|
-
return projectSchema.locales.filter(locale => locale !== projectSchema.defaultLocale);
|
|
41
|
+
return projectSchema.locales.filter((locale) => locale !== projectSchema.defaultLocale);
|
|
42
42
|
}
|
|
43
43
|
function getLocalizedSourceKeys(keys, locales) {
|
|
44
|
-
return keys.flatMap(key => [{ key }, ...locales.map(locale => ({ key: `${key}:${locale}`, locale }))]);
|
|
44
|
+
return keys.flatMap((key) => [{ key }, ...locales.map((locale) => ({ key: `${key}:${locale}`, locale }))]);
|
|
45
45
|
}
|
|
46
46
|
export function preferSourceKey(name, schema) {
|
|
47
47
|
const key = getStorageKey(schema);
|
|
@@ -51,7 +51,7 @@ export function findTransforms(pluginMap, schema, name, shape) {
|
|
|
51
51
|
const type = getType(schema);
|
|
52
52
|
if (pluginMap && (pluginMap[type] ?? pluginMap["*"])) {
|
|
53
53
|
const plugins = (pluginMap[type] ?? []).concat(pluginMap["*"] ?? []);
|
|
54
|
-
return plugins.find(plugin => plugin.filter(schema, name, shape));
|
|
54
|
+
return plugins.find((plugin) => plugin.filter(schema, name, shape));
|
|
55
55
|
}
|
|
56
56
|
return undefined;
|
|
57
57
|
}
|
|
@@ -61,9 +61,9 @@ export function getContentTransform({ transforms, accumulators, keyTransform = p
|
|
|
61
61
|
const shapeName = getRefShapeName(projectSchema, schema);
|
|
62
62
|
schema = dereferenceSchema(projectSchema, schema);
|
|
63
63
|
if (accumulators) {
|
|
64
|
-
|
|
64
|
+
for (const accumulator of accumulators) {
|
|
65
65
|
accumulator.accumulate(obj, schema, name);
|
|
66
|
-
}
|
|
66
|
+
}
|
|
67
67
|
}
|
|
68
68
|
const shape = shapeName ? projectSchema.shapes[shapeName] : undefined;
|
|
69
69
|
const transform = findTransforms(transforms, schema, name, shape);
|
|
@@ -106,7 +106,7 @@ export function getContentTransform({ transforms, accumulators, keyTransform = p
|
|
|
106
106
|
if (isArraySchema(schema)) {
|
|
107
107
|
const itemSchema = schema.items;
|
|
108
108
|
if (Array.isArray(obj)) {
|
|
109
|
-
return obj.map(item => prepare(itemSchema, item, name));
|
|
109
|
+
return obj.map((item) => prepare(itemSchema, item, name));
|
|
110
110
|
}
|
|
111
111
|
if (obj === undefined) {
|
|
112
112
|
prepare(itemSchema, obj, name);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { REMOVE, deepCloneWith, isIterableObject } from '@takeshape/util';
|
|
1
2
|
import defaults from 'lodash/fp/defaults.js';
|
|
2
|
-
import { isIterableObject, deepCloneWith, REMOVE } from '@takeshape/util';
|
|
3
3
|
const inputSchemaCache = new Map();
|
|
4
4
|
function getInputSchemaCache(options) {
|
|
5
5
|
// Ensure key order does not invalidate the cache
|