@api-client/core 0.19.29 → 0.19.31

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.
Files changed (38) hide show
  1. package/build/src/modeling/DomainAssociation.d.ts +4 -4
  2. package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
  3. package/build/src/modeling/DomainAssociation.js.map +1 -1
  4. package/build/src/modeling/ai/domain_response_schema.d.ts +4 -2
  5. package/build/src/modeling/ai/domain_response_schema.d.ts.map +1 -1
  6. package/build/src/modeling/ai/domain_response_schema.js +1 -1
  7. package/build/src/modeling/ai/domain_response_schema.js.map +1 -1
  8. package/build/src/modeling/ai/types.d.ts +2 -3
  9. package/build/src/modeling/ai/types.d.ts.map +1 -1
  10. package/build/src/modeling/ai/types.js.map +1 -1
  11. package/build/src/modeling/amf/ShapeGenerator.js +1 -1
  12. package/build/src/modeling/amf/ShapeGenerator.js.map +1 -1
  13. package/build/src/modeling/generators/oas_312/OasGenerator.js +1 -1
  14. package/build/src/modeling/generators/oas_312/OasGenerator.js.map +1 -1
  15. package/build/src/modeling/generators/oas_312/OasSchemaGenerator.js +3 -3
  16. package/build/src/modeling/generators/oas_312/OasSchemaGenerator.js.map +1 -1
  17. package/build/src/modeling/generators/oas_320/OasSchemaGenerator.js +3 -3
  18. package/build/src/modeling/generators/oas_320/OasSchemaGenerator.js.map +1 -1
  19. package/build/src/modeling/types.d.ts +55 -0
  20. package/build/src/modeling/types.d.ts.map +1 -1
  21. package/build/src/modeling/types.js.map +1 -1
  22. package/build/tsconfig.tsbuildinfo +1 -1
  23. package/package.json +1 -1
  24. package/skills-lock.json +10 -0
  25. package/src/modeling/DomainAssociation.ts +4 -4
  26. package/src/modeling/ai/domain_response_schema.ts +1 -1
  27. package/src/modeling/ai/types.ts +2 -3
  28. package/src/modeling/amf/ShapeGenerator.ts +1 -1
  29. package/src/modeling/generators/oas_312/OasGenerator.ts +1 -1
  30. package/src/modeling/generators/oas_312/OasSchemaGenerator.ts +3 -3
  31. package/src/modeling/generators/oas_320/OasSchemaGenerator.ts +3 -3
  32. package/src/modeling/types.ts +56 -0
  33. package/tests/unit/modeling/amf/shape_generator.spec.ts +32 -14
  34. package/tests/unit/modeling/data_domain_change_observers.spec.ts +1 -1
  35. package/tests/unit/modeling/domain_asociation.spec.ts +18 -18
  36. package/tests/unit/modeling/domain_entity_example_generator_json.spec.ts +68 -23
  37. package/tests/unit/modeling/domain_entity_example_generator_xml.spec.ts +32 -9
  38. package/tests/unit/modeling/generators/OasGenerator.spec.ts +2 -2
@@ -6,7 +6,7 @@ import type { DomainEntity } from './DomainEntity.js';
6
6
  import type { Shapes } from '@api-client/amf-core';
7
7
  import type { AssociationBinding, AssociationBindings, AssociationWebBindings } from './Bindings.js';
8
8
  import { DomainAttributeAttribute } from './DataFormat.js';
9
- import type { AssociationTarget } from './types.js';
9
+ import type { AssociationSchema, AssociationTarget } from './types.js';
10
10
  import { type SemanticType, type AppliedDataSemantic } from './Semantics.js';
11
11
  /**
12
12
  * Defines the behavior when a parent entity in an association is deleted.
@@ -48,7 +48,7 @@ export interface DomainAssociationSchema extends DomainElementSchema {
48
48
  * referenced entities schemas. Note, changes in the referenced entities may not be propagated
49
49
  * to schemas altered by the user.
50
50
  */
51
- schema?: Shapes.IApiAssociationShape;
51
+ schema?: AssociationSchema;
52
52
  /**
53
53
  * The list of bindings for this property.
54
54
  *
@@ -143,7 +143,7 @@ export declare class DomainAssociation extends DomainElement {
143
143
  * The schema allowing to translate the model into a
144
144
  * specific format (like JSON, RAML, XML, etc.)
145
145
  */
146
- accessor schema: Shapes.IApiAssociationShape | undefined;
146
+ accessor schema: AssociationSchema | undefined;
147
147
  /**
148
148
  * The list of bindings for this property.
149
149
  *
@@ -224,7 +224,7 @@ export declare class DomainAssociation extends DomainElement {
224
224
  * const schema = association.ensureSchema();
225
225
  * ```
226
226
  */
227
- ensureSchema(): Shapes.IApiAssociationShape;
227
+ ensureSchema(): AssociationSchema;
228
228
  /**
229
229
  * Checks whether the passed value is one of the supported
230
230
  * data property attributes.
@@ -1 +1 @@
1
- {"version":3,"file":"DomainAssociation.d.ts","sourceRoot":"","sources":["../../../src/modeling/DomainAssociation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE5E,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACpG,OAAO,EAAE,wBAAwB,EAA6B,MAAM,iBAAiB,CAAA;AACrF,OAAO,KAAK,EAAE,iBAAiB,EAAmB,MAAM,YAAY,CAAA;AAEpE,OAAO,EAAwC,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAElH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,CAAA;AAE3E,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE,IAAI,EAAE,OAAO,qBAAqB,CAAA;IAClC;;OAEG;IACH,IAAI,EAAE,WAAW,CAAA;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,oBAAoB,CAAA;IACpC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,kBAAkB,EAA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C,CAAA;YAEnD,uEAAuE;YACvE,0CAA0C;YAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAsC,CAAA;YAE9D,8CAA8C;YAC9C,OAAO,IAAI,CAAC,GAAG,CAAA;YACf,OAAO,IAAI,CAAC,OAAO,CAAA;YAEnB,kDAAkD;YAClD,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;gBACd,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAA;YAC1B,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;YAC/B,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;YAE1C,2BAA2B;YAC3B,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;YAC7C,CAAC;YAED,oDAAoD;YACpD,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;YAC1C,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;YAC/C,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;YAClC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,GAAG,CAAC,EAAE,CAAC,EAAE,cAAc,CAAC,CAAA;YAE1D,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAA;YAC1B,OAAO,MAAM,CAAA;QACf,CAAC;;;SA3gBU,iBAAiB","sourcesContent":["import type { DataDomain } from './DataDomain.js'\nimport { DomainAssociationKind } from '../models/kinds.js'\nimport { DomainElement, type DomainElementSchema } from './DomainElement.js'\nimport { nanoid } from '../nanoid.js'\nimport { type ThingSchema, Thing } from '../models/Thing.js'\nimport { observed, retargetChange, toRaw } from '../decorators/observed.js'\nimport type { DomainEntity } from './DomainEntity.js'\nimport type { Shapes } from '@api-client/amf-core'\nimport type { AssociationBinding, AssociationBindings, AssociationWebBindings } from './Bindings.js'\nimport { DomainAttributeAttribute, DomainAttributeAttributes } from './DataFormat.js'\nimport type { AssociationTarget, DomainGraphEdge } from './types.js'\nimport { ShapeGenerator } from './amf/ShapeGenerator.js'\nimport { DataSemantics, isAssociationSemantic, type SemanticType, type AppliedDataSemantic } from './Semantics.js'\n\n/**\n * Defines the behavior when a parent entity in an association is deleted.\n *\n * - `restrict`: Prevents the deletion of a parent entity if it has any associated child entities.\n * The generated API should return a clear and specific error message (e.g., 409 Conflict).\n * - _Example_: Do not allow a Department to be deleted if it still has Employees.\n * - `cascade`: Automatically deletes all associated child entities when the parent entity is deleted.\n * - _Example_: Deleting a User will also delete all their associated Posts and Comments.\n * - `setNull`: Sets the foreign key of the associated child entities to NULL. This is only valid if the\n * association property on the child entity is nullable.\n * - _Example_: When a `Project` is deleted, the `project_id` on associated `Tasks` is set to NULL,\n * making them unassigned but not deleting them.\n * - `doNothing`: No action is taken on the associated child entities when the parent entity is deleted.\n * - _Example_: Deleting a `Category` does not affect associated `Products`, which remain in the database\n * but may become orphaned.\n * This is useful when the association is optional or when child entities should not be deleted\n * or modified upon the deletion of a parent entity.\n */\nexport type OnDeleteRule = 'restrict' | 'cascade' | 'setNull' | 'doNothing'\n\nexport interface DomainAssociationSchema extends DomainElementSchema {\n kind: typeof DomainAssociationKind\n /**\n * The data association description.\n */\n info: ThingSchema\n /**\n * Wether the data association is required.\n */\n required?: boolean\n /**\n * Whether the data association allows multiple items.\n */\n multiple?: boolean\n /**\n * The schema allowing to translate the model into a specific format (like JSON, RAML, XML, etc.)\n *\n * When this is defined then it is used as the schema. When this is not defined it uses\n * referenced entities schemas. Note, changes in the referenced entities may not be propagated\n * to schemas altered by the user.\n */\n schema?: Shapes.IApiAssociationShape\n /**\n * The list of bindings for this property.\n *\n * A binding defines a translation from a data model to a specific format.\n * For example allows to define properties required to generate AMF shape and therefore RAML/OAS shapes for web APIs\n * or a protocol buffer schema.\n */\n bindings?: AssociationBinding[]\n /**\n * The list of keys associated with the entity through this association.\n * An association without a target is considered invalid and discarded when processing the values.\n * When multiple associations are set then we are dealing with an union.\n */\n targets?: AssociationTarget[]\n /**\n * The semantics applied to this association.\n * This is a list of applied semantics that can be used to\n * describe the association in more detail.\n */\n semantics?: AppliedDataSemantic[]\n /**\n * Defines the behavior when a parent entity in an association is deleted.\n */\n onDelete?: OnDeleteRule\n /**\n * Whether the association is read-only.\n */\n readOnly?: boolean\n}\n\n/**\n * Represents an association between entities in a data domain.\n *\n * A `DomainAssociation` defines a relationship between a\n * `DomainEntity` and one or more other entities. It specifies\n * how entities are connected and can represent various types\n * of relationships, such as one-to-one, one-to-many, or\n * many-to-many.\n *\n * **Key Features:**\n *\n * - **Target Entities:** Specifies the entities that are\n * the target of the association.\n * - **Cardinality:** Defines whether the association is\n * single-valued or multi-valued (e.g., one-to-one vs.\n * one-to-many).\n * - **Required Status:** Indicates whether the association\n * is mandatory or optional.\n * - **Schema Customization:** Allows defining a custom\n * schema for the association, overriding the default\n * schema derived from the target entities.\n * - **Bindings:** Supports defining how the association is\n * represented in different formats (e.g., web APIs,\n * protocol buffers).\n * - **Foreign Namespaces:** Can target entities in other\n * namespaces, enabling cross-namespace relationships.\n *\n * **Usage:**\n *\n * The preferred way to create a `DomainAssociation` is\n * through the `DomainEntity.addAssociation()` method.\n *\n * **Example:**\n *\n * ```typescript\n * const dataDomain = new DataDomain();\n * const userModel = dataDomain.addModel({ key: 'userModel' });\n * const userEntity = userModel.addEntity({ key: 'user' });\n * const addressEntity = userModel.addEntity({ key: 'address' });\n * // Add an association from User to Address\n * const addressAssociation = userEntity.addAssociation();\n * addressAssociation.addTarget(addressEntity);\n * ```\n */\nexport class DomainAssociation extends DomainElement {\n /**\n * The kind of the domain element.\n */\n override kind: typeof DomainAssociationKind\n\n /**\n * The description of the association namespace.\n */\n @retargetChange() accessor info: Thing\n\n /**\n * Wether the data association is required.\n */\n @observed() accessor required: boolean | undefined\n\n /**\n * Whether the data association allows multiple items.\n */\n @observed() accessor multiple: boolean | undefined\n\n /**\n * The schema allowing to translate the model into a\n * specific format (like JSON, RAML, XML, etc.)\n */\n @observed({ deep: true }) accessor schema: Shapes.IApiAssociationShape | undefined\n\n /**\n * The list of bindings for this property.\n *\n * A binding defines a translation from a data model to a specific format.\n * For example allows to define properties required to generate AMF shape and therefore RAML/OAS shapes for web APIs\n * or a protocol buffer schema.\n */\n @observed({ deep: true }) accessor bindings: AssociationBinding[]\n\n /**\n * The key of the parent entity.\n */\n protected parent: string\n\n /**\n * The list of keys associated with the entity through this association.\n * An association without a target is considered invalid and discarded when processing the values.\n * When multiple associations are set then we are dealing with an union.\n */\n @observed({ deep: true }) accessor targets: AssociationTarget[]\n\n /**\n * Semantics applied to this association.\n */\n @observed({ deep: true }) accessor semantics: AppliedDataSemantic[] = []\n\n /**\n * Defines the behavior when a parent entity in an association is deleted.\n */\n @observed() accessor onDelete: OnDeleteRule | undefined\n\n /**\n * Whether the association is read-only.\n */\n @observed() accessor readOnly: boolean | undefined\n\n /**\n * Creates a full data association schema with defaults.\n *\n * @param input The partial data association schema.\n * @returns The data association schema.\n */\n static createSchema(input: Partial<DomainAssociationSchema> = {}): DomainAssociationSchema {\n const { key = nanoid(), semantics = [] } = input\n const info = Thing.fromJSON(input.info, { name: 'new_association' }).toJSON()\n const result: DomainAssociationSchema = {\n kind: DomainAssociationKind,\n key,\n info,\n }\n if (Array.isArray(semantics)) {\n result.semantics = [...semantics]\n }\n if (input.onDelete) {\n result.onDelete = input.onDelete\n }\n if (typeof input.readOnly === 'boolean') {\n result.readOnly = input.readOnly\n }\n if (input.schema) {\n result.schema = structuredClone(input.schema)\n }\n if (typeof input.multiple === 'boolean') {\n result.multiple = input.multiple\n }\n if (typeof input.required === 'boolean') {\n result.required = input.required\n }\n if (Array.isArray(input.bindings)) {\n result.bindings = input.bindings.map((i) => structuredClone(i))\n }\n if (Array.isArray(input.targets)) {\n result.targets = input.targets.map((i) => ({ ...i }))\n }\n return result\n }\n\n /**\n * Creates a new data association instance.\n *\n * You probably want to use the `DomainEntity.addAssociation()` method instead.\n *\n * @param root A reference to the root DataDomain instance.\n * @param parent The key of the parent entity.\n * @param input The partial data association schema.\n */\n constructor(root: DataDomain, parent: string, input?: Partial<DomainAssociationSchema>) {\n const init = DomainAssociation.createSchema(input)\n super(root, init.key)\n this.parent = parent\n this.kind = DomainAssociationKind\n this.info = new Thing(init.info)\n if (init.schema) {\n this.schema = structuredClone(init.schema)\n }\n if (typeof init.multiple === 'boolean') {\n this.multiple = init.multiple\n }\n if (typeof init.required === 'boolean') {\n this.required = init.required\n }\n if (Array.isArray(init.bindings)) {\n this.bindings = init.bindings.map((i) => structuredClone(i))\n } else {\n this.bindings = []\n }\n if (Array.isArray(init.targets)) {\n this.targets = init.targets.map((i) => ({ ...i }))\n } else {\n this.targets = []\n }\n if (Array.isArray(init.semantics)) {\n this.semantics = init.semantics.map((item) => structuredClone(item))\n } else {\n this.semantics = []\n }\n if (init.onDelete) {\n this.onDelete = init.onDelete\n }\n if (typeof init.readOnly === 'boolean') {\n this.readOnly = init.readOnly\n }\n }\n\n /**\n * Generates a JSON representation of the association.\n *\n * @returns A plain object representation of the `DomainAssociation`.\n */\n toJSON(): DomainAssociationSchema {\n const result: DomainAssociationSchema = {\n kind: this.kind,\n key: this.key,\n info: this.info.toJSON(),\n }\n if (this.schema) {\n result.schema = structuredClone(toRaw(this, this.schema))\n }\n if (typeof this.multiple === 'boolean') {\n result.multiple = this.multiple\n }\n if (typeof this.required === 'boolean') {\n result.required = this.required\n }\n if (Array.isArray(this.bindings) && this.bindings.length) {\n result.bindings = toRaw(this, this.bindings)?.map((i) => structuredClone(i))\n }\n if (Array.isArray(this.targets) && this.targets.length) {\n result.targets = toRaw(this, this.targets)?.map((i) => ({ ...i }))\n }\n if (Array.isArray(this.semantics) && this.semantics.length) {\n result.semantics = toRaw(this, this.semantics)?.map((i) => structuredClone(i))\n }\n if (this.onDelete) {\n result.onDelete = this.onDelete\n }\n if (typeof this.readOnly === 'boolean' && this.readOnly) {\n result.readOnly = this.readOnly\n }\n return result\n }\n\n /**\n * Returns a parent data entity where this data property exist.\n *\n * @returns The parent `DomainEntity` or undefined if not found.\n */\n getParentInstance(): DomainEntity | undefined {\n return this.root.graph.node(this.parent) as DomainEntity | undefined\n }\n\n /**\n * Removes this property from the parent entity.\n *\n * This method removes the association from the parent\n * entity's list of associations.\n *\n * @example\n * ```typescript\n * association.remove();\n * ```\n */\n remove(): void {\n const parent = this.getParentInstance()\n parent?.removeAssociation(this.key)\n }\n\n /**\n * Creates the `schema` object if missing and returns it.\n *\n * @returns The schema object.\n * @example\n * ```typescript\n * const schema = association.ensureSchema();\n * ```\n */\n ensureSchema(): Shapes.IApiAssociationShape {\n if (!this.schema) {\n this.schema = {}\n }\n return this.schema\n }\n\n /**\n * Checks whether the passed value is one of the supported\n * data property attributes.\n *\n * @param value The value to test\n * @returns True when the passed value is one of the\n * supported data property attributes.\n */\n static isValidAttribute(value: unknown): value is DomainAttributeAttribute {\n if (typeof value !== 'string') {\n return false\n }\n return DomainAttributeAttributes.includes(value as DomainAttributeAttribute)\n }\n\n /**\n * Creates if not existing and returns web bindings\n * definition.\n *\n * @returns The web binding definition\n * @example\n * ```typescript\n * const webBindings = association.getWebBinding();\n * webBindings.hidden = true;\n * ```\n */\n getWebBinding(): AssociationWebBindings {\n let object = this.bindings.find((i) => i.type === 'web') as AssociationBinding | undefined\n if (!object) {\n object = { type: 'web', schema: {} } as AssociationBinding\n this.bindings.push(object)\n this.domain.notifyChange()\n }\n return object.schema as AssociationWebBindings\n }\n\n /**\n * Reads the web binding definition, if any.\n * Useful for reading binding data without mutating the model when the binding\n * is missing (unlike `getWebBinding()` which creates the binding when missing).\n * @returns The web binding definition, if any\n */\n readWebBinding(): AssociationWebBindings | undefined {\n const object = this.bindings.find((i) => i.type === 'web') as AssociationBinding | undefined\n return object?.schema as AssociationWebBindings | undefined\n }\n\n /**\n * Returns the schema value of the binding, if any was\n * created.\n *\n * @param type The type of the binding to read.\n * @returns The binding schema, if any\n * @example\n * ```typescript\n * const webBindings = association.readBinding('web');\n * if (webBindings) {\n * // ...\n * }\n * ```\n */\n readBinding(type: 'web' | 'protobuf'): AssociationBindings | undefined {\n const item = this.bindings.find((i) => i.type === type) as AssociationBinding\n return item?.schema || undefined\n }\n\n /**\n * Adds a target entity to the association.\n *\n * If the entity comes from another namespace then it is\n * set as a foreign entity.\n *\n * @param entity - The `DomainEntity` instance to add.\n * @example\n * ```typescript\n * association.addTarget(addressEntity);\n * ```\n */\n addTarget(entity: DomainEntity): void\n\n /**\n * Adds a target entity to the association.\n *\n * @param entity - The `DomainEntity` definition or just\n * its key.\n * @param namespace - The key of the foreign namespace this\n * entity belongs to. Do not set this value for local\n * entities.\n * @example\n * ```typescript\n * association.addTarget('address', 'foreignNamespace');\n * ```\n */\n addTarget(entity: string, namespace?: string): void\n\n /**\n * Adds a target entity to the association.\n *\n * @param init The key of an entity, its instance, or schema.\n * @param namespace - The key of the foreign namespace this\n * entity belongs to. Do not set this value for local entities.\n */\n addTarget(init: string | DomainEntity, namespace?: string): void {\n let key: string\n if (typeof init === 'string') {\n key = init\n } else {\n key = init.key\n if (init.domain.key !== this.root.key) {\n namespace = init.domain.key\n }\n }\n if (this.targets.some((i) => i.key === key && i.domain === namespace)) {\n const message = `Target ${key} already exists.`\n throw new Error(message)\n }\n if (namespace && !this.root.dependencies.has(namespace)) {\n throw new Error(`Foreign namespace \"${namespace}\" does not exist.`)\n }\n const info: AssociationTarget = {\n key,\n }\n if (namespace) {\n info.domain = namespace\n }\n this.targets.push(info)\n const targetKey = namespace ? `${namespace}:${key}` : key\n const label: DomainGraphEdge = {\n type: 'association',\n }\n if (namespace) {\n label.domain = namespace\n label.foreign = true\n }\n // We need to associate the target with the association\n // in the graph. This way, when looking for associations\n // on a target entities we can easily locate the\n // association.\n this.root.graph.setEdge(this.key, targetKey, label)\n // this.root.notifyChange()\n }\n\n /**\n * Removes a target entity from the targets list.\n *\n * @param init The key of an entity, its instance, or\n * schema.\n * @example\n * ```typescript\n * association.removeTarget(addressEntity);\n * ```\n */\n removeTarget(init: string | DomainEntity): void {\n let key: string\n if (typeof init === 'string') {\n key = init\n } else {\n key = init.key\n }\n const index = this.targets.findIndex((i) => i.key === key)\n if (index >= 0) {\n this.targets.splice(index, 1)\n // this.root.notifyChange()\n }\n this.root.graph.removeEdge(this.key, key)\n }\n\n /**\n * Lists all target entities of this association.\n *\n * @returns A generator that yields each target\n * `DomainEntity`.\n * @example\n * ```typescript\n * for (const target of association.listTargets()) {\n * console.log(target.key);\n * }\n * ```\n */\n *listTargets(): Generator<DomainEntity> {\n for (const target of this.targets) {\n const { key, domain } = target\n const targetKey = domain ? `${domain}:${key}` : key\n const entity = this.root.graph.node(targetKey) as DomainEntity | undefined\n if (entity) {\n yield entity\n }\n }\n }\n\n /**\n * Creates a Property Shape of AMF.\n * The property itself is auto-generated. If the `schema` is defined then it is used\n * as the `range` of the property. Otherwise basic shape is generated for the range.\n *\n * This is a preferred way of reading the AMF shape as this synchronizes changed\n * data properties with the shape definition.\n *\n * @returns AMF property shape definition.\n */\n toApiShape(): Shapes.IApiPropertyShape {\n const serializer = new ShapeGenerator()\n return serializer.associationProperty(this)\n }\n\n /**\n * Adds or updates a semantic to the association.\n * @param semantic The semantic to add to the association.\n * @throws Error if the semantic is not an association semantic.\n */\n addSemantic(semantic: AppliedDataSemantic): void {\n const sem = DataSemantics[semantic.id]\n if (!isAssociationSemantic(sem)) {\n throw new Error(`Invalid semantic type: ${semantic.id}. Expected an association semantic.`)\n }\n const index = this.semantics.findIndex((s) => s.id === semantic.id)\n if (index >= 0) {\n this.semantics[index] = semantic\n } else {\n this.semantics.push(semantic)\n }\n this.domain.notifyChange()\n }\n\n /**\n * Removes a semantic from the association.\n * @param semanticId The ID of the semantic to remove.\n */\n removeSemantic(semanticId: SemanticType): void {\n const index = this.semantics.findIndex((s) => s.id === semanticId)\n if (index >= 0) {\n this.semantics.splice(index, 1)\n this.domain.notifyChange()\n }\n }\n\n /**\n * Checks if the association has a specific semantic.\n * @param semanticId The ID of the semantic to check.\n * @returns True if the semantic is present, false otherwise.\n */\n hasSemantic(semanticId: SemanticType): boolean {\n return this.semantics.some((s) => s.id === semanticId)\n }\n\n /**\n * Creates a duplicate of this association.\n * It places the duplicate on the parent entity right after the original association.\n *\n * @returns A new `DomainAssociation` instance that is a duplicate of this one.\n */\n duplicate(): DomainAssociation {\n const parent = this.getParentInstance()\n if (!parent) {\n throw new Error(`Cannot duplicate association ${this.key} as it has no parent entity.`)\n }\n const originalIndex = parent.fields.findIndex((f) => f.key === this.key)\n if (originalIndex === -1) {\n throw new Error(`Cannot duplicate association ${this.key} as it does not exist on the parent entity fields list.`)\n }\n const baseName = this.info.name || 'field'\n const newName = parent.generateUniqueName(baseName)\n\n // Making a copy and restoring it through the `addAssociation()` method\n // scales better than copying it manually.\n const copy = this.toJSON() as Partial<DomainAssociationSchema>\n\n // Delete properties that should not be copied\n delete copy.key\n delete copy.targets\n\n // Set the new name for the duplicated association\n if (copy.info) {\n copy.info.name = newName\n } else {\n copy.info = { name: newName }\n }\n\n const result = parent.addAssociation(copy)\n\n // Copy the target entities\n for (const target of this.targets) {\n result.addTarget(target.key, target.domain)\n }\n\n // Move the duplicate to be right after the original\n const fromIndex = parent.fields.length - 1\n const duplicateField = parent.fields[fromIndex]\n parent.fields.splice(fromIndex, 1)\n parent.fields.splice(originalIndex + 1, 0, duplicateField)\n\n this.domain.notifyChange()\n return result\n }\n}\n"]}
1
+ {"version":3,"file":"DomainAssociation.js","sourceRoot":"","sources":["../../../src/modeling/DomainAssociation.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAA;AAC5E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CAA0C;YAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAsC,CAAA;YAE9D,8CAA8C;YAC9C,OAAO,IAAI,CAAC,GAAG,CAAA;YACf,OAAO,IAAI,CAAC,OAAO,CAAA;YAEnB,kDAAkD;YAClD,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;gBACd,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAA;YAC1B,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;YAC/B,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;YAE1C,2BAA2B;YAC3B,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;YAC7C,CAAC;YAED,oDAAoD;YACpD,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;YAC1C,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;YAC/C,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;YAClC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,GAAG,CAAC,EAAE,CAAC,EAAE,cAAc,CAAC,CAAA;YAE1D,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAA;YAC1B,OAAO,MAAM,CAAA;QACf,CAAC;;;SA3gBU,iBAAiB","sourcesContent":["import type { DataDomain } from './DataDomain.js'\nimport { DomainAssociationKind } from '../models/kinds.js'\nimport { DomainElement, type DomainElementSchema } from './DomainElement.js'\nimport { nanoid } from '../nanoid.js'\nimport { type ThingSchema, Thing } from '../models/Thing.js'\nimport { observed, retargetChange, toRaw } from '../decorators/observed.js'\nimport type { DomainEntity } from './DomainEntity.js'\nimport type { Shapes } from '@api-client/amf-core'\nimport type { AssociationBinding, AssociationBindings, AssociationWebBindings } from './Bindings.js'\nimport { DomainAttributeAttribute, DomainAttributeAttributes } from './DataFormat.js'\nimport type { AssociationSchema, AssociationTarget, DomainGraphEdge } from './types.js'\nimport { ShapeGenerator } from './amf/ShapeGenerator.js'\nimport { DataSemantics, isAssociationSemantic, type SemanticType, type AppliedDataSemantic } from './Semantics.js'\n\n/**\n * Defines the behavior when a parent entity in an association is deleted.\n *\n * - `restrict`: Prevents the deletion of a parent entity if it has any associated child entities.\n * The generated API should return a clear and specific error message (e.g., 409 Conflict).\n * - _Example_: Do not allow a Department to be deleted if it still has Employees.\n * - `cascade`: Automatically deletes all associated child entities when the parent entity is deleted.\n * - _Example_: Deleting a User will also delete all their associated Posts and Comments.\n * - `setNull`: Sets the foreign key of the associated child entities to NULL. This is only valid if the\n * association property on the child entity is nullable.\n * - _Example_: When a `Project` is deleted, the `project_id` on associated `Tasks` is set to NULL,\n * making them unassigned but not deleting them.\n * - `doNothing`: No action is taken on the associated child entities when the parent entity is deleted.\n * - _Example_: Deleting a `Category` does not affect associated `Products`, which remain in the database\n * but may become orphaned.\n * This is useful when the association is optional or when child entities should not be deleted\n * or modified upon the deletion of a parent entity.\n */\nexport type OnDeleteRule = 'restrict' | 'cascade' | 'setNull' | 'doNothing'\n\nexport interface DomainAssociationSchema extends DomainElementSchema {\n kind: typeof DomainAssociationKind\n /**\n * The data association description.\n */\n info: ThingSchema\n /**\n * Wether the data association is required.\n */\n required?: boolean\n /**\n * Whether the data association allows multiple items.\n */\n multiple?: boolean\n /**\n * The schema allowing to translate the model into a specific format (like JSON, RAML, XML, etc.)\n *\n * When this is defined then it is used as the schema. When this is not defined it uses\n * referenced entities schemas. Note, changes in the referenced entities may not be propagated\n * to schemas altered by the user.\n */\n schema?: AssociationSchema\n /**\n * The list of bindings for this property.\n *\n * A binding defines a translation from a data model to a specific format.\n * For example allows to define properties required to generate AMF shape and therefore RAML/OAS shapes for web APIs\n * or a protocol buffer schema.\n */\n bindings?: AssociationBinding[]\n /**\n * The list of keys associated with the entity through this association.\n * An association without a target is considered invalid and discarded when processing the values.\n * When multiple associations are set then we are dealing with an union.\n */\n targets?: AssociationTarget[]\n /**\n * The semantics applied to this association.\n * This is a list of applied semantics that can be used to\n * describe the association in more detail.\n */\n semantics?: AppliedDataSemantic[]\n /**\n * Defines the behavior when a parent entity in an association is deleted.\n */\n onDelete?: OnDeleteRule\n /**\n * Whether the association is read-only.\n */\n readOnly?: boolean\n}\n\n/**\n * Represents an association between entities in a data domain.\n *\n * A `DomainAssociation` defines a relationship between a\n * `DomainEntity` and one or more other entities. It specifies\n * how entities are connected and can represent various types\n * of relationships, such as one-to-one, one-to-many, or\n * many-to-many.\n *\n * **Key Features:**\n *\n * - **Target Entities:** Specifies the entities that are\n * the target of the association.\n * - **Cardinality:** Defines whether the association is\n * single-valued or multi-valued (e.g., one-to-one vs.\n * one-to-many).\n * - **Required Status:** Indicates whether the association\n * is mandatory or optional.\n * - **Schema Customization:** Allows defining a custom\n * schema for the association, overriding the default\n * schema derived from the target entities.\n * - **Bindings:** Supports defining how the association is\n * represented in different formats (e.g., web APIs,\n * protocol buffers).\n * - **Foreign Namespaces:** Can target entities in other\n * namespaces, enabling cross-namespace relationships.\n *\n * **Usage:**\n *\n * The preferred way to create a `DomainAssociation` is\n * through the `DomainEntity.addAssociation()` method.\n *\n * **Example:**\n *\n * ```typescript\n * const dataDomain = new DataDomain();\n * const userModel = dataDomain.addModel({ key: 'userModel' });\n * const userEntity = userModel.addEntity({ key: 'user' });\n * const addressEntity = userModel.addEntity({ key: 'address' });\n * // Add an association from User to Address\n * const addressAssociation = userEntity.addAssociation();\n * addressAssociation.addTarget(addressEntity);\n * ```\n */\nexport class DomainAssociation extends DomainElement {\n /**\n * The kind of the domain element.\n */\n override kind: typeof DomainAssociationKind\n\n /**\n * The description of the association namespace.\n */\n @retargetChange() accessor info: Thing\n\n /**\n * Wether the data association is required.\n */\n @observed() accessor required: boolean | undefined\n\n /**\n * Whether the data association allows multiple items.\n */\n @observed() accessor multiple: boolean | undefined\n\n /**\n * The schema allowing to translate the model into a\n * specific format (like JSON, RAML, XML, etc.)\n */\n @observed({ deep: true }) accessor schema: AssociationSchema | undefined\n\n /**\n * The list of bindings for this property.\n *\n * A binding defines a translation from a data model to a specific format.\n * For example allows to define properties required to generate AMF shape and therefore RAML/OAS shapes for web APIs\n * or a protocol buffer schema.\n */\n @observed({ deep: true }) accessor bindings: AssociationBinding[]\n\n /**\n * The key of the parent entity.\n */\n protected parent: string\n\n /**\n * The list of keys associated with the entity through this association.\n * An association without a target is considered invalid and discarded when processing the values.\n * When multiple associations are set then we are dealing with an union.\n */\n @observed({ deep: true }) accessor targets: AssociationTarget[]\n\n /**\n * Semantics applied to this association.\n */\n @observed({ deep: true }) accessor semantics: AppliedDataSemantic[] = []\n\n /**\n * Defines the behavior when a parent entity in an association is deleted.\n */\n @observed() accessor onDelete: OnDeleteRule | undefined\n\n /**\n * Whether the association is read-only.\n */\n @observed() accessor readOnly: boolean | undefined\n\n /**\n * Creates a full data association schema with defaults.\n *\n * @param input The partial data association schema.\n * @returns The data association schema.\n */\n static createSchema(input: Partial<DomainAssociationSchema> = {}): DomainAssociationSchema {\n const { key = nanoid(), semantics = [] } = input\n const info = Thing.fromJSON(input.info, { name: 'new_association' }).toJSON()\n const result: DomainAssociationSchema = {\n kind: DomainAssociationKind,\n key,\n info,\n }\n if (Array.isArray(semantics)) {\n result.semantics = [...semantics]\n }\n if (input.onDelete) {\n result.onDelete = input.onDelete\n }\n if (typeof input.readOnly === 'boolean') {\n result.readOnly = input.readOnly\n }\n if (input.schema) {\n result.schema = structuredClone(input.schema)\n }\n if (typeof input.multiple === 'boolean') {\n result.multiple = input.multiple\n }\n if (typeof input.required === 'boolean') {\n result.required = input.required\n }\n if (Array.isArray(input.bindings)) {\n result.bindings = input.bindings.map((i) => structuredClone(i))\n }\n if (Array.isArray(input.targets)) {\n result.targets = input.targets.map((i) => ({ ...i }))\n }\n return result\n }\n\n /**\n * Creates a new data association instance.\n *\n * You probably want to use the `DomainEntity.addAssociation()` method instead.\n *\n * @param root A reference to the root DataDomain instance.\n * @param parent The key of the parent entity.\n * @param input The partial data association schema.\n */\n constructor(root: DataDomain, parent: string, input?: Partial<DomainAssociationSchema>) {\n const init = DomainAssociation.createSchema(input)\n super(root, init.key)\n this.parent = parent\n this.kind = DomainAssociationKind\n this.info = new Thing(init.info)\n if (init.schema) {\n this.schema = structuredClone(init.schema)\n }\n if (typeof init.multiple === 'boolean') {\n this.multiple = init.multiple\n }\n if (typeof init.required === 'boolean') {\n this.required = init.required\n }\n if (Array.isArray(init.bindings)) {\n this.bindings = init.bindings.map((i) => structuredClone(i))\n } else {\n this.bindings = []\n }\n if (Array.isArray(init.targets)) {\n this.targets = init.targets.map((i) => ({ ...i }))\n } else {\n this.targets = []\n }\n if (Array.isArray(init.semantics)) {\n this.semantics = init.semantics.map((item) => structuredClone(item))\n } else {\n this.semantics = []\n }\n if (init.onDelete) {\n this.onDelete = init.onDelete\n }\n if (typeof init.readOnly === 'boolean') {\n this.readOnly = init.readOnly\n }\n }\n\n /**\n * Generates a JSON representation of the association.\n *\n * @returns A plain object representation of the `DomainAssociation`.\n */\n toJSON(): DomainAssociationSchema {\n const result: DomainAssociationSchema = {\n kind: this.kind,\n key: this.key,\n info: this.info.toJSON(),\n }\n if (this.schema) {\n result.schema = structuredClone(toRaw(this, this.schema))\n }\n if (typeof this.multiple === 'boolean') {\n result.multiple = this.multiple\n }\n if (typeof this.required === 'boolean') {\n result.required = this.required\n }\n if (Array.isArray(this.bindings) && this.bindings.length) {\n result.bindings = toRaw(this, this.bindings)?.map((i) => structuredClone(i))\n }\n if (Array.isArray(this.targets) && this.targets.length) {\n result.targets = toRaw(this, this.targets)?.map((i) => ({ ...i }))\n }\n if (Array.isArray(this.semantics) && this.semantics.length) {\n result.semantics = toRaw(this, this.semantics)?.map((i) => structuredClone(i))\n }\n if (this.onDelete) {\n result.onDelete = this.onDelete\n }\n if (typeof this.readOnly === 'boolean' && this.readOnly) {\n result.readOnly = this.readOnly\n }\n return result\n }\n\n /**\n * Returns a parent data entity where this data property exist.\n *\n * @returns The parent `DomainEntity` or undefined if not found.\n */\n getParentInstance(): DomainEntity | undefined {\n return this.root.graph.node(this.parent) as DomainEntity | undefined\n }\n\n /**\n * Removes this property from the parent entity.\n *\n * This method removes the association from the parent\n * entity's list of associations.\n *\n * @example\n * ```typescript\n * association.remove();\n * ```\n */\n remove(): void {\n const parent = this.getParentInstance()\n parent?.removeAssociation(this.key)\n }\n\n /**\n * Creates the `schema` object if missing and returns it.\n *\n * @returns The schema object.\n * @example\n * ```typescript\n * const schema = association.ensureSchema();\n * ```\n */\n ensureSchema(): AssociationSchema {\n if (!this.schema) {\n this.schema = {}\n }\n return this.schema\n }\n\n /**\n * Checks whether the passed value is one of the supported\n * data property attributes.\n *\n * @param value The value to test\n * @returns True when the passed value is one of the\n * supported data property attributes.\n */\n static isValidAttribute(value: unknown): value is DomainAttributeAttribute {\n if (typeof value !== 'string') {\n return false\n }\n return DomainAttributeAttributes.includes(value as DomainAttributeAttribute)\n }\n\n /**\n * Creates if not existing and returns web bindings\n * definition.\n *\n * @returns The web binding definition\n * @example\n * ```typescript\n * const webBindings = association.getWebBinding();\n * webBindings.hidden = true;\n * ```\n */\n getWebBinding(): AssociationWebBindings {\n let object = this.bindings.find((i) => i.type === 'web') as AssociationBinding | undefined\n if (!object) {\n object = { type: 'web', schema: {} } as AssociationBinding\n this.bindings.push(object)\n this.domain.notifyChange()\n }\n return object.schema as AssociationWebBindings\n }\n\n /**\n * Reads the web binding definition, if any.\n * Useful for reading binding data without mutating the model when the binding\n * is missing (unlike `getWebBinding()` which creates the binding when missing).\n * @returns The web binding definition, if any\n */\n readWebBinding(): AssociationWebBindings | undefined {\n const object = this.bindings.find((i) => i.type === 'web') as AssociationBinding | undefined\n return object?.schema as AssociationWebBindings | undefined\n }\n\n /**\n * Returns the schema value of the binding, if any was\n * created.\n *\n * @param type The type of the binding to read.\n * @returns The binding schema, if any\n * @example\n * ```typescript\n * const webBindings = association.readBinding('web');\n * if (webBindings) {\n * // ...\n * }\n * ```\n */\n readBinding(type: 'web' | 'protobuf'): AssociationBindings | undefined {\n const item = this.bindings.find((i) => i.type === type) as AssociationBinding\n return item?.schema || undefined\n }\n\n /**\n * Adds a target entity to the association.\n *\n * If the entity comes from another namespace then it is\n * set as a foreign entity.\n *\n * @param entity - The `DomainEntity` instance to add.\n * @example\n * ```typescript\n * association.addTarget(addressEntity);\n * ```\n */\n addTarget(entity: DomainEntity): void\n\n /**\n * Adds a target entity to the association.\n *\n * @param entity - The `DomainEntity` definition or just\n * its key.\n * @param namespace - The key of the foreign namespace this\n * entity belongs to. Do not set this value for local\n * entities.\n * @example\n * ```typescript\n * association.addTarget('address', 'foreignNamespace');\n * ```\n */\n addTarget(entity: string, namespace?: string): void\n\n /**\n * Adds a target entity to the association.\n *\n * @param init The key of an entity, its instance, or schema.\n * @param namespace - The key of the foreign namespace this\n * entity belongs to. Do not set this value for local entities.\n */\n addTarget(init: string | DomainEntity, namespace?: string): void {\n let key: string\n if (typeof init === 'string') {\n key = init\n } else {\n key = init.key\n if (init.domain.key !== this.root.key) {\n namespace = init.domain.key\n }\n }\n if (this.targets.some((i) => i.key === key && i.domain === namespace)) {\n const message = `Target ${key} already exists.`\n throw new Error(message)\n }\n if (namespace && !this.root.dependencies.has(namespace)) {\n throw new Error(`Foreign namespace \"${namespace}\" does not exist.`)\n }\n const info: AssociationTarget = {\n key,\n }\n if (namespace) {\n info.domain = namespace\n }\n this.targets.push(info)\n const targetKey = namespace ? `${namespace}:${key}` : key\n const label: DomainGraphEdge = {\n type: 'association',\n }\n if (namespace) {\n label.domain = namespace\n label.foreign = true\n }\n // We need to associate the target with the association\n // in the graph. This way, when looking for associations\n // on a target entities we can easily locate the\n // association.\n this.root.graph.setEdge(this.key, targetKey, label)\n // this.root.notifyChange()\n }\n\n /**\n * Removes a target entity from the targets list.\n *\n * @param init The key of an entity, its instance, or\n * schema.\n * @example\n * ```typescript\n * association.removeTarget(addressEntity);\n * ```\n */\n removeTarget(init: string | DomainEntity): void {\n let key: string\n if (typeof init === 'string') {\n key = init\n } else {\n key = init.key\n }\n const index = this.targets.findIndex((i) => i.key === key)\n if (index >= 0) {\n this.targets.splice(index, 1)\n // this.root.notifyChange()\n }\n this.root.graph.removeEdge(this.key, key)\n }\n\n /**\n * Lists all target entities of this association.\n *\n * @returns A generator that yields each target\n * `DomainEntity`.\n * @example\n * ```typescript\n * for (const target of association.listTargets()) {\n * console.log(target.key);\n * }\n * ```\n */\n *listTargets(): Generator<DomainEntity> {\n for (const target of this.targets) {\n const { key, domain } = target\n const targetKey = domain ? `${domain}:${key}` : key\n const entity = this.root.graph.node(targetKey) as DomainEntity | undefined\n if (entity) {\n yield entity\n }\n }\n }\n\n /**\n * Creates a Property Shape of AMF.\n * The property itself is auto-generated. If the `schema` is defined then it is used\n * as the `range` of the property. Otherwise basic shape is generated for the range.\n *\n * This is a preferred way of reading the AMF shape as this synchronizes changed\n * data properties with the shape definition.\n *\n * @returns AMF property shape definition.\n */\n toApiShape(): Shapes.IApiPropertyShape {\n const serializer = new ShapeGenerator()\n return serializer.associationProperty(this)\n }\n\n /**\n * Adds or updates a semantic to the association.\n * @param semantic The semantic to add to the association.\n * @throws Error if the semantic is not an association semantic.\n */\n addSemantic(semantic: AppliedDataSemantic): void {\n const sem = DataSemantics[semantic.id]\n if (!isAssociationSemantic(sem)) {\n throw new Error(`Invalid semantic type: ${semantic.id}. Expected an association semantic.`)\n }\n const index = this.semantics.findIndex((s) => s.id === semantic.id)\n if (index >= 0) {\n this.semantics[index] = semantic\n } else {\n this.semantics.push(semantic)\n }\n this.domain.notifyChange()\n }\n\n /**\n * Removes a semantic from the association.\n * @param semanticId The ID of the semantic to remove.\n */\n removeSemantic(semanticId: SemanticType): void {\n const index = this.semantics.findIndex((s) => s.id === semanticId)\n if (index >= 0) {\n this.semantics.splice(index, 1)\n this.domain.notifyChange()\n }\n }\n\n /**\n * Checks if the association has a specific semantic.\n * @param semanticId The ID of the semantic to check.\n * @returns True if the semantic is present, false otherwise.\n */\n hasSemantic(semanticId: SemanticType): boolean {\n return this.semantics.some((s) => s.id === semanticId)\n }\n\n /**\n * Creates a duplicate of this association.\n * It places the duplicate on the parent entity right after the original association.\n *\n * @returns A new `DomainAssociation` instance that is a duplicate of this one.\n */\n duplicate(): DomainAssociation {\n const parent = this.getParentInstance()\n if (!parent) {\n throw new Error(`Cannot duplicate association ${this.key} as it has no parent entity.`)\n }\n const originalIndex = parent.fields.findIndex((f) => f.key === this.key)\n if (originalIndex === -1) {\n throw new Error(`Cannot duplicate association ${this.key} as it does not exist on the parent entity fields list.`)\n }\n const baseName = this.info.name || 'field'\n const newName = parent.generateUniqueName(baseName)\n\n // Making a copy and restoring it through the `addAssociation()` method\n // scales better than copying it manually.\n const copy = this.toJSON() as Partial<DomainAssociationSchema>\n\n // Delete properties that should not be copied\n delete copy.key\n delete copy.targets\n\n // Set the new name for the duplicated association\n if (copy.info) {\n copy.info.name = newName\n } else {\n copy.info = { name: newName }\n }\n\n const result = parent.addAssociation(copy)\n\n // Copy the target entities\n for (const target of this.targets) {\n result.addTarget(target.key, target.domain)\n }\n\n // Move the duplicate to be right after the original\n const fromIndex = parent.fields.length - 1\n const duplicateField = parent.fields[fromIndex]\n parent.fields.splice(fromIndex, 1)\n parent.fields.splice(originalIndex + 1, 0, duplicateField)\n\n this.domain.notifyChange()\n return result\n }\n}\n"]}
@@ -310,8 +310,9 @@ export declare const DOMAIN_SCHEMA: {
310
310
  schema: {
311
311
  type: Type;
312
312
  properties: {
313
- linked: {
313
+ embedded: {
314
314
  type: Type;
315
+ description: string;
315
316
  };
316
317
  unionType: {
317
318
  type: Type;
@@ -772,8 +773,9 @@ export declare const DOMAIN_SCHEMA: {
772
773
  schema: {
773
774
  type: Type;
774
775
  properties: {
775
- linked: {
776
+ embedded: {
776
777
  type: Type;
778
+ description: string;
777
779
  };
778
780
  unionType: {
779
781
  type: Type;
@@ -1 +1 @@
1
- {"version":3,"file":"domain_response_schema.d.ts","sourceRoot":"","sources":["../../../../src/modeling/ai/domain_response_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AA0NjC;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+FzB,CAAA"}
@@ -87,7 +87,7 @@ const PropertySchema = {
87
87
  const AssociationSchemaShape = {
88
88
  type: Type.OBJECT,
89
89
  properties: {
90
- linked: { type: Type.BOOLEAN },
90
+ embedded: { type: Type.BOOLEAN, description: 'Whether the association should be embedded in the target entity' },
91
91
  unionType: { type: Type.STRING, description: 'Enum: allOf, anyOf, oneOf, not' },
92
92
  },
93
93
  };
@@ -1 +1 @@
1
- {"version":3,"file":"domain_response_schema.js","sourceRoot":"","sources":["../../../../src/modeling/ai/domain_response_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,MAAM,cAAc,GAAG;IACrB,IAAI,EAAE,IAAI,CAAC,MAAM;IACjB,UAAU,EAAE;QACV,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;QACzB,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;KAC9B;IACD,QAAQ,EAAE,CAAC,IAAI,CAAC;CACjB,CAAA;AAED,MAAM,iBAAiB,GAAG;IACxB,IAAI,EAAE,IAAI,CAAC,MAAM;IACjB,UAAU,EAAE;QACV,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,+BAA+B,EAAE;QACxE,MAAM,EAAE;YACN,IAAI,EAAE,IAAI,CAAC,MAAM;YACjB,WAAW,EAAE,4FAA4F;SAC1G;KACF;IACD,QAAQ,EAAE,CAAC,KAAK,CAAC;CAClB,CAAA;AAED,MAAM,kBAAkB,GAAG;IACzB,IAAI,EAAE,IAAI,CAAC,MAAM;IACjB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,IAAI,EAAE,IAAI,CAAC,MAAM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,KAAK;4BACL,oBAAoB;4BACpB,uBAAuB;4BACvB,wBAAwB;4BACxB,qBAAqB;4BACrB,wBAAwB;4BACxB,yBAAyB;4BACzB,uBAAuB;4BACvB,0BAA0B;4BAC1B,4BAA4B;yBAC7B;qBACF;oBACD,WAAW,EAAE,+FAA+F;iBAC7G;aACF;YACD,QAAQ,EAAE;gBACR,aAAa;gBACb,kBAAkB;gBAClB,gBAAgB;gBAChB,eAAe;gBACf,mBAAmB;gBACnB,kBAAkB;aACnB;SACF;KACF;IACD,QAAQ,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC;CACjC,CAAA","sourcesContent":["import { Type } from './types.js'\n\nconst SemanticSchema = {\n type: Type.OBJECT,\n properties: {\n id: { type: Type.STRING },\n config: { type: Type.OBJECT },\n },\n required: ['id'],\n}\n\nconst AssociationTarget = {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING, description: 'The key of the target entity.' },\n domain: {\n type: Type.STRING,\n description: 'The key of the target data domain. Only set when the target is in a different data domain.',\n },\n },\n required: ['key'],\n}\n\nconst SchemaDefaultValue = {\n type: Type.OBJECT,\n properties: {\n type: {\n type: Type.STRING,\n description: 'Enum: literal, function',\n },\n value: {\n type: Type.STRING,\n description: 'The default value of the property',\n },\n },\n required: ['type'],\n}\n\nconst PropertySchemaShape = {\n type: Type.OBJECT,\n properties: {\n minimum: { type: Type.NUMBER, nullable: true },\n maximum: { type: Type.NUMBER, nullable: true },\n exclusiveMinimum: { type: Type.BOOLEAN, nullable: true },\n exclusiveMaximum: { type: Type.BOOLEAN, nullable: true },\n multipleOf: { type: Type.NUMBER, nullable: true },\n enum: { type: Type.ARRAY, items: { type: Type.STRING }, nullable: true },\n examples: { type: Type.ARRAY, items: { type: Type.STRING }, nullable: true },\n defaultValue: { ...SchemaDefaultValue, nullable: true },\n pattern: { type: Type.STRING, nullable: true },\n },\n}\n\nconst PropertyConstraintsSchema = {\n type: Type.OBJECT,\n properties: {\n required: { type: Type.BOOLEAN, nullable: true },\n unique: { type: Type.BOOLEAN, nullable: true },\n index: { type: Type.BOOLEAN, nullable: true },\n primary: { type: Type.BOOLEAN, nullable: true },\n multiple: { type: Type.BOOLEAN, nullable: true },\n readOnly: { type: Type.BOOLEAN, nullable: true },\n writeOnly: { type: Type.BOOLEAN, nullable: true },\n },\n}\n\n/**\n * Must comply with the `AiDomainProperty` type.\n */\nconst PropertySchema = {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING },\n name: { type: Type.STRING },\n displayName: { type: Type.STRING },\n description: { type: Type.STRING },\n type: {\n type: Type.STRING,\n description: 'Enum: string, number, boolean, date, datetime, time, binary',\n },\n constraints: PropertyConstraintsSchema,\n deprecated: { type: Type.BOOLEAN },\n schema: PropertySchemaShape,\n semantics: {\n type: Type.ARRAY,\n items: SemanticSchema,\n description: \"List of semantics applied to this property. Note: ONLY use semantics with scope='property'.\",\n },\n tags: { type: Type.ARRAY, items: { type: Type.STRING }, nullable: true },\n },\n required: ['key', 'name', 'type', 'displayName', 'description'],\n}\n\nconst AssociationSchemaShape = {\n type: Type.OBJECT,\n properties: {\n linked: { type: Type.BOOLEAN },\n unionType: { type: Type.STRING, description: 'Enum: allOf, anyOf, oneOf, not' },\n },\n}\n\n/**\n * Must comply with the `AiDomainAssociation` type.\n */\nconst AssociationSchema = {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING },\n name: { type: Type.STRING },\n displayName: { type: Type.STRING },\n description: { type: Type.STRING },\n targets: { type: Type.ARRAY, items: AssociationTarget },\n required: { type: Type.BOOLEAN },\n multiple: {\n type: Type.BOOLEAN,\n description: 'Whether the association can have multiple targets (like User has multiple addresses)',\n },\n onDelete: { type: Type.STRING, description: 'Enum: restrict, cascade, setNull, doNothing' },\n semantics: {\n type: Type.ARRAY,\n items: SemanticSchema,\n description: \"List of semantics applied to this association. Note: ONLY use semantics with scope='association'.\",\n },\n schema: AssociationSchemaShape,\n },\n required: ['key', 'name', 'targets', 'displayName', 'description'],\n}\n\n/**\n * Must comply with the `AiDataModel` type.\n */\nconst ModelSchema = {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING },\n name: { type: Type.STRING },\n description: { type: Type.STRING },\n },\n required: ['key', 'name'],\n}\n\n/**\n * Must comply with the `AiDomainEntityResponseSchema` type.\n */\nconst EntitySchema = {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING },\n modelKey: { type: Type.STRING, description: 'The Domain Model this entity belongs to (e.g. \"users\", \"shipping\")' },\n name: { type: Type.STRING },\n displayName: { type: Type.STRING },\n description: { type: Type.STRING },\n tags: { type: Type.ARRAY, items: { type: Type.STRING } },\n semantics: {\n type: Type.ARRAY,\n items: SemanticSchema,\n description: \"List of semantics applied to this entity. Note: ONLY use semantics with scope='entity'.\",\n },\n properties: { type: Type.ARRAY, items: PropertySchema },\n associations: { type: Type.ARRAY, items: AssociationSchema },\n },\n required: ['key', 'name', 'modelKey', 'displayName', 'description'],\n}\n\n/**\n * Allows modifying a property (not adding)\n */\nconst PropertyDeltaSchema = {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING },\n name: { type: Type.STRING },\n displayName: { type: Type.STRING },\n description: { type: Type.STRING },\n type: {\n type: Type.STRING,\n description: 'Enum: string, number, boolean, date, datetime, time, binary',\n },\n constraints: { ...PropertyConstraintsSchema, nullable: true },\n deprecated: { type: Type.BOOLEAN, nullable: true },\n schema: { ...PropertySchemaShape, nullable: true },\n addedSemantics: {\n type: Type.ARRAY,\n items: SemanticSchema,\n description: \"Semantics to add. Note: ONLY use semantics with scope='property'.\",\n },\n modifiedSemantics: { type: Type.ARRAY, items: SemanticSchema },\n deletedSemanticIds: { type: Type.ARRAY, items: { type: Type.STRING } },\n },\n required: ['key'],\n}\n\nconst AssociationDeltaSchema = {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING },\n name: { type: Type.STRING },\n displayName: { type: Type.STRING },\n description: { type: Type.STRING },\n targets: { type: Type.ARRAY, items: AssociationTarget },\n required: { type: Type.BOOLEAN, nullable: true },\n multiple: {\n type: Type.BOOLEAN,\n nullable: true,\n description: 'Whether the association can have multiple targets (like User has multiple addresses)',\n },\n onDelete: { type: Type.STRING, nullable: true, description: 'Enum: restrict, cascade, setNull, doNothing' },\n addedSemantics: {\n type: Type.ARRAY,\n items: SemanticSchema,\n description: \"Semantics to add. Note: ONLY use semantics with scope='association'.\",\n },\n modifiedSemantics: { type: Type.ARRAY, items: SemanticSchema },\n deletedSemanticIds: { type: Type.ARRAY, items: { type: Type.STRING } },\n },\n required: ['key'],\n}\n\n/**\n * Must comply with the `AiDomainDeltaResponse` type.\n */\nexport const DOMAIN_SCHEMA = {\n type: Type.OBJECT,\n properties: {\n sessionTitle: {\n type: Type.STRING,\n description: 'A short, 3-to-5 word descriptive title for this data modeling session.',\n },\n reasoning: {\n type: Type.STRING,\n description: 'Conversational response analyzing the request or explaining changes, in markdown format',\n },\n delta: {\n type: Type.OBJECT,\n properties: {\n addedModels: {\n type: Type.ARRAY,\n items: ModelSchema,\n description: 'Brand new models to create',\n },\n deletedModelKeys: {\n type: Type.ARRAY,\n items: { type: Type.STRING },\n description:\n 'Keys of completely removed models. This also removes all entities and associations in the model.',\n },\n modifiedModels: {\n type: Type.ARRAY,\n items: ModelSchema,\n description: 'Models to modify in the domain',\n },\n addedEntities: {\n type: Type.ARRAY,\n items: EntitySchema,\n description: 'Brand new entities to create',\n },\n deletedEntityKeys: {\n type: Type.ARRAY,\n items: { type: Type.STRING },\n description: 'Keys of completely removed entities',\n },\n modifiedEntities: {\n type: Type.ARRAY,\n items: {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING, description: 'The original key of the existing entity being modified' },\n modelKey: {\n type: Type.STRING,\n description: 'Change this to migrate the entity to a different model (boundary)',\n },\n name: { type: Type.STRING },\n displayName: { type: Type.STRING },\n description: { type: Type.STRING },\n tags: { type: Type.ARRAY, items: { type: Type.STRING }, nullable: true },\n addedSemantics: {\n type: Type.ARRAY,\n items: SemanticSchema,\n description: \"Semantics to add. Note: ONLY use semantics with scope='entity'.\",\n },\n modifiedSemantics: { type: Type.ARRAY, items: SemanticSchema },\n deletedSemanticIds: { type: Type.ARRAY, items: { type: Type.STRING } },\n addedProperties: { type: Type.ARRAY, items: PropertySchema },\n modifiedProperties: { type: Type.ARRAY, items: PropertyDeltaSchema },\n deletedPropertyKeys: { type: Type.ARRAY, items: { type: Type.STRING } },\n addedAssociations: { type: Type.ARRAY, items: AssociationSchema },\n modifiedAssociations: { type: Type.ARRAY, items: AssociationDeltaSchema },\n deletedAssociationKeys: { type: Type.ARRAY, items: { type: Type.STRING } },\n },\n required: [\n 'key',\n // 'addedSemantics',\n // 'modifiedSemantics',\n // 'deletedSemanticIds',\n // 'addedProperties',\n // 'modifiedProperties',\n // 'deletedPropertyKeys',\n // 'addedAssociations',\n // 'modifiedAssociations',\n // 'deletedAssociationKeys',\n ],\n },\n description: 'Modifications to existing entities like adding, removing, or changing properties/associations',\n },\n },\n required: [\n 'addedModels',\n 'deletedModelKeys',\n 'modifiedModels',\n 'addedEntities',\n 'deletedEntityKeys',\n 'modifiedEntities',\n ],\n },\n },\n required: ['reasoning', 'delta'],\n}\n"]}
1
+ {"version":3,"file":"domain_response_schema.js","sourceRoot":"","sources":["../../../../src/modeling/ai/domain_response_schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,MAAM,cAAc,GAAG;IACrB,IAAI,EAAE,IAAI,CAAC,MAAM;IACjB,UAAU,EAAE;QACV,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;QACzB,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;KAC9B;IACD,QAAQ,EAAE,CAAC,IAAI,CAAC;CACjB,CAAA;AAED,MAAM,iBAAiB,GAAG;IACxB,IAAI,EAAE,IAAI,CAAC,MAAM;IACjB,UAAU,EAAE;QACV,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MA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vE,iBAAiB,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE;4BACjE,oBAAoB,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,sBAAsB,EAAE;4BACzE,sBAAsB,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE;yBAC3E;wBACD,QAAQ,EAAE;4BACR,KAAK;4BACL,oBAAoB;4BACpB,uBAAuB;4BACvB,wBAAwB;4BACxB,qBAAqB;4BACrB,wBAAwB;4BACxB,yBAAyB;4BACzB,uBAAuB;4BACvB,0BAA0B;4BAC1B,4BAA4B;yBAC7B;qBACF;oBACD,WAAW,EAAE,+FAA+F;iBAC7G;aACF;YACD,QAAQ,EAAE;gBACR,aAAa;gBACb,kBAAkB;gBAClB,gBAAgB;gBAChB,eAAe;gBACf,mBAAmB;gBACnB,kBAAkB;aACnB;SACF;KACF;IACD,QAAQ,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC;CACjC,CAAA","sourcesContent":["import { Type } from './types.js'\n\nconst SemanticSchema = {\n type: Type.OBJECT,\n properties: {\n id: { type: Type.STRING },\n config: { type: Type.OBJECT },\n },\n required: ['id'],\n}\n\nconst AssociationTarget = {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING, description: 'The key of the target entity.' },\n domain: {\n type: Type.STRING,\n description: 'The key of the target data domain. Only set when the target is in a different data domain.',\n },\n },\n required: ['key'],\n}\n\nconst SchemaDefaultValue = {\n type: Type.OBJECT,\n properties: {\n type: {\n type: Type.STRING,\n description: 'Enum: literal, function',\n },\n value: {\n type: Type.STRING,\n description: 'The default value of the property',\n },\n },\n required: ['type'],\n}\n\nconst PropertySchemaShape = {\n type: Type.OBJECT,\n properties: {\n minimum: { type: Type.NUMBER, nullable: true },\n maximum: { type: Type.NUMBER, nullable: true },\n exclusiveMinimum: { type: Type.BOOLEAN, nullable: true },\n exclusiveMaximum: { type: Type.BOOLEAN, nullable: true },\n multipleOf: { type: Type.NUMBER, nullable: true },\n enum: { type: Type.ARRAY, items: { type: Type.STRING }, nullable: true },\n examples: { type: Type.ARRAY, items: { type: Type.STRING }, nullable: true },\n defaultValue: { ...SchemaDefaultValue, nullable: true },\n pattern: { type: Type.STRING, nullable: true },\n },\n}\n\nconst PropertyConstraintsSchema = {\n type: Type.OBJECT,\n properties: {\n required: { type: Type.BOOLEAN, nullable: true },\n unique: { type: Type.BOOLEAN, nullable: true },\n index: { type: Type.BOOLEAN, nullable: true },\n primary: { type: Type.BOOLEAN, nullable: true },\n multiple: { type: Type.BOOLEAN, nullable: true },\n readOnly: { type: Type.BOOLEAN, nullable: true },\n writeOnly: { type: Type.BOOLEAN, nullable: true },\n },\n}\n\n/**\n * Must comply with the `AiDomainProperty` type.\n */\nconst PropertySchema = {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING },\n name: { type: Type.STRING },\n displayName: { type: Type.STRING },\n description: { type: Type.STRING },\n type: {\n type: Type.STRING,\n description: 'Enum: string, number, boolean, date, datetime, time, binary',\n },\n constraints: PropertyConstraintsSchema,\n deprecated: { type: Type.BOOLEAN },\n schema: PropertySchemaShape,\n semantics: {\n type: Type.ARRAY,\n items: SemanticSchema,\n description: \"List of semantics applied to this property. Note: ONLY use semantics with scope='property'.\",\n },\n tags: { type: Type.ARRAY, items: { type: Type.STRING }, nullable: true },\n },\n required: ['key', 'name', 'type', 'displayName', 'description'],\n}\n\nconst AssociationSchemaShape = {\n type: Type.OBJECT,\n properties: {\n embedded: { type: Type.BOOLEAN, description: 'Whether the association should be embedded in the target entity' },\n unionType: { type: Type.STRING, description: 'Enum: allOf, anyOf, oneOf, not' },\n },\n}\n\n/**\n * Must comply with the `AiDomainAssociation` type.\n */\nconst AssociationSchema = {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING },\n name: { type: Type.STRING },\n displayName: { type: Type.STRING },\n description: { type: Type.STRING },\n targets: { type: Type.ARRAY, items: AssociationTarget },\n required: { type: Type.BOOLEAN },\n multiple: {\n type: Type.BOOLEAN,\n description: 'Whether the association can have multiple targets (like User has multiple addresses)',\n },\n onDelete: { type: Type.STRING, description: 'Enum: restrict, cascade, setNull, doNothing' },\n semantics: {\n type: Type.ARRAY,\n items: SemanticSchema,\n description: \"List of semantics applied to this association. Note: ONLY use semantics with scope='association'.\",\n },\n schema: AssociationSchemaShape,\n },\n required: ['key', 'name', 'targets', 'displayName', 'description'],\n}\n\n/**\n * Must comply with the `AiDataModel` type.\n */\nconst ModelSchema = {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING },\n name: { type: Type.STRING },\n description: { type: Type.STRING },\n },\n required: ['key', 'name'],\n}\n\n/**\n * Must comply with the `AiDomainEntityResponseSchema` type.\n */\nconst EntitySchema = {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING },\n modelKey: { type: Type.STRING, description: 'The Domain Model this entity belongs to (e.g. \"users\", \"shipping\")' },\n name: { type: Type.STRING },\n displayName: { type: Type.STRING },\n description: { type: Type.STRING },\n tags: { type: Type.ARRAY, items: { type: Type.STRING } },\n semantics: {\n type: Type.ARRAY,\n items: SemanticSchema,\n description: \"List of semantics applied to this entity. Note: ONLY use semantics with scope='entity'.\",\n },\n properties: { type: Type.ARRAY, items: PropertySchema },\n associations: { type: Type.ARRAY, items: AssociationSchema },\n },\n required: ['key', 'name', 'modelKey', 'displayName', 'description'],\n}\n\n/**\n * Allows modifying a property (not adding)\n */\nconst PropertyDeltaSchema = {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING },\n name: { type: Type.STRING },\n displayName: { type: Type.STRING },\n description: { type: Type.STRING },\n type: {\n type: Type.STRING,\n description: 'Enum: string, number, boolean, date, datetime, time, binary',\n },\n constraints: { ...PropertyConstraintsSchema, nullable: true },\n deprecated: { type: Type.BOOLEAN, nullable: true },\n schema: { ...PropertySchemaShape, nullable: true },\n addedSemantics: {\n type: Type.ARRAY,\n items: SemanticSchema,\n description: \"Semantics to add. Note: ONLY use semantics with scope='property'.\",\n },\n modifiedSemantics: { type: Type.ARRAY, items: SemanticSchema },\n deletedSemanticIds: { type: Type.ARRAY, items: { type: Type.STRING } },\n },\n required: ['key'],\n}\n\nconst AssociationDeltaSchema = {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING },\n name: { type: Type.STRING },\n displayName: { type: Type.STRING },\n description: { type: Type.STRING },\n targets: { type: Type.ARRAY, items: AssociationTarget },\n required: { type: Type.BOOLEAN, nullable: true },\n multiple: {\n type: Type.BOOLEAN,\n nullable: true,\n description: 'Whether the association can have multiple targets (like User has multiple addresses)',\n },\n onDelete: { type: Type.STRING, nullable: true, description: 'Enum: restrict, cascade, setNull, doNothing' },\n addedSemantics: {\n type: Type.ARRAY,\n items: SemanticSchema,\n description: \"Semantics to add. Note: ONLY use semantics with scope='association'.\",\n },\n modifiedSemantics: { type: Type.ARRAY, items: SemanticSchema },\n deletedSemanticIds: { type: Type.ARRAY, items: { type: Type.STRING } },\n },\n required: ['key'],\n}\n\n/**\n * Must comply with the `AiDomainDeltaResponse` type.\n */\nexport const DOMAIN_SCHEMA = {\n type: Type.OBJECT,\n properties: {\n sessionTitle: {\n type: Type.STRING,\n description: 'A short, 3-to-5 word descriptive title for this data modeling session.',\n },\n reasoning: {\n type: Type.STRING,\n description: 'Conversational response analyzing the request or explaining changes, in markdown format',\n },\n delta: {\n type: Type.OBJECT,\n properties: {\n addedModels: {\n type: Type.ARRAY,\n items: ModelSchema,\n description: 'Brand new models to create',\n },\n deletedModelKeys: {\n type: Type.ARRAY,\n items: { type: Type.STRING },\n description:\n 'Keys of completely removed models. This also removes all entities and associations in the model.',\n },\n modifiedModels: {\n type: Type.ARRAY,\n items: ModelSchema,\n description: 'Models to modify in the domain',\n },\n addedEntities: {\n type: Type.ARRAY,\n items: EntitySchema,\n description: 'Brand new entities to create',\n },\n deletedEntityKeys: {\n type: Type.ARRAY,\n items: { type: Type.STRING },\n description: 'Keys of completely removed entities',\n },\n modifiedEntities: {\n type: Type.ARRAY,\n items: {\n type: Type.OBJECT,\n properties: {\n key: { type: Type.STRING, description: 'The original key of the existing entity being modified' },\n modelKey: {\n type: Type.STRING,\n description: 'Change this to migrate the entity to a different model (boundary)',\n },\n name: { type: Type.STRING },\n displayName: { type: Type.STRING },\n description: { type: Type.STRING },\n tags: { type: Type.ARRAY, items: { type: Type.STRING }, nullable: true },\n addedSemantics: {\n type: Type.ARRAY,\n items: SemanticSchema,\n description: \"Semantics to add. Note: ONLY use semantics with scope='entity'.\",\n },\n modifiedSemantics: { type: Type.ARRAY, items: SemanticSchema },\n deletedSemanticIds: { type: Type.ARRAY, items: { type: Type.STRING } },\n addedProperties: { type: Type.ARRAY, items: PropertySchema },\n modifiedProperties: { type: Type.ARRAY, items: PropertyDeltaSchema },\n deletedPropertyKeys: { type: Type.ARRAY, items: { type: Type.STRING } },\n addedAssociations: { type: Type.ARRAY, items: AssociationSchema },\n modifiedAssociations: { type: Type.ARRAY, items: AssociationDeltaSchema },\n deletedAssociationKeys: { type: Type.ARRAY, items: { type: Type.STRING } },\n },\n required: [\n 'key',\n // 'addedSemantics',\n // 'modifiedSemantics',\n // 'deletedSemanticIds',\n // 'addedProperties',\n // 'modifiedProperties',\n // 'deletedPropertyKeys',\n // 'addedAssociations',\n // 'modifiedAssociations',\n // 'deletedAssociationKeys',\n ],\n },\n description: 'Modifications to existing entities like adding, removing, or changing properties/associations',\n },\n },\n required: [\n 'addedModels',\n 'deletedModelKeys',\n 'modifiedModels',\n 'addedEntities',\n 'deletedEntityKeys',\n 'modifiedEntities',\n ],\n },\n },\n required: ['reasoning', 'delta'],\n}\n"]}
@@ -1,10 +1,9 @@
1
- import type { Shapes } from '@api-client/amf-core';
2
1
  import type { Exception } from '../../exceptions/exception.js';
3
2
  import type { AiSessionSchema } from '../../models/AiSession.js';
4
3
  import type { DomainPropertyType } from '../DataFormat.js';
5
4
  import type { OnDeleteRule } from '../index.js';
6
5
  import { SemanticType } from '../Semantics.js';
7
- import type { AssociationTarget, PropertySchema } from '../types.js';
6
+ import type { AssociationSchema, AssociationTarget, PropertySchema } from '../types.js';
8
7
  import type { AiModelMessageSchema, AiModelMessage, AiUserMessageSchema } from '../../models/AiMessage.js';
9
8
  /**
10
9
  * A copy of the `Type` enum from the `@google/genai` package.
@@ -142,7 +141,7 @@ export interface AiDomainAssociation {
142
141
  multiple?: boolean;
143
142
  onDelete?: OnDeleteRule;
144
143
  semantics?: AiDomainSemantic[];
145
- schema?: Shapes.IApiAssociationShape;
144
+ schema?: AssociationSchema;
146
145
  }
147
146
  /**
148
147
  * The core structure representing a set of modifications (a delta) proposed by the AI.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/modeling/ai/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAE1G;;;GAGG;AACH,oBAAY,IAAI;IACd;;OAEG;IACH,gBAAgB,qBAAqB;IACrC;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,OAAO,YAAY;IACnB;;OAEG;IACH,OAAO,YAAY;IACnB;;OA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AA;IACnB;;OAEG;IACH,uBAAe,CAAA;IACf;;OAEG;IACH,yBAAiB,CAAA;IACjB;;OAEG;IACH,qBAAa,CAAA;AACf,CAAC,EAjCW,IAAI,KAAJ,IAAI,QAiCf","sourcesContent":["import type { Shapes } from '@api-client/amf-core'\nimport type { Exception } from '../../exceptions/exception.js'\nimport type { AiSessionSchema } from '../../models/AiSession.js'\nimport type { DomainPropertyType } from '../DataFormat.js'\nimport type { OnDeleteRule } from '../index.js'\nimport { SemanticType } from '../Semantics.js'\nimport type { AssociationTarget, PropertySchema } from '../types.js'\nimport type { AiModelMessageSchema, AiModelMessage, AiUserMessageSchema } from '../../models/AiMessage.js'\n\n/**\n * A copy of the `Type` enum from the `@google/genai` package.\n * It's here so we don't need to import the nodejs only package.\n */\nexport enum Type {\n /**\n * Not specified, should not be used.\n */\n TYPE_UNSPECIFIED = 'TYPE_UNSPECIFIED',\n /**\n * OpenAPI string type\n */\n STRING = 'STRING',\n /**\n * OpenAPI number type\n */\n NUMBER = 'NUMBER',\n /**\n * OpenAPI integer type\n */\n INTEGER = 'INTEGER',\n /**\n * OpenAPI boolean type\n */\n BOOLEAN = 'BOOLEAN',\n /**\n * OpenAPI array type\n */\n ARRAY = 'ARRAY',\n /**\n * OpenAPI object type\n */\n OBJECT = 'OBJECT',\n /**\n * Null type\n */\n NULL = 'NULL',\n}\n\n/**\n * A lightweight representation of the `DataDomain` used specifically for serializing\n * the current domain state and sending it as context to the AI endpoint.\n * It omits complex internal graph structures, including only essential keys, names,\n * descriptions, and the hierarchical structure of models and entities.\n */\nexport interface AiDataDomainSchema {\n key: string\n name: string\n models: AiDataModelSchema[]\n entities: AiDomainEntitySchema[]\n}\n\n/**\n * A stripped-down representation of a `DomainModel` sent to the AI as part of the\n * domain context. It provides the AI with the existing model hierarchy and descriptions.\n */\nexport interface AiDataModelSchema {\n key: string\n name?: string\n description?: string\n}\n\n/**\n * Represents a semantic annotation applied to an entity, property, or association\n * within the AI's understanding or response. It defines the \"meaning\" of a field\n * (e.g., \"Email\", \"Password\", \"Address\").\n */\nexport interface AiDomainSemantic {\n id: SemanticType\n config?: Record<string, unknown>\n}\n\n/**\n * Represents a full or partial entity schema as generated by the AI in its response delta.\n * It defines a new entity or updates to an existing one, including its properties,\n * associations, semantics, and tags. This is also used by the `get_entity_details` tool\n * to send detailed serialized entity information back to the AI.\n */\nexport interface AiDomainEntityResponseSchema {\n key: string\n modelKey: string\n name?: string\n displayName?: string\n description?: string\n tags?: string[]\n semantics?: AiDomainSemantic[]\n properties?: AiDomainProperty[]\n associations?: AiDomainAssociation[]\n}\n\n/**\n * A minimal representation of an entity used purely for context-setting when\n * sending the current domain structure to the AI. It excludes deeply nested\n * properties and associations to save token space.\n */\nexport interface AiDomainEntitySchema {\n key: string\n modelKey: string\n name?: string\n description?: string\n}\n\n/**\n * Represents a property definition generated by the AI. It maps the complex internal\n * domain property structure into a simpler, flat structure that the AI generates,\n * including data types, constraints, schema metadata, and semantics.\n */\nexport interface AiDomainProperty {\n key?: string\n name?: string\n displayName?: string\n description?: string\n type: DomainPropertyType\n constraints?: {\n required?: boolean\n unique?: boolean\n index?: boolean\n primary?: boolean\n multiple?: boolean\n readOnly?: boolean\n writeOnly?: boolean\n }\n deprecated?: boolean\n schema?: PropertySchema\n semantics?: AiDomainSemantic[]\n tags?: string[] | null\n}\n\n/**\n * Represents an association definition generated by the AI, linking an entity\n * to one or more target entities. It includes relationship rules (like onDelete)\n * and semantic annotations.\n */\nexport interface AiDomainAssociation {\n key: string\n name?: string\n displayName?: string\n description?: string\n targets: AssociationTarget[]\n required?: boolean\n multiple?: boolean\n onDelete?: OnDeleteRule\n semantics?: AiDomainSemantic[]\n schema?: Shapes.IApiAssociationShape\n}\n\n/**\n * The core structure representing a set of modifications (a delta) proposed by the AI.\n * It contains arrays of models and entities to add, delete, or modify. The application\n * processes this delta to transition the data domain to the new requested state.\n */\nexport interface AiDomainDelta {\n /**\n * Models to add to the domain.\n */\n addedModels?: AiDataModelSchema[]\n /**\n * Keys of models to delete from the domain.\n */\n deletedModelKeys?: string[]\n /**\n * Models to modify in the domain.\n */\n modifiedModels?: AiDataModelSchema[]\n /**\n * Entities to add to the domain.\n */\n addedEntities?: AiDomainEntityResponseSchema[]\n /**\n * Keys of entities to delete from the domain.\n */\n deletedEntityKeys?: string[]\n /**\n * Entities to modify in the domain.\n */\n modifiedEntities?: AiDomainEntityDelta[]\n}\n\n/**\n * The expected JSON schema structure returned by the AI endpoint when performing\n * data domain manipulation. It includes the AI's step-by-step reasoning and the\n * actionable delta to be applied.\n */\nexport interface AiDomainDeltaResponse {\n /**\n * The LLM reasoning.\n */\n reasoning: string\n /**\n * Domain changes delta\n */\n delta?: AiDomainDelta\n}\n\n/**\n * Union type for progressive SSE stream chunks\n * received from the AI generation endpoint.\n */\nexport type AiStreamEvent =\n | { event: 'user-message'; data: AiUserMessageSchema }\n | { event: 'agent-message'; data: AiModelMessageSchema }\n | { event: 'thought-chunk'; data: string }\n | { event: 'text-chunk'; data: string }\n | { event: 'done'; data: AiModelMessageSchema }\n | { event: 'error'; data: Exception }\n | { event: 'session-updated'; data: AiSessionSchema }\n\n/**\n * Represents a targeted modification to an existing entity generated by the AI.\n * Instead of providing the full entity state, the AI provides explicit arrays\n * of properties, associations, and semantics to add, modify, or delete, enabling\n * precise, non-destructive updates.\n */\nexport interface AiDomainEntityDelta {\n key: string\n modelKey?: string // Provide to move the entity to a different model\n name?: string\n displayName?: string\n description?: string\n tags?: string[] | null\n // Entity semantics delta\n addedSemantics?: AiDomainSemantic[]\n modifiedSemantics?: AiDomainSemantic[]\n deletedSemanticIds?: SemanticType[]\n // Explicit deltas so the LLM doesn't have to list untouched properties\n addedProperties?: AiDomainProperty[]\n modifiedProperties?: AiDomainPropertyDelta[]\n deletedPropertyKeys?: string[]\n addedAssociations?: AiDomainAssociation[]\n modifiedAssociations?: AiDomainAssociationDelta[]\n deletedAssociationKeys?: string[]\n}\n\nexport type NullablePropertySchema = {\n [K in keyof PropertySchema]?: PropertySchema[K] | null\n}\n\n/**\n * Represents a targeted modification to an existing property generated by the AI.\n * It captures changes to superficial properties (name, description), type changes,\n * constraint updates, and semantic alterations.\n */\nexport interface AiDomainPropertyDelta {\n key: string\n name?: string\n displayName?: string\n description?: string\n type?: DomainPropertyType\n constraints?: {\n required?: boolean | null\n unique?: boolean | null\n index?: boolean | null\n primary?: boolean | null\n multiple?: boolean | null\n readOnly?: boolean | null\n writeOnly?: boolean | null\n } | null\n deprecated?: boolean | null\n // Property semantics delta\n addedSemantics?: AiDomainSemantic[]\n modifiedSemantics?: AiDomainSemantic[]\n deletedSemanticIds?: SemanticType[]\n schema?: NullablePropertySchema\n}\n\n/**\n * Represents a targeted modification to an existing association generated by the AI.\n * It captures updates to relationship cardinality, target entities, deletion rules,\n * and applied semantics.\n */\nexport interface AiDomainAssociationDelta {\n key: string\n name?: string\n displayName?: string\n description?: string\n targets?: AssociationTarget[]\n required?: boolean | null\n multiple?: boolean | null\n onDelete?: OnDeleteRule | null\n // Association semantics delta\n addedSemantics?: AiDomainSemantic[]\n modifiedSemantics?: AiDomainSemantic[]\n deletedSemanticIds?: SemanticType[]\n}\n\n/**\n * An enriched, in-memory representation of a model's message that includes the globally\n * parsed `AiDomainDelta` object.\n * This is not stored directly in the datastore as-is; instead, the raw JSON text is stored,\n * and this structure is assembled at runtime when the chat history is loaded into the UI.\n */\nexport interface AiModelMessageWithDelta extends AiModelMessage {\n /**\n * The delta of the message, if any.\n */\n delta?: AiDomainDelta\n /**\n * The reasoning of the delta.\n * Format in markdown.\n */\n reasoning?: string\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/modeling/ai/types.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,CAAN,IAAY,IAiCX;AAjCD,WAAY,IAAI;IACd;;OAEG;IACH,6CAAqC,CAAA;IACrC;;OAEG;IACH,yBAAiB,CAAA;IACjB;;OAEG;IACH,yBAAiB,CAAA;IACjB;;OAEG;IACH,2BAAmB,CAAA;IACnB;;OAEG;IACH,2BAAmB,CAAA;IACnB;;OAEG;IACH,uBAAe,CAAA;IACf;;OAEG;IACH,yBAAiB,CAAA;IACjB;;OAEG;IACH,qBAAa,CAAA;AACf,CAAC,EAjCW,IAAI,KAAJ,IAAI,QAiCf","sourcesContent":["import type { Exception } from '../../exceptions/exception.js'\nimport type { AiSessionSchema } from '../../models/AiSession.js'\nimport type { DomainPropertyType } from '../DataFormat.js'\nimport type { OnDeleteRule } from '../index.js'\nimport { SemanticType } from '../Semantics.js'\nimport type { AssociationSchema, AssociationTarget, PropertySchema } from '../types.js'\nimport type { AiModelMessageSchema, AiModelMessage, AiUserMessageSchema } from '../../models/AiMessage.js'\n\n/**\n * A copy of the `Type` enum from the `@google/genai` package.\n * It's here so we don't need to import the nodejs only package.\n */\nexport enum Type {\n /**\n * Not specified, should not be used.\n */\n TYPE_UNSPECIFIED = 'TYPE_UNSPECIFIED',\n /**\n * OpenAPI string type\n */\n STRING = 'STRING',\n /**\n * OpenAPI number type\n */\n NUMBER = 'NUMBER',\n /**\n * OpenAPI integer type\n */\n INTEGER = 'INTEGER',\n /**\n * OpenAPI boolean type\n */\n BOOLEAN = 'BOOLEAN',\n /**\n * OpenAPI array type\n */\n ARRAY = 'ARRAY',\n /**\n * OpenAPI object type\n */\n OBJECT = 'OBJECT',\n /**\n * Null type\n */\n NULL = 'NULL',\n}\n\n/**\n * A lightweight representation of the `DataDomain` used specifically for serializing\n * the current domain state and sending it as context to the AI endpoint.\n * It omits complex internal graph structures, including only essential keys, names,\n * descriptions, and the hierarchical structure of models and entities.\n */\nexport interface AiDataDomainSchema {\n key: string\n name: string\n models: AiDataModelSchema[]\n entities: AiDomainEntitySchema[]\n}\n\n/**\n * A stripped-down representation of a `DomainModel` sent to the AI as part of the\n * domain context. It provides the AI with the existing model hierarchy and descriptions.\n */\nexport interface AiDataModelSchema {\n key: string\n name?: string\n description?: string\n}\n\n/**\n * Represents a semantic annotation applied to an entity, property, or association\n * within the AI's understanding or response. It defines the \"meaning\" of a field\n * (e.g., \"Email\", \"Password\", \"Address\").\n */\nexport interface AiDomainSemantic {\n id: SemanticType\n config?: Record<string, unknown>\n}\n\n/**\n * Represents a full or partial entity schema as generated by the AI in its response delta.\n * It defines a new entity or updates to an existing one, including its properties,\n * associations, semantics, and tags. This is also used by the `get_entity_details` tool\n * to send detailed serialized entity information back to the AI.\n */\nexport interface AiDomainEntityResponseSchema {\n key: string\n modelKey: string\n name?: string\n displayName?: string\n description?: string\n tags?: string[]\n semantics?: AiDomainSemantic[]\n properties?: AiDomainProperty[]\n associations?: AiDomainAssociation[]\n}\n\n/**\n * A minimal representation of an entity used purely for context-setting when\n * sending the current domain structure to the AI. It excludes deeply nested\n * properties and associations to save token space.\n */\nexport interface AiDomainEntitySchema {\n key: string\n modelKey: string\n name?: string\n description?: string\n}\n\n/**\n * Represents a property definition generated by the AI. It maps the complex internal\n * domain property structure into a simpler, flat structure that the AI generates,\n * including data types, constraints, schema metadata, and semantics.\n */\nexport interface AiDomainProperty {\n key?: string\n name?: string\n displayName?: string\n description?: string\n type: DomainPropertyType\n constraints?: {\n required?: boolean\n unique?: boolean\n index?: boolean\n primary?: boolean\n multiple?: boolean\n readOnly?: boolean\n writeOnly?: boolean\n }\n deprecated?: boolean\n schema?: PropertySchema\n semantics?: AiDomainSemantic[]\n tags?: string[] | null\n}\n\n/**\n * Represents an association definition generated by the AI, linking an entity\n * to one or more target entities. It includes relationship rules (like onDelete)\n * and semantic annotations.\n */\nexport interface AiDomainAssociation {\n key: string\n name?: string\n displayName?: string\n description?: string\n targets: AssociationTarget[]\n required?: boolean\n multiple?: boolean\n onDelete?: OnDeleteRule\n semantics?: AiDomainSemantic[]\n schema?: AssociationSchema\n}\n\n/**\n * The core structure representing a set of modifications (a delta) proposed by the AI.\n * It contains arrays of models and entities to add, delete, or modify. The application\n * processes this delta to transition the data domain to the new requested state.\n */\nexport interface AiDomainDelta {\n /**\n * Models to add to the domain.\n */\n addedModels?: AiDataModelSchema[]\n /**\n * Keys of models to delete from the domain.\n */\n deletedModelKeys?: string[]\n /**\n * Models to modify in the domain.\n */\n modifiedModels?: AiDataModelSchema[]\n /**\n * Entities to add to the domain.\n */\n addedEntities?: AiDomainEntityResponseSchema[]\n /**\n * Keys of entities to delete from the domain.\n */\n deletedEntityKeys?: string[]\n /**\n * Entities to modify in the domain.\n */\n modifiedEntities?: AiDomainEntityDelta[]\n}\n\n/**\n * The expected JSON schema structure returned by the AI endpoint when performing\n * data domain manipulation. It includes the AI's step-by-step reasoning and the\n * actionable delta to be applied.\n */\nexport interface AiDomainDeltaResponse {\n /**\n * The LLM reasoning.\n */\n reasoning: string\n /**\n * Domain changes delta\n */\n delta?: AiDomainDelta\n}\n\n/**\n * Union type for progressive SSE stream chunks\n * received from the AI generation endpoint.\n */\nexport type AiStreamEvent =\n | { event: 'user-message'; data: AiUserMessageSchema }\n | { event: 'agent-message'; data: AiModelMessageSchema }\n | { event: 'thought-chunk'; data: string }\n | { event: 'text-chunk'; data: string }\n | { event: 'done'; data: AiModelMessageSchema }\n | { event: 'error'; data: Exception }\n | { event: 'session-updated'; data: AiSessionSchema }\n\n/**\n * Represents a targeted modification to an existing entity generated by the AI.\n * Instead of providing the full entity state, the AI provides explicit arrays\n * of properties, associations, and semantics to add, modify, or delete, enabling\n * precise, non-destructive updates.\n */\nexport interface AiDomainEntityDelta {\n key: string\n modelKey?: string // Provide to move the entity to a different model\n name?: string\n displayName?: string\n description?: string\n tags?: string[] | null\n // Entity semantics delta\n addedSemantics?: AiDomainSemantic[]\n modifiedSemantics?: AiDomainSemantic[]\n deletedSemanticIds?: SemanticType[]\n // Explicit deltas so the LLM doesn't have to list untouched properties\n addedProperties?: AiDomainProperty[]\n modifiedProperties?: AiDomainPropertyDelta[]\n deletedPropertyKeys?: string[]\n addedAssociations?: AiDomainAssociation[]\n modifiedAssociations?: AiDomainAssociationDelta[]\n deletedAssociationKeys?: string[]\n}\n\nexport type NullablePropertySchema = {\n [K in keyof PropertySchema]?: PropertySchema[K] | null\n}\n\n/**\n * Represents a targeted modification to an existing property generated by the AI.\n * It captures changes to superficial properties (name, description), type changes,\n * constraint updates, and semantic alterations.\n */\nexport interface AiDomainPropertyDelta {\n key: string\n name?: string\n displayName?: string\n description?: string\n type?: DomainPropertyType\n constraints?: {\n required?: boolean | null\n unique?: boolean | null\n index?: boolean | null\n primary?: boolean | null\n multiple?: boolean | null\n readOnly?: boolean | null\n writeOnly?: boolean | null\n } | null\n deprecated?: boolean | null\n // Property semantics delta\n addedSemantics?: AiDomainSemantic[]\n modifiedSemantics?: AiDomainSemantic[]\n deletedSemanticIds?: SemanticType[]\n schema?: NullablePropertySchema\n}\n\n/**\n * Represents a targeted modification to an existing association generated by the AI.\n * It captures updates to relationship cardinality, target entities, deletion rules,\n * and applied semantics.\n */\nexport interface AiDomainAssociationDelta {\n key: string\n name?: string\n displayName?: string\n description?: string\n targets?: AssociationTarget[]\n required?: boolean | null\n multiple?: boolean | null\n onDelete?: OnDeleteRule | null\n // Association semantics delta\n addedSemantics?: AiDomainSemantic[]\n modifiedSemantics?: AiDomainSemantic[]\n deletedSemanticIds?: SemanticType[]\n}\n\n/**\n * An enriched, in-memory representation of a model's message that includes the globally\n * parsed `AiDomainDelta` object.\n * This is not stored directly in the datastore as-is; instead, the raw JSON text is stored,\n * and this structure is assembled at runtime when the chat history is loaded into the UI.\n */\nexport interface AiModelMessageWithDelta extends AiModelMessage {\n /**\n * The delta of the message, if any.\n */\n delta?: AiDomainDelta\n /**\n * The reasoning of the delta.\n * Format in markdown.\n */\n reasoning?: string\n}\n"]}
@@ -184,7 +184,7 @@ export class ShapeGenerator {
184
184
  */
185
185
  associationShape(input, visited = new Set()) {
186
186
  const schema = input.schema;
187
- if (schema && schema.linked) {
187
+ if (!schema?.embedded) {
188
188
  return this.createLinkedShape(input);
189
189
  }
190
190
  const items = this.associationUnion(input, visited);