@wildo-ai/saas-specifications 1.1.16 → 1.1.17
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/esm/_core/application-maturity/application-maturity-open-items.d.ts +2 -1
- package/dist/esm/_core/application-maturity/application-maturity-open-items.d.ts.map +1 -1
- package/dist/esm/_core/application-maturity/application-maturity-open-items.js +2 -1
- package/dist/esm/_core/application-maturity/application-maturity-open-items.js.map +1 -1
- package/dist/esm/_core/application-maturity/application-maturity-validation.js +1 -1
- package/dist/esm/_core/application-maturity/application-maturity-validation.js.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-relationship-grouping.d.ts.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-relationship-grouping.js +5 -2
- package/dist/esm/_core/build-plan/build-plan-relationship-grouping.js.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.d.ts +251 -0
- package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.js +43 -0
- package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.js.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.d.ts +43 -0
- package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.d.ts.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.js +58 -0
- package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.js.map +1 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set-generation.schemas.d.ts +1 -0
- package/dist/esm/_core/domain-plan/domain-plan-output-set-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set-generation.schemas.js +5 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set-generation.schemas.js.map +1 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set-validation.js +2 -0
- package/dist/esm/_core/domain-plan/domain-plan-output-set-validation.js.map +1 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.d.ts +3 -0
- package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.d.ts.map +1 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.js +12 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.js.map +1 -1
- package/dist/esm/_core/execution-view-specification.schemas.d.ts +19 -3
- package/dist/esm/_core/execution-view-specification.schemas.d.ts.map +1 -1
- package/dist/esm/_core/execution-view-specification.schemas.js +11 -1
- package/dist/esm/_core/execution-view-specification.schemas.js.map +1 -1
- package/dist/esm/_core/market/market-snapshot-generation.schemas.d.ts +15 -0
- package/dist/esm/_core/market/market-snapshot-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/market/market-snapshot-generation.schemas.js +43 -0
- package/dist/esm/_core/market/market-snapshot-generation.schemas.js.map +1 -1
- package/dist/esm/_core/service-method/service-method-derivation.d.ts +17 -1
- package/dist/esm/_core/service-method/service-method-derivation.d.ts.map +1 -1
- package/dist/esm/_core/service-method/service-method-derivation.js +46 -0
- package/dist/esm/_core/service-method/service-method-derivation.js.map +1 -1
- package/dist/esm/_core/service-method/service-method-generation.schemas.d.ts +5 -0
- package/dist/esm/_core/service-method/service-method-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/service-method/service-method.family-aspects.d.ts.map +1 -1
- package/dist/esm/_core/service-method/service-method.family-aspects.js +1 -0
- package/dist/esm/_core/service-method/service-method.family-aspects.js.map +1 -1
- package/dist/esm/_core/service-method/service-method.schemas.d.ts +36 -1
- package/dist/esm/_core/service-method/service-method.schemas.d.ts.map +1 -1
- package/dist/esm/_core/service-method/service-method.schemas.js +49 -1
- package/dist/esm/_core/service-method/service-method.schemas.js.map +1 -1
- package/dist/esm/_core/utils/extract-field-specs.d.ts +4 -3
- package/dist/esm/_core/utils/extract-field-specs.d.ts.map +1 -1
- package/dist/esm/_core/utils/extract-field-specs.js +4 -3
- package/dist/esm/_core/utils/extract-field-specs.js.map +1 -1
- package/dist/esm/engine/frontend-components/ai-elements/chat/ai-conversation-thread.frontend-component.specification.js +1 -1
- package/dist/esm/engine/frontend-components/ai-elements/chat/ai-conversation-thread.frontend-component.specification.js.map +1 -1
- package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.d.ts.map +1 -1
- package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.js +1 -0
- package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.js.map +1 -1
- package/dist/esm/engine/frontend-components/data-display/approval-seal.frontend-component.specification.js +3 -3
- package/dist/esm/engine/frontend-components/data-display/approval-seal.frontend-component.specification.js.map +1 -1
- package/dist/esm/engine/frontend-components/data-display/signature-requests.frontend-component.specification.d.ts +4 -0
- package/dist/esm/engine/frontend-components/data-display/signature-requests.frontend-component.specification.d.ts.map +1 -0
- package/dist/esm/engine/frontend-components/data-display/signature-requests.frontend-component.specification.js +29 -0
- package/dist/esm/engine/frontend-components/data-display/signature-requests.frontend-component.specification.js.map +1 -0
- package/dist/esm/engine/frontend-components/flows-actors/low-level-ai-approval.frontend-component.specification.js +1 -1
- package/dist/esm/engine/frontend-components/flows-actors/low-level-ai-approval.frontend-component.specification.js.map +1 -1
- package/dist/esm/engine/frontend-components/index.d.ts +1 -0
- package/dist/esm/engine/frontend-components/index.d.ts.map +1 -1
- package/dist/esm/engine/frontend-components/index.js +3 -0
- package/dist/esm/engine/frontend-components/index.js.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-members.resource.specification.d.ts +9 -0
- package/dist/esm/engine/organizations/resources/organization-members.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js +50 -0
- package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-relationships.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-relationships.resource.specification.js +25 -0
- package/dist/esm/engine/organizations/resources/organization-relationships.resource.specification.js.map +1 -1
- package/dist/esm/engine/providers/antigravity.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/antigravity.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/antigravity.provider.specification.js +54 -0
- package/dist/esm/engine/providers/antigravity.provider.specification.js.map +1 -0
- package/dist/esm/engine/providers/google-drive.provider.specification.d.ts.map +1 -1
- package/dist/esm/engine/providers/google-drive.provider.specification.js +8 -0
- package/dist/esm/engine/providers/google-drive.provider.specification.js.map +1 -1
- package/dist/esm/engine/providers/index.d.ts +2 -0
- package/dist/esm/engine/providers/index.d.ts.map +1 -1
- package/dist/esm/engine/providers/index.js +5 -1
- package/dist/esm/engine/providers/index.js.map +1 -1
- package/dist/esm/engine/providers/microsoft-onedrive.provider.specification.d.ts.map +1 -1
- package/dist/esm/engine/providers/microsoft-onedrive.provider.specification.js +17 -0
- package/dist/esm/engine/providers/microsoft-onedrive.provider.specification.js.map +1 -1
- package/dist/esm/engine/providers/outbound-bearer-token.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/outbound-bearer-token.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/outbound-bearer-token.provider.specification.js +41 -0
- package/dist/esm/engine/providers/outbound-bearer-token.provider.specification.js.map +1 -0
- package/dist/esm/engine/providers/twilio.provider.specification.d.ts.map +1 -1
- package/dist/esm/engine/providers/twilio.provider.specification.js +3 -0
- package/dist/esm/engine/providers/twilio.provider.specification.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-plan-output-set-generation.schemas.js","sourceRoot":"","sources":["../../../../src/_core/domain-plan/domain-plan-output-set-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,8BAA8B,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,u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CAAC,EAAE,kBAAkB,EAAE,CAAC;gBAC9D,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;gBACtC,GAAG,CAAC,kBAAkB,KAAK,IAAI;oBAC7B,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,gCAAgC,CAAC,EAAE,kBAAkB,EAAE,kBAAkB,IAAI,EAAE,EAAE,kBAAkB,EAAE,eAAe,EAAE,OAAO,CAAC,6BAA6B,EAAE,CAAC,CAAC;aACpK,CAAC,CAAC;SACJ;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { z } from 'zod';\nimport { OrganizationRowConfinementMode, SystemOfRecordAccess, TenantRecordVisibility } from '@wildo-ai/saas-models';\n\nimport {\n DomainPlanConfinementFieldNameSchema,\n DomainPlanOrganizationJoining,\n DomainPlanOrganizationModelRefSchema,\n DomainPlanRecordLocation,\n DomainPlanSystemOfRecordKindSchema,\n DomainPlanEngineRealization,\n DomainPlanOutputSetSchema,\n DomainPlanTenancyModel,\n DomainRelationshipCardinalityIntent,\n DomainRelationshipOwnershipIntent,\n DomainTransitionPerformer,\n DomainTransitionRefSchema,\n DomainTransitionStampsFieldSchema,\n layDownDomainPlanRecordPartition,\n type DomainPlanOutputSet,\n type DomainPlanSystemOfRecordPartitionFields,\n} from './domain-plan-output-set.schemas';\n\nconst NonEmptyStringSchema = z.string().trim().min(1);\n\n/** Strict provider-facing module shape: every field must be emitted explicitly. */\nexport const DomainPlanGeneratedModuleSchema = z.strictObject({\n relatedModuleId: NonEmptyStringSchema,\n purpose: NonEmptyStringSchema,\n businessCapability: NonEmptyStringSchema,\n businessDomain: NonEmptyStringSchema.nullable(),\n primaryActors: z.array(NonEmptyStringSchema),\n mainResources: z.array(NonEmptyStringSchema),\n supportingResources: z.array(NonEmptyStringSchema),\n integrationSurfaces: z.array(NonEmptyStringSchema),\n});\nexport type DomainPlanGeneratedModule = z.infer<typeof DomainPlanGeneratedModuleSchema>;\n\n/** Strict provider-facing relationship shape used before permissive staging. */\nexport const DomainRelationshipDraftGenerationSchema = z.strictObject({\n relationshipRef: NonEmptyStringSchema,\n sourceResourceRef: NonEmptyStringSchema,\n targetResourceRef: NonEmptyStringSchema,\n cardinalityIntent: z.enum(DomainRelationshipCardinalityIntent),\n ownershipIntent: z.enum(DomainRelationshipOwnershipIntent),\n rationale: NonEmptyStringSchema,\n});\nexport type DomainRelationshipDraftGeneration = z.infer<typeof DomainRelationshipDraftGenerationSchema>;\n\n/** One indivisible provider response for both destination families. */\nexport const DomainPlanOutputSetGenerationSchema = z.strictObject({\n schemaVersion: z.literal(1),\n /**\n * REQUIRED here though optional on the family schema. A derivation that does not state its\n * tenancy has made the decision silently — and it does make one: wonder-crm's plan modelled a\n * workspace and a membership without ever being asked. Stating it is what lets a reviewer see the\n * decision, and what lets `bottom_up.foundation` stop re-asking a question the plan already answered.\n */\n tenancy: z.enum(DomainPlanTenancyModel),\n /**\n * REQUIRED here, and an empty list is an answer (#2492): the requirements met by what the engine\n * provides rather than by a module. Required for the same reason as `tenancy` — a plan that never says\n * a role requirement is the engine's has silently decided it is a module's, which is how an access-role\n * resource nothing reads came to be planned.\n */\n engineRealizedRequirements: z.array(z.strictObject({\n requirementRef: NonEmptyStringSchema,\n realization: z.enum(DomainPlanEngineRealization),\n rationale: NonEmptyStringSchema,\n })),\n /**\n * REQUIRED (#2491): the lifecycle of every resource that moves through states. An empty list is an\n * answer — that no resource does — and a plan that leaves it out has decided, silently, that every status\n * is a field users edit.\n */\n lifecycles: z.array(z.strictObject({\n resourceRef: NonEmptyStringSchema,\n states: z.array(NonEmptyStringSchema).min(2),\n initialState: NonEmptyStringSchema,\n transitions: z.array(z.strictObject({\n transitionRef: DomainTransitionRefSchema,\n from: z.array(NonEmptyStringSchema).min(1),\n to: NonEmptyStringSchema,\n performedBy: NonEmptyStringSchema,\n // Required here, optional on the stored plan (#3066): whether the step waits on someone other than the author.\n performer: z.enum(DomainTransitionPerformer),\n createsResourceRef: NonEmptyStringSchema.nullable(),\n stampsField: DomainTransitionStampsFieldSchema.nullable(),\n })).min(1),\n lockedStates: z.array(NonEmptyStringSchema),\n finalStates: z.array(NonEmptyStringSchema),\n })),\n /**\n * REQUIRED (#3032): the organizations, the relationship kinds between them, the confined records and the records held\n * in another system, every list allowed empty. Required for the same reason as `tenancy`: a plan that never says an\n * agency acts inside its clients' tenants has decided, silently, that the link is a module of the application (#2617),\n * and one that never says suppliers come from the ERP has decided they are the application's own table.\n */\n organizationModel: z.strictObject({\n organizationTypes: z.array(z.strictObject({\n ref: DomainPlanOrganizationModelRefSchema,\n purpose: NonEmptyStringSchema,\n ownsApplication: z.boolean(),\n userTypes: z.array(NonEmptyStringSchema).min(1),\n offeredRoles: z.array(NonEmptyStringSchema).min(1),\n joining: z.enum(DomainPlanOrganizationJoining),\n requiresMfa: z.boolean(),\n })),\n relationshipKinds: z.array(z.strictObject({\n ref: DomainPlanOrganizationModelRefSchema,\n purpose: NonEmptyStringSchema,\n representingTypes: z.array(DomainPlanOrganizationModelRefSchema).min(1),\n grantingTypes: z.array(DomainPlanOrganizationModelRefSchema).min(1),\n mutual: z.boolean(),\n confersRoles: z.array(NonEmptyStringSchema).min(1),\n tenantRecords: z.enum(TenantRecordVisibility),\n })),\n unitConfinements: z.array(z.strictObject({\n resourceRef: NonEmptyStringSchema,\n mode: z.enum(OrganizationRowConfinementMode),\n fieldName: DomainPlanConfinementFieldNameSchema,\n })),\n recordLocations: z.array(z.strictObject({\n resourceRef: NonEmptyStringSchema,\n location: z.enum(DomainPlanRecordLocation),\n systemOfRecordKind: DomainPlanSystemOfRecordKindSchema.nullable(),\n access: z.enum(SystemOfRecordAccess).nullable(),\n /**\n * Whether the requirements split this system's records by legal entity (\"each subsidiary sees its own suppliers\",\n * #3045): `true` or `false` for a system of record, `null` for the application's own store. Only WHETHER: the field\n * the system splits on is the facet's, and the normalizer lays it down ({@link layDownDomainPlanRecordPartition}).\n */\n splitByLegalEntity: z.boolean().nullable(),\n })),\n }),\n modules: z.array(DomainPlanGeneratedModuleSchema).min(1),\n relationships: z.array(DomainRelationshipDraftGenerationSchema),\n});\nexport type DomainPlanOutputSetGeneration = z.infer<typeof DomainPlanOutputSetGenerationSchema>;\n\n/** What the HOST read that the domain-plan normalizer lays down (#3045). Every member optional: absent reads nothing. */\nexport interface DomainPlanGenerationNormalizationContext {\n /**\n * The system-of-record facets' partition fields, by kind, when the host could read the facet library. Absent, a split\n * the requirements state is recorded `UNCONFIRMED` rather than guessed.\n */\n readonly systemOfRecordPartitionFields?: DomainPlanSystemOfRecordPartitionFields | undefined;\n}\n\n/** Normalize a strict provider response into the permissive persisted contract. */\nexport function parseDomainPlanOutputSetGeneration(input: unknown, context: DomainPlanGenerationNormalizationContext = {}): DomainPlanOutputSet {\n const generated = DomainPlanOutputSetGenerationSchema.parse(input);\n return DomainPlanOutputSetSchema.parse({\n schemaVersion: generated.schemaVersion,\n tenancy: generated.tenancy,\n engineRealizedRequirements: generated.engineRealizedRequirements,\n lifecycles: generated.lifecycles.map((lifecycle) => ({\n ...lifecycle,\n transitions: lifecycle.transitions.map(({ createsResourceRef, stampsField, ...transition }) => ({\n ...transition,\n ...(createsResourceRef === null ? {} : { createsResourceRef }),\n ...(stampsField === null ? {} : { stampsField }),\n })),\n })),\n modules: generated.modules.map(({ businessDomain, ...module }) => ({\n ...module,\n ...(businessDomain === null ? {} : { businessDomain }),\n })),\n relationships: generated.relationships,\n organizationModel: {\n // `false` is the absent default, as for `mutual`.\n organizationTypes: generated.organizationModel.organizationTypes.map(({ requiresMfa, ...type }) => ({\n ...type,\n ...(requiresMfa ? { requiresMfa: true } : {}),\n })),\n // `false` is the absent default on the family schema, so it is not persisted: one spelling per statement.\n relationshipKinds: generated.organizationModel.relationshipKinds.map(({ mutual, ...kind }) => ({\n ...kind,\n ...(mutual ? { mutual: true } : {}),\n })),\n unitConfinements: generated.organizationModel.unitConfinements,\n /*\n * #3045: the partition is LAID DOWN here from the facets the host read, never taken from the model. An entry naming\n * no system is laid down against no kind (so it cannot be split) and is incomplete, which the validator reports. A\n * split stated on the application's own store is kept as a partition the validator refuses there, so the\n * contradiction reaches the model rather than being dropped.\n */\n recordLocations: generated.organizationModel.recordLocations.map(({ systemOfRecordKind, access, splitByLegalEntity, ...entry }) => ({\n ...entry,\n ...(systemOfRecordKind === null ? {} : { systemOfRecordKind }),\n ...(access === null ? {} : { access }),\n ...(splitByLegalEntity === null\n ? {}\n : layDownDomainPlanRecordPartition({ systemOfRecordKind: systemOfRecordKind ?? '', splitByLegalEntity, partitionFields: context.systemOfRecordPartitionFields })),\n })),\n },\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"domain-plan-output-set-generation.schemas.js","sourceRoot":"","sources":["../../../../src/_core/domain-plan/domain-plan-output-set-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,8BAA8B,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAErH,OAAO,EACL,oCAAoC,EACpC,6BAA6B,EAC7B,oCAAoC,EACpC,wBAAwB,EACxB,kCAAkC,EAClC,2BAA2B,EAC3B,yBAAyB,EACzB,sBAAsB,EACtB,mCAAmC,EACnC,iCAAiC,EACjC,yBAAyB,EACzB,yBAAyB,EACzB,iCAAiC,EACjC,gCAAgC,GAGjC,MAAM,kCAAkC,CAAC;AAE1C,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEtD,mFAAmF;AACnF,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,YAAY,CAAC;IAC5D,eAAe,EAAE,oBAAoB;IACrC,OAAO,EAAE,oBAAoB;IAC7B,kBAAkB,EAAE,oBAAoB;IACxC,cAAc,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IAC/C,a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,CAAC,CAAC;SACJ;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { z } from 'zod';\nimport { OrganizationRowConfinementMode, SystemOfRecordAccess, TenantRecordVisibility } from '@wildo-ai/saas-models';\n\nimport {\n DomainPlanConfinementFieldNameSchema,\n DomainPlanOrganizationJoining,\n DomainPlanOrganizationModelRefSchema,\n DomainPlanRecordLocation,\n DomainPlanSystemOfRecordKindSchema,\n DomainPlanEngineRealization,\n DomainPlanOutputSetSchema,\n DomainPlanTenancyModel,\n DomainRelationshipCardinalityIntent,\n DomainRelationshipOwnershipIntent,\n DomainTransitionPerformer,\n DomainTransitionRefSchema,\n DomainTransitionStampsFieldSchema,\n layDownDomainPlanRecordPartition,\n type DomainPlanOutputSet,\n type DomainPlanSystemOfRecordPartitionFields,\n} from './domain-plan-output-set.schemas';\n\nconst NonEmptyStringSchema = z.string().trim().min(1);\n\n/** Strict provider-facing module shape: every field must be emitted explicitly. */\nexport const DomainPlanGeneratedModuleSchema = z.strictObject({\n relatedModuleId: NonEmptyStringSchema,\n purpose: NonEmptyStringSchema,\n businessCapability: NonEmptyStringSchema,\n businessDomain: NonEmptyStringSchema.nullable(),\n primaryActors: z.array(NonEmptyStringSchema),\n mainResources: z.array(NonEmptyStringSchema),\n supportingResources: z.array(NonEmptyStringSchema),\n integrationSurfaces: z.array(NonEmptyStringSchema),\n});\nexport type DomainPlanGeneratedModule = z.infer<typeof DomainPlanGeneratedModuleSchema>;\n\n/** Strict provider-facing relationship shape used before permissive staging. */\nexport const DomainRelationshipDraftGenerationSchema = z.strictObject({\n relationshipRef: NonEmptyStringSchema,\n sourceResourceRef: NonEmptyStringSchema,\n targetResourceRef: NonEmptyStringSchema,\n cardinalityIntent: z.enum(DomainRelationshipCardinalityIntent),\n ownershipIntent: z.enum(DomainRelationshipOwnershipIntent),\n rationale: NonEmptyStringSchema,\n});\nexport type DomainRelationshipDraftGeneration = z.infer<typeof DomainRelationshipDraftGenerationSchema>;\n\n/** One indivisible provider response for both destination families. */\nexport const DomainPlanOutputSetGenerationSchema = z.strictObject({\n schemaVersion: z.literal(1),\n /**\n * REQUIRED here though optional on the family schema. A derivation that does not state its\n * tenancy has made the decision silently — and it does make one: wonder-crm's plan modelled a\n * workspace and a membership without ever being asked. Stating it is what lets a reviewer see the\n * decision, and what lets `bottom_up.foundation` stop re-asking a question the plan already answered.\n */\n tenancy: z.enum(DomainPlanTenancyModel),\n /**\n * REQUIRED here, and an empty list is an answer (#2492): the requirements met by what the engine\n * provides rather than by a module. Required for the same reason as `tenancy` — a plan that never says\n * a role requirement is the engine's has silently decided it is a module's, which is how an access-role\n * resource nothing reads came to be planned.\n */\n engineRealizedRequirements: z.array(z.strictObject({\n requirementRef: NonEmptyStringSchema,\n realization: z.enum(DomainPlanEngineRealization),\n rationale: NonEmptyStringSchema,\n })),\n /**\n * REQUIRED (#2491): the lifecycle of every resource that moves through states. An empty list is an\n * answer — that no resource does — and a plan that leaves it out has decided, silently, that every status\n * is a field users edit.\n */\n lifecycles: z.array(z.strictObject({\n resourceRef: NonEmptyStringSchema,\n states: z.array(NonEmptyStringSchema).min(2),\n initialState: NonEmptyStringSchema,\n transitions: z.array(z.strictObject({\n transitionRef: DomainTransitionRefSchema,\n from: z.array(NonEmptyStringSchema).min(1),\n to: NonEmptyStringSchema,\n performedBy: NonEmptyStringSchema,\n // Required here, optional on the stored plan (#3066): whether the step waits on someone other than the author.\n performer: z.enum(DomainTransitionPerformer),\n createsResourceRef: NonEmptyStringSchema.nullable(),\n stampsField: DomainTransitionStampsFieldSchema.nullable(),\n })).min(1),\n lockedStates: z.array(NonEmptyStringSchema),\n finalStates: z.array(NonEmptyStringSchema),\n })),\n /**\n * REQUIRED (#3032): the organizations, the relationship kinds between them, the confined records and the records held\n * in another system, every list allowed empty. Required for the same reason as `tenancy`: a plan that never says an\n * agency acts inside its clients' tenants has decided, silently, that the link is a module of the application (#2617),\n * and one that never says suppliers come from the ERP has decided they are the application's own table.\n */\n organizationModel: z.strictObject({\n organizationTypes: z.array(z.strictObject({\n ref: DomainPlanOrganizationModelRefSchema,\n purpose: NonEmptyStringSchema,\n ownsApplication: z.boolean(),\n userTypes: z.array(NonEmptyStringSchema).min(1),\n offeredRoles: z.array(NonEmptyStringSchema).min(1),\n joining: z.enum(DomainPlanOrganizationJoining),\n requiresMfa: z.boolean(),\n })),\n relationshipKinds: z.array(z.strictObject({\n ref: DomainPlanOrganizationModelRefSchema,\n purpose: NonEmptyStringSchema,\n representingTypes: z.array(DomainPlanOrganizationModelRefSchema).min(1),\n grantingTypes: z.array(DomainPlanOrganizationModelRefSchema).min(1),\n mutual: z.boolean(),\n confersRoles: z.array(NonEmptyStringSchema).min(1),\n // Empty when the representing side grants the granting side's own people nothing (#4057): the usual answer.\n delegatesMemberRoles: z.array(NonEmptyStringSchema),\n tenantRecords: z.enum(TenantRecordVisibility),\n })),\n unitConfinements: z.array(z.strictObject({\n resourceRef: NonEmptyStringSchema,\n mode: z.enum(OrganizationRowConfinementMode),\n fieldName: DomainPlanConfinementFieldNameSchema,\n })),\n recordLocations: z.array(z.strictObject({\n resourceRef: NonEmptyStringSchema,\n location: z.enum(DomainPlanRecordLocation),\n systemOfRecordKind: DomainPlanSystemOfRecordKindSchema.nullable(),\n access: z.enum(SystemOfRecordAccess).nullable(),\n /**\n * Whether the requirements split this system's records by legal entity (\"each subsidiary sees its own suppliers\",\n * #3045): `true` or `false` for a system of record, `null` for the application's own store. Only WHETHER: the field\n * the system splits on is the facet's, and the normalizer lays it down ({@link layDownDomainPlanRecordPartition}).\n */\n splitByLegalEntity: z.boolean().nullable(),\n })),\n }),\n modules: z.array(DomainPlanGeneratedModuleSchema).min(1),\n relationships: z.array(DomainRelationshipDraftGenerationSchema),\n});\nexport type DomainPlanOutputSetGeneration = z.infer<typeof DomainPlanOutputSetGenerationSchema>;\n\n/** What the HOST read that the domain-plan normalizer lays down (#3045). Every member optional: absent reads nothing. */\nexport interface DomainPlanGenerationNormalizationContext {\n /**\n * The system-of-record facets' partition fields, by kind, when the host could read the facet library. Absent, a split\n * the requirements state is recorded `UNCONFIRMED` rather than guessed.\n */\n readonly systemOfRecordPartitionFields?: DomainPlanSystemOfRecordPartitionFields | undefined;\n}\n\n/** Normalize a strict provider response into the permissive persisted contract. */\nexport function parseDomainPlanOutputSetGeneration(input: unknown, context: DomainPlanGenerationNormalizationContext = {}): DomainPlanOutputSet {\n const generated = DomainPlanOutputSetGenerationSchema.parse(input);\n return DomainPlanOutputSetSchema.parse({\n schemaVersion: generated.schemaVersion,\n tenancy: generated.tenancy,\n engineRealizedRequirements: generated.engineRealizedRequirements,\n lifecycles: generated.lifecycles.map((lifecycle) => ({\n ...lifecycle,\n transitions: lifecycle.transitions.map(({ createsResourceRef, stampsField, ...transition }) => ({\n ...transition,\n ...(createsResourceRef === null ? {} : { createsResourceRef }),\n ...(stampsField === null ? {} : { stampsField }),\n })),\n })),\n modules: generated.modules.map(({ businessDomain, ...module }) => ({\n ...module,\n ...(businessDomain === null ? {} : { businessDomain }),\n })),\n relationships: generated.relationships,\n organizationModel: {\n // `false` is the absent default, as for `mutual`.\n organizationTypes: generated.organizationModel.organizationTypes.map(({ requiresMfa, ...type }) => ({\n ...type,\n ...(requiresMfa ? { requiresMfa: true } : {}),\n })),\n // `false` is the absent default on the family schema, so it is not persisted: one spelling per statement.\n relationshipKinds: generated.organizationModel.relationshipKinds.map(({ mutual, delegatesMemberRoles, ...kind }) => ({\n ...kind,\n ...(mutual ? { mutual: true } : {}),\n // Empty is the absent default too (#4057).\n ...(delegatesMemberRoles.length > 0 ? { delegatesMemberRoles } : {}),\n })),\n unitConfinements: generated.organizationModel.unitConfinements,\n /*\n * #3045: the partition is LAID DOWN here from the facets the host read, never taken from the model. An entry naming\n * no system is laid down against no kind (so it cannot be split) and is incomplete, which the validator reports. A\n * split stated on the application's own store is kept as a partition the validator refuses there, so the\n * contradiction reaches the model rather than being dropped.\n */\n recordLocations: generated.organizationModel.recordLocations.map(({ systemOfRecordKind, access, splitByLegalEntity, ...entry }) => ({\n ...entry,\n ...(systemOfRecordKind === null ? {} : { systemOfRecordKind }),\n ...(access === null ? {} : { access }),\n ...(splitByLegalEntity === null\n ? {}\n : layDownDomainPlanRecordPartition({ systemOfRecordKind: systemOfRecordKind ?? '', splitByLegalEntity, partitionFields: context.systemOfRecordPartitionFields })),\n })),\n },\n });\n}\n"]}
|
|
@@ -617,6 +617,8 @@ function describeRelationshipKindViolation(violation) {
|
|
|
617
617
|
return 'The operating organization\'s type represents beside other types, competing with the organizations whose platform it runs. Make the operator the only representing type (the operator is the party), or take it off the representing side (independent parties).';
|
|
618
618
|
case OrganizationRelationshipKindViolation.INVITATIONS_WITHOUT_REPRESENTING_PROPOSALS:
|
|
619
619
|
return 'Invitations are the representing side\'s proposals: let that side propose.';
|
|
620
|
+
case OrganizationRelationshipKindViolation.DELEGATED_MEMBER_ROLE_NOT_CONFERRED:
|
|
621
|
+
return 'The representing side may grant the granting side\'s own members only a role the kind confers: list it in confersRoles, or remove it from delegatesMemberRoles.';
|
|
620
622
|
}
|
|
621
623
|
}
|
|
622
624
|
function groupIndexes(values) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-plan-output-set-validation.js","sourceRoot":"","sources":["../../../../src/_core/domain-plan/domain-plan-output-set-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,gCAAgC,EAChC,6CAA6C,EAC7C,gDAAgD,EAChD,oBAAoB,EACpB,cAAc,EACd,0BAA0B,EAC1B,yBAAyB,EACzB,qCAAqC,EACrC,8BAA8B,EAC9B,4CAA4C,EAC5C,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,EAC7B,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,2CAA2C,EAC3C,wCAAwC,EACxC,mCAAmC,EACnC,iCAAiC,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,OAAe,EACf,WAAqB;IAErB,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,iCAAiC,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;AACvG,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n ALL_CORE_OPERATIONS,\n applicationOwnerOrganizationType,\n collectOrganizationRelationshipKindViolations,\n collectOrganizationTypeRoleDeclarationViolations,\n computeRoleHierarchy,\n CORE_ORG_ROLES,\n DEFAULT_ORGANIZATION_ROLES,\n isDelegatedCapabilityRole,\n OrganizationRelationshipKindViolation,\n OrganizationRowConfinementMode,\n OrganizationTypeRoleDeclarationViolationKind,\n SystemOfRecordAccess,\n} from '@wildo-ai/saas-models';\n\nimport {\n DomainPlanEngineRealization,\n DomainPlanOrganizationJoining,\n DomainPlanOutputSetSchema,\n DomainPlanRecordLocation,\n DomainPlanRecordPartition,\n DomainPlanTenancyModel,\n domainPlanRecordPartitionPartitionsInstance,\n projectDomainPlanOrganizationDeclaration,\n DomainRelationshipCardinalityIntent,\n DomainRelationshipOwnershipIntent,\n domainRelationshipOwnershipContradictsCardinality,\n domainRelationshipOwnershipRequiredByCardinality,\n type DomainPlanOrganizationModel,\n type DomainPlanOutputSet,\n} from './domain-plan-output-set.schemas';\n\nexport enum DomainPlanValidationIssueSeverity {\n ERROR = 'error',\n WARNING = 'warning',\n}\n\nexport enum DomainPlanValidationIssueCode {\n DUPLICATE_MODULE_ID = 'duplicate-module-id',\n DUPLICATE_RESOURCE_IN_MODULE_INVENTORY = 'duplicate-resource-in-module-inventory',\n RESOURCE_WITHOUT_MAIN_OWNER = 'resource-without-main-owner',\n RESOURCE_WITH_MULTIPLE_MAIN_OWNERS = 'resource-with-multiple-main-owners',\n DUPLICATE_RELATIONSHIP_REF = 'duplicate-relationship-ref',\n DUPLICATE_RELATIONSHIP = 'duplicate-relationship',\n RELATIONSHIP_ENDPOINTS_IDENTICAL = 'relationship-endpoints-identical',\n RELATIONSHIP_ENDPOINT_NOT_INVENTORIED = 'relationship-endpoint-not-inventoried',\n RELATIONSHIP_CARDINALITY_MISSING = 'relationship-cardinality-missing',\n RELATIONSHIP_OWNERSHIP_MISSING = 'relationship-ownership-missing',\n /**\n * A one-sided cardinality whose \"one\" end is said to hold the reference — e.g. `one-to-many` with\n * `source-holds-reference`. Read source → target, the many side holds the reference, so the two\n * intents cannot both be true. Refused here rather than left to the semantic judge, which used to\n * catch it as a GAP after the model had already spent its turn.\n */\n RELATIONSHIP_OWNERSHIP_CONTRADICTS_CARDINALITY = 'relationship-ownership-contradicts-cardinality',\n /** The same requirement left to the same engine concern twice (#2492): one of the entries says nothing. */\n DUPLICATE_ENGINE_REALIZED_REQUIREMENT = 'duplicate-engine-realized-requirement',\n /** #2491 — a lifecycle for a resource no module inventories: the build has nothing to attach it to. */\n LIFECYCLE_RESOURCE_NOT_INVENTORIED = 'lifecycle-resource-not-inventoried',\n /** Two lifecycles for one resource: a resource has one set of states. */\n DUPLICATE_LIFECYCLE = 'duplicate-lifecycle',\n /** A state named by `initialState`, a transition, `lockedStates` or `finalStates` that `states` does not declare. */\n LIFECYCLE_STATE_UNDECLARED = 'lifecycle-state-undeclared',\n /** One state listed twice in a lifecycle's `states`. */\n DUPLICATE_LIFECYCLE_STATE = 'duplicate-lifecycle-state',\n /**\n * A transition that starts from a FINAL state (#2491 review F3). A final state is TERMINAL, so a plan that also\n * moves the record out contradicts itself. Refused: the artifact would be untrue, whichever half was meant. A\n * state that only stops EDITS (an issued invoice later marked paid) is a locked state, which a transition may\n * leave.\n */\n LIFECYCLE_TRANSITION_FROM_FINAL_STATE = 'lifecycle-transition-from-final-state',\n /**\n * A transition named after a core operation (`update`, `delete`, …). The build turns a transition into an\n * operation of that name, which would collide with the core operation the resource already has and read as\n * built before anything ran (#2491 review). Name the business verb instead (`archive`, not `delete`).\n */\n LIFECYCLE_TRANSITION_NAMES_A_CORE_OPERATION = 'lifecycle-transition-names-a-core-operation',\n /**\n * A state listed as both locked and final. A WARNING: final already implies locked, so nothing is untrue, but\n * the list says less than it should about whether the record still moves on.\n */\n LIFECYCLE_STATE_LOCKED_AND_FINAL = 'lifecycle-state-locked-and-final',\n /** One verb declared twice on a lifecycle: it becomes ONE operation. */\n DUPLICATE_LIFECYCLE_TRANSITION = 'duplicate-lifecycle-transition',\n /** A conversion that creates a resource no module inventories. */\n LIFECYCLE_CONVERSION_TARGET_NOT_INVENTORIED = 'lifecycle-conversion-target-not-inventoried',\n /** #3032 — organization types declared on a plan whose tenancy is `users`: every user's data is their own, so there are no organizations to type. */\n ORGANIZATION_MODEL_WITHOUT_ORGANIZATIONS_TENANCY = 'organization-model-without-organizations-tenancy',\n /** One organization type ref declared twice. */\n DUPLICATE_ORGANIZATION_TYPE = 'duplicate-organization-type',\n /**\n * An organization type whose own roles the engine's startup check refuses (`collectOrganizationTypeRoleDeclarationViolations`,\n * run on the projected types): it does not offer `ORG_OWNER` (no door could found it with an owner) or `ORG_MEMBER`\n * (every member added without a role would be refused), or it offers a role no membership may hold (a delegated\n * capability, an engine handler-only role).\n */\n ORGANIZATION_TYPE_ROLES_REFUSED_BY_ENGINE = 'organization-type-roles-refused-by-engine',\n /**\n * Two `SELF_SERVICE` types sharing a user type. Signing up as that user type could found either, and the engine refuses\n * two types created at registration of one user type (`createOnUserTypeRegistration`): registration does not choose.\n */\n SELF_SERVICE_TYPES_SHARE_USER_TYPE = 'self-service-types-share-user-type',\n /** One relationship kind ref declared twice. */\n DUPLICATE_RELATIONSHIP_KIND = 'duplicate-relationship-kind',\n /** More than one type `ownsApplication`: the engine refuses two, since \"the operator\" would become a choice. */\n MULTIPLE_APPLICATION_OWNER_TYPES = 'multiple-application-owner-types',\n /**\n * The type that `ownsApplication` joins by `SELF_SERVICE`. The engine refuses a creation door on the operator's type\n * (`creationPolicy` or `selfServiceCreation` beside `ownsApplication`): every registrant would become a second operator.\n */\n APPLICATION_OWNER_TYPE_SELF_SERVICE = 'application-owner-type-self-service',\n /**\n * A relationship kind the engine's startup check refuses (`collectOrganizationRelationshipKindViolations`, run on the\n * plan's projected declaration): an undeclared side type, a conferred role a granting type does not offer or that reaches\n * `ORG_ADMIN`, a mutual kind whose sides differ, or the operator sharing the representing side with other types.\n */\n RELATIONSHIP_KIND_REFUSED_BY_ENGINE = 'relationship-kind-refused-by-engine',\n /**\n * A requirement left to `ORGANIZATION_RELATIONSHIPS` while the plan declares no relationship kind: the concern it\n * names would configure nothing.\n */\n ORGANIZATION_RELATIONSHIPS_REALIZATION_WITHOUT_KIND = 'organization-relationships-realization-without-kind',\n /** A WARNING: a relationship kind no requirement leaves to `ORGANIZATION_RELATIONSHIPS`, so nothing in the definition set asks for it. */\n RELATIONSHIP_KIND_WITHOUT_REQUIREMENT = 'relationship-kind-without-requirement',\n /**\n * #2617 — an inventoried resource named after a declared organization type or relationship kind: the organizations,\n * or the link between them, modelled as an application table beside the engine's own. An organization type's records\n * are organizations, and a relationship is the engine's `organizationRelationships`, never a junction of the application.\n */\n RESOURCE_DUPLICATES_ORGANIZATION_MODEL = 'resource-duplicates-organization-model',\n /**\n * A WARNING: an inventoried resource named after a declared relationship KIND. A link between organizations re-made as\n * a table is #2617's defect, but a kind's name is also an ordinary word (`service`, `engagement`) a product resource may\n * legitimately carry, so this asks for a rename of one or the other rather than refusing the plan.\n */\n RESOURCE_NAMED_AFTER_RELATIONSHIP_KIND = 'resource-named-after-relationship-kind',\n /**\n * Own-row confinement of a resource read through from a system of record. The engine refuses it at startup\n * (`OrganizationOwnRowsViolationKind.READ_THROUGH_RESOURCE`): the outside system owns those rows and their owner field.\n */\n OWN_ROWS_ON_READ_THROUGH_RESOURCE = 'own-rows-on-read-through-resource',\n /** A confinement or a record location for a resource no module inventories. */\n ORGANIZATION_MODEL_RESOURCE_NOT_INVENTORIED = 'organization-model-resource-not-inventoried',\n /** The same resource confined twice in the same mode. */\n DUPLICATE_UNIT_CONFINEMENT = 'duplicate-unit-confinement',\n /** Records confined to organization units on a plan whose tenancy is `users`: there is no organization to have units. */\n UNIT_CONFINEMENT_WITHOUT_ORGANIZATIONS_TENANCY = 'unit-confinement-without-organizations-tenancy',\n /** Two locations for one resource: its records live in one place. */\n DUPLICATE_RECORD_LOCATION = 'duplicate-record-location',\n /**\n * A system-of-record location without its facet, its access lane or its partition (#3045), an application-store location\n * carrying any of them, or a partition field that does not go with its partition (`BY_LEGAL_ENTITY` names the facet's\n * field, every other partition names none).\n */\n RECORD_LOCATION_INCOMPLETE = 'record-location-incomplete',\n /**\n * Two resources read from one system of record whose partitions disagree on whether the system's instance is\n * partitioned (#3045). The split is a property of the INSTANCE (`partition: true`), so every resource read from it is\n * split alike: one entry split by legal entity beside another not split states two instances where the build lays\n * down one.\n */\n RECORD_PARTITION_DISAGREES_WITHIN_SYSTEM = 'record-partition-disagrees-within-system',\n /**\n * A WARNING (#3045): the requirements split a system's records by legal entity and its facet declares no partition the\n * engine can confine on, so every member who may read the resource sees every entity's records. True, and a gap the\n * reader must know about: the plan says it rather than claiming a split.\n */\n RECORDS_CANNOT_BE_SPLIT = 'records-cannot-be-split',\n /**\n * A WARNING (#3045): a split by legal entity recorded while the facets could not be read, so no partition field was\n * laid down. The backend confirms it at startup, or refuses `partition: true` on a vendor declaring none.\n */\n RECORD_PARTITION_UNCONFIRMED = 'record-partition-unconfirmed',\n /**\n * A system of record on a plan whose organization types name no operator (`ownsApplication`). The engine stamps rows\n * read from a system of record with the owning organization's id, and refuses a configuration declaring one without it.\n */\n SYSTEM_OF_RECORD_WITHOUT_APPLICATION_OWNER = 'system-of-record-without-application-owner',\n}\n\nexport const DomainPlanValidationIssueSchema = z.object({\n code: z.enum(DomainPlanValidationIssueCode),\n severity: z.enum(DomainPlanValidationIssueSeverity),\n path: z.string().min(1),\n message: z.string().min(1),\n relatedRefs: z.array(z.string().min(1)),\n});\nexport type DomainPlanValidationIssue = z.infer<typeof DomainPlanValidationIssueSchema>;\n\nexport const DomainPlanOutputSetValidationResultSchema = z.object({\n valid: z.boolean(),\n issues: z.array(DomainPlanValidationIssueSchema),\n});\nexport type DomainPlanOutputSetValidationResult = z.infer<typeof DomainPlanOutputSetValidationResultSchema>;\n\n/**\n * Deterministic structural validation before semantic evaluation. It diagnoses\n * a staged payload; it neither accepts family state nor substitutes for the\n * required `domain-plan-coherent` evaluator.\n */\nexport function validateDomainPlanOutputSet(input: DomainPlanOutputSet): DomainPlanOutputSetValidationResult {\n const outputSet = DomainPlanOutputSetSchema.parse(input);\n const issues: DomainPlanValidationIssue[] = [];\n const moduleIndexesById = groupIndexes(outputSet.modules.map((module) => module.relatedModuleId));\n for (const [moduleId, indexes] of moduleIndexesById) {\n for (const duplicateIndex of indexes.slice(1)) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.DUPLICATE_MODULE_ID,\n `modules[${duplicateIndex}].relatedModuleId`,\n `Module id is declared more than once: ${moduleId}`,\n [moduleId],\n );\n }\n }\n\n /*\n * The inventory findings below are read by the model that has to correct the plan (#2341), so each one\n * points at the entry to change and says what the change is. The rule they enforce: a resource is MAIN\n * in exactly one module, and one module never lists a resource in both roles. So promoting a resource a\n * module lists as supporting is a MOVE, never only an add. Measured on app-creation-test-005: told only\n * \"has no main owning module\", the model added seven resources to `mainResources` and left all seven in\n * `supportingResources`, which spent an attempt on the both-roles refusal.\n */\n const mainOwnerIndexesByResource = new Map<string, Set<number>>();\n const supportingPositionsByResource = new Map<string, string[]>();\n const inventoriedResources = new Set<string>();\n outputSet.modules.forEach((module, moduleIndex) => {\n const mainPositions = new Map<string, string>();\n const supportingPositions = new Map<string, string>();\n module.mainResources.forEach((resourceRef, resourceIndex) => {\n inventoriedResources.add(resourceRef);\n const position = `modules[${moduleIndex}].mainResources[${resourceIndex}]`;\n const firstPosition = mainPositions.get(resourceRef);\n if (firstPosition !== undefined) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.DUPLICATE_RESOURCE_IN_MODULE_INVENTORY,\n position,\n `Resource is repeated in the module's main inventory: ${resourceRef} (first at ${firstPosition}). Remove the entry at ${position}.`,\n [module.relatedModuleId, resourceRef],\n );\n } else {\n mainPositions.set(resourceRef, position);\n }\n const owners = mainOwnerIndexesByResource.get(resourceRef) ?? new Set<number>();\n owners.add(moduleIndex);\n mainOwnerIndexesByResource.set(resourceRef, owners);\n });\n module.supportingResources.forEach((resourceRef, resourceIndex) => {\n inventoriedResources.add(resourceRef);\n const position = `modules[${moduleIndex}].supportingResources[${resourceIndex}]`;\n supportingPositionsByResource.set(resourceRef, [...(supportingPositionsByResource.get(resourceRef) ?? []), position]);\n const mainPosition = mainPositions.get(resourceRef);\n const firstPosition = supportingPositions.get(resourceRef);\n if (mainPosition !== undefined) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.DUPLICATE_RESOURCE_IN_MODULE_INVENTORY,\n position,\n `Resource is in both inventory roles of one module: ${resourceRef} is main at ${mainPosition} and supporting at ${position}. `\n + `A module lists a resource in one role only, and the main role wins: remove the supportingResources entry at ${position}.`,\n [module.relatedModuleId, resourceRef],\n );\n } else if (firstPosition !== undefined) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.DUPLICATE_RESOURCE_IN_MODULE_INVENTORY,\n position,\n `Resource is repeated in the module's supporting inventory: ${resourceRef} (first at ${firstPosition}). Remove the entry at ${position}.`,\n [module.relatedModuleId, resourceRef],\n );\n }\n if (firstPosition === undefined) supportingPositions.set(resourceRef, position);\n });\n });\n\n for (const resourceRef of [...inventoriedResources].sort()) {\n const owners = [...(mainOwnerIndexesByResource.get(resourceRef) ?? new Set<number>())].sort((left, right) => left - right);\n if (owners.length === 0) {\n // No main owner means every place the resource is listed is a supporting entry, so there is at least one.\n const supportingPositions = supportingPositionsByResource.get(resourceRef) ?? [];\n addIssue(\n issues,\n DomainPlanValidationIssueCode.RESOURCE_WITHOUT_MAIN_OWNER,\n supportingPositions[0] ?? 'modules',\n `Inventoried resource has no main owning module: ${resourceRef}, listed only as supporting at ${supportingPositions.join(', ')}. `\n + 'Every inventoried resource is main in exactly one module, and a module lists a resource in one role only. '\n + 'To make it main in a module that lists it as supporting, MOVE it: add it to that module\\'s mainResources and remove it from '\n + 'that module\\'s supportingResources in the same correction. To make another module its owner, add it to that module\\'s mainResources.',\n [resourceRef],\n );\n }\n if (owners.length > 1) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.RESOURCE_WITH_MULTIPLE_MAIN_OWNERS,\n `modules[${owners[1]}].mainResources`,\n `Resource has more than one main owning module: ${resourceRef}`,\n [resourceRef, ...owners.map((index) => outputSet.modules[index]!.relatedModuleId)],\n );\n }\n }\n\n const relationshipIndexesByRef = groupIndexes(outputSet.relationships.map((relationship) => relationship.relationshipRef));\n const relationshipIndexesByEndpoints = groupIndexes(\n outputSet.relationships.map((relationship) => [relationship.sourceResourceRef, relationship.targetResourceRef].sort().join('\\u0000')),\n );\n outputSet.relationships.forEach((relationship, relationshipIndex) => {\n const path = `relationships[${relationshipIndex}]`;\n const sameRefIndexes = relationshipIndexesByRef.get(relationship.relationshipRef) ?? [];\n if (sameRefIndexes.length > 1 && sameRefIndexes[0] !== relationshipIndex) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.DUPLICATE_RELATIONSHIP_REF,\n `${path}.relationshipRef`,\n `Relationship ref is declared more than once: ${relationship.relationshipRef}`,\n [relationship.relationshipRef],\n );\n }\n const endpointKey = [relationship.sourceResourceRef, relationship.targetResourceRef].sort().join('\\u0000');\n const sameEndpointIndexes = relationshipIndexesByEndpoints.get(endpointKey) ?? [];\n if (sameEndpointIndexes.length > 1 && sameEndpointIndexes[0] !== relationshipIndex) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.DUPLICATE_RELATIONSHIP,\n path,\n 'The same resource endpoints are related more than once.',\n [relationship.sourceResourceRef, relationship.targetResourceRef],\n );\n }\n if (relationship.sourceResourceRef === relationship.targetResourceRef) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.RELATIONSHIP_ENDPOINTS_IDENTICAL,\n path,\n 'A relationship must name two distinct resource endpoints.',\n [relationship.sourceResourceRef],\n );\n }\n for (const [field, resourceRef] of [['sourceResourceRef', relationship.sourceResourceRef], ['targetResourceRef', relationship.targetResourceRef]] as const) {\n if (!inventoriedResources.has(resourceRef)) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.RELATIONSHIP_ENDPOINT_NOT_INVENTORIED,\n `${path}.${field}`,\n `Relationship endpoint is absent from the module inventory: ${resourceRef}`,\n [relationship.relationshipRef, resourceRef],\n );\n }\n }\n if (relationship.cardinalityIntent === undefined) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.RELATIONSHIP_CARDINALITY_MISSING,\n `${path}.cardinalityIntent`,\n 'Relationship cardinality intent is required before semantic evaluation.',\n [relationship.relationshipRef],\n );\n }\n if (relationship.ownershipIntent === undefined) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.RELATIONSHIP_OWNERSHIP_MISSING,\n `${path}.ownershipIntent`,\n 'Relationship ownership intent is required before semantic evaluation.',\n [relationship.relationshipRef],\n );\n }\n if (domainRelationshipOwnershipContradictsCardinality(relationship)) {\n // Both are defined here: the predicate is false while either is undecided.\n const required = domainRelationshipOwnershipRequiredByCardinality(relationship.cardinalityIntent!)!;\n const reversed = relationship.cardinalityIntent === DomainRelationshipCardinalityIntent.ONE_TO_MANY\n ? DomainRelationshipCardinalityIntent.MANY_TO_ONE\n : DomainRelationshipCardinalityIntent.ONE_TO_MANY;\n addIssue(\n issues,\n DomainPlanValidationIssueCode.RELATIONSHIP_OWNERSHIP_CONTRADICTS_CARDINALITY,\n `${path}.ownershipIntent`,\n `Relationship \"${relationship.relationshipRef}\" says ${relationship.cardinalityIntent} from ${relationship.sourceResourceRef} (source) to `\n + `${relationship.targetResourceRef} (target) with ${relationship.ownershipIntent}. Cardinality is read source → target, and the \"many\" side `\n + `holds the reference, so ${relationship.cardinalityIntent} requires ${required}. If ${relationship.ownershipIntent === DomainRelationshipOwnershipIntent.SOURCE_HOLDS_REFERENCE ? relationship.sourceResourceRef : relationship.targetResourceRef} `\n + `really holds the reference, the cardinality is ${reversed}.`,\n [relationship.relationshipRef, relationship.sourceResourceRef, relationship.targetResourceRef],\n );\n }\n });\n\n const engineRealizationIndexes = groupIndexes(\n (outputSet.engineRealizedRequirements ?? []).map((entry) => `${entry.requirementRef}\\u0000${entry.realization}`),\n );\n for (const [key, indexes] of engineRealizationIndexes) {\n const [requirementRef, realization] = key.split('\\u0000') as [string, string];\n for (const duplicateIndex of indexes.slice(1)) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.DUPLICATE_ENGINE_REALIZED_REQUIREMENT,\n `engineRealizedRequirements[${duplicateIndex}]`,\n `Requirement \"${requirementRef}\" is left to ${realization} more than once (first at engineRealizedRequirements[${indexes[0]}]). Merge the rationales and remove the entry at engineRealizedRequirements[${duplicateIndex}].`,\n [requirementRef],\n );\n }\n }\n\n const lifecycleIndexesByResource = groupIndexes((outputSet.lifecycles ?? []).map((lifecycle) => lifecycle.resourceRef));\n (outputSet.lifecycles ?? []).forEach((lifecycle, lifecycleIndex) => {\n const path = `lifecycles[${lifecycleIndex}]`;\n if (!inventoriedResources.has(lifecycle.resourceRef)) {\n addIssue(issues, DomainPlanValidationIssueCode.LIFECYCLE_RESOURCE_NOT_INVENTORIED, `${path}.resourceRef`,\n `Lifecycle for \"${lifecycle.resourceRef}\", which no module inventories. Inventory the resource, or name the inventoried resource whose states these are.`,\n [lifecycle.resourceRef]);\n }\n const firstIndex = lifecycleIndexesByResource.get(lifecycle.resourceRef)?.[0];\n if (firstIndex !== undefined && firstIndex !== lifecycleIndex) {\n addIssue(issues, DomainPlanValidationIssueCode.DUPLICATE_LIFECYCLE, path,\n `\"${lifecycle.resourceRef}\" already has a lifecycle at lifecycles[${firstIndex}]. Merge the two into one.`,\n [lifecycle.resourceRef]);\n }\n const declared = new Set<string>();\n lifecycle.states.forEach((state, stateIndex) => {\n if (declared.has(state)) {\n addIssue(issues, DomainPlanValidationIssueCode.DUPLICATE_LIFECYCLE_STATE, `${path}.states[${stateIndex}]`,\n `State \"${state}\" of \"${lifecycle.resourceRef}\" is declared twice. Remove the entry at ${path}.states[${stateIndex}].`,\n [lifecycle.resourceRef, state]);\n }\n declared.add(state);\n });\n const requireDeclared = (state: string, statePath: string): void => {\n if (declared.has(state)) return;\n addIssue(issues, DomainPlanValidationIssueCode.LIFECYCLE_STATE_UNDECLARED, statePath,\n `\"${state}\" is not one of the states of \"${lifecycle.resourceRef}\" (${lifecycle.states.join(', ')}). Add it to ${path}.states, or name a declared state.`,\n [lifecycle.resourceRef, state]);\n };\n requireDeclared(lifecycle.initialState, `${path}.initialState`);\n (lifecycle.lockedStates ?? []).forEach((state, stateIndex) => requireDeclared(state, `${path}.lockedStates[${stateIndex}]`));\n lifecycle.finalStates.forEach((state, stateIndex) => requireDeclared(state, `${path}.finalStates[${stateIndex}]`));\n (lifecycle.lockedStates ?? []).forEach((state, stateIndex) => {\n if (!lifecycle.finalStates.includes(state)) return;\n issues.push({\n code: DomainPlanValidationIssueCode.LIFECYCLE_STATE_LOCKED_AND_FINAL,\n severity: DomainPlanValidationIssueSeverity.WARNING,\n path: `${path}.lockedStates[${stateIndex}]`,\n message: `\"${state}\" of \"${lifecycle.resourceRef}\" is listed as both locked and final. Keep it in finalStates if nothing moves the record out of it, otherwise only in lockedStates.`,\n relatedRefs: [lifecycle.resourceRef, state],\n });\n });\n const transitionIndexes = groupIndexes(lifecycle.transitions.map((transition) => transition.transitionRef));\n lifecycle.transitions.forEach((transition, transitionIndex) => {\n const transitionPath = `${path}.transitions[${transitionIndex}]`;\n transition.from.forEach((state, fromIndex) => {\n requireDeclared(state, `${transitionPath}.from[${fromIndex}]`);\n if (lifecycle.finalStates.includes(state)) {\n addIssue(issues, DomainPlanValidationIssueCode.LIFECYCLE_TRANSITION_FROM_FINAL_STATE, `${transitionPath}.from[${fromIndex}]`,\n `Transition \"${transition.transitionRef}\" of \"${lifecycle.resourceRef}\" starts from \"${state}\", which is a final state: nothing moves a record out of it. If the record only stops being edited there, move \"${state}\" to ${path}.lockedStates; otherwise remove it from this transition's \"from\".`,\n [lifecycle.resourceRef, transition.transitionRef, state]);\n }\n });\n requireDeclared(transition.to, `${transitionPath}.to`);\n if ((ALL_CORE_OPERATIONS as readonly string[]).includes(transition.transitionRef)) {\n addIssue(issues, DomainPlanValidationIssueCode.LIFECYCLE_TRANSITION_NAMES_A_CORE_OPERATION, `${transitionPath}.transitionRef`,\n `Transition \"${transition.transitionRef}\" of \"${lifecycle.resourceRef}\" has the name of a core operation every resource already has. Name the business verb (archive, close, cancel).`,\n [lifecycle.resourceRef, transition.transitionRef]);\n }\n const firstTransition = transitionIndexes.get(transition.transitionRef)?.[0];\n if (firstTransition !== undefined && firstTransition !== transitionIndex) {\n addIssue(issues, DomainPlanValidationIssueCode.DUPLICATE_LIFECYCLE_TRANSITION, transitionPath,\n `Transition \"${transition.transitionRef}\" of \"${lifecycle.resourceRef}\" is declared twice (first at ${path}.transitions[${firstTransition}]). One verb is one operation: list every starting state in one transition's \"from\".`,\n [lifecycle.resourceRef, transition.transitionRef]);\n }\n if (transition.createsResourceRef !== undefined && !inventoriedResources.has(transition.createsResourceRef)) {\n addIssue(issues, DomainPlanValidationIssueCode.LIFECYCLE_CONVERSION_TARGET_NOT_INVENTORIED, `${transitionPath}.createsResourceRef`,\n `Transition \"${transition.transitionRef}\" of \"${lifecycle.resourceRef}\" creates \"${transition.createsResourceRef}\", which no module inventories.`,\n [lifecycle.resourceRef, transition.createsResourceRef]);\n }\n });\n });\n\n validateOrganizationModel(outputSet, inventoriedResources, issues);\n\n issues.sort((left, right) => `${left.code}\\u0000${left.path}\\u0000${left.message}`.localeCompare(`${right.code}\\u0000${right.path}\\u0000${right.message}`));\n return DomainPlanOutputSetValidationResultSchema.parse({\n valid: !issues.some((issue) => issue.severity === DomainPlanValidationIssueSeverity.ERROR),\n issues,\n });\n}\n\n/**\n * The organization model (#3032): cross-references inside it, and the engine's own startup check on the relationship kinds\n * it projects to, so the plan cannot state a relationship arrangement the backend refuses when it starts. The other\n * startup refusals the plan can see (two operating types, a creation door on the operator's type, own rows on a\n * read-through resource, a system of record with no operator) are checked here by the same rule; what depends on facts\n * the plan does not carry (the line's default structure, the resources' fields) is left to the step that has them.\n *\n * The engine check runs against the CORE organization role table (`DEFAULT_ORGANIZATION_ROLES`'s `inheritFrom` walk) and\n * reads an application role, which the plan cannot see the table of, as declared with no ancestors, the way the\n * configuration-time check in `define-saas-config` does. A custom role that inherits `ORG_ADMIN` is therefore left to\n * the startup check, which runs the same collector against the live table. Unlike that site, the plan keeps the\n * `ORG_ADMIN` anchor: conferring `ORG_ADMIN` or `ORG_OWNER` itself is refused here.\n */\nfunction validateOrganizationModel(\n outputSet: DomainPlanOutputSet,\n inventoriedResources: ReadonlySet<string>,\n issues: DomainPlanValidationIssue[],\n): void {\n const model = outputSet.organizationModel;\n const realizationsOfRelationships = (outputSet.engineRealizedRequirements ?? [])\n .filter((entry) => entry.realization === DomainPlanEngineRealization.ORGANIZATION_RELATIONSHIPS);\n if (model === undefined) {\n realizationsOfRelationships.forEach((entry) => addIssue(issues, DomainPlanValidationIssueCode.ORGANIZATION_RELATIONSHIPS_REALIZATION_WITHOUT_KIND,\n 'organizationModel',\n `Requirement \"${entry.requirementRef}\" is left to ORGANIZATION_RELATIONSHIPS, but the plan has no organizationModel. Declare the organization types and the relationship kind that meets it in organizationModel.relationshipKinds.`,\n [entry.requirementRef]));\n return;\n }\n const usersTenancy = outputSet.tenancy === DomainPlanTenancyModel.USERS;\n if (usersTenancy && model.organizationTypes.length > 0) {\n addIssue(issues, DomainPlanValidationIssueCode.ORGANIZATION_MODEL_WITHOUT_ORGANIZATIONS_TENANCY, 'organizationModel.organizationTypes',\n 'The plan declares organization types while its tenancy is \"users\", where every person\\'s data is their own. Either the people work together in organizations (tenancy \"organizations\"), or there are no organization types.',\n model.organizationTypes.map((type) => type.ref));\n }\n\n for (const [ref, indexes] of groupIndexes(model.organizationTypes.map((type) => type.ref))) {\n for (const duplicateIndex of indexes.slice(1)) {\n addIssue(issues, DomainPlanValidationIssueCode.DUPLICATE_ORGANIZATION_TYPE, `organizationModel.organizationTypes[${duplicateIndex}].ref`,\n `Organization type \"${ref}\" is declared more than once (first at organizationModel.organizationTypes[${indexes[0]}]). Merge them.`, [ref]);\n }\n }\n const ownerIndexes = model.organizationTypes.flatMap((type, index) => (type.ownsApplication ? [index] : []));\n if (ownerIndexes.length > 1) {\n addIssue(issues, DomainPlanValidationIssueCode.MULTIPLE_APPLICATION_OWNER_TYPES, `organizationModel.organizationTypes[${ownerIndexes[1]}].ownsApplication`,\n `More than one organization type operates the application: ${ownerIndexes.map((index) => model.organizationTypes[index]!.ref).join(', ')}. The engine refuses two; keep ownsApplication on the one whose organization runs the application.`,\n ownerIndexes.map((index) => model.organizationTypes[index]!.ref));\n }\n model.organizationTypes.forEach((type, index) => {\n if (type.ownsApplication && type.joining === DomainPlanOrganizationJoining.SELF_SERVICE) {\n addIssue(issues, DomainPlanValidationIssueCode.APPLICATION_OWNER_TYPE_SELF_SERVICE, `organizationModel.organizationTypes[${index}].joining`,\n `Organization type \"${type.ref}\" operates the application and joins by SELF_SERVICE. The engine refuses a creation door on the operator's type, since every registrant would become a second operator. Use INVITATION_ONLY or DIRECTORY_PROVISIONED, and put self-service on the customers' type.`,\n [type.ref]);\n }\n });\n\n const declaration = projectDomainPlanOrganizationDeclaration(model);\n const typeIndexByRef = new Map(model.organizationTypes.map((type, index) => [type.ref, index] as const));\n /*\n * Each type's own roles, through the engine's startup collector. It reads the CORE role table only: an application role\n * the plan names is declared in a table the plan cannot see, so `UNDECLARED_ROLE` is left to startup, as the kind check\n * treats a custom role. The plan carries no `defaultMemberRole` or founding owner role, so the engine's defaults\n * (`ORG_MEMBER`, `ORG_OWNER`) are what every type must offer.\n */\n for (const violation of collectOrganizationTypeRoleDeclarationViolations({\n organizationTypes: declaration.organizationTypes,\n declaredOrganizationRoles: Object.keys(DEFAULT_ORGANIZATION_ROLES),\n })) {\n if (violation.kind === OrganizationTypeRoleDeclarationViolationKind.UNDECLARED_ROLE) continue;\n addIssue(issues, DomainPlanValidationIssueCode.ORGANIZATION_TYPE_ROLES_REFUSED_BY_ENGINE,\n `organizationModel.organizationTypes[${typeIndexByRef.get(violation.organizationType) ?? 0}].offeredRoles`,\n `Organization type \"${violation.organizationType}\" would be refused when the application starts (${violation.kind}, ${violation.role}). ${describeOrganizationTypeRoleViolation(violation.kind)}`,\n [violation.organizationType, violation.role]);\n }\n const selfServiceTypesByUserType = new Map<string, string[]>();\n for (const type of model.organizationTypes) {\n if (type.joining !== DomainPlanOrganizationJoining.SELF_SERVICE) continue;\n for (const userType of new Set(type.userTypes)) selfServiceTypesByUserType.set(userType, [...(selfServiceTypesByUserType.get(userType) ?? []), type.ref]);\n }\n for (const [userType, refs] of selfServiceTypesByUserType) {\n if (refs.length < 2) continue;\n addIssue(issues, DomainPlanValidationIssueCode.SELF_SERVICE_TYPES_SHARE_USER_TYPE, `organizationModel.organizationTypes[${typeIndexByRef.get(refs[1]!) ?? 0}].joining`,\n `Organization types ${refs.map((ref) => `\"${ref}\"`).join(', ')} all join by SELF_SERVICE for user type \"${userType}\": signing up could found any of them, and the engine refuses two types created at one user type's registration. Give each self-service type its own user type, or make all but one INVITATION_ONLY.`,\n [userType, ...refs]);\n }\n\n for (const [ref, indexes] of groupIndexes(model.relationshipKinds.map((kind) => kind.ref))) {\n for (const duplicateIndex of indexes.slice(1)) {\n addIssue(issues, DomainPlanValidationIssueCode.DUPLICATE_RELATIONSHIP_KIND, `organizationModel.relationshipKinds[${duplicateIndex}].ref`,\n `Relationship kind \"${ref}\" is declared more than once (first at organizationModel.relationshipKinds[${indexes[0]}]). Merge them.`, [ref]);\n }\n }\n const kindIndexByRef = new Map(model.relationshipKinds.map((kind, index) => [kind.ref, index] as const));\n for (const violation of collectOrganizationRelationshipKindViolations({\n kinds: declaration.organizationRelationships,\n organizationTypes: declaration.organizationTypes,\n ownerOrganizationType: applicationOwnerOrganizationType(declaration.organizationTypes),\n administrationAnchorRole: CORE_ORG_ROLES.ORG_ADMIN,\n organizationRoleHierarchy: (role) => (DEFAULT_ORGANIZATION_ROLES[role] ? computeRoleHierarchy(role, DEFAULT_ORGANIZATION_ROLES) : [role]),\n isDelegatedCapabilityRole,\n })) {\n addIssue(issues, DomainPlanValidationIssueCode.RELATIONSHIP_KIND_REFUSED_BY_ENGINE,\n `organizationModel.relationshipKinds[${kindIndexByRef.get(violation.kind) ?? 0}]`,\n `Relationship kind \"${violation.kind}\" would be refused when the application starts (${violation.violation}, ${violation.subject}). ${describeRelationshipKindViolation(violation.violation)}`,\n [violation.kind, violation.subject]);\n }\n\n realizationsOfRelationships.forEach((entry) => {\n if (model.relationshipKinds.length > 0) return;\n addIssue(issues, DomainPlanValidationIssueCode.ORGANIZATION_RELATIONSHIPS_REALIZATION_WITHOUT_KIND, 'organizationModel.relationshipKinds',\n `Requirement \"${entry.requirementRef}\" is left to ORGANIZATION_RELATIONSHIPS, but organizationModel.relationshipKinds is empty. Declare the kind that meets it: which types represent, which grant, what it confers and what representatives see.`,\n [entry.requirementRef]);\n });\n if (outputSet.engineRealizedRequirements !== undefined && realizationsOfRelationships.length === 0) {\n model.relationshipKinds.forEach((kind, index) => issues.push({\n code: DomainPlanValidationIssueCode.RELATIONSHIP_KIND_WITHOUT_REQUIREMENT,\n severity: DomainPlanValidationIssueSeverity.WARNING,\n path: `organizationModel.relationshipKinds[${index}]`,\n message: `Relationship kind \"${kind.ref}\" is declared, but no requirement is left to ORGANIZATION_RELATIONSHIPS. Cite the requirement it meets in engineRealizedRequirements, or remove the kind.`,\n relatedRefs: [kind.ref],\n }));\n }\n\n /*\n * #2617: a resource carrying the name of an organization type or a relationship kind is the organizations, or the link\n * between them, re-made as an application table. Matched on the exact ref and its plain plural, the only spellings a\n * plan uses for the same concept; a junction named some other way is the semantic judge's (engine-concern discipline).\n */\n const typeRefs = new Set(model.organizationTypes.map((type) => type.ref));\n const kindRefs = new Set(model.relationshipKinds.map((kind) => kind.ref));\n for (const resourceRef of [...inventoriedResources].sort()) {\n const singulars = [resourceRef, resourceRef.replace(/ies$/, 'y'), resourceRef.replace(/es$/, ''), resourceRef.replace(/s$/, '')];\n const typeRef = singulars.find((candidate) => typeRefs.has(candidate));\n if (typeRef !== undefined) {\n addIssue(issues, DomainPlanValidationIssueCode.RESOURCE_DUPLICATES_ORGANIZATION_MODEL, 'modules',\n `Resource \"${resourceRef}\" is inventoried beside the organization type \"${typeRef}\". An organization type's records are organizations, which the engine holds with their members, roles and the relationships between them; an application table for them duplicates the tenant itself. Remove the resource and keep the organization type.`,\n [resourceRef, typeRef]);\n continue;\n }\n const kindRef = singulars.find((candidate) => kindRefs.has(candidate));\n if (kindRef === undefined) continue;\n issues.push({\n code: DomainPlanValidationIssueCode.RESOURCE_NAMED_AFTER_RELATIONSHIP_KIND,\n severity: DomainPlanValidationIssueSeverity.WARNING,\n path: 'modules',\n message: `Resource \"${resourceRef}\" carries the name of the relationship kind \"${kindRef}\". If it records which organization acts for which, remove it: the relationship kind is that record, with consent, a role ceiling, record separation and an audit of the representative's actions. If it is a product record of its own (a catalogue of services), rename the kind or the resource so the two cannot be read as one.`,\n relatedRefs: [resourceRef, kindRef],\n });\n }\n\n const readThroughResources = new Set(model.recordLocations\n .filter((entry) => entry.location === DomainPlanRecordLocation.SYSTEM_OF_RECORD && entry.access === SystemOfRecordAccess.READ_THROUGH)\n .map((entry) => entry.resourceRef));\n const confinementIndexes = groupIndexes(model.unitConfinements.map((entry) => `${entry.resourceRef}\\u0000${entry.mode}`));\n model.unitConfinements.forEach((entry, index) => {\n const path = `organizationModel.unitConfinements[${index}]`;\n if (!inventoriedResources.has(entry.resourceRef)) {\n addIssue(issues, DomainPlanValidationIssueCode.ORGANIZATION_MODEL_RESOURCE_NOT_INVENTORIED, `${path}.resourceRef`,\n `Confinement of \"${entry.resourceRef}\", which no module inventories. Name an inventoried resource.`, [entry.resourceRef]);\n }\n const first = confinementIndexes.get(`${entry.resourceRef}\\u0000${entry.mode}`)?.[0];\n if (first !== undefined && first !== index) {\n addIssue(issues, DomainPlanValidationIssueCode.DUPLICATE_UNIT_CONFINEMENT, path,\n `\"${entry.resourceRef}\" is already confined in mode ${entry.mode} at organizationModel.unitConfinements[${first}]. Remove one.`, [entry.resourceRef]);\n }\n if (entry.mode === OrganizationRowConfinementMode.OWN_ROWS && readThroughResources.has(entry.resourceRef)) {\n addIssue(issues, DomainPlanValidationIssueCode.OWN_ROWS_ON_READ_THROUGH_RESOURCE, path,\n `\"${entry.resourceRef}\" is confined to own rows but read through from a system of record, which owns those rows and their owner field; the engine refuses the declaration at startup. Keep the rows in an owned copy (access OWNED_COPY), or drop the own-row confinement.`,\n [entry.resourceRef]);\n }\n if (usersTenancy) {\n addIssue(issues, DomainPlanValidationIssueCode.UNIT_CONFINEMENT_WITHOUT_ORGANIZATIONS_TENANCY, path,\n `\"${entry.resourceRef}\" is confined (${entry.mode}) while the plan's tenancy is \"users\": every person already sees only their own data, and there are no organization units.`,\n [entry.resourceRef]);\n }\n });\n\n const locationIndexes = groupIndexes(model.recordLocations.map((entry) => entry.resourceRef));\n model.recordLocations.forEach((entry, index) => {\n const path = `organizationModel.recordLocations[${index}]`;\n if (!inventoriedResources.has(entry.resourceRef)) {\n addIssue(issues, DomainPlanValidationIssueCode.ORGANIZATION_MODEL_RESOURCE_NOT_INVENTORIED, `${path}.resourceRef`,\n `Record location of \"${entry.resourceRef}\", which no module inventories. Name an inventoried resource.`, [entry.resourceRef]);\n }\n const first = locationIndexes.get(entry.resourceRef)?.[0];\n if (first !== undefined && first !== index) {\n addIssue(issues, DomainPlanValidationIssueCode.DUPLICATE_RECORD_LOCATION, path,\n `\"${entry.resourceRef}\" already has a location at organizationModel.recordLocations[${first}]. A resource's records live in one place.`, [entry.resourceRef]);\n }\n const atSystem = entry.location === DomainPlanRecordLocation.SYSTEM_OF_RECORD;\n if (atSystem && (entry.systemOfRecordKind === undefined || entry.access === undefined)) {\n addIssue(issues, DomainPlanValidationIssueCode.RECORD_LOCATION_INCOMPLETE, path,\n `\"${entry.resourceRef}\" lives in a system of record, so it names the system's facet (systemOfRecordKind, such as \"odoo\") and how it is reached (access: READ_THROUGH or OWNED_COPY).`,\n [entry.resourceRef]);\n }\n if (!atSystem && (entry.systemOfRecordKind !== undefined || entry.access !== undefined)) {\n addIssue(issues, DomainPlanValidationIssueCode.RECORD_LOCATION_INCOMPLETE, path,\n `\"${entry.resourceRef}\" lives in the application's store, so it names no system of record and no access lane. Remove them, or set location to SYSTEM_OF_RECORD.`,\n [entry.resourceRef]);\n }\n validateRecordPartition(issues, entry, path, atSystem);\n });\n /*\n * #3045: the split belongs to the system's INSTANCE, one per kind, so the entries of one kind must agree on whether it is\n * partitioned. Reported once per kind, naming every resource read from it.\n */\n const partitionedByKind = new Map<string, { partitioned: Set<boolean>; resources: string[] }>();\n for (const entry of model.recordLocations) {\n if (entry.location !== DomainPlanRecordLocation.SYSTEM_OF_RECORD || entry.systemOfRecordKind === undefined || entry.partition === undefined) continue;\n const known = partitionedByKind.get(entry.systemOfRecordKind) ?? { partitioned: new Set<boolean>(), resources: [] };\n known.partitioned.add(domainPlanRecordPartitionPartitionsInstance(entry.partition));\n known.resources.push(entry.resourceRef);\n partitionedByKind.set(entry.systemOfRecordKind, known);\n }\n for (const [kind, known] of partitionedByKind) {\n if (known.partitioned.size < 2) continue;\n addIssue(issues, DomainPlanValidationIssueCode.RECORD_PARTITION_DISAGREES_WITHIN_SYSTEM, 'organizationModel.recordLocations',\n `The resources read from the \"${kind}\" system disagree on whether its records are split by legal entity (${known.resources.join(', ')}). The split belongs to the system's instance, so every resource read from it is split alike: state the same split on each.`,\n known.resources);\n }\n /*\n * A system of record needs an operating organization: the engine stamps rows read from one with its id, and refuses a\n * configuration declaring one without a type that `ownsApplication` (`define-saas-config`). Checked where the plan can\n * see the answer: under `users` tenancy there is no organization at all, and with declared types the operator is the\n * one marked. With NO declared types the line's default structure decides the types, which this plan does not carry\n * (a single owner or an operator with clients has an operating type, customer tenants do not); that residual is the\n * foundation's to check when it lays the structure down, and it is left unreported here rather than guessed.\n */\n const declaresSystemOfRecord = model.recordLocations.some((entry) => entry.location === DomainPlanRecordLocation.SYSTEM_OF_RECORD);\n if (declaresSystemOfRecord && usersTenancy) {\n addIssue(issues, DomainPlanValidationIssueCode.SYSTEM_OF_RECORD_WITHOUT_APPLICATION_OWNER, 'organizationModel.recordLocations',\n 'Records live in a system of record, but the plan\\'s tenancy is \"users\": there is no organization to operate the application and own the rows read from it, and the engine refuses the configuration. Use tenancy \"organizations\" with a type that operates the application.',\n model.recordLocations.map((entry) => entry.resourceRef));\n } else if (declaresSystemOfRecord && model.organizationTypes.length > 0 && ownerIndexes.length === 0) {\n addIssue(issues, DomainPlanValidationIssueCode.SYSTEM_OF_RECORD_WITHOUT_APPLICATION_OWNER, 'organizationModel.organizationTypes',\n 'Records live in a system of record, but no organization type operates the application (ownsApplication). Rows read from a system of record belong to the operating organization, and the engine refuses the configuration without one. Mark the type whose organization runs the application.',\n model.organizationTypes.map((type) => type.ref));\n }\n}\n\n/**\n * One record location's partition (#3045): required on a system of record and absent on the application's store, with the\n * facet's field exactly when the records are split by legal entity, and a warning for each split the plan could not make\n * or could not confirm.\n */\nfunction validateRecordPartition(\n issues: DomainPlanValidationIssue[],\n entry: DomainPlanOrganizationModel['recordLocations'][number],\n path: string,\n atSystem: boolean,\n): void {\n if (!atSystem) {\n if (entry.partition !== undefined || entry.partitionField !== undefined) {\n addIssue(issues, DomainPlanValidationIssueCode.RECORD_LOCATION_INCOMPLETE, path,\n `\"${entry.resourceRef}\" lives in the application's store, so its records are not split by any outside system: state splitByLegalEntity null.`,\n [entry.resourceRef]);\n }\n return;\n }\n if (entry.partition === undefined) {\n addIssue(issues, DomainPlanValidationIssueCode.RECORD_LOCATION_INCOMPLETE, path,\n `\"${entry.resourceRef}\" lives in a system of record, so the plan says whether its records are split by legal entity (splitByLegalEntity true when the requirements give each company or subsidiary only its own records, false otherwise).`,\n [entry.resourceRef]);\n return;\n }\n const split = entry.partition === DomainPlanRecordPartition.BY_LEGAL_ENTITY;\n if (split !== (entry.partitionField !== undefined)) {\n addIssue(issues, DomainPlanValidationIssueCode.RECORD_LOCATION_INCOMPLETE, `${path}.partitionField`,\n split\n ? `\"${entry.resourceRef}\" is split by legal entity with no partition field. The field is the facet's own, laid down when the plan is normalized: the plan must not state a split without it.`\n : `\"${entry.resourceRef}\" names a partition field while its records are ${entry.partition}. Only a split by legal entity names the facet's field.`,\n [entry.resourceRef]);\n }\n if (entry.partition === DomainPlanRecordPartition.CANNOT_BE_SPLIT) {\n issues.push({\n code: DomainPlanValidationIssueCode.RECORDS_CANNOT_BE_SPLIT,\n severity: DomainPlanValidationIssueSeverity.WARNING,\n path,\n message: `The requirements split \"${entry.resourceRef}\" by legal entity, and the \"${entry.systemOfRecordKind ?? '(unnamed)'}\" system's facet declares no partition the engine can confine on: every member who may read it will see every entity's records. Keep them in a system whose facet declares a partition, or accept that the split is not made.`,\n relatedRefs: [entry.resourceRef],\n });\n }\n if (entry.partition === DomainPlanRecordPartition.UNCONFIRMED) {\n issues.push({\n code: DomainPlanValidationIssueCode.RECORD_PARTITION_UNCONFIRMED,\n severity: DomainPlanValidationIssueSeverity.WARNING,\n path,\n message: `\"${entry.resourceRef}\" is split by legal entity, and the system-of-record facets could not be read when the plan was written, so no partition field was laid down. The backend confirms the split at startup, or refuses it if the \"${entry.systemOfRecordKind ?? '(unnamed)'}\" facet declares none.`,\n relatedRefs: [entry.resourceRef],\n });\n }\n}\n\n/** What to change for each reason the engine refuses a type's own roles. Total over the engine's vocabulary (no default). */\nfunction describeOrganizationTypeRoleViolation(kind: OrganizationTypeRoleDeclarationViolationKind): string {\n switch (kind) {\n case OrganizationTypeRoleDeclarationViolationKind.UNDECLARED_ROLE:\n return 'Name a core role or one the application declares.';\n case OrganizationTypeRoleDeclarationViolationKind.ROLE_NOT_HOLDABLE_BY_A_MEMBERSHIP:\n return 'No membership may hold it (a delegated capability is lent by a dated grant; a handler-only role belongs to the engine): remove it from offeredRoles.';\n case OrganizationTypeRoleDeclarationViolationKind.DEFAULT_MEMBER_ROLE_NOT_OFFERED:\n return 'Every type offers ORG_MEMBER, the role a member added without one receives: add it to offeredRoles.';\n case OrganizationTypeRoleDeclarationViolationKind.FOUNDING_OWNER_ROLE_NOT_OFFERED:\n return 'Every type offers ORG_OWNER, the role of the person who founds an organization of it: add it to offeredRoles.';\n }\n}\n\n/** What to change for each reason the engine refuses a relationship kind. Total over the engine's vocabulary (no default). */\nfunction describeRelationshipKindViolation(violation: OrganizationRelationshipKindViolation): string {\n switch (violation) {\n case OrganizationRelationshipKindViolation.ORGANIZATION_TYPE_UNDECLARED:\n return 'A side names an organization type organizationModel.organizationTypes does not declare: declare it, or name a declared type.';\n case OrganizationRelationshipKindViolation.CONFERRED_ROLE_UNDECLARED:\n return 'A conferred role is unknown to the organization role table: name a core role or one the application declares.';\n case OrganizationRelationshipKindViolation.CONFERRED_ROLE_REACHES_ADMINISTRATION:\n return 'A relationship never confers administration of a tenant: confer a member-level role (ORG_REPRESENTATIVE, or the application\\'s own).';\n case OrganizationRelationshipKindViolation.CONFERRED_ROLE_IS_DELEGATED_CAPABILITY:\n return 'A delegated capability is lent by a dated grant, never conferred for a relationship\\'s life: remove it from confersRoles.';\n case OrganizationRelationshipKindViolation.CONFERRED_ROLE_UNAVAILABLE_IN_GRANTING_TYPE:\n return 'Every granting type must offer each conferred role: add it to that type\\'s offeredRoles, or confer another role.';\n case OrganizationRelationshipKindViolation.DEFAULT_ROLE_NOT_CONFERRED:\n return 'The first conferred role is the default role: list it in confersRoles.';\n case OrganizationRelationshipKindViolation.MUTUAL_SIDES_DIFFER:\n return 'A mutual kind lists the same types on both sides: make representingTypes and grantingTypes equal, or make the kind one-directional.';\n case OrganizationRelationshipKindViolation.MUTUAL_KIND_RESTRICTS_PROPOSING_SIDE:\n return 'A mutual kind lets both sides propose.';\n case OrganizationRelationshipKindViolation.OPERATOR_SHARES_REPRESENTING_SIDE:\n return 'The operating organization\\'s type represents beside other types, competing with the organizations whose platform it runs. Make the operator the only representing type (the operator is the party), or take it off the representing side (independent parties).';\n case OrganizationRelationshipKindViolation.INVITATIONS_WITHOUT_REPRESENTING_PROPOSALS:\n return 'Invitations are the representing side\\'s proposals: let that side propose.';\n }\n}\n\nfunction groupIndexes(values: readonly string[]): Map<string, number[]> {\n const grouped = new Map<string, number[]>();\n values.forEach((value, index) => grouped.set(value, [...(grouped.get(value) ?? []), index]));\n return grouped;\n}\n\nfunction addIssue(\n issues: DomainPlanValidationIssue[],\n code: DomainPlanValidationIssueCode,\n path: string,\n message: string,\n relatedRefs: string[],\n): void {\n issues.push({ code, severity: DomainPlanValidationIssueSeverity.ERROR, path, message, relatedRefs });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"domain-plan-output-set-validation.js","sourceRoot":"","sources":["../../../../src/_core/domain-plan/domain-plan-output-set-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,gCAAgC,EAChC,6CAA6C,EAC7C,gDAAgD,EAChD,oBAAoB,EACpB,cAAc,EACd,0BAA0B,EAC1B,yBAAyB,EACzB,qCAAqC,EACrC,8BAA8B,EAC9B,4CAA4C,EAC5C,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,EAC7B,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,2CAA2C,EAC3C,wCAAwC,EACxC,mCAAmC,EACnC,iCAAiC,EACjC,iDAAiD,EACjD,gDAAgD,GAGjD,MAAM,kCAAkC,CAAC;AAE1C,MAAM,CAAN,IAAY,iCAGX;AAHD,WAAY,iCAAiC;IAC3C,oDAAe,CAAA;IACf,wDAAmB,CAAA;AACrB,CAAC,EAHW,iCAAiC,KAAjC,iCAAiC,QAG5C;AAED,MAAM,CAAN,IAAY,6BA8IX;AA9ID,WAAY,6BAA6B;IACvC,4EAA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ALL_CORE_OPERATIONS,\n applicationOwnerOrganizationType,\n collectOrganizationRelationshipKindViolations,\n collectOrganizationTypeRoleDeclarationViolations,\n computeRoleHierarchy,\n CORE_ORG_ROLES,\n DEFAULT_ORGANIZATION_ROLES,\n isDelegatedCapabilityRole,\n OrganizationRelationshipKindViolation,\n OrganizationRowConfinementMode,\n OrganizationTypeRoleDeclarationViolationKind,\n SystemOfRecordAccess,\n} from '@wildo-ai/saas-models';\n\nimport {\n DomainPlanEngineRealization,\n DomainPlanOrganizationJoining,\n DomainPlanOutputSetSchema,\n DomainPlanRecordLocation,\n DomainPlanRecordPartition,\n DomainPlanTenancyModel,\n domainPlanRecordPartitionPartitionsInstance,\n projectDomainPlanOrganizationDeclaration,\n DomainRelationshipCardinalityIntent,\n DomainRelationshipOwnershipIntent,\n domainRelationshipOwnershipContradictsCardinality,\n domainRelationshipOwnershipRequiredByCardinality,\n type DomainPlanOrganizationModel,\n type DomainPlanOutputSet,\n} from './domain-plan-output-set.schemas';\n\nexport enum DomainPlanValidationIssueSeverity {\n ERROR = 'error',\n WARNING = 'warning',\n}\n\nexport enum DomainPlanValidationIssueCode {\n DUPLICATE_MODULE_ID = 'duplicate-module-id',\n DUPLICATE_RESOURCE_IN_MODULE_INVENTORY = 'duplicate-resource-in-module-inventory',\n RESOURCE_WITHOUT_MAIN_OWNER = 'resource-without-main-owner',\n RESOURCE_WITH_MULTIPLE_MAIN_OWNERS = 'resource-with-multiple-main-owners',\n DUPLICATE_RELATIONSHIP_REF = 'duplicate-relationship-ref',\n DUPLICATE_RELATIONSHIP = 'duplicate-relationship',\n RELATIONSHIP_ENDPOINTS_IDENTICAL = 'relationship-endpoints-identical',\n RELATIONSHIP_ENDPOINT_NOT_INVENTORIED = 'relationship-endpoint-not-inventoried',\n RELATIONSHIP_CARDINALITY_MISSING = 'relationship-cardinality-missing',\n RELATIONSHIP_OWNERSHIP_MISSING = 'relationship-ownership-missing',\n /**\n * A one-sided cardinality whose \"one\" end is said to hold the reference — e.g. `one-to-many` with\n * `source-holds-reference`. Read source → target, the many side holds the reference, so the two\n * intents cannot both be true. Refused here rather than left to the semantic judge, which used to\n * catch it as a GAP after the model had already spent its turn.\n */\n RELATIONSHIP_OWNERSHIP_CONTRADICTS_CARDINALITY = 'relationship-ownership-contradicts-cardinality',\n /** The same requirement left to the same engine concern twice (#2492): one of the entries says nothing. */\n DUPLICATE_ENGINE_REALIZED_REQUIREMENT = 'duplicate-engine-realized-requirement',\n /** #2491 — a lifecycle for a resource no module inventories: the build has nothing to attach it to. */\n LIFECYCLE_RESOURCE_NOT_INVENTORIED = 'lifecycle-resource-not-inventoried',\n /** Two lifecycles for one resource: a resource has one set of states. */\n DUPLICATE_LIFECYCLE = 'duplicate-lifecycle',\n /** A state named by `initialState`, a transition, `lockedStates` or `finalStates` that `states` does not declare. */\n LIFECYCLE_STATE_UNDECLARED = 'lifecycle-state-undeclared',\n /** One state listed twice in a lifecycle's `states`. */\n DUPLICATE_LIFECYCLE_STATE = 'duplicate-lifecycle-state',\n /**\n * A transition that starts from a FINAL state (#2491 review F3). A final state is TERMINAL, so a plan that also\n * moves the record out contradicts itself. Refused: the artifact would be untrue, whichever half was meant. A\n * state that only stops EDITS (an issued invoice later marked paid) is a locked state, which a transition may\n * leave.\n */\n LIFECYCLE_TRANSITION_FROM_FINAL_STATE = 'lifecycle-transition-from-final-state',\n /**\n * A transition named after a core operation (`update`, `delete`, …). The build turns a transition into an\n * operation of that name, which would collide with the core operation the resource already has and read as\n * built before anything ran (#2491 review). Name the business verb instead (`archive`, not `delete`).\n */\n LIFECYCLE_TRANSITION_NAMES_A_CORE_OPERATION = 'lifecycle-transition-names-a-core-operation',\n /**\n * A state listed as both locked and final. A WARNING: final already implies locked, so nothing is untrue, but\n * the list says less than it should about whether the record still moves on.\n */\n LIFECYCLE_STATE_LOCKED_AND_FINAL = 'lifecycle-state-locked-and-final',\n /** One verb declared twice on a lifecycle: it becomes ONE operation. */\n DUPLICATE_LIFECYCLE_TRANSITION = 'duplicate-lifecycle-transition',\n /** A conversion that creates a resource no module inventories. */\n LIFECYCLE_CONVERSION_TARGET_NOT_INVENTORIED = 'lifecycle-conversion-target-not-inventoried',\n /** #3032 — organization types declared on a plan whose tenancy is `users`: every user's data is their own, so there are no organizations to type. */\n ORGANIZATION_MODEL_WITHOUT_ORGANIZATIONS_TENANCY = 'organization-model-without-organizations-tenancy',\n /** One organization type ref declared twice. */\n DUPLICATE_ORGANIZATION_TYPE = 'duplicate-organization-type',\n /**\n * An organization type whose own roles the engine's startup check refuses (`collectOrganizationTypeRoleDeclarationViolations`,\n * run on the projected types): it does not offer `ORG_OWNER` (no door could found it with an owner) or `ORG_MEMBER`\n * (every member added without a role would be refused), or it offers a role no membership may hold (a delegated\n * capability, an engine handler-only role).\n */\n ORGANIZATION_TYPE_ROLES_REFUSED_BY_ENGINE = 'organization-type-roles-refused-by-engine',\n /**\n * Two `SELF_SERVICE` types sharing a user type. Signing up as that user type could found either, and the engine refuses\n * two types created at registration of one user type (`createOnUserTypeRegistration`): registration does not choose.\n */\n SELF_SERVICE_TYPES_SHARE_USER_TYPE = 'self-service-types-share-user-type',\n /** One relationship kind ref declared twice. */\n DUPLICATE_RELATIONSHIP_KIND = 'duplicate-relationship-kind',\n /** More than one type `ownsApplication`: the engine refuses two, since \"the operator\" would become a choice. */\n MULTIPLE_APPLICATION_OWNER_TYPES = 'multiple-application-owner-types',\n /**\n * The type that `ownsApplication` joins by `SELF_SERVICE`. The engine refuses a creation door on the operator's type\n * (`creationPolicy` or `selfServiceCreation` beside `ownsApplication`): every registrant would become a second operator.\n */\n APPLICATION_OWNER_TYPE_SELF_SERVICE = 'application-owner-type-self-service',\n /**\n * A relationship kind the engine's startup check refuses (`collectOrganizationRelationshipKindViolations`, run on the\n * plan's projected declaration): an undeclared side type, a conferred role a granting type does not offer or that reaches\n * `ORG_ADMIN`, a mutual kind whose sides differ, or the operator sharing the representing side with other types.\n */\n RELATIONSHIP_KIND_REFUSED_BY_ENGINE = 'relationship-kind-refused-by-engine',\n /**\n * A requirement left to `ORGANIZATION_RELATIONSHIPS` while the plan declares no relationship kind: the concern it\n * names would configure nothing.\n */\n ORGANIZATION_RELATIONSHIPS_REALIZATION_WITHOUT_KIND = 'organization-relationships-realization-without-kind',\n /** A WARNING: a relationship kind no requirement leaves to `ORGANIZATION_RELATIONSHIPS`, so nothing in the definition set asks for it. */\n RELATIONSHIP_KIND_WITHOUT_REQUIREMENT = 'relationship-kind-without-requirement',\n /**\n * #2617 — an inventoried resource named after a declared organization type or relationship kind: the organizations,\n * or the link between them, modelled as an application table beside the engine's own. An organization type's records\n * are organizations, and a relationship is the engine's `organizationRelationships`, never a junction of the application.\n */\n RESOURCE_DUPLICATES_ORGANIZATION_MODEL = 'resource-duplicates-organization-model',\n /**\n * A WARNING: an inventoried resource named after a declared relationship KIND. A link between organizations re-made as\n * a table is #2617's defect, but a kind's name is also an ordinary word (`service`, `engagement`) a product resource may\n * legitimately carry, so this asks for a rename of one or the other rather than refusing the plan.\n */\n RESOURCE_NAMED_AFTER_RELATIONSHIP_KIND = 'resource-named-after-relationship-kind',\n /**\n * Own-row confinement of a resource read through from a system of record. The engine refuses it at startup\n * (`OrganizationOwnRowsViolationKind.READ_THROUGH_RESOURCE`): the outside system owns those rows and their owner field.\n */\n OWN_ROWS_ON_READ_THROUGH_RESOURCE = 'own-rows-on-read-through-resource',\n /** A confinement or a record location for a resource no module inventories. */\n ORGANIZATION_MODEL_RESOURCE_NOT_INVENTORIED = 'organization-model-resource-not-inventoried',\n /** The same resource confined twice in the same mode. */\n DUPLICATE_UNIT_CONFINEMENT = 'duplicate-unit-confinement',\n /** Records confined to organization units on a plan whose tenancy is `users`: there is no organization to have units. */\n UNIT_CONFINEMENT_WITHOUT_ORGANIZATIONS_TENANCY = 'unit-confinement-without-organizations-tenancy',\n /** Two locations for one resource: its records live in one place. */\n DUPLICATE_RECORD_LOCATION = 'duplicate-record-location',\n /**\n * A system-of-record location without its facet, its access lane or its partition (#3045), an application-store location\n * carrying any of them, or a partition field that does not go with its partition (`BY_LEGAL_ENTITY` names the facet's\n * field, every other partition names none).\n */\n RECORD_LOCATION_INCOMPLETE = 'record-location-incomplete',\n /**\n * Two resources read from one system of record whose partitions disagree on whether the system's instance is\n * partitioned (#3045). The split is a property of the INSTANCE (`partition: true`), so every resource read from it is\n * split alike: one entry split by legal entity beside another not split states two instances where the build lays\n * down one.\n */\n RECORD_PARTITION_DISAGREES_WITHIN_SYSTEM = 'record-partition-disagrees-within-system',\n /**\n * A WARNING (#3045): the requirements split a system's records by legal entity and its facet declares no partition the\n * engine can confine on, so every member who may read the resource sees every entity's records. True, and a gap the\n * reader must know about: the plan says it rather than claiming a split.\n */\n RECORDS_CANNOT_BE_SPLIT = 'records-cannot-be-split',\n /**\n * A WARNING (#3045): a split by legal entity recorded while the facets could not be read, so no partition field was\n * laid down. The backend confirms it at startup, or refuses `partition: true` on a vendor declaring none.\n */\n RECORD_PARTITION_UNCONFIRMED = 'record-partition-unconfirmed',\n /**\n * A system of record on a plan whose organization types name no operator (`ownsApplication`). The engine stamps rows\n * read from a system of record with the owning organization's id, and refuses a configuration declaring one without it.\n */\n SYSTEM_OF_RECORD_WITHOUT_APPLICATION_OWNER = 'system-of-record-without-application-owner',\n}\n\nexport const DomainPlanValidationIssueSchema = z.object({\n code: z.enum(DomainPlanValidationIssueCode),\n severity: z.enum(DomainPlanValidationIssueSeverity),\n path: z.string().min(1),\n message: z.string().min(1),\n relatedRefs: z.array(z.string().min(1)),\n});\nexport type DomainPlanValidationIssue = z.infer<typeof DomainPlanValidationIssueSchema>;\n\nexport const DomainPlanOutputSetValidationResultSchema = z.object({\n valid: z.boolean(),\n issues: z.array(DomainPlanValidationIssueSchema),\n});\nexport type DomainPlanOutputSetValidationResult = z.infer<typeof DomainPlanOutputSetValidationResultSchema>;\n\n/**\n * Deterministic structural validation before semantic evaluation. It diagnoses\n * a staged payload; it neither accepts family state nor substitutes for the\n * required `domain-plan-coherent` evaluator.\n */\nexport function validateDomainPlanOutputSet(input: DomainPlanOutputSet): DomainPlanOutputSetValidationResult {\n const outputSet = DomainPlanOutputSetSchema.parse(input);\n const issues: DomainPlanValidationIssue[] = [];\n const moduleIndexesById = groupIndexes(outputSet.modules.map((module) => module.relatedModuleId));\n for (const [moduleId, indexes] of moduleIndexesById) {\n for (const duplicateIndex of indexes.slice(1)) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.DUPLICATE_MODULE_ID,\n `modules[${duplicateIndex}].relatedModuleId`,\n `Module id is declared more than once: ${moduleId}`,\n [moduleId],\n );\n }\n }\n\n /*\n * The inventory findings below are read by the model that has to correct the plan (#2341), so each one\n * points at the entry to change and says what the change is. The rule they enforce: a resource is MAIN\n * in exactly one module, and one module never lists a resource in both roles. So promoting a resource a\n * module lists as supporting is a MOVE, never only an add. Measured on app-creation-test-005: told only\n * \"has no main owning module\", the model added seven resources to `mainResources` and left all seven in\n * `supportingResources`, which spent an attempt on the both-roles refusal.\n */\n const mainOwnerIndexesByResource = new Map<string, Set<number>>();\n const supportingPositionsByResource = new Map<string, string[]>();\n const inventoriedResources = new Set<string>();\n outputSet.modules.forEach((module, moduleIndex) => {\n const mainPositions = new Map<string, string>();\n const supportingPositions = new Map<string, string>();\n module.mainResources.forEach((resourceRef, resourceIndex) => {\n inventoriedResources.add(resourceRef);\n const position = `modules[${moduleIndex}].mainResources[${resourceIndex}]`;\n const firstPosition = mainPositions.get(resourceRef);\n if (firstPosition !== undefined) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.DUPLICATE_RESOURCE_IN_MODULE_INVENTORY,\n position,\n `Resource is repeated in the module's main inventory: ${resourceRef} (first at ${firstPosition}). Remove the entry at ${position}.`,\n [module.relatedModuleId, resourceRef],\n );\n } else {\n mainPositions.set(resourceRef, position);\n }\n const owners = mainOwnerIndexesByResource.get(resourceRef) ?? new Set<number>();\n owners.add(moduleIndex);\n mainOwnerIndexesByResource.set(resourceRef, owners);\n });\n module.supportingResources.forEach((resourceRef, resourceIndex) => {\n inventoriedResources.add(resourceRef);\n const position = `modules[${moduleIndex}].supportingResources[${resourceIndex}]`;\n supportingPositionsByResource.set(resourceRef, [...(supportingPositionsByResource.get(resourceRef) ?? []), position]);\n const mainPosition = mainPositions.get(resourceRef);\n const firstPosition = supportingPositions.get(resourceRef);\n if (mainPosition !== undefined) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.DUPLICATE_RESOURCE_IN_MODULE_INVENTORY,\n position,\n `Resource is in both inventory roles of one module: ${resourceRef} is main at ${mainPosition} and supporting at ${position}. `\n + `A module lists a resource in one role only, and the main role wins: remove the supportingResources entry at ${position}.`,\n [module.relatedModuleId, resourceRef],\n );\n } else if (firstPosition !== undefined) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.DUPLICATE_RESOURCE_IN_MODULE_INVENTORY,\n position,\n `Resource is repeated in the module's supporting inventory: ${resourceRef} (first at ${firstPosition}). Remove the entry at ${position}.`,\n [module.relatedModuleId, resourceRef],\n );\n }\n if (firstPosition === undefined) supportingPositions.set(resourceRef, position);\n });\n });\n\n for (const resourceRef of [...inventoriedResources].sort()) {\n const owners = [...(mainOwnerIndexesByResource.get(resourceRef) ?? new Set<number>())].sort((left, right) => left - right);\n if (owners.length === 0) {\n // No main owner means every place the resource is listed is a supporting entry, so there is at least one.\n const supportingPositions = supportingPositionsByResource.get(resourceRef) ?? [];\n addIssue(\n issues,\n DomainPlanValidationIssueCode.RESOURCE_WITHOUT_MAIN_OWNER,\n supportingPositions[0] ?? 'modules',\n `Inventoried resource has no main owning module: ${resourceRef}, listed only as supporting at ${supportingPositions.join(', ')}. `\n + 'Every inventoried resource is main in exactly one module, and a module lists a resource in one role only. '\n + 'To make it main in a module that lists it as supporting, MOVE it: add it to that module\\'s mainResources and remove it from '\n + 'that module\\'s supportingResources in the same correction. To make another module its owner, add it to that module\\'s mainResources.',\n [resourceRef],\n );\n }\n if (owners.length > 1) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.RESOURCE_WITH_MULTIPLE_MAIN_OWNERS,\n `modules[${owners[1]}].mainResources`,\n `Resource has more than one main owning module: ${resourceRef}`,\n [resourceRef, ...owners.map((index) => outputSet.modules[index]!.relatedModuleId)],\n );\n }\n }\n\n const relationshipIndexesByRef = groupIndexes(outputSet.relationships.map((relationship) => relationship.relationshipRef));\n const relationshipIndexesByEndpoints = groupIndexes(\n outputSet.relationships.map((relationship) => [relationship.sourceResourceRef, relationship.targetResourceRef].sort().join('\\u0000')),\n );\n outputSet.relationships.forEach((relationship, relationshipIndex) => {\n const path = `relationships[${relationshipIndex}]`;\n const sameRefIndexes = relationshipIndexesByRef.get(relationship.relationshipRef) ?? [];\n if (sameRefIndexes.length > 1 && sameRefIndexes[0] !== relationshipIndex) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.DUPLICATE_RELATIONSHIP_REF,\n `${path}.relationshipRef`,\n `Relationship ref is declared more than once: ${relationship.relationshipRef}`,\n [relationship.relationshipRef],\n );\n }\n const endpointKey = [relationship.sourceResourceRef, relationship.targetResourceRef].sort().join('\\u0000');\n const sameEndpointIndexes = relationshipIndexesByEndpoints.get(endpointKey) ?? [];\n if (sameEndpointIndexes.length > 1 && sameEndpointIndexes[0] !== relationshipIndex) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.DUPLICATE_RELATIONSHIP,\n path,\n 'The same resource endpoints are related more than once.',\n [relationship.sourceResourceRef, relationship.targetResourceRef],\n );\n }\n if (relationship.sourceResourceRef === relationship.targetResourceRef) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.RELATIONSHIP_ENDPOINTS_IDENTICAL,\n path,\n 'A relationship must name two distinct resource endpoints.',\n [relationship.sourceResourceRef],\n );\n }\n for (const [field, resourceRef] of [['sourceResourceRef', relationship.sourceResourceRef], ['targetResourceRef', relationship.targetResourceRef]] as const) {\n if (!inventoriedResources.has(resourceRef)) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.RELATIONSHIP_ENDPOINT_NOT_INVENTORIED,\n `${path}.${field}`,\n `Relationship endpoint is absent from the module inventory: ${resourceRef}`,\n [relationship.relationshipRef, resourceRef],\n );\n }\n }\n if (relationship.cardinalityIntent === undefined) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.RELATIONSHIP_CARDINALITY_MISSING,\n `${path}.cardinalityIntent`,\n 'Relationship cardinality intent is required before semantic evaluation.',\n [relationship.relationshipRef],\n );\n }\n if (relationship.ownershipIntent === undefined) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.RELATIONSHIP_OWNERSHIP_MISSING,\n `${path}.ownershipIntent`,\n 'Relationship ownership intent is required before semantic evaluation.',\n [relationship.relationshipRef],\n );\n }\n if (domainRelationshipOwnershipContradictsCardinality(relationship)) {\n // Both are defined here: the predicate is false while either is undecided.\n const required = domainRelationshipOwnershipRequiredByCardinality(relationship.cardinalityIntent!)!;\n const reversed = relationship.cardinalityIntent === DomainRelationshipCardinalityIntent.ONE_TO_MANY\n ? DomainRelationshipCardinalityIntent.MANY_TO_ONE\n : DomainRelationshipCardinalityIntent.ONE_TO_MANY;\n addIssue(\n issues,\n DomainPlanValidationIssueCode.RELATIONSHIP_OWNERSHIP_CONTRADICTS_CARDINALITY,\n `${path}.ownershipIntent`,\n `Relationship \"${relationship.relationshipRef}\" says ${relationship.cardinalityIntent} from ${relationship.sourceResourceRef} (source) to `\n + `${relationship.targetResourceRef} (target) with ${relationship.ownershipIntent}. Cardinality is read source → target, and the \"many\" side `\n + `holds the reference, so ${relationship.cardinalityIntent} requires ${required}. If ${relationship.ownershipIntent === DomainRelationshipOwnershipIntent.SOURCE_HOLDS_REFERENCE ? relationship.sourceResourceRef : relationship.targetResourceRef} `\n + `really holds the reference, the cardinality is ${reversed}.`,\n [relationship.relationshipRef, relationship.sourceResourceRef, relationship.targetResourceRef],\n );\n }\n });\n\n const engineRealizationIndexes = groupIndexes(\n (outputSet.engineRealizedRequirements ?? []).map((entry) => `${entry.requirementRef}\\u0000${entry.realization}`),\n );\n for (const [key, indexes] of engineRealizationIndexes) {\n const [requirementRef, realization] = key.split('\\u0000') as [string, string];\n for (const duplicateIndex of indexes.slice(1)) {\n addIssue(\n issues,\n DomainPlanValidationIssueCode.DUPLICATE_ENGINE_REALIZED_REQUIREMENT,\n `engineRealizedRequirements[${duplicateIndex}]`,\n `Requirement \"${requirementRef}\" is left to ${realization} more than once (first at engineRealizedRequirements[${indexes[0]}]). Merge the rationales and remove the entry at engineRealizedRequirements[${duplicateIndex}].`,\n [requirementRef],\n );\n }\n }\n\n const lifecycleIndexesByResource = groupIndexes((outputSet.lifecycles ?? []).map((lifecycle) => lifecycle.resourceRef));\n (outputSet.lifecycles ?? []).forEach((lifecycle, lifecycleIndex) => {\n const path = `lifecycles[${lifecycleIndex}]`;\n if (!inventoriedResources.has(lifecycle.resourceRef)) {\n addIssue(issues, DomainPlanValidationIssueCode.LIFECYCLE_RESOURCE_NOT_INVENTORIED, `${path}.resourceRef`,\n `Lifecycle for \"${lifecycle.resourceRef}\", which no module inventories. Inventory the resource, or name the inventoried resource whose states these are.`,\n [lifecycle.resourceRef]);\n }\n const firstIndex = lifecycleIndexesByResource.get(lifecycle.resourceRef)?.[0];\n if (firstIndex !== undefined && firstIndex !== lifecycleIndex) {\n addIssue(issues, DomainPlanValidationIssueCode.DUPLICATE_LIFECYCLE, path,\n `\"${lifecycle.resourceRef}\" already has a lifecycle at lifecycles[${firstIndex}]. Merge the two into one.`,\n [lifecycle.resourceRef]);\n }\n const declared = new Set<string>();\n lifecycle.states.forEach((state, stateIndex) => {\n if (declared.has(state)) {\n addIssue(issues, DomainPlanValidationIssueCode.DUPLICATE_LIFECYCLE_STATE, `${path}.states[${stateIndex}]`,\n `State \"${state}\" of \"${lifecycle.resourceRef}\" is declared twice. Remove the entry at ${path}.states[${stateIndex}].`,\n [lifecycle.resourceRef, state]);\n }\n declared.add(state);\n });\n const requireDeclared = (state: string, statePath: string): void => {\n if (declared.has(state)) return;\n addIssue(issues, DomainPlanValidationIssueCode.LIFECYCLE_STATE_UNDECLARED, statePath,\n `\"${state}\" is not one of the states of \"${lifecycle.resourceRef}\" (${lifecycle.states.join(', ')}). Add it to ${path}.states, or name a declared state.`,\n [lifecycle.resourceRef, state]);\n };\n requireDeclared(lifecycle.initialState, `${path}.initialState`);\n (lifecycle.lockedStates ?? []).forEach((state, stateIndex) => requireDeclared(state, `${path}.lockedStates[${stateIndex}]`));\n lifecycle.finalStates.forEach((state, stateIndex) => requireDeclared(state, `${path}.finalStates[${stateIndex}]`));\n (lifecycle.lockedStates ?? []).forEach((state, stateIndex) => {\n if (!lifecycle.finalStates.includes(state)) return;\n issues.push({\n code: DomainPlanValidationIssueCode.LIFECYCLE_STATE_LOCKED_AND_FINAL,\n severity: DomainPlanValidationIssueSeverity.WARNING,\n path: `${path}.lockedStates[${stateIndex}]`,\n message: `\"${state}\" of \"${lifecycle.resourceRef}\" is listed as both locked and final. Keep it in finalStates if nothing moves the record out of it, otherwise only in lockedStates.`,\n relatedRefs: [lifecycle.resourceRef, state],\n });\n });\n const transitionIndexes = groupIndexes(lifecycle.transitions.map((transition) => transition.transitionRef));\n lifecycle.transitions.forEach((transition, transitionIndex) => {\n const transitionPath = `${path}.transitions[${transitionIndex}]`;\n transition.from.forEach((state, fromIndex) => {\n requireDeclared(state, `${transitionPath}.from[${fromIndex}]`);\n if (lifecycle.finalStates.includes(state)) {\n addIssue(issues, DomainPlanValidationIssueCode.LIFECYCLE_TRANSITION_FROM_FINAL_STATE, `${transitionPath}.from[${fromIndex}]`,\n `Transition \"${transition.transitionRef}\" of \"${lifecycle.resourceRef}\" starts from \"${state}\", which is a final state: nothing moves a record out of it. If the record only stops being edited there, move \"${state}\" to ${path}.lockedStates; otherwise remove it from this transition's \"from\".`,\n [lifecycle.resourceRef, transition.transitionRef, state]);\n }\n });\n requireDeclared(transition.to, `${transitionPath}.to`);\n if ((ALL_CORE_OPERATIONS as readonly string[]).includes(transition.transitionRef)) {\n addIssue(issues, DomainPlanValidationIssueCode.LIFECYCLE_TRANSITION_NAMES_A_CORE_OPERATION, `${transitionPath}.transitionRef`,\n `Transition \"${transition.transitionRef}\" of \"${lifecycle.resourceRef}\" has the name of a core operation every resource already has. Name the business verb (archive, close, cancel).`,\n [lifecycle.resourceRef, transition.transitionRef]);\n }\n const firstTransition = transitionIndexes.get(transition.transitionRef)?.[0];\n if (firstTransition !== undefined && firstTransition !== transitionIndex) {\n addIssue(issues, DomainPlanValidationIssueCode.DUPLICATE_LIFECYCLE_TRANSITION, transitionPath,\n `Transition \"${transition.transitionRef}\" of \"${lifecycle.resourceRef}\" is declared twice (first at ${path}.transitions[${firstTransition}]). One verb is one operation: list every starting state in one transition's \"from\".`,\n [lifecycle.resourceRef, transition.transitionRef]);\n }\n if (transition.createsResourceRef !== undefined && !inventoriedResources.has(transition.createsResourceRef)) {\n addIssue(issues, DomainPlanValidationIssueCode.LIFECYCLE_CONVERSION_TARGET_NOT_INVENTORIED, `${transitionPath}.createsResourceRef`,\n `Transition \"${transition.transitionRef}\" of \"${lifecycle.resourceRef}\" creates \"${transition.createsResourceRef}\", which no module inventories.`,\n [lifecycle.resourceRef, transition.createsResourceRef]);\n }\n });\n });\n\n validateOrganizationModel(outputSet, inventoriedResources, issues);\n\n issues.sort((left, right) => `${left.code}\\u0000${left.path}\\u0000${left.message}`.localeCompare(`${right.code}\\u0000${right.path}\\u0000${right.message}`));\n return DomainPlanOutputSetValidationResultSchema.parse({\n valid: !issues.some((issue) => issue.severity === DomainPlanValidationIssueSeverity.ERROR),\n issues,\n });\n}\n\n/**\n * The organization model (#3032): cross-references inside it, and the engine's own startup check on the relationship kinds\n * it projects to, so the plan cannot state a relationship arrangement the backend refuses when it starts. The other\n * startup refusals the plan can see (two operating types, a creation door on the operator's type, own rows on a\n * read-through resource, a system of record with no operator) are checked here by the same rule; what depends on facts\n * the plan does not carry (the line's default structure, the resources' fields) is left to the step that has them.\n *\n * The engine check runs against the CORE organization role table (`DEFAULT_ORGANIZATION_ROLES`'s `inheritFrom` walk) and\n * reads an application role, which the plan cannot see the table of, as declared with no ancestors, the way the\n * configuration-time check in `define-saas-config` does. A custom role that inherits `ORG_ADMIN` is therefore left to\n * the startup check, which runs the same collector against the live table. Unlike that site, the plan keeps the\n * `ORG_ADMIN` anchor: conferring `ORG_ADMIN` or `ORG_OWNER` itself is refused here.\n */\nfunction validateOrganizationModel(\n outputSet: DomainPlanOutputSet,\n inventoriedResources: ReadonlySet<string>,\n issues: DomainPlanValidationIssue[],\n): void {\n const model = outputSet.organizationModel;\n const realizationsOfRelationships = (outputSet.engineRealizedRequirements ?? [])\n .filter((entry) => entry.realization === DomainPlanEngineRealization.ORGANIZATION_RELATIONSHIPS);\n if (model === undefined) {\n realizationsOfRelationships.forEach((entry) => addIssue(issues, DomainPlanValidationIssueCode.ORGANIZATION_RELATIONSHIPS_REALIZATION_WITHOUT_KIND,\n 'organizationModel',\n `Requirement \"${entry.requirementRef}\" is left to ORGANIZATION_RELATIONSHIPS, but the plan has no organizationModel. Declare the organization types and the relationship kind that meets it in organizationModel.relationshipKinds.`,\n [entry.requirementRef]));\n return;\n }\n const usersTenancy = outputSet.tenancy === DomainPlanTenancyModel.USERS;\n if (usersTenancy && model.organizationTypes.length > 0) {\n addIssue(issues, DomainPlanValidationIssueCode.ORGANIZATION_MODEL_WITHOUT_ORGANIZATIONS_TENANCY, 'organizationModel.organizationTypes',\n 'The plan declares organization types while its tenancy is \"users\", where every person\\'s data is their own. Either the people work together in organizations (tenancy \"organizations\"), or there are no organization types.',\n model.organizationTypes.map((type) => type.ref));\n }\n\n for (const [ref, indexes] of groupIndexes(model.organizationTypes.map((type) => type.ref))) {\n for (const duplicateIndex of indexes.slice(1)) {\n addIssue(issues, DomainPlanValidationIssueCode.DUPLICATE_ORGANIZATION_TYPE, `organizationModel.organizationTypes[${duplicateIndex}].ref`,\n `Organization type \"${ref}\" is declared more than once (first at organizationModel.organizationTypes[${indexes[0]}]). Merge them.`, [ref]);\n }\n }\n const ownerIndexes = model.organizationTypes.flatMap((type, index) => (type.ownsApplication ? [index] : []));\n if (ownerIndexes.length > 1) {\n addIssue(issues, DomainPlanValidationIssueCode.MULTIPLE_APPLICATION_OWNER_TYPES, `organizationModel.organizationTypes[${ownerIndexes[1]}].ownsApplication`,\n `More than one organization type operates the application: ${ownerIndexes.map((index) => model.organizationTypes[index]!.ref).join(', ')}. The engine refuses two; keep ownsApplication on the one whose organization runs the application.`,\n ownerIndexes.map((index) => model.organizationTypes[index]!.ref));\n }\n model.organizationTypes.forEach((type, index) => {\n if (type.ownsApplication && type.joining === DomainPlanOrganizationJoining.SELF_SERVICE) {\n addIssue(issues, DomainPlanValidationIssueCode.APPLICATION_OWNER_TYPE_SELF_SERVICE, `organizationModel.organizationTypes[${index}].joining`,\n `Organization type \"${type.ref}\" operates the application and joins by SELF_SERVICE. The engine refuses a creation door on the operator's type, since every registrant would become a second operator. Use INVITATION_ONLY or DIRECTORY_PROVISIONED, and put self-service on the customers' type.`,\n [type.ref]);\n }\n });\n\n const declaration = projectDomainPlanOrganizationDeclaration(model);\n const typeIndexByRef = new Map(model.organizationTypes.map((type, index) => [type.ref, index] as const));\n /*\n * Each type's own roles, through the engine's startup collector. It reads the CORE role table only: an application role\n * the plan names is declared in a table the plan cannot see, so `UNDECLARED_ROLE` is left to startup, as the kind check\n * treats a custom role. The plan carries no `defaultMemberRole` or founding owner role, so the engine's defaults\n * (`ORG_MEMBER`, `ORG_OWNER`) are what every type must offer.\n */\n for (const violation of collectOrganizationTypeRoleDeclarationViolations({\n organizationTypes: declaration.organizationTypes,\n declaredOrganizationRoles: Object.keys(DEFAULT_ORGANIZATION_ROLES),\n })) {\n if (violation.kind === OrganizationTypeRoleDeclarationViolationKind.UNDECLARED_ROLE) continue;\n addIssue(issues, DomainPlanValidationIssueCode.ORGANIZATION_TYPE_ROLES_REFUSED_BY_ENGINE,\n `organizationModel.organizationTypes[${typeIndexByRef.get(violation.organizationType) ?? 0}].offeredRoles`,\n `Organization type \"${violation.organizationType}\" would be refused when the application starts (${violation.kind}, ${violation.role}). ${describeOrganizationTypeRoleViolation(violation.kind)}`,\n [violation.organizationType, violation.role]);\n }\n const selfServiceTypesByUserType = new Map<string, string[]>();\n for (const type of model.organizationTypes) {\n if (type.joining !== DomainPlanOrganizationJoining.SELF_SERVICE) continue;\n for (const userType of new Set(type.userTypes)) selfServiceTypesByUserType.set(userType, [...(selfServiceTypesByUserType.get(userType) ?? []), type.ref]);\n }\n for (const [userType, refs] of selfServiceTypesByUserType) {\n if (refs.length < 2) continue;\n addIssue(issues, DomainPlanValidationIssueCode.SELF_SERVICE_TYPES_SHARE_USER_TYPE, `organizationModel.organizationTypes[${typeIndexByRef.get(refs[1]!) ?? 0}].joining`,\n `Organization types ${refs.map((ref) => `\"${ref}\"`).join(', ')} all join by SELF_SERVICE for user type \"${userType}\": signing up could found any of them, and the engine refuses two types created at one user type's registration. Give each self-service type its own user type, or make all but one INVITATION_ONLY.`,\n [userType, ...refs]);\n }\n\n for (const [ref, indexes] of groupIndexes(model.relationshipKinds.map((kind) => kind.ref))) {\n for (const duplicateIndex of indexes.slice(1)) {\n addIssue(issues, DomainPlanValidationIssueCode.DUPLICATE_RELATIONSHIP_KIND, `organizationModel.relationshipKinds[${duplicateIndex}].ref`,\n `Relationship kind \"${ref}\" is declared more than once (first at organizationModel.relationshipKinds[${indexes[0]}]). Merge them.`, [ref]);\n }\n }\n const kindIndexByRef = new Map(model.relationshipKinds.map((kind, index) => [kind.ref, index] as const));\n for (const violation of collectOrganizationRelationshipKindViolations({\n kinds: declaration.organizationRelationships,\n organizationTypes: declaration.organizationTypes,\n ownerOrganizationType: applicationOwnerOrganizationType(declaration.organizationTypes),\n administrationAnchorRole: CORE_ORG_ROLES.ORG_ADMIN,\n organizationRoleHierarchy: (role) => (DEFAULT_ORGANIZATION_ROLES[role] ? computeRoleHierarchy(role, DEFAULT_ORGANIZATION_ROLES) : [role]),\n isDelegatedCapabilityRole,\n })) {\n addIssue(issues, DomainPlanValidationIssueCode.RELATIONSHIP_KIND_REFUSED_BY_ENGINE,\n `organizationModel.relationshipKinds[${kindIndexByRef.get(violation.kind) ?? 0}]`,\n `Relationship kind \"${violation.kind}\" would be refused when the application starts (${violation.violation}, ${violation.subject}). ${describeRelationshipKindViolation(violation.violation)}`,\n [violation.kind, violation.subject]);\n }\n\n realizationsOfRelationships.forEach((entry) => {\n if (model.relationshipKinds.length > 0) return;\n addIssue(issues, DomainPlanValidationIssueCode.ORGANIZATION_RELATIONSHIPS_REALIZATION_WITHOUT_KIND, 'organizationModel.relationshipKinds',\n `Requirement \"${entry.requirementRef}\" is left to ORGANIZATION_RELATIONSHIPS, but organizationModel.relationshipKinds is empty. Declare the kind that meets it: which types represent, which grant, what it confers and what representatives see.`,\n [entry.requirementRef]);\n });\n if (outputSet.engineRealizedRequirements !== undefined && realizationsOfRelationships.length === 0) {\n model.relationshipKinds.forEach((kind, index) => issues.push({\n code: DomainPlanValidationIssueCode.RELATIONSHIP_KIND_WITHOUT_REQUIREMENT,\n severity: DomainPlanValidationIssueSeverity.WARNING,\n path: `organizationModel.relationshipKinds[${index}]`,\n message: `Relationship kind \"${kind.ref}\" is declared, but no requirement is left to ORGANIZATION_RELATIONSHIPS. Cite the requirement it meets in engineRealizedRequirements, or remove the kind.`,\n relatedRefs: [kind.ref],\n }));\n }\n\n /*\n * #2617: a resource carrying the name of an organization type or a relationship kind is the organizations, or the link\n * between them, re-made as an application table. Matched on the exact ref and its plain plural, the only spellings a\n * plan uses for the same concept; a junction named some other way is the semantic judge's (engine-concern discipline).\n */\n const typeRefs = new Set(model.organizationTypes.map((type) => type.ref));\n const kindRefs = new Set(model.relationshipKinds.map((kind) => kind.ref));\n for (const resourceRef of [...inventoriedResources].sort()) {\n const singulars = [resourceRef, resourceRef.replace(/ies$/, 'y'), resourceRef.replace(/es$/, ''), resourceRef.replace(/s$/, '')];\n const typeRef = singulars.find((candidate) => typeRefs.has(candidate));\n if (typeRef !== undefined) {\n addIssue(issues, DomainPlanValidationIssueCode.RESOURCE_DUPLICATES_ORGANIZATION_MODEL, 'modules',\n `Resource \"${resourceRef}\" is inventoried beside the organization type \"${typeRef}\". An organization type's records are organizations, which the engine holds with their members, roles and the relationships between them; an application table for them duplicates the tenant itself. Remove the resource and keep the organization type.`,\n [resourceRef, typeRef]);\n continue;\n }\n const kindRef = singulars.find((candidate) => kindRefs.has(candidate));\n if (kindRef === undefined) continue;\n issues.push({\n code: DomainPlanValidationIssueCode.RESOURCE_NAMED_AFTER_RELATIONSHIP_KIND,\n severity: DomainPlanValidationIssueSeverity.WARNING,\n path: 'modules',\n message: `Resource \"${resourceRef}\" carries the name of the relationship kind \"${kindRef}\". If it records which organization acts for which, remove it: the relationship kind is that record, with consent, a role ceiling, record separation and an audit of the representative's actions. If it is a product record of its own (a catalogue of services), rename the kind or the resource so the two cannot be read as one.`,\n relatedRefs: [resourceRef, kindRef],\n });\n }\n\n const readThroughResources = new Set(model.recordLocations\n .filter((entry) => entry.location === DomainPlanRecordLocation.SYSTEM_OF_RECORD && entry.access === SystemOfRecordAccess.READ_THROUGH)\n .map((entry) => entry.resourceRef));\n const confinementIndexes = groupIndexes(model.unitConfinements.map((entry) => `${entry.resourceRef}\\u0000${entry.mode}`));\n model.unitConfinements.forEach((entry, index) => {\n const path = `organizationModel.unitConfinements[${index}]`;\n if (!inventoriedResources.has(entry.resourceRef)) {\n addIssue(issues, DomainPlanValidationIssueCode.ORGANIZATION_MODEL_RESOURCE_NOT_INVENTORIED, `${path}.resourceRef`,\n `Confinement of \"${entry.resourceRef}\", which no module inventories. Name an inventoried resource.`, [entry.resourceRef]);\n }\n const first = confinementIndexes.get(`${entry.resourceRef}\\u0000${entry.mode}`)?.[0];\n if (first !== undefined && first !== index) {\n addIssue(issues, DomainPlanValidationIssueCode.DUPLICATE_UNIT_CONFINEMENT, path,\n `\"${entry.resourceRef}\" is already confined in mode ${entry.mode} at organizationModel.unitConfinements[${first}]. Remove one.`, [entry.resourceRef]);\n }\n if (entry.mode === OrganizationRowConfinementMode.OWN_ROWS && readThroughResources.has(entry.resourceRef)) {\n addIssue(issues, DomainPlanValidationIssueCode.OWN_ROWS_ON_READ_THROUGH_RESOURCE, path,\n `\"${entry.resourceRef}\" is confined to own rows but read through from a system of record, which owns those rows and their owner field; the engine refuses the declaration at startup. Keep the rows in an owned copy (access OWNED_COPY), or drop the own-row confinement.`,\n [entry.resourceRef]);\n }\n if (usersTenancy) {\n addIssue(issues, DomainPlanValidationIssueCode.UNIT_CONFINEMENT_WITHOUT_ORGANIZATIONS_TENANCY, path,\n `\"${entry.resourceRef}\" is confined (${entry.mode}) while the plan's tenancy is \"users\": every person already sees only their own data, and there are no organization units.`,\n [entry.resourceRef]);\n }\n });\n\n const locationIndexes = groupIndexes(model.recordLocations.map((entry) => entry.resourceRef));\n model.recordLocations.forEach((entry, index) => {\n const path = `organizationModel.recordLocations[${index}]`;\n if (!inventoriedResources.has(entry.resourceRef)) {\n addIssue(issues, DomainPlanValidationIssueCode.ORGANIZATION_MODEL_RESOURCE_NOT_INVENTORIED, `${path}.resourceRef`,\n `Record location of \"${entry.resourceRef}\", which no module inventories. Name an inventoried resource.`, [entry.resourceRef]);\n }\n const first = locationIndexes.get(entry.resourceRef)?.[0];\n if (first !== undefined && first !== index) {\n addIssue(issues, DomainPlanValidationIssueCode.DUPLICATE_RECORD_LOCATION, path,\n `\"${entry.resourceRef}\" already has a location at organizationModel.recordLocations[${first}]. A resource's records live in one place.`, [entry.resourceRef]);\n }\n const atSystem = entry.location === DomainPlanRecordLocation.SYSTEM_OF_RECORD;\n if (atSystem && (entry.systemOfRecordKind === undefined || entry.access === undefined)) {\n addIssue(issues, DomainPlanValidationIssueCode.RECORD_LOCATION_INCOMPLETE, path,\n `\"${entry.resourceRef}\" lives in a system of record, so it names the system's facet (systemOfRecordKind, such as \"odoo\") and how it is reached (access: READ_THROUGH or OWNED_COPY).`,\n [entry.resourceRef]);\n }\n if (!atSystem && (entry.systemOfRecordKind !== undefined || entry.access !== undefined)) {\n addIssue(issues, DomainPlanValidationIssueCode.RECORD_LOCATION_INCOMPLETE, path,\n `\"${entry.resourceRef}\" lives in the application's store, so it names no system of record and no access lane. Remove them, or set location to SYSTEM_OF_RECORD.`,\n [entry.resourceRef]);\n }\n validateRecordPartition(issues, entry, path, atSystem);\n });\n /*\n * #3045: the split belongs to the system's INSTANCE, one per kind, so the entries of one kind must agree on whether it is\n * partitioned. Reported once per kind, naming every resource read from it.\n */\n const partitionedByKind = new Map<string, { partitioned: Set<boolean>; resources: string[] }>();\n for (const entry of model.recordLocations) {\n if (entry.location !== DomainPlanRecordLocation.SYSTEM_OF_RECORD || entry.systemOfRecordKind === undefined || entry.partition === undefined) continue;\n const known = partitionedByKind.get(entry.systemOfRecordKind) ?? { partitioned: new Set<boolean>(), resources: [] };\n known.partitioned.add(domainPlanRecordPartitionPartitionsInstance(entry.partition));\n known.resources.push(entry.resourceRef);\n partitionedByKind.set(entry.systemOfRecordKind, known);\n }\n for (const [kind, known] of partitionedByKind) {\n if (known.partitioned.size < 2) continue;\n addIssue(issues, DomainPlanValidationIssueCode.RECORD_PARTITION_DISAGREES_WITHIN_SYSTEM, 'organizationModel.recordLocations',\n `The resources read from the \"${kind}\" system disagree on whether its records are split by legal entity (${known.resources.join(', ')}). The split belongs to the system's instance, so every resource read from it is split alike: state the same split on each.`,\n known.resources);\n }\n /*\n * A system of record needs an operating organization: the engine stamps rows read from one with its id, and refuses a\n * configuration declaring one without a type that `ownsApplication` (`define-saas-config`). Checked where the plan can\n * see the answer: under `users` tenancy there is no organization at all, and with declared types the operator is the\n * one marked. With NO declared types the line's default structure decides the types, which this plan does not carry\n * (a single owner or an operator with clients has an operating type, customer tenants do not); that residual is the\n * foundation's to check when it lays the structure down, and it is left unreported here rather than guessed.\n */\n const declaresSystemOfRecord = model.recordLocations.some((entry) => entry.location === DomainPlanRecordLocation.SYSTEM_OF_RECORD);\n if (declaresSystemOfRecord && usersTenancy) {\n addIssue(issues, DomainPlanValidationIssueCode.SYSTEM_OF_RECORD_WITHOUT_APPLICATION_OWNER, 'organizationModel.recordLocations',\n 'Records live in a system of record, but the plan\\'s tenancy is \"users\": there is no organization to operate the application and own the rows read from it, and the engine refuses the configuration. Use tenancy \"organizations\" with a type that operates the application.',\n model.recordLocations.map((entry) => entry.resourceRef));\n } else if (declaresSystemOfRecord && model.organizationTypes.length > 0 && ownerIndexes.length === 0) {\n addIssue(issues, DomainPlanValidationIssueCode.SYSTEM_OF_RECORD_WITHOUT_APPLICATION_OWNER, 'organizationModel.organizationTypes',\n 'Records live in a system of record, but no organization type operates the application (ownsApplication). Rows read from a system of record belong to the operating organization, and the engine refuses the configuration without one. Mark the type whose organization runs the application.',\n model.organizationTypes.map((type) => type.ref));\n }\n}\n\n/**\n * One record location's partition (#3045): required on a system of record and absent on the application's store, with the\n * facet's field exactly when the records are split by legal entity, and a warning for each split the plan could not make\n * or could not confirm.\n */\nfunction validateRecordPartition(\n issues: DomainPlanValidationIssue[],\n entry: DomainPlanOrganizationModel['recordLocations'][number],\n path: string,\n atSystem: boolean,\n): void {\n if (!atSystem) {\n if (entry.partition !== undefined || entry.partitionField !== undefined) {\n addIssue(issues, DomainPlanValidationIssueCode.RECORD_LOCATION_INCOMPLETE, path,\n `\"${entry.resourceRef}\" lives in the application's store, so its records are not split by any outside system: state splitByLegalEntity null.`,\n [entry.resourceRef]);\n }\n return;\n }\n if (entry.partition === undefined) {\n addIssue(issues, DomainPlanValidationIssueCode.RECORD_LOCATION_INCOMPLETE, path,\n `\"${entry.resourceRef}\" lives in a system of record, so the plan says whether its records are split by legal entity (splitByLegalEntity true when the requirements give each company or subsidiary only its own records, false otherwise).`,\n [entry.resourceRef]);\n return;\n }\n const split = entry.partition === DomainPlanRecordPartition.BY_LEGAL_ENTITY;\n if (split !== (entry.partitionField !== undefined)) {\n addIssue(issues, DomainPlanValidationIssueCode.RECORD_LOCATION_INCOMPLETE, `${path}.partitionField`,\n split\n ? `\"${entry.resourceRef}\" is split by legal entity with no partition field. The field is the facet's own, laid down when the plan is normalized: the plan must not state a split without it.`\n : `\"${entry.resourceRef}\" names a partition field while its records are ${entry.partition}. Only a split by legal entity names the facet's field.`,\n [entry.resourceRef]);\n }\n if (entry.partition === DomainPlanRecordPartition.CANNOT_BE_SPLIT) {\n issues.push({\n code: DomainPlanValidationIssueCode.RECORDS_CANNOT_BE_SPLIT,\n severity: DomainPlanValidationIssueSeverity.WARNING,\n path,\n message: `The requirements split \"${entry.resourceRef}\" by legal entity, and the \"${entry.systemOfRecordKind ?? '(unnamed)'}\" system's facet declares no partition the engine can confine on: every member who may read it will see every entity's records. Keep them in a system whose facet declares a partition, or accept that the split is not made.`,\n relatedRefs: [entry.resourceRef],\n });\n }\n if (entry.partition === DomainPlanRecordPartition.UNCONFIRMED) {\n issues.push({\n code: DomainPlanValidationIssueCode.RECORD_PARTITION_UNCONFIRMED,\n severity: DomainPlanValidationIssueSeverity.WARNING,\n path,\n message: `\"${entry.resourceRef}\" is split by legal entity, and the system-of-record facets could not be read when the plan was written, so no partition field was laid down. The backend confirms the split at startup, or refuses it if the \"${entry.systemOfRecordKind ?? '(unnamed)'}\" facet declares none.`,\n relatedRefs: [entry.resourceRef],\n });\n }\n}\n\n/** What to change for each reason the engine refuses a type's own roles. Total over the engine's vocabulary (no default). */\nfunction describeOrganizationTypeRoleViolation(kind: OrganizationTypeRoleDeclarationViolationKind): string {\n switch (kind) {\n case OrganizationTypeRoleDeclarationViolationKind.UNDECLARED_ROLE:\n return 'Name a core role or one the application declares.';\n case OrganizationTypeRoleDeclarationViolationKind.ROLE_NOT_HOLDABLE_BY_A_MEMBERSHIP:\n return 'No membership may hold it (a delegated capability is lent by a dated grant; a handler-only role belongs to the engine): remove it from offeredRoles.';\n case OrganizationTypeRoleDeclarationViolationKind.DEFAULT_MEMBER_ROLE_NOT_OFFERED:\n return 'Every type offers ORG_MEMBER, the role a member added without one receives: add it to offeredRoles.';\n case OrganizationTypeRoleDeclarationViolationKind.FOUNDING_OWNER_ROLE_NOT_OFFERED:\n return 'Every type offers ORG_OWNER, the role of the person who founds an organization of it: add it to offeredRoles.';\n }\n}\n\n/** What to change for each reason the engine refuses a relationship kind. Total over the engine's vocabulary (no default). */\nfunction describeRelationshipKindViolation(violation: OrganizationRelationshipKindViolation): string {\n switch (violation) {\n case OrganizationRelationshipKindViolation.ORGANIZATION_TYPE_UNDECLARED:\n return 'A side names an organization type organizationModel.organizationTypes does not declare: declare it, or name a declared type.';\n case OrganizationRelationshipKindViolation.CONFERRED_ROLE_UNDECLARED:\n return 'A conferred role is unknown to the organization role table: name a core role or one the application declares.';\n case OrganizationRelationshipKindViolation.CONFERRED_ROLE_REACHES_ADMINISTRATION:\n return 'A relationship never confers administration of a tenant: confer a member-level role (ORG_REPRESENTATIVE, or the application\\'s own).';\n case OrganizationRelationshipKindViolation.CONFERRED_ROLE_IS_DELEGATED_CAPABILITY:\n return 'A delegated capability is lent by a dated grant, never conferred for a relationship\\'s life: remove it from confersRoles.';\n case OrganizationRelationshipKindViolation.CONFERRED_ROLE_UNAVAILABLE_IN_GRANTING_TYPE:\n return 'Every granting type must offer each conferred role: add it to that type\\'s offeredRoles, or confer another role.';\n case OrganizationRelationshipKindViolation.DEFAULT_ROLE_NOT_CONFERRED:\n return 'The first conferred role is the default role: list it in confersRoles.';\n case OrganizationRelationshipKindViolation.MUTUAL_SIDES_DIFFER:\n return 'A mutual kind lists the same types on both sides: make representingTypes and grantingTypes equal, or make the kind one-directional.';\n case OrganizationRelationshipKindViolation.MUTUAL_KIND_RESTRICTS_PROPOSING_SIDE:\n return 'A mutual kind lets both sides propose.';\n case OrganizationRelationshipKindViolation.OPERATOR_SHARES_REPRESENTING_SIDE:\n return 'The operating organization\\'s type represents beside other types, competing with the organizations whose platform it runs. Make the operator the only representing type (the operator is the party), or take it off the representing side (independent parties).';\n case OrganizationRelationshipKindViolation.INVITATIONS_WITHOUT_REPRESENTING_PROPOSALS:\n return 'Invitations are the representing side\\'s proposals: let that side propose.';\n case OrganizationRelationshipKindViolation.DELEGATED_MEMBER_ROLE_NOT_CONFERRED:\n return 'The representing side may grant the granting side\\'s own members only a role the kind confers: list it in confersRoles, or remove it from delegatesMemberRoles.';\n }\n}\n\nfunction groupIndexes(values: readonly string[]): Map<string, number[]> {\n const grouped = new Map<string, number[]>();\n values.forEach((value, index) => grouped.set(value, [...(grouped.get(value) ?? []), index]));\n return grouped;\n}\n\nfunction addIssue(\n issues: DomainPlanValidationIssue[],\n code: DomainPlanValidationIssueCode,\n path: string,\n message: string,\n relatedRefs: string[],\n): void {\n issues.push({ code, severity: DomainPlanValidationIssueSeverity.ERROR, path, message, relatedRefs });\n}\n"]}
|
|
@@ -475,6 +475,7 @@ export declare const DomainPlanRelationshipKindSchema: z.ZodObject<{
|
|
|
475
475
|
grantingTypes: z.ZodArray<z.ZodString>;
|
|
476
476
|
mutual: z.ZodOptional<z.ZodBoolean>;
|
|
477
477
|
confersRoles: z.ZodArray<z.ZodString>;
|
|
478
|
+
delegatesMemberRoles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
478
479
|
tenantRecords: z.ZodEnum<typeof TenantRecordVisibility>;
|
|
479
480
|
}, z.core.$strip>;
|
|
480
481
|
export type DomainPlanRelationshipKind = z.infer<typeof DomainPlanRelationshipKindSchema>;
|
|
@@ -545,6 +546,7 @@ export declare const DomainPlanOrganizationModelSchema: z.ZodObject<{
|
|
|
545
546
|
grantingTypes: z.ZodArray<z.ZodString>;
|
|
546
547
|
mutual: z.ZodOptional<z.ZodBoolean>;
|
|
547
548
|
confersRoles: z.ZodArray<z.ZodString>;
|
|
549
|
+
delegatesMemberRoles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
548
550
|
tenantRecords: z.ZodEnum<typeof TenantRecordVisibility>;
|
|
549
551
|
}, z.core.$strip>>;
|
|
550
552
|
unitConfinements: z.ZodArray<z.ZodObject<{
|
|
@@ -660,6 +662,7 @@ export declare const DomainPlanOutputSetSchema: z.ZodObject<{
|
|
|
660
662
|
grantingTypes: z.ZodArray<z.ZodString>;
|
|
661
663
|
mutual: z.ZodOptional<z.ZodBoolean>;
|
|
662
664
|
confersRoles: z.ZodArray<z.ZodString>;
|
|
665
|
+
delegatesMemberRoles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
663
666
|
tenantRecords: z.ZodEnum<typeof TenantRecordVisibility>;
|
|
664
667
|
}, z.core.$strip>>;
|
|
665
668
|
unitConfinements: z.ZodArray<z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-plan-output-set.schemas.d.ts","sourceRoot":"","sources":["../../../../src/_core/domain-plan/domain-plan-output-set.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,0BAA0B,CAAC;AAElC,OAAO,EAGL,KAAK,gBAAgB,EACrB,8BAA8B,EAC9B,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,6BAA6B,EACnC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAuC,KAAK,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAM/H,0EAA0E;AAC1E,eAAO,MAAM,iCAAiC,oCAAoC,CAAC;AAEnF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK9D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,oBAAY,mCAAmC;IAC7C,2HAA2H;IAC3H,UAAU,eAAe;IACzB;;;OAGG;IACH,WAAW,gBAAgB;IAC3B;;;;OAIG;IACH,WAAW,gBAAgB;IAC3B,+GAA+G;IAC/G,YAAY,iBAAiB;CAC9B;AAED;;;;;;GAMG;AACH,oBAAY,iCAAiC;IAC3C,sBAAsB,2BAA2B;IACjD,sBAAsB,2BAA2B;CAClD;AAED;;;;;GAKG;AACH,wBAAgB,gDAAgD,CAC9D,WAAW,EAAE,mCAAmC,GAC/C,iCAAiC,GAAG,SAAS,CAU/C;AAED;;;;GAIG;AACH,wBAAgB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CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAE5F;;;;;;;;GAQG;AACH,wBAAgB,wCAAwC,CAAC,KAAK,EAAE,2BAA2B,GAAG;IAC5F,QAAQ,CAAC,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC,CAAC;IACzI,QAAQ,CAAC,yBAAyB,EAAE,6BAA6B,CAAC;CACnE,CAoBA;AAED,kIAAkI;AAClI,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAChD,kGAAkG;IAClG,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,2BAA2B,GAAG,SAAS,0BAA0B,EAAE,CAO3H;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkCpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -555,6 +555,13 @@ export const DomainPlanRelationshipKindSchema = z.object({
|
|
|
555
555
|
* and never a delegated capability role: the engine refuses both.
|
|
556
556
|
*/
|
|
557
557
|
confersRoles: z.array(NonEmptyStringSchema).min(1),
|
|
558
|
+
/**
|
|
559
|
+
* The conferred roles the REPRESENTING organization may also grant to the granting organization's OWN members (#4057):
|
|
560
|
+
* "the firm recognises a client's in-house accountant". Only roles in {@link confersRoles}, and only when the plan's
|
|
561
|
+
* requirements say the granting side's own people take decisions the role guards, which its owner cannot grant them
|
|
562
|
+
* (the role carries the authority the relationship entrusts to the representing side). Absent or empty: none.
|
|
563
|
+
*/
|
|
564
|
+
delegatesMemberRoles: z.array(NonEmptyStringSchema).min(1).optional(),
|
|
558
565
|
/** What representatives see of the granting tenant's OWN records: every one their role reaches, or only those shared with the relationship. */
|
|
559
566
|
tenantRecords: z.enum(TenantRecordVisibility).systemEnum('TenantRecordVisibility'),
|
|
560
567
|
});
|
|
@@ -650,7 +657,11 @@ export function projectDomainPlanOrganizationDeclaration(model) {
|
|
|
650
657
|
representing: { organizationTypes: [...kind.representingTypes] },
|
|
651
658
|
granting: { organizationTypes: Object.fromEntries(kind.grantingTypes.map((type) => [type, {}])) },
|
|
652
659
|
...(kind.mutual === true ? { mutual: true } : {}),
|
|
653
|
-
confers: {
|
|
660
|
+
confers: {
|
|
661
|
+
roles: [...kind.confersRoles],
|
|
662
|
+
defaultRole: kind.confersRoles[0],
|
|
663
|
+
...(kind.delegatesMemberRoles?.length ? { delegatedMemberRoles: [...kind.delegatesMemberRoles] } : {}),
|
|
664
|
+
},
|
|
654
665
|
tenantRecords: kind.tenantRecords,
|
|
655
666
|
};
|
|
656
667
|
}
|