@baseplate-dev/plugin-auth 0.1.2 → 1.0.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/auth/core/common.d.ts +1 -0
- package/dist/auth/core/common.d.ts.map +1 -1
- package/dist/auth/core/common.js.map +1 -1
- package/dist/auth/core/node.d.ts.map +1 -1
- package/dist/auth/core/node.js +6 -3
- package/dist/auth/core/node.js.map +1 -1
- package/dist/auth/core/schema/models.d.ts.map +1 -1
- package/dist/auth/core/schema/models.js +11 -0
- package/dist/auth/core/schema/models.js.map +1 -1
- package/dist/auth/generators/fastify/auth-module/auth-module.generator.d.ts +13 -1
- package/dist/auth/generators/fastify/auth-module/auth-module.generator.d.ts.map +1 -1
- package/dist/auth/generators/fastify/auth-module/auth-module.generator.js +20 -8
- package/dist/auth/generators/fastify/auth-module/auth-module.generator.js.map +1 -1
- package/dist/auth/generators/fastify/auth-module/generated/index.d.ts +88 -0
- package/dist/auth/generators/fastify/auth-module/generated/index.d.ts.map +1 -0
- package/dist/auth/generators/fastify/auth-module/generated/index.js +9 -0
- package/dist/auth/generators/fastify/auth-module/generated/index.js.map +1 -0
- package/dist/auth/generators/fastify/auth-module/generated/template-paths.d.ts +16 -0
- package/dist/auth/generators/fastify/auth-module/generated/template-paths.d.ts.map +1 -0
- package/dist/auth/generators/fastify/auth-module/generated/template-paths.js +26 -0
- package/dist/auth/generators/fastify/auth-module/generated/template-paths.js.map +1 -0
- package/dist/auth/generators/fastify/auth-module/generated/ts-import-providers.d.ts +10 -0
- package/dist/auth/generators/fastify/auth-module/generated/ts-import-providers.d.ts.map +1 -0
- package/dist/auth/generators/fastify/auth-module/generated/ts-import-providers.js +23 -0
- package/dist/auth/generators/fastify/auth-module/generated/ts-import-providers.js.map +1 -0
- package/dist/auth/generators/fastify/auth-module/generated/{ts-templates.d.ts → typed-templates.d.ts} +26 -41
- package/dist/auth/generators/fastify/auth-module/generated/typed-templates.d.ts.map +1 -0
- package/dist/auth/generators/fastify/auth-module/generated/typed-templates.js +68 -0
- package/dist/auth/generators/fastify/auth-module/generated/typed-templates.js.map +1 -0
- package/dist/auth/generators/fastify/auth-module/index.d.ts +2 -0
- package/dist/auth/generators/fastify/auth-module/index.d.ts.map +1 -0
- package/dist/auth/generators/fastify/auth-module/index.js +2 -0
- package/dist/auth/generators/fastify/auth-module/index.js.map +1 -0
- package/dist/auth/generators/fastify/auth-module/templates/{utils → module/utils}/cookie-signer.ts +6 -0
- package/dist/auth/generators/fastify/index.d.ts +1 -1
- package/dist/auth/generators/fastify/index.d.ts.map +1 -1
- package/dist/auth/generators/fastify/index.js +1 -1
- package/dist/auth/generators/fastify/index.js.map +1 -1
- package/dist/auth0/core/schema/models.d.ts.map +1 -1
- package/dist/auth0/core/schema/models.js +6 -0
- package/dist/auth0/core/schema/models.js.map +1 -1
- package/dist/auth0/generators/fastify/auth0-module/auth0-module.generator.d.ts +14 -6
- package/dist/auth0/generators/fastify/auth0-module/auth0-module.generator.d.ts.map +1 -1
- package/dist/auth0/generators/fastify/auth0-module/auth0-module.generator.js +11 -16
- package/dist/auth0/generators/fastify/auth0-module/auth0-module.generator.js.map +1 -1
- package/dist/auth0/generators/fastify/auth0-module/generated/index.d.ts +62 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/index.d.ts.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/index.js +9 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/index.js.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/template-paths.d.ts +13 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/template-paths.d.ts.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/template-paths.js +23 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/template-paths.js.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-providers.d.ts +10 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-providers.d.ts.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-providers.js +23 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-providers.js.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/{ts-templates.d.ts → typed-templates.d.ts} +2 -2
- package/dist/auth0/generators/fastify/auth0-module/generated/typed-templates.d.ts.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/{ts-templates.js → typed-templates.js} +11 -8
- package/dist/auth0/generators/fastify/auth0-module/generated/typed-templates.js.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/index.d.ts +2 -0
- package/dist/auth0/generators/fastify/auth0-module/index.d.ts.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/index.js +2 -0
- package/dist/auth0/generators/fastify/auth0-module/index.js.map +1 -0
- package/dist/auth0/generators/fastify/index.d.ts +1 -1
- package/dist/auth0/generators/fastify/index.d.ts.map +1 -1
- package/dist/auth0/generators/fastify/index.js +1 -1
- package/dist/auth0/generators/fastify/index.js.map +1 -1
- package/dist/auth0/generators/react/auth0-apollo/index.d.ts +2 -0
- package/dist/auth0/generators/react/auth0-apollo/index.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-apollo/index.js +2 -0
- package/dist/auth0/generators/react/auth0-apollo/index.js.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/auth0-callback.generator.d.ts +101 -8
- package/dist/auth0/generators/react/auth0-callback/auth0-callback.generator.d.ts.map +1 -1
- package/dist/auth0/generators/react/auth0-callback/auth0-callback.generator.js +10 -11
- package/dist/auth0/generators/react/auth0-callback/auth0-callback.generator.js.map +1 -1
- package/dist/auth0/generators/react/auth0-callback/generated/index.d.ts +290 -0
- package/dist/auth0/generators/react/auth0-callback/generated/index.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/generated/index.js +7 -0
- package/dist/auth0/generators/react/auth0-callback/generated/index.js.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/generated/template-paths.d.ts +13 -0
- package/dist/auth0/generators/react/auth0-callback/generated/template-paths.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/generated/template-paths.js +23 -0
- package/dist/auth0/generators/react/auth0-callback/generated/template-paths.js.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/generated/typed-templates.d.ts +280 -0
- package/dist/auth0/generators/react/auth0-callback/generated/typed-templates.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/generated/{ts-templates.js → typed-templates.js} +11 -9
- package/dist/auth0/generators/react/auth0-callback/generated/typed-templates.js.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/index.d.ts +2 -0
- package/dist/auth0/generators/react/auth0-callback/index.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/index.js +2 -0
- package/dist/auth0/generators/react/auth0-callback/index.js.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/templates/{auth0-callback.page.tsx → routes/auth0-callback.page.tsx} +3 -3
- package/dist/auth0/generators/react/auth0-callback/templates/{signup.page.tsx → routes/signup.page.tsx} +3 -3
- package/dist/auth0/generators/react/auth0-components/auth0-components.generator.d.ts +106 -12
- package/dist/auth0/generators/react/auth0-components/auth0-components.generator.d.ts.map +1 -1
- package/dist/auth0/generators/react/auth0-components/auth0-components.generator.js +12 -16
- package/dist/auth0/generators/react/auth0-components/auth0-components.generator.js.map +1 -1
- package/dist/auth0/generators/react/auth0-components/generated/index.d.ts +151 -0
- package/dist/auth0/generators/react/auth0-components/generated/index.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-components/generated/index.js +9 -0
- package/dist/auth0/generators/react/auth0-components/generated/index.js.map +1 -0
- package/dist/auth0/generators/react/auth0-components/generated/template-paths.d.ts +12 -0
- package/dist/auth0/generators/react/auth0-components/generated/template-paths.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-components/generated/template-paths.js +22 -0
- package/dist/auth0/generators/react/auth0-components/generated/template-paths.js.map +1 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-providers.d.ts +10 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-providers.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-providers.js +25 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-providers.js.map +1 -0
- package/dist/auth0/generators/react/auth0-components/generated/typed-templates.d.ts +132 -0
- package/dist/auth0/generators/react/auth0-components/generated/typed-templates.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-components/generated/typed-templates.js +17 -0
- package/dist/auth0/generators/react/auth0-components/generated/typed-templates.js.map +1 -0
- package/dist/auth0/generators/react/auth0-components/index.d.ts +2 -0
- package/dist/auth0/generators/react/auth0-components/index.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-components/index.js +2 -0
- package/dist/auth0/generators/react/auth0-components/index.js.map +1 -0
- package/dist/auth0/generators/react/auth0-components/templates/{RequireAuth.tsx → src/components/require-auth/require-auth.tsx} +4 -4
- package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.d.ts +10 -2
- package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.d.ts.map +1 -1
- package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.js +13 -24
- package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.js.map +1 -1
- package/dist/auth0/generators/react/auth0-hooks/generated/index.d.ts +51 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/index.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/index.js +9 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/index.js.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/template-paths.d.ts +16 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/template-paths.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/template-paths.js +26 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/template-paths.js.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-providers.d.ts +16 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-providers.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-providers.js +27 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-providers.js.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/typed-templates.d.ts +44 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/typed-templates.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/typed-templates.js +67 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/typed-templates.js.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/index.d.ts +2 -0
- package/dist/auth0/generators/react/auth0-hooks/index.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/index.js +2 -0
- package/dist/auth0/generators/react/auth0-hooks/index.js.map +1 -0
- package/dist/auth0/generators/react/index.d.ts +5 -5
- package/dist/auth0/generators/react/index.d.ts.map +1 -1
- package/dist/auth0/generators/react/index.js +5 -5
- package/dist/auth0/generators/react/index.js.map +1 -1
- package/dist/auth0/generators/react/react-auth0/index.d.ts +2 -0
- package/dist/auth0/generators/react/react-auth0/index.d.ts.map +1 -0
- package/dist/auth0/generators/react/react-auth0/index.js +2 -0
- package/dist/auth0/generators/react/react-auth0/index.js.map +1 -0
- package/dist/web/assets/{__federation_expose_auth0CoreCommon--n6esVYP.js → __federation_expose_auth0CoreCommon-hOTVdirQ.js} +3 -3
- package/dist/web/assets/{__federation_expose_auth0CoreCommon--n6esVYP.js.map → __federation_expose_auth0CoreCommon-hOTVdirQ.js.map} +1 -1
- package/dist/web/assets/{__federation_expose_auth0CoreWeb-Ql6gpX5q.js → __federation_expose_auth0CoreWeb-xV61eveJ.js} +13 -9
- package/dist/web/assets/__federation_expose_auth0CoreWeb-xV61eveJ.js.map +1 -0
- package/dist/web/assets/__federation_expose_authCoreCommon-CndjGc3R.js +36 -0
- package/dist/web/assets/__federation_expose_authCoreCommon-CndjGc3R.js.map +1 -0
- package/dist/web/assets/__federation_expose_authCoreWeb-CJ4-gYAU.js +442 -0
- package/dist/web/assets/__federation_expose_authCoreWeb-CJ4-gYAU.js.map +1 -0
- package/dist/web/assets/{__federation_fn_import-BiwmVFwy.js → __federation_fn_import-Drn1CtCD.js} +2 -2
- package/dist/web/assets/{__federation_fn_import-BiwmVFwy.js.map → __federation_fn_import-Drn1CtCD.js.map} +1 -1
- package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/{web-CY8oz43s.js → web-CcNXBRTZ.js} +18 -7
- package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/web-CcNXBRTZ.js.map +1 -0
- package/dist/web/assets/__federation_shared_@baseplate-dev/{project-builder-lib-B62IPizQ.js → project-builder-lib-Tb9xtEo4.js} +162 -829
- package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib-Tb9xtEo4.js.map +1 -0
- package/dist/web/assets/__federation_shared_@baseplate-dev/{ui-components-BU2QTWNs.js → ui-components-0t9VhwId.js} +17757 -9806
- package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-0t9VhwId.js.map +1 -0
- package/dist/web/assets/{index-CgJx-krK.js → index-CZqpaSlN.js} +10 -4
- package/dist/web/assets/{index-CgJx-krK.js.map → index-CZqpaSlN.js.map} +1 -1
- package/dist/web/assets/{index.esm-BcxPd7Ha.js → index.esm-SbEmZvZj.js} +3 -3
- package/dist/web/assets/{index.esm-BcxPd7Ha.js.map → index.esm-SbEmZvZj.js.map} +1 -1
- package/dist/web/assets/{model-utils-CbQJy1wE.js → model-merger-BLh0ERqk.js} +807 -19
- package/dist/web/assets/model-merger-BLh0ERqk.js.map +1 -0
- package/dist/web/assets/plugin-definition-CNgM5Juv.js +34 -0
- package/dist/web/assets/plugin-definition-CNgM5Juv.js.map +1 -0
- package/dist/web/assets/plugin-definition-CQ2no5O3.js +22 -0
- package/dist/web/assets/plugin-definition-CQ2no5O3.js.map +1 -0
- package/dist/web/assets/{react-2jQE8aG0.js → react-BiQIVSjI.js} +2 -2
- package/dist/web/assets/{react-2jQE8aG0.js.map → react-BiQIVSjI.js.map} +1 -1
- package/dist/web/assets/remoteEntry.js +8 -2
- package/dist/web/assets/remoteEntry.js.map +1 -1
- package/dist/web/assets/{plugin-definition-BQRupXoQ.js → schema-CaLuKwEg.js} +16 -27
- package/dist/web/assets/schema-CaLuKwEg.js.map +1 -0
- package/dist/web/assets/styles-BPCQNyj6.js +8 -0
- package/dist/web/assets/styles-BPCQNyj6.js.map +1 -0
- package/manifest.json +1 -1
- package/package.json +23 -13
- package/dist/auth/generators/fastify/auth-module/generated/ts-templates.d.ts.map +0 -1
- package/dist/auth/generators/fastify/auth-module/generated/ts-templates.js +0 -94
- package/dist/auth/generators/fastify/auth-module/generated/ts-templates.js.map +0 -1
- package/dist/auth/generators/fastify/auth-module/templates/management.ts +0 -22
- package/dist/auth/generators/fastify/auth-module/templates/schema/user-session-payload.object-type.ts +0 -23
- package/dist/auth/generators/fastify/auth-module/templates/schema/user-session.mutations.ts +0 -22
- package/dist/auth/generators/fastify/auth-module/templates/schema/user-session.queries.ts +0 -20
- package/dist/auth/generators/fastify/auth-module/templates/user-session.service.ts +0 -101
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-maps.d.ts +0 -3
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-maps.d.ts.map +0 -1
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-maps.js +0 -12
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-maps.js.map +0 -1
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-templates.d.ts.map +0 -1
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-templates.js.map +0 -1
- package/dist/auth0/generators/react/auth0-callback/generated/ts-templates.d.ts +0 -106
- package/dist/auth0/generators/react/auth0-callback/generated/ts-templates.d.ts.map +0 -1
- package/dist/auth0/generators/react/auth0-callback/generated/ts-templates.js.map +0 -1
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-maps.d.ts +0 -3
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-maps.d.ts.map +0 -1
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-maps.js +0 -12
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-maps.js.map +0 -1
- package/dist/auth0/generators/react/auth0-components/generated/ts-templates.d.ts +0 -45
- package/dist/auth0/generators/react/auth0-components/generated/ts-templates.d.ts.map +0 -1
- package/dist/auth0/generators/react/auth0-components/generated/ts-templates.js +0 -13
- package/dist/auth0/generators/react/auth0-components/generated/ts-templates.js.map +0 -1
- package/dist/auth0/generators/react/auth0-hooks/generated/text-templates.d.ts +0 -8
- package/dist/auth0/generators/react/auth0-hooks/generated/text-templates.d.ts.map +0 -1
- package/dist/auth0/generators/react/auth0-hooks/generated/text-templates.js +0 -12
- package/dist/auth0/generators/react/auth0-hooks/generated/text-templates.js.map +0 -1
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-maps.d.ts +0 -3
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-maps.d.ts.map +0 -1
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-maps.js +0 -16
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-maps.js.map +0 -1
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-templates.d.ts +0 -33
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-templates.d.ts.map +0 -1
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-templates.js +0 -50
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-templates.js.map +0 -1
- package/dist/web/assets/__federation_expose_auth0CoreWeb-Ql6gpX5q.js.map +0 -1
- package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/web-CY8oz43s.js.map +0 -1
- package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib-B62IPizQ.js.map +0 -1
- package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-BU2QTWNs.js.map +0 -1
- package/dist/web/assets/model-utils-CbQJy1wE.js.map +0 -1
- package/dist/web/assets/plugin-definition-BQRupXoQ.js.map +0 -1
- /package/dist/auth/generators/fastify/auth-module/templates/{user-session.constants.ts → module/constants/user-session.constants.ts} +0 -0
- /package/dist/auth/generators/fastify/auth-module/templates/{services → module/services}/user-session.service.ts +0 -0
- /package/dist/auth/generators/fastify/auth-module/templates/{utils → module/utils}/session-cookie.ts +0 -0
- /package/dist/auth/generators/fastify/auth-module/templates/{utils → module/utils}/verify-request-origin.ts +0 -0
- /package/dist/auth0/generators/fastify/auth0-module/templates/{management.ts → module/services/management.ts} +0 -0
- /package/dist/auth0/generators/fastify/auth0-module/templates/{user-session.service.ts → module/services/user-session.service.ts} +0 -0
- /package/dist/auth0/generators/react/auth0-hooks/templates/{useCurrentUser.gql → src/hooks/useCurrentUser.gql} +0 -0
- /package/dist/auth0/generators/react/auth0-hooks/templates/{useCurrentUser.ts → src/hooks/useCurrentUser.ts} +0 -0
- /package/dist/auth0/generators/react/auth0-hooks/templates/{useLogOut.ts → src/hooks/useLogOut.ts} +0 -0
- /package/dist/auth0/generators/react/auth0-hooks/templates/{useRequiredUserId.ts → src/hooks/useRequiredUserId.ts} +0 -0
- /package/dist/auth0/generators/react/auth0-hooks/templates/{useSession.ts → src/hooks/useSession.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as createPluginSpec,
|
|
2
|
-
export {
|
|
3
|
-
import { importShared } from '../__federation_fn_import-
|
|
1
|
+
import { c as createPluginSpec, i as isEqual, m as mapValues, a as createEntityType, z as zodPluginSymbol, Z as ZodRefWrapper, g as get$1, s as set$1, C as CASE_VALIDATORS, d as definitionSchema, b as zRef, e as modelForeignRelationEntityType, f as modelLocalRelationEntityType, h as modelScalarFieldEntityType, j as zEnt, k as modelTransformerEntityType, l as createDefinitionEntityNameResolver, n as modelEntityType, o as modelEnumValueEntityType, p as featureEntityType, q as modelEnumEntityType, r as zRefBuilder, t as zRefId, u as modelUniqueConstraintEntityType, v as createFeaturesSchema, M as ModelUtils, w as zPluginWrapper, x as omit, y as cloneDeep } from '../model-merger-BLh0ERqk.js';
|
|
2
|
+
export { S as DefinitionDiffArrayIncludesField, Q as DefinitionDiffKeyedArrayField, R as DefinitionDiffReplacementField, G as DefinitionEntityType, F as FeatureUtils, A as ZodPluginWrapper, E as ZodRef, D as ZodRefBuilder, V as applyDefinitionDiff, N as applyModelMergerDiff, O as applyModelMergerResultInPlace, P as createAndApplyModelMergerResults, U as createDefinitionDiff, T as createDefinitionDiffConfig, I as createFeatureSchema, B as createInitializedPluginSpec, K as createModelMergerResult, L as createModelMergerResults, H as featureNameSchema, J as modelMergerDefinitionDiffConfig } from '../model-merger-BLh0ERqk.js';
|
|
3
|
+
import { importShared } from '../__federation_fn_import-Drn1CtCD.js';
|
|
4
4
|
|
|
5
5
|
function createAdminCrudInputCompilerImplementation() {
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -99,171 +99,6 @@ function flow(...funcs) {
|
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
function isPrimitive(value) {
|
|
103
|
-
return value == null || (typeof value !== 'object' && typeof value !== 'function');
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function isTypedArray(x) {
|
|
107
|
-
return ArrayBuffer.isView(x) && !(x instanceof DataView);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function cloneDeepWithImpl(valueToClone, keyToClone, objectToClone, stack = new Map(), cloneValue = undefined) {
|
|
111
|
-
const cloned = cloneValue?.(valueToClone, keyToClone, objectToClone, stack);
|
|
112
|
-
if (cloned != null) {
|
|
113
|
-
return cloned;
|
|
114
|
-
}
|
|
115
|
-
if (isPrimitive(valueToClone)) {
|
|
116
|
-
return valueToClone;
|
|
117
|
-
}
|
|
118
|
-
if (stack.has(valueToClone)) {
|
|
119
|
-
return stack.get(valueToClone);
|
|
120
|
-
}
|
|
121
|
-
if (Array.isArray(valueToClone)) {
|
|
122
|
-
const result = new Array(valueToClone.length);
|
|
123
|
-
stack.set(valueToClone, result);
|
|
124
|
-
for (let i = 0; i < valueToClone.length; i++) {
|
|
125
|
-
result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
|
|
126
|
-
}
|
|
127
|
-
if (Object.hasOwn(valueToClone, 'index')) {
|
|
128
|
-
result.index = valueToClone.index;
|
|
129
|
-
}
|
|
130
|
-
if (Object.hasOwn(valueToClone, 'input')) {
|
|
131
|
-
result.input = valueToClone.input;
|
|
132
|
-
}
|
|
133
|
-
return result;
|
|
134
|
-
}
|
|
135
|
-
if (valueToClone instanceof Date) {
|
|
136
|
-
return new Date(valueToClone.getTime());
|
|
137
|
-
}
|
|
138
|
-
if (valueToClone instanceof RegExp) {
|
|
139
|
-
const result = new RegExp(valueToClone.source, valueToClone.flags);
|
|
140
|
-
result.lastIndex = valueToClone.lastIndex;
|
|
141
|
-
return result;
|
|
142
|
-
}
|
|
143
|
-
if (valueToClone instanceof Map) {
|
|
144
|
-
const result = new Map();
|
|
145
|
-
stack.set(valueToClone, result);
|
|
146
|
-
for (const [key, value] of valueToClone) {
|
|
147
|
-
result.set(key, cloneDeepWithImpl(value, key, objectToClone, stack, cloneValue));
|
|
148
|
-
}
|
|
149
|
-
return result;
|
|
150
|
-
}
|
|
151
|
-
if (valueToClone instanceof Set) {
|
|
152
|
-
const result = new Set();
|
|
153
|
-
stack.set(valueToClone, result);
|
|
154
|
-
for (const value of valueToClone) {
|
|
155
|
-
result.add(cloneDeepWithImpl(value, undefined, objectToClone, stack, cloneValue));
|
|
156
|
-
}
|
|
157
|
-
return result;
|
|
158
|
-
}
|
|
159
|
-
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(valueToClone)) {
|
|
160
|
-
return valueToClone.subarray();
|
|
161
|
-
}
|
|
162
|
-
if (isTypedArray(valueToClone)) {
|
|
163
|
-
const result = new (Object.getPrototypeOf(valueToClone).constructor)(valueToClone.length);
|
|
164
|
-
stack.set(valueToClone, result);
|
|
165
|
-
for (let i = 0; i < valueToClone.length; i++) {
|
|
166
|
-
result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
|
|
167
|
-
}
|
|
168
|
-
return result;
|
|
169
|
-
}
|
|
170
|
-
if (valueToClone instanceof ArrayBuffer ||
|
|
171
|
-
(typeof SharedArrayBuffer !== 'undefined' && valueToClone instanceof SharedArrayBuffer)) {
|
|
172
|
-
return valueToClone.slice(0);
|
|
173
|
-
}
|
|
174
|
-
if (valueToClone instanceof DataView) {
|
|
175
|
-
const result = new DataView(valueToClone.buffer.slice(0), valueToClone.byteOffset, valueToClone.byteLength);
|
|
176
|
-
stack.set(valueToClone, result);
|
|
177
|
-
copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
|
|
178
|
-
return result;
|
|
179
|
-
}
|
|
180
|
-
if (typeof File !== 'undefined' && valueToClone instanceof File) {
|
|
181
|
-
const result = new File([valueToClone], valueToClone.name, {
|
|
182
|
-
type: valueToClone.type,
|
|
183
|
-
});
|
|
184
|
-
stack.set(valueToClone, result);
|
|
185
|
-
copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
|
|
186
|
-
return result;
|
|
187
|
-
}
|
|
188
|
-
if (valueToClone instanceof Blob) {
|
|
189
|
-
const result = new Blob([valueToClone], { type: valueToClone.type });
|
|
190
|
-
stack.set(valueToClone, result);
|
|
191
|
-
copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
|
|
192
|
-
return result;
|
|
193
|
-
}
|
|
194
|
-
if (valueToClone instanceof Error) {
|
|
195
|
-
const result = new valueToClone.constructor();
|
|
196
|
-
stack.set(valueToClone, result);
|
|
197
|
-
result.message = valueToClone.message;
|
|
198
|
-
result.name = valueToClone.name;
|
|
199
|
-
result.stack = valueToClone.stack;
|
|
200
|
-
result.cause = valueToClone.cause;
|
|
201
|
-
copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
|
|
202
|
-
return result;
|
|
203
|
-
}
|
|
204
|
-
if (typeof valueToClone === 'object' && valueToClone !== null) {
|
|
205
|
-
const result = Object.create(Object.getPrototypeOf(valueToClone));
|
|
206
|
-
stack.set(valueToClone, result);
|
|
207
|
-
copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
|
|
208
|
-
return result;
|
|
209
|
-
}
|
|
210
|
-
return valueToClone;
|
|
211
|
-
}
|
|
212
|
-
function copyProperties(target, source, objectToClone = target, stack, cloneValue) {
|
|
213
|
-
const keys = [...Object.keys(source), ...getSymbols(source)];
|
|
214
|
-
for (let i = 0; i < keys.length; i++) {
|
|
215
|
-
const key = keys[i];
|
|
216
|
-
const descriptor = Object.getOwnPropertyDescriptor(target, key);
|
|
217
|
-
if (descriptor == null || descriptor.writable) {
|
|
218
|
-
target[key] = cloneDeepWithImpl(source[key], key, objectToClone, stack, cloneValue);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function cloneDeep(obj) {
|
|
224
|
-
return cloneDeepWithImpl(obj, undefined, obj, new Map(), undefined);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function mapValues(object, getNewValue) {
|
|
228
|
-
const result = {};
|
|
229
|
-
const keys = Object.keys(object);
|
|
230
|
-
for (let i = 0; i < keys.length; i++) {
|
|
231
|
-
const key = keys[i];
|
|
232
|
-
const value = object[key];
|
|
233
|
-
result[key] = getNewValue(value, key, object);
|
|
234
|
-
}
|
|
235
|
-
return result;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
function merge(target, source) {
|
|
239
|
-
const sourceKeys = Object.keys(source);
|
|
240
|
-
for (let i = 0; i < sourceKeys.length; i++) {
|
|
241
|
-
const key = sourceKeys[i];
|
|
242
|
-
const sourceValue = source[key];
|
|
243
|
-
const targetValue = target[key];
|
|
244
|
-
if (Array.isArray(sourceValue)) {
|
|
245
|
-
if (Array.isArray(targetValue)) {
|
|
246
|
-
target[key] = merge(targetValue, sourceValue);
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
target[key] = merge([], sourceValue);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
else if (isPlainObject$2(sourceValue)) {
|
|
253
|
-
if (isPlainObject$2(targetValue)) {
|
|
254
|
-
target[key] = merge(targetValue, sourceValue);
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
target[key] = merge({}, sourceValue);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
else if (targetValue === undefined || sourceValue !== undefined) {
|
|
261
|
-
target[key] = sourceValue;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
return target;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
102
|
function isObjectLike(value) {
|
|
268
103
|
return typeof value === 'object' && value !== null;
|
|
269
104
|
}
|
|
@@ -291,15 +126,6 @@ function mergeWith(target, source, merge) {
|
|
|
291
126
|
return target;
|
|
292
127
|
}
|
|
293
128
|
|
|
294
|
-
function omit(obj, keys) {
|
|
295
|
-
const result = { ...obj };
|
|
296
|
-
for (let i = 0; i < keys.length; i++) {
|
|
297
|
-
const key = keys[i];
|
|
298
|
-
delete result[key];
|
|
299
|
-
}
|
|
300
|
-
return result;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
129
|
function pickBy(obj, shouldPick) {
|
|
304
130
|
const result = {};
|
|
305
131
|
const keys = Object.keys(obj);
|
|
@@ -313,13 +139,9 @@ function pickBy(obj, shouldPick) {
|
|
|
313
139
|
return result;
|
|
314
140
|
}
|
|
315
141
|
|
|
316
|
-
function toMerged(target, source) {
|
|
317
|
-
return merge(cloneDeep(target), source);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
142
|
// adapted from https://github.com/AitoDotAI/json-stringify-pretty-compact
|
|
321
143
|
// allows { } to be presented as {} to better mirror prettier formatting
|
|
322
|
-
function isObject
|
|
144
|
+
function isObject(obj) {
|
|
323
145
|
return typeof obj === 'object' && obj !== null;
|
|
324
146
|
}
|
|
325
147
|
function forEach(obj, cb) {
|
|
@@ -327,7 +149,7 @@ function forEach(obj, cb) {
|
|
|
327
149
|
// eslint-disable-next-line unicorn/no-array-for-each
|
|
328
150
|
obj.forEach(cb);
|
|
329
151
|
}
|
|
330
|
-
else if (isObject
|
|
152
|
+
else if (isObject(obj)) {
|
|
331
153
|
for (const key of Object.keys(obj)) {
|
|
332
154
|
const val = obj[key];
|
|
333
155
|
cb(val, key);
|
|
@@ -336,9 +158,9 @@ function forEach(obj, cb) {
|
|
|
336
158
|
}
|
|
337
159
|
function getTreeDepth(obj) {
|
|
338
160
|
let depth = 0;
|
|
339
|
-
if (Array.isArray(obj) || isObject
|
|
161
|
+
if (Array.isArray(obj) || isObject(obj)) {
|
|
340
162
|
forEach(obj, (val) => {
|
|
341
|
-
if (Array.isArray(val) || isObject
|
|
163
|
+
if (Array.isArray(val) || isObject(val)) {
|
|
342
164
|
const tmpDepth = getTreeDepth(val);
|
|
343
165
|
if (tmpDepth > depth) {
|
|
344
166
|
depth = tmpDepth;
|
|
@@ -409,7 +231,7 @@ function stringifyPrettyCompact(rootObj, options = {}) {
|
|
|
409
231
|
return prettified;
|
|
410
232
|
}
|
|
411
233
|
}
|
|
412
|
-
if (isObject
|
|
234
|
+
if (isObject(obj)) {
|
|
413
235
|
const nextIndent = currentIndent + indent;
|
|
414
236
|
const items = [];
|
|
415
237
|
let delimiters;
|
|
@@ -1651,27 +1473,27 @@ function createPluginConfigImplementation() {
|
|
|
1651
1473
|
const schemas = new Map();
|
|
1652
1474
|
const migrationsMap = new Map();
|
|
1653
1475
|
return {
|
|
1654
|
-
registerSchema(
|
|
1655
|
-
if (schemas.has(
|
|
1656
|
-
throw new Error(`Schema for plugin ${
|
|
1476
|
+
registerSchema(pluginKey, schema) {
|
|
1477
|
+
if (schemas.has(pluginKey)) {
|
|
1478
|
+
throw new Error(`Schema for plugin ${pluginKey} is already registered`);
|
|
1657
1479
|
}
|
|
1658
|
-
schemas.set(
|
|
1480
|
+
schemas.set(pluginKey, schema);
|
|
1659
1481
|
},
|
|
1660
|
-
registerMigrations(
|
|
1661
|
-
if (migrationsMap.has(
|
|
1662
|
-
throw new Error(`Migrations for plugin ${
|
|
1482
|
+
registerMigrations(pluginKey, migrations) {
|
|
1483
|
+
if (migrationsMap.has(pluginKey)) {
|
|
1484
|
+
throw new Error(`Migrations for plugin ${pluginKey} are already registered`);
|
|
1663
1485
|
}
|
|
1664
1486
|
const sortedMigrations = sortAndValidateMigrations(migrations);
|
|
1665
|
-
migrationsMap.set(
|
|
1487
|
+
migrationsMap.set(pluginKey, sortedMigrations);
|
|
1666
1488
|
},
|
|
1667
|
-
getSchema(
|
|
1668
|
-
return schemas.get(
|
|
1489
|
+
getSchema(pluginKey) {
|
|
1490
|
+
return schemas.get(pluginKey);
|
|
1669
1491
|
},
|
|
1670
|
-
getMigrations(
|
|
1671
|
-
return migrationsMap.get(
|
|
1492
|
+
getMigrations(pluginKey) {
|
|
1493
|
+
return migrationsMap.get(pluginKey);
|
|
1672
1494
|
},
|
|
1673
|
-
getLastMigrationVersion(
|
|
1674
|
-
const migrations = migrationsMap.get(
|
|
1495
|
+
getLastMigrationVersion(pluginKey) {
|
|
1496
|
+
const migrations = migrationsMap.get(pluginKey);
|
|
1675
1497
|
return migrations?.[migrations.length - 1]?.version;
|
|
1676
1498
|
},
|
|
1677
1499
|
};
|
|
@@ -1696,7 +1518,7 @@ function runPluginMigrations(projectDefinition, pluginImplementationStore) {
|
|
|
1696
1518
|
setAutoFreeze(false);
|
|
1697
1519
|
return produce(projectDefinition, (draft) => {
|
|
1698
1520
|
for (const pluginDefinition of draft.plugins ?? []) {
|
|
1699
|
-
const pluginMigrations = pluginConfigService.getMigrations(pluginEntityType.
|
|
1521
|
+
const pluginMigrations = pluginConfigService.getMigrations(pluginEntityType.keyFromId(pluginDefinition.id));
|
|
1700
1522
|
const currentSchemaVersion = pluginDefinition.configSchemaVersion ?? -1;
|
|
1701
1523
|
if (!pluginMigrations)
|
|
1702
1524
|
continue;
|
|
@@ -2448,107 +2270,6 @@ const AppUtils = {
|
|
|
2448
2270
|
getBackendRelativePath,
|
|
2449
2271
|
};
|
|
2450
2272
|
|
|
2451
|
-
function isObject(value) {
|
|
2452
|
-
return value !== null && (typeof value === 'object' || typeof value === 'function');
|
|
2453
|
-
}
|
|
2454
|
-
|
|
2455
|
-
function isMatch(target, source) {
|
|
2456
|
-
if (source === target) {
|
|
2457
|
-
return true;
|
|
2458
|
-
}
|
|
2459
|
-
switch (typeof source) {
|
|
2460
|
-
case 'object': {
|
|
2461
|
-
if (source == null) {
|
|
2462
|
-
return true;
|
|
2463
|
-
}
|
|
2464
|
-
const keys = Object.keys(source);
|
|
2465
|
-
if (target == null) {
|
|
2466
|
-
return keys.length === 0;
|
|
2467
|
-
}
|
|
2468
|
-
if (Array.isArray(source)) {
|
|
2469
|
-
return isArrayMatch(target, source);
|
|
2470
|
-
}
|
|
2471
|
-
if (source instanceof Map) {
|
|
2472
|
-
return isMapMatch(target, source);
|
|
2473
|
-
}
|
|
2474
|
-
if (source instanceof Set) {
|
|
2475
|
-
return isSetMatch(target, source);
|
|
2476
|
-
}
|
|
2477
|
-
for (let i = 0; i < keys.length; i++) {
|
|
2478
|
-
const key = keys[i];
|
|
2479
|
-
if (!isPrimitive(target) && !(key in target)) {
|
|
2480
|
-
return false;
|
|
2481
|
-
}
|
|
2482
|
-
if (source[key] === undefined && target[key] !== undefined) {
|
|
2483
|
-
return false;
|
|
2484
|
-
}
|
|
2485
|
-
if (source[key] === null && target[key] !== null) {
|
|
2486
|
-
return false;
|
|
2487
|
-
}
|
|
2488
|
-
if (!isMatch(target[key], source[key])) {
|
|
2489
|
-
return false;
|
|
2490
|
-
}
|
|
2491
|
-
}
|
|
2492
|
-
return true;
|
|
2493
|
-
}
|
|
2494
|
-
case 'function': {
|
|
2495
|
-
if (Object.keys(source).length > 0) {
|
|
2496
|
-
return isMatch(target, { ...source });
|
|
2497
|
-
}
|
|
2498
|
-
return false;
|
|
2499
|
-
}
|
|
2500
|
-
default: {
|
|
2501
|
-
if (!isObject(target)) {
|
|
2502
|
-
return eq(target, source);
|
|
2503
|
-
}
|
|
2504
|
-
return !source;
|
|
2505
|
-
}
|
|
2506
|
-
}
|
|
2507
|
-
}
|
|
2508
|
-
function isMapMatch(target, source) {
|
|
2509
|
-
if (source.size === 0) {
|
|
2510
|
-
return true;
|
|
2511
|
-
}
|
|
2512
|
-
if (!(target instanceof Map)) {
|
|
2513
|
-
return false;
|
|
2514
|
-
}
|
|
2515
|
-
for (const [key, value] of source.entries()) {
|
|
2516
|
-
if (!isMatch(target.get(key), value)) {
|
|
2517
|
-
return false;
|
|
2518
|
-
}
|
|
2519
|
-
}
|
|
2520
|
-
return true;
|
|
2521
|
-
}
|
|
2522
|
-
function isArrayMatch(target, source) {
|
|
2523
|
-
if (source.length === 0) {
|
|
2524
|
-
return true;
|
|
2525
|
-
}
|
|
2526
|
-
if (!Array.isArray(target)) {
|
|
2527
|
-
return false;
|
|
2528
|
-
}
|
|
2529
|
-
const countedIndex = new Set();
|
|
2530
|
-
for (let i = 0; i < source.length; i++) {
|
|
2531
|
-
const sourceItem = source[i];
|
|
2532
|
-
const index = target.findIndex((targetItem, index) => {
|
|
2533
|
-
return isMatch(targetItem, sourceItem) && !countedIndex.has(index);
|
|
2534
|
-
});
|
|
2535
|
-
if (index === -1) {
|
|
2536
|
-
return false;
|
|
2537
|
-
}
|
|
2538
|
-
countedIndex.add(index);
|
|
2539
|
-
}
|
|
2540
|
-
return true;
|
|
2541
|
-
}
|
|
2542
|
-
function isSetMatch(target, source) {
|
|
2543
|
-
if (source.size === 0) {
|
|
2544
|
-
return true;
|
|
2545
|
-
}
|
|
2546
|
-
if (!(target instanceof Set)) {
|
|
2547
|
-
return false;
|
|
2548
|
-
}
|
|
2549
|
-
return isArrayMatch([...target], [...source]);
|
|
2550
|
-
}
|
|
2551
|
-
|
|
2552
2273
|
/**
|
|
2553
2274
|
* Resolves entity names in a ZodRefPayload.
|
|
2554
2275
|
*
|
|
@@ -2847,7 +2568,7 @@ const palettesSchema = z$i.object({
|
|
|
2847
2568
|
base: paletteSchema,
|
|
2848
2569
|
primary: paletteSchema,
|
|
2849
2570
|
});
|
|
2850
|
-
const
|
|
2571
|
+
const createThemeSchema = definitionSchema(() => z$i.object({
|
|
2851
2572
|
palettes: z$i.object({
|
|
2852
2573
|
base: paletteSchema,
|
|
2853
2574
|
primary: paletteSchema,
|
|
@@ -2856,7 +2577,7 @@ const themeSchema = z$i.object({
|
|
|
2856
2577
|
light: themeColorSchema,
|
|
2857
2578
|
dark: themeColorSchema,
|
|
2858
2579
|
}),
|
|
2859
|
-
});
|
|
2580
|
+
}));
|
|
2860
2581
|
|
|
2861
2582
|
const {z: z$h} = await importShared('zod');
|
|
2862
2583
|
|
|
@@ -2877,19 +2598,6 @@ const VALIDATORS = {
|
|
|
2877
2598
|
.optional(),
|
|
2878
2599
|
};
|
|
2879
2600
|
|
|
2880
|
-
const modelEntityType = createEntityType('model');
|
|
2881
|
-
const modelScalarFieldEntityType = createEntityType('model-scalar-field', {
|
|
2882
|
-
parentType: modelEntityType,
|
|
2883
|
-
});
|
|
2884
|
-
const modelLocalRelationEntityType = createEntityType('model-local-relation', { parentType: modelEntityType });
|
|
2885
|
-
const modelForeignRelationEntityType = createEntityType('model-foreign-relation', { parentType: modelEntityType });
|
|
2886
|
-
const modelUniqueConstraintEntityType = createEntityType('model-unique-constraint', { parentType: modelEntityType });
|
|
2887
|
-
const modelTransformerEntityType = createEntityType('model-transformer', { parentType: modelEntityType });
|
|
2888
|
-
const modelEnumEntityType = createEntityType('model-enum');
|
|
2889
|
-
const modelEnumValueEntityType = createEntityType('model-enum-value', {
|
|
2890
|
-
parentType: modelEnumEntityType,
|
|
2891
|
-
});
|
|
2892
|
-
|
|
2893
2601
|
const {z: z$g} = await importShared('zod');
|
|
2894
2602
|
const roleArray = z$g
|
|
2895
2603
|
.array(zRef(z$g.string(), {
|
|
@@ -2897,7 +2605,7 @@ const roleArray = z$g
|
|
|
2897
2605
|
onDelete: 'DELETE',
|
|
2898
2606
|
}))
|
|
2899
2607
|
.optional();
|
|
2900
|
-
const
|
|
2608
|
+
const createModelGraphqlSchema = definitionSchema(() => z$g.object({
|
|
2901
2609
|
objectType: z$g
|
|
2902
2610
|
.object({
|
|
2903
2611
|
enabled: z$g.boolean().default(false),
|
|
@@ -2981,7 +2689,7 @@ const modelGraphqlSchema = z$g.object({
|
|
|
2981
2689
|
}),
|
|
2982
2690
|
})
|
|
2983
2691
|
.default({}),
|
|
2984
|
-
});
|
|
2692
|
+
}));
|
|
2985
2693
|
|
|
2986
2694
|
const {z: z$f} = await importShared('zod');
|
|
2987
2695
|
|
|
@@ -2997,15 +2705,15 @@ function createModelTransformerType(payload) {
|
|
|
2997
2705
|
}
|
|
2998
2706
|
|
|
2999
2707
|
const {z: z$e} = await importShared('zod');
|
|
3000
|
-
const
|
|
2708
|
+
const createPasswordTransformerSchema = definitionSchema(() => zEnt(z$e.object({
|
|
3001
2709
|
...baseTransformerFields,
|
|
3002
2710
|
type: z$e.literal('password'),
|
|
3003
2711
|
}), {
|
|
3004
2712
|
type: modelTransformerEntityType,
|
|
3005
2713
|
parentPath: { context: 'model' },
|
|
3006
2714
|
getNameResolver: () => 'password',
|
|
3007
|
-
});
|
|
3008
|
-
const
|
|
2715
|
+
}));
|
|
2716
|
+
const createEmbeddedRelationTransformerSchema = definitionSchema(() => zEnt(z$e.object({
|
|
3009
2717
|
...baseTransformerFields,
|
|
3010
2718
|
foreignRelationRef: zRef(z$e.string().min(1), {
|
|
3011
2719
|
type: modelForeignRelationEntityType,
|
|
@@ -3038,16 +2746,16 @@ const embeddedRelationTransformerSchema = zEnt(z$e.object({
|
|
|
3038
2746
|
}),
|
|
3039
2747
|
}).refBuilder((builder) => {
|
|
3040
2748
|
builder.addPathToContext('modelRef', modelEntityType, 'embeddedModel');
|
|
3041
|
-
});
|
|
2749
|
+
}));
|
|
3042
2750
|
const BUILT_IN_TRANSFORMERS = [
|
|
3043
2751
|
createModelTransformerType({
|
|
3044
2752
|
name: 'password',
|
|
3045
|
-
schema:
|
|
2753
|
+
schema: createPasswordTransformerSchema,
|
|
3046
2754
|
getName: () => 'Password',
|
|
3047
2755
|
}),
|
|
3048
2756
|
createModelTransformerType({
|
|
3049
2757
|
name: 'embeddedRelation',
|
|
3050
|
-
schema:
|
|
2758
|
+
schema: createEmbeddedRelationTransformerSchema,
|
|
3051
2759
|
getName: (definitionContainer, definition) => definitionContainer.nameFromId(definition.foreignRelationRef),
|
|
3052
2760
|
}),
|
|
3053
2761
|
];
|
|
@@ -3063,10 +2771,6 @@ function createModelTransformerImplementation() {
|
|
|
3063
2771
|
if (transformers[transformer.name]) {
|
|
3064
2772
|
throw new Error(`Model transformer with name ${transformer.name} is already registered`);
|
|
3065
2773
|
}
|
|
3066
|
-
// check transformer schema is a zEnt
|
|
3067
|
-
if (!(transformer.schema instanceof ZodRef)) {
|
|
3068
|
-
throw new TypeError(`Model transformer schema for ${transformer.name} is not a zEnt`);
|
|
3069
|
-
}
|
|
3070
2774
|
transformers[transformer.name] =
|
|
3071
2775
|
transformer;
|
|
3072
2776
|
},
|
|
@@ -3089,38 +2793,38 @@ const modelTransformerSpec = createPluginSpec('core/model-transformer', {
|
|
|
3089
2793
|
defaultInitializer: createModelTransformerImplementation,
|
|
3090
2794
|
});
|
|
3091
2795
|
|
|
3092
|
-
const
|
|
2796
|
+
const createTransformerSchema = definitionSchema((ctx) => zWithPlugins((plugins, data) => {
|
|
3093
2797
|
const { type } = baseTransformerSchema.parse(data);
|
|
3094
2798
|
const transformer = plugins
|
|
3095
2799
|
.getPluginSpec(modelTransformerSpec)
|
|
3096
2800
|
.getModelTransformer(type);
|
|
3097
|
-
return transformer.schema;
|
|
3098
|
-
});
|
|
2801
|
+
return transformer.schema(ctx);
|
|
2802
|
+
}));
|
|
3099
2803
|
|
|
3100
2804
|
const {z: z$d} = await importShared('zod');
|
|
3101
|
-
const
|
|
2805
|
+
const createEnumValueSchema = definitionSchema(() => zEnt(z$d.object({
|
|
3102
2806
|
name: z$d.string().min(1),
|
|
3103
2807
|
friendlyName: z$d.string().min(1),
|
|
3104
2808
|
}), {
|
|
3105
2809
|
type: modelEnumValueEntityType,
|
|
3106
2810
|
parentPath: { context: 'enum' },
|
|
3107
|
-
});
|
|
3108
|
-
const
|
|
2811
|
+
}));
|
|
2812
|
+
const createEnumBaseSchema = definitionSchema((ctx) => z$d.object({
|
|
3109
2813
|
name: z$d.string().min(1),
|
|
3110
2814
|
featureRef: zRef(z$d.string().min(1), {
|
|
3111
2815
|
type: featureEntityType,
|
|
3112
2816
|
onDelete: 'RESTRICT',
|
|
3113
2817
|
}),
|
|
3114
|
-
values: z$d.array(
|
|
2818
|
+
values: z$d.array(createEnumValueSchema(ctx)),
|
|
3115
2819
|
isExposed: z$d.boolean(),
|
|
3116
|
-
});
|
|
3117
|
-
const
|
|
2820
|
+
}));
|
|
2821
|
+
const createEnumSchema = definitionSchema((ctx) => zEnt(createEnumBaseSchema(ctx), {
|
|
3118
2822
|
type: modelEnumEntityType,
|
|
3119
2823
|
addContext: 'enum',
|
|
3120
|
-
});
|
|
2824
|
+
}));
|
|
3121
2825
|
|
|
3122
2826
|
const {z: z$c} = await importShared('zod');
|
|
3123
|
-
const
|
|
2827
|
+
const createModelScalarFieldSchema = definitionSchema(() => zEnt(z$c.object({
|
|
3124
2828
|
name: VALIDATORS.CAMEL_CASE_STRING,
|
|
3125
2829
|
type: z$c.enum(SCALAR_FIELD_TYPES),
|
|
3126
2830
|
isOptional: z$c.boolean().default(false),
|
|
@@ -3182,7 +2886,7 @@ const modelScalarFieldSchema = zEnt(z$c.object({
|
|
|
3182
2886
|
};
|
|
3183
2887
|
}
|
|
3184
2888
|
return value;
|
|
3185
|
-
});
|
|
2889
|
+
}));
|
|
3186
2890
|
const REFERENTIAL_ACTIONS = [
|
|
3187
2891
|
'Cascade',
|
|
3188
2892
|
'Restrict',
|
|
@@ -3190,7 +2894,7 @@ const REFERENTIAL_ACTIONS = [
|
|
|
3190
2894
|
'SetNull',
|
|
3191
2895
|
'SetDefault',
|
|
3192
2896
|
];
|
|
3193
|
-
const
|
|
2897
|
+
const createModelRelationFieldSchema = definitionSchema(() => zRefBuilder(z$c.object({
|
|
3194
2898
|
id: zRefId,
|
|
3195
2899
|
foreignId: z$c
|
|
3196
2900
|
.string()
|
|
@@ -3229,8 +2933,8 @@ const modelRelationFieldSchema = zRefBuilder(z$c.object({
|
|
|
3229
2933
|
getNameResolver: (entity) => entity.foreignRelationName,
|
|
3230
2934
|
parentPath: 'modelRef',
|
|
3231
2935
|
});
|
|
3232
|
-
});
|
|
3233
|
-
const
|
|
2936
|
+
}));
|
|
2937
|
+
const createModelUniqueConstraintSchema = definitionSchema(() => zEnt(z$c.object({
|
|
3234
2938
|
fields: z$c.array(z$c.object({
|
|
3235
2939
|
fieldRef: zRef(z$c.string().min(1), {
|
|
3236
2940
|
type: modelScalarFieldEntityType,
|
|
@@ -3247,8 +2951,8 @@ const modelUniqueConstraintSchema = zEnt(z$c.object({
|
|
|
3247
2951
|
resolveName: (entityNames) => entityNames.fields.join('_'),
|
|
3248
2952
|
});
|
|
3249
2953
|
},
|
|
3250
|
-
});
|
|
3251
|
-
const
|
|
2954
|
+
}));
|
|
2955
|
+
const createModelServiceSchema = definitionSchema((ctx) => z$c.object({
|
|
3252
2956
|
create: z$c
|
|
3253
2957
|
.object({
|
|
3254
2958
|
enabled: z$c.boolean().default(false),
|
|
@@ -3294,9 +2998,9 @@ const modelServiceSchema = z$c.object({
|
|
|
3294
2998
|
.default({
|
|
3295
2999
|
enabled: false,
|
|
3296
3000
|
}),
|
|
3297
|
-
transformers: z$c.array(
|
|
3298
|
-
});
|
|
3299
|
-
const
|
|
3001
|
+
transformers: z$c.array(createTransformerSchema(ctx)).default([]),
|
|
3002
|
+
}));
|
|
3003
|
+
const createModelBaseSchema = definitionSchema((ctx) => z$c.object({
|
|
3300
3004
|
id: zRefId,
|
|
3301
3005
|
name: VALIDATORS.PASCAL_CASE_STRING,
|
|
3302
3006
|
featureRef: zRef(z$c.string().min(1), {
|
|
@@ -3304,8 +3008,8 @@ const modelBaseSchema = z$c.object({
|
|
|
3304
3008
|
onDelete: 'RESTRICT',
|
|
3305
3009
|
}),
|
|
3306
3010
|
model: z$c.object({
|
|
3307
|
-
fields: z$c.array(
|
|
3308
|
-
relations: z$c.array(
|
|
3011
|
+
fields: z$c.array(createModelScalarFieldSchema(ctx)),
|
|
3012
|
+
relations: z$c.array(createModelRelationFieldSchema(ctx)).optional(),
|
|
3309
3013
|
primaryKeyFieldRefs: z$c
|
|
3310
3014
|
.array(zRef(z$c.string(), {
|
|
3311
3015
|
type: modelScalarFieldEntityType,
|
|
@@ -3313,20 +3017,22 @@ const modelBaseSchema = z$c.object({
|
|
|
3313
3017
|
parentPath: { context: 'model' },
|
|
3314
3018
|
}))
|
|
3315
3019
|
.min(1),
|
|
3316
|
-
uniqueConstraints: z$c
|
|
3020
|
+
uniqueConstraints: z$c
|
|
3021
|
+
.array(createModelUniqueConstraintSchema(ctx))
|
|
3022
|
+
.optional(),
|
|
3317
3023
|
}),
|
|
3318
|
-
service:
|
|
3024
|
+
service: createModelServiceSchema(ctx).default({
|
|
3319
3025
|
create: { enabled: false },
|
|
3320
3026
|
update: { enabled: false },
|
|
3321
3027
|
delete: { enabled: false },
|
|
3322
3028
|
transformers: [],
|
|
3323
3029
|
}),
|
|
3324
|
-
graphql:
|
|
3325
|
-
});
|
|
3326
|
-
const
|
|
3030
|
+
graphql: createModelGraphqlSchema(ctx).optional(),
|
|
3031
|
+
}));
|
|
3032
|
+
const createModelSchema = definitionSchema((ctx) => zEnt(createModelBaseSchema(ctx), {
|
|
3327
3033
|
type: modelEntityType,
|
|
3328
3034
|
addContext: 'model',
|
|
3329
|
-
});
|
|
3035
|
+
}));
|
|
3330
3036
|
|
|
3331
3037
|
const adminSectionEntityType = createEntityType('admin-section', {
|
|
3332
3038
|
parentType: appEntityType,
|
|
@@ -3357,7 +3063,7 @@ const adminCrudEmbeddedFormEntityType = createEntityType('admin-crud-embedded-fo
|
|
|
3357
3063
|
});
|
|
3358
3064
|
|
|
3359
3065
|
const {z: z$9} = await importShared('zod');
|
|
3360
|
-
const
|
|
3066
|
+
const createAdminCrudTextInputSchema = definitionSchema(() => z$9.object({
|
|
3361
3067
|
type: z$9.literal('text'),
|
|
3362
3068
|
label: z$9.string().min(1),
|
|
3363
3069
|
modelFieldRef: zRef(z$9.string(), {
|
|
@@ -3366,12 +3072,12 @@ const adminCrudTextInputSchema = z$9.object({
|
|
|
3366
3072
|
parentPath: { context: 'model' },
|
|
3367
3073
|
}),
|
|
3368
3074
|
validation: z$9.string().optional(),
|
|
3369
|
-
});
|
|
3075
|
+
}));
|
|
3370
3076
|
const adminCrudTextInputType = createAdminCrudInputType({
|
|
3371
3077
|
name: 'text',
|
|
3372
|
-
schema:
|
|
3078
|
+
schema: createAdminCrudTextInputSchema,
|
|
3373
3079
|
});
|
|
3374
|
-
const
|
|
3080
|
+
const createAdminCrudForeignInputSchema = definitionSchema(() => z$9.object({
|
|
3375
3081
|
type: z$9.literal('foreign'),
|
|
3376
3082
|
label: z$9.string().min(1),
|
|
3377
3083
|
localRelationRef: zRef(z$9.string(), {
|
|
@@ -3383,12 +3089,12 @@ const adminCrudForeignInputSchema = z$9.object({
|
|
|
3383
3089
|
valueExpression: z$9.string().min(1),
|
|
3384
3090
|
defaultLabel: z$9.string().optional(),
|
|
3385
3091
|
nullLabel: z$9.string().optional(),
|
|
3386
|
-
});
|
|
3092
|
+
}));
|
|
3387
3093
|
const adminCrudForeignInputType = createAdminCrudInputType({
|
|
3388
3094
|
name: 'foreign',
|
|
3389
|
-
schema:
|
|
3095
|
+
schema: createAdminCrudForeignInputSchema,
|
|
3390
3096
|
});
|
|
3391
|
-
const
|
|
3097
|
+
const createAdminCrudEnumInputSchema = definitionSchema(() => z$9.object({
|
|
3392
3098
|
type: z$9.literal('enum'),
|
|
3393
3099
|
label: z$9.string().min(1),
|
|
3394
3100
|
modelFieldRef: zRef(z$9.string(), {
|
|
@@ -3396,12 +3102,12 @@ const adminCrudEnumInputSchema = z$9.object({
|
|
|
3396
3102
|
onDelete: 'RESTRICT',
|
|
3397
3103
|
parentPath: { context: 'model' },
|
|
3398
3104
|
}),
|
|
3399
|
-
});
|
|
3105
|
+
}));
|
|
3400
3106
|
const adminCrudEnumInputType = createAdminCrudInputType({
|
|
3401
3107
|
name: 'enum',
|
|
3402
|
-
schema:
|
|
3108
|
+
schema: createAdminCrudEnumInputSchema,
|
|
3403
3109
|
});
|
|
3404
|
-
const
|
|
3110
|
+
const createAdminCrudEmbeddedInputSchema = definitionSchema(() => z$9.object({
|
|
3405
3111
|
type: z$9.literal('embedded'),
|
|
3406
3112
|
label: z$9.string().min(1),
|
|
3407
3113
|
modelRelationRef: zRef(z$9.string(), {
|
|
@@ -3414,12 +3120,12 @@ const adminCrudEmbeddedInputSchema = z$9.object({
|
|
|
3414
3120
|
parentPath: { context: 'admin-section' },
|
|
3415
3121
|
onDelete: 'RESTRICT',
|
|
3416
3122
|
}),
|
|
3417
|
-
});
|
|
3123
|
+
}));
|
|
3418
3124
|
const adminCrudEmbeddedInputType = createAdminCrudInputType({
|
|
3419
3125
|
name: 'embedded',
|
|
3420
|
-
schema:
|
|
3126
|
+
schema: createAdminCrudEmbeddedInputSchema,
|
|
3421
3127
|
});
|
|
3422
|
-
const
|
|
3128
|
+
const createAdminCrudEmbeddedLocalInputSchema = definitionSchema(() => z$9.object({
|
|
3423
3129
|
type: z$9.literal('embeddedLocal'),
|
|
3424
3130
|
label: z$9.string().min(1),
|
|
3425
3131
|
localRelationRef: zRef(z$9.string(), {
|
|
@@ -3432,18 +3138,18 @@ const adminCrudEmbeddedLocalInputSchema = z$9.object({
|
|
|
3432
3138
|
parentPath: { context: 'admin-section' },
|
|
3433
3139
|
onDelete: 'RESTRICT',
|
|
3434
3140
|
}),
|
|
3435
|
-
});
|
|
3141
|
+
}));
|
|
3436
3142
|
const adminCrudEmbeddedLocalInputType = createAdminCrudInputType({
|
|
3437
3143
|
name: 'embeddedLocal',
|
|
3438
|
-
schema:
|
|
3144
|
+
schema: createAdminCrudEmbeddedLocalInputSchema,
|
|
3439
3145
|
});
|
|
3440
|
-
const
|
|
3146
|
+
const createAdminCrudPasswordInputSchema = definitionSchema(() => z$9.object({
|
|
3441
3147
|
type: z$9.literal('password'),
|
|
3442
3148
|
label: z$9.string().min(1),
|
|
3443
|
-
});
|
|
3149
|
+
}));
|
|
3444
3150
|
const adminCrudPasswordInputType = createAdminCrudInputType({
|
|
3445
3151
|
name: 'password',
|
|
3446
|
-
schema:
|
|
3152
|
+
schema: createAdminCrudPasswordInputSchema,
|
|
3447
3153
|
});
|
|
3448
3154
|
const BUILT_IN_ADMIN_CRUD_INPUTS = [
|
|
3449
3155
|
adminCrudTextInputType,
|
|
@@ -3482,17 +3188,17 @@ const adminCrudInputSpec = createPluginSpec('core/admin-crud-input', {
|
|
|
3482
3188
|
defaultInitializer: createAdminCrudInputImplementation,
|
|
3483
3189
|
});
|
|
3484
3190
|
|
|
3485
|
-
const
|
|
3191
|
+
const createAdminCrudInputSchema = definitionSchema((ctx) => zWithPlugins((plugins, data) => {
|
|
3486
3192
|
const { type } = baseAdminCrudInputSchema.parse(data);
|
|
3487
3193
|
const input = plugins
|
|
3488
3194
|
.getPluginSpec(adminCrudInputSpec)
|
|
3489
3195
|
.getAdminCrudInput(type);
|
|
3490
|
-
return input.schema;
|
|
3491
|
-
});
|
|
3196
|
+
return input.schema(ctx);
|
|
3197
|
+
}));
|
|
3492
3198
|
|
|
3493
3199
|
const {z: z$8} = await importShared('zod');
|
|
3494
3200
|
// Table Columns
|
|
3495
|
-
const
|
|
3201
|
+
const createAdminCrudForeignDisplaySchema = definitionSchema(() => z$8.object({
|
|
3496
3202
|
type: z$8.literal('foreign'),
|
|
3497
3203
|
localRelationRef: zRef(z$8.string(), {
|
|
3498
3204
|
type: modelLocalRelationEntityType,
|
|
@@ -3501,31 +3207,27 @@ const adminCrudForeignDisplaySchema = z$8.object({
|
|
|
3501
3207
|
}),
|
|
3502
3208
|
labelExpression: z$8.string().min(1),
|
|
3503
3209
|
valueExpression: z$8.string().min(1),
|
|
3504
|
-
});
|
|
3505
|
-
const
|
|
3210
|
+
}));
|
|
3211
|
+
const createAdminCrudTextDisplaySchema = definitionSchema(() => z$8.object({
|
|
3506
3212
|
type: z$8.literal('text'),
|
|
3507
3213
|
modelFieldRef: zRef(z$8.string(), {
|
|
3508
3214
|
type: modelScalarFieldEntityType,
|
|
3509
3215
|
onDelete: 'RESTRICT',
|
|
3510
3216
|
parentPath: { context: 'model' },
|
|
3511
3217
|
}),
|
|
3512
|
-
});
|
|
3513
|
-
const
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
]);
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
.filter((x) => x !== undefined);
|
|
3521
|
-
}
|
|
3522
|
-
const adminCrudDisplayTypes = primitiveMapToKeys(adminCrudDisplaySchema.optionsMap);
|
|
3523
|
-
const adminCrudTableColumnSchema = z$8.object({
|
|
3218
|
+
}));
|
|
3219
|
+
const createAdminCrudDisplaySchema = definitionSchema((ctx) => z$8.discriminatedUnion('type', [
|
|
3220
|
+
createAdminCrudTextDisplaySchema(ctx),
|
|
3221
|
+
createAdminCrudForeignDisplaySchema(ctx),
|
|
3222
|
+
]));
|
|
3223
|
+
// TODO: Improve this to be more dynamic in the future
|
|
3224
|
+
const adminCrudDisplayTypes = ['text', 'foreign'];
|
|
3225
|
+
const createAdminCrudTableColumnSchema = definitionSchema((ctx) => z$8.object({
|
|
3524
3226
|
label: z$8.string().min(1),
|
|
3525
|
-
display:
|
|
3526
|
-
});
|
|
3227
|
+
display: createAdminCrudDisplaySchema(ctx),
|
|
3228
|
+
}));
|
|
3527
3229
|
// Embedded Crud
|
|
3528
|
-
const
|
|
3230
|
+
const createAdminCrudEmbeddedObjectSchema = definitionSchema((ctx) => z$8.object({
|
|
3529
3231
|
id: z$8.string().min(1),
|
|
3530
3232
|
name: z$8.string().min(1),
|
|
3531
3233
|
modelRef: zRef(z$8.string().min(1), {
|
|
@@ -3535,10 +3237,10 @@ const adminCrudEmbeddedObjectSchema = z$8.object({
|
|
|
3535
3237
|
includeIdField: z$8.boolean().optional(),
|
|
3536
3238
|
type: z$8.literal('object'),
|
|
3537
3239
|
form: z$8.object({
|
|
3538
|
-
fields: z$8.array(
|
|
3240
|
+
fields: z$8.array(createAdminCrudInputSchema(ctx)),
|
|
3539
3241
|
}),
|
|
3540
|
-
});
|
|
3541
|
-
const
|
|
3242
|
+
}));
|
|
3243
|
+
const createAdminCrudEmbeddedListSchema = definitionSchema((ctx) => z$8.object({
|
|
3542
3244
|
id: z$8.string().min(1),
|
|
3543
3245
|
name: z$8.string().min(1),
|
|
3544
3246
|
modelRef: zRef(z$8.string().min(1), {
|
|
@@ -3550,24 +3252,24 @@ const adminCrudEmbeddedListSchema = z$8.object({
|
|
|
3550
3252
|
// NOTE: These two fields need to be synced with crud section schema
|
|
3551
3253
|
// because the web app expects that (TODO)
|
|
3552
3254
|
table: z$8.object({
|
|
3553
|
-
columns: z$8.array(
|
|
3255
|
+
columns: z$8.array(createAdminCrudTableColumnSchema(ctx)),
|
|
3554
3256
|
}),
|
|
3555
3257
|
form: z$8.object({
|
|
3556
|
-
fields: z$8.array(
|
|
3258
|
+
fields: z$8.array(createAdminCrudInputSchema(ctx)),
|
|
3557
3259
|
}),
|
|
3558
|
-
});
|
|
3559
|
-
const
|
|
3560
|
-
|
|
3561
|
-
|
|
3260
|
+
}));
|
|
3261
|
+
const createAdminCrudEmbeddedFormSchema = definitionSchema((ctx) => zRefBuilder(z$8.discriminatedUnion('type', [
|
|
3262
|
+
createAdminCrudEmbeddedObjectSchema(ctx),
|
|
3263
|
+
createAdminCrudEmbeddedListSchema(ctx),
|
|
3562
3264
|
]), (builder) => {
|
|
3563
3265
|
builder.addEntity({
|
|
3564
3266
|
type: adminCrudEmbeddedFormEntityType,
|
|
3565
3267
|
parentPath: { context: 'admin-section' },
|
|
3566
3268
|
});
|
|
3567
3269
|
builder.addPathToContext('modelRef', modelEntityType, 'model');
|
|
3568
|
-
});
|
|
3270
|
+
}));
|
|
3569
3271
|
// Admin Section
|
|
3570
|
-
const
|
|
3272
|
+
const createAdminCrudSectionSchema = definitionSchema((ctx) => zRefBuilder(z$8.object({
|
|
3571
3273
|
...baseAdminSectionValidators,
|
|
3572
3274
|
type: z$8.literal('crud'),
|
|
3573
3275
|
modelRef: zRef(z$8.string().min(1), {
|
|
@@ -3576,25 +3278,25 @@ const adminCrudSectionSchema = zRefBuilder(z$8.object({
|
|
|
3576
3278
|
}),
|
|
3577
3279
|
disableCreate: z$8.boolean().optional(),
|
|
3578
3280
|
table: z$8.object({
|
|
3579
|
-
columns: z$8.array(
|
|
3281
|
+
columns: z$8.array(createAdminCrudTableColumnSchema(ctx)),
|
|
3580
3282
|
}),
|
|
3581
3283
|
form: z$8.object({
|
|
3582
|
-
fields: z$8.array(
|
|
3284
|
+
fields: z$8.array(createAdminCrudInputSchema(ctx)),
|
|
3583
3285
|
}),
|
|
3584
|
-
embeddedForms: z$8.array(
|
|
3286
|
+
embeddedForms: z$8.array(createAdminCrudEmbeddedFormSchema(ctx)).optional(),
|
|
3585
3287
|
}), (builder) => {
|
|
3586
3288
|
builder.addPathToContext('modelRef', modelEntityType, 'model');
|
|
3587
|
-
});
|
|
3289
|
+
}));
|
|
3588
3290
|
|
|
3589
3291
|
const {z: z$7} = await importShared('zod');
|
|
3590
|
-
const
|
|
3292
|
+
const createAdminSectionSchema = definitionSchema((ctx) => zRefBuilder(createAdminCrudSectionSchema(ctx), (builder) => {
|
|
3591
3293
|
builder.addEntity({
|
|
3592
3294
|
type: adminSectionEntityType,
|
|
3593
3295
|
parentPath: { context: 'app' },
|
|
3594
3296
|
addContext: 'admin-section',
|
|
3595
3297
|
});
|
|
3596
|
-
});
|
|
3597
|
-
const
|
|
3298
|
+
}));
|
|
3299
|
+
const createAdminAppSchema = definitionSchema((ctx) => z$7.object({
|
|
3598
3300
|
...baseAppValidators,
|
|
3599
3301
|
type: z$7.literal('admin'),
|
|
3600
3302
|
allowedRoles: z$7
|
|
@@ -3603,12 +3305,12 @@ const adminAppSchema = z$7.object({
|
|
|
3603
3305
|
onDelete: 'DELETE',
|
|
3604
3306
|
}))
|
|
3605
3307
|
.optional(),
|
|
3606
|
-
sections: z$7.array(
|
|
3607
|
-
});
|
|
3308
|
+
sections: z$7.array(createAdminSectionSchema(ctx)).optional(),
|
|
3309
|
+
}));
|
|
3608
3310
|
const adminAppEntryType = createAppEntryType('admin');
|
|
3609
3311
|
|
|
3610
3312
|
const {z: z$6} = await importShared('zod');
|
|
3611
|
-
const
|
|
3313
|
+
const createBackendAppSchema = definitionSchema(() => z$6.object({
|
|
3612
3314
|
...baseAppValidators,
|
|
3613
3315
|
type: z$6.literal('backend'),
|
|
3614
3316
|
enableStripe: z$6.boolean().optional(),
|
|
@@ -3617,11 +3319,11 @@ const backendAppSchema = z$6.object({
|
|
|
3617
3319
|
enablePostmark: z$6.boolean().optional(),
|
|
3618
3320
|
enableSubscriptions: z$6.boolean().optional(),
|
|
3619
3321
|
enableAxios: z$6.boolean().optional(),
|
|
3620
|
-
});
|
|
3322
|
+
}));
|
|
3621
3323
|
const backendAppEntryType = createAppEntryType('backend');
|
|
3622
3324
|
|
|
3623
3325
|
const {z: z$5} = await importShared('zod');
|
|
3624
|
-
const
|
|
3326
|
+
const createWebAppSchema = definitionSchema(() => z$5.object({
|
|
3625
3327
|
...baseAppValidators,
|
|
3626
3328
|
type: z$5.literal('web'),
|
|
3627
3329
|
includeAuth: z$5.boolean().optional(),
|
|
@@ -3635,41 +3337,38 @@ const webAppSchema = z$5.object({
|
|
|
3635
3337
|
.optional(),
|
|
3636
3338
|
includeUploadComponents: z$5.boolean().optional(),
|
|
3637
3339
|
enableSubscriptions: z$5.boolean().optional(),
|
|
3638
|
-
});
|
|
3340
|
+
}));
|
|
3639
3341
|
const webAppEntryType = createAppEntryType('web');
|
|
3640
3342
|
|
|
3641
|
-
function definitionSchema(creator) {
|
|
3642
|
-
return (options) => creator(options);
|
|
3643
|
-
}
|
|
3644
|
-
|
|
3645
3343
|
const {z: z$4} = await importShared('zod');
|
|
3646
|
-
const basePluginDefinitionSchema =
|
|
3344
|
+
const basePluginDefinitionSchema = z$4.object({
|
|
3345
|
+
id: z$4.string().min(1),
|
|
3647
3346
|
packageName: z$4.string(),
|
|
3648
3347
|
name: z$4.string(),
|
|
3649
3348
|
version: z$4.string(),
|
|
3650
3349
|
config: z$4.unknown(),
|
|
3651
3350
|
configSchemaVersion: z$4.number().optional(),
|
|
3652
|
-
}), {
|
|
3653
|
-
type: pluginEntityType,
|
|
3654
3351
|
});
|
|
3655
|
-
const
|
|
3656
|
-
const
|
|
3657
|
-
const
|
|
3352
|
+
const createPluginWithConfigSchema = definitionSchema(() => zWithPlugins((plugins, data) => {
|
|
3353
|
+
const parsedBasePlugin = basePluginDefinitionSchema.parse(data);
|
|
3354
|
+
const pluginKey = pluginEntityType.keyFromId(parsedBasePlugin.id);
|
|
3658
3355
|
const configSchema = plugins
|
|
3659
3356
|
.getPluginSpec(pluginConfigSpec)
|
|
3660
|
-
.getSchema(
|
|
3357
|
+
.getSchema(pluginKey);
|
|
3358
|
+
const pluginDefinitionWithEnt = zEnt(basePluginDefinitionSchema, {
|
|
3359
|
+
type: pluginEntityType,
|
|
3360
|
+
});
|
|
3661
3361
|
if (!configSchema) {
|
|
3662
|
-
return
|
|
3362
|
+
return pluginDefinitionWithEnt;
|
|
3663
3363
|
}
|
|
3664
|
-
return
|
|
3364
|
+
return pluginDefinitionWithEnt.and(z$4.object({
|
|
3665
3365
|
config: configSchema,
|
|
3666
3366
|
}));
|
|
3667
|
-
});
|
|
3668
|
-
const
|
|
3367
|
+
}));
|
|
3368
|
+
const createPluginsSchema = definitionSchema((ctx) => z$4.array(createPluginWithConfigSchema(ctx)));
|
|
3669
3369
|
|
|
3670
3370
|
const {z: z$3} = await importShared('zod');
|
|
3671
|
-
|
|
3672
|
-
const templateExtractorSchema = z$3.object({
|
|
3371
|
+
const createTemplateExtractorSchema = definitionSchema(() => z$3.object({
|
|
3673
3372
|
/**
|
|
3674
3373
|
* Whether to write template extractor metadata when writing files to the project.
|
|
3675
3374
|
*
|
|
@@ -3684,7 +3383,7 @@ const templateExtractorSchema = z$3.object({
|
|
|
3684
3383
|
* The list is delimited by a newline and can include a * to match any number of characters.
|
|
3685
3384
|
*/
|
|
3686
3385
|
fileIdRegexWhitelist: z$3.string().default(''),
|
|
3687
|
-
});
|
|
3386
|
+
}));
|
|
3688
3387
|
|
|
3689
3388
|
const {z: z$2} = await importShared('zod');
|
|
3690
3389
|
const generalSettingsSchema = z$2.object({
|
|
@@ -3708,32 +3407,32 @@ const generalSettingsSchema = z$2.object({
|
|
|
3708
3407
|
.int()
|
|
3709
3408
|
.refine((portOffset) => portOffset % 1000 === 0, 'Port offset must be a multiple of 1000, e.g. 1000, 2000, 3000, etc.'),
|
|
3710
3409
|
});
|
|
3711
|
-
const createSettingsSchema = definitionSchema(() => z$2.object({
|
|
3410
|
+
const createSettingsSchema = definitionSchema((ctx) => z$2.object({
|
|
3712
3411
|
general: generalSettingsSchema,
|
|
3713
|
-
templateExtractor:
|
|
3714
|
-
theme:
|
|
3412
|
+
templateExtractor: createTemplateExtractorSchema(ctx).optional(),
|
|
3413
|
+
theme: createThemeSchema(ctx).optional(),
|
|
3715
3414
|
}));
|
|
3716
3415
|
|
|
3717
3416
|
const {z: z$1} = await importShared('zod');
|
|
3718
|
-
const
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3417
|
+
const createAppSchema = definitionSchema((ctx) => zRefBuilder(z$1.discriminatedUnion('type', [
|
|
3418
|
+
createBackendAppSchema(ctx),
|
|
3419
|
+
createWebAppSchema(ctx),
|
|
3420
|
+
createAdminAppSchema(ctx),
|
|
3722
3421
|
]), (builder) => {
|
|
3723
3422
|
builder.addEntity({
|
|
3724
3423
|
type: appEntityType,
|
|
3725
3424
|
addContext: 'app',
|
|
3726
3425
|
});
|
|
3727
|
-
});
|
|
3426
|
+
}));
|
|
3728
3427
|
const createProjectDefinitionSchema = definitionSchema((ctx) => z$1.object({
|
|
3729
3428
|
cliVersion: z$1.string().nullish(),
|
|
3730
|
-
apps: z$1.array(
|
|
3731
|
-
features:
|
|
3732
|
-
models: z$1.array(
|
|
3733
|
-
enums: z$1.array(
|
|
3429
|
+
apps: z$1.array(createAppSchema(ctx)).default([]),
|
|
3430
|
+
features: createFeaturesSchema(ctx),
|
|
3431
|
+
models: z$1.array(createModelSchema(ctx)).default([]),
|
|
3432
|
+
enums: z$1.array(createEnumSchema(ctx)).optional(),
|
|
3734
3433
|
isInitialized: z$1.boolean().default(false),
|
|
3735
3434
|
schemaVersion: z$1.number(),
|
|
3736
|
-
plugins:
|
|
3435
|
+
plugins: createPluginsSchema(ctx).optional(),
|
|
3737
3436
|
settings: createSettingsSchema(ctx),
|
|
3738
3437
|
}));
|
|
3739
3438
|
|
|
@@ -3848,7 +3547,7 @@ function getTransformName(definitionContainer, transformer, pluginStore) {
|
|
|
3848
3547
|
const ModelTransformerUtils = { getTransformer, getTransformName };
|
|
3849
3548
|
|
|
3850
3549
|
function byId(projectDefinition, id) {
|
|
3851
|
-
const pluginEntityId = pluginEntityType.
|
|
3550
|
+
const pluginEntityId = pluginEntityType.idFromKey(id);
|
|
3852
3551
|
const plugin = projectDefinition.plugins?.find((m) => m.id === pluginEntityId);
|
|
3853
3552
|
return plugin ?? null;
|
|
3854
3553
|
}
|
|
@@ -3865,7 +3564,7 @@ function configByIdOrThrow(projectDefinition, id) {
|
|
|
3865
3564
|
}
|
|
3866
3565
|
function setPluginConfig(projectDefinition, plugin, pluginConfig, pluginImplementationStore) {
|
|
3867
3566
|
const plugins = projectDefinition.plugins ?? [];
|
|
3868
|
-
const pluginEntityId = pluginEntityType.
|
|
3567
|
+
const pluginEntityId = pluginEntityType.idFromKey(plugin.id);
|
|
3869
3568
|
const pluginConfigService = pluginImplementationStore.getPluginSpec(pluginConfigSpec);
|
|
3870
3569
|
const lastMigrationVersion = pluginConfigService.getLastMigrationVersion(plugin.id);
|
|
3871
3570
|
projectDefinition.plugins = plugins.some((p) => p.id === pluginEntityId)
|
|
@@ -8934,7 +8633,7 @@ const migration011PluginId = createSchemaMigration({
|
|
|
8934
8633
|
version: 11,
|
|
8935
8634
|
name: 'pluginId',
|
|
8936
8635
|
description: 'Convert plugin ids to use the plugin entity type',
|
|
8937
|
-
migrate: (config) => transformJsonPath(config, 'plugins.*.id', (id) => pluginEntityType.
|
|
8636
|
+
migrate: (config) => transformJsonPath(config, 'plugins.*.id', (id) => pluginEntityType.idFromKey(id)),
|
|
8938
8637
|
});
|
|
8939
8638
|
|
|
8940
8639
|
const migration012MigrateAuthConfig = createSchemaMigration({
|
|
@@ -9112,6 +8811,12 @@ function createTestProjectDefinition(input = {}) {
|
|
|
9112
8811
|
...input,
|
|
9113
8812
|
};
|
|
9114
8813
|
}
|
|
8814
|
+
function createTestProjectDefinitionInput(input = {}) {
|
|
8815
|
+
return {
|
|
8816
|
+
...createTestProjectDefinition(),
|
|
8817
|
+
...input,
|
|
8818
|
+
};
|
|
8819
|
+
}
|
|
9115
8820
|
function createTestProjectDefinitionContainer(input = {}) {
|
|
9116
8821
|
const pluginStore = {
|
|
9117
8822
|
availablePlugins: [],
|
|
@@ -9121,384 +8826,12 @@ function createTestProjectDefinitionContainer(input = {}) {
|
|
|
9121
8826
|
plugins: pluginImplementationStore,
|
|
9122
8827
|
});
|
|
9123
8828
|
const schemaWithPlugins = zPluginWrapper(projectDefinitionSchema, pluginImplementationStore);
|
|
9124
|
-
const resolvedRefPayload = deserializeSchemaWithReferences(schemaWithPlugins,
|
|
8829
|
+
const resolvedRefPayload = deserializeSchemaWithReferences(schemaWithPlugins, createTestProjectDefinitionInput(input));
|
|
9125
8830
|
return new ProjectDefinitionContainer(resolvedRefPayload, { pluginStore }, pluginImplementationStore);
|
|
9126
8831
|
}
|
|
9127
8832
|
|
|
9128
8833
|
const AVAILABLE_FLAGS = ['TEMPLATE_EXTRACTOR'];
|
|
9129
8834
|
|
|
9130
|
-
/**
|
|
9131
|
-
* Allows diffing of arbitrary JSON objects.
|
|
9132
|
-
*/
|
|
9133
|
-
class DefinitionDiffField {
|
|
9134
|
-
constructor(
|
|
9135
|
-
/**
|
|
9136
|
-
* The name of the field to be presented to the user.
|
|
9137
|
-
*/
|
|
9138
|
-
name) {
|
|
9139
|
-
Object.defineProperty(this, "name", {
|
|
9140
|
-
enumerable: true,
|
|
9141
|
-
configurable: true,
|
|
9142
|
-
writable: true,
|
|
9143
|
-
value: name
|
|
9144
|
-
});
|
|
9145
|
-
}
|
|
9146
|
-
}
|
|
9147
|
-
/**
|
|
9148
|
-
* A field that is an array of objects with a unique key.
|
|
9149
|
-
*/
|
|
9150
|
-
class DefinitionDiffKeyedArrayField extends DefinitionDiffField {
|
|
9151
|
-
constructor(name, getKey, options = {}) {
|
|
9152
|
-
super(name);
|
|
9153
|
-
Object.defineProperty(this, "getKey", {
|
|
9154
|
-
enumerable: true,
|
|
9155
|
-
configurable: true,
|
|
9156
|
-
writable: true,
|
|
9157
|
-
value: getKey
|
|
9158
|
-
});
|
|
9159
|
-
Object.defineProperty(this, "options", {
|
|
9160
|
-
enumerable: true,
|
|
9161
|
-
configurable: true,
|
|
9162
|
-
writable: true,
|
|
9163
|
-
value: options
|
|
9164
|
-
});
|
|
9165
|
-
this.getKey = getKey;
|
|
9166
|
-
}
|
|
9167
|
-
diff(current, desired) {
|
|
9168
|
-
const currentValue = current ?? [];
|
|
9169
|
-
const desiredValue = desired ?? [];
|
|
9170
|
-
if (!Array.isArray(currentValue) || !Array.isArray(desiredValue)) {
|
|
9171
|
-
throw new TypeError('Current and desired must be arrays');
|
|
9172
|
-
}
|
|
9173
|
-
const ops = [];
|
|
9174
|
-
const { allowRemove, ignoreFields = ['id'] } = this.options;
|
|
9175
|
-
const currentByKey = new Map(currentValue.map((item) => [this.getKey(item), item]));
|
|
9176
|
-
const desiredByKey = new Map(desiredValue.map((item) => [this.getKey(item), item]));
|
|
9177
|
-
for (const [key, desiredItem] of desiredByKey) {
|
|
9178
|
-
const currentItem = currentByKey.get(key);
|
|
9179
|
-
if (!currentItem) {
|
|
9180
|
-
ops.push({ type: 'add', key, item: desiredItem });
|
|
9181
|
-
continue;
|
|
9182
|
-
}
|
|
9183
|
-
if (!isMatch(omit(currentItem, ignoreFields), omit(desiredItem, ignoreFields))) {
|
|
9184
|
-
ops.push({ type: 'update', key, item: desiredItem });
|
|
9185
|
-
}
|
|
9186
|
-
}
|
|
9187
|
-
if (allowRemove) {
|
|
9188
|
-
for (const [key, currentItem] of currentByKey) {
|
|
9189
|
-
if (!desiredByKey.has(key)) {
|
|
9190
|
-
ops.push({ type: 'remove', key, item: currentItem });
|
|
9191
|
-
}
|
|
9192
|
-
}
|
|
9193
|
-
}
|
|
9194
|
-
return ops;
|
|
9195
|
-
}
|
|
9196
|
-
apply(current, diff) {
|
|
9197
|
-
const patch = diff;
|
|
9198
|
-
const currentValue = current ?? [];
|
|
9199
|
-
if (!Array.isArray(currentValue)) {
|
|
9200
|
-
throw new TypeError('Current must be array');
|
|
9201
|
-
}
|
|
9202
|
-
const items = [...currentValue];
|
|
9203
|
-
for (const { type, key, item } of patch) {
|
|
9204
|
-
const index = items.findIndex((i) => this.getKey(i) === key);
|
|
9205
|
-
switch (type) {
|
|
9206
|
-
case 'add': {
|
|
9207
|
-
items.push(item);
|
|
9208
|
-
break;
|
|
9209
|
-
}
|
|
9210
|
-
case 'update': {
|
|
9211
|
-
if (index === -1) {
|
|
9212
|
-
throw new Error(`Cannot apply patch. Item with key "${key}" not found.`);
|
|
9213
|
-
}
|
|
9214
|
-
// Preserve existing id if present.
|
|
9215
|
-
items[index] = toMerged(items[index], item);
|
|
9216
|
-
break;
|
|
9217
|
-
}
|
|
9218
|
-
case 'remove': {
|
|
9219
|
-
if (index !== -1) {
|
|
9220
|
-
items.splice(index, 1);
|
|
9221
|
-
}
|
|
9222
|
-
break;
|
|
9223
|
-
}
|
|
9224
|
-
}
|
|
9225
|
-
}
|
|
9226
|
-
return items;
|
|
9227
|
-
}
|
|
9228
|
-
}
|
|
9229
|
-
/**
|
|
9230
|
-
* A field that is a replacement for the entire object or array.
|
|
9231
|
-
*/
|
|
9232
|
-
class DefinitionDiffReplacementField extends DefinitionDiffField {
|
|
9233
|
-
diff(current, desired) {
|
|
9234
|
-
if (!isMatch(current, desired)) {
|
|
9235
|
-
return [{ type: 'update', key: '*', item: desired }];
|
|
9236
|
-
}
|
|
9237
|
-
return [];
|
|
9238
|
-
}
|
|
9239
|
-
apply(current, diff) {
|
|
9240
|
-
if (diff.length === 0)
|
|
9241
|
-
return current;
|
|
9242
|
-
return diff[0].item;
|
|
9243
|
-
}
|
|
9244
|
-
}
|
|
9245
|
-
function createDefinitionDiffConfig(config) {
|
|
9246
|
-
return config;
|
|
9247
|
-
}
|
|
9248
|
-
/**
|
|
9249
|
-
* Creates a diff between two objects.
|
|
9250
|
-
*/
|
|
9251
|
-
function createDefinitionDiff(current, desired, configuration) {
|
|
9252
|
-
const ops = mapValues(configuration, (field, key) => {
|
|
9253
|
-
if (!field)
|
|
9254
|
-
return [];
|
|
9255
|
-
return field.diff(get$1(current, key), get$1(desired, key));
|
|
9256
|
-
});
|
|
9257
|
-
if (Object.values(ops).every((ops) => ops.length === 0)) {
|
|
9258
|
-
return undefined;
|
|
9259
|
-
}
|
|
9260
|
-
return ops;
|
|
9261
|
-
}
|
|
9262
|
-
/**
|
|
9263
|
-
* Applies a diff to an object.
|
|
9264
|
-
*/
|
|
9265
|
-
function applyDefinitionDiff(current, diff, configuration) {
|
|
9266
|
-
const clonedCurrent = cloneDeep(current);
|
|
9267
|
-
for (const [key, ops] of Object.entries(diff)) {
|
|
9268
|
-
if (!ops)
|
|
9269
|
-
continue;
|
|
9270
|
-
const field = configuration[key];
|
|
9271
|
-
const currentValue = get$1(clonedCurrent, key);
|
|
9272
|
-
set$1(clonedCurrent, key, field.apply(currentValue, ops));
|
|
9273
|
-
}
|
|
9274
|
-
return clonedCurrent;
|
|
9275
|
-
}
|
|
9276
|
-
|
|
9277
|
-
/**
|
|
9278
|
-
* Computes a unique key for a unique constraint by sorting its field refs.
|
|
9279
|
-
*
|
|
9280
|
-
* @param constraint - Unique constraint input.
|
|
9281
|
-
* @returns A key string.
|
|
9282
|
-
*/
|
|
9283
|
-
function getUniqueConstraintKey(constraint) {
|
|
9284
|
-
const fields = constraint.fields.map((f) => f.fieldRef).sort();
|
|
9285
|
-
return fields.join('|');
|
|
9286
|
-
}
|
|
9287
|
-
const modelMergerDefinitionDiffConfig = createDefinitionDiffConfig({
|
|
9288
|
-
'model.fields': new DefinitionDiffKeyedArrayField('fields', (f) => f.name),
|
|
9289
|
-
'model.relations': new DefinitionDiffKeyedArrayField('relations', (r) => r.name),
|
|
9290
|
-
'model.uniqueConstraints': new DefinitionDiffKeyedArrayField('uniqueConstraints', (c) => getUniqueConstraintKey(c)),
|
|
9291
|
-
'model.primaryKeyFieldRefs': new DefinitionDiffReplacementField('primaryKeyFieldRefs'),
|
|
9292
|
-
});
|
|
9293
|
-
/**
|
|
9294
|
-
* Serializes a model merger model input such that all IDs are replaced with
|
|
9295
|
-
* names.
|
|
9296
|
-
*
|
|
9297
|
-
* @param input - The model merger model input.
|
|
9298
|
-
* @param definitionContainer - The definition container.
|
|
9299
|
-
* @returns The serialized model merger model input.
|
|
9300
|
-
*/
|
|
9301
|
-
function serializeModelMergerModelInput(input, definitionContainer, siblingModels) {
|
|
9302
|
-
const siblingModelFieldIdMap = new Map([
|
|
9303
|
-
...input.model.fields.map((f) => [f.id, f.name]),
|
|
9304
|
-
...siblingModels.flatMap((m) => m.model.fields.map((f) => [f.id, f.name])),
|
|
9305
|
-
]);
|
|
9306
|
-
const nameFromId = (id) => siblingModelFieldIdMap.get(id) ?? definitionContainer.nameFromId(id);
|
|
9307
|
-
return {
|
|
9308
|
-
...input,
|
|
9309
|
-
model: {
|
|
9310
|
-
...input.model,
|
|
9311
|
-
relations: input.model.relations?.map((r) => ({
|
|
9312
|
-
...r,
|
|
9313
|
-
references: r.references.map((reference) => ({
|
|
9314
|
-
...reference,
|
|
9315
|
-
localRef: nameFromId(reference.localRef),
|
|
9316
|
-
foreignRef: nameFromId(reference.foreignRef),
|
|
9317
|
-
})),
|
|
9318
|
-
})),
|
|
9319
|
-
uniqueConstraints: input.model.uniqueConstraints?.map((c) => ({
|
|
9320
|
-
...c,
|
|
9321
|
-
fields: c.fields.map((f) => ({
|
|
9322
|
-
...f,
|
|
9323
|
-
fieldRef: nameFromId(f.fieldRef),
|
|
9324
|
-
})),
|
|
9325
|
-
})),
|
|
9326
|
-
primaryKeyFieldRefs: input.model.primaryKeyFieldRefs.map(nameFromId),
|
|
9327
|
-
},
|
|
9328
|
-
};
|
|
9329
|
-
}
|
|
9330
|
-
/**
|
|
9331
|
-
* Attaches IDs to the model merger model input.
|
|
9332
|
-
*
|
|
9333
|
-
* @param input - The model merger model input.
|
|
9334
|
-
* @returns The model merger model input with IDs attached.
|
|
9335
|
-
*/
|
|
9336
|
-
function attachIdsToModelMergerModelInput(input) {
|
|
9337
|
-
return {
|
|
9338
|
-
...input,
|
|
9339
|
-
model: {
|
|
9340
|
-
...input.model,
|
|
9341
|
-
fields: input.model.fields.map((f) => ({
|
|
9342
|
-
...f,
|
|
9343
|
-
id: f.id ?? modelScalarFieldEntityType.generateNewId(),
|
|
9344
|
-
})),
|
|
9345
|
-
relations: input.model.relations?.map((r) => ({
|
|
9346
|
-
...r,
|
|
9347
|
-
id: r.id ?? modelLocalRelationEntityType.generateNewId(),
|
|
9348
|
-
foreignId: r.foreignId ?? modelForeignRelationEntityType.generateNewId(),
|
|
9349
|
-
})),
|
|
9350
|
-
uniqueConstraints: input.model.uniqueConstraints?.map((c) => ({
|
|
9351
|
-
...c,
|
|
9352
|
-
id: c.id ?? modelUniqueConstraintEntityType.generateNewId(),
|
|
9353
|
-
})),
|
|
9354
|
-
},
|
|
9355
|
-
};
|
|
9356
|
-
}
|
|
9357
|
-
/**
|
|
9358
|
-
* Deserializes a model merger model input converting all names to IDs.
|
|
9359
|
-
*
|
|
9360
|
-
* @param input - The model merger model input.
|
|
9361
|
-
* @param resolveForeignFieldRef - A function that resolves the foreign field ref.
|
|
9362
|
-
* @returns The deserialized model merger model input.
|
|
9363
|
-
*/
|
|
9364
|
-
function deserializeModelMergerModelInput(input, resolveForeignFieldRef) {
|
|
9365
|
-
const inputWithIds = attachIdsToModelMergerModelInput(input);
|
|
9366
|
-
const resolveLocalFieldName = (name) => {
|
|
9367
|
-
const field = inputWithIds.model.fields.find((f) => f.name === name);
|
|
9368
|
-
if (!field) {
|
|
9369
|
-
throw new Error(`Field ${name} not found`);
|
|
9370
|
-
}
|
|
9371
|
-
return field.id;
|
|
9372
|
-
};
|
|
9373
|
-
return {
|
|
9374
|
-
...inputWithIds,
|
|
9375
|
-
model: {
|
|
9376
|
-
...inputWithIds.model,
|
|
9377
|
-
relations: inputWithIds.model.relations?.map((relation) => ({
|
|
9378
|
-
...relation,
|
|
9379
|
-
references: relation.references.map((reference) => ({
|
|
9380
|
-
...reference,
|
|
9381
|
-
localRef: resolveLocalFieldName(reference.localRef),
|
|
9382
|
-
foreignRef: resolveForeignFieldRef(relation.modelRef, reference.foreignRef),
|
|
9383
|
-
})),
|
|
9384
|
-
})),
|
|
9385
|
-
uniqueConstraints: inputWithIds.model.uniqueConstraints?.map((constraint) => ({
|
|
9386
|
-
...constraint,
|
|
9387
|
-
fields: constraint.fields.map((field) => ({
|
|
9388
|
-
...field,
|
|
9389
|
-
fieldRef: resolveLocalFieldName(field.fieldRef),
|
|
9390
|
-
})),
|
|
9391
|
-
})),
|
|
9392
|
-
primaryKeyFieldRefs: inputWithIds.model.primaryKeyFieldRefs.map((fieldRef) => resolveLocalFieldName(fieldRef)),
|
|
9393
|
-
},
|
|
9394
|
-
};
|
|
9395
|
-
}
|
|
9396
|
-
/**
|
|
9397
|
-
* Creates a new blank model config input from a name and feature ref.
|
|
9398
|
-
*
|
|
9399
|
-
* @param name - The name of the model.
|
|
9400
|
-
* @param featureRef - The feature ref of the model.
|
|
9401
|
-
* @returns The new model config input.
|
|
9402
|
-
*/
|
|
9403
|
-
function createNewModelConfigInput(name, featureRef) {
|
|
9404
|
-
return {
|
|
9405
|
-
id: modelEntityType.generateNewId(),
|
|
9406
|
-
name,
|
|
9407
|
-
featureRef,
|
|
9408
|
-
model: {
|
|
9409
|
-
fields: [],
|
|
9410
|
-
primaryKeyFieldRefs: [],
|
|
9411
|
-
},
|
|
9412
|
-
};
|
|
9413
|
-
}
|
|
9414
|
-
/**
|
|
9415
|
-
* Diff the model definition.
|
|
9416
|
-
*
|
|
9417
|
-
* @param current - The current model definition or a new model to be created.
|
|
9418
|
-
* @param desired - The desired model definition.
|
|
9419
|
-
* @param definitionContainer - Project definition container.
|
|
9420
|
-
* @param options - Diff options.
|
|
9421
|
-
* @returns A diff output or undefined if there are no differences.
|
|
9422
|
-
*/
|
|
9423
|
-
function createModelMergerResult(current, desired, definitionContainer, { siblingModels = [] } = {}) {
|
|
9424
|
-
const currentModel = current ?? createNewModelConfigInput(desired.name, desired.featureRef);
|
|
9425
|
-
// resolves all the names of the current model config input
|
|
9426
|
-
const resolvedCurrent = serializeModelMergerModelInput(currentModel, definitionContainer, siblingModels);
|
|
9427
|
-
const diff = createDefinitionDiff(resolvedCurrent, desired, modelMergerDefinitionDiffConfig);
|
|
9428
|
-
if (!diff) {
|
|
9429
|
-
return undefined;
|
|
9430
|
-
}
|
|
9431
|
-
return {
|
|
9432
|
-
isNewModel: !current,
|
|
9433
|
-
id: currentModel.id,
|
|
9434
|
-
name: currentModel.name,
|
|
9435
|
-
featureRef: currentModel.featureRef,
|
|
9436
|
-
changes: diff,
|
|
9437
|
-
};
|
|
9438
|
-
}
|
|
9439
|
-
/**
|
|
9440
|
-
* Creates a model merger result for a set of models.
|
|
9441
|
-
*
|
|
9442
|
-
* @param current - A map of model IDs
|
|
9443
|
-
* @param desired - The desired model definition.
|
|
9444
|
-
* @param definitionContainer - Project definition container.
|
|
9445
|
-
* @param options - Diff options.
|
|
9446
|
-
* @returns A model merger result for a set of models.
|
|
9447
|
-
*/
|
|
9448
|
-
function createModelMergerResults(current, desired, definitionContainer, { siblingModels = [] } = {}) {
|
|
9449
|
-
return mapValues(desired, (desired, key) => createModelMergerResult(current[key] && modelEntityType.isId(current[key])
|
|
9450
|
-
? ModelUtils.byIdOrThrow(definitionContainer.definition, current[key])
|
|
9451
|
-
: undefined, desired, definitionContainer, {
|
|
9452
|
-
siblingModels,
|
|
9453
|
-
}));
|
|
9454
|
-
}
|
|
9455
|
-
function applyModelMergerDiff(model, diff, definitionContainer, siblingModels = []) {
|
|
9456
|
-
const resolvedCurrent = serializeModelMergerModelInput(model, definitionContainer, siblingModels);
|
|
9457
|
-
const patchedCurrent = applyDefinitionDiff(resolvedCurrent, diff, modelMergerDefinitionDiffConfig);
|
|
9458
|
-
return {
|
|
9459
|
-
...model,
|
|
9460
|
-
...deserializeModelMergerModelInput(patchedCurrent, (modelId, fieldName) => {
|
|
9461
|
-
const siblingModel = siblingModels.find((m) => m.id === modelId);
|
|
9462
|
-
if (siblingModel) {
|
|
9463
|
-
const field = siblingModel.model.fields.find((f) => f.name === fieldName);
|
|
9464
|
-
if (!field) {
|
|
9465
|
-
throw new Error(`Field ${fieldName} not found in sibling model ${modelId}`);
|
|
9466
|
-
}
|
|
9467
|
-
return field.id;
|
|
9468
|
-
}
|
|
9469
|
-
const model = ModelUtils.byIdOrThrow(definitionContainer.definition, modelId);
|
|
9470
|
-
const field = model.model.fields.find((f) => f.name === fieldName);
|
|
9471
|
-
if (!field) {
|
|
9472
|
-
throw new Error(`Field ${fieldName} not found in model ${model.name}`);
|
|
9473
|
-
}
|
|
9474
|
-
return field.id;
|
|
9475
|
-
}),
|
|
9476
|
-
};
|
|
9477
|
-
}
|
|
9478
|
-
function applyModelMergerResultInPlace(draftConfig, result, definitionContainer, { siblingModels = [] } = {}) {
|
|
9479
|
-
const model = result.isNewModel
|
|
9480
|
-
? createNewModelConfigInput(result.name, result.featureRef)
|
|
9481
|
-
: ModelUtils.byIdOrThrow(definitionContainer.definition, result.id);
|
|
9482
|
-
const newModel = applyModelMergerDiff(model, result.changes, definitionContainer, siblingModels);
|
|
9483
|
-
if (result.isNewModel) {
|
|
9484
|
-
draftConfig.models.push(newModel);
|
|
9485
|
-
}
|
|
9486
|
-
else {
|
|
9487
|
-
const index = draftConfig.models.findIndex((m) => m.id === result.id);
|
|
9488
|
-
if (index === -1) {
|
|
9489
|
-
throw new Error(`Model ${result.id} not found`);
|
|
9490
|
-
}
|
|
9491
|
-
draftConfig.models[index] = newModel;
|
|
9492
|
-
}
|
|
9493
|
-
return newModel.id;
|
|
9494
|
-
}
|
|
9495
|
-
function createAndApplyModelMergerResults(draftConfig, current, desired, definitionContainer, { siblingModels = [] } = {}) {
|
|
9496
|
-
const results = createModelMergerResults(current, desired, definitionContainer, { siblingModels });
|
|
9497
|
-
return mapValues(results, (result, key) => result
|
|
9498
|
-
? applyModelMergerResultInPlace(draftConfig, result, definitionContainer, { siblingModels })
|
|
9499
|
-
: desired[key].name);
|
|
9500
|
-
}
|
|
9501
|
-
|
|
9502
8835
|
/**
|
|
9503
8836
|
* Convert a color name to a hex color. Can be one of the following:
|
|
9504
8837
|
* - A fixed color name (e.g. 'white', 'black').
|
|
@@ -10555,5 +9888,5 @@ function generateDefaultTheme() {
|
|
|
10555
9888
|
};
|
|
10556
9889
|
}
|
|
10557
9890
|
|
|
10558
|
-
export { AVAILABLE_FLAGS, AppUtils, BUILT_IN_ADMIN_CRUD_INPUTS, BUILT_IN_TRANSFORMERS, COLOR_PALETTES,
|
|
10559
|
-
//# sourceMappingURL=project-builder-lib-
|
|
9891
|
+
export { AVAILABLE_FLAGS, AppUtils, BUILT_IN_ADMIN_CRUD_INPUTS, BUILT_IN_TRANSFORMERS, COLOR_PALETTES, EnumUtils, FIXED_COLOR_MAPPINGS, ModelFieldUtils, ModelTransformerUtils, ModelUtils, PALETTE_SHADES, PluginImplementationStore, PluginUtils, ProjectDefinitionContainer, REFERENTIAL_ACTIONS, SCALAR_FIELD_TYPES, SCHEMA_MIGRATIONS, SchemaMigrationError, THEME_COLORS, THEME_COLOR_KEYS, VALIDATORS, ZodRefWrapper, ZodWithPlugins, adminAppEntryType, adminCrudDisplayTypes, adminCrudEmbeddedFormEntityType, adminCrudEmbeddedInputType, adminCrudEmbeddedLocalInputType, adminCrudInputCompilerSpec, adminCrudInputSpec, adminSectionEntityType, appCompilerSpec, appEntityType, authConfigSpec, authRoleEntityType, backendAppEntryType, baseAdminCrudInputSchema, baseAdminSectionValidators, baseAppSchema, baseAppValidators, basePluginDefinitionSchema, baseTransformerFields, baseTransformerSchema, convertColorNameToOklch, convertHexToOklch, convertOklchToColorName, convertOklchToHex, createAdminAppSchema, createAdminCrudDisplaySchema, createAdminCrudEmbeddedFormSchema, createAdminCrudEmbeddedInputSchema, createAdminCrudEmbeddedListSchema, createAdminCrudEmbeddedLocalInputSchema, createAdminCrudEmbeddedObjectSchema, createAdminCrudEnumInputSchema, createAdminCrudForeignDisplaySchema, createAdminCrudForeignInputSchema, createAdminCrudInputCompilerImplementation, createAdminCrudInputImplementation, createAdminCrudInputSchema, createAdminCrudInputType, createAdminCrudPasswordInputSchema, createAdminCrudSectionSchema, createAdminCrudTableColumnSchema, createAdminCrudTextDisplaySchema, createAdminCrudTextInputSchema, createAdminSectionSchema, createAppCompiler, createAppCompilerPlugin, createAppEntryType, createAppSchema, createBackendAppSchema, createDefinitionEntityNameResolver, createEmbeddedRelationTransformerSchema, createEntityType, createEnumBaseSchema, createEnumSchema, createEnumValueSchema, createFeaturesSchema, createModelBaseSchema, createModelGraphqlSchema, createModelRelationFieldSchema, createModelScalarFieldSchema, createModelSchema, createModelServiceSchema, createModelTransformerCompilerImplementation, createModelTransformerImplementation, createModelTransformerType, createModelUniqueConstraintSchema, createPasswordTransformerSchema, createPlatformPluginExport, createPluginConfigImplementation, createPluginImplementationStore, createPluginSpec, createPluginWithConfigSchema, createPluginsSchema, createProjectDefinitionSchema, createProjectDefinitionSchemaWithContext, createSettingsSchema, createTemplateExtractorSchema, createTestProjectDefinition, createTestProjectDefinitionContainer, createTestProjectDefinitionInput, createThemeSchema, createTransformerSchema, createWebAppSchema, createWebConfigImplementation, definitionSchema, deserializeSchemaWithReferences, featureEntityType, fixRefDeletions, generalSettingsSchema, generateCssFromThemeConfig, generateDefaultTheme, generateThemeColorsFromShade, getBackendRelativePath, getDefaultThemeColorFromShade, getLatestMigrationVersion, initializePlugins, isMigrateableProjectDefinition, modelEntityType, modelEnumEntityType, modelEnumValueEntityType, modelForeignRelationEntityType, modelLocalRelationEntityType, modelScalarFieldEntityType, modelTransformerCompilerSpec, modelTransformerEntityType, modelTransformerSpec, modelUniqueConstraintEntityType, oklchColor, paletteSchema, palettesSchema, parseOklch, parseProjectDefinitionWithContext, parseProjectDefinitionWithReferences, pluginConfigSpec, pluginEntityType, pluginManifestJsonSchema, pluginMetadataSchema, pluginSpecDependencySchema, pluginSpecSupportSchema, runPluginMigrations, runSchemaMigrations, serializeSchema, serializeSchemaFromRefPayload, stripEmptyGeneratorChildren, stripUndefinedValues, themeColorSchema, undefinedIfEmpty, undefinedIfFalsy, webAppEntryType, webConfigSpec, zEnt, zPluginWrapper, zRef, zRefBuilder, zRefId, zWithPlugins };
|
|
9892
|
+
//# sourceMappingURL=project-builder-lib-Tb9xtEo4.js.map
|