@api-client/core 0.13.6 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/build/src/amf/AmfTypes.d.ts +1 -1
  2. package/build/src/amf/AmfTypes.js +1 -1
  3. package/build/src/amf/AmfTypes.js.map +1 -1
  4. package/build/src/amf/Utils.d.ts +0 -6
  5. package/build/src/amf/Utils.d.ts.map +1 -1
  6. package/build/src/amf/Utils.js +0 -14
  7. package/build/src/amf/Utils.js.map +1 -1
  8. package/build/src/browser.d.ts +1 -0
  9. package/build/src/browser.d.ts.map +1 -1
  10. package/build/src/browser.js +1 -0
  11. package/build/src/browser.js.map +1 -1
  12. package/build/src/index.d.ts +1 -0
  13. package/build/src/index.d.ts.map +1 -1
  14. package/build/src/index.js +1 -0
  15. package/build/src/index.js.map +1 -1
  16. package/build/src/legacy.d.ts +0 -8
  17. package/build/src/legacy.d.ts.map +1 -1
  18. package/build/src/legacy.js +0 -9
  19. package/build/src/legacy.js.map +1 -1
  20. package/build/src/modeling/Bindings.d.ts +1 -1
  21. package/build/src/modeling/Bindings.js.map +1 -1
  22. package/build/src/modeling/DataDomain.js +2 -2
  23. package/build/src/modeling/DataDomain.js.map +1 -1
  24. package/build/src/modeling/DataFormat.d.ts +0 -40
  25. package/build/src/modeling/DataFormat.d.ts.map +1 -1
  26. package/build/src/modeling/DataFormat.js +0 -27
  27. package/build/src/modeling/DataFormat.js.map +1 -1
  28. package/build/src/modeling/DomainAssociation.d.ts +28 -0
  29. package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
  30. package/build/src/modeling/DomainAssociation.js +73 -4
  31. package/build/src/modeling/DomainAssociation.js.map +1 -1
  32. package/build/src/modeling/DomainEntity.d.ts +25 -9
  33. package/build/src/modeling/DomainEntity.d.ts.map +1 -1
  34. package/build/src/modeling/DomainEntity.js +65 -21
  35. package/build/src/modeling/DomainEntity.js.map +1 -1
  36. package/build/src/modeling/DomainFile.d.ts +3 -4
  37. package/build/src/modeling/DomainFile.d.ts.map +1 -1
  38. package/build/src/modeling/DomainFile.js +5 -9
  39. package/build/src/modeling/DomainFile.js.map +1 -1
  40. package/build/src/modeling/DomainImpactAnalysis.d.ts +1 -1
  41. package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
  42. package/build/src/modeling/DomainImpactAnalysis.js +3 -3
  43. package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
  44. package/build/src/modeling/DomainModel.d.ts +2 -2
  45. package/build/src/modeling/DomainModel.js +2 -2
  46. package/build/src/modeling/DomainModel.js.map +1 -1
  47. package/build/src/modeling/DomainProperty.d.ts +28 -12
  48. package/build/src/modeling/DomainProperty.d.ts.map +1 -1
  49. package/build/src/modeling/DomainProperty.js +61 -26
  50. package/build/src/modeling/DomainProperty.js.map +1 -1
  51. package/build/src/modeling/Semantics.d.ts +109 -0
  52. package/build/src/modeling/Semantics.d.ts.map +1 -0
  53. package/build/src/modeling/Semantics.js +97 -0
  54. package/build/src/modeling/Semantics.js.map +1 -0
  55. package/build/src/models/CertificateFile.d.ts +2 -3
  56. package/build/src/models/CertificateFile.d.ts.map +1 -1
  57. package/build/src/models/CertificateFile.js +4 -8
  58. package/build/src/models/CertificateFile.js.map +1 -1
  59. package/build/src/models/Folder.d.ts +1 -2
  60. package/build/src/models/Folder.d.ts.map +1 -1
  61. package/build/src/models/Folder.js +2 -4
  62. package/build/src/models/Folder.js.map +1 -1
  63. package/build/src/models/Project.d.ts +2 -3
  64. package/build/src/models/Project.d.ts.map +1 -1
  65. package/build/src/models/Project.js +4 -8
  66. package/build/src/models/Project.js.map +1 -1
  67. package/build/src/models/kinds.d.ts +0 -24
  68. package/build/src/models/kinds.d.ts.map +1 -1
  69. package/build/src/models/kinds.js +0 -24
  70. package/build/src/models/kinds.js.map +1 -1
  71. package/build/src/models/store/File.d.ts +1 -21
  72. package/build/src/models/store/File.d.ts.map +1 -1
  73. package/build/src/models/store/File.js +3 -23
  74. package/build/src/models/store/File.js.map +1 -1
  75. package/build/src/models/store/data_catalog.d.ts +1 -1
  76. package/build/src/models/store/data_catalog.js.map +1 -1
  77. package/build/src/sdk/FilesSdk.js +1 -1
  78. package/build/src/sdk/FilesSdk.js.map +1 -1
  79. package/build/tsconfig.tsbuildinfo +1 -1
  80. package/data/models/example-generator-api.json +22 -22
  81. package/eslint.config.js +1 -0
  82. package/package.json +5 -5
  83. package/src/amf/AmfTypes.ts +1 -1
  84. package/src/amf/Utils.ts +0 -15
  85. package/src/modeling/Bindings.ts +1 -1
  86. package/src/modeling/DataDomain.ts +2 -2
  87. package/src/modeling/DataFormat.ts +0 -48
  88. package/src/modeling/DomainAssociation.ts +66 -3
  89. package/src/modeling/DomainEntity.ts +56 -17
  90. package/src/modeling/DomainFile.ts +5 -9
  91. package/src/modeling/DomainImpactAnalysis.ts +3 -3
  92. package/src/modeling/DomainModel.ts +2 -2
  93. package/src/modeling/DomainProperty.ts +60 -21
  94. package/src/modeling/Semantics.ts +178 -0
  95. package/src/modeling/graph.md +14 -14
  96. package/src/modeling/readme.md +29 -29
  97. package/src/models/CertificateFile.ts +4 -12
  98. package/src/models/Folder.ts +2 -4
  99. package/src/models/Project.ts +4 -8
  100. package/src/models/kinds.ts +0 -25
  101. package/src/models/store/File.ts +4 -35
  102. package/src/models/store/data_catalog.ts +1 -1
  103. package/src/sdk/FilesSdk.ts +1 -1
  104. package/tests/unit/modeling/data_domain_change_observers.spec.ts +11 -10
  105. package/tests/unit/modeling/data_domain_entities.spec.ts +129 -1
  106. package/tests/unit/modeling/data_domain_property.spec.ts +1 -1
  107. package/tests/unit/modeling/domain_asociation.spec.ts +177 -0
  108. package/tests/unit/modeling/domain_entity.spec.ts +27 -26
  109. package/tests/unit/modeling/domain_entity_example_generator_json.spec.ts +11 -11
  110. package/tests/unit/modeling/domain_entity_example_generator_xml.spec.ts +10 -10
  111. package/tests/unit/modeling/domain_file.spec.ts +4 -27
  112. package/tests/unit/modeling/{domain.property.spec.ts → domain_property.spec.ts} +139 -23
  113. package/tests/unit/models/Certificate/from_name.spec.ts +3 -15
  114. package/tests/unit/models/File/constructor.spec.ts +0 -1
  115. package/tests/unit/models/File/new.spec.ts +0 -13
  116. package/tests/unit/models/File/shortcutTo.spec.ts +1 -2
  117. package/tests/unit/models/File/toJSON.spec.ts +0 -13
  118. package/tests/unit/models/File/updateByMeMeta.spec.ts +4 -6
  119. package/tests/unit/models/Folder/create.spec.ts +2 -23
  120. package/tests/unit/models/Project/create.spec.ts +6 -32
  121. package/build/src/amf/AmfShapeGenerator.d.ts +0 -103
  122. package/build/src/amf/AmfShapeGenerator.d.ts.map +0 -1
  123. package/build/src/amf/AmfShapeGenerator.js +0 -416
  124. package/build/src/amf/AmfShapeGenerator.js.map +0 -1
  125. package/build/src/modeling/legacy/DataAssociation.d.ts +0 -284
  126. package/build/src/modeling/legacy/DataAssociation.d.ts.map +0 -1
  127. package/build/src/modeling/legacy/DataAssociation.js +0 -443
  128. package/build/src/modeling/legacy/DataAssociation.js.map +0 -1
  129. package/build/src/modeling/legacy/DataEntity.d.ts +0 -358
  130. package/build/src/modeling/legacy/DataEntity.d.ts.map +0 -1
  131. package/build/src/modeling/legacy/DataEntity.js +0 -855
  132. package/build/src/modeling/legacy/DataEntity.js.map +0 -1
  133. package/build/src/modeling/legacy/DataEntityBuilder.d.ts +0 -162
  134. package/build/src/modeling/legacy/DataEntityBuilder.d.ts.map +0 -1
  135. package/build/src/modeling/legacy/DataEntityBuilder.js +0 -221
  136. package/build/src/modeling/legacy/DataEntityBuilder.js.map +0 -1
  137. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts +0 -298
  138. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts.map +0 -1
  139. package/build/src/modeling/legacy/DataImpactAnalysis.js +0 -441
  140. package/build/src/modeling/legacy/DataImpactAnalysis.js.map +0 -1
  141. package/build/src/modeling/legacy/DataModel.d.ts +0 -99
  142. package/build/src/modeling/legacy/DataModel.d.ts.map +0 -1
  143. package/build/src/modeling/legacy/DataModel.js +0 -237
  144. package/build/src/modeling/legacy/DataModel.js.map +0 -1
  145. package/build/src/modeling/legacy/DataNamespace.d.ts +0 -340
  146. package/build/src/modeling/legacy/DataNamespace.d.ts.map +0 -1
  147. package/build/src/modeling/legacy/DataNamespace.js +0 -784
  148. package/build/src/modeling/legacy/DataNamespace.js.map +0 -1
  149. package/build/src/modeling/legacy/DataProperty.d.ts +0 -332
  150. package/build/src/modeling/legacy/DataProperty.d.ts.map +0 -1
  151. package/build/src/modeling/legacy/DataProperty.js +0 -415
  152. package/build/src/modeling/legacy/DataProperty.js.map +0 -1
  153. package/build/src/models/store/DataFile.d.ts +0 -31
  154. package/build/src/models/store/DataFile.d.ts.map +0 -1
  155. package/build/src/models/store/DataFile.js +0 -92
  156. package/build/src/models/store/DataFile.js.map +0 -1
  157. package/src/amf/AmfShapeGenerator.ts +0 -477
  158. package/src/modeling/legacy/DataAssociation.ts +0 -554
  159. package/src/modeling/legacy/DataEntity.ts +0 -1019
  160. package/src/modeling/legacy/DataEntityBuilder.ts +0 -236
  161. package/src/modeling/legacy/DataImpactAnalysis.ts +0 -530
  162. package/src/modeling/legacy/DataModel.ts +0 -276
  163. package/src/modeling/legacy/DataNamespace.ts +0 -929
  164. package/src/modeling/legacy/DataProperty.ts +0 -630
  165. package/src/models/store/DataFile.ts +0 -100
  166. package/tests/unit/modeling/legacy/amf_shape_generator.spec.ts +0 -1041
  167. package/tests/unit/modeling/legacy/data_association.spec.ts +0 -710
  168. package/tests/unit/modeling/legacy/data_entity.spec.ts +0 -2061
  169. package/tests/unit/modeling/legacy/data_entity_generator_json.spec.ts +0 -987
  170. package/tests/unit/modeling/legacy/data_entity_generator_xml.spec.ts +0 -1451
  171. package/tests/unit/modeling/legacy/data_model.spec.ts +0 -395
  172. package/tests/unit/modeling/legacy/data_namespace.spec.ts +0 -1312
  173. package/tests/unit/modeling/legacy/data_property.spec.ts +0 -887
  174. package/tests/unit/modeling/legacy/impact_analysis.sp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,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACvC,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;oBACrB,OAAO,QAAQ,CAAA;gBACjB,CAAC;YACH,CAAC;YACD,IAAI,QAAoC,CAAA;YACxC,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxC,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,EAAE,CAAA;gBAChC,IAAI,IAAI,EAAE,CAAC;oBACT,qDAAqD;oBACrD,sDAAsD;oBACtD,gBAAgB;oBAChB,mEAAmE;oBACnE,gDAAgD;oBAChD,QAAQ,GAAG,IAAI,CAAA;gBACjB,CAAC;YACH,CAAC;YACD,OAAO,QAAQ,CAAA;QACjB,CAAC;;;SA9sBU,YAAY","sourcesContent":["import type { DataDomain } from './DataDomain.js'\nimport { DomainAssociationKind, DomainEntityKind, DomainPropertyKind } from '../models/kinds.js'\nimport { DomainElement, type DomainElementSchema } from './DomainElement.js'\nimport { nanoid } from '../nanoid.js'\nimport { type IThing, Thing } from '../models/Thing.js'\nimport { observed, retargetChange, toRaw } from './observed.js'\nimport type { IShapeUnion } from '../amf/definitions/Shapes.js'\nimport { DomainProperty, type DomainPropertySchema } from './DomainProperty.js'\nimport { RemovePropertyException } from '../exceptions/remove_property_exception.js'\nimport { DomainAssociation, DomainAssociationSchema } from './DomainAssociation.js'\nimport type { AssociationAddOptions } from './types.js'\nimport type { FileBreadcrumb } from '../models/store/File.js'\nimport type { DomainModel } from './DomainModel.js'\nimport type { DomainNamespace } from './DomainNamespace.js'\nimport { ValidationError } from '../exceptions/validation_error.js'\nimport { ShapeGenerator } from './amf/ShapeGenerator.js'\nimport type { IShapeRenderOptions } from '../amf/shape/ShapeBase.js'\nimport { ApiSchemaGenerator } from '../amf/ApiSchemaGenerator.js'\nimport { removeGraphNode } from './GraphUtils.js'\n\nexport interface EntityOrderedItem {\n /**\n * The type of the ordered item.\n */\n type: 'property' | 'association'\n\n /**\n * The key of the ordered item.\n */\n key: string\n}\n\nexport interface DomainEntitySchema extends DomainElementSchema {\n kind: typeof DomainEntityKind\n /**\n * The domain entity description.\n */\n info: IThing\n\n /**\n * Optional general purpose tags for the UI.\n */\n tags?: string[]\n\n /**\n * For future use.\n *\n * The keys of the taxonomy items associated with the entity.\n */\n taxonomy?: string[]\n\n /**\n * The ordered list of fields (properties and associations) in the schema.\n * These only keep references to the properties and associations.\n * The order of the fields is important as it defines the order of the\n * properties in the schema.\n */\n fields?: EntityOrderedItem[]\n\n /**\n * Whether this entity is deprecated.\n */\n deprecated?: boolean\n}\n\n/**\n * Represents an entity within a data domain model.\n *\n * A `DomainEntity` defines a structured data type,\n * containing properties and associations. It's a\n * fundamental building block for modeling complex data\n * structures.\n *\n * **Key Features:**\n *\n * - **Properties:** Defines the data elements (fields) within the entity.\n * - **Associations:** Defines relationships to other entities.\n * - **Inheritance:** Supports inheriting properties and associations from parent entities.\n * - **Metadata:** Supports tags, taxonomy, and deprecation status.\n * - **AMF Shape Generation:** Can be serialized to an AMF (API Modeling Framework) shape.\n * - **Example Generation:** Can generate example databased on its schema.\n *\n * **Usage:**\n *\n * The preferred way to create a `DomainEntity` is through\n * the `DomainModel.addEntity()` 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 * ```\n *\n * Entity Validation Rules:\n *\n * - **Primary Key:** An entity must have a primary key selected. This can come from a parent\n * entity or be defined in the current entity.\n * - **Parent Entity:** The parent entity must exist in the graph.\n * - **Circular Dependency:** Adding a parent entity that creates a circular dependency is not allowed.\n * - **Unique Parent:** An entity cannot have the same parent more than once.\n * - **Property Shadowing:** A property can shadow a parent property. This means that if a property\n * with the same key exists in both the parent and child entity, the child property will take precedence.\n * - **Association Shadowing:** An association can shadow a parent association. This means that if an\n * association with the same key exists in both the parent and child entity,\n * the child association will take precedence.\n * - **Property Resolution:** When the same property exists more than one parent and the child entity,\n * doesn't explicitly define the property, then:\n * - The last parent entity (iterating from the first entity to the last) that has the property\n * will be used as the source of the property.\n * - **Association Resolution:** When the same association exists more than one parent and the child entity,\n * doesn't explicitly define the association, then:\n * - The last parent entity (iterating from the first entity to the last) that has the association\n * will be used as the source of the association.\n * - **Minimum Required Properties:** An entity must have at least one property defined. Entities without properties\n * are ignored in the system.\n * - **Entity Name**:\n * - An entity must have a name defined.\n * - The name has to follow the same rules as the names in a SQL database. This means that the name must be unique\n * within the data domain and cannot contain special characters.\n * - **Association Targets:** An association must have a target entity defined.\n * This means that the association must point to at least one entity.\n */\nexport class DomainEntity extends DomainElement {\n /**\n * The kind of the domain element.\n */\n override kind: typeof DomainEntityKind\n\n /**\n * The description of the domain entity.\n */\n @retargetChange() accessor info: Thing\n\n /**\n * Optional general purpose tags for the UI.\n */\n @observed({ deep: true }) accessor tags: string[]\n\n /**\n * Reserved for future use.\n *\n * The keys of the taxonomy items associated with the entity.\n */\n @observed({ deep: true }) accessor taxonomy: string[]\n\n /**\n * The ordered list of fields (properties and associations) in the schema.\n * These only keep references to the properties and associations.\n * The order of the fields is important as it defines the order of the\n * properties in the schema.\n */\n accessor fields: EntityOrderedItem[]\n\n /**\n * Whether this entity is deprecated.\n */\n @observed() accessor deprecated: boolean | undefined\n\n /**\n * Creates a full data entity schema with defaults.\n *\n * @param input The partial data entity schema.\n * @returns The data entity schema.\n */\n static createSchema(input: Partial<DomainEntitySchema> = {}): DomainEntitySchema {\n const { key = nanoid(), tags, taxonomy, fields, deprecated } = input\n const info = Thing.fromJSON(input.info, { name: 'New entity' }).toJSON()\n const result: DomainEntitySchema = {\n kind: DomainEntityKind,\n key,\n info,\n }\n if (Array.isArray(tags)) {\n result.tags = [...tags]\n }\n if (Array.isArray(taxonomy)) {\n result.taxonomy = [...taxonomy]\n }\n if (Array.isArray(fields)) {\n result.fields = [...fields]\n }\n if (typeof deprecated === 'boolean') {\n result.deprecated = deprecated\n }\n return result\n }\n\n /**\n * Creates a new domain entity instance.\n *\n * You probably want to use the `DomainModel.addEntity()`\n * method instead.\n *\n * @param root A reference to the root DataDomain instance.\n * @param input The partial domain entity schema.\n */\n constructor(root: DataDomain, input?: Partial<DomainEntitySchema>) {\n const init = DomainEntity.createSchema(input)\n super(root, init.key)\n this.kind = DomainEntityKind\n this.info = new Thing(init.info)\n if (Array.isArray(init.tags)) {\n this.tags = [...init.tags]\n } else {\n this.tags = []\n }\n if (Array.isArray(init.taxonomy)) {\n this.taxonomy = [...init.taxonomy]\n } else {\n this.taxonomy = []\n }\n if (Array.isArray(init.fields)) {\n this.fields = [...init.fields]\n } else {\n this.fields = []\n }\n if (typeof init.deprecated === 'boolean') {\n this.deprecated = init.deprecated\n }\n }\n\n /**\n * Generates a JSON representation of the entity.\n *\n * @returns A plain object representation of the `DomainEntity`.\n */\n toJSON(): DomainEntitySchema {\n const result: DomainEntitySchema = {\n kind: this.kind,\n key: this.key,\n info: this.info.toJSON(),\n }\n if (Array.isArray(this.fields) && this.fields.length) {\n result.fields = [...this.fields]\n }\n if (Array.isArray(this.taxonomy) && this.taxonomy.length) {\n result.taxonomy = [...(toRaw(this, this.taxonomy) as string[])]\n }\n if (Array.isArray(this.tags) && this.tags.length) {\n result.tags = [...(toRaw(this, this.tags) as string[])]\n }\n if (typeof this.deprecated === 'boolean') {\n result.deprecated = this.deprecated\n }\n return result\n }\n\n /**\n * Returns a parent data entity where this data property\n * exist.\n *\n * @returns The parent `DomainModel` or undefined if not found.\n * @example\n * ```typescript\n * const parent = entity.getParentInstance();\n * if (parent) {\n * console.log(parent.key);\n * }\n * ```\n */\n getParentInstance(): DomainModel | undefined {\n const parentKey = this.root.graph.parent(this.key)\n if (!parentKey) {\n return undefined\n }\n return this.root.graph.node(parentKey) as DomainModel | undefined\n }\n\n /**\n * Adds a property to this entity.\n *\n * @param property The partial property schema.\n * @returns The created `DomainProperty` instance.\n * @example\n * ```typescript\n * const property = entity.addProperty({\n * key: 'name',\n * type: 'string',\n * required: true,\n * })\n * ```\n */\n addProperty(property?: Partial<DomainPropertySchema>): DomainProperty {\n if (property && property.key && this.root.graph.hasNode(property.key)) {\n throw new Error(`Trying to add a property ${property.key}, but it already exists`)\n }\n const instance = new DomainProperty(this.root, this.key, property)\n this.root.graph.setNode(instance.key, instance)\n this.root.graph.setEdge(this.key, instance.key, { type: 'property' })\n this.fields.push({\n type: 'property',\n key: instance.key,\n })\n this.root.notifyChange()\n return instance\n }\n\n /**\n * Removes a property from this entity.\n *\n * @param key The key of the property to remove.\n * @throws {RemovePropertyException} When the property does not exist.\n * @example\n * ```typescript\n * entity.removeProperty('name')\n * ```\n */\n removeProperty(key: string): void {\n if (!this.root.graph.hasNode(key)) {\n throw new RemovePropertyException(`Trying to remove the ${key} property, but it doesn't exist`)\n }\n const prop = this.root.graph.node(key) as DomainProperty\n if (prop.getParentInstance() !== this) {\n throw new RemovePropertyException(`Trying to remove the ${key} property, but it doesn't belong to this entity`)\n }\n removeGraphNode(this.root.graph, key)\n this.removeField(key)\n this.root.notifyChange()\n }\n\n /**\n * A shortcut to `listProperties()`.\n */\n get properties(): Generator<DomainProperty> {\n return this.listProperties()\n }\n\n /**\n * Lists all properties of this entity.\n *\n * Note, it accounts for the order of the properties as\n * defined in the `fields` array.\n *\n * @returns A generator that yields each `DomainProperty`.\n * @example\n * ```typescript\n * for (const property of entity.listProperties()) {\n * console.log(property.key);\n * }\n * ```\n */\n *listProperties(): Generator<DomainProperty> {\n for (const { key, type } of this.fields) {\n if (type !== 'property') {\n continue\n }\n const node = this.root.graph.node(key)\n if (!node || node.kind !== DomainPropertyKind) {\n continue\n }\n yield node\n }\n }\n\n /**\n * Checks if this entity has any properties.\n *\n * @returns True if the entity has properties.\n * @example\n * ```typescript\n * if (entity.hasProperties()) {\n * // ...\n * }\n * ```\n */\n hasProperties(): boolean {\n return this.fields.some((item) => item.type === 'property')\n }\n\n /**\n * A shortcut to `listParents()`.\n */\n get parents(): Generator<DomainEntity> {\n return this.listParents()\n }\n\n /**\n * Lists all parent entities of this entity.\n *\n * @returns A generator that yields each parent `DomainEntity`.\n * @example\n * ```typescript\n * for (const parent of entity.listParents()) {\n * console.log(parent.key);\n * }\n * ```\n */\n *listParents(): Generator<DomainEntity> {\n for (const edge of this.root.graph.outEdges(this.key)) {\n const value = this.root.graph.edge(edge)\n if (!value || value.type !== 'parent') {\n continue\n }\n const parent = this.root.graph.node(edge.w) as DomainEntity\n if (parent) {\n yield parent\n }\n }\n }\n\n /**\n * Adds a parent to this entity.\n *\n * @param key The key of the parent entity.\n * @param domain The key of the foreign domain the parent belongs to.\n * @returns `this` for chaining.\n * @throws ValidationError When the parent does not exist or a circular dependency is detected.\n * @example\n * ```typescript\n * entity.addParent('baseEntity');\n * ```\n */\n addParent(key: string, domain?: string): this {\n const effectiveKey = domain ? `${domain}:${key}` : key\n // Prevent adding self as parent\n if (effectiveKey === this.key) {\n const message = 'Entity cannot be a parent of itself'\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'circular',\n },\n ],\n { message }\n )\n }\n const { graph } = this.root\n if (!graph.hasNode(effectiveKey)) {\n let message = `Entity with key \"${key}\" not found`\n if (domain) {\n message += ` in domain \"${domain}\"`\n }\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'required',\n },\n ],\n { message }\n )\n }\n // Check for circular inheritance\n if (this.hasCircularParent(effectiveKey)) {\n const message = `Circular inheritance detected. Cannot add ${key} as a parent`\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'circular',\n },\n ],\n { message }\n )\n }\n if (graph.outEdges(this.key, effectiveKey).next().value) {\n const message = `Parent ${key} already exists`\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'unique',\n },\n ],\n { message }\n )\n }\n // Parents are associated through graph edges.\n // Otherwise it would collide with the parent model.\n if (domain) {\n graph.setEdge(this.key, effectiveKey, { type: 'parent', domain, foreign: true })\n } else {\n graph.setEdge(this.key, effectiveKey, { type: 'parent' })\n }\n this.root.notifyChange()\n return this\n }\n\n /**\n * Removes a parent from this entity.\n *\n * @param key The key of the parent entity to remove.\n * @returns `this` for chaining.\n * @throws Error When the parent does not exist.\n * @example\n * ```typescript\n * entity.removeParent('baseEntity');\n * ```\n */\n removeParent(key: string): this {\n const { graph } = this.root\n if (!graph.hasEdge(this.key, key)) {\n throw new Error(`Trying to remove a parent ${key} from ${this.key}, but it doesn't exist`)\n }\n graph.removeEdge(this.key, key)\n this.root.notifyChange()\n return this\n }\n\n /**\n * Checks if this entity has any parents.\n *\n * @returns True if the entity has parents.\n * @example\n * ```typescript\n * if (entity.hasParents()) {\n * // ...\n * }\n * ```\n */\n hasParents(): boolean {\n for (const edge of this.root.graph.outEdges(this.key)) {\n if (this.root.graph.edge(edge)?.type === 'parent') {\n return true\n }\n }\n return false\n }\n\n /**\n * Checks if the passed entity has a circular parent\n * relationship when attempting to add a new parent.\n *\n * @param key The key of the parent being added.\n * @returns True if adding this parent would create a\n * circular relationship.\n */\n hasCircularParent(key: string): boolean {\n const { graph } = this.root\n\n // Check if new parent is one of the children.\n for (const edge of graph.outEdges(key, this.key)) {\n if (graph.edge(edge)?.type === 'parent') {\n return true\n }\n }\n\n // check if this entity is in parents chain.\n let current: DomainEntity | undefined = graph.node(key) as DomainEntity | undefined\n while (current) {\n if (current.key === this.key) {\n return true\n }\n const parents = [...current.listParents()]\n if (parents.length === 0) {\n break\n }\n // Assuming single inheritance\n // TODO: Update this to check for multiple parents.\n current = parents[0]\n }\n\n return false\n }\n\n /**\n * Creates breadcrumbs from this entity to the root\n * namespace.\n *\n * @returns An array of `FileBreadcrumb` instances.\n * @example\n * ```typescript\n * const breadcrumbs = entity.breadcrumbs();\n * console.log(breadcrumbs);\n * ```\n */\n breadcrumbs(): FileBreadcrumb[] {\n const result: FileBreadcrumb[] = []\n result.push({\n key: this.key,\n name: this.info.getLabel('Unnamed entity'),\n kind: DomainEntityKind,\n })\n const model = this.getParentInstance()\n if (model) {\n result.push({\n key: model.key,\n kind: model.kind,\n name: model.info.getLabel('Unnamed model'),\n })\n let parent: DataDomain | DomainNamespace = model.getParentInstance()\n while (parent && parent !== this.root) {\n result.push({\n key: parent.key,\n kind: parent.kind,\n name: parent.info.getLabel('Unnamed namespace'),\n })\n const typed = parent as DomainNamespace\n parent = typed.getParentInstance()\n }\n }\n result.push({\n key: this.root.key,\n name: this.root.info.getLabel('Unnamed data domain'),\n kind: this.root.kind,\n })\n return result.reverse()\n }\n\n /**\n * Adds an association to this entity.\n *\n * @param init The association options.\n * @param input The partial association schema.\n * @returns The created `DomainAssociation` instance.\n * @throws Error When the target entity does not exist.\n * @example\n * ```typescript\n * const association = entity.addAssociation({\n * key: 'address',\n * });\n * ```\n */\n addAssociation(init: AssociationAddOptions = {}, input?: Partial<DomainAssociationSchema>): DomainAssociation {\n const { graph } = this.root\n if (init.domain && init.key) {\n // target is foreign\n const foreignKey = `${init.domain}:${init.key}`\n if (!graph.hasNode(foreignKey)) {\n throw new Error(`Foreign entity ${foreignKey} not found`)\n }\n } else if (init.key) {\n if (!graph.hasNode(init.key)) {\n throw new Error(`Target entity ${init.key} not found`)\n }\n }\n const item = new DomainAssociation(this.root, this.key, input)\n graph.setNode(item.key, item)\n graph.setEdge(this.key, item.key, { type: 'association' })\n if (init.key) {\n item.addTarget(init.key, init.domain)\n }\n this.fields.push({ type: 'association', key: item.key })\n this.root.notifyChange()\n return item\n }\n\n /**\n * Removes an association from this entity.\n *\n * @param key The key of the association to remove.\n * @throws Error When the association does not exist.\n * @example\n * ```typescript\n * entity.removeAssociation('address');\n * ```\n */\n removeAssociation(key: string): void {\n if (!this.root.graph.hasEdge(this.key, key)) {\n throw new Error(`Unable to find a connection between this entity and the ${key} association`)\n }\n const edge = this.root.graph.edge(this.key, key)\n if (!edge || edge.type !== 'association') {\n throw new Error(`Association ${key} does not exist`)\n }\n removeGraphNode(this.root.graph, key)\n this.removeField(key)\n this.root.notifyChange()\n }\n\n /**\n * A shortcut to `listAssociations()`.\n */\n get associations(): Generator<DomainAssociation> {\n return this.listAssociations()\n }\n\n /**\n * Lists all associations of this entity.\n *\n * The order of the associations is defined in the `fields` array.\n *\n * @returns A generator that yields each\n * `DomainAssociation`.\n * @example\n * ```typescript\n * for (const association of entity.listAssociations()) {\n * console.log(association.key);\n * }\n * ```\n */\n *listAssociations(): Generator<DomainAssociation> {\n for (const { key, type } of this.fields) {\n if (type !== 'association') {\n continue\n }\n const node = this.root.graph.node(key)\n if (!node || node.kind !== DomainAssociationKind) {\n continue\n }\n yield node\n }\n }\n\n /**\n * Checks if this entity has any associations.\n *\n * @returns True if the entity has associations.\n * @example\n * ```typescript\n * if (entity.hasAssociations()) {\n * // ...\n * }\n * ```\n */\n hasAssociations(): boolean {\n return this.fields.some((item) => item.type === 'association')\n }\n\n /**\n * Lists all fields (properties and associations) of this entity.\n *\n * @returns A generator that yields each `DomainAssociation` or `DomainProperty`.\n * @example\n * ```typescript\n * for (const field of entity.listFields()) {\n * console.log(field.key);\n * }\n * ```\n */\n *listFields(): Generator<DomainAssociation | DomainProperty> {\n for (const { key } of this.fields) {\n const node = this.root.graph.node(key)\n if (!node) {\n continue\n }\n if (node.kind === DomainAssociationKind || node.kind === DomainPropertyKind) {\n yield node\n }\n }\n }\n\n /**\n * Checks if this entity has any fields (properties or associations).\n *\n * @returns True if the entity has fields.\n * @example\n * ```typescript\n * if (entity.hasFields()) {\n * // ...\n * }\n * ```\n */\n hasFields(): boolean {\n return this.fields.length > 0\n }\n\n private removeField(key: string): void {\n this.fields = this.fields.filter((item) => item.key !== key)\n }\n\n /**\n * Creates an AMF's data Shape.\n *\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(): IShapeUnion {\n const serializer = new ShapeGenerator()\n return serializer.entity(this)\n }\n\n /**\n * Reads the schema of the Entity and generates an example for it.\n *\n * @param mime The mime type of the example.\n * @param opts The example generation options.\n * @returns The generated example.\n * @example\n * ```typescript\n * const example = entity.toExample('application/json');\n * console.log(example);\n * ```\n */\n toExample(mime: string, opts: IShapeRenderOptions = {}): string | number | boolean | null | undefined {\n const shape = this.toApiShape()\n const generator = new ApiSchemaGenerator(mime, {\n renderExamples: typeof opts.renderExamples === 'boolean' ? opts.renderExamples : true,\n renderMocked: typeof opts.renderMocked === 'boolean' ? opts.renderMocked : true,\n renderOptional: typeof opts.renderOptional === 'boolean' ? opts.renderOptional : true,\n selectedUnions: opts.selectedUnions,\n })\n return generator.generate(shape)\n }\n\n /**\n * Checks whether the entity is a child of the given namespace or data model.\n * The relationship doesn't have to be direct, as long as the entity\n * is in the hierarchy it will return true.\n *\n * @param key The key of the parent to check.\n * @returns True if this entity is a child of the given namespace or data model.\n */\n isChildOf(key: string): boolean {\n if (this.key === key) {\n return false\n }\n const parent = this.getParentInstance()\n if (!parent) {\n return false\n }\n if (parent.key === key) {\n return true\n }\n return parent.isChildOf(key)\n }\n\n /**\n * Finds the primary key property of this entity.\n * @returns The primary key property of this entity or undefined if not found.\n */\n primaryKey(): DomainProperty | undefined {\n for (const property of this.properties) {\n if (property.primary) {\n return property\n }\n }\n let property: DomainProperty | undefined\n for (const parent of this.listParents()) {\n const prop = parent.primaryKey()\n if (prop) {\n // According to the validation rules, the last parent\n // that has the property will be used as the source of\n // the property.\n // In the future, we may add a schema definition to the entity that\n // will explicitly define which property to use.\n property = prop\n }\n }\n return property\n }\n}\n"]}
1
+ {"version":3,"file":"DomainEntity.js","sourceRoot":"","sources":["../../../src/modeling/DomainEntity.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAChG,OAAO,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO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A;YAClE,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;gBACf,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;gBAC/B,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAA;YAC5B,CAAC;QACH,CAAC;QAED;;;;WAIG;QACH,WAAW,CAAC,UAAwB;YAClC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,CAAA;QACxD,CAAC;;;SApvBU,YAAY","sourcesContent":["import type { DataDomain } from './DataDomain.js'\nimport { DomainAssociationKind, DomainEntityKind, DomainPropertyKind } from '../models/kinds.js'\nimport { DomainElement, type DomainElementSchema } from './DomainElement.js'\nimport { nanoid } from '../nanoid.js'\nimport { type IThing, Thing } from '../models/Thing.js'\nimport { observed, retargetChange, toRaw } from './observed.js'\nimport type { IShapeUnion } from '../amf/definitions/Shapes.js'\nimport { DomainProperty, type DomainPropertySchema } from './DomainProperty.js'\nimport { RemovePropertyException } from '../exceptions/remove_property_exception.js'\nimport { DomainAssociation, DomainAssociationSchema } from './DomainAssociation.js'\nimport type { AssociationAddOptions } from './types.js'\nimport type { FileBreadcrumb } from '../models/store/File.js'\nimport type { DomainModel } from './DomainModel.js'\nimport type { DomainNamespace } from './DomainNamespace.js'\nimport { ValidationError } from '../exceptions/validation_error.js'\nimport { ShapeGenerator } from './amf/ShapeGenerator.js'\nimport type { IShapeRenderOptions } from '../amf/shape/ShapeBase.js'\nimport { ApiSchemaGenerator } from '../amf/ApiSchemaGenerator.js'\nimport { removeGraphNode } from './GraphUtils.js'\nimport { DataSemantics, isEntitySemantic, type SemanticType, type AppliedDataSemantic } from './Semantics.js'\n\nexport interface EntityOrderedItem {\n /**\n * The type of the ordered item.\n */\n type: 'property' | 'association'\n\n /**\n * The key of the ordered item.\n */\n key: string\n}\n\nexport interface DomainEntitySchema extends DomainElementSchema {\n kind: typeof DomainEntityKind\n /**\n * The domain entity description.\n */\n info: IThing\n\n /**\n * Optional general purpose tags for the UI.\n */\n tags?: string[]\n\n /**\n * The semantics applied to this entity.\n * This is a list of applied semantics that can be used to\n * describe the entity in more detail.\n */\n semantics?: AppliedDataSemantic[]\n\n /**\n * The ordered list of fields (properties and associations) in the schema.\n * These only keep references to the properties and associations.\n * The order of the fields is important as it defines the order of the\n * properties in the schema.\n */\n fields?: EntityOrderedItem[]\n\n /**\n * Whether this entity is deprecated.\n */\n deprecated?: boolean\n}\n\n/**\n * Represents an entity within a data domain model.\n *\n * A `DomainEntity` defines a structured data type,\n * containing properties and associations. It's a\n * fundamental building block for modeling complex data\n * structures.\n *\n * **Key Features:**\n *\n * - **Properties:** Defines the data elements (fields) within the entity.\n * - **Associations:** Defines relationships to other entities.\n * - **Inheritance:** Supports inheriting properties and associations from parent entities.\n * - **Metadata:** Supports tags, semantics, and deprecation status.\n * - **AMF Shape Generation:** Can be serialized to an AMF (API Modeling Framework) shape.\n * - **Example Generation:** Can generate example databased on its schema.\n *\n * **Usage:**\n *\n * The preferred way to create a `DomainEntity` is through\n * the `DomainModel.addEntity()` 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 * ```\n *\n * Entity Validation Rules:\n *\n * - **Primary Key:** An entity must have a primary key selected. This can come from a parent\n * entity or be defined in the current entity.\n * - **Parent Entity:** The parent entity must exist in the graph.\n * - **Circular Dependency:** Adding a parent entity that creates a circular dependency is not allowed.\n * - **Unique Parent:** An entity cannot have the same parent more than once.\n * - **Property Shadowing:** A property can shadow a parent property. This means that if a property\n * with the same key exists in both the parent and child entity, the child property will take precedence.\n * - **Association Shadowing:** An association can shadow a parent association. This means that if an\n * association with the same key exists in both the parent and child entity,\n * the child association will take precedence.\n * - **Property Resolution:** When the same property exists more than one parent and the child entity,\n * doesn't explicitly define the property, then:\n * - The last parent entity (iterating from the first entity to the last) that has the property\n * will be used as the source of the property.\n * - **Association Resolution:** When the same association exists more than one parent and the child entity,\n * doesn't explicitly define the association, then:\n * - The last parent entity (iterating from the first entity to the last) that has the association\n * will be used as the source of the association.\n * - **Minimum Required Properties:** An entity must have at least one property defined. Entities without properties\n * are ignored in the system.\n * - **Entity Name**:\n * - An entity must have a name defined.\n * - The name has to follow the same rules as the names in a SQL database. This means that the name must be unique\n * within the data domain and cannot contain special characters.\n * - **Association Targets:** An association must have a target entity defined.\n * This means that the association must point to at least one entity.\n */\nexport class DomainEntity extends DomainElement {\n /**\n * The kind of the domain element.\n */\n override kind: typeof DomainEntityKind\n\n /**\n * The description of the domain entity.\n */\n @retargetChange() accessor info: Thing\n\n /**\n * Optional general purpose tags for the UI.\n */\n @observed({ deep: true }) accessor tags: string[]\n\n /**\n * Semantics applied to this property.\n */\n @observed({ deep: true }) accessor semantics: AppliedDataSemantic[] = []\n\n /**\n * The ordered list of fields (properties and associations) in the schema.\n * These only keep references to the properties and associations.\n * The order of the fields is important as it defines the order of the\n * properties in the schema.\n */\n accessor fields: EntityOrderedItem[]\n\n /**\n * Whether this entity is deprecated.\n */\n @observed() accessor deprecated: boolean | undefined\n\n /**\n * Creates a full data entity schema with defaults.\n *\n * @param input The partial data entity schema.\n * @returns The data entity schema.\n */\n static createSchema(input: Partial<DomainEntitySchema> = {}): DomainEntitySchema {\n const { key = nanoid(), tags, semantics, fields, deprecated } = input\n const info = Thing.fromJSON(input.info, { name: 'New entity' }).toJSON()\n const result: DomainEntitySchema = {\n kind: DomainEntityKind,\n key,\n info,\n }\n if (Array.isArray(tags)) {\n result.tags = [...tags]\n }\n if (Array.isArray(semantics)) {\n result.semantics = [...semantics]\n }\n if (Array.isArray(fields)) {\n result.fields = [...fields]\n }\n if (typeof deprecated === 'boolean') {\n result.deprecated = deprecated\n }\n return result\n }\n\n /**\n * Creates a new domain entity instance.\n *\n * You probably want to use the `DomainModel.addEntity()`\n * method instead.\n *\n * @param root A reference to the root DataDomain instance.\n * @param input The partial domain entity schema.\n */\n constructor(root: DataDomain, input?: Partial<DomainEntitySchema>) {\n const init = DomainEntity.createSchema(input)\n super(root, init.key)\n this.kind = DomainEntityKind\n this.info = new Thing(init.info)\n if (Array.isArray(init.tags)) {\n this.tags = [...init.tags]\n } else {\n this.tags = []\n }\n if (Array.isArray(init.semantics)) {\n this.semantics = init.semantics.map((item) => structuredClone(item))\n } else {\n this.semantics = []\n }\n if (Array.isArray(init.fields)) {\n this.fields = [...init.fields]\n } else {\n this.fields = []\n }\n if (typeof init.deprecated === 'boolean') {\n this.deprecated = init.deprecated\n }\n }\n\n /**\n * Generates a JSON representation of the entity.\n *\n * @returns A plain object representation of the `DomainEntity`.\n */\n toJSON(): DomainEntitySchema {\n const result: DomainEntitySchema = {\n kind: this.kind,\n key: this.key,\n info: this.info.toJSON(),\n }\n if (Array.isArray(this.fields) && this.fields.length) {\n result.fields = [...this.fields]\n }\n if (Array.isArray(this.semantics) && this.semantics.length) {\n result.semantics = toRaw(this, this.semantics)?.map((i) => structuredClone(i))\n }\n if (Array.isArray(this.tags) && this.tags.length) {\n result.tags = [...(toRaw(this, this.tags) as string[])]\n }\n if (typeof this.deprecated === 'boolean') {\n result.deprecated = this.deprecated\n }\n return result\n }\n\n /**\n * Returns a parent data entity where this data property\n * exist.\n *\n * @returns The parent `DomainModel` or undefined if not found.\n * @example\n * ```typescript\n * const parent = entity.getParentInstance();\n * if (parent) {\n * console.log(parent.key);\n * }\n * ```\n */\n getParentInstance(): DomainModel | undefined {\n const parentKey = this.root.graph.parent(this.key)\n if (!parentKey) {\n return undefined\n }\n return this.root.graph.node(parentKey) as DomainModel | undefined\n }\n\n /**\n * Adds a property to this entity.\n *\n * @param property The partial property schema.\n * @returns The created `DomainProperty` instance.\n * @example\n * ```typescript\n * const property = entity.addProperty({\n * key: 'name',\n * type: 'string',\n * required: true,\n * })\n * ```\n */\n addProperty(property?: Partial<DomainPropertySchema>): DomainProperty {\n if (property && property.key && this.root.graph.hasNode(property.key)) {\n throw new Error(`Trying to add a property ${property.key}, but it already exists`)\n }\n const instance = new DomainProperty(this.root, this.key, property)\n this.root.graph.setNode(instance.key, instance)\n this.root.graph.setEdge(this.key, instance.key, { type: 'property' })\n this.fields.push({\n type: 'property',\n key: instance.key,\n })\n this.root.notifyChange()\n return instance\n }\n\n /**\n * Removes a property from this entity.\n *\n * @param key The key of the property to remove.\n * @throws {RemovePropertyException} When the property does not exist.\n * @example\n * ```typescript\n * entity.removeProperty('name')\n * ```\n */\n removeProperty(key: string): void {\n if (!this.root.graph.hasNode(key)) {\n throw new RemovePropertyException(`Trying to remove the ${key} property, but it doesn't exist`)\n }\n const prop = this.root.graph.node(key) as DomainProperty\n if (prop.getParentInstance() !== this) {\n throw new RemovePropertyException(`Trying to remove the ${key} property, but it doesn't belong to this entity`)\n }\n removeGraphNode(this.root.graph, key)\n this.removeField(key)\n this.root.notifyChange()\n }\n\n /**\n * A shortcut to `listProperties()`.\n */\n get properties(): Generator<DomainProperty> {\n return this.listProperties()\n }\n\n /**\n * Lists all properties of this entity.\n *\n * Note, it accounts for the order of the properties as\n * defined in the `fields` array.\n *\n * @returns A generator that yields each `DomainProperty`.\n * @example\n * ```typescript\n * for (const property of entity.listProperties()) {\n * console.log(property.key);\n * }\n * ```\n */\n *listProperties(): Generator<DomainProperty> {\n for (const { key, type } of this.fields) {\n if (type !== 'property') {\n continue\n }\n const node = this.root.graph.node(key)\n if (!node || node.kind !== DomainPropertyKind) {\n continue\n }\n yield node\n }\n }\n\n /**\n * Checks if this entity has any properties.\n *\n * @returns True if the entity has properties.\n * @example\n * ```typescript\n * if (entity.hasProperties()) {\n * // ...\n * }\n * ```\n */\n hasProperties(): boolean {\n return this.fields.some((item) => item.type === 'property')\n }\n\n /**\n * A shortcut to `listParents()`.\n */\n get parents(): Generator<DomainEntity> {\n return this.listParents()\n }\n\n /**\n * Lists all parent entities of this entity.\n *\n * @returns A generator that yields each parent `DomainEntity`.\n * @example\n * ```typescript\n * for (const parent of entity.listParents()) {\n * console.log(parent.key);\n * }\n * ```\n */\n *listParents(): Generator<DomainEntity> {\n for (const edge of this.root.graph.outEdges(this.key)) {\n const value = this.root.graph.edge(edge)\n if (!value || value.type !== 'parent') {\n continue\n }\n const parent = this.root.graph.node(edge.w) as DomainEntity\n if (parent) {\n yield parent\n }\n }\n }\n\n /**\n * Adds a parent to this entity.\n *\n * @param key The key of the parent entity.\n * @param domain The key of the foreign domain the parent belongs to.\n * @returns `this` for chaining.\n * @throws ValidationError When the parent does not exist or a circular dependency is detected.\n * @example\n * ```typescript\n * entity.addParent('baseEntity');\n * ```\n */\n addParent(key: string, domain?: string): this {\n const effectiveKey = domain ? `${domain}:${key}` : key\n // Prevent adding self as parent\n if (effectiveKey === this.key) {\n const message = 'Entity cannot be a parent of itself'\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'circular',\n },\n ],\n { message }\n )\n }\n const { graph } = this.root\n if (!graph.hasNode(effectiveKey)) {\n let message = `Entity with key \"${key}\" not found`\n if (domain) {\n message += ` in domain \"${domain}\"`\n }\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'required',\n },\n ],\n { message }\n )\n }\n // Check for circular inheritance\n if (this.hasCircularParent(effectiveKey)) {\n const message = `Circular inheritance detected. Cannot add ${key} as a parent`\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'circular',\n },\n ],\n { message }\n )\n }\n if (graph.outEdges(this.key, effectiveKey).next().value) {\n const message = `Parent ${key} already exists`\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'unique',\n },\n ],\n { message }\n )\n }\n // Parents are associated through graph edges.\n // Otherwise it would collide with the parent model.\n if (domain) {\n graph.setEdge(this.key, effectiveKey, { type: 'parent', domain, foreign: true })\n } else {\n graph.setEdge(this.key, effectiveKey, { type: 'parent' })\n }\n this.root.notifyChange()\n return this\n }\n\n /**\n * Removes a parent from this entity.\n *\n * @param key The key of the parent entity to remove.\n * @returns `this` for chaining.\n * @throws Error When the parent does not exist.\n * @example\n * ```typescript\n * entity.removeParent('baseEntity');\n * ```\n */\n removeParent(key: string): this {\n const { graph } = this.root\n if (!graph.hasEdge(this.key, key)) {\n throw new Error(`Trying to remove a parent ${key} from ${this.key}, but it doesn't exist`)\n }\n graph.removeEdge(this.key, key)\n this.root.notifyChange()\n return this\n }\n\n /**\n * Checks if this entity has any parents.\n *\n * @returns True if the entity has parents.\n * @example\n * ```typescript\n * if (entity.hasParents()) {\n * // ...\n * }\n * ```\n */\n hasParents(): boolean {\n for (const edge of this.root.graph.outEdges(this.key)) {\n if (this.root.graph.edge(edge)?.type === 'parent') {\n return true\n }\n }\n return false\n }\n\n /**\n * Checks if the passed entity has a circular parent\n * relationship when attempting to add a new parent.\n *\n * @param key The key of the parent being added.\n * @returns True if adding this parent would create a\n * circular relationship.\n */\n hasCircularParent(key: string): boolean {\n const { graph } = this.root\n\n // Check if new parent is one of the children.\n for (const edge of graph.outEdges(key, this.key)) {\n if (graph.edge(edge)?.type === 'parent') {\n return true\n }\n }\n\n // check if this entity is in parents chain.\n let current: DomainEntity | undefined = graph.node(key) as DomainEntity | undefined\n while (current) {\n if (current.key === this.key) {\n return true\n }\n const parents = [...current.listParents()]\n if (parents.length === 0) {\n break\n }\n // Assuming single inheritance\n // TODO: Update this to check for multiple parents.\n current = parents[0]\n }\n\n return false\n }\n\n /**\n * Creates breadcrumbs from this entity to the root\n * namespace.\n *\n * @returns An array of `FileBreadcrumb` instances.\n * @example\n * ```typescript\n * const breadcrumbs = entity.breadcrumbs();\n * console.log(breadcrumbs);\n * ```\n */\n breadcrumbs(): FileBreadcrumb[] {\n const result: FileBreadcrumb[] = []\n result.push({\n key: this.key,\n name: this.info.getLabel('Unnamed entity'),\n kind: DomainEntityKind,\n })\n const model = this.getParentInstance()\n if (model) {\n result.push({\n key: model.key,\n kind: model.kind,\n name: model.info.getLabel('Unnamed model'),\n })\n let parent: DataDomain | DomainNamespace = model.getParentInstance()\n while (parent && parent !== this.root) {\n result.push({\n key: parent.key,\n kind: parent.kind,\n name: parent.info.getLabel('Unnamed namespace'),\n })\n const typed = parent as DomainNamespace\n parent = typed.getParentInstance()\n }\n }\n result.push({\n key: this.root.key,\n name: this.root.info.getLabel('Unnamed data domain'),\n kind: this.root.kind,\n })\n return result.reverse()\n }\n\n /**\n * Adds an association to this entity.\n *\n * @param init The association options.\n * @param input The partial association schema.\n * @returns The created `DomainAssociation` instance.\n * @throws Error When the target entity does not exist.\n * @example\n * ```typescript\n * const association = entity.addAssociation({\n * key: 'address',\n * });\n * ```\n */\n addAssociation(init: AssociationAddOptions = {}, input?: Partial<DomainAssociationSchema>): DomainAssociation {\n const { graph } = this.root\n if (init.domain && init.key) {\n // target is foreign\n const foreignKey = `${init.domain}:${init.key}`\n if (!graph.hasNode(foreignKey)) {\n throw new Error(`Foreign entity ${foreignKey} not found`)\n }\n } else if (init.key) {\n if (!graph.hasNode(init.key)) {\n throw new Error(`Target entity ${init.key} not found`)\n }\n }\n const item = new DomainAssociation(this.root, this.key, input)\n graph.setNode(item.key, item)\n graph.setEdge(this.key, item.key, { type: 'association' })\n if (init.key) {\n item.addTarget(init.key, init.domain)\n }\n this.fields.push({ type: 'association', key: item.key })\n this.root.notifyChange()\n return item\n }\n\n /**\n * Removes an association from this entity.\n *\n * @param key The key of the association to remove.\n * @throws Error When the association does not exist.\n * @example\n * ```typescript\n * entity.removeAssociation('address');\n * ```\n */\n removeAssociation(key: string): void {\n if (!this.root.graph.hasEdge(this.key, key)) {\n throw new Error(`Unable to find a connection between this entity and the ${key} association`)\n }\n const edge = this.root.graph.edge(this.key, key)\n if (!edge || edge.type !== 'association') {\n throw new Error(`Association ${key} does not exist`)\n }\n removeGraphNode(this.root.graph, key)\n this.removeField(key)\n this.root.notifyChange()\n }\n\n /**\n * A shortcut to `listAssociations()`.\n */\n get associations(): Generator<DomainAssociation> {\n return this.listAssociations()\n }\n\n /**\n * Lists all associations of this entity.\n *\n * The order of the associations is defined in the `fields` array.\n *\n * @returns A generator that yields each\n * `DomainAssociation`.\n * @example\n * ```typescript\n * for (const association of entity.listAssociations()) {\n * console.log(association.key);\n * }\n * ```\n */\n *listAssociations(): Generator<DomainAssociation> {\n for (const { key, type } of this.fields) {\n if (type !== 'association') {\n continue\n }\n const node = this.root.graph.node(key)\n if (!node || node.kind !== DomainAssociationKind) {\n continue\n }\n yield node\n }\n }\n\n /**\n * Checks if this entity has any associations.\n *\n * @returns True if the entity has associations.\n * @example\n * ```typescript\n * if (entity.hasAssociations()) {\n * // ...\n * }\n * ```\n */\n hasAssociations(): boolean {\n return this.fields.some((item) => item.type === 'association')\n }\n\n /**\n * Lists all fields (properties and associations) of this entity.\n *\n * @returns A generator that yields each `DomainAssociation` or `DomainProperty`.\n * @example\n * ```typescript\n * for (const field of entity.listFields()) {\n * console.log(field.key);\n * }\n * ```\n */\n *listFields(): Generator<DomainAssociation | DomainProperty> {\n for (const { key } of this.fields) {\n const node = this.root.graph.node(key)\n if (!node) {\n continue\n }\n if (node.kind === DomainAssociationKind || node.kind === DomainPropertyKind) {\n yield node\n }\n }\n }\n\n /**\n * Checks if this entity has any fields (properties or associations).\n *\n * @returns True if the entity has fields.\n * @example\n * ```typescript\n * if (entity.hasFields()) {\n * // ...\n * }\n * ```\n */\n hasFields(): boolean {\n return this.fields.length > 0\n }\n\n private removeField(key: string): void {\n this.fields = this.fields.filter((item) => item.key !== key)\n }\n\n /**\n * Creates an AMF's data Shape.\n *\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(): IShapeUnion {\n const serializer = new ShapeGenerator()\n return serializer.entity(this)\n }\n\n /**\n * Reads the schema of the Entity and generates an example for it.\n *\n * @param mime The mime type of the example.\n * @param opts The example generation options.\n * @returns The generated example.\n * @example\n * ```typescript\n * const example = entity.toExample('application/json');\n * console.log(example);\n * ```\n */\n toExample(mime: string, opts: IShapeRenderOptions = {}): string | number | boolean | null | undefined {\n const shape = this.toApiShape()\n const generator = new ApiSchemaGenerator(mime, {\n renderExamples: typeof opts.renderExamples === 'boolean' ? opts.renderExamples : true,\n renderMocked: typeof opts.renderMocked === 'boolean' ? opts.renderMocked : true,\n renderOptional: typeof opts.renderOptional === 'boolean' ? opts.renderOptional : true,\n selectedUnions: opts.selectedUnions,\n })\n return generator.generate(shape)\n }\n\n /**\n * Checks whether the entity is a child of the given namespace or data model.\n * The relationship doesn't have to be direct, as long as the entity\n * is in the hierarchy it will return true.\n *\n * @param key The key of the parent to check.\n * @returns True if this entity is a child of the given namespace or data model.\n */\n isChildOf(key: string): boolean {\n if (this.key === key) {\n return false\n }\n const parent = this.getParentInstance()\n if (!parent) {\n return false\n }\n if (parent.key === key) {\n return true\n }\n return parent.isChildOf(key)\n }\n\n /**\n * Finds the primary key property of this entity.\n * @returns The primary key property of this entity or undefined if not found.\n */\n primaryKey(): DomainProperty | undefined {\n for (const property of this.properties) {\n if (property.primary) {\n return property\n }\n }\n let property: DomainProperty | undefined\n for (const parent of this.listParents()) {\n const prop = parent.primaryKey()\n if (prop) {\n // According to the validation rules, the last parent\n // that has the property will be used as the source of\n // the property.\n // In the future, we may add a schema definition to the entity that\n // will explicitly define which property to use.\n property = prop\n }\n }\n return property\n }\n\n /**\n * Adds or updates a semantic to the entity.\n * @param semantic The semantic to add to the entity.\n * @throws Error if the semantic is not an entity semantic.\n */\n addSemantic(semantic: AppliedDataSemantic): void {\n const sem = DataSemantics[semantic.id]\n if (!isEntitySemantic(sem)) {\n throw new Error(`Invalid semantic type: ${semantic.id}. Expected an entity 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 entity.\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 entity 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"]}
@@ -9,14 +9,13 @@ export interface IDomainFile extends IFile {
9
9
  */
10
10
  export declare class DomainFile extends File {
11
11
  kind: string;
12
- static fromName(name: string, organization: string, owner?: string): DomainFile;
12
+ static fromName(name: string): DomainFile;
13
13
  /**
14
- * Creates the file definition for a DataNamespace contents.
14
+ * Creates the file definition for a DomainNamespace contents.
15
15
  *
16
16
  * @param input The data namespace instance or schema.
17
- * @param owner Optional owner to set.
18
17
  */
19
- static fromDataDomain(input: DataDomain | DataDomainSchema, organization: string, owner?: string): DomainFile;
18
+ static fromDataDomain(input: DataDomain | DataDomainSchema): DomainFile;
20
19
  constructor(input?: string | IDomainFile);
21
20
  new(init: IDomainFile): this;
22
21
  static isDomainFile(input: unknown): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"DomainFile.d.ts","sourceRoot":"","sources":["../../../src/modeling/DomainFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,WAAW,WAAY,SAAQ,KAAK;IACxC,IAAI,EAAE,OAAO,cAAc,CAAA;CAC5B;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,IAAI;IACzB,IAAI,SAAiB;WAEd,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU;IAIxF;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU;gBAqBjG,KAAK,CAAC,EAAE,MAAM,GAAG,WAAW;IAsB/B,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IASrC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAQnC,MAAM,IAAI,WAAW;CAO/B"}
1
+ {"version":3,"file":"DomainFile.d.ts","sourceRoot":"","sources":["../../../src/modeling/DomainFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,WAAW,WAAY,SAAQ,KAAK;IACxC,IAAI,EAAE,OAAO,cAAc,CAAA;CAC5B;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,IAAI;IACzB,IAAI,SAAiB;WAEd,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAIlD;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,gBAAgB,GAAG,UAAU;gBAmB3D,KAAK,CAAC,EAAE,MAAM,GAAG,WAAW;IAqB/B,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IASrC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAQnC,MAAM,IAAI,WAAW;CAO/B"}
@@ -7,16 +7,15 @@ import { DomainFileKind } from '../models/kinds.js';
7
7
  */
8
8
  export class DomainFile extends File {
9
9
  kind = DomainFileKind;
10
- static fromName(name, organization, owner) {
11
- return super.fromName(name, organization, owner, DomainFileKind);
10
+ static fromName(name) {
11
+ return super.fromName(name, DomainFileKind);
12
12
  }
13
13
  /**
14
- * Creates the file definition for a DataNamespace contents.
14
+ * Creates the file definition for a DomainNamespace contents.
15
15
  *
16
16
  * @param input The data namespace instance or schema.
17
- * @param owner Optional owner to set.
18
17
  */
19
- static fromDataDomain(input, organization, owner) {
18
+ static fromDataDomain(input) {
20
19
  let final;
21
20
  if (typeof input.toJSON === 'function') {
22
21
  final = input.toJSON();
@@ -27,10 +26,8 @@ export class DomainFile extends File {
27
26
  const init = {
28
27
  kind: DomainFileKind,
29
28
  key: final.key,
30
- organization,
31
29
  info: { ...final.info },
32
- lastModified: { user: owner || '', time: 0, byMe: false },
33
- owner,
30
+ lastModified: { user: '', time: 0, byMe: false },
34
31
  parents: [],
35
32
  permissionIds: [],
36
33
  permissions: [],
@@ -50,7 +47,6 @@ export class DomainFile extends File {
50
47
  init = {
51
48
  kind: DomainFileKind,
52
49
  key: nanoid(),
53
- organization: '',
54
50
  info: Thing.fromName('').toJSON(),
55
51
  parents: [],
56
52
  permissionIds: [],
@@ -1 +1 @@
1
- {"version":3,"file":"DomainFile.js","sourceRoot":"","sources":["../../../src/modeling/DomainFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,IAAI,EAAc,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAMnD;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAI;IACzB,IAAI,GAAG,cAAc,CAAA;IAE9B,MAAM,CAAU,QAAQ,CAAC,IAAY,EAAE,YAAoB,EAAE,KAAc;QACzE,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,CAAe,CAAA;IAChF,CAA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E;gBACf,YAAY,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE;aACjD,CAAA;QACH,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAChB,CAAC;IAEQ,GAAG,CAAC,IAAiB;QAC5B,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;QACrC,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAA;QAC1B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,KAAc;QAChC,MAAM,KAAK,GAAG,KAAoB,CAAA;QAClC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAC5C,OAAO,KAAK,CAAA;QACd,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAEQ,MAAM;QACb,MAAM,MAAM,GAAgB;YAC1B,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,IAAI,EAAE,cAAc;SACrB,CAAA;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import { nanoid } from '../nanoid.js'\nimport { File, type IFile } from '../models/store/File.js'\nimport { Thing } from '../models/Thing.js'\nimport type { DataDomain, DataDomainSchema } from './DataDomain.js'\nimport { DomainFileKind } from '../models/kinds.js'\n\nexport interface IDomainFile extends IFile {\n kind: typeof DomainFileKind\n}\n\n/**\n * Used by the store. A file definition for the DataDomain\n */\nexport class DomainFile extends File {\n override kind = DomainFileKind\n\n static override fromName(name: string, organization: string, owner?: string): DomainFile {\n return super.fromName(name, organization, owner, DomainFileKind) as DomainFile\n }\n\n /**\n * Creates the file definition for a DataNamespace contents.\n *\n * @param input The data namespace instance or schema.\n * @param owner Optional owner to set.\n */\n static fromDataDomain(input: DataDomain | DataDomainSchema, organization: string, owner?: string): DomainFile {\n let final: DataDomainSchema\n if (typeof (input as DataDomain).toJSON === 'function') {\n final = (input as DataDomain).toJSON()\n } else {\n final = input as DataDomainSchema\n }\n const init: IDomainFile = {\n kind: DomainFileKind,\n key: final.key,\n organization,\n info: { ...final.info },\n lastModified: { user: owner || '', time: 0, byMe: false },\n owner,\n parents: [],\n permissionIds: [],\n permissions: [],\n }\n return new DomainFile(init)\n }\n\n constructor(input?: string | IDomainFile) {\n super()\n let init: IDomainFile\n if (typeof input === 'string') {\n init = JSON.parse(input)\n } else if (typeof input === 'object') {\n init = input\n } else {\n init = {\n kind: DomainFileKind,\n key: nanoid(),\n organization: '',\n info: Thing.fromName('').toJSON(),\n parents: [],\n permissionIds: [],\n permissions: [],\n lastModified: { user: '', time: 0, byMe: false },\n }\n }\n this.new(init)\n }\n\n override new(init: IDomainFile): this {\n if (!DomainFile.isDomainFile(init)) {\n throw new Error(`Not a data file.`)\n }\n super.new(init)\n this.kind = DomainFileKind\n return this\n }\n\n static isDomainFile(input: unknown): boolean {\n const typed = input as IDomainFile\n if (!input || typed.kind !== DomainFileKind) {\n return false\n }\n return true\n }\n\n override toJSON(): IDomainFile {\n const result: IDomainFile = {\n ...super.toJSON(),\n kind: DomainFileKind,\n }\n return result\n }\n}\n"]}
1
+ {"version":3,"file":"DomainFile.js","sourceRoot":"","sources":["../../../src/modeling/DomainFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,IAAI,EAAc,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAMnD;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAI;IACzB,IAAI,GAAG,cAAc,CAAA;IAE9B,MAAM,CAAU,QAAQ,C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AE;gBACf,YAAY,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE;aACjD,CAAA;QACH,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAChB,CAAC;IAEQ,GAAG,CAAC,IAAiB;QAC5B,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;QACrC,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAA;QAC1B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,KAAc;QAChC,MAAM,KAAK,GAAG,KAAoB,CAAA;QAClC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAC5C,OAAO,KAAK,CAAA;QACd,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAEQ,MAAM;QACb,MAAM,MAAM,GAAgB;YAC1B,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,IAAI,EAAE,cAAc;SACrB,CAAA;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import { nanoid } from '../nanoid.js'\nimport { File, type IFile } from '../models/store/File.js'\nimport { Thing } from '../models/Thing.js'\nimport type { DataDomain, DataDomainSchema } from './DataDomain.js'\nimport { DomainFileKind } from '../models/kinds.js'\n\nexport interface IDomainFile extends IFile {\n kind: typeof DomainFileKind\n}\n\n/**\n * Used by the store. A file definition for the DataDomain\n */\nexport class DomainFile extends File {\n override kind = DomainFileKind\n\n static override fromName(name: string): DomainFile {\n return super.fromName(name, DomainFileKind) as DomainFile\n }\n\n /**\n * Creates the file definition for a DomainNamespace contents.\n *\n * @param input The data namespace instance or schema.\n */\n static fromDataDomain(input: DataDomain | DataDomainSchema): DomainFile {\n let final: DataDomainSchema\n if (typeof (input as DataDomain).toJSON === 'function') {\n final = (input as DataDomain).toJSON()\n } else {\n final = input as DataDomainSchema\n }\n const init: IDomainFile = {\n kind: DomainFileKind,\n key: final.key,\n info: { ...final.info },\n lastModified: { user: '', time: 0, byMe: false },\n parents: [],\n permissionIds: [],\n permissions: [],\n }\n return new DomainFile(init)\n }\n\n constructor(input?: string | IDomainFile) {\n super()\n let init: IDomainFile\n if (typeof input === 'string') {\n init = JSON.parse(input)\n } else if (typeof input === 'object') {\n init = input\n } else {\n init = {\n kind: DomainFileKind,\n key: nanoid(),\n info: Thing.fromName('').toJSON(),\n parents: [],\n permissionIds: [],\n permissions: [],\n lastModified: { user: '', time: 0, byMe: false },\n }\n }\n this.new(init)\n }\n\n override new(init: IDomainFile): this {\n if (!DomainFile.isDomainFile(init)) {\n throw new Error(`Not a data file.`)\n }\n super.new(init)\n this.kind = DomainFileKind\n return this\n }\n\n static isDomainFile(input: unknown): boolean {\n const typed = input as IDomainFile\n if (!input || typed.kind !== DomainFileKind) {\n return false\n }\n return true\n }\n\n override toJSON(): IDomainFile {\n const result: IDomainFile = {\n ...super.toJSON(),\n kind: DomainFileKind,\n }\n return result\n }\n}\n"]}
@@ -315,7 +315,7 @@ export declare class DomainImpactAnalysis {
315
315
  publishAnalysis(): DomainImpactReport;
316
316
  protected createDeleteImpact(key: string, kind: DomainImpactKinds, rootKey: string): void;
317
317
  protected deleteNamespaceAnalysis(key: string, rootKey: string): void;
318
- protected deleteDataModelAnalysis(key: string, rootKey: string): void;
318
+ protected deleteModelAnalysis(key: string, rootKey: string): void;
319
319
  protected deleteEntityAnalysis(key: string, rootKey: string): void;
320
320
  protected deletePropertyAnalysis(key: string): void;
321
321
  protected deleteAssociationAnalysis(key: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"DomainImpactAnalysis.d.ts","sourceRoot":"","sources":["../../../src/modeling/DomainImpactAnalysis.ts"],"names":[],"mappings":"AAAA,OAAO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CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,IAAI,CAAY;gBAEZ,IAAI,EAAE,UAAU;IAU5B;;;;;OAKG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAWxE;;;;OAIG;IACH,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB;IAW/D;;;;OAIG;IACH,eAAe,IAAI,kBAAkB;IAoErC,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAsBzF,SAAS,CAAC,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAqBrE,SAAS,CAAC,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAkBjE,SAAS,CAAC,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAkFlE,SAAS,CAAC,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAenD,SAAS,CAAC,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAetD,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM;IAiBtD,SAAS,CAAC,kCAAkC,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CA8DhE"}
@@ -338,7 +338,7 @@ export class DomainImpactAnalysis {
338
338
  this.deleteNamespaceAnalysis(key, rootKey);
339
339
  break;
340
340
  case DomainModelKind:
341
- this.deleteDataModelAnalysis(key, rootKey);
341
+ this.deleteModelAnalysis(key, rootKey);
342
342
  break;
343
343
  case DomainEntityKind:
344
344
  this.deleteEntityAnalysis(key, rootKey);
@@ -370,10 +370,10 @@ export class DomainImpactAnalysis {
370
370
  this.deleteNamespaceAnalysis(child.key, rootKey);
371
371
  }
372
372
  for (const child of ns.listModels()) {
373
- this.deleteDataModelAnalysis(child.key, rootKey);
373
+ this.deleteModelAnalysis(child.key, rootKey);
374
374
  }
375
375
  }
376
- deleteDataModelAnalysis(key, rootKey) {
376
+ deleteModelAnalysis(key, rootKey) {
377
377
  const model = this.root.findModel(key);
378
378
  if (!model) {
379
379
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"DomainImpactAnalysis.js","sourceRoot":"","sources":["../../../src/modeling/DomainImpactAnalysis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,GACf,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AAsFxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsNG;AACH,MAAM,OAAO,oBAAoB;IACvB,MAAM,CAAoB;IAC1B,IAAI,CAAY;IAExB,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,MAAM,GAAG;YACZ,GAAG,EAAE,EAAE;YACP,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,EAAE;YACV,UAAU,EAAE,KAAK;SAClB,CAAA;IACH,CAAC;IAED;;;;;OAKG;IACH,cAAc,CAAC,GAAW,EAAE,IAAuB;QACjD,IAAI,CAAC,MAAM,GAAG;YACZ,G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AC,WAAW,CAAC,qBAAqB,CAAC,UAAU,MAAM,wCAAwC,MAAM,+BAA+B,gBAAgB,CAAC,GAAG,IAAI;gCACvL,UAAU,EAAE,QAAQ,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,0BAA0B,MAAM,IAAI;gCAC1G,QAAQ,EAAE,IAAI;gCACd,QAAQ,EAAE,OAAO;6BAClB,CAAC,CAAA;4BACF,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,KAAK,CAAA;wBAChC,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import {\n DomainNamespaceKind,\n DomainEntityKind,\n DomainModelKind,\n DomainPropertyKind,\n DomainAssociationKind,\n DataDomainKind,\n} from '../models/kinds.js'\nimport type { DataDomain } from './DataDomain.js'\nimport { AssociationValidation } from './validation/association_validation.js'\nimport { EntityValidation } from './validation/entity_validation.js'\nimport { PropertyValidation } from './validation/property_validation.js'\n\nexport type DomainImpactKinds =\n | typeof DomainNamespaceKind\n | typeof DomainEntityKind\n | typeof DomainModelKind\n | typeof DomainPropertyKind\n | typeof DomainAssociationKind\n | typeof DataDomainKind\n\n/**\n * The impact analysis report\n */\nexport interface DomainImpactReport {\n /**\n * The key of the impacted data object.\n * This is the key of the object that is being changed.\n */\n key: string\n /**\n * The kind of the impacted data object.\n * This is the kind of the object that is being changed.\n */\n kind: DomainImpactKinds\n /**\n * The list of impacted data objects.\n */\n impact: DomainImpactItem[]\n /**\n * Whether it is possible to proceed with the change.\n * If the change is not possible, the reason will be in the impact list.\n */\n canProceed: boolean\n}\n\nexport interface DomainImpactItem {\n /**\n * The key of the impacted data object.\n */\n key: string\n /**\n * The kind of the impacted data object.\n */\n kind: string\n /**\n * The type of the impact.\n *\n * - `delete` - The data object would be deleted.\n */\n type: 'delete' | 'publish'\n /**\n * The impact description.\n * Explains what will happen to the impacted data object.\n * This is a human-readable description of the impact.\n * It should be clear and concise.\n */\n impact: string\n /**\n * The severity of the impact.\n *\n * - `info` - The impact is informational.\n * - `warning` - The impact can potentially cause problems but is not a blocker.\n * - `error` - The impact is a blocker and needs to be resolved before proceeding.\n */\n severity: 'info' | 'warning' | 'error'\n /**\n * Whether the impact is blocking the operation.\n * If true, the operation cannot proceed.\n * @deprecated Use `severity` instead.\n */\n blocking: boolean\n /**\n * The type of the relationship between two impacted objects.\n */\n relationship?: 'child'\n /**\n * The resolution of the conflict if the change will be forced.\n */\n resolution?: string\n /**\n * The optional parent of the impacted data object.\n * For example, if the impacted item is a property, this will be the entity it belongs to.\n */\n parent?: string\n}\n\n/**\n * # DomainImpactAnalysis\n *\n * The `DomainImpactAnalysis` class is a tool for analyzing the consequences of deleting data domain elements\n * within a `DataDomain`. It helps developers understand the ripple effects of removing a namespace, data model,\n * entity, property, or association, ensuring data integrity and preventing unintended side effects.\n *\n * ## Core Concepts\n *\n * - **Impact Report:** The central output of the `DomainImpactAnalysis` class is an `DomainImpactReport`.\n * This report details the potential consequences of a deletion operation, including:\n * - The object being deleted (`key`, `kind`).\n * - A list of `DomainImpactItem` objects, each describing a specific consequence.\n * - Whether the deletion can proceed safely (`canProceed`).\n *\n * - **DomainImpactItem:** Each `DomainImpactItem` describes a specific consequence of the deletion.\n * Key properties include:\n * - `key`: The key of the impacted object.\n * - `kind`: The kind of the impacted object.\n * - `type`: The type of impact (currently only `delete`).\n * - `impact`: A human-readable description of the impact.\n * - `blocking`: Whether this impact prevents the deletion from proceeding.\n * - `relationship`: The type of relationship between the deleted object and the impacted object (e.g., `child`).\n * - `resolution`: A description of how the impact will be resolved if the deletion is forced.\n *\n * - **Blocking Impacts:** Some impacts are considered \"blocking,\" meaning they prevent the deletion from proceeding\n * without manual intervention. For example, deleting an entity that is a parent to other entities is\n * a blocking impact.\n *\n * - **Non-Blocking Impacts:** Some impacts are informational and do not prevent the deletion. For example, deleting a\n * property is not a blocking impact.\n *\n * ## Usage\n *\n * 1. **Instantiation:** Create an instance of `DomainImpactAnalysis`, passing the root `DataDomain` as an argument.\n *\n * ```typescript\n * import { DataDomain } from './DataDomain';\n * import { DomainImpactAnalysis } from './DomainImpactAnalysis';\n *\n * const dataDomain = new DataDomain();\n * // ... add some data to the domain\n * const analyzer = new DomainImpactAnalysis(dataDomain);\n * ```\n *\n * 2. **Performing Analysis:** Use the `deleteAnalysis()` method to generate an `DomainImpactReport` for\n * a specific deletion.\n * Provide the `key` and `kind` of the object to be deleted.\n *\n * ```typescript\n * import { DomainEntityKind } from '../models/kinds.js';\n * // ...\n * const entityKey = 'some-entity-key';\n * const report = analyzer.deleteAnalysis(entityKey, DomainEntityKind);\n * ```\n *\n * 3. **Interpreting the Report:** Examine the `DomainImpactReport` to understand the consequences of the deletion.\n * - Check `report.canProceed` to see if the deletion is safe.\n * - Iterate through `report.impact` to understand each consequence.\n * - Pay special attention to `impact.blocking` to identify impacts that require manual resolution.\n *\n * ```typescript\n * if (report.canProceed) {\n * // Proceed with deletion\n * } else {\n * console.warn('Deletion cannot proceed due to the following impacts:');\n * report.impact.forEach((item) => {\n * console.warn(`- ${item.impact}`);\n * if (item.blocking) {\n * console.warn(` - This impact is blocking.`);\n * if (item.resolution) {\n * console.warn(` - Resolution: ${item.resolution}`);\n * }\n * }\n * });\n * // Handle blocking impacts (e.g., prompt the user, modify the data, etc.)\n * }\n * ```\n *\n * ## Supported Deletion Scenarios\n *\n * The `DomainImpactAnalysis` class supports analyzing the deletion of the following data domain element types:\n *\n * - **Namespaces (`DomainNamespaceKind`):** Deleting a namespace also impacts all its child namespaces,\n * data models, entities, properties, and associations.\n * - **Data Models (`DomainModelKind`):** Deleting a data model impacts all its entities, properties, and associations.\n * - **Entities (`DomainEntityKind`):** Deleting an entity impacts its properties, associations, and any other\n * entities that have it as a parent or target in an association.\n * - **Properties (`DomainPropertyKind`):** Deleting a property impacts the entity it belongs to.\n * - **Associations (`DomainAssociationKind`):** Deleting an association impacts the entity it belongs to.\n * - **Data Domain (`DataDomainKind`):** Deleting a data domain is not supported.\n *\n * ## Example: Deleting an Entity\n *\n * Consider the following scenario:\n *\n * ```\n * DataDomain\n * - Namespace: `MyNamespace`\n * - Data Model: `ProductModel`\n * - Entity: `Product`\n * - Property: `name`\n * - Association: `category` (targets `Category` entity)\n * - Entity: `Category`\n * - Property: `name`\n * - Entity: `SpecialProduct` (parent: `Product`)\n * ```\n *\n * If you attempt to delete the `Product` entity, the `DomainImpactAnalysis` will generate a report similar to this:\n *\n * ```json\n * {\n * \"key\": \"Product\",\n * \"kind\": \"DomainEntityKind\",\n * \"impact\": [\n * {\n * \"key\": \"Product\",\n * \"kind\": \"DomainEntityKind\",\n * \"type\": \"delete\",\n * \"impact\": \"The entity with key Product will be deleted.\",\n * \"blocking\": false\n * },\n * {\n * \"key\": \"SpecialProduct\",\n * \"kind\": \"DomainEntityKind\",\n * \"type\": \"delete\",\n * \"impact\": \"The SpecialProduct entity will become an orphan because it is a child of Product.\",\n * \"resolution\": \"The \\\"Product\\\" entity will be removed as the parent of the \\\"SpecialProduct\\\" entity.\",\n * \"blocking\": true,\n * \"relationship\": \"child\"\n * },\n * {\n * \"key\": \"category\",\n * \"kind\": \"DomainAssociationKind\",\n * \"type\": \"delete\",\n * \"impact\": \"The association with key category will be broken because it has a target to Product.\",\n * \"resolution\": \"The association with key category will be removed from Product.\",\n * \"blocking\": true\n * },\n * {\n * \"key\": \"name\",\n * \"kind\": \"DomainPropertyKind\",\n * \"type\": \"delete\",\n * \"impact\": \"The property with key name will be deleted.\",\n * \"blocking\": false\n * }\n * ],\n * \"canProceed\": false\n * }\n * ```\n *\n * This report indicates that:\n *\n * - The `Product` entity will be deleted.\n * - The `SpecialProduct` entity will become an orphan (blocking).\n * - The `category` association will be broken (blocking).\n * - The `name` property will be deleted.\n * - The deletion cannot proceed without addressing the blocking impacts.\n *\n * ## Types\n *\n * ### `DomainImpactKinds`\n *\n * - **Description:** A type alias for the kinds of data domain elements that can be analyzed.\n * - **Values:**\n * - `DomainNamespaceKind`\n * - `DomainEntityKind`\n * - `DomainModelKind`\n * - `DomainPropertyKind`\n * - `DomainAssociationKind`\n * - `DataDomainKind`\n *\n * ### `DomainImpactReport`\n *\n * - **Description:** The structure of the impact analysis report.\n * - **Properties:**\n * - `key` (`string`): The key of the object being deleted.\n * - `kind` (`DomainImpactKinds`): The kind of the object being deleted.\n * - `impact` (`DomainImpactItem[]`): The list of impacts.\n * - `canProceed` (`boolean`): Whether the deletion can proceed.\n *\n * ### `DomainImpactItem`\n *\n * - **Description:** The structure of an individual impact item.\n * - **Properties:**\n * - `key` (`string`): The key of the impacted object.\n * - `kind` (`string`): The kind of the impacted object.\n * - `type` (`'delete'`): The type of impact.\n * - `impact` (`string`): The impact description.\n * - `blocking` (`boolean`): Whether the impact is blocking.\n * - `relationship` (`'child'`, optional): The relationship type.\n * - `resolution` (`string`, optional): The resolution description.\n *\n * ## Error Handling\n *\n * The `DomainImpactAnalysis` class does not throw errors. Instead, it uses the `DomainImpactReport` to communicate\n * the results of the analysis, including any blocking impacts.\n *\n * ## Best Practices\n *\n * - **Always Analyze Before Deleting:** Before deleting any data domain element, always use `DomainImpactAnalysis`\n * to understand the consequences.\n * - **Handle Blocking Impacts:** Pay close attention to `blocking` impacts and implement appropriate\n * logic to handle them.\n * - **Inform the User:** If a deletion cannot proceed, inform the user about the blocking impacts and provide\n * guidance on how to resolve them.\n * - **Consider Forced Deletion:** In some cases, you may want to allow users to force a deletion even if there are\n * blocking impacts. In such cases, you should clearly communicate the risks to the user.\n *\n * ## Conclusion\n *\n * The `DomainImpactAnalysis` class is an essential tool for maintaining data integrity when working with complex\n * data domain models. By providing detailed impact reports, it empowers developers to make informed decisions\n * about data deletion and prevent unintended consequences.\n */\nexport class DomainImpactAnalysis {\n private report: DomainImpactReport\n private root: DataDomain\n\n constructor(root: DataDomain) {\n this.root = root\n this.report = {\n key: '',\n kind: DataDomainKind,\n impact: [],\n canProceed: false,\n }\n }\n\n /**\n * Generates a report of how the data domain will be impacted by the deletion of a data domain object.\n * @param key The key of the impacted data domain object.\n * @param kind The kind of the impacted data object.\n * @returns The delete impact analysis report.\n */\n deleteAnalysis(key: string, kind: DomainImpactKinds): DomainImpactReport {\n this.report = {\n key,\n kind,\n impact: [],\n canProceed: true,\n }\n this.createDeleteImpact(key, kind, key)\n return this.report\n }\n\n /**\n * Generates a report of how the data domain will be impacted by the removal of a foreign namespace.\n * @param key The key of the foreign namespace.\n * @returns The delete impact analysis report.\n */\n removeForeignNamespaceAnalysis(key: string): DomainImpactReport {\n this.report = {\n key,\n kind: DomainNamespaceKind,\n impact: [],\n canProceed: true,\n }\n this.createRemoveForeignNamespaceImpact(key)\n return this.report\n }\n\n /**\n * Analyzes the data domain for publishing. Essentially, it performs a validation of the data domain\n * and returns a report of the impact.\n * @returns The publish impact analysis report.\n */\n publishAnalysis(): DomainImpactReport {\n this.report = {\n key: '',\n kind: DataDomainKind,\n impact: [],\n canProceed: true,\n }\n const entityValidator = new EntityValidation(this.root)\n const propertyValidator = new PropertyValidation(this.root)\n const associationValidator = new AssociationValidation(this.root)\n for (const entity of this.root.listEntities()) {\n if (entity.domain.key !== this.root.key) {\n // we don't need to validate foreign entities\n continue\n }\n const report = entityValidator.validate(entity)\n for (const item of report) {\n const blocking = item.severity === 'error'\n this.report.canProceed = this.report.canProceed && !blocking\n this.report.impact.push({\n key: item.key,\n kind: item.kind,\n type: 'publish',\n impact: item.message,\n blocking,\n resolution: item.help,\n severity: item.severity,\n parent: item.parent,\n })\n }\n for (const property of entity.properties) {\n const report = propertyValidator.validate(property)\n for (const item of report) {\n const blocking = item.severity === 'error'\n this.report.canProceed = this.report.canProceed && !blocking\n this.report.impact.push({\n key: item.key,\n kind: item.kind,\n type: 'publish',\n impact: item.message,\n blocking,\n resolution: item.help,\n severity: item.severity,\n parent: item.parent,\n })\n }\n }\n for (const association of entity.associations) {\n const report = associationValidator.validate(association)\n for (const item of report) {\n const blocking = item.severity === 'error'\n this.report.canProceed = this.report.canProceed && !blocking\n this.report.impact.push({\n key: item.key,\n kind: item.kind,\n type: 'publish',\n impact: item.message,\n blocking,\n resolution: item.help,\n severity: item.severity,\n parent: item.parent,\n })\n }\n }\n }\n return this.report\n }\n\n protected createDeleteImpact(key: string, kind: DomainImpactKinds, rootKey: string): void {\n switch (kind) {\n case DomainNamespaceKind:\n this.deleteNamespaceAnalysis(key, rootKey)\n break\n case DomainModelKind:\n this.deleteDataModelAnalysis(key, rootKey)\n break\n case DomainEntityKind:\n this.deleteEntityAnalysis(key, rootKey)\n break\n case DomainPropertyKind:\n this.deletePropertyAnalysis(key)\n break\n case DomainAssociationKind:\n this.deleteAssociationAnalysis(key)\n break\n default:\n // ignore unknown kinds\n }\n }\n\n protected deleteNamespaceAnalysis(key: string, rootKey: string): void {\n const ns = this.root.findNamespace(key)\n if (!ns) {\n return\n }\n this.report.impact.push({\n key: ns.key,\n kind: ns.kind,\n type: 'delete',\n impact: `The ${ns.info.getLabel()} ${this.kindToLabel(DomainNamespaceKind)} will be deleted.`,\n blocking: false,\n severity: 'info',\n })\n for (const child of ns.listNamespaces()) {\n this.deleteNamespaceAnalysis(child.key, rootKey)\n }\n for (const child of ns.listModels()) {\n this.deleteDataModelAnalysis(child.key, rootKey)\n }\n }\n\n protected deleteDataModelAnalysis(key: string, rootKey: string): void {\n const model = this.root.findModel(key)\n if (!model) {\n return\n }\n this.report.impact.push({\n key: model.key,\n kind: model.kind,\n type: 'delete',\n impact: `The ${model.info.getLabel()} ${this.kindToLabel(DomainModelKind)} will be deleted.`,\n blocking: false,\n severity: 'info',\n })\n for (const child of model.listEntities()) {\n this.deleteEntityAnalysis(child.key, rootKey)\n }\n }\n\n protected deleteEntityAnalysis(key: string, rootKey: string): void {\n const entity = this.root.findEntity(key)\n if (!entity) {\n return\n }\n this.report.impact.push({\n key: entity.key,\n kind: entity.kind,\n type: 'delete',\n impact: `The ${entity.info.getLabel()} ${this.kindToLabel(DomainEntityKind)} will be deleted.`,\n blocking: false,\n severity: 'info',\n })\n\n // We need to know whether the entity is a parent of another entity\n for (const info of this.root.graph.inEdges(key)) {\n const edge = this.root.graph.edge(info)\n if (!edge || edge.type !== 'parent') {\n continue\n }\n const childEntity = this.root.findEntity(info.v)\n if (!childEntity) {\n continue\n }\n if (childEntity.isChildOf(rootKey)) {\n // No need to include this child as it itself is being deleted\n continue\n }\n const pLabel = entity.info.getLabel()\n const cLabel = childEntity.info.getLabel()\n this.report.impact.push({\n key: childEntity.key,\n kind: childEntity.kind,\n type: 'delete',\n impact: `The \"${cLabel}\" ${this.kindToLabel(DomainEntityKind)} will become an orphan because it is a child of the \"${pLabel}\" entity.`,\n resolution: `The \"${pLabel}\" entity will be removed as the parent of the \"${cLabel}\" entity.`,\n blocking: false,\n relationship: 'child',\n severity: 'error',\n })\n this.report.canProceed = false\n }\n // We need to know whether there's another entity that has an association to this entity.\n for (const edgeInfo of this.root.graph.inEdges(entity.key)) {\n const edge = this.root.graph.edge(edgeInfo)\n if (!edge || edge.type !== 'association') {\n continue\n }\n const association = this.root.findAssociation(edgeInfo.v)\n if (!association) {\n continue\n }\n const targetEntity = association.getParentInstance()\n if (!targetEntity) {\n continue\n }\n if (targetEntity.isChildOf(rootKey)) {\n // No need to include this association as the target entity itself is being deleted\n continue\n }\n\n const aLabel = association.info.getLabel()\n const eLabel = entity.info.getLabel()\n this.report.impact.push({\n key: association.key,\n kind: association.kind,\n type: 'delete',\n impact: `The ${aLabel} ${this.kindToLabel(DomainAssociationKind)} will be broken because it has a target to ${eLabel}.`,\n resolution: `The ${aLabel} ${this.kindToLabel(DomainAssociationKind)} will be removed from ${eLabel}.`,\n blocking: true,\n severity: 'error',\n })\n this.report.canProceed = false\n }\n for (const child of entity.listProperties()) {\n this.deletePropertyAnalysis(child.key)\n }\n for (const child of entity.listAssociations()) {\n this.deleteAssociationAnalysis(child.key)\n }\n }\n\n protected deletePropertyAnalysis(key: string): void {\n const property = this.root.findProperty(key)\n if (!property) {\n return\n }\n this.report.impact.push({\n key: property.key,\n kind: property.kind,\n type: 'delete',\n impact: `The ${property.info.getLabel()} ${this.kindToLabel(DomainPropertyKind)} will be deleted.`,\n blocking: false,\n severity: 'info',\n })\n }\n\n protected deleteAssociationAnalysis(key: string): void {\n const association = this.root.findAssociation(key)\n if (!association) {\n return\n }\n this.report.impact.push({\n key: association.key,\n kind: association.kind,\n type: 'delete',\n impact: `The ${association.info.getLabel()} ${this.kindToLabel(DomainAssociationKind)} will be deleted.`,\n blocking: false,\n severity: 'info',\n })\n }\n\n protected kindToLabel(kind: DomainImpactKinds): string {\n switch (kind) {\n case DomainNamespaceKind:\n return 'namespace'\n case DomainEntityKind:\n return 'entity'\n case DomainModelKind:\n return 'data model'\n case DomainPropertyKind:\n return 'property'\n case DomainAssociationKind:\n return 'association'\n default:\n return 'unknown'\n }\n }\n\n protected createRemoveForeignNamespaceImpact(key: string): void {\n const foreignNamespace = this.root.dependencies.get(key)\n if (!foreignNamespace) {\n return\n }\n // Check for parent relationships to foreign entities\n for (const entity of this.root.listEntities()) {\n for (const info of this.root.graph.outEdges(entity.key)) {\n const edge = this.root.graph.edge(info)\n if (!edge) {\n continue\n }\n if (edge.type === 'parent' && edge.domain === key) {\n // the parent is in the foreign namespace\n const parentEntity = this.root.findEntity(info.w)\n if (!parentEntity) {\n continue\n }\n const eLabel = entity.info.getLabel()\n const pLabel = parentEntity.info.getLabel()\n this.report.impact.push({\n key: entity.key,\n kind: entity.kind,\n type: 'delete',\n impact: `The \"${eLabel}\" ${this.kindToLabel(DomainEntityKind)} will become an orphan because its parent \"${pLabel}\" is in the foreign namespace \"${foreignNamespace.key}\".`,\n resolution: `The \"${pLabel}\" entity will be removed as the parent of the \"${eLabel}\" entity.`,\n blocking: true,\n relationship: 'child',\n severity: 'error',\n })\n this.report.canProceed = false\n } else if (edge.type === 'association') {\n const association = this.root.findAssociation(info.w)\n if (!association) {\n continue\n }\n const targets = association.targets.filter((t) => t.domain === key)\n if (targets.length) {\n for (const info of targets) {\n const targetEntity = this.root.findForeignEntity(info.key, info.domain as string)\n if (!targetEntity) {\n continue\n }\n const aLabel = association.info.getLabel()\n const eLabel = entity.info.getLabel()\n const tLabel = targetEntity.info.getLabel()\n this.report.impact.push({\n key: association.key,\n kind: association.kind,\n type: 'delete',\n impact: `The \"${aLabel}\" ${this.kindToLabel(DomainAssociationKind)} from \"${eLabel}\" will be broken because it targets \"${tLabel}\" in the foreign namespace \"${foreignNamespace.key}\".`,\n resolution: `The \"${aLabel}\" ${this.kindToLabel(DomainAssociationKind)} will be removed from \"${eLabel}\".`,\n blocking: true,\n severity: 'error',\n })\n this.report.canProceed = false\n }\n }\n }\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"DomainImpactAnalysis.js","sourceRoot":"","sources":["../../../src/modeling/DomainImpactAnalysis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,GACf,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AAsFxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsNG;AACH,MAAM,OAAO,oBAAoB;IACvB,MAAM,CAAoB;IAC1B,IAAI,CAAY;IAExB,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,MAAM,GAAG;YACZ,GAAG,EAAE,EAAE;YACP,IAAI,EAAE,cAAc;YACpB,MAAM,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CACtB,GAAG,EAAE,WAAW,CAAC,GAAG;gCACpB,IAAI,EAAE,WAAW,CAAC,IAAI;gCACtB,IAAI,EAAE,QAAQ;gCACd,MAAM,EAAE,QAAQ,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,UAAU,MAAM,wCAAwC,MAAM,+BAA+B,gBAAgB,CAAC,GAAG,IAAI;gCACvL,UAAU,EAAE,QAAQ,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,0BAA0B,MAAM,IAAI;gCAC1G,QAAQ,EAAE,IAAI;gCACd,QAAQ,EAAE,OAAO;6BAClB,CAAC,CAAA;4BACF,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,KAAK,CAAA;wBAChC,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import {\n DomainNamespaceKind,\n DomainEntityKind,\n DomainModelKind,\n DomainPropertyKind,\n DomainAssociationKind,\n DataDomainKind,\n} from '../models/kinds.js'\nimport type { DataDomain } from './DataDomain.js'\nimport { AssociationValidation } from './validation/association_validation.js'\nimport { EntityValidation } from './validation/entity_validation.js'\nimport { PropertyValidation } from './validation/property_validation.js'\n\nexport type DomainImpactKinds =\n | typeof DomainNamespaceKind\n | typeof DomainEntityKind\n | typeof DomainModelKind\n | typeof DomainPropertyKind\n | typeof DomainAssociationKind\n | typeof DataDomainKind\n\n/**\n * The impact analysis report\n */\nexport interface DomainImpactReport {\n /**\n * The key of the impacted data object.\n * This is the key of the object that is being changed.\n */\n key: string\n /**\n * The kind of the impacted data object.\n * This is the kind of the object that is being changed.\n */\n kind: DomainImpactKinds\n /**\n * The list of impacted data objects.\n */\n impact: DomainImpactItem[]\n /**\n * Whether it is possible to proceed with the change.\n * If the change is not possible, the reason will be in the impact list.\n */\n canProceed: boolean\n}\n\nexport interface DomainImpactItem {\n /**\n * The key of the impacted data object.\n */\n key: string\n /**\n * The kind of the impacted data object.\n */\n kind: string\n /**\n * The type of the impact.\n *\n * - `delete` - The data object would be deleted.\n */\n type: 'delete' | 'publish'\n /**\n * The impact description.\n * Explains what will happen to the impacted data object.\n * This is a human-readable description of the impact.\n * It should be clear and concise.\n */\n impact: string\n /**\n * The severity of the impact.\n *\n * - `info` - The impact is informational.\n * - `warning` - The impact can potentially cause problems but is not a blocker.\n * - `error` - The impact is a blocker and needs to be resolved before proceeding.\n */\n severity: 'info' | 'warning' | 'error'\n /**\n * Whether the impact is blocking the operation.\n * If true, the operation cannot proceed.\n * @deprecated Use `severity` instead.\n */\n blocking: boolean\n /**\n * The type of the relationship between two impacted objects.\n */\n relationship?: 'child'\n /**\n * The resolution of the conflict if the change will be forced.\n */\n resolution?: string\n /**\n * The optional parent of the impacted data object.\n * For example, if the impacted item is a property, this will be the entity it belongs to.\n */\n parent?: string\n}\n\n/**\n * # DomainImpactAnalysis\n *\n * The `DomainImpactAnalysis` class is a tool for analyzing the consequences of deleting data domain elements\n * within a `DataDomain`. It helps developers understand the ripple effects of removing a namespace, data model,\n * entity, property, or association, ensuring data integrity and preventing unintended side effects.\n *\n * ## Core Concepts\n *\n * - **Impact Report:** The central output of the `DomainImpactAnalysis` class is an `DomainImpactReport`.\n * This report details the potential consequences of a deletion operation, including:\n * - The object being deleted (`key`, `kind`).\n * - A list of `DomainImpactItem` objects, each describing a specific consequence.\n * - Whether the deletion can proceed safely (`canProceed`).\n *\n * - **DomainImpactItem:** Each `DomainImpactItem` describes a specific consequence of the deletion.\n * Key properties include:\n * - `key`: The key of the impacted object.\n * - `kind`: The kind of the impacted object.\n * - `type`: The type of impact (currently only `delete`).\n * - `impact`: A human-readable description of the impact.\n * - `blocking`: Whether this impact prevents the deletion from proceeding.\n * - `relationship`: The type of relationship between the deleted object and the impacted object (e.g., `child`).\n * - `resolution`: A description of how the impact will be resolved if the deletion is forced.\n *\n * - **Blocking Impacts:** Some impacts are considered \"blocking,\" meaning they prevent the deletion from proceeding\n * without manual intervention. For example, deleting an entity that is a parent to other entities is\n * a blocking impact.\n *\n * - **Non-Blocking Impacts:** Some impacts are informational and do not prevent the deletion. For example, deleting a\n * property is not a blocking impact.\n *\n * ## Usage\n *\n * 1. **Instantiation:** Create an instance of `DomainImpactAnalysis`, passing the root `DataDomain` as an argument.\n *\n * ```typescript\n * import { DataDomain } from './DataDomain';\n * import { DomainImpactAnalysis } from './DomainImpactAnalysis';\n *\n * const dataDomain = new DataDomain();\n * // ... add some data to the domain\n * const analyzer = new DomainImpactAnalysis(dataDomain);\n * ```\n *\n * 2. **Performing Analysis:** Use the `deleteAnalysis()` method to generate an `DomainImpactReport` for\n * a specific deletion.\n * Provide the `key` and `kind` of the object to be deleted.\n *\n * ```typescript\n * import { DomainEntityKind } from '../models/kinds.js';\n * // ...\n * const entityKey = 'some-entity-key';\n * const report = analyzer.deleteAnalysis(entityKey, DomainEntityKind);\n * ```\n *\n * 3. **Interpreting the Report:** Examine the `DomainImpactReport` to understand the consequences of the deletion.\n * - Check `report.canProceed` to see if the deletion is safe.\n * - Iterate through `report.impact` to understand each consequence.\n * - Pay special attention to `impact.blocking` to identify impacts that require manual resolution.\n *\n * ```typescript\n * if (report.canProceed) {\n * // Proceed with deletion\n * } else {\n * console.warn('Deletion cannot proceed due to the following impacts:');\n * report.impact.forEach((item) => {\n * console.warn(`- ${item.impact}`);\n * if (item.blocking) {\n * console.warn(` - This impact is blocking.`);\n * if (item.resolution) {\n * console.warn(` - Resolution: ${item.resolution}`);\n * }\n * }\n * });\n * // Handle blocking impacts (e.g., prompt the user, modify the data, etc.)\n * }\n * ```\n *\n * ## Supported Deletion Scenarios\n *\n * The `DomainImpactAnalysis` class supports analyzing the deletion of the following data domain element types:\n *\n * - **Namespaces (`DomainNamespaceKind`):** Deleting a namespace also impacts all its child namespaces,\n * data models, entities, properties, and associations.\n * - **Data Models (`DomainModelKind`):** Deleting a data model impacts all its entities, properties, and associations.\n * - **Entities (`DomainEntityKind`):** Deleting an entity impacts its properties, associations, and any other\n * entities that have it as a parent or target in an association.\n * - **Properties (`DomainPropertyKind`):** Deleting a property impacts the entity it belongs to.\n * - **Associations (`DomainAssociationKind`):** Deleting an association impacts the entity it belongs to.\n * - **Data Domain (`DataDomainKind`):** Deleting a data domain is not supported.\n *\n * ## Example: Deleting an Entity\n *\n * Consider the following scenario:\n *\n * ```\n * DataDomain\n * - Namespace: `MyNamespace`\n * - Data Model: `ProductModel`\n * - Entity: `Product`\n * - Property: `name`\n * - Association: `category` (targets `Category` entity)\n * - Entity: `Category`\n * - Property: `name`\n * - Entity: `SpecialProduct` (parent: `Product`)\n * ```\n *\n * If you attempt to delete the `Product` entity, the `DomainImpactAnalysis` will generate a report similar to this:\n *\n * ```json\n * {\n * \"key\": \"Product\",\n * \"kind\": \"DomainEntityKind\",\n * \"impact\": [\n * {\n * \"key\": \"Product\",\n * \"kind\": \"DomainEntityKind\",\n * \"type\": \"delete\",\n * \"impact\": \"The entity with key Product will be deleted.\",\n * \"blocking\": false\n * },\n * {\n * \"key\": \"SpecialProduct\",\n * \"kind\": \"DomainEntityKind\",\n * \"type\": \"delete\",\n * \"impact\": \"The SpecialProduct entity will become an orphan because it is a child of Product.\",\n * \"resolution\": \"The \\\"Product\\\" entity will be removed as the parent of the \\\"SpecialProduct\\\" entity.\",\n * \"blocking\": true,\n * \"relationship\": \"child\"\n * },\n * {\n * \"key\": \"category\",\n * \"kind\": \"DomainAssociationKind\",\n * \"type\": \"delete\",\n * \"impact\": \"The association with key category will be broken because it has a target to Product.\",\n * \"resolution\": \"The association with key category will be removed from Product.\",\n * \"blocking\": true\n * },\n * {\n * \"key\": \"name\",\n * \"kind\": \"DomainPropertyKind\",\n * \"type\": \"delete\",\n * \"impact\": \"The property with key name will be deleted.\",\n * \"blocking\": false\n * }\n * ],\n * \"canProceed\": false\n * }\n * ```\n *\n * This report indicates that:\n *\n * - The `Product` entity will be deleted.\n * - The `SpecialProduct` entity will become an orphan (blocking).\n * - The `category` association will be broken (blocking).\n * - The `name` property will be deleted.\n * - The deletion cannot proceed without addressing the blocking impacts.\n *\n * ## Types\n *\n * ### `DomainImpactKinds`\n *\n * - **Description:** A type alias for the kinds of data domain elements that can be analyzed.\n * - **Values:**\n * - `DomainNamespaceKind`\n * - `DomainEntityKind`\n * - `DomainModelKind`\n * - `DomainPropertyKind`\n * - `DomainAssociationKind`\n * - `DataDomainKind`\n *\n * ### `DomainImpactReport`\n *\n * - **Description:** The structure of the impact analysis report.\n * - **Properties:**\n * - `key` (`string`): The key of the object being deleted.\n * - `kind` (`DomainImpactKinds`): The kind of the object being deleted.\n * - `impact` (`DomainImpactItem[]`): The list of impacts.\n * - `canProceed` (`boolean`): Whether the deletion can proceed.\n *\n * ### `DomainImpactItem`\n *\n * - **Description:** The structure of an individual impact item.\n * - **Properties:**\n * - `key` (`string`): The key of the impacted object.\n * - `kind` (`string`): The kind of the impacted object.\n * - `type` (`'delete'`): The type of impact.\n * - `impact` (`string`): The impact description.\n * - `blocking` (`boolean`): Whether the impact is blocking.\n * - `relationship` (`'child'`, optional): The relationship type.\n * - `resolution` (`string`, optional): The resolution description.\n *\n * ## Error Handling\n *\n * The `DomainImpactAnalysis` class does not throw errors. Instead, it uses the `DomainImpactReport` to communicate\n * the results of the analysis, including any blocking impacts.\n *\n * ## Best Practices\n *\n * - **Always Analyze Before Deleting:** Before deleting any data domain element, always use `DomainImpactAnalysis`\n * to understand the consequences.\n * - **Handle Blocking Impacts:** Pay close attention to `blocking` impacts and implement appropriate\n * logic to handle them.\n * - **Inform the User:** If a deletion cannot proceed, inform the user about the blocking impacts and provide\n * guidance on how to resolve them.\n * - **Consider Forced Deletion:** In some cases, you may want to allow users to force a deletion even if there are\n * blocking impacts. In such cases, you should clearly communicate the risks to the user.\n *\n * ## Conclusion\n *\n * The `DomainImpactAnalysis` class is an essential tool for maintaining data integrity when working with complex\n * data domain models. By providing detailed impact reports, it empowers developers to make informed decisions\n * about data deletion and prevent unintended consequences.\n */\nexport class DomainImpactAnalysis {\n private report: DomainImpactReport\n private root: DataDomain\n\n constructor(root: DataDomain) {\n this.root = root\n this.report = {\n key: '',\n kind: DataDomainKind,\n impact: [],\n canProceed: false,\n }\n }\n\n /**\n * Generates a report of how the data domain will be impacted by the deletion of a data domain object.\n * @param key The key of the impacted data domain object.\n * @param kind The kind of the impacted data object.\n * @returns The delete impact analysis report.\n */\n deleteAnalysis(key: string, kind: DomainImpactKinds): DomainImpactReport {\n this.report = {\n key,\n kind,\n impact: [],\n canProceed: true,\n }\n this.createDeleteImpact(key, kind, key)\n return this.report\n }\n\n /**\n * Generates a report of how the data domain will be impacted by the removal of a foreign namespace.\n * @param key The key of the foreign namespace.\n * @returns The delete impact analysis report.\n */\n removeForeignNamespaceAnalysis(key: string): DomainImpactReport {\n this.report = {\n key,\n kind: DomainNamespaceKind,\n impact: [],\n canProceed: true,\n }\n this.createRemoveForeignNamespaceImpact(key)\n return this.report\n }\n\n /**\n * Analyzes the data domain for publishing. Essentially, it performs a validation of the data domain\n * and returns a report of the impact.\n * @returns The publish impact analysis report.\n */\n publishAnalysis(): DomainImpactReport {\n this.report = {\n key: '',\n kind: DataDomainKind,\n impact: [],\n canProceed: true,\n }\n const entityValidator = new EntityValidation(this.root)\n const propertyValidator = new PropertyValidation(this.root)\n const associationValidator = new AssociationValidation(this.root)\n for (const entity of this.root.listEntities()) {\n if (entity.domain.key !== this.root.key) {\n // we don't need to validate foreign entities\n continue\n }\n const report = entityValidator.validate(entity)\n for (const item of report) {\n const blocking = item.severity === 'error'\n this.report.canProceed = this.report.canProceed && !blocking\n this.report.impact.push({\n key: item.key,\n kind: item.kind,\n type: 'publish',\n impact: item.message,\n blocking,\n resolution: item.help,\n severity: item.severity,\n parent: item.parent,\n })\n }\n for (const property of entity.properties) {\n const report = propertyValidator.validate(property)\n for (const item of report) {\n const blocking = item.severity === 'error'\n this.report.canProceed = this.report.canProceed && !blocking\n this.report.impact.push({\n key: item.key,\n kind: item.kind,\n type: 'publish',\n impact: item.message,\n blocking,\n resolution: item.help,\n severity: item.severity,\n parent: item.parent,\n })\n }\n }\n for (const association of entity.associations) {\n const report = associationValidator.validate(association)\n for (const item of report) {\n const blocking = item.severity === 'error'\n this.report.canProceed = this.report.canProceed && !blocking\n this.report.impact.push({\n key: item.key,\n kind: item.kind,\n type: 'publish',\n impact: item.message,\n blocking,\n resolution: item.help,\n severity: item.severity,\n parent: item.parent,\n })\n }\n }\n }\n return this.report\n }\n\n protected createDeleteImpact(key: string, kind: DomainImpactKinds, rootKey: string): void {\n switch (kind) {\n case DomainNamespaceKind:\n this.deleteNamespaceAnalysis(key, rootKey)\n break\n case DomainModelKind:\n this.deleteModelAnalysis(key, rootKey)\n break\n case DomainEntityKind:\n this.deleteEntityAnalysis(key, rootKey)\n break\n case DomainPropertyKind:\n this.deletePropertyAnalysis(key)\n break\n case DomainAssociationKind:\n this.deleteAssociationAnalysis(key)\n break\n default:\n // ignore unknown kinds\n }\n }\n\n protected deleteNamespaceAnalysis(key: string, rootKey: string): void {\n const ns = this.root.findNamespace(key)\n if (!ns) {\n return\n }\n this.report.impact.push({\n key: ns.key,\n kind: ns.kind,\n type: 'delete',\n impact: `The ${ns.info.getLabel()} ${this.kindToLabel(DomainNamespaceKind)} will be deleted.`,\n blocking: false,\n severity: 'info',\n })\n for (const child of ns.listNamespaces()) {\n this.deleteNamespaceAnalysis(child.key, rootKey)\n }\n for (const child of ns.listModels()) {\n this.deleteModelAnalysis(child.key, rootKey)\n }\n }\n\n protected deleteModelAnalysis(key: string, rootKey: string): void {\n const model = this.root.findModel(key)\n if (!model) {\n return\n }\n this.report.impact.push({\n key: model.key,\n kind: model.kind,\n type: 'delete',\n impact: `The ${model.info.getLabel()} ${this.kindToLabel(DomainModelKind)} will be deleted.`,\n blocking: false,\n severity: 'info',\n })\n for (const child of model.listEntities()) {\n this.deleteEntityAnalysis(child.key, rootKey)\n }\n }\n\n protected deleteEntityAnalysis(key: string, rootKey: string): void {\n const entity = this.root.findEntity(key)\n if (!entity) {\n return\n }\n this.report.impact.push({\n key: entity.key,\n kind: entity.kind,\n type: 'delete',\n impact: `The ${entity.info.getLabel()} ${this.kindToLabel(DomainEntityKind)} will be deleted.`,\n blocking: false,\n severity: 'info',\n })\n\n // We need to know whether the entity is a parent of another entity\n for (const info of this.root.graph.inEdges(key)) {\n const edge = this.root.graph.edge(info)\n if (!edge || edge.type !== 'parent') {\n continue\n }\n const childEntity = this.root.findEntity(info.v)\n if (!childEntity) {\n continue\n }\n if (childEntity.isChildOf(rootKey)) {\n // No need to include this child as it itself is being deleted\n continue\n }\n const pLabel = entity.info.getLabel()\n const cLabel = childEntity.info.getLabel()\n this.report.impact.push({\n key: childEntity.key,\n kind: childEntity.kind,\n type: 'delete',\n impact: `The \"${cLabel}\" ${this.kindToLabel(DomainEntityKind)} will become an orphan because it is a child of the \"${pLabel}\" entity.`,\n resolution: `The \"${pLabel}\" entity will be removed as the parent of the \"${cLabel}\" entity.`,\n blocking: false,\n relationship: 'child',\n severity: 'error',\n })\n this.report.canProceed = false\n }\n // We need to know whether there's another entity that has an association to this entity.\n for (const edgeInfo of this.root.graph.inEdges(entity.key)) {\n const edge = this.root.graph.edge(edgeInfo)\n if (!edge || edge.type !== 'association') {\n continue\n }\n const association = this.root.findAssociation(edgeInfo.v)\n if (!association) {\n continue\n }\n const targetEntity = association.getParentInstance()\n if (!targetEntity) {\n continue\n }\n if (targetEntity.isChildOf(rootKey)) {\n // No need to include this association as the target entity itself is being deleted\n continue\n }\n\n const aLabel = association.info.getLabel()\n const eLabel = entity.info.getLabel()\n this.report.impact.push({\n key: association.key,\n kind: association.kind,\n type: 'delete',\n impact: `The ${aLabel} ${this.kindToLabel(DomainAssociationKind)} will be broken because it has a target to ${eLabel}.`,\n resolution: `The ${aLabel} ${this.kindToLabel(DomainAssociationKind)} will be removed from ${eLabel}.`,\n blocking: true,\n severity: 'error',\n })\n this.report.canProceed = false\n }\n for (const child of entity.listProperties()) {\n this.deletePropertyAnalysis(child.key)\n }\n for (const child of entity.listAssociations()) {\n this.deleteAssociationAnalysis(child.key)\n }\n }\n\n protected deletePropertyAnalysis(key: string): void {\n const property = this.root.findProperty(key)\n if (!property) {\n return\n }\n this.report.impact.push({\n key: property.key,\n kind: property.kind,\n type: 'delete',\n impact: `The ${property.info.getLabel()} ${this.kindToLabel(DomainPropertyKind)} will be deleted.`,\n blocking: false,\n severity: 'info',\n })\n }\n\n protected deleteAssociationAnalysis(key: string): void {\n const association = this.root.findAssociation(key)\n if (!association) {\n return\n }\n this.report.impact.push({\n key: association.key,\n kind: association.kind,\n type: 'delete',\n impact: `The ${association.info.getLabel()} ${this.kindToLabel(DomainAssociationKind)} will be deleted.`,\n blocking: false,\n severity: 'info',\n })\n }\n\n protected kindToLabel(kind: DomainImpactKinds): string {\n switch (kind) {\n case DomainNamespaceKind:\n return 'namespace'\n case DomainEntityKind:\n return 'entity'\n case DomainModelKind:\n return 'data model'\n case DomainPropertyKind:\n return 'property'\n case DomainAssociationKind:\n return 'association'\n default:\n return 'unknown'\n }\n }\n\n protected createRemoveForeignNamespaceImpact(key: string): void {\n const foreignNamespace = this.root.dependencies.get(key)\n if (!foreignNamespace) {\n return\n }\n // Check for parent relationships to foreign entities\n for (const entity of this.root.listEntities()) {\n for (const info of this.root.graph.outEdges(entity.key)) {\n const edge = this.root.graph.edge(info)\n if (!edge) {\n continue\n }\n if (edge.type === 'parent' && edge.domain === key) {\n // the parent is in the foreign namespace\n const parentEntity = this.root.findEntity(info.w)\n if (!parentEntity) {\n continue\n }\n const eLabel = entity.info.getLabel()\n const pLabel = parentEntity.info.getLabel()\n this.report.impact.push({\n key: entity.key,\n kind: entity.kind,\n type: 'delete',\n impact: `The \"${eLabel}\" ${this.kindToLabel(DomainEntityKind)} will become an orphan because its parent \"${pLabel}\" is in the foreign namespace \"${foreignNamespace.key}\".`,\n resolution: `The \"${pLabel}\" entity will be removed as the parent of the \"${eLabel}\" entity.`,\n blocking: true,\n relationship: 'child',\n severity: 'error',\n })\n this.report.canProceed = false\n } else if (edge.type === 'association') {\n const association = this.root.findAssociation(info.w)\n if (!association) {\n continue\n }\n const targets = association.targets.filter((t) => t.domain === key)\n if (targets.length) {\n for (const info of targets) {\n const targetEntity = this.root.findForeignEntity(info.key, info.domain as string)\n if (!targetEntity) {\n continue\n }\n const aLabel = association.info.getLabel()\n const eLabel = entity.info.getLabel()\n const tLabel = targetEntity.info.getLabel()\n this.report.impact.push({\n key: association.key,\n kind: association.kind,\n type: 'delete',\n impact: `The \"${aLabel}\" ${this.kindToLabel(DomainAssociationKind)} from \"${eLabel}\" will be broken because it targets \"${tLabel}\" in the foreign namespace \"${foreignNamespace.key}\".`,\n resolution: `The \"${aLabel}\" ${this.kindToLabel(DomainAssociationKind)} will be removed from \"${eLabel}\".`,\n blocking: true,\n severity: 'error',\n })\n this.report.canProceed = false\n }\n }\n }\n }\n }\n }\n}\n"]}
@@ -53,10 +53,10 @@ export interface DomainModelSchema extends DomainElementSchema {
53
53
  *
54
54
  * ```typescript
55
55
  * const dataDomain = new DataDomain();
56
- * const dataNamespace = dataDomain.addNamespace({
56
+ * const ns = dataDomain.addNamespace({
57
57
  * key: 'myNamespace',
58
58
  * });
59
- * const userModel = dataNamespace.addModel({
59
+ * const userModel = ns.addModel({
60
60
  * key: 'userModel',
61
61
  * info: { name: 'User Model' },
62
62
  * });
@@ -32,10 +32,10 @@ import { DetachException } from '../exceptions/detach_exception.js';
32
32
  *
33
33
  * ```typescript
34
34
  * const dataDomain = new DataDomain();
35
- * const dataNamespace = dataDomain.addNamespace({
35
+ * const ns = dataDomain.addNamespace({
36
36
  * key: 'myNamespace',
37
37
  * });
38
- * const userModel = dataNamespace.addModel({
38
+ * const userModel = ns.addModel({
39
39
  * key: 'userModel',
40
40
  * info: { name: 'User Model' },
41
41
  * });