@takeshape/schema 11.45.5 → 11.47.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +7 -5
- 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 +4 -2
- 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
|
@@ -5,14 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.migrateInterfaceShapes = exports.normalizeForms = void 0;
|
|
7
7
|
const util_1 = require("@takeshape/util");
|
|
8
|
-
const upperFirst_js_1 = __importDefault(require("lodash/upperFirst.js"));
|
|
9
8
|
const set_js_1 = __importDefault(require("lodash/fp/set.js"));
|
|
10
9
|
const unset_js_1 = __importDefault(require("lodash/fp/unset.js"));
|
|
10
|
+
const upperFirst_js_1 = __importDefault(require("lodash/upperFirst.js"));
|
|
11
|
+
const constants_1 = require("../../constants");
|
|
11
12
|
const refs_1 = require("../../refs");
|
|
12
13
|
const schema_util_1 = require("../../schema-util");
|
|
13
14
|
const schemas_1 = require("../../schemas");
|
|
14
15
|
const services_1 = require("../../services/services");
|
|
15
|
-
const constants_1 = require("../../constants");
|
|
16
16
|
// Inline utilities for posterity
|
|
17
17
|
function refItemToShapeName(refItem) {
|
|
18
18
|
const { serviceNamespace, typeName } = refItem;
|
|
@@ -29,8 +29,8 @@ function normalizeForms(projectSchema) {
|
|
|
29
29
|
const storeSourceForm = (shapeName, formConfig, propName) => {
|
|
30
30
|
normalizedForms[shapeName] ||= { default: (0, util_1.deepClone)(formConfig) };
|
|
31
31
|
const propConfig = normalizedForms[shapeName].default.properties[propName];
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
propConfig.properties = undefined;
|
|
33
|
+
propConfig.order = undefined;
|
|
34
34
|
propConfig.widget = widgetMigrations[propConfig.widget] ?? propConfig.widget;
|
|
35
35
|
};
|
|
36
36
|
const normalizeNested = (shapeName, formConfig) => {
|
|
@@ -88,7 +88,6 @@ function migrateInterfaceShapes(projectSchema) {
|
|
|
88
88
|
continue;
|
|
89
89
|
}
|
|
90
90
|
for (const template of ['CreateArgs', 'UpdateArgs']) {
|
|
91
|
-
// eslint-disable-next-line max-depth
|
|
92
91
|
if (mutation.args === `${template}<${interfaceShapeName}>`) {
|
|
93
92
|
updatedProjectSchema = (0, set_js_1.default)(['mutations', mutationName], { ...mutation, args: `${template}<${serviceShapeName}>` }, updatedProjectSchema);
|
|
94
93
|
}
|
|
@@ -109,15 +108,13 @@ const migrate = async (_, projectSchema) => {
|
|
|
109
108
|
}
|
|
110
109
|
catch (e) {
|
|
111
110
|
// TODO remove console.log when a formal warning mechanism is added https://app.shortcut.com/takeshape/story/11533/return-warnings-from-schema-migration
|
|
112
|
-
|
|
113
|
-
console.log(`v3.34.0 migration warning: Failed to normalize forms`, e.message);
|
|
111
|
+
console.info('v3.34.0 migration warning: Failed to normalize forms', e.message);
|
|
114
112
|
}
|
|
115
113
|
try {
|
|
116
114
|
normalized = migrateInterfaceShapes(normalized);
|
|
117
115
|
}
|
|
118
116
|
catch (e) {
|
|
119
|
-
|
|
120
|
-
console.log(`v3.34.0 migration warning: Failed to migrate interface shapes`, e.message);
|
|
117
|
+
console.info('v3.34.0 migration warning: Failed to migrate interface shapes', e.message);
|
|
121
118
|
}
|
|
122
119
|
return {
|
|
123
120
|
...normalized,
|
|
@@ -9,7 +9,7 @@ const migrate = async (_, projectSchema) => {
|
|
|
9
9
|
...projectSchema,
|
|
10
10
|
schemaVersion: '3.36.0'
|
|
11
11
|
};
|
|
12
|
-
result.services &&= (0, mapValues_js_1.default)(result.services, config => {
|
|
12
|
+
result.services &&= (0, mapValues_js_1.default)(result.services, (config) => {
|
|
13
13
|
// Add transformVersion to OpenAPI services so we can preserve the legacy behavior
|
|
14
14
|
if (config.serviceType === 'openapi') {
|
|
15
15
|
return {
|
|
@@ -5,12 +5,12 @@ const migrate = async ({ decryptFn, encryptFn }, projectSchema) => {
|
|
|
5
5
|
/**
|
|
6
6
|
* Move unencrypted searchParams out of the authentication object.
|
|
7
7
|
*/
|
|
8
|
-
Object.values(projectSchema.services ?? {})
|
|
8
|
+
for (const serviceConfig of Object.values(projectSchema.services ?? {})) {
|
|
9
9
|
if (serviceConfig.authentication) {
|
|
10
10
|
const authentication = decryptFn(serviceConfig.authentication);
|
|
11
11
|
if ((0, types_1.isServiceAuthentication)(authentication) && (0, types_1.isSearchParamsAuthentication)(authentication)) {
|
|
12
12
|
if (serviceConfig.provider === 'judgeMe') {
|
|
13
|
-
const shopDomain = authentication.params.find(param => param.name === 'shop_domain');
|
|
13
|
+
const shopDomain = authentication.params.find((param) => param.name === 'shop_domain');
|
|
14
14
|
if (shopDomain) {
|
|
15
15
|
serviceConfig.options = {
|
|
16
16
|
...serviceConfig.options,
|
|
@@ -18,12 +18,12 @@ const migrate = async ({ decryptFn, encryptFn }, projectSchema) => {
|
|
|
18
18
|
shop_domain: shopDomain.value
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
serviceConfig.options.shopDomain = undefined;
|
|
22
22
|
}
|
|
23
|
-
authentication.params = authentication.params.filter(param => param.name !== 'shop_domain');
|
|
23
|
+
authentication.params = authentication.params.filter((param) => param.name !== 'shop_domain');
|
|
24
24
|
}
|
|
25
25
|
if (serviceConfig.provider === 'reviewsIo') {
|
|
26
|
-
const storeId = authentication.params.find(param => param.name === 'store');
|
|
26
|
+
const storeId = authentication.params.find((param) => param.name === 'store');
|
|
27
27
|
if (storeId) {
|
|
28
28
|
serviceConfig.options = {
|
|
29
29
|
...serviceConfig.options,
|
|
@@ -31,14 +31,14 @@ const migrate = async ({ decryptFn, encryptFn }, projectSchema) => {
|
|
|
31
31
|
store: storeId.value
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
|
|
34
|
+
serviceConfig.options.storeId = undefined;
|
|
35
35
|
}
|
|
36
|
-
authentication.params = authentication.params.filter(param => param.name !== 'store');
|
|
36
|
+
authentication.params = authentication.params.filter((param) => param.name !== 'store');
|
|
37
37
|
}
|
|
38
38
|
serviceConfig.authentication = encryptFn(authentication);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|
|
42
42
|
return {
|
|
43
43
|
...projectSchema,
|
|
44
44
|
schemaVersion: '3.39.0'
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const mapValues_js_1 = __importDefault(require("lodash/mapValues.js"));
|
|
7
7
|
const migrate = async (_, projectSchema) => {
|
|
8
|
-
const newShapes = (0, mapValues_js_1.default)(projectSchema.shapes, shape => {
|
|
8
|
+
const newShapes = (0, mapValues_js_1.default)(projectSchema.shapes, (shape) => {
|
|
9
9
|
// Set includeDeprecated to true for shapes to preserve behavior when indexing shapes by maxDepth
|
|
10
10
|
if (shape.cache?.fragment?.maxDepth !== undefined) {
|
|
11
11
|
const newShape = {
|
|
@@ -21,7 +21,7 @@ const migrate = async (_, projectSchema) => {
|
|
|
21
21
|
/**
|
|
22
22
|
* Function will visit each resolver in the schema and mutate them.
|
|
23
23
|
*/
|
|
24
|
-
(0, util_1.visit)(projectSchema, ['resolver', '@resolver'], maybeResolver => {
|
|
24
|
+
(0, util_1.visit)(projectSchema, ['resolver', '@resolver'], (maybeResolver) => {
|
|
25
25
|
if (isComposeResolver(maybeResolver)) {
|
|
26
26
|
maybeResolver.compose.forEach(renameResolver);
|
|
27
27
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const migrate = async (_, projectSchema) => {
|
|
4
|
+
/**
|
|
5
|
+
* No migration needed all changes are backwards compatible.
|
|
6
|
+
*/
|
|
7
|
+
return {
|
|
8
|
+
...projectSchema,
|
|
9
|
+
schemaVersion: '3.51.0'
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.default = migrate;
|
|
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const util_1 = require("@takeshape/util");
|
|
7
|
-
const omit_js_1 = __importDefault(require("lodash/omit.js"));
|
|
8
7
|
const isEmpty_js_1 = __importDefault(require("lodash/isEmpty.js"));
|
|
8
|
+
const omit_js_1 = __importDefault(require("lodash/omit.js"));
|
|
9
9
|
function omitOptions(resolver, names) {
|
|
10
10
|
if (resolver.options) {
|
|
11
11
|
const newOptions = (0, omit_js_1.default)(resolver.options, names);
|
|
12
12
|
if ((0, isEmpty_js_1.default)(newOptions)) {
|
|
13
|
-
|
|
13
|
+
resolver.options = undefined;
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
16
|
resolver.options = newOptions;
|
|
@@ -68,7 +68,7 @@ const migrate = async (_, projectSchema) => {
|
|
|
68
68
|
/**
|
|
69
69
|
* Function will visit each resolver in the schema and mutate them.
|
|
70
70
|
*/
|
|
71
|
-
(0, util_1.visit)(projectSchema, ['resolver', '@resolver'], resolver => {
|
|
71
|
+
(0, util_1.visit)(projectSchema, ['resolver', '@resolver'], (resolver) => {
|
|
72
72
|
if (resolver.compose) {
|
|
73
73
|
resolver.compose.forEach(ensureResolverOptions);
|
|
74
74
|
}
|
|
@@ -8,9 +8,9 @@ const omit_js_1 = __importDefault(require("lodash/omit.js"));
|
|
|
8
8
|
const refs_1 = require("../refs");
|
|
9
9
|
const schema_util_1 = require("../schema-util");
|
|
10
10
|
const shapes_1 = require("../util/shapes");
|
|
11
|
-
const shape_1 = require("./shape");
|
|
12
11
|
const query_1 = require("./query");
|
|
13
12
|
const service_1 = require("./service");
|
|
13
|
+
const shape_1 = require("./shape");
|
|
14
14
|
/**
|
|
15
15
|
* Model object representing a ProjectSchema.
|
|
16
16
|
* Intended to help make it easier to find the right utils
|
|
@@ -56,7 +56,7 @@ class ProjectSchema {
|
|
|
56
56
|
return new shape_1.ShapeModel(this, shapeRef);
|
|
57
57
|
}
|
|
58
58
|
get shapes() {
|
|
59
|
-
this._cache.shapes ??= Object.keys(this.json.shapes).map(name => new shape_1.ShapeModel(this, (0, refs_1.normalizeRefExpression)(this.json, name)));
|
|
59
|
+
this._cache.shapes ??= Object.keys(this.json.shapes).map((name) => new shape_1.ShapeModel(this, (0, refs_1.normalizeRefExpression)(this.json, name)));
|
|
60
60
|
return this._cache.shapes;
|
|
61
61
|
}
|
|
62
62
|
get refs() {
|
|
@@ -67,14 +67,14 @@ class ProjectSchema {
|
|
|
67
67
|
return new query_1.QueryModel(this, 'query', queryName);
|
|
68
68
|
}
|
|
69
69
|
get queries() {
|
|
70
|
-
this._cache.queries ??= Object.keys(this.json.queries).map(name => new query_1.QueryModel(this, 'query', name));
|
|
70
|
+
this._cache.queries ??= Object.keys(this.json.queries).map((name) => new query_1.QueryModel(this, 'query', name));
|
|
71
71
|
return this._cache.queries;
|
|
72
72
|
}
|
|
73
73
|
getMutationByName(mutationName) {
|
|
74
74
|
return new query_1.QueryModel(this, 'mutation', mutationName);
|
|
75
75
|
}
|
|
76
76
|
get mutations() {
|
|
77
|
-
this._cache.mutations = Object.keys(this.json.mutations).map(name => new query_1.QueryModel(this, 'mutation', name));
|
|
77
|
+
this._cache.mutations = Object.keys(this.json.mutations).map((name) => new query_1.QueryModel(this, 'mutation', name));
|
|
78
78
|
return this._cache.mutations;
|
|
79
79
|
}
|
|
80
80
|
getServiceById(serviceId) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ShapeModel = void 0;
|
|
4
|
+
const interfaces_1 = require("../interfaces");
|
|
4
5
|
const refs_1 = require("../refs");
|
|
5
6
|
const schema_util_1 = require("../schema-util");
|
|
6
7
|
const types_1 = require("../types");
|
|
7
|
-
const interfaces_1 = require("../interfaces");
|
|
8
8
|
/**
|
|
9
9
|
* Create a shape model from either a ref item or a ref string such as `rick:Character`
|
|
10
10
|
*/
|
|
@@ -27,7 +27,7 @@ class ShapeModel {
|
|
|
27
27
|
else {
|
|
28
28
|
const rawShape = (0, refs_1.refItemToShape)(_projectSchemaModel.json, refArg);
|
|
29
29
|
if (!rawShape) {
|
|
30
|
-
throw new Error(
|
|
30
|
+
throw new Error('Error creating shape model: ref item argument could not be resolved to a shape');
|
|
31
31
|
}
|
|
32
32
|
this._rawShape = rawShape;
|
|
33
33
|
this._shapeRefItem = refArg;
|
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.isProjectSchemaJSONV3_41_0 = exports.isProjectSchemaJSONV3_40_0 = exports.isProjectSchemaJSONV3_39_0 = exports.isProjectSchemaJSONV3_38_0 = exports.isProjectSchemaJSONV3_37_0 = exports.isProjectSchemaJSONV3_36_0 = exports.isProjectSchemaJSONV3_35_0 = exports.isProjectSchemaJSONV3_34_0 = exports.isProjectSchemaJSONV3_33_0 = exports.isProjectSchemaJSONV3_32_0 = exports.isProjectSchemaJSONV3_31_0 = exports.isProjectSchemaJSONV3_30_0 = exports.isProjectSchemaJSONV3_29_0 = exports.isProjectSchemaJSONV3_28_0 = exports.isProjectSchemaJSONV3_27_0 = exports.isProjectSchemaJSONV3_26_0 = exports.isProjectSchemaJSONV3_25_0 = exports.isProjectSchemaJSONV3_24_0 = exports.isProjectSchemaJSONV3_23_0 = exports.isProjectSchemaJSONV3_22_0 = exports.isProjectSchemaJSONV3_21_0 = exports.isProjectSchemaJSONV3_20_0 = exports.isProjectSchemaJSONV3_19_0 = exports.isProjectSchemaJSONV3_18_2 = exports.isProjectSchemaJSONV3_18_1 = exports.isProjectSchemaJSONV3_18_0 = exports.isProjectSchemaJSONV3_17_1 = exports.isProjectSchemaJSONV3_17_0 = exports.isProjectSchemaJSONV3_16_0 = exports.isProjectSchemaJSONV3_15_0 = exports.isProjectSchemaJSONV3_14_0 = exports.isProjectSchemaJSONV3_13_0 = exports.isProjectSchemaJSONV3_12_3 = exports.isProjectSchemaJSONV3_12_2 = exports.isProjectSchemaJSONV3_12_1 = exports.isProjectSchemaJSONV3_12_0 = exports.isProjectSchemaJSONV3_11_0 = exports.isProjectSchemaJSONV3_10_0 = exports.isProjectSchemaJSONV3_9_0 = exports.isProjectSchemaJSONV3_8_0 = exports.isProjectSchemaJSONV3_7_0 = exports.isProjectSchemaJSONV3_6_0 = exports.isProjectSchemaJSONV3_5_1 = exports.isProjectSchemaJSONV3_5_0 = exports.isProjectSchemaJSONV3_4_0 = exports.isProjectSchemaJSONV3_3_0 = exports.isProjectSchemaJSONV3_2_0 = exports.isProjectSchemaJSONV3_1_0 = exports.isProjectSchemaJSONV3_0_0 = exports.isProjectSchemaJSONV1_0_0 = void 0;
|
|
18
|
-
exports.isProjectSchemaJSONV4_0_0 = exports.isLatestProjectSchemaJSON = exports.isProjectSchemaJSONV3_50_0 = exports.isProjectSchemaJSONV3_49_0 = exports.isProjectSchemaJSONV3_48_0 = exports.isProjectSchemaJSONV3_47_0 = exports.isProjectSchemaJSONV3_46_0 = exports.isProjectSchemaJSONV3_45_0 = exports.isProjectSchemaJSONV3_44_0 = exports.isProjectSchemaJSONV3_43_0 = exports.isProjectSchemaJSONV3_42_0 = void 0;
|
|
18
|
+
exports.isProjectSchemaJSONV4_0_0 = exports.isLatestProjectSchemaJSON = exports.isProjectSchemaJSONV3_51_0 = exports.isProjectSchemaJSONV3_50_0 = exports.isProjectSchemaJSONV3_49_0 = exports.isProjectSchemaJSONV3_48_0 = exports.isProjectSchemaJSONV3_47_0 = exports.isProjectSchemaJSONV3_46_0 = exports.isProjectSchemaJSONV3_45_0 = exports.isProjectSchemaJSONV3_44_0 = exports.isProjectSchemaJSONV3_43_0 = exports.isProjectSchemaJSONV3_42_0 = void 0;
|
|
19
19
|
// This file is generated by "pnpm json2ts"
|
|
20
20
|
__exportStar(require("./latest"), exports);
|
|
21
21
|
__exportStar(require("./v1.0.0"), exports);
|
|
@@ -77,6 +77,7 @@ __exportStar(require("./v3.47.0"), exports);
|
|
|
77
77
|
__exportStar(require("./v3.48.0"), exports);
|
|
78
78
|
__exportStar(require("./v3.49.0"), exports);
|
|
79
79
|
__exportStar(require("./v3.50.0"), exports);
|
|
80
|
+
__exportStar(require("./v3.51.0"), exports);
|
|
80
81
|
__exportStar(require("./v4.0.0"), exports);
|
|
81
82
|
// Schema type utilities
|
|
82
83
|
function createVersionPredicate(expectedVersion) {
|
|
@@ -150,5 +151,6 @@ exports.isProjectSchemaJSONV3_47_0 = createVersionPredicate('3.47.0');
|
|
|
150
151
|
exports.isProjectSchemaJSONV3_48_0 = createVersionPredicate('3.48.0');
|
|
151
152
|
exports.isProjectSchemaJSONV3_49_0 = createVersionPredicate('3.49.0');
|
|
152
153
|
exports.isProjectSchemaJSONV3_50_0 = createVersionPredicate('3.50.0');
|
|
153
|
-
exports.
|
|
154
|
+
exports.isProjectSchemaJSONV3_51_0 = createVersionPredicate('3.51.0');
|
|
155
|
+
exports.isLatestProjectSchemaJSON = createVersionPredicate('3.51.0');
|
|
154
156
|
exports.isProjectSchemaJSONV4_0_0 = createVersionPredicate('4.0.0');
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ensureLatest = exports.migrateToLatestProjectSchema = void 0;
|
|
4
4
|
const migration_1 = require("../migration");
|
|
5
5
|
const index_1 = require("./index");
|
|
6
|
-
// eslint-disable-next-line complexity
|
|
7
6
|
async function migrateToLatestProjectSchema(context, projectSchema) {
|
|
8
7
|
if ((0, index_1.isLatestProjectSchemaJSON)(projectSchema)) {
|
|
9
8
|
return projectSchema;
|
|
@@ -182,6 +181,9 @@ async function migrateToLatestProjectSchema(context, projectSchema) {
|
|
|
182
181
|
if ((0, index_1.isProjectSchemaJSONV3_49_0)(projectSchema)) {
|
|
183
182
|
projectSchema = await migration_1.migrateTo['v3.50.0'](context, projectSchema);
|
|
184
183
|
}
|
|
184
|
+
if ((0, index_1.isProjectSchemaJSONV3_50_0)(projectSchema)) {
|
|
185
|
+
projectSchema = await migration_1.migrateTo['v3.51.0'](context, projectSchema);
|
|
186
|
+
}
|
|
185
187
|
if ((0, index_1.isProjectSchemaJSONV4_0_0)(projectSchema)) {
|
|
186
188
|
throw new Error('You are using an unreleased schema version. Migration is not possible');
|
|
187
189
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/**
|
|
4
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
5
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
6
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/cjs/src/refs.js
CHANGED
|
@@ -5,18 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.propertyRefItemToPath = exports.queryRefToLocalName = exports.propertyRefItemToLocalName = exports.propertyRefItemToArgsPath = exports.propertyRefItemToResolverPath = exports.applyNamespace = exports.formatShapeRef = exports.propertyRefToShapeRef = exports.normalizePropertyRef = exports.serializePropertyRef = exports.parsePropertyRef = exports.createGetNamespace = exports.dereferenceObjectSchema = exports.dereferenceSchema = exports.hasResolvableRef = exports.hasRef = exports.followRef = exports.omitRefAndExtend = exports.anyRefToShapeSchemaPath = exports.getRefShapeName = exports.refItemToShapeSchema = exports.refItemToShapeWithPath = exports.refItemListToShapeList = exports.refItemToShape = exports.refItemToShapePath = exports.refItemToNamespacedShapeName = exports.refItemToAtRef = exports.getRefOrItemsRef = exports.getOneOfRefs = exports.hasRefProperty = exports.getRefWithPath = exports.getRef = exports.shapeToRefString = exports.shapeToRefItem = exports.parseName = exports.refToRefItem = exports.atRefToRefItem = exports.splitAtRef = exports.refExpressionToShape = exports.refExpressionListToRefItemList = exports.refExpressionToRefItem = exports.refSchemaToPath = exports.$refToAtRef = exports.getFlattenedTemplateShapeName = exports.untemplate = exports.createTemplateShapeName = exports.returnShapeToSchema = exports.parseReturnShape = exports.parseTemplateShape = exports.isRefItemWithPath = void 0;
|
|
7
7
|
exports.normalizeRefs = exports.ensureQuery = exports.getQuery = exports.getAllPropertyRefs = exports.normalizeLocalRefString = exports.normalizeRefExpression = exports.propertyRefToArgs = void 0;
|
|
8
|
+
const errors_1 = require("@takeshape/errors");
|
|
8
9
|
const util_1 = require("@takeshape/util");
|
|
9
|
-
const
|
|
10
|
+
const compact_js_1 = __importDefault(require("lodash/compact.js"));
|
|
10
11
|
const assign_js_1 = __importDefault(require("lodash/fp/assign.js"));
|
|
11
12
|
const omit_js_1 = __importDefault(require("lodash/fp/omit.js"));
|
|
13
|
+
const get_js_1 = __importDefault(require("lodash/get.js"));
|
|
12
14
|
const isString_js_1 = __importDefault(require("lodash/isString.js"));
|
|
13
|
-
const errors_1 = require("@takeshape/errors");
|
|
14
|
-
const compact_js_1 = __importDefault(require("lodash/compact.js"));
|
|
15
|
-
const util_2 = require("./services/util");
|
|
16
|
-
const merge_1 = require("./util/merge");
|
|
17
|
-
const ai_tools_1 = require("./util/ai-tools");
|
|
18
15
|
const scalars_1 = require("./scalars");
|
|
16
|
+
const util_2 = require("./services/util");
|
|
19
17
|
const types_1 = require("./types");
|
|
18
|
+
const ai_tools_1 = require("./util/ai-tools");
|
|
19
|
+
const merge_1 = require("./util/merge");
|
|
20
20
|
/**
|
|
21
21
|
* Guard for RefItemWithPath. Tests for presence of all required props.
|
|
22
22
|
*/
|
|
@@ -43,7 +43,11 @@ function parseReturnShape(projectSchema, shape) {
|
|
|
43
43
|
if (!ref) {
|
|
44
44
|
throw new Error(`Could not parse ${JSON.stringify(shape.items)}: invalid ref`);
|
|
45
45
|
}
|
|
46
|
-
return {
|
|
46
|
+
return {
|
|
47
|
+
isArray: true,
|
|
48
|
+
ref,
|
|
49
|
+
shapeName: refItemToNamespacedShapeName(ref)
|
|
50
|
+
};
|
|
47
51
|
}
|
|
48
52
|
if (typeof shape.items.type !== 'string') {
|
|
49
53
|
throw new Error(`Could not parse ${JSON.stringify(shape.items)}: invalid type`);
|
|
@@ -63,7 +67,9 @@ function returnShapeToSchema(projectSchema, returnShape) {
|
|
|
63
67
|
if ((0, scalars_1.isScalar)(returnShape) || returnShape === 'object') {
|
|
64
68
|
return { type: returnShape };
|
|
65
69
|
}
|
|
66
|
-
return {
|
|
70
|
+
return {
|
|
71
|
+
'@ref': refItemToAtRef(refExpressionToRefItem(projectSchema, returnShape))
|
|
72
|
+
};
|
|
67
73
|
}
|
|
68
74
|
return returnShape;
|
|
69
75
|
}
|
|
@@ -129,7 +135,7 @@ exports.refExpressionToRefItem = refExpressionToRefItem;
|
|
|
129
135
|
* Converts a list of ref expressions into a list of ref items.
|
|
130
136
|
*/
|
|
131
137
|
function refExpressionListToRefItemList(context, refExpressionList) {
|
|
132
|
-
return refExpressionList.map(ref => refExpressionToRefItem(context, ref));
|
|
138
|
+
return refExpressionList.map((ref) => refExpressionToRefItem(context, ref));
|
|
133
139
|
}
|
|
134
140
|
exports.refExpressionListToRefItemList = refExpressionListToRefItemList;
|
|
135
141
|
/**
|
|
@@ -272,7 +278,7 @@ function getOneOfRefs(context, propertySchema, schemaPath = []) {
|
|
|
272
278
|
const oneOf = propertySchema.oneOf ?? propertySchema.items?.oneOf;
|
|
273
279
|
const path = propertySchema.oneOf ? schemaPath : [...schemaPath, 'items'];
|
|
274
280
|
if (oneOf) {
|
|
275
|
-
return (0, compact_js_1.default)(oneOf.map(one => {
|
|
281
|
+
return (0, compact_js_1.default)(oneOf.map((one) => {
|
|
276
282
|
return getRefWithPath(context, one, path);
|
|
277
283
|
}));
|
|
278
284
|
}
|
|
@@ -328,7 +334,7 @@ exports.refItemToShape = refItemToShape;
|
|
|
328
334
|
* Get all shapes referenced by a RefItem array.
|
|
329
335
|
*/
|
|
330
336
|
function refItemListToShapeList(context, refItems) {
|
|
331
|
-
return refItems.map(ref => refItemToShape(context, ref)).filter(util_1.isDefined);
|
|
337
|
+
return refItems.map((ref) => refItemToShape(context, ref)).filter(util_1.isDefined);
|
|
332
338
|
}
|
|
333
339
|
exports.refItemListToShapeList = refItemListToShapeList;
|
|
334
340
|
/**
|
|
@@ -408,10 +414,10 @@ function hasResolvableRef(context, schema) {
|
|
|
408
414
|
return Boolean(refItemToShapeSchema(context, getRef(context, schema)));
|
|
409
415
|
}
|
|
410
416
|
if ((0, types_1.isAllOfSchema)(schema)) {
|
|
411
|
-
return Boolean(schema.allOf.find(s => hasResolvableRef(context, s)));
|
|
417
|
+
return Boolean(schema.allOf.find((s) => hasResolvableRef(context, s)));
|
|
412
418
|
}
|
|
413
419
|
if ((0, types_1.isOneOfSchema)(schema)) {
|
|
414
|
-
return Boolean(schema.oneOf.find(s => hasResolvableRef(context, s)));
|
|
420
|
+
return Boolean(schema.oneOf.find((s) => hasResolvableRef(context, s)));
|
|
415
421
|
}
|
|
416
422
|
return false;
|
|
417
423
|
}
|
|
@@ -420,7 +426,7 @@ function isSelfReferential(path, shapeName) {
|
|
|
420
426
|
if (path[0] !== 'shapes' || path[1] !== shapeName) {
|
|
421
427
|
return false;
|
|
422
428
|
}
|
|
423
|
-
const index = path.findIndex(part => part === 'allOf' || part === 'extends');
|
|
429
|
+
const index = path.findIndex((part) => part === 'allOf' || part === 'extends');
|
|
424
430
|
return index !== -1 && (0, util_1.isIntegerLike)(path[Number(index) + 1]);
|
|
425
431
|
}
|
|
426
432
|
/**
|
|
@@ -480,7 +486,7 @@ function dereferenceObjectSchema(context, shapeOrFieldSchema, schemaPath = []) {
|
|
|
480
486
|
}
|
|
481
487
|
exports.dereferenceObjectSchema = dereferenceObjectSchema;
|
|
482
488
|
function createGetNamespace(context) {
|
|
483
|
-
return serviceId => context.services?.[serviceId]?.namespace;
|
|
489
|
+
return (serviceId) => context.services?.[serviceId]?.namespace;
|
|
484
490
|
}
|
|
485
491
|
exports.createGetNamespace = createGetNamespace;
|
|
486
492
|
function parsePropertyRef(refStr) {
|
|
@@ -490,7 +496,11 @@ function parsePropertyRef(refStr) {
|
|
|
490
496
|
return { serviceId, shapeName: 'Query', propertyName: coordinateParts[0] };
|
|
491
497
|
}
|
|
492
498
|
if (coordinateParts.length === 2) {
|
|
493
|
-
return {
|
|
499
|
+
return {
|
|
500
|
+
serviceId,
|
|
501
|
+
shapeName: coordinateParts[0],
|
|
502
|
+
propertyName: coordinateParts[1]
|
|
503
|
+
};
|
|
494
504
|
}
|
|
495
505
|
}
|
|
496
506
|
exports.parsePropertyRef = parsePropertyRef;
|
|
@@ -581,7 +591,7 @@ function getAllPropertyRefs(projectSchema) {
|
|
|
581
591
|
const parentIsResolver = (path, resolverName) => {
|
|
582
592
|
const parent = (0, get_js_1.default)(projectSchema, path.slice(0, -1));
|
|
583
593
|
return ((0, util_1.isRecord)(parent) &&
|
|
584
|
-
(Array.isArray(resolverName) ? resolverName.some(name => name === parent.name) : parent.name === resolverName));
|
|
594
|
+
(Array.isArray(resolverName) ? resolverName.some((name) => name === parent.name) : parent.name === resolverName));
|
|
585
595
|
};
|
|
586
596
|
const parentIsGenerateState = (path) => {
|
|
587
597
|
if (path[0] !== 'ai-experimental' || path[path.length - 2] !== 'execution') {
|
|
@@ -646,7 +656,7 @@ function normalizeRefs(projectSchema, property) {
|
|
|
646
656
|
if (property.oneOf) {
|
|
647
657
|
return {
|
|
648
658
|
...updatedProperty,
|
|
649
|
-
oneOf: property.oneOf.map(item => normalizeRefs(projectSchema, item))
|
|
659
|
+
oneOf: property.oneOf.map((item) => normalizeRefs(projectSchema, item))
|
|
650
660
|
};
|
|
651
661
|
}
|
|
652
662
|
// Convert $ref to @ref
|
|
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.addRelatedFields = exports.hasUnequalRelationships = exports.isEqualRelationship = exports.findExistingRelationships = exports.getRelationship = exports.getLegacyRelationship = exports.getRelationshipShapeIds = exports.getRelationshipShapes = exports.getRelationshipShapeRefs = exports.getRelationshipSchema = void 0;
|
|
7
7
|
const util_1 = require("@takeshape/util");
|
|
8
|
-
const find_js_1 = __importDefault(require("lodash/find.js"));
|
|
9
8
|
const camelCase_js_1 = __importDefault(require("lodash/camelCase.js"));
|
|
9
|
+
const find_js_1 = __importDefault(require("lodash/find.js"));
|
|
10
10
|
const uniq_js_1 = __importDefault(require("lodash/uniq.js"));
|
|
11
|
-
const
|
|
11
|
+
const builtin_schema_1 = require("./builtin-schema");
|
|
12
12
|
const refs_1 = require("./refs");
|
|
13
|
+
const types_1 = require("./types");
|
|
13
14
|
const unions_1 = require("./unions");
|
|
14
|
-
const builtin_schema_1 = require("./builtin-schema");
|
|
15
15
|
const shapes_1 = require("./util/shapes");
|
|
16
16
|
/**
|
|
17
17
|
* Turn a LegacyRelationship into a partial PropertySchemaWithRelationship.
|
|
@@ -31,8 +31,8 @@ function getRelationshipSchema(projectSchema, relationship) {
|
|
|
31
31
|
let shapeRefs;
|
|
32
32
|
if ('shapeIds' in relationship) {
|
|
33
33
|
shapeRefs = relationship.shapeIds
|
|
34
|
-
.map(shapeId => {
|
|
35
|
-
const shape = (0, shapes_1.getShapeById)(projectSchema, shapeId) ?? (0, find_js_1.default)(builtin_schema_1.builtInShapes, shape => shape.id === shapeId);
|
|
34
|
+
.map((shapeId) => {
|
|
35
|
+
const shape = (0, shapes_1.getShapeById)(projectSchema, shapeId) ?? (0, find_js_1.default)(builtin_schema_1.builtInShapes, (shape) => shape.id === shapeId);
|
|
36
36
|
return (shape && {
|
|
37
37
|
'@ref': `local:${shape.name}`
|
|
38
38
|
});
|
|
@@ -41,7 +41,7 @@ function getRelationshipSchema(projectSchema, relationship) {
|
|
|
41
41
|
isMultiple = relationship.type === 'multiple';
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
|
-
shapeRefs = relationship.refs.map(refStr => ({ '@ref': refStr }));
|
|
44
|
+
shapeRefs = relationship.refs.map((refStr) => ({ '@ref': refStr }));
|
|
45
45
|
isMultiple = relationship.isMultiple;
|
|
46
46
|
}
|
|
47
47
|
if (!shapeRefs.length) {
|
|
@@ -77,7 +77,7 @@ function getRelationshipShapeRefs(propertySchema) {
|
|
|
77
77
|
let refs = [];
|
|
78
78
|
const schema = propertySchema.items ?? propertySchema;
|
|
79
79
|
if (schema.oneOf) {
|
|
80
|
-
refs = schema.oneOf.map(schema => schema['@ref']).filter(util_1.isDefined);
|
|
80
|
+
refs = schema.oneOf.map((schema) => schema['@ref']).filter(util_1.isDefined);
|
|
81
81
|
}
|
|
82
82
|
else if (schema['@ref']) {
|
|
83
83
|
refs = [schema['@ref']];
|
|
@@ -90,7 +90,7 @@ exports.getRelationshipShapeRefs = getRelationshipShapeRefs;
|
|
|
90
90
|
*/
|
|
91
91
|
function getRelationshipShapes(shapes, refs) {
|
|
92
92
|
return refs
|
|
93
|
-
.map(ref => {
|
|
93
|
+
.map((ref) => {
|
|
94
94
|
const shapeName = ref.split(':')[1];
|
|
95
95
|
const shape = shapes[shapeName];
|
|
96
96
|
return shape ? shape : undefined;
|
|
@@ -103,7 +103,7 @@ exports.getRelationshipShapes = getRelationshipShapes;
|
|
|
103
103
|
*/
|
|
104
104
|
function getRelationshipShapeIds(shapes, refs) {
|
|
105
105
|
return refs
|
|
106
|
-
.map(ref => {
|
|
106
|
+
.map((ref) => {
|
|
107
107
|
const shapeName = ref.split(':')[1];
|
|
108
108
|
const shape = shapes[shapeName];
|
|
109
109
|
return shape ? shape.id : undefined;
|
|
@@ -149,7 +149,7 @@ function findExistingRelationships(projectSchema, shapes) {
|
|
|
149
149
|
const relationships = {};
|
|
150
150
|
const shapeArray = Object.values(shapes);
|
|
151
151
|
const shapesSeen = new Set();
|
|
152
|
-
const shapeIds = new Set(shapeArray.map(shape => shape.id));
|
|
152
|
+
const shapeIds = new Set(shapeArray.map((shape) => shape.id));
|
|
153
153
|
const findRelationships = (schema, path, parentShapeName) => {
|
|
154
154
|
const relationship = getRelationship(schema);
|
|
155
155
|
if (relationship) {
|
|
@@ -224,7 +224,7 @@ function isEqualRelationship(a, b) {
|
|
|
224
224
|
return false;
|
|
225
225
|
}
|
|
226
226
|
const refSet = new Set(refsA);
|
|
227
|
-
return refsB.every(ref => refSet.has(ref));
|
|
227
|
+
return refsB.every((ref) => refSet.has(ref));
|
|
228
228
|
}
|
|
229
229
|
exports.isEqualRelationship = isEqualRelationship;
|
|
230
230
|
/**
|
|
@@ -238,10 +238,10 @@ function hasUnequalRelationships(relationships) {
|
|
|
238
238
|
}
|
|
239
239
|
exports.hasUnequalRelationships = hasUnequalRelationships;
|
|
240
240
|
function getRelatedShapeIds(relationships) {
|
|
241
|
-
return (0, uniq_js_1.default)(relationships.map(rel => (rel.hasBackreference ? rel.shapeId : undefined)).filter(util_1.isDefined));
|
|
241
|
+
return (0, uniq_js_1.default)(relationships.map((rel) => (rel.hasBackreference ? rel.shapeId : undefined)).filter(util_1.isDefined));
|
|
242
242
|
}
|
|
243
243
|
function getShapes(projectSchema, shapeIds) {
|
|
244
|
-
return shapeIds.map(shapeId => (0, shapes_1.getShapeById)(projectSchema, shapeId)).filter(util_1.isDefined);
|
|
244
|
+
return shapeIds.map((shapeId) => (0, shapes_1.getShapeById)(projectSchema, shapeId)).filter(util_1.isDefined);
|
|
245
245
|
}
|
|
246
246
|
/**
|
|
247
247
|
* Adds backreference fields to the schema.
|
|
@@ -251,7 +251,7 @@ function addRelatedFields(projectSchema, allRelationships) {
|
|
|
251
251
|
const shape = (0, shapes_1.getShapeById)(projectSchema, shapeId);
|
|
252
252
|
if (shape && (0, types_1.isObjectSchema)(shape.schema)) {
|
|
253
253
|
const relatedShapeIds = getRelatedShapeIds(shapeRelationships);
|
|
254
|
-
const relatedShapeNames = getShapes(projectSchema, relatedShapeIds).map(shape => shape.name);
|
|
254
|
+
const relatedShapeNames = getShapes(projectSchema, relatedShapeIds).map((shape) => shape.name);
|
|
255
255
|
if (relatedShapeNames.length) {
|
|
256
256
|
let shapeName;
|
|
257
257
|
if (relatedShapeNames.length === 1) {
|
|
@@ -266,14 +266,16 @@ function addRelatedFields(projectSchema, allRelationships) {
|
|
|
266
266
|
name: shapeName,
|
|
267
267
|
title: shapeName,
|
|
268
268
|
schema: {
|
|
269
|
-
oneOf: relatedShapeNames.map(name => ({
|
|
269
|
+
oneOf: relatedShapeNames.map((name) => ({
|
|
270
|
+
'@ref': `local:${name}`
|
|
271
|
+
}))
|
|
270
272
|
}
|
|
271
273
|
};
|
|
272
274
|
}
|
|
273
275
|
// _references, a list of all backreferences across all fields on this shape.
|
|
274
276
|
// It lists all the items that have references to the current item.
|
|
275
277
|
// It is for convenience.
|
|
276
|
-
if (shapeRelationships.some(rel => rel.hasBackreference)) {
|
|
278
|
+
if (shapeRelationships.some((rel) => rel.hasBackreference)) {
|
|
277
279
|
shape.schema.properties._references = {
|
|
278
280
|
'@args': `TSListArgs<local:${shapeName}>`,
|
|
279
281
|
'@ref': `PaginatedList<local:${shapeName}>`,
|
|
@@ -283,8 +285,8 @@ function addRelatedFields(projectSchema, allRelationships) {
|
|
|
283
285
|
args: {
|
|
284
286
|
ops: [
|
|
285
287
|
{ path: '$', mapping: '$args' },
|
|
286
|
-
{ path:
|
|
287
|
-
{ path:
|
|
288
|
+
{ path: 'baseWhere._references.eq', mapping: '$source._id' },
|
|
289
|
+
{ path: 'baseWhere._shapeId.in', value: relatedShapeIds }
|
|
288
290
|
]
|
|
289
291
|
}
|
|
290
292
|
}
|
|
@@ -307,8 +309,11 @@ function addRelatedFields(projectSchema, allRelationships) {
|
|
|
307
309
|
args: {
|
|
308
310
|
ops: [
|
|
309
311
|
{ path: '$', mapping: '$args' },
|
|
310
|
-
{
|
|
311
|
-
|
|
312
|
+
{
|
|
313
|
+
path: `baseWhere.${filterField}.eq`,
|
|
314
|
+
mapping: '$source._id'
|
|
315
|
+
},
|
|
316
|
+
{ path: 'baseWhere._shapeId.eq', value: relatedShape.id }
|
|
312
317
|
]
|
|
313
318
|
}
|
|
314
319
|
}
|
|
@@ -5,16 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.buildRuntimeSchema = exports.applyDefaultsAndFlatten = exports.applyLegacyCompatibilityTweaks = void 0;
|
|
7
7
|
const errors_1 = require("@takeshape/errors");
|
|
8
|
-
const compose_js_1 = __importDefault(require("lodash/fp/compose.js"));
|
|
9
8
|
const util_1 = require("@takeshape/util");
|
|
10
|
-
const
|
|
9
|
+
const compose_js_1 = __importDefault(require("lodash/fp/compose.js"));
|
|
11
10
|
const isError_js_1 = __importDefault(require("lodash/isError.js"));
|
|
12
|
-
const
|
|
13
|
-
const schema_util_1 = require("./schema-util");
|
|
14
|
-
const relationships_1 = require("./relationships");
|
|
15
|
-
const flatten_templates_1 = require("./flatten-templates");
|
|
11
|
+
const set_js_1 = __importDefault(require("lodash/set.js"));
|
|
16
12
|
const agents_1 = require("./agents");
|
|
13
|
+
const flatten_templates_1 = require("./flatten-templates");
|
|
14
|
+
const relationships_1 = require("./relationships");
|
|
15
|
+
const schema_util_1 = require("./schema-util");
|
|
17
16
|
const service_dependencies_1 = require("./service-dependencies");
|
|
17
|
+
const types_1 = require("./types");
|
|
18
18
|
function applyLegacyCompatibilityTweaks(projectSchema) {
|
|
19
19
|
const newSchema = (0, util_1.deepClone)(projectSchema);
|
|
20
20
|
let hasSearchableShapes = false;
|
|
@@ -22,8 +22,12 @@ function applyLegacyCompatibilityTweaks(projectSchema) {
|
|
|
22
22
|
if ((0, types_1.isModelShape)(shape)) {
|
|
23
23
|
hasSearchableShapes = true;
|
|
24
24
|
// Magic _contentTypeId field used for V1 compatibility
|
|
25
|
-
(0, set_js_1.default)(shape, ['schema', 'properties', '_contentTypeId'], {
|
|
26
|
-
|
|
25
|
+
(0, set_js_1.default)(shape, ['schema', 'properties', '_contentTypeId'], {
|
|
26
|
+
type: 'string'
|
|
27
|
+
});
|
|
28
|
+
(0, set_js_1.default)(shape, ['schema', 'properties', '_contentTypeName'], {
|
|
29
|
+
type: 'string'
|
|
30
|
+
});
|
|
27
31
|
if (shape.model?.type !== 'single') {
|
|
28
32
|
newSchema.queries[`search${shapeName}Index`] = {
|
|
29
33
|
shape: `SearchResults<${shapeName}>`,
|
|
@@ -49,7 +53,10 @@ function applyLegacyCompatibilityTweaks(projectSchema) {
|
|
|
49
53
|
}
|
|
50
54
|
if (hasSearchableShapes) {
|
|
51
55
|
// A placeholder shape for the TSSearchable interface
|
|
52
|
-
newSchema.shapes.TSSearchable = (0, schema_util_1.createShape)('TSSearchable', {
|
|
56
|
+
newSchema.shapes.TSSearchable = (0, schema_util_1.createShape)('TSSearchable', {
|
|
57
|
+
type: 'object',
|
|
58
|
+
properties: {}
|
|
59
|
+
});
|
|
53
60
|
newSchema.queries.search = {
|
|
54
61
|
shape: 'SearchResults<TSSearchable>',
|
|
55
62
|
resolver: {
|