@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
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { isInterfaceShape } from "../interfaces.js";
|
|
1
2
|
import { refItemToShape } from "../refs.js";
|
|
2
3
|
import { createSchemaPropertyAccessor, createSchemaPropertyList, getShapeByRef } from "../schema-util.js";
|
|
3
4
|
import { isCachedShape, isModelShape } from "../types/index.js";
|
|
4
|
-
import { isInterfaceShape } from "../interfaces.js";
|
|
5
5
|
/**
|
|
6
6
|
* Create a shape model from either a ref item or a ref string such as `rick:Character`
|
|
7
7
|
*/
|
|
@@ -24,7 +24,7 @@ export class ShapeModel {
|
|
|
24
24
|
else {
|
|
25
25
|
const rawShape = refItemToShape(_projectSchemaModel.json, refArg);
|
|
26
26
|
if (!rawShape) {
|
|
27
|
-
throw new Error(
|
|
27
|
+
throw new Error("Error creating shape model: ref item argument could not be resolved to a shape");
|
|
28
28
|
}
|
|
29
29
|
this._rawShape = rawShape;
|
|
30
30
|
this._shapeRefItem = refArg;
|
|
@@ -59,6 +59,7 @@ export * from "./v3.47.0.js";
|
|
|
59
59
|
export * from "./v3.48.0.js";
|
|
60
60
|
export * from "./v3.49.0.js";
|
|
61
61
|
export * from "./v3.50.0.js";
|
|
62
|
+
export * from "./v3.51.0.js";
|
|
62
63
|
export * from "./v4.0.0.js";
|
|
63
64
|
// Schema type utilities
|
|
64
65
|
function createVersionPredicate(expectedVersion) {
|
|
@@ -132,5 +133,6 @@ export const isProjectSchemaJSONV3_47_0 = createVersionPredicate("3.47.0");
|
|
|
132
133
|
export const isProjectSchemaJSONV3_48_0 = createVersionPredicate("3.48.0");
|
|
133
134
|
export const isProjectSchemaJSONV3_49_0 = createVersionPredicate("3.49.0");
|
|
134
135
|
export const isProjectSchemaJSONV3_50_0 = createVersionPredicate("3.50.0");
|
|
135
|
-
export const
|
|
136
|
+
export const isProjectSchemaJSONV3_51_0 = createVersionPredicate("3.51.0");
|
|
137
|
+
export const isLatestProjectSchemaJSON = createVersionPredicate("3.51.0");
|
|
136
138
|
export const isProjectSchemaJSONV4_0_0 = createVersionPredicate("4.0.0");
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { migrateTo } from "../migration/index.js";
|
|
2
|
-
import { isProjectSchemaJSONV1_0_0, isProjectSchemaJSONV3_0_0, isProjectSchemaJSONV3_1_0, isProjectSchemaJSONV3_2_0, isProjectSchemaJSONV3_3_0, isProjectSchemaJSONV3_4_0, isProjectSchemaJSONV3_5_0, isProjectSchemaJSONV3_5_1, isProjectSchemaJSONV3_6_0, isProjectSchemaJSONV3_7_0, isProjectSchemaJSONV3_8_0, isProjectSchemaJSONV3_9_0, isProjectSchemaJSONV3_10_0, isProjectSchemaJSONV3_11_0, isProjectSchemaJSONV3_12_0, isProjectSchemaJSONV3_12_1, isProjectSchemaJSONV3_12_2, isProjectSchemaJSONV3_12_3, isProjectSchemaJSONV3_13_0, isProjectSchemaJSONV3_14_0, isProjectSchemaJSONV3_15_0, isProjectSchemaJSONV3_16_0, isProjectSchemaJSONV3_17_0, isProjectSchemaJSONV3_17_1, isProjectSchemaJSONV3_18_0, isProjectSchemaJSONV3_18_1, isProjectSchemaJSONV3_18_2, isProjectSchemaJSONV3_19_0, isProjectSchemaJSONV3_20_0, isProjectSchemaJSONV3_21_0, isProjectSchemaJSONV3_22_0, isProjectSchemaJSONV3_23_0, isProjectSchemaJSONV3_24_0, isProjectSchemaJSONV3_25_0, isProjectSchemaJSONV3_26_0, isProjectSchemaJSONV3_27_0, isProjectSchemaJSONV3_28_0, isProjectSchemaJSONV3_29_0, isProjectSchemaJSONV3_30_0, isProjectSchemaJSONV3_31_0, isProjectSchemaJSONV3_32_0, isProjectSchemaJSONV3_33_0, isProjectSchemaJSONV3_34_0, isProjectSchemaJSONV3_35_0, isProjectSchemaJSONV3_36_0, isProjectSchemaJSONV3_37_0, isProjectSchemaJSONV3_38_0, isProjectSchemaJSONV3_39_0, isProjectSchemaJSONV3_40_0, isProjectSchemaJSONV3_41_0, isProjectSchemaJSONV3_42_0, isProjectSchemaJSONV3_43_0, isProjectSchemaJSONV3_44_0, isProjectSchemaJSONV3_45_0, isProjectSchemaJSONV3_46_0, isProjectSchemaJSONV3_47_0, isProjectSchemaJSONV3_48_0, isProjectSchemaJSONV3_49_0, isProjectSchemaJSONV4_0_0, isLatestProjectSchemaJSON } from "./index.js";
|
|
3
|
-
// eslint-disable-next-line complexity
|
|
2
|
+
import { isProjectSchemaJSONV1_0_0, isProjectSchemaJSONV3_0_0, isProjectSchemaJSONV3_1_0, isProjectSchemaJSONV3_2_0, isProjectSchemaJSONV3_3_0, isProjectSchemaJSONV3_4_0, isProjectSchemaJSONV3_5_0, isProjectSchemaJSONV3_5_1, isProjectSchemaJSONV3_6_0, isProjectSchemaJSONV3_7_0, isProjectSchemaJSONV3_8_0, isProjectSchemaJSONV3_9_0, isProjectSchemaJSONV3_10_0, isProjectSchemaJSONV3_11_0, isProjectSchemaJSONV3_12_0, isProjectSchemaJSONV3_12_1, isProjectSchemaJSONV3_12_2, isProjectSchemaJSONV3_12_3, isProjectSchemaJSONV3_13_0, isProjectSchemaJSONV3_14_0, isProjectSchemaJSONV3_15_0, isProjectSchemaJSONV3_16_0, isProjectSchemaJSONV3_17_0, isProjectSchemaJSONV3_17_1, isProjectSchemaJSONV3_18_0, isProjectSchemaJSONV3_18_1, isProjectSchemaJSONV3_18_2, isProjectSchemaJSONV3_19_0, isProjectSchemaJSONV3_20_0, isProjectSchemaJSONV3_21_0, isProjectSchemaJSONV3_22_0, isProjectSchemaJSONV3_23_0, isProjectSchemaJSONV3_24_0, isProjectSchemaJSONV3_25_0, isProjectSchemaJSONV3_26_0, isProjectSchemaJSONV3_27_0, isProjectSchemaJSONV3_28_0, isProjectSchemaJSONV3_29_0, isProjectSchemaJSONV3_30_0, isProjectSchemaJSONV3_31_0, isProjectSchemaJSONV3_32_0, isProjectSchemaJSONV3_33_0, isProjectSchemaJSONV3_34_0, isProjectSchemaJSONV3_35_0, isProjectSchemaJSONV3_36_0, isProjectSchemaJSONV3_37_0, isProjectSchemaJSONV3_38_0, isProjectSchemaJSONV3_39_0, isProjectSchemaJSONV3_40_0, isProjectSchemaJSONV3_41_0, isProjectSchemaJSONV3_42_0, isProjectSchemaJSONV3_43_0, isProjectSchemaJSONV3_44_0, isProjectSchemaJSONV3_45_0, isProjectSchemaJSONV3_46_0, isProjectSchemaJSONV3_47_0, isProjectSchemaJSONV3_48_0, isProjectSchemaJSONV3_49_0, isProjectSchemaJSONV3_50_0, isProjectSchemaJSONV4_0_0, isLatestProjectSchemaJSON } from "./index.js";
|
|
4
3
|
export async function migrateToLatestProjectSchema(context, projectSchema) {
|
|
5
4
|
if (isLatestProjectSchemaJSON(projectSchema)) {
|
|
6
5
|
return projectSchema;
|
|
@@ -179,6 +178,9 @@ export async function migrateToLatestProjectSchema(context, projectSchema) {
|
|
|
179
178
|
if (isProjectSchemaJSONV3_49_0(projectSchema)) {
|
|
180
179
|
projectSchema = await migrateTo["v3.50.0"](context, projectSchema);
|
|
181
180
|
}
|
|
181
|
+
if (isProjectSchemaJSONV3_50_0(projectSchema)) {
|
|
182
|
+
projectSchema = await migrateTo["v3.51.0"](context, projectSchema);
|
|
183
|
+
}
|
|
182
184
|
if (isProjectSchemaJSONV4_0_0(projectSchema)) {
|
|
183
185
|
throw new Error("You are using an unreleased schema version. Migration is not possible");
|
|
184
186
|
}
|
package/dist/esm/src/refs.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { NotFoundError } from "@takeshape/errors";
|
|
2
|
+
import { isDefined, isIntegerLike, isRecord, visit } from "@takeshape/util";
|
|
3
|
+
import compact from "lodash/compact.js";
|
|
3
4
|
import assign from "lodash/fp/assign.js";
|
|
4
5
|
import omit from "lodash/fp/omit.js";
|
|
6
|
+
import get from "lodash/get.js";
|
|
5
7
|
import isString from "lodash/isString.js";
|
|
6
|
-
import { NotFoundError } from "@takeshape/errors";
|
|
7
|
-
import compact from "lodash/compact.js";
|
|
8
|
-
import { getServiceNamespaces } from "./services/util.js";
|
|
9
|
-
import { mergeDeepObjectSchemas, mergeObjectSchemas } from "./util/merge.js";
|
|
10
|
-
import { getToolRef } from "./util/ai-tools.js";
|
|
11
8
|
import { isScalar } from "./scalars.js";
|
|
9
|
+
import { getServiceNamespaces } from "./services/util.js";
|
|
12
10
|
import { getRefType, isAllOfSchema, isExtendsSchema, isObjectSchema, isOneOfSchema, isRefSchema, isRefSchemaLegacy } from "./types/index.js";
|
|
11
|
+
import { getToolRef } from "./util/ai-tools.js";
|
|
12
|
+
import { mergeDeepObjectSchemas, mergeObjectSchemas } from "./util/merge.js";
|
|
13
13
|
/**
|
|
14
14
|
* Guard for RefItemWithPath. Tests for presence of all required props.
|
|
15
15
|
*/
|
|
@@ -34,7 +34,11 @@ export function parseReturnShape(projectSchema, shape) {
|
|
|
34
34
|
if (!ref) {
|
|
35
35
|
throw new Error(`Could not parse ${JSON.stringify(shape.items)}: invalid ref`);
|
|
36
36
|
}
|
|
37
|
-
return {
|
|
37
|
+
return {
|
|
38
|
+
isArray: true,
|
|
39
|
+
ref,
|
|
40
|
+
shapeName: refItemToNamespacedShapeName(ref)
|
|
41
|
+
};
|
|
38
42
|
}
|
|
39
43
|
if (typeof shape.items.type !== "string") {
|
|
40
44
|
throw new Error(`Could not parse ${JSON.stringify(shape.items)}: invalid type`);
|
|
@@ -53,7 +57,9 @@ export function returnShapeToSchema(projectSchema, returnShape) {
|
|
|
53
57
|
if (isScalar(returnShape) || returnShape === "object") {
|
|
54
58
|
return { type: returnShape };
|
|
55
59
|
}
|
|
56
|
-
return {
|
|
60
|
+
return {
|
|
61
|
+
"@ref": refItemToAtRef(refExpressionToRefItem(projectSchema, returnShape))
|
|
62
|
+
};
|
|
57
63
|
}
|
|
58
64
|
return returnShape;
|
|
59
65
|
}
|
|
@@ -112,7 +118,7 @@ export function refExpressionToRefItem(context, refExpression) {
|
|
|
112
118
|
* Converts a list of ref expressions into a list of ref items.
|
|
113
119
|
*/
|
|
114
120
|
export function refExpressionListToRefItemList(context, refExpressionList) {
|
|
115
|
-
return refExpressionList.map(ref => refExpressionToRefItem(context, ref));
|
|
121
|
+
return refExpressionList.map((ref) => refExpressionToRefItem(context, ref));
|
|
116
122
|
}
|
|
117
123
|
/**
|
|
118
124
|
* Sugar for converting a `refExpression` directly into a shape, without the
|
|
@@ -244,7 +250,7 @@ export function getOneOfRefs(context, propertySchema, schemaPath = []) {
|
|
|
244
250
|
const oneOf = propertySchema.oneOf ?? propertySchema.items?.oneOf;
|
|
245
251
|
const path = propertySchema.oneOf ? schemaPath : [...schemaPath, "items"];
|
|
246
252
|
if (oneOf) {
|
|
247
|
-
return compact(oneOf.map(one => {
|
|
253
|
+
return compact(oneOf.map((one) => {
|
|
248
254
|
return getRefWithPath(context, one, path);
|
|
249
255
|
}));
|
|
250
256
|
}
|
|
@@ -294,7 +300,7 @@ export function refItemToShape(context, refItem) {
|
|
|
294
300
|
* Get all shapes referenced by a RefItem array.
|
|
295
301
|
*/
|
|
296
302
|
export function refItemListToShapeList(context, refItems) {
|
|
297
|
-
return refItems.map(ref => refItemToShape(context, ref)).filter(isDefined);
|
|
303
|
+
return refItems.map((ref) => refItemToShape(context, ref)).filter(isDefined);
|
|
298
304
|
}
|
|
299
305
|
/**
|
|
300
306
|
* Get a shape referenced by a `RefItem`, also returning the path to the new shape.
|
|
@@ -366,10 +372,10 @@ export function hasResolvableRef(context, schema) {
|
|
|
366
372
|
return Boolean(refItemToShapeSchema(context, getRef(context, schema)));
|
|
367
373
|
}
|
|
368
374
|
if (isAllOfSchema(schema)) {
|
|
369
|
-
return Boolean(schema.allOf.find(s => hasResolvableRef(context, s)));
|
|
375
|
+
return Boolean(schema.allOf.find((s) => hasResolvableRef(context, s)));
|
|
370
376
|
}
|
|
371
377
|
if (isOneOfSchema(schema)) {
|
|
372
|
-
return Boolean(schema.oneOf.find(s => hasResolvableRef(context, s)));
|
|
378
|
+
return Boolean(schema.oneOf.find((s) => hasResolvableRef(context, s)));
|
|
373
379
|
}
|
|
374
380
|
return false;
|
|
375
381
|
}
|
|
@@ -377,7 +383,7 @@ function isSelfReferential(path, shapeName) {
|
|
|
377
383
|
if (path[0] !== "shapes" || path[1] !== shapeName) {
|
|
378
384
|
return false;
|
|
379
385
|
}
|
|
380
|
-
const index = path.findIndex(part => part === "allOf" || part === "extends");
|
|
386
|
+
const index = path.findIndex((part) => part === "allOf" || part === "extends");
|
|
381
387
|
return index !== -1 && isIntegerLike(path[Number(index) + 1]);
|
|
382
388
|
}
|
|
383
389
|
/**
|
|
@@ -435,7 +441,7 @@ export function dereferenceObjectSchema(context, shapeOrFieldSchema, schemaPath
|
|
|
435
441
|
return schema;
|
|
436
442
|
}
|
|
437
443
|
export function createGetNamespace(context) {
|
|
438
|
-
return serviceId => context.services?.[serviceId]?.namespace;
|
|
444
|
+
return (serviceId) => context.services?.[serviceId]?.namespace;
|
|
439
445
|
}
|
|
440
446
|
export function parsePropertyRef(refStr) {
|
|
441
447
|
const [serviceId, coordinate] = splitAtRef(refStr);
|
|
@@ -444,7 +450,11 @@ export function parsePropertyRef(refStr) {
|
|
|
444
450
|
return { serviceId, shapeName: "Query", propertyName: coordinateParts[0] };
|
|
445
451
|
}
|
|
446
452
|
if (coordinateParts.length === 2) {
|
|
447
|
-
return {
|
|
453
|
+
return {
|
|
454
|
+
serviceId,
|
|
455
|
+
shapeName: coordinateParts[0],
|
|
456
|
+
propertyName: coordinateParts[1]
|
|
457
|
+
};
|
|
448
458
|
}
|
|
449
459
|
}
|
|
450
460
|
export function serializePropertyRef({ shapeName, propertyName, serviceId }) {
|
|
@@ -521,7 +531,7 @@ export function getAllPropertyRefs(projectSchema) {
|
|
|
521
531
|
const parentIsResolver = (path, resolverName) => {
|
|
522
532
|
const parent = get(projectSchema, path.slice(0, -1));
|
|
523
533
|
return (isRecord(parent) &&
|
|
524
|
-
(Array.isArray(resolverName) ? resolverName.some(name => name === parent.name) : parent.name === resolverName));
|
|
534
|
+
(Array.isArray(resolverName) ? resolverName.some((name) => name === parent.name) : parent.name === resolverName));
|
|
525
535
|
};
|
|
526
536
|
const parentIsGenerateState = (path) => {
|
|
527
537
|
if (path[0] !== "ai-experimental" || path[path.length - 2] !== "execution") {
|
|
@@ -583,7 +593,7 @@ export function normalizeRefs(projectSchema, property) {
|
|
|
583
593
|
if (property.oneOf) {
|
|
584
594
|
return {
|
|
585
595
|
...updatedProperty,
|
|
586
|
-
oneOf: property.oneOf.map(item => normalizeRefs(projectSchema, item))
|
|
596
|
+
oneOf: property.oneOf.map((item) => normalizeRefs(projectSchema, item))
|
|
587
597
|
};
|
|
588
598
|
}
|
|
589
599
|
// Convert $ref to @ref
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { isDefined } from "@takeshape/util";
|
|
2
|
-
import find from "lodash/find.js";
|
|
3
2
|
import camelCase from "lodash/camelCase.js";
|
|
3
|
+
import find from "lodash/find.js";
|
|
4
4
|
import uniq from "lodash/uniq.js";
|
|
5
|
-
import { isPropertySchemaWithRelationship, isModelShape, isObjectSchema } from "./types/index.js";
|
|
6
|
-
import { getRefShapeName, followRef } from "./refs.js";
|
|
7
|
-
import { isUnionSchema } from "./unions.js";
|
|
8
5
|
import { builtInShapes } from "./builtin-schema.js";
|
|
6
|
+
import { followRef, getRefShapeName } from "./refs.js";
|
|
7
|
+
import { isModelShape, isObjectSchema, isPropertySchemaWithRelationship } from "./types/index.js";
|
|
8
|
+
import { isUnionSchema } from "./unions.js";
|
|
9
9
|
import { getShapeById } from "./util/shapes.js";
|
|
10
10
|
/**
|
|
11
11
|
* Turn a LegacyRelationship into a partial PropertySchemaWithRelationship.
|
|
@@ -25,8 +25,8 @@ export function getRelationshipSchema(projectSchema, relationship) {
|
|
|
25
25
|
let shapeRefs;
|
|
26
26
|
if ("shapeIds" in relationship) {
|
|
27
27
|
shapeRefs = relationship.shapeIds
|
|
28
|
-
.map(shapeId => {
|
|
29
|
-
const shape = getShapeById(projectSchema, shapeId) ?? find(builtInShapes, shape => shape.id === shapeId);
|
|
28
|
+
.map((shapeId) => {
|
|
29
|
+
const shape = getShapeById(projectSchema, shapeId) ?? find(builtInShapes, (shape) => shape.id === shapeId);
|
|
30
30
|
return (shape && {
|
|
31
31
|
"@ref": `local:${shape.name}`
|
|
32
32
|
});
|
|
@@ -35,7 +35,7 @@ export function getRelationshipSchema(projectSchema, relationship) {
|
|
|
35
35
|
isMultiple = relationship.type === "multiple";
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
shapeRefs = relationship.refs.map(refStr => ({ "@ref": refStr }));
|
|
38
|
+
shapeRefs = relationship.refs.map((refStr) => ({ "@ref": refStr }));
|
|
39
39
|
isMultiple = relationship.isMultiple;
|
|
40
40
|
}
|
|
41
41
|
if (!shapeRefs.length) {
|
|
@@ -70,7 +70,7 @@ export function getRelationshipShapeRefs(propertySchema) {
|
|
|
70
70
|
let refs = [];
|
|
71
71
|
const schema = propertySchema.items ?? propertySchema;
|
|
72
72
|
if (schema.oneOf) {
|
|
73
|
-
refs = schema.oneOf.map(schema => schema["@ref"]).filter(isDefined);
|
|
73
|
+
refs = schema.oneOf.map((schema) => schema["@ref"]).filter(isDefined);
|
|
74
74
|
}
|
|
75
75
|
else if (schema["@ref"]) {
|
|
76
76
|
refs = [schema["@ref"]];
|
|
@@ -82,7 +82,7 @@ export function getRelationshipShapeRefs(propertySchema) {
|
|
|
82
82
|
*/
|
|
83
83
|
export function getRelationshipShapes(shapes, refs) {
|
|
84
84
|
return refs
|
|
85
|
-
.map(ref => {
|
|
85
|
+
.map((ref) => {
|
|
86
86
|
const shapeName = ref.split(":")[1];
|
|
87
87
|
const shape = shapes[shapeName];
|
|
88
88
|
return shape ? shape : undefined;
|
|
@@ -94,7 +94,7 @@ export function getRelationshipShapes(shapes, refs) {
|
|
|
94
94
|
*/
|
|
95
95
|
export function getRelationshipShapeIds(shapes, refs) {
|
|
96
96
|
return refs
|
|
97
|
-
.map(ref => {
|
|
97
|
+
.map((ref) => {
|
|
98
98
|
const shapeName = ref.split(":")[1];
|
|
99
99
|
const shape = shapes[shapeName];
|
|
100
100
|
return shape ? shape.id : undefined;
|
|
@@ -137,7 +137,7 @@ export function findExistingRelationships(projectSchema, shapes) {
|
|
|
137
137
|
const relationships = {};
|
|
138
138
|
const shapeArray = Object.values(shapes);
|
|
139
139
|
const shapesSeen = new Set();
|
|
140
|
-
const shapeIds = new Set(shapeArray.map(shape => shape.id));
|
|
140
|
+
const shapeIds = new Set(shapeArray.map((shape) => shape.id));
|
|
141
141
|
const findRelationships = (schema, path, parentShapeName) => {
|
|
142
142
|
const relationship = getRelationship(schema);
|
|
143
143
|
if (relationship) {
|
|
@@ -211,7 +211,7 @@ export function isEqualRelationship(a, b) {
|
|
|
211
211
|
return false;
|
|
212
212
|
}
|
|
213
213
|
const refSet = new Set(refsA);
|
|
214
|
-
return refsB.every(ref => refSet.has(ref));
|
|
214
|
+
return refsB.every((ref) => refSet.has(ref));
|
|
215
215
|
}
|
|
216
216
|
/**
|
|
217
217
|
* Test whether an array of PropertySchemas have unequal relationships
|
|
@@ -223,10 +223,10 @@ export function hasUnequalRelationships(relationships) {
|
|
|
223
223
|
}));
|
|
224
224
|
}
|
|
225
225
|
function getRelatedShapeIds(relationships) {
|
|
226
|
-
return uniq(relationships.map(rel => (rel.hasBackreference ? rel.shapeId : undefined)).filter(isDefined));
|
|
226
|
+
return uniq(relationships.map((rel) => (rel.hasBackreference ? rel.shapeId : undefined)).filter(isDefined));
|
|
227
227
|
}
|
|
228
228
|
function getShapes(projectSchema, shapeIds) {
|
|
229
|
-
return shapeIds.map(shapeId => getShapeById(projectSchema, shapeId)).filter(isDefined);
|
|
229
|
+
return shapeIds.map((shapeId) => getShapeById(projectSchema, shapeId)).filter(isDefined);
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
232
232
|
* Adds backreference fields to the schema.
|
|
@@ -236,7 +236,7 @@ export function addRelatedFields(projectSchema, allRelationships) {
|
|
|
236
236
|
const shape = getShapeById(projectSchema, shapeId);
|
|
237
237
|
if (shape && isObjectSchema(shape.schema)) {
|
|
238
238
|
const relatedShapeIds = getRelatedShapeIds(shapeRelationships);
|
|
239
|
-
const relatedShapeNames = getShapes(projectSchema, relatedShapeIds).map(shape => shape.name);
|
|
239
|
+
const relatedShapeNames = getShapes(projectSchema, relatedShapeIds).map((shape) => shape.name);
|
|
240
240
|
if (relatedShapeNames.length) {
|
|
241
241
|
let shapeName;
|
|
242
242
|
if (relatedShapeNames.length === 1) {
|
|
@@ -251,14 +251,16 @@ export function addRelatedFields(projectSchema, allRelationships) {
|
|
|
251
251
|
name: shapeName,
|
|
252
252
|
title: shapeName,
|
|
253
253
|
schema: {
|
|
254
|
-
oneOf: relatedShapeNames.map(name => ({
|
|
254
|
+
oneOf: relatedShapeNames.map((name) => ({
|
|
255
|
+
"@ref": `local:${name}`
|
|
256
|
+
}))
|
|
255
257
|
}
|
|
256
258
|
};
|
|
257
259
|
}
|
|
258
260
|
// _references, a list of all backreferences across all fields on this shape.
|
|
259
261
|
// It lists all the items that have references to the current item.
|
|
260
262
|
// It is for convenience.
|
|
261
|
-
if (shapeRelationships.some(rel => rel.hasBackreference)) {
|
|
263
|
+
if (shapeRelationships.some((rel) => rel.hasBackreference)) {
|
|
262
264
|
shape.schema.properties._references = {
|
|
263
265
|
"@args": `TSListArgs<local:${shapeName}>`,
|
|
264
266
|
"@ref": `PaginatedList<local:${shapeName}>`,
|
|
@@ -268,8 +270,8 @@ export function addRelatedFields(projectSchema, allRelationships) {
|
|
|
268
270
|
args: {
|
|
269
271
|
ops: [
|
|
270
272
|
{ path: "$", mapping: "$args" },
|
|
271
|
-
{ path:
|
|
272
|
-
{ path:
|
|
273
|
+
{ path: "baseWhere._references.eq", mapping: "$source._id" },
|
|
274
|
+
{ path: "baseWhere._shapeId.in", value: relatedShapeIds }
|
|
273
275
|
]
|
|
274
276
|
}
|
|
275
277
|
}
|
|
@@ -292,8 +294,11 @@ export function addRelatedFields(projectSchema, allRelationships) {
|
|
|
292
294
|
args: {
|
|
293
295
|
ops: [
|
|
294
296
|
{ path: "$", mapping: "$args" },
|
|
295
|
-
{
|
|
296
|
-
|
|
297
|
+
{
|
|
298
|
+
path: `baseWhere.${filterField}.eq`,
|
|
299
|
+
mapping: "$source._id"
|
|
300
|
+
},
|
|
301
|
+
{ path: "baseWhere._shapeId.eq", value: relatedShape.id }
|
|
297
302
|
]
|
|
298
303
|
}
|
|
299
304
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { SchemaBuildError } from "@takeshape/errors";
|
|
2
|
-
import compose from "lodash/fp/compose.js";
|
|
3
2
|
import { deepClone } from "@takeshape/util";
|
|
4
|
-
import
|
|
3
|
+
import compose from "lodash/fp/compose.js";
|
|
5
4
|
import isError from "lodash/isError.js";
|
|
6
|
-
import
|
|
7
|
-
import { applyDefaultsToSchema, createShape } from "./schema-util.js";
|
|
8
|
-
import { addRelatedFields, findExistingRelationships } from "./relationships.js";
|
|
9
|
-
import { flattenTemplates } from "./flatten-templates.js";
|
|
5
|
+
import set from "lodash/set.js";
|
|
10
6
|
import { addAiQueries } from "./agents.js";
|
|
7
|
+
import { flattenTemplates } from "./flatten-templates.js";
|
|
8
|
+
import { addRelatedFields, findExistingRelationships } from "./relationships.js";
|
|
9
|
+
import { applyDefaultsToSchema, createShape } from "./schema-util.js";
|
|
11
10
|
import { resolveSchemaShapeDependencies } from "./service-dependencies.js";
|
|
11
|
+
import { isModelShape } from "./types/index.js";
|
|
12
12
|
export function applyLegacyCompatibilityTweaks(projectSchema) {
|
|
13
13
|
const newSchema = deepClone(projectSchema);
|
|
14
14
|
let hasSearchableShapes = false;
|
|
@@ -16,8 +16,12 @@ export function applyLegacyCompatibilityTweaks(projectSchema) {
|
|
|
16
16
|
if (isModelShape(shape)) {
|
|
17
17
|
hasSearchableShapes = true;
|
|
18
18
|
// Magic _contentTypeId field used for V1 compatibility
|
|
19
|
-
set(shape, ["schema", "properties", "_contentTypeId"], {
|
|
20
|
-
|
|
19
|
+
set(shape, ["schema", "properties", "_contentTypeId"], {
|
|
20
|
+
type: "string"
|
|
21
|
+
});
|
|
22
|
+
set(shape, ["schema", "properties", "_contentTypeName"], {
|
|
23
|
+
type: "string"
|
|
24
|
+
});
|
|
21
25
|
if (shape.model?.type !== "single") {
|
|
22
26
|
newSchema.queries[`search${shapeName}Index`] = {
|
|
23
27
|
shape: `SearchResults<${shapeName}>`,
|
|
@@ -43,7 +47,10 @@ export function applyLegacyCompatibilityTweaks(projectSchema) {
|
|
|
43
47
|
}
|
|
44
48
|
if (hasSearchableShapes) {
|
|
45
49
|
// A placeholder shape for the TSSearchable interface
|
|
46
|
-
newSchema.shapes.TSSearchable = createShape("TSSearchable", {
|
|
50
|
+
newSchema.shapes.TSSearchable = createShape("TSSearchable", {
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: {}
|
|
53
|
+
});
|
|
47
54
|
newSchema.queries.search = {
|
|
48
55
|
shape: "SearchResults<TSSearchable>",
|
|
49
56
|
resolver: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { visit } from "@takeshape/util";
|
|
2
2
|
import pickBy from "lodash/pickBy.js";
|
|
3
|
+
import { getContentTransform } from "./content-schema-transform.js";
|
|
3
4
|
import { isObjectSchema } from "./types/index.js";
|
|
4
5
|
import { createUnwrapTransform, createWrapTransform, isUnionSchema } from "./unions.js";
|
|
5
|
-
import { getContentTransform } from "./content-schema-transform.js";
|
|
6
6
|
function createPropertiesPredicate(propertyNames) {
|
|
7
7
|
const byShape = new Map();
|
|
8
8
|
for (const name of propertyNames) {
|
|
@@ -22,7 +22,7 @@ function createPropertiesPredicate(propertyNames) {
|
|
|
22
22
|
}
|
|
23
23
|
export function removePropertiesTransform(propertyNames) {
|
|
24
24
|
const isBlacklisted = createPropertiesPredicate(propertyNames);
|
|
25
|
-
return projectSchema => {
|
|
25
|
+
return (projectSchema) => {
|
|
26
26
|
visit(projectSchema, ["schema"], (value, path) => {
|
|
27
27
|
if (path.length === 3 && path[0] === "shapes" && path[2] === "schema") {
|
|
28
28
|
const shapeSchema = value;
|
|
@@ -30,7 +30,7 @@ export function removePropertiesTransform(propertyNames) {
|
|
|
30
30
|
const { properties, required } = shapeSchema;
|
|
31
31
|
shapeSchema.properties = pickBy(properties, (_, name) => !isBlacklisted(path[1], name));
|
|
32
32
|
if (required) {
|
|
33
|
-
shapeSchema.required = required.filter(name => !isBlacklisted(path[1], name));
|
|
33
|
+
shapeSchema.required = required.filter((name) => !isBlacklisted(path[1], name));
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import keyBy from "lodash/keyBy.js";
|
|
1
|
+
import { deepClone, ensureArray, pascalCase, visit } from "@takeshape/util";
|
|
3
2
|
import curry from "lodash/fp/curry.js";
|
|
4
3
|
import orderBy from "lodash/fp/orderBy.js";
|
|
5
|
-
import uniq from "lodash/uniq.js";
|
|
6
|
-
import { deepClone, visit, pascalCase, ensureArray } from "@takeshape/util";
|
|
7
|
-
import isString from "lodash/isString.js";
|
|
8
4
|
import isArray from "lodash/isArray.js";
|
|
5
|
+
import isString from "lodash/isString.js";
|
|
6
|
+
import keyBy from "lodash/keyBy.js";
|
|
7
|
+
import mapValues from "lodash/mapValues.js";
|
|
9
8
|
import some from "lodash/some.js";
|
|
10
|
-
import
|
|
11
|
-
import { CURRENT_API_VERSION, CURRENT_SCHEMA_VERSION } from "./versions.js";
|
|
9
|
+
import uniq from "lodash/uniq.js";
|
|
12
10
|
import { workflowsEnabled } from "./api-version.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
11
|
+
import { builtInForms, builtInShapes } from "./builtin-schema.js";
|
|
12
|
+
import { SERVICE_OBJECT_PATTERN_NAME } from "./constants.js";
|
|
13
|
+
import { atRefToRefItem, createTemplateShapeName, dereferenceObjectSchema, dereferenceSchema, getRef, getRefOrItemsRef, getRefShapeName, parseReturnShape, parseTemplateShape, refExpressionToRefItem, refItemToNamespacedShapeName, refItemToShape, refItemToShapeSchema, refToRefItem, returnShapeToSchema, serializePropertyRef } from "./refs.js";
|
|
14
|
+
import { getArgsType, isAllOfSchema, isArraySchema, isCachedShape, isExtendsSchema, isGraphqlResolver, isModelShape, isObjectSchema, isOneOfSchema, isRefSchema } from "./types/index.js";
|
|
15
15
|
import { isUnionSchema } from "./unions.js";
|
|
16
|
-
import { mergeFormProperties, mergeSchemaProperties } from "./util/merge.js";
|
|
17
16
|
import { getArgs } from "./util/has-arg.js";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
17
|
+
import { mergeFormProperties, mergeSchemaProperties } from "./util/merge.js";
|
|
18
|
+
import { CURRENT_API_VERSION, CURRENT_SCHEMA_VERSION } from "./versions.js";
|
|
19
|
+
import { defaultWorkflow, getStatusField } from "./workflows.js";
|
|
20
20
|
export function isBuiltinShape(shapeName) {
|
|
21
21
|
return Boolean(builtInShapes[shapeName]);
|
|
22
22
|
}
|
|
@@ -386,17 +386,17 @@ const requiredBuiltinShapes = ["Asset", "TSRelationship", "TSStaticSite", "TSUse
|
|
|
386
386
|
*/
|
|
387
387
|
export function getBuiltinsUsed(projectSchema) {
|
|
388
388
|
const builtinsUsed = {};
|
|
389
|
-
const shapeNames = uniq(requiredBuiltinShapes.concat(getAllRefs(projectSchema, refItem => refItem.serviceKey === "local" && isBuiltinShape(refItem.typeName)).map(refItemToNamespacedShapeName)));
|
|
389
|
+
const shapeNames = uniq(requiredBuiltinShapes.concat(getAllRefs(projectSchema, (refItem) => refItem.serviceKey === "local" && isBuiltinShape(refItem.typeName)).map(refItemToNamespacedShapeName)));
|
|
390
390
|
const schemaWithAllBuiltins = {
|
|
391
391
|
...emptySchema("project-id"),
|
|
392
392
|
shapes: builtInShapes
|
|
393
393
|
};
|
|
394
|
-
|
|
394
|
+
for (const builtinShapeName of shapeNames) {
|
|
395
395
|
builtinsUsed[builtinShapeName] = builtInShapes[builtinShapeName];
|
|
396
|
-
getShapeDependencies(schemaWithAllBuiltins, builtInShapes[builtinShapeName])
|
|
396
|
+
for (const depShapeName of getShapeDependencies(schemaWithAllBuiltins, builtInShapes[builtinShapeName])) {
|
|
397
397
|
builtinsUsed[depShapeName] = builtInShapes[depShapeName];
|
|
398
|
-
}
|
|
399
|
-
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
400
|
return builtinsUsed;
|
|
401
401
|
}
|
|
402
402
|
export function applyDefaultsToSchema(projectSchema) {
|
|
@@ -405,7 +405,9 @@ export function applyDefaultsToSchema(projectSchema) {
|
|
|
405
405
|
...projectSchema,
|
|
406
406
|
workflows: {
|
|
407
407
|
...projectSchema.workflows,
|
|
408
|
-
...(workflowsEnabled(projectSchema.apiVersion) && {
|
|
408
|
+
...(workflowsEnabled(projectSchema.apiVersion) && {
|
|
409
|
+
default: defaultWorkflow
|
|
410
|
+
})
|
|
409
411
|
},
|
|
410
412
|
queries: {
|
|
411
413
|
...builtInQueriesAndMutations.queries,
|
|
@@ -415,7 +417,7 @@ export function applyDefaultsToSchema(projectSchema) {
|
|
|
415
417
|
...builtInQueriesAndMutations.mutations,
|
|
416
418
|
...projectSchema.mutations
|
|
417
419
|
},
|
|
418
|
-
shapes: mapValues({ ...builtinsUsed, ...projectSchema.shapes }, shape => {
|
|
420
|
+
shapes: mapValues({ ...builtinsUsed, ...projectSchema.shapes }, (shape) => {
|
|
419
421
|
const builtInShape = builtinsUsed[shape.name];
|
|
420
422
|
if (builtInShape && builtInShape !== shape) {
|
|
421
423
|
shape = {
|
|
@@ -428,7 +430,10 @@ export function applyDefaultsToSchema(projectSchema) {
|
|
|
428
430
|
forms: mapValues({ ...builtInForms, ...projectSchema.forms }, (formsConfig, shapeName) => {
|
|
429
431
|
const builtInFormsConfig = builtInForms[shapeName];
|
|
430
432
|
if (builtInFormsConfig && builtInFormsConfig !== formsConfig) {
|
|
431
|
-
formsConfig = {
|
|
433
|
+
formsConfig = {
|
|
434
|
+
...formsConfig,
|
|
435
|
+
default: mergeFormProperties(formsConfig.default, builtInFormsConfig.default)
|
|
436
|
+
};
|
|
432
437
|
}
|
|
433
438
|
return formsConfig;
|
|
434
439
|
})
|
|
@@ -481,16 +486,19 @@ const createShapeToPropertySchema = (projectSchema, definitions, definitionNames
|
|
|
481
486
|
};
|
|
482
487
|
propSchema.required = ["_shapeId"];
|
|
483
488
|
}
|
|
484
|
-
propSchema.oneOf
|
|
489
|
+
for (const schema of propSchema.oneOf) {
|
|
485
490
|
handleSchema(schema);
|
|
486
|
-
}
|
|
491
|
+
}
|
|
487
492
|
return;
|
|
488
493
|
}
|
|
489
494
|
// Add workflow validation
|
|
490
495
|
if (propSchema["@workflow"]) {
|
|
491
496
|
const workflowName = propSchema["@workflow"];
|
|
492
497
|
const workflow = projectSchema.workflows[workflowName] || defaultWorkflow;
|
|
493
|
-
propSchema.oneOf = workflow.steps.map(step => ({
|
|
498
|
+
propSchema.oneOf = workflow.steps.map((step) => ({
|
|
499
|
+
enum: [step.key, step.name],
|
|
500
|
+
title: step.title
|
|
501
|
+
}));
|
|
494
502
|
}
|
|
495
503
|
const refItem = getRef(projectSchema, propSchema);
|
|
496
504
|
if (refItem) {
|
|
@@ -525,9 +533,9 @@ const createShapeToPropertySchema = (projectSchema, definitions, definitionNames
|
|
|
525
533
|
if (shape.title) {
|
|
526
534
|
shapeSchemaCopy.title = shape.title;
|
|
527
535
|
}
|
|
528
|
-
Object.values(shapeSchemaCopy.properties)
|
|
536
|
+
for (const schema of Object.values(shapeSchemaCopy.properties)) {
|
|
529
537
|
handleSchema(schema);
|
|
530
|
-
}
|
|
538
|
+
}
|
|
531
539
|
return shapeSchemaCopy;
|
|
532
540
|
};
|
|
533
541
|
return rewriteRefs;
|
|
@@ -771,7 +779,7 @@ export function getFullyQualifiedShapeName(schema) {
|
|
|
771
779
|
* @param schema
|
|
772
780
|
*/
|
|
773
781
|
export function getStorageKey(schema) {
|
|
774
|
-
const first = findMapping(schema, mapping => mapping.startsWith("shapedb:"));
|
|
782
|
+
const first = findMapping(schema, (mapping) => mapping.startsWith("shapedb:"));
|
|
775
783
|
return first ? splitMapping(first)[1] : undefined;
|
|
776
784
|
}
|
|
777
785
|
export function getPropertyService(schema) {
|
|
@@ -814,7 +822,7 @@ export function getShapesById(projectSchema) {
|
|
|
814
822
|
* @returns A `string` array with all the shapes that are in namespaces.
|
|
815
823
|
*/
|
|
816
824
|
export function getAllNamespaceShapes(projectSchema) {
|
|
817
|
-
const isServiceRef = refItem => Boolean(refItem.serviceNamespace);
|
|
825
|
+
const isServiceRef = (refItem) => Boolean(refItem.serviceNamespace);
|
|
818
826
|
return uniq(getAllValidRefs(projectSchema, isServiceRef).map(refItemToNamespacedShapeName));
|
|
819
827
|
}
|
|
820
828
|
/**
|
|
@@ -837,11 +845,11 @@ export function getNamespacedShapeNameList(projectSchema) {
|
|
|
837
845
|
const namespacedShapeNames = new Set(getAllNamespaceShapes(projectSchema));
|
|
838
846
|
// Add all namespaced shapes to the schema if they are not already present,
|
|
839
847
|
// e.g. Shopify_Product
|
|
840
|
-
|
|
848
|
+
for (const name of namespacedShapeNames) {
|
|
841
849
|
if (!existingShapeNames.has(name)) {
|
|
842
850
|
requiredShapeNames.add(name);
|
|
843
851
|
}
|
|
844
|
-
}
|
|
852
|
+
}
|
|
845
853
|
return requiredShapeNames;
|
|
846
854
|
}
|
|
847
855
|
/**
|
|
@@ -887,7 +895,7 @@ export const createSchemaPropertyList = curry((context, shapeOrSchema) => {
|
|
|
887
895
|
.sort(([nameA], [nameB]) => {
|
|
888
896
|
const indexA = comparatorArray.indexOf(nameA);
|
|
889
897
|
const indexB = comparatorArray.indexOf(nameB);
|
|
890
|
-
return (indexA > -1 ? indexA :
|
|
898
|
+
return ((indexA > -1 ? indexA : Number.POSITIVE_INFINITY) - (indexB > -1 ? indexB : Number.POSITIVE_INFINITY));
|
|
891
899
|
}));
|
|
892
900
|
}
|
|
893
901
|
return self;
|
|
@@ -1030,12 +1038,12 @@ export function queryToPropertySchema(projectSchema, query) {
|
|
|
1030
1038
|
export function getQueriesShape(projectSchema, operation) {
|
|
1031
1039
|
return createShape(pascalCase(operation), {
|
|
1032
1040
|
type: "object",
|
|
1033
|
-
properties: mapValues(projectSchema[operation === "query" ? "queries" : "mutations"], query => queryToPropertySchema(projectSchema, query))
|
|
1041
|
+
properties: mapValues(projectSchema[operation === "query" ? "queries" : "mutations"], (query) => queryToPropertySchema(projectSchema, query))
|
|
1034
1042
|
});
|
|
1035
1043
|
}
|
|
1036
1044
|
export function fieldMappingContainsKey(fieldMapping, key) {
|
|
1037
1045
|
if (isArray(fieldMapping)) {
|
|
1038
|
-
return some(fieldMapping, mapping => parseMapping(mapping).key === key);
|
|
1046
|
+
return some(fieldMapping, (mapping) => parseMapping(mapping).key === key);
|
|
1039
1047
|
}
|
|
1040
1048
|
return parseMapping(fieldMapping).key === key;
|
|
1041
1049
|
}
|