@api-client/core 0.11.8 → 0.11.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/browser.d.ts +1 -1
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js +1 -1
- package/build/src/browser.js.map +1 -1
- package/build/src/index.d.ts +1 -1
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +1 -1
- package/build/src/index.js.map +1 -1
- package/build/src/modeling/DataEntity.d.ts +1 -1
- package/build/src/modeling/DataEntity.js +1 -1
- package/build/src/modeling/DataEntity.js.map +1 -1
- package/build/src/modeling/DataNamespace.d.ts +10 -2
- package/build/src/modeling/DataNamespace.d.ts.map +1 -1
- package/build/src/modeling/DataNamespace.js +34 -6
- package/build/src/modeling/DataNamespace.js.map +1 -1
- package/build/src/modeling/{ImpactAnalysis.d.ts → DomainImpactAnalysis.d.ts} +29 -30
- package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -0
- package/build/src/modeling/{ImpactAnalysis.js → DomainImpactAnalysis.js} +20 -18
- package/build/src/modeling/DomainImpactAnalysis.js.map +1 -0
- package/build/src/modeling/types.d.ts +1 -1
- package/build/src/modeling/types.js.map +1 -1
- package/data/models/example-generator-api.json +15 -15
- package/package.json +1 -1
- package/src/modeling/DataEntity.ts +1 -1
- package/src/modeling/DataNamespace.ts +41 -6
- package/src/modeling/{ImpactAnalysis.ts → DomainImpactAnalysis.ts} +38 -36
- package/src/modeling/types.ts +1 -1
- package/tests/unit/modeling/impact_analysis.spec.ts +16 -16
- package/build/src/modeling/ImpactAnalysis.d.ts.map +0 -1
- package/build/src/modeling/ImpactAnalysis.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataNamespace.js","sourceRoot":"","sources":["../../../src/modeling/DataNamespace.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAU,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO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E,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,CAAC,CAAA;QACzD,IAAI,MAAM,EAAE,CAAC;YACX,OAAM;QACR,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACvB,CAAC;IAED,aAAa,CAAC,EAAiB;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;QACrD,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;QAC/B,CAAC;IACH,CAAC;IAED,mBAAmB,CAAC,GAAW;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAA;IAChD,CAAC;IAED;;;;;;OAMG;IACH,SAAS,CAAC,GAAW;QACnB,IAAI,IAAI,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;YACrB,OAAO,KAAK,CAAA;QACd,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;QACvC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,KAAK,CAAA;QACd,CAAC;QACD,IAAI,MAAM,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;YACvB,OAAO,IAAI,CAAA;QACb,CAAC;QACD,OAAO,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IAC9B,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-this-alias */\nimport { IThing, Thing } from '../models/Thing.js'\nimport { IDataAssociation, DataAssociation, AssociationTarget } from './DataAssociation.js'\nimport { IDataEntity, DataEntity } from './DataEntity.js'\nimport { IDataModel, DataModel } from './DataModel.js'\nimport { IDataProperty, DataProperty } from './DataProperty.js'\nimport { DataNamespaceKind, DataModelKind } from '../models/kinds.js'\nimport v4 from '../lib/uuid.js'\nimport type { DataDomainRemoveOptions } from './types.js'\n\ntype ItemKind = typeof DataNamespaceKind | typeof DataModelKind\n\nexport interface DataItemAdaptingOptions {\n /**\n * The index at which to adapt the item.\n */\n index?: number\n}\n\ninterface IDataDefinitions {\n models?: IDataModel[]\n entities?: IDataEntity[]\n properties?: IDataProperty[]\n associations?: IDataAssociation[]\n namespaces?: IDataNamespace[]\n tags?: string[]\n /**\n * The list of foreign namespaces associated with this namespace.\n */\n foreign?: ForeignNamespace[]\n}\n\ninterface DataDefinitions {\n models: DataModel[]\n // @todo: This should be a map of entities with a key of the entity key.\n entities: DataEntity[]\n // @todo: This should be a map of properties with a key of the property key.\n properties: DataProperty[]\n // @todo: This should be a map of associations with a key of the association key.\n associations: DataAssociation[]\n namespaces: DataNamespace[]\n /**\n * Common for the entire root namespace tags.\n * These are kept separately so the UI can generate autocomplete for tags.\n */\n tags: string[]\n /**\n * The list of foreign namespaces associated with this namespace.\n */\n foreign?: ForeignNamespace[]\n}\n\n/**\n * Data definition for a foreign namespace.\n * Each foreign namespace is resolved to a specific version.\n * This makes sure that the local data are always referencing an existing\n * entity as breaking changes should be resolved when upgrading a version.\n */\ninterface ForeignNamespace {\n key: string\n version: string\n}\n\n/**\n * Data namespace is a logical description of the hierarchy in the data.\n */\nexport interface IDataNamespace {\n kind: typeof DataNamespaceKind\n /**\n * The key of the namespace.\n */\n key: string\n /**\n * The ordered list of items in this namespace.\n */\n items: IDataItem[]\n /**\n * The data namespace description.\n */\n info: IThing\n /**\n * The list of definitions used in the namespace.\n */\n definitions: IDataDefinitions\n}\n\n/**\n * Data item is a reference to an object in the top namespace definitions\n * to the namespace items.\n */\nexport interface IDataItem {\n /**\n * The kind of the item.\n */\n kind: ItemKind\n /**\n * The identifier in the `definitions` array of the namespace.\n */\n key: string\n}\n\nexport class DataItem implements IDataItem {\n kind: ItemKind = DataModelKind\n\n key = ''\n\n /**\n * A reference to the top level namespace.\n */\n private root: DataNamespace\n\n static isDataItem(input: unknown): boolean {\n const typed = input as IDataItem\n if (!input || ![DataModelKind, DataNamespaceKind].includes(typed.kind)) {\n return false\n }\n return true\n }\n\n static dataNamespace(root: DataNamespace, key: string): DataItem {\n const item = new DataItem(root, {\n kind: DataNamespaceKind,\n key,\n })\n return item\n }\n\n static dataModel(root: DataNamespace, key: string): DataItem {\n const item = new DataItem(root, {\n kind: DataModelKind,\n key,\n })\n return item\n }\n\n /**\n * @param root The top-most data namespace.\n * @param input The project item definition used to restore the state.\n */\n constructor(root: DataNamespace, input: string | IDataItem) {\n this.root = root\n let init: IDataItem\n if (typeof input === 'string') {\n init = JSON.parse(input)\n } else if (typeof input === 'object') {\n init = input\n } else {\n throw new Error('Specify the type of the item.')\n }\n this.new(init)\n }\n\n new(init: IDataItem): void {\n if (!DataItem.isDataItem(init)) {\n throw new Error(`Not a data item.`)\n }\n const { kind, key } = init\n this.kind = kind\n this.key = key\n }\n\n toJSON(): IDataItem {\n const result: IDataItem = {\n kind: this.kind,\n key: this.key,\n }\n return result\n }\n\n getItem(): DataNamespace | DataModel | undefined {\n const { root, key, kind } = this\n const { definitions } = root\n if (kind === DataModelKind) {\n return definitions.models.find((i) => i.key === key)\n }\n if (kind === kind) {\n return definitions.namespaces.find((i) => i.key === key)\n }\n }\n}\n\n/**\n * Data namespace is a logical description of the hierarchy in the data.\n */\nexport class DataNamespace {\n kind = DataNamespaceKind\n\n key = ''\n\n /**\n * The ordered list of items in this namespace.\n */\n items: DataItem[] = []\n\n /**\n * The description of the data namespace.\n */\n info: Thing = Thing.fromName('')\n\n /**\n * When a namespace is a sub-namespace this is the reference to the\n * root namespace with all definitions.\n */\n root?: DataNamespace\n /**\n * The list of definitions used in the namespace.\n */\n definitions: DataDefinitions\n\n /**\n * The list of foreign namespaces.\n * This is used to find entities from foreign namespaces.\n * Values here are treated as read only (objects can be frozen).\n *\n * This should be set by the application and the namespace will do\n * nothing to populate this value.\n */\n foreign: DataNamespace[] = []\n\n /**\n * Creates a new data namespace from a name.\n * @param name The name to set.\n */\n static fromName(name: string, root?: DataNamespace): DataNamespace {\n const ns = new DataNamespace(undefined, root)\n const info = Thing.fromName(name)\n ns.info = info\n return ns\n }\n\n /**\n * @deprecated\n */\n static definitions(): DataDefinitions {\n return {\n models: [],\n associations: [],\n entities: [],\n properties: [],\n namespaces: [],\n tags: [],\n }\n }\n\n constructor(input?: string | IDataNamespace, root?: DataNamespace) {\n this.root = root\n this.definitions = {\n models: [],\n associations: [],\n entities: [],\n properties: [],\n namespaces: [],\n tags: [],\n }\n\n let init: IDataNamespace\n if (typeof input === 'string') {\n init = JSON.parse(input)\n } else if (typeof input === 'object') {\n init = input\n if (!init.kind) {\n init.kind = DataNamespaceKind\n }\n } else {\n init = {\n kind: DataNamespaceKind,\n key: v4(),\n definitions: {},\n items: [],\n info: Thing.fromName('').toJSON(),\n }\n }\n this.new(init)\n }\n\n new(init: IDataNamespace): void {\n if (!init || !init.definitions || !init.items) {\n throw new Error(`Not a data namespace.`)\n }\n const { key = v4(), definitions = {}, items, info } = init\n this.key = key\n if (info) {\n this.info = new Thing(info)\n } else {\n this.info = Thing.fromName('')\n }\n if (Array.isArray(items)) {\n this.items = items.map((i) => new DataItem(this, i))\n } else {\n this.items = []\n }\n if (Array.isArray(definitions.associations)) {\n this.definitions.associations = definitions.associations.map((i) => new DataAssociation(this, i))\n } else {\n this.definitions.associations = []\n }\n if (Array.isArray(definitions.properties)) {\n this.definitions.properties = definitions.properties.map((i) => new DataProperty(this, i))\n } else {\n this.definitions.properties = []\n }\n // note, entities must be restored after properties / associations\n if (Array.isArray(definitions.entities)) {\n this.definitions.entities = definitions.entities.map((i) => new DataEntity(this, i))\n } else {\n this.definitions.entities = []\n }\n // must be set after entities.\n if (Array.isArray(definitions.models)) {\n this.definitions.models = definitions.models.map((i) => new DataModel(this, i))\n } else {\n this.definitions.models = []\n }\n if (Array.isArray(definitions.namespaces)) {\n this.definitions.namespaces = definitions.namespaces.map((i) => new DataNamespace(i, this))\n } else {\n this.definitions.namespaces = []\n }\n if (Array.isArray(definitions.tags)) {\n this.definitions.tags = [...definitions.tags]\n } else {\n this.definitions.tags = []\n }\n }\n\n toJSON(): IDataNamespace {\n const result: IDataNamespace = {\n key: this.key,\n kind: DataNamespaceKind,\n info: this.info.toJSON(),\n items: this.items.map((i) => i.toJSON()),\n definitions: {},\n }\n const { associations, entities, models, namespaces, properties, tags } = this.definitions\n if (Array.isArray(associations) && associations.length) {\n result.definitions.associations = associations.map((i) => i.toJSON())\n }\n if (Array.isArray(entities) && entities.length) {\n result.definitions.entities = entities.map((i) => i.toJSON())\n }\n if (Array.isArray(models) && models.length) {\n result.definitions.models = models.map((i) => i.toJSON())\n }\n if (Array.isArray(namespaces) && namespaces.length) {\n result.definitions.namespaces = namespaces.map((i) => i.toJSON())\n }\n if (Array.isArray(properties) && properties.length) {\n result.definitions.properties = properties.map((i) => i.toJSON())\n }\n if (Array.isArray(tags) && tags.length) {\n result.definitions.tags = [...tags]\n }\n return result\n }\n\n /**\n * @deprecated Use the `getParentInstance()` method instead.\n */\n getParent(): DataNamespace | undefined {\n return this.getParentInstance()\n }\n\n /**\n * @returns The parent namespace of this namespace. It returns `undefined` when this is the root namespace.\n */\n getParentInstance(): DataNamespace | undefined {\n const { root, key } = this\n if (root) {\n return root.findParent(key)\n }\n // we are the root namespace.\n return undefined\n }\n\n /**\n * Lists namespaces that are in this namespace items.\n */\n listNamespaces(): DataNamespace[] {\n const result: DataNamespace[] = []\n const { items } = this\n const root = this.getRoot()\n const { namespaces } = root.definitions\n items.forEach((i) => {\n if (i.kind !== DataNamespaceKind) {\n return\n }\n const def = namespaces.find((j) => j.key === i.key)\n if (def) {\n result.push(def)\n }\n })\n return result\n }\n\n /**\n * Lists namespaces that are in this namespace items.\n */\n listDataModels(): DataModel[] {\n const result: DataModel[] = []\n const { items } = this\n const root = this.getRoot()\n const { models } = root.definitions\n items.forEach((i) => {\n if (i.kind !== DataModelKind) {\n return\n }\n const def = models.find((j) => j.key === i.key)\n if (def) {\n result.push(def)\n }\n })\n return result\n }\n\n /**\n * @returns The root of the namespaces tree. It might be the same object.\n */\n getRoot(): DataNamespace {\n if (this.root) {\n return this.root\n }\n return this as unknown as DataNamespace\n }\n\n /**\n * Removes self from the parent namespace with all data models.\n * This does noting for the root namespace.\n */\n remove(opts?: DataDomainRemoveOptions): void {\n const { root } = this\n if (!root) {\n throw new Error(`Unable to remove the root namespace this way.`)\n }\n const models = this.listDataModels()\n const children = this.listNamespaces()\n models.forEach((m) => m.remove(opts))\n children.forEach((c) => c.remove(opts))\n const index = root.definitions.namespaces.findIndex((i) => i.key === this.key)\n if (index >= 0) {\n root.definitions.namespaces.splice(index, 1)\n }\n }\n\n /**\n * Checks if this is the root namespace.\n * @returns True if this is the root namespace.\n */\n isRoot(): boolean {\n return this.root === undefined\n }\n\n /**\n * Finds a parent namespace for the given namespace.\n * @param key The namespace key to find the parent for.\n * @returns The parent namespace or undefined when the namespace does not exist. It may return the root namespace.\n */\n findParent(key: string): DataNamespace | undefined {\n const { definitions, items = [] } = this\n const rootIndex = items.findIndex((i) => i.key === key)\n if (rootIndex >= 0) {\n return this\n }\n const definition = definitions.namespaces.find((i) => i.items.some((item) => item.key === key))\n if (definition) {\n return definition\n }\n return undefined\n }\n\n /**\n * Adds a data namespace to the structure.\n * @param init The name of the namespace to add, namespace's schema, or instance.\n * @param parent The optional key of the parent namespace to add the new namespace to.\n */\n addNamespace(init: string | IDataNamespace | DataNamespace, parent?: string): DataNamespace {\n let root: DataNamespace\n if (parent) {\n const rootCandidate = this.findParent(parent)\n if (!rootCandidate) {\n throw new Error(`Unable to find the parent namespace ${parent}`)\n }\n root = rootCandidate\n } else {\n root = this\n }\n let definition: DataNamespace\n if (typeof init === 'string') {\n definition = DataNamespace.fromName(init, this.root || this)\n } else if (init instanceof DataNamespace) {\n definition = init\n } else {\n definition = new DataNamespace(init, this.root || this)\n }\n ;(this.root || this).definitions.namespaces.push(definition)\n const item = DataItem.dataNamespace(this.root || this, definition.key)\n if (!Array.isArray(root.items)) {\n root.items = []\n }\n root.items.push(item)\n return definition\n }\n\n /**\n * Adapts an existing namespace to this namespace.\n * This will remove the namespace from the parent namespace and add it to this one.\n *\n * @param ns The namespace to adapt.\n * @param opts Adapting options.\n */\n adaptNamespace(ns: DataNamespace, opts: DataItemAdaptingOptions = {}): void {\n if (opts.index !== undefined) {\n if (opts.index < 0) {\n throw new Error(`The index ${opts.index} cannot be below 0.`)\n }\n if (opts.index >= this.items.length) {\n throw new Error(`The index ${opts.index} is not valid.`)\n }\n }\n if (ns === this) {\n throw new Error(`Unable to adapt a namespace that is self.`)\n }\n if (ns.root !== this.root) {\n throw new Error(`The namespace ${ns.key} is not in the same namespace as this data namespace.`)\n }\n if (ns.getParentInstance() === this) {\n throw new Error(`The namespace ${ns.key} is already adapted by this data namespace.`)\n }\n // Check for circular dependency\n let current: DataNamespace | undefined = this\n while (current) {\n if (current === ns) {\n throw new Error(`Unable to adapt namespace ${ns.key} under itself or one of its children.`)\n }\n current = current.getParentInstance()\n }\n const parent = ns.getParentInstance() || this.root\n if (!parent) {\n throw new Error(`The namespace ${ns.key} has no parent.`)\n }\n // it has a parent (above check) so it has the index.\n const index = parent.items.findIndex((i) => i.key === ns.key)\n const [item] = parent.items.splice(index, 1)\n if (opts.index !== undefined) {\n this.items.splice(opts.index, 0, item)\n } else {\n this.items.push(item)\n }\n }\n\n /**\n * Adapts an existing data model to this namespace.\n * This will remove the data model from the parent namespace and add it to this one.\n * @param model The data model to adapt.\n * @param opts The adapting options.\n */\n adaptDataModel(model: DataModel, opts: DataItemAdaptingOptions = {}): void {\n if (opts.index !== undefined) {\n if (opts.index < 0) {\n throw new Error(`The index ${opts.index} cannot be below 0.`)\n }\n if (opts.index >= this.items.length) {\n throw new Error(`The index ${opts.index} is not valid.`)\n }\n }\n if (model.root !== this.root) {\n throw new Error(`The data model ${model.key} is not in the same namespace as this data namespace.`)\n }\n const parent = model.getParentInstance()\n if (!parent) {\n throw new Error(`The data model ${model.key} has no parent.`)\n }\n if (parent === this) {\n throw new Error(`The data model ${model.key} is already adapted by this data namespace.`)\n }\n // it has a parent (above check) so it has the index.\n const index = parent.items.findIndex((i) => i.key === model.key)\n const [item] = parent.items.splice(index, 1)\n if (opts.index !== undefined) {\n this.items.splice(opts.index, 0, item)\n } else {\n this.items.push(item)\n }\n }\n\n /**\n * Finds a namespace in the definitions.\n * @param key The key of the namespace to find.\n * @returns The namespace definition or undefined when not found.\n */\n findNamespace(key: string): DataNamespace | undefined {\n const { definitions } = this.root || this\n return definitions.namespaces.find((i) => i.key === key)\n }\n\n /**\n * Finds a namespace and calls the `remove()` on it.\n * @param key The key of the namespace to find.\n */\n removeNamespace(key: string): void {\n const root = this.root || this\n if (root.key === key) {\n throw new Error(`Unable to remove the root namespace this way.`)\n }\n const { definitions } = root\n const ns = definitions.namespaces.find((i) => i.key === key)\n if (ns) {\n ns.remove()\n }\n }\n\n /**\n * Adds a data model to a namespace.\n * @param init The name of the data model to add, data model's schema, or its instance.\n * @param parent The optional key of the parent namespace to add the new data model to.\n */\n addDataModel(init: string | IDataModel | DataModel, parent?: string): DataModel {\n let root: DataNamespace\n if (parent) {\n const rootCandidate = this.findNamespace(parent)\n if (!rootCandidate) {\n throw new Error(`Unable to find the parent namespace ${parent}`)\n }\n root = rootCandidate\n } else {\n root = this\n }\n let definition: DataModel\n if (typeof init === 'string') {\n definition = DataModel.fromName(this.root || this, init)\n } else if (init instanceof DataModel) {\n definition = init\n } else {\n definition = new DataModel(this.root || this, init)\n }\n ;(this.root || this).definitions.models.push(definition)\n const item = DataItem.dataModel(this.root || this, definition.key)\n if (!Array.isArray(root.items)) {\n root.items = []\n }\n root.items.push(item)\n return definition\n }\n\n /**\n * Finds a data model in the definitions.\n * @param key The key of the data model to find.\n * @returns The data model definition or undefined when not found.\n */\n findDataModel(key: string): DataModel | undefined {\n const { definitions } = this.root || this\n return definitions.models.find((i) => i.key === key)\n }\n\n /**\n * Finds a data model and calls the `remove()` on it.\n * @param key The key of the data model to find.\n */\n removeDataModel(key: string): void {\n const { definitions } = this.root || this\n const model = definitions.models.find((i) => i.key === key)\n if (model) {\n model.remove()\n }\n }\n\n /**\n * @returns The graph of associations where keys are the source\n * entities and the value is the list of all target entities.\n */\n associationGraph(): Record<string, string[]> {\n const graph: Record<string, string[]> = {}\n const { definitions } = this.root || this\n const { associations, entities } = definitions\n for (const assoc of associations) {\n if (!assoc.targets.length) {\n continue\n }\n const srcEntity = entities.find((i) => i.associations.some((a) => a === assoc))\n if (!srcEntity) {\n continue\n }\n if (!graph[srcEntity.key]) {\n graph[srcEntity.key] = []\n }\n const targetIds = assoc.targets.map((i) => i.key)\n graph[srcEntity.key].splice(0, 0, ...targetIds)\n }\n return graph\n }\n\n /**\n * Prints out all associations from one entity to another through all entities that may be in between.\n *\n * @param from The key of the from entity\n * @param to The key of the target entity\n * @param g The graph generated with `associationGraph()`\n * @param path The current list of entity ids. Do not set this, it is for the recursive processing of the graph.\n * @param visited The list of visited paths to avoid cycles.\n * Do not set this, it is for the recursive processing of the graph.\n */\n *associationPath(\n from: string,\n to: string,\n g: Record<string, string[]>,\n path: string[] = [],\n visited = new Set<string>()\n ): Generator<string[]> {\n if (from === to) {\n yield path.concat(to)\n return\n }\n if (visited.has(from)) {\n // it's a cycle\n return\n }\n if (g[from]) {\n visited.add(from)\n path.push(from)\n\n for (const neighbor of g[from]) {\n yield* this.associationPath(neighbor, to, g, path, visited)\n }\n\n visited.delete(from)\n path.pop()\n }\n }\n\n /**\n * Scans all associations for foreign namespaces and returns\n * the list of all namespaces used in the association graph.\n * This will never add this namespace's key.\n *\n * This function should be used to read keys for all related\n * namespaces through associations.\n *\n * @returns All keys of foreign namespaces.\n */\n computeForeignNamespaceKeys(): string[] {\n const result: string[] = []\n const { associations = [] } = this.definitions\n associations.forEach((association) => {\n const { targets = [] } = association\n targets.forEach((target) => {\n const { namespace } = target\n if (!namespace || namespace === this.key) {\n return\n }\n result.push(namespace)\n })\n })\n return result\n }\n\n /**\n * Finds an entity in this namespace.\n * @param key The key of the entity to find.\n */\n findEntity(key: string): DataEntity | undefined {\n const { definitions } = this.root || this\n return definitions.entities.find((i) => i.key === key)\n }\n\n /**\n * Finds a property by its key.\n * @param key The key of the property to find\n * @returns The property or undefined if not found.\n */\n findProperty(key: string): DataProperty | undefined {\n const { definitions } = this.root || this\n return definitions.properties.find((i) => i.key === key)\n }\n\n /**\n * Finds an association by its key.\n * @param key The key of the property to find\n * @returns The property or undefined if not found.\n */\n findAssociation(key: string): DataAssociation | undefined {\n const { definitions } = this.root || this\n return definitions.associations.find((i) => i.key === key)\n }\n\n /**\n * Searches for entities for association targets.\n * This is a helper function to discover entities in the current and foreign namespaces.\n *\n * @param targets The list of targets\n * @returns A list of entities. An `undefined` is put at the index where an entity cannot be found\n */\n findAssociatedEntities(targets: AssociationTarget[]): (DataEntity | undefined)[] {\n const result: (DataEntity | undefined)[] = []\n targets.forEach((target) => {\n let ns: DataNamespace | undefined\n if (target.namespace) {\n ns = this.foreign.find((i) => i.key === target.namespace)\n } else {\n ns = this\n }\n if (!ns) {\n result.push(undefined)\n return\n }\n const entity = ns.findEntity(target.key)\n if (entity) {\n result.push(entity)\n } else {\n result.push(undefined)\n }\n })\n return result\n }\n\n /**\n * Finds an associated entity in the current or foreign namespace.\n * This is a helper function to discover entities in the current and foreign namespaces.\n *\n * @param key The key of the entity to find.\n * @param namespace The optional namespace to search in.\n * If not set, the current namespace is used.\n * This is used to find entities in foreign namespaces.\n * @returns The entity or undefined if not found.\n */\n findAssociatedEntity(key: string, namespace?: string): DataEntity | undefined {\n let ns: DataNamespace | undefined\n if (namespace) {\n ns = this.foreign.find((i) => i.key === namespace)\n } else {\n ns = this\n }\n if (!ns) {\n return undefined\n }\n return ns.findEntity(key)\n }\n\n addForeign(ns: DataNamespace): void {\n const exists = this.foreign.some((i) => i.key === ns.key)\n if (exists) {\n return\n }\n this.foreign.push(ns)\n }\n\n removeForeign(ns: DataNamespace): void {\n const index = this.foreign.findIndex((i) => i === ns)\n if (index >= 0) {\n this.foreign.splice(index, 1)\n }\n }\n\n hasForeignNamespace(key: string): boolean {\n return this.foreign.some((i) => i.key === key)\n }\n\n /**\n * Checks whether the namespace is a child of the given namespace.\n * The relationship doesn't have to be direct, as long as the namespace is in the hierarchy it will return true.\n *\n * @param key The key of the parent namespace to check.\n * @returns True if this namespace is a child of the given namespace.\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"]}
|
|
1
|
+
{"version":3,"file":"DataNamespace.js","sourceRoot":"","sources":["../../../src/modeling/DataNamespace.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAU,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAoB,eAAe,EAAqB,MAAM,sBAAsB,CAAA;AAC3F,OAAO,EAAe,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAc,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,EAAiB,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,MAAM,gBAAgB,CAAA;AA8F/B,MAAM,OAAO,QAAQ;IACnB,IAAI,GAAa,aAAa,CAAA;IAE9B,GAAG,GAAG,EAAE,CAAA;IAER;;OAEG;IACK,IAAI,CAAe;IAE3B,MAAM,CAAC,UAAU,CAAC,KAAc;QAC9B,MAAM,KAAK,GAAG,KAAkB,CAAA;QAChC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IA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ent":["/* eslint-disable @typescript-eslint/no-this-alias */\nimport { IThing, Thing } from '../models/Thing.js'\nimport { IDataAssociation, DataAssociation, AssociationTarget } from './DataAssociation.js'\nimport { IDataEntity, DataEntity } from './DataEntity.js'\nimport { IDataModel, DataModel } from './DataModel.js'\nimport { IDataProperty, DataProperty } from './DataProperty.js'\nimport {\n DataNamespaceKind,\n DataModelKind,\n DataEntityKind,\n DataPropertyKind,\n DataAssociationKind,\n} from '../models/kinds.js'\nimport v4 from '../lib/uuid.js'\nimport type { DataDomainRemoveOptions } from './types.js'\n\ntype ItemKind = typeof DataNamespaceKind | typeof DataModelKind\n\nexport interface DataItemAdaptingOptions {\n /**\n * The index at which to adapt the item.\n */\n index?: number\n}\n\ninterface IDataDefinitions {\n models?: IDataModel[]\n entities?: IDataEntity[]\n properties?: IDataProperty[]\n associations?: IDataAssociation[]\n namespaces?: IDataNamespace[]\n tags?: string[]\n /**\n * The list of foreign namespaces associated with this namespace.\n */\n foreign?: ForeignNamespace[]\n}\n\ninterface DataDefinitions {\n models: DataModel[]\n // @todo: This should be a map of entities with a key of the entity key.\n entities: DataEntity[]\n // @todo: This should be a map of properties with a key of the property key.\n properties: DataProperty[]\n // @todo: This should be a map of associations with a key of the association key.\n associations: DataAssociation[]\n namespaces: DataNamespace[]\n /**\n * Common for the entire root namespace tags.\n * These are kept separately so the UI can generate autocomplete for tags.\n */\n tags: string[]\n /**\n * The list of foreign namespaces associated with this namespace.\n */\n foreign?: ForeignNamespace[]\n}\n\n/**\n * Data definition for a foreign namespace.\n * Each foreign namespace is resolved to a specific version.\n * This makes sure that the local data are always referencing an existing\n * entity as breaking changes should be resolved when upgrading a version.\n */\ninterface ForeignNamespace {\n key: string\n version: string\n}\n\n/**\n * Data namespace is a logical description of the hierarchy in the data.\n */\nexport interface IDataNamespace {\n kind: typeof DataNamespaceKind\n /**\n * The key of the namespace.\n */\n key: string\n /**\n * The ordered list of items in this namespace.\n */\n items: IDataItem[]\n /**\n * The data namespace description.\n */\n info: IThing\n /**\n * The list of definitions used in the namespace.\n */\n definitions: IDataDefinitions\n}\n\n/**\n * Data item is a reference to an object in the top namespace definitions\n * to the namespace items.\n */\nexport interface IDataItem {\n /**\n * The kind of the item.\n */\n kind: ItemKind\n /**\n * The identifier in the `definitions` array of the namespace.\n */\n key: string\n}\n\nexport class DataItem implements IDataItem {\n kind: ItemKind = DataModelKind\n\n key = ''\n\n /**\n * A reference to the top level namespace.\n */\n private root: DataNamespace\n\n static isDataItem(input: unknown): boolean {\n const typed = input as IDataItem\n if (!input || ![DataModelKind, DataNamespaceKind].includes(typed.kind)) {\n return false\n }\n return true\n }\n\n static dataNamespace(root: DataNamespace, key: string): DataItem {\n const item = new DataItem(root, {\n kind: DataNamespaceKind,\n key,\n })\n return item\n }\n\n static dataModel(root: DataNamespace, key: string): DataItem {\n const item = new DataItem(root, {\n kind: DataModelKind,\n key,\n })\n return item\n }\n\n /**\n * @param root The top-most data namespace.\n * @param input The project item definition used to restore the state.\n */\n constructor(root: DataNamespace, input: string | IDataItem) {\n this.root = root\n let init: IDataItem\n if (typeof input === 'string') {\n init = JSON.parse(input)\n } else if (typeof input === 'object') {\n init = input\n } else {\n throw new Error('Specify the type of the item.')\n }\n this.new(init)\n }\n\n new(init: IDataItem): void {\n if (!DataItem.isDataItem(init)) {\n throw new Error(`Not a data item.`)\n }\n const { kind, key } = init\n this.kind = kind\n this.key = key\n }\n\n toJSON(): IDataItem {\n const result: IDataItem = {\n kind: this.kind,\n key: this.key,\n }\n return result\n }\n\n getItem(): DataNamespace | DataModel | undefined {\n const { root, key, kind } = this\n const { definitions } = root\n if (kind === DataModelKind) {\n return definitions.models.find((i) => i.key === key)\n }\n if (kind === kind) {\n return definitions.namespaces.find((i) => i.key === key)\n }\n }\n}\n\n/**\n * Data namespace is a logical description of the hierarchy in the data.\n */\nexport class DataNamespace {\n kind = DataNamespaceKind\n\n key = ''\n\n /**\n * The ordered list of items in this namespace.\n */\n items: DataItem[] = []\n\n /**\n * The description of the data namespace.\n */\n info: Thing = Thing.fromName('')\n\n /**\n * When a namespace is a sub-namespace this is the reference to the\n * root namespace with all definitions.\n */\n root?: DataNamespace\n /**\n * The list of definitions used in the namespace.\n */\n definitions: DataDefinitions\n\n /**\n * The list of foreign namespaces.\n * This is used to find entities from foreign namespaces.\n * Values here are treated as read only (objects can be frozen).\n *\n * This should be set by the application and the namespace will do\n * nothing to populate this value.\n */\n foreign: DataNamespace[] = []\n\n /**\n * Creates a new data namespace from a name.\n * @param name The name to set.\n */\n static fromName(name: string, root?: DataNamespace): DataNamespace {\n const ns = new DataNamespace(undefined, root)\n const info = Thing.fromName(name)\n ns.info = info\n return ns\n }\n\n /**\n * @deprecated\n */\n static definitions(): DataDefinitions {\n return {\n models: [],\n associations: [],\n entities: [],\n properties: [],\n namespaces: [],\n tags: [],\n }\n }\n\n constructor(input?: string | IDataNamespace, root?: DataNamespace) {\n this.root = root\n this.definitions = {\n models: [],\n associations: [],\n entities: [],\n properties: [],\n namespaces: [],\n tags: [],\n }\n\n let init: IDataNamespace\n if (typeof input === 'string') {\n init = JSON.parse(input)\n } else if (typeof input === 'object') {\n init = input\n if (!init.kind) {\n init.kind = DataNamespaceKind\n }\n } else {\n init = {\n kind: DataNamespaceKind,\n key: v4(),\n definitions: {},\n items: [],\n info: Thing.fromName('').toJSON(),\n }\n }\n this.new(init)\n }\n\n new(init: IDataNamespace): void {\n if (!init || !init.definitions || !init.items) {\n throw new Error(`Not a data namespace.`)\n }\n const { key = v4(), definitions = {}, items, info } = init\n this.key = key\n if (info) {\n this.info = new Thing(info)\n } else {\n this.info = Thing.fromName('')\n }\n if (Array.isArray(items)) {\n this.items = items.map((i) => new DataItem(this, i))\n } else {\n this.items = []\n }\n if (Array.isArray(definitions.associations)) {\n this.definitions.associations = definitions.associations.map((i) => new DataAssociation(this, i))\n } else {\n this.definitions.associations = []\n }\n if (Array.isArray(definitions.properties)) {\n this.definitions.properties = definitions.properties.map((i) => new DataProperty(this, i))\n } else {\n this.definitions.properties = []\n }\n // note, entities must be restored after properties / associations\n if (Array.isArray(definitions.entities)) {\n this.definitions.entities = definitions.entities.map((i) => new DataEntity(this, i))\n } else {\n this.definitions.entities = []\n }\n // must be set after entities.\n if (Array.isArray(definitions.models)) {\n this.definitions.models = definitions.models.map((i) => new DataModel(this, i))\n } else {\n this.definitions.models = []\n }\n if (Array.isArray(definitions.namespaces)) {\n this.definitions.namespaces = definitions.namespaces.map((i) => new DataNamespace(i, this))\n } else {\n this.definitions.namespaces = []\n }\n if (Array.isArray(definitions.tags)) {\n this.definitions.tags = [...definitions.tags]\n } else {\n this.definitions.tags = []\n }\n }\n\n toJSON(): IDataNamespace {\n const result: IDataNamespace = {\n key: this.key,\n kind: DataNamespaceKind,\n info: this.info.toJSON(),\n items: this.items.map((i) => i.toJSON()),\n definitions: {},\n }\n const { associations, entities, models, namespaces, properties, tags } = this.definitions\n if (Array.isArray(associations) && associations.length) {\n result.definitions.associations = associations.map((i) => i.toJSON())\n }\n if (Array.isArray(entities) && entities.length) {\n result.definitions.entities = entities.map((i) => i.toJSON())\n }\n if (Array.isArray(models) && models.length) {\n result.definitions.models = models.map((i) => i.toJSON())\n }\n if (Array.isArray(namespaces) && namespaces.length) {\n result.definitions.namespaces = namespaces.map((i) => i.toJSON())\n }\n if (Array.isArray(properties) && properties.length) {\n result.definitions.properties = properties.map((i) => i.toJSON())\n }\n if (Array.isArray(tags) && tags.length) {\n result.definitions.tags = [...tags]\n }\n return result\n }\n\n /**\n * @deprecated Use the `getParentInstance()` method instead.\n */\n getParent(): DataNamespace | undefined {\n return this.getParentInstance()\n }\n\n /**\n * @returns The parent namespace of this namespace. It returns `undefined` when this is the root namespace.\n */\n getParentInstance(): DataNamespace | undefined {\n const { root, key } = this\n if (root) {\n return root.findParent(key)\n }\n // we are the root namespace.\n return undefined\n }\n\n /**\n * Lists namespaces that are in this namespace items.\n */\n listNamespaces(): DataNamespace[] {\n const result: DataNamespace[] = []\n const { items } = this\n const root = this.getRoot()\n const { namespaces } = root.definitions\n items.forEach((i) => {\n if (i.kind !== DataNamespaceKind) {\n return\n }\n const def = namespaces.find((j) => j.key === i.key)\n if (def) {\n result.push(def)\n }\n })\n return result\n }\n\n /**\n * Lists namespaces that are in this namespace items.\n */\n listDataModels(): DataModel[] {\n const result: DataModel[] = []\n const { items } = this\n const root = this.getRoot()\n const { models } = root.definitions\n items.forEach((i) => {\n if (i.kind !== DataModelKind) {\n return\n }\n const def = models.find((j) => j.key === i.key)\n if (def) {\n result.push(def)\n }\n })\n return result\n }\n\n /**\n * @returns The root of the namespaces tree. It might be the same object.\n */\n getRoot(): DataNamespace {\n if (this.root) {\n return this.root\n }\n return this as unknown as DataNamespace\n }\n\n /**\n * Removes self from the parent namespace with all data models.\n * This does noting for the root namespace.\n */\n remove(opts?: DataDomainRemoveOptions): void {\n const { root } = this\n if (!root) {\n throw new Error(`Unable to remove the root namespace this way.`)\n }\n const models = this.listDataModels()\n const children = this.listNamespaces()\n models.forEach((m) => m.remove(opts))\n children.forEach((c) => c.remove(opts))\n const index = root.definitions.namespaces.findIndex((i) => i.key === this.key)\n if (index >= 0) {\n root.definitions.namespaces.splice(index, 1)\n }\n }\n\n /**\n * Checks if this is the root namespace.\n * @returns True if this is the root namespace.\n */\n isRoot(): boolean {\n return this.root === undefined\n }\n\n /**\n * Finds a parent namespace for the given namespace.\n * @param key The namespace key to find the parent for.\n * @returns The parent namespace or undefined when the namespace does not exist. It may return the root namespace.\n */\n findParent(key: string): DataNamespace | undefined {\n const { definitions, items = [] } = this\n const rootIndex = items.findIndex((i) => i.key === key)\n if (rootIndex >= 0) {\n return this\n }\n const definition = definitions.namespaces.find((i) => i.items.some((item) => item.key === key))\n if (definition) {\n return definition\n }\n return undefined\n }\n\n /**\n * Adds a data namespace to the structure.\n * @param init The name of the namespace to add, namespace's schema, or instance.\n * @param parent The optional key of the parent namespace to add the new namespace to.\n */\n addNamespace(init: string | IDataNamespace | DataNamespace, parent?: string): DataNamespace {\n let root: DataNamespace\n if (parent) {\n const rootCandidate = this.findNamespace(parent)\n if (!rootCandidate) {\n throw new Error(`Unable to find the parent namespace ${parent}`)\n }\n root = rootCandidate\n } else {\n root = this\n }\n let definition: DataNamespace\n if (typeof init === 'string') {\n definition = DataNamespace.fromName(init, this.root || this)\n } else if (init instanceof DataNamespace) {\n definition = init\n } else {\n definition = new DataNamespace(init, this.root || this)\n }\n ;(this.root || this).definitions.namespaces.push(definition)\n const item = DataItem.dataNamespace(this.root || this, definition.key)\n if (!Array.isArray(root.items)) {\n root.items = []\n }\n root.items.push(item)\n return definition\n }\n\n /**\n * Adapts an existing namespace to this namespace.\n * This will remove the namespace from the parent namespace and add it to this one.\n *\n * @param ns The namespace to adapt.\n * @param opts Adapting options.\n */\n adaptNamespace(ns: DataNamespace, opts: DataItemAdaptingOptions = {}): void {\n if (opts.index !== undefined) {\n if (opts.index < 0) {\n throw new Error(`The index ${opts.index} cannot be below 0.`)\n }\n if (opts.index >= this.items.length) {\n throw new Error(`The index ${opts.index} is not valid.`)\n }\n }\n if (ns === this) {\n throw new Error(`Unable to adapt a namespace that is self.`)\n }\n if (ns.root !== this.root) {\n throw new Error(`The namespace ${ns.key} is not in the same namespace as this data namespace.`)\n }\n if (ns.getParentInstance() === this) {\n throw new Error(`The namespace ${ns.key} is already adapted by this data namespace.`)\n }\n // Check for circular dependency\n let current: DataNamespace | undefined = this\n while (current) {\n if (current === ns) {\n throw new Error(`Unable to adapt namespace ${ns.key} under itself or one of its children.`)\n }\n current = current.getParentInstance()\n }\n const parent = ns.getParentInstance() || this.root\n if (!parent) {\n throw new Error(`The namespace ${ns.key} has no parent.`)\n }\n // it has a parent (above check) so it has the index.\n const index = parent.items.findIndex((i) => i.key === ns.key)\n const [item] = parent.items.splice(index, 1)\n if (opts.index !== undefined) {\n this.items.splice(opts.index, 0, item)\n } else {\n this.items.push(item)\n }\n }\n\n /**\n * Adapts an existing data model to this namespace.\n * This will remove the data model from the parent namespace and add it to this one.\n * @param model The data model to adapt.\n * @param opts The adapting options.\n */\n adaptDataModel(model: DataModel, opts: DataItemAdaptingOptions = {}): void {\n if (opts.index !== undefined) {\n if (opts.index < 0) {\n throw new Error(`The index ${opts.index} cannot be below 0.`)\n }\n if (opts.index >= this.items.length) {\n throw new Error(`The index ${opts.index} is not valid.`)\n }\n }\n if (model.root !== this.root) {\n throw new Error(`The data model ${model.key} is not in the same namespace as this data namespace.`)\n }\n const parent = model.getParentInstance()\n if (!parent) {\n throw new Error(`The data model ${model.key} has no parent.`)\n }\n if (parent === this) {\n throw new Error(`The data model ${model.key} is already adapted by this data namespace.`)\n }\n // it has a parent (above check) so it has the index.\n const index = parent.items.findIndex((i) => i.key === model.key)\n const [item] = parent.items.splice(index, 1)\n if (opts.index !== undefined) {\n this.items.splice(opts.index, 0, item)\n } else {\n this.items.push(item)\n }\n }\n\n /**\n * Finds a namespace in the definitions.\n * @param key The key of the namespace to find.\n * @returns The namespace definition or undefined when not found.\n */\n findNamespace(key: string): DataNamespace | undefined {\n const { definitions } = this.root || this\n return definitions.namespaces.find((i) => i.key === key)\n }\n\n /**\n * Finds a namespace and calls the `remove()` on it.\n * @param key The key of the namespace to find.\n */\n removeNamespace(key: string, opts?: DataDomainRemoveOptions): void {\n const root = this.root || this\n if (root.key === key) {\n throw new Error(`Unable to remove the root namespace this way.`)\n }\n const { definitions } = root\n const ns = definitions.namespaces.find((i) => i.key === key)\n if (ns) {\n ns.remove(opts)\n }\n }\n\n /**\n * Adds a data model to a namespace.\n * @param init The name of the data model to add, data model's schema, or its instance.\n * @param parent The optional key of the parent namespace to add the new data model to.\n */\n addDataModel(init: string | IDataModel | DataModel, parent?: string): DataModel {\n let root: DataNamespace\n if (parent) {\n const rootCandidate = this.findNamespace(parent)\n if (!rootCandidate) {\n throw new Error(`Unable to find the parent namespace ${parent}`)\n }\n root = rootCandidate\n } else {\n root = this\n }\n let definition: DataModel\n if (typeof init === 'string') {\n definition = DataModel.fromName(this.root || this, init)\n } else if (init instanceof DataModel) {\n definition = init\n } else {\n definition = new DataModel(this.root || this, init)\n }\n ;(this.root || this).definitions.models.push(definition)\n const item = DataItem.dataModel(this.root || this, definition.key)\n if (!Array.isArray(root.items)) {\n root.items = []\n }\n root.items.push(item)\n return definition\n }\n\n /**\n * Finds a data model in the definitions.\n * @param key The key of the data model to find.\n * @returns The data model definition or undefined when not found.\n */\n findDataModel(key: string): DataModel | undefined {\n const { definitions } = this.root || this\n return definitions.models.find((i) => i.key === key)\n }\n\n /**\n * A convenience function to remove an object from the namespace.\n * @param key The key of the object to remove.\n * @param kind The kind of the object to remove.\n * @param opts The options for the removal.\n * @throws Error when the kind is not known.\n */\n removeObject(key: string, kind: string, opts?: DataDomainRemoveOptions): void {\n switch (kind) {\n case DataNamespaceKind:\n this.findNamespace(key)?.remove(opts)\n break\n case DataModelKind:\n this.findDataModel(key)?.remove(opts)\n break\n case DataEntityKind:\n this.findEntity(key)?.remove(opts)\n break\n case DataPropertyKind:\n this.findProperty(key)?.remove()\n break\n case DataAssociationKind:\n this.findAssociation(key)?.remove()\n break\n default:\n throw new Error(`Unknown kind ${kind} for the object ${key}.`)\n }\n }\n\n /**\n * Finds a data model and calls the `remove()` on it.\n * @param key The key of the data model to find.\n */\n removeDataModel(key: string, opts?: DataDomainRemoveOptions): void {\n const { definitions } = this.root || this\n const model = definitions.models.find((i) => i.key === key)\n if (model) {\n model.remove(opts)\n }\n }\n\n /**\n * @returns The graph of associations where keys are the source\n * entities and the value is the list of all target entities.\n */\n associationGraph(): Record<string, string[]> {\n const graph: Record<string, string[]> = {}\n const { definitions } = this.root || this\n const { associations, entities } = definitions\n for (const assoc of associations) {\n if (!assoc.targets.length) {\n continue\n }\n const srcEntity = entities.find((i) => i.associations.some((a) => a === assoc))\n if (!srcEntity) {\n continue\n }\n if (!graph[srcEntity.key]) {\n graph[srcEntity.key] = []\n }\n const targetIds = assoc.targets.map((i) => i.key)\n graph[srcEntity.key].splice(0, 0, ...targetIds)\n }\n return graph\n }\n\n /**\n * Prints out all associations from one entity to another through all entities that may be in between.\n *\n * @param from The key of the from entity\n * @param to The key of the target entity\n * @param g The graph generated with `associationGraph()`\n * @param path The current list of entity ids. Do not set this, it is for the recursive processing of the graph.\n * @param visited The list of visited paths to avoid cycles.\n * Do not set this, it is for the recursive processing of the graph.\n */\n *associationPath(\n from: string,\n to: string,\n g: Record<string, string[]>,\n path: string[] = [],\n visited = new Set<string>()\n ): Generator<string[]> {\n if (from === to) {\n yield path.concat(to)\n return\n }\n if (visited.has(from)) {\n // it's a cycle\n return\n }\n if (g[from]) {\n visited.add(from)\n path.push(from)\n\n for (const neighbor of g[from]) {\n yield* this.associationPath(neighbor, to, g, path, visited)\n }\n\n visited.delete(from)\n path.pop()\n }\n }\n\n /**\n * Scans all associations for foreign namespaces and returns\n * the list of all namespaces used in the association graph.\n * This will never add this namespace's key.\n *\n * This function should be used to read keys for all related\n * namespaces through associations.\n *\n * @returns All keys of foreign namespaces.\n */\n computeForeignNamespaceKeys(): string[] {\n const result: string[] = []\n const { associations = [] } = this.definitions\n associations.forEach((association) => {\n const { targets = [] } = association\n targets.forEach((target) => {\n const { namespace } = target\n if (!namespace || namespace === this.key) {\n return\n }\n result.push(namespace)\n })\n })\n return result\n }\n\n /**\n * Finds an entity in this namespace.\n * @param key The key of the entity to find.\n */\n findEntity(key: string): DataEntity | undefined {\n const { definitions } = this.root || this\n return definitions.entities.find((i) => i.key === key)\n }\n\n /**\n * Finds a property by its key.\n * @param key The key of the property to find\n * @returns The property or undefined if not found.\n */\n findProperty(key: string): DataProperty | undefined {\n const { definitions } = this.root || this\n return definitions.properties.find((i) => i.key === key)\n }\n\n /**\n * Finds an association by its key.\n * @param key The key of the property to find\n * @returns The property or undefined if not found.\n */\n findAssociation(key: string): DataAssociation | undefined {\n const { definitions } = this.root || this\n return definitions.associations.find((i) => i.key === key)\n }\n\n /**\n * Searches for entities for association targets.\n * This is a helper function to discover entities in the current and foreign namespaces.\n *\n * @param targets The list of targets\n * @returns A list of entities. An `undefined` is put at the index where an entity cannot be found\n */\n findAssociatedEntities(targets: AssociationTarget[]): (DataEntity | undefined)[] {\n const result: (DataEntity | undefined)[] = []\n targets.forEach((target) => {\n let ns: DataNamespace | undefined\n if (target.namespace) {\n ns = this.foreign.find((i) => i.key === target.namespace)\n } else {\n ns = this\n }\n if (!ns) {\n result.push(undefined)\n return\n }\n const entity = ns.findEntity(target.key)\n if (entity) {\n result.push(entity)\n } else {\n result.push(undefined)\n }\n })\n return result\n }\n\n /**\n * Finds an associated entity in the current or foreign namespace.\n * This is a helper function to discover entities in the current and foreign namespaces.\n *\n * @param key The key of the entity to find.\n * @param namespace The optional namespace to search in.\n * If not set, the current namespace is used.\n * This is used to find entities in foreign namespaces.\n * @returns The entity or undefined if not found.\n */\n findAssociatedEntity(key: string, namespace?: string): DataEntity | undefined {\n let ns: DataNamespace | undefined\n if (namespace) {\n ns = this.foreign.find((i) => i.key === namespace)\n } else {\n ns = this\n }\n if (!ns) {\n return undefined\n }\n return ns.findEntity(key)\n }\n\n addForeign(ns: DataNamespace): void {\n const exists = this.foreign.some((i) => i.key === ns.key)\n if (exists) {\n return\n }\n this.foreign.push(ns)\n }\n\n removeForeign(ns: DataNamespace): void {\n const index = this.foreign.findIndex((i) => i === ns)\n if (index >= 0) {\n this.foreign.splice(index, 1)\n }\n }\n\n hasForeignNamespace(key: string): boolean {\n return this.foreign.some((i) => i.key === key)\n }\n\n /**\n * Checks whether the namespace is a child of the given namespace.\n * The relationship doesn't have to be direct, as long as the namespace is in the hierarchy it will return true.\n *\n * @param key The key of the parent namespace to check.\n * @returns True if this namespace is a child of the given namespace.\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"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DataNamespaceKind, DataEntityKind, DataModelKind, DataPropertyKind, DataAssociationKind } from '../models/kinds.js';
|
|
2
2
|
import type { DataNamespace } from './DataNamespace.js';
|
|
3
|
-
export type
|
|
3
|
+
export type DomainImpactKinds = typeof DataNamespaceKind | typeof DataEntityKind | typeof DataModelKind | typeof DataPropertyKind | typeof DataAssociationKind;
|
|
4
4
|
/**
|
|
5
5
|
* The impact analysis report
|
|
6
6
|
*/
|
|
7
|
-
interface
|
|
7
|
+
export interface DomainImpactReport {
|
|
8
8
|
/**
|
|
9
9
|
* The key of the impacted data object.
|
|
10
10
|
* This is the key of the object that is being changed.
|
|
@@ -14,18 +14,18 @@ interface ImpactReport {
|
|
|
14
14
|
* The kind of the impacted data object.
|
|
15
15
|
* This is the kind of the object that is being changed.
|
|
16
16
|
*/
|
|
17
|
-
kind:
|
|
17
|
+
kind: DomainImpactKinds;
|
|
18
18
|
/**
|
|
19
19
|
* The list of impacted data objects.
|
|
20
20
|
*/
|
|
21
|
-
impact:
|
|
21
|
+
impact: DomainImpactItem[];
|
|
22
22
|
/**
|
|
23
23
|
* Whether it is possible to proceed with the change.
|
|
24
24
|
* If the change is not possible, the reason will be in the impact list.
|
|
25
25
|
*/
|
|
26
26
|
canProceed: boolean;
|
|
27
27
|
}
|
|
28
|
-
interface
|
|
28
|
+
export interface DomainImpactItem {
|
|
29
29
|
/**
|
|
30
30
|
* The key of the impacted data object.
|
|
31
31
|
*/
|
|
@@ -59,17 +59,17 @@ interface ImpactItem {
|
|
|
59
59
|
resolution?: string;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
* #
|
|
62
|
+
* # DomainImpactAnalysis
|
|
63
63
|
*
|
|
64
|
-
* The `
|
|
64
|
+
* The `DomainImpactAnalysis` class is a powerful tool for analyzing the consequences of deleting data domain objects
|
|
65
65
|
* within a `DataNamespace`.
|
|
66
66
|
* It helps developers understand the ripple effects of removing a namespace, data model, entity, property,
|
|
67
67
|
* or association, ensuring data integrity and preventing unintended side effects.
|
|
68
68
|
*
|
|
69
69
|
* ## Core Concepts
|
|
70
70
|
*
|
|
71
|
-
* - **Impact Report:** The central output of the `
|
|
72
|
-
* potential consequences of a deletion operation, including:
|
|
71
|
+
* - **Impact Report:** The central output of the `DomainImpactAnalysis` class is an `DomainImpactReport`.
|
|
72
|
+
* This report details the potential consequences of a deletion operation, including:
|
|
73
73
|
* - The object being deleted (`key`, `kind`).
|
|
74
74
|
* - A list of `ImpactItem` objects, each describing a specific consequence.
|
|
75
75
|
* - Whether the deletion can proceed safely (`canProceed`).
|
|
@@ -92,15 +92,15 @@ interface ImpactItem {
|
|
|
92
92
|
*
|
|
93
93
|
* ## Usage
|
|
94
94
|
*
|
|
95
|
-
* 1. **Instantiation:** Create an instance of `
|
|
95
|
+
* 1. **Instantiation:** Create an instance of `DomainImpactAnalysis`, passing the root `DataNamespace` as an argument.
|
|
96
96
|
*
|
|
97
97
|
* ```typescript
|
|
98
|
-
* import { DataNamespace } from './DataNamespace';
|
|
99
|
-
* import {
|
|
98
|
+
* import { DataNamespace } from './DataNamespace';
|
|
99
|
+
* import { DomainImpactAnalysis } from './DomainImpactAnalysis';
|
|
100
100
|
*
|
|
101
101
|
* const rootNamespace = new DataNamespace();
|
|
102
102
|
* // ... add some data to the namespace
|
|
103
|
-
* const analyzer = new
|
|
103
|
+
* const analyzer = new DomainImpactAnalysis(rootNamespace);
|
|
104
104
|
* ```
|
|
105
105
|
*
|
|
106
106
|
* 2. **Performing Analysis:** Use the `deleteAnalysis()` method to generate an `ImpactReport` for a specific deletion.
|
|
@@ -138,7 +138,7 @@ interface ImpactItem {
|
|
|
138
138
|
*
|
|
139
139
|
* ## Supported Deletion Scenarios
|
|
140
140
|
*
|
|
141
|
-
* The `
|
|
141
|
+
* The `DomainImpactAnalysis` class supports analyzing the deletion of the following data domain object types:
|
|
142
142
|
*
|
|
143
143
|
* - **Namespaces (`DataNamespaceKind`):** Deleting a namespace also impacts all its child namespaces,
|
|
144
144
|
* data models, entities, properties, and associations.
|
|
@@ -161,7 +161,7 @@ interface ImpactItem {
|
|
|
161
161
|
* - Property: `name`
|
|
162
162
|
* - Entity: `SpecialProduct` (parent: `Product`)
|
|
163
163
|
*
|
|
164
|
-
* If you attempt to delete the `Product` entity, the `
|
|
164
|
+
* If you attempt to delete the `Product` entity, the `DomainImpactAnalysis` will generate a report similar to this:
|
|
165
165
|
*
|
|
166
166
|
* ```json
|
|
167
167
|
* {
|
|
@@ -180,7 +180,7 @@ interface ImpactItem {
|
|
|
180
180
|
* "kind": "DataEntityKind",
|
|
181
181
|
* "type": "delete",
|
|
182
182
|
* "impact": "The SpecialProduct entity will become an orphan because it is a child of Product.",
|
|
183
|
-
* "resolution": "The Product will be removed as the parent
|
|
183
|
+
* "resolution": "The "Product" entity will be removed as the parent of the "SpecialProduct" entity.",
|
|
184
184
|
* "blocking": true,
|
|
185
185
|
* "relationship": "child"
|
|
186
186
|
* },
|
|
@@ -247,12 +247,12 @@ interface ImpactItem {
|
|
|
247
247
|
*
|
|
248
248
|
* ## Error Handling
|
|
249
249
|
*
|
|
250
|
-
* The `
|
|
250
|
+
* The `DomainImpactAnalysis` class does not throw errors. Instead, it uses the `ImpactReport` to communicate
|
|
251
251
|
* the results of the analysis, including any blocking impacts.
|
|
252
252
|
*
|
|
253
253
|
* ## Best Practices
|
|
254
254
|
*
|
|
255
|
-
* - **Always Analyze Before Deleting:** Before deleting any data domain object, always use `
|
|
255
|
+
* - **Always Analyze Before Deleting:** Before deleting any data domain object, always use `DomainImpactAnalysis`
|
|
256
256
|
* to understand the consequences.
|
|
257
257
|
* - **Handle Blocking Impacts:** Pay close attention to `blocking` impacts and implement appropriate
|
|
258
258
|
* logic to handle them.
|
|
@@ -263,11 +263,11 @@ interface ImpactItem {
|
|
|
263
263
|
*
|
|
264
264
|
* ## Conclusion
|
|
265
265
|
*
|
|
266
|
-
* The `
|
|
266
|
+
* The `DomainImpactAnalysis` class is an essential tool for maintaining data integrity when working with complex
|
|
267
267
|
* data domain models. By providing detailed impact reports, it empowers developers to make informed decisions
|
|
268
268
|
* about data deletion and prevent unintended consequences.
|
|
269
269
|
*/
|
|
270
|
-
export declare class
|
|
270
|
+
export declare class DomainImpactAnalysis {
|
|
271
271
|
private report;
|
|
272
272
|
private root;
|
|
273
273
|
constructor(root: DataNamespace);
|
|
@@ -277,14 +277,13 @@ export declare class ImpactAnalysis {
|
|
|
277
277
|
* @param kind The kind of the impacted data object.
|
|
278
278
|
* @returns The delete impact analysis report.
|
|
279
279
|
*/
|
|
280
|
-
deleteAnalysis(key: string, kind:
|
|
281
|
-
protected createDeleteImpact(key: string, kind:
|
|
282
|
-
protected deleteNamespaceAnalysis(key: string, rootKey: string):
|
|
283
|
-
protected deleteDataModelAnalysis(key: string, rootKey: string):
|
|
284
|
-
protected deleteEntityAnalysis(key: string, rootKey: string):
|
|
285
|
-
protected deletePropertyAnalysis(key: string):
|
|
286
|
-
protected deleteAssociationAnalysis(key: string):
|
|
287
|
-
protected kindToLabel(kind:
|
|
280
|
+
deleteAnalysis(key: string, kind: DomainImpactKinds): DomainImpactReport;
|
|
281
|
+
protected createDeleteImpact(key: string, kind: DomainImpactKinds, rootKey: string): DomainImpactItem[];
|
|
282
|
+
protected deleteNamespaceAnalysis(key: string, rootKey: string): DomainImpactItem[];
|
|
283
|
+
protected deleteDataModelAnalysis(key: string, rootKey: string): DomainImpactItem[];
|
|
284
|
+
protected deleteEntityAnalysis(key: string, rootKey: string): DomainImpactItem[];
|
|
285
|
+
protected deletePropertyAnalysis(key: string): DomainImpactItem[];
|
|
286
|
+
protected deleteAssociationAnalysis(key: string): DomainImpactItem[];
|
|
287
|
+
protected kindToLabel(kind: DomainImpactKinds): string;
|
|
288
288
|
}
|
|
289
|
-
|
|
290
|
-
//# sourceMappingURL=ImpactAnalysis.d.ts.map
|
|
289
|
+
//# sourceMappingURL=DomainImpactAnalysis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DomainImpactAnalysis.d.ts","sourceRoot":"","sources":["../../../src/modeling/DomainImpactAnalysis.ts"],"names":[],"mappings":"AAAA,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;;;;OAKG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAkBxE,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB,EAAE;IAiBvG,SAAS,CAAC,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB,EAAE;IA0BnF,SAAS,CAAC,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB,EAAE;IAoBnF,SAAS,CAAC,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB,EAAE;IAuFhF,SAAS,CAAC,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE;IAgBjE,SAAS,CAAC,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE;IAgBpE,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM;CAgBvD"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { DataNamespaceKind, DataEntityKind, DataModelKind, DataPropertyKind, DataAssociationKind, } from '../models/kinds.js';
|
|
2
2
|
/**
|
|
3
|
-
* #
|
|
3
|
+
* # DomainImpactAnalysis
|
|
4
4
|
*
|
|
5
|
-
* The `
|
|
5
|
+
* The `DomainImpactAnalysis` class is a powerful tool for analyzing the consequences of deleting data domain objects
|
|
6
6
|
* within a `DataNamespace`.
|
|
7
7
|
* It helps developers understand the ripple effects of removing a namespace, data model, entity, property,
|
|
8
8
|
* or association, ensuring data integrity and preventing unintended side effects.
|
|
9
9
|
*
|
|
10
10
|
* ## Core Concepts
|
|
11
11
|
*
|
|
12
|
-
* - **Impact Report:** The central output of the `
|
|
13
|
-
* potential consequences of a deletion operation, including:
|
|
12
|
+
* - **Impact Report:** The central output of the `DomainImpactAnalysis` class is an `DomainImpactReport`.
|
|
13
|
+
* This report details the potential consequences of a deletion operation, including:
|
|
14
14
|
* - The object being deleted (`key`, `kind`).
|
|
15
15
|
* - A list of `ImpactItem` objects, each describing a specific consequence.
|
|
16
16
|
* - Whether the deletion can proceed safely (`canProceed`).
|
|
@@ -33,15 +33,15 @@ import { DataNamespaceKind, DataEntityKind, DataModelKind, DataPropertyKind, Dat
|
|
|
33
33
|
*
|
|
34
34
|
* ## Usage
|
|
35
35
|
*
|
|
36
|
-
* 1. **Instantiation:** Create an instance of `
|
|
36
|
+
* 1. **Instantiation:** Create an instance of `DomainImpactAnalysis`, passing the root `DataNamespace` as an argument.
|
|
37
37
|
*
|
|
38
38
|
* ```typescript
|
|
39
|
-
* import { DataNamespace } from './DataNamespace';
|
|
40
|
-
* import {
|
|
39
|
+
* import { DataNamespace } from './DataNamespace';
|
|
40
|
+
* import { DomainImpactAnalysis } from './DomainImpactAnalysis';
|
|
41
41
|
*
|
|
42
42
|
* const rootNamespace = new DataNamespace();
|
|
43
43
|
* // ... add some data to the namespace
|
|
44
|
-
* const analyzer = new
|
|
44
|
+
* const analyzer = new DomainImpactAnalysis(rootNamespace);
|
|
45
45
|
* ```
|
|
46
46
|
*
|
|
47
47
|
* 2. **Performing Analysis:** Use the `deleteAnalysis()` method to generate an `ImpactReport` for a specific deletion.
|
|
@@ -79,7 +79,7 @@ import { DataNamespaceKind, DataEntityKind, DataModelKind, DataPropertyKind, Dat
|
|
|
79
79
|
*
|
|
80
80
|
* ## Supported Deletion Scenarios
|
|
81
81
|
*
|
|
82
|
-
* The `
|
|
82
|
+
* The `DomainImpactAnalysis` class supports analyzing the deletion of the following data domain object types:
|
|
83
83
|
*
|
|
84
84
|
* - **Namespaces (`DataNamespaceKind`):** Deleting a namespace also impacts all its child namespaces,
|
|
85
85
|
* data models, entities, properties, and associations.
|
|
@@ -102,7 +102,7 @@ import { DataNamespaceKind, DataEntityKind, DataModelKind, DataPropertyKind, Dat
|
|
|
102
102
|
* - Property: `name`
|
|
103
103
|
* - Entity: `SpecialProduct` (parent: `Product`)
|
|
104
104
|
*
|
|
105
|
-
* If you attempt to delete the `Product` entity, the `
|
|
105
|
+
* If you attempt to delete the `Product` entity, the `DomainImpactAnalysis` will generate a report similar to this:
|
|
106
106
|
*
|
|
107
107
|
* ```json
|
|
108
108
|
* {
|
|
@@ -121,7 +121,7 @@ import { DataNamespaceKind, DataEntityKind, DataModelKind, DataPropertyKind, Dat
|
|
|
121
121
|
* "kind": "DataEntityKind",
|
|
122
122
|
* "type": "delete",
|
|
123
123
|
* "impact": "The SpecialProduct entity will become an orphan because it is a child of Product.",
|
|
124
|
-
* "resolution": "The Product will be removed as the parent
|
|
124
|
+
* "resolution": "The "Product" entity will be removed as the parent of the "SpecialProduct" entity.",
|
|
125
125
|
* "blocking": true,
|
|
126
126
|
* "relationship": "child"
|
|
127
127
|
* },
|
|
@@ -188,12 +188,12 @@ import { DataNamespaceKind, DataEntityKind, DataModelKind, DataPropertyKind, Dat
|
|
|
188
188
|
*
|
|
189
189
|
* ## Error Handling
|
|
190
190
|
*
|
|
191
|
-
* The `
|
|
191
|
+
* The `DomainImpactAnalysis` class does not throw errors. Instead, it uses the `ImpactReport` to communicate
|
|
192
192
|
* the results of the analysis, including any blocking impacts.
|
|
193
193
|
*
|
|
194
194
|
* ## Best Practices
|
|
195
195
|
*
|
|
196
|
-
* - **Always Analyze Before Deleting:** Before deleting any data domain object, always use `
|
|
196
|
+
* - **Always Analyze Before Deleting:** Before deleting any data domain object, always use `DomainImpactAnalysis`
|
|
197
197
|
* to understand the consequences.
|
|
198
198
|
* - **Handle Blocking Impacts:** Pay close attention to `blocking` impacts and implement appropriate
|
|
199
199
|
* logic to handle them.
|
|
@@ -204,11 +204,11 @@ import { DataNamespaceKind, DataEntityKind, DataModelKind, DataPropertyKind, Dat
|
|
|
204
204
|
*
|
|
205
205
|
* ## Conclusion
|
|
206
206
|
*
|
|
207
|
-
* The `
|
|
207
|
+
* The `DomainImpactAnalysis` class is an essential tool for maintaining data integrity when working with complex
|
|
208
208
|
* data domain models. By providing detailed impact reports, it empowers developers to make informed decisions
|
|
209
209
|
* about data deletion and prevent unintended consequences.
|
|
210
210
|
*/
|
|
211
|
-
export class
|
|
211
|
+
export class DomainImpactAnalysis {
|
|
212
212
|
report;
|
|
213
213
|
root;
|
|
214
214
|
constructor(root) {
|
|
@@ -335,12 +335,14 @@ export class ImpactAnalysis {
|
|
|
335
335
|
});
|
|
336
336
|
if (children.length) {
|
|
337
337
|
children.forEach((child) => {
|
|
338
|
+
const pLabel = entity.info.renderLabel;
|
|
339
|
+
const cLabel = child.info.renderLabel;
|
|
338
340
|
result.push({
|
|
339
341
|
key: child.key,
|
|
340
342
|
kind: child.kind,
|
|
341
343
|
type: 'delete',
|
|
342
|
-
impact: `The ${
|
|
343
|
-
resolution: `The ${
|
|
344
|
+
impact: `The "${cLabel}" ${this.kindToLabel(DataEntityKind)} will become an orphan because it is a child of the "${pLabel}" entity.`,
|
|
345
|
+
resolution: `The "${pLabel}" entity will be removed as the parent of the "${cLabel}" entity.`,
|
|
344
346
|
blocking: true,
|
|
345
347
|
relationship: 'child',
|
|
346
348
|
});
|
|
@@ -434,4 +436,4 @@ export class ImpactAnalysis {
|
|
|
434
436
|
}
|
|
435
437
|
}
|
|
436
438
|
}
|
|
437
|
-
//# sourceMappingURL=
|
|
439
|
+
//# sourceMappingURL=DomainImpactAnalysis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DomainImpactAnalysis.js","sourceRoot":"","sources":["../../../src/modeling/DomainImpactAnalysis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oBAAoB,CAAA;AAqE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,GAAG,CAAC,CAAA;QAClD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO,MAAM,CAAA;QACf,CAAC;QACD,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,EAAE,WAAW,CAAC,GAAG;YACpB,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,mBAAmB;YACvG,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAA;QACF,OAAO,MAAM,CAAA;IACf,CAAC;IAES,WAAW,CAAC,IAAuB;QAC3C,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,iBAAiB;gBACpB,OAAO,WAAW,CAAA;YACpB,KAAK,cAAc;gBACjB,OAAO,QAAQ,CAAA;YACjB,KAAK,aAAa;gBAChB,OAAO,YAAY,CAAA;YACrB,KAAK,gBAAgB;gBACnB,OAAO,UAAU,CAAA;YACnB,KAAK,mBAAmB;gBACtB,OAAO,aAAa,CAAA;YACtB;gBACE,OAAO,SAAS,CAAA;QACpB,CAAC;IACH,CAAC;CACF","sourcesContent":["import {\n DataNamespaceKind,\n DataEntityKind,\n DataModelKind,\n DataPropertyKind,\n DataAssociationKind,\n} from '../models/kinds.js'\nimport type { DataNamespace } from './DataNamespace.js'\n\nexport type DomainImpactKinds =\n | typeof DataNamespaceKind\n | typeof DataEntityKind\n | typeof DataModelKind\n | typeof DataPropertyKind\n | typeof DataAssociationKind\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'\n /**\n * The impact description.\n */\n impact: string\n /**\n * Whether the impact is blocking the operation.\n * If true, the operation cannot proceed.\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\n/**\n * # DomainImpactAnalysis\n *\n * The `DomainImpactAnalysis` class is a powerful tool for analyzing the consequences of deleting data domain objects\n * within a `DataNamespace`.\n * It helps developers understand the ripple effects of removing a namespace, data model, entity, property,\n * 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 `ImpactItem` objects, each describing a specific consequence.\n * - Whether the deletion can proceed safely (`canProceed`).\n *\n * - **ImpactItem:** Each `ImpactItem` describes a specific consequence of the deletion. 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 `DataNamespace` as an argument.\n *\n * ```typescript\n * import { DataNamespace } from './DataNamespace';\n * import { DomainImpactAnalysis } from './DomainImpactAnalysis';\n *\n * const rootNamespace = new DataNamespace();\n * // ... add some data to the namespace\n * const analyzer = new DomainImpactAnalysis(rootNamespace);\n * ```\n *\n * 2. **Performing Analysis:** Use the `deleteAnalysis()` method to generate an `ImpactReport` for a specific deletion.\n * Provide the `key` and `kind` of the object to be deleted.\n *\n * ```typescript\n * import { DataEntityKind } from '../models/kinds.js';\n * // ...\n * const entityKey = 'some-entity-key';\n * const report = analyzer.deleteAnalysis(entityKey, DataEntityKind);\n * ```\n *\n * 3. **Interpreting the Report:** Examine the `ImpactReport` 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 object types:\n *\n * - **Namespaces (`DataNamespaceKind`):** Deleting a namespace also impacts all its child namespaces,\n * data models, entities, properties, and associations.\n * - **Data Models (`DataModelKind`):** Deleting a data model impacts all its entities, properties, and associations.\n * - **Entities (`DataEntityKind`):** 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 (`DataPropertyKind`):** Deleting a property impacts the entity it belongs to.\n * - **Associations (`DataAssociationKind`):** Deleting an association impacts the entity it belongs to.\n *\n * ## Example: Deleting an Entity\n *\n * Consider the following scenario:\n *\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 * 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\": \"DataEntityKind\",\n * \"impact\": [\n * {\n * \"key\": \"Product\",\n * \"kind\": \"DataEntityKind\",\n * \"type\": \"delete\",\n * \"impact\": \"The entity with key Product will be deleted.\",\n * \"blocking\": false\n * },\n * {\n * \"key\": \"SpecialProduct\",\n * \"kind\": \"DataEntityKind\",\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\": \"DataAssociationKind\",\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\": \"DataPropertyKind\",\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 * ### `ImpactKinds`\n *\n * - **Description:** A type alias for the kinds of data domain objects that can be analyzed.\n * - **Values:**\n * - `DataNamespaceKind`\n * - `DataEntityKind`\n * - `DataModelKind`\n * - `DataPropertyKind`\n * - `DataAssociationKind`\n *\n * ### `ImpactReport`\n *\n * - **Description:** The structure of the impact analysis report.\n * - **Properties:**\n * - `key` (`string`): The key of the object being deleted.\n * - `kind` (`ImpactKinds`): The kind of the object being deleted.\n * - `impact` (`ImpactItem[]`): The list of impacts.\n * - `canProceed` (`boolean`): Whether the deletion can proceed.\n *\n * ### `ImpactItem`\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 `ImpactReport` 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 object, 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: DataNamespace\n\n constructor(root: DataNamespace) {\n this.root = root\n this.report = {\n key: '',\n kind: DataNamespaceKind,\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.report.impact = this.createDeleteImpact(key, kind, key)\n // this.report.impact.unshift({\n // key,\n // kind,\n // type: 'delete',\n // impact: `The ${this.kindToLabel(kind)} with key ${key} will be deleted.`,\n // blocking: false,\n // })\n return this.report\n }\n\n protected createDeleteImpact(key: string, kind: DomainImpactKinds, rootKey: string): DomainImpactItem[] {\n switch (kind) {\n case DataNamespaceKind:\n return this.deleteNamespaceAnalysis(key, rootKey)\n case DataModelKind:\n return this.deleteDataModelAnalysis(key, rootKey)\n case DataEntityKind:\n return this.deleteEntityAnalysis(key, rootKey)\n case DataPropertyKind:\n return this.deletePropertyAnalysis(key)\n case DataAssociationKind:\n return this.deleteAssociationAnalysis(key)\n default:\n return []\n }\n }\n\n protected deleteNamespaceAnalysis(key: string, rootKey: string): DomainImpactItem[] {\n const result: DomainImpactItem[] = []\n const ns = this.root.findNamespace(key)\n if (!ns) {\n return result\n }\n result.push({\n key: ns.key,\n kind: ns.kind,\n type: 'delete',\n impact: `The ${ns.info.renderLabel} ${this.kindToLabel(DataNamespaceKind)} will be deleted.`,\n blocking: false,\n })\n const namespaces = ns.listNamespaces()\n namespaces.forEach((child) => {\n const items = this.deleteNamespaceAnalysis(child.key, rootKey)\n result.push(...items)\n })\n const models = ns.listDataModels()\n models.forEach((child) => {\n const items = this.deleteDataModelAnalysis(child.key, rootKey)\n result.push(...items)\n })\n return result\n }\n\n protected deleteDataModelAnalysis(key: string, rootKey: string): DomainImpactItem[] {\n const result: DomainImpactItem[] = []\n const model = this.root.findDataModel(key)\n if (!model) {\n return result\n }\n result.push({\n key: model.key,\n kind: model.kind,\n type: 'delete',\n impact: `The ${model.info.renderLabel} ${this.kindToLabel(DataModelKind)} will be deleted.`,\n blocking: false,\n })\n model.entities.forEach((child) => {\n const items = this.deleteEntityAnalysis(child.key, rootKey)\n result.push(...items)\n })\n return result\n }\n\n protected deleteEntityAnalysis(key: string, rootKey: string): DomainImpactItem[] {\n const result: DomainImpactItem[] = []\n const entity = this.root.findEntity(key)\n if (!entity) {\n return result\n }\n result.push({\n key: entity.key,\n kind: entity.kind,\n type: 'delete',\n impact: `The ${entity.info.renderLabel} ${this.kindToLabel(DataEntityKind)} will be deleted.`,\n blocking: false,\n })\n // We need to know whether the entity is a parent of another entity\n const children = this.root.definitions.entities.filter((domainEntity) => {\n if (domainEntity.key === entity.key) {\n // ignore self\n return false\n }\n if (!domainEntity.parents.includes(entity.key)) {\n // no relationship\n return false\n }\n if (domainEntity.isChildOf(rootKey)) {\n // No need to include this parent as it itself is being deleted\n return false\n }\n // the entity has a parent-child relationship to the deleted entity.\n return true\n })\n if (children.length) {\n children.forEach((child) => {\n const pLabel = entity.info.renderLabel\n const cLabel = child.info.renderLabel\n result.push({\n key: child.key,\n kind: child.kind,\n type: 'delete',\n impact: `The \"${cLabel}\" ${this.kindToLabel(DataEntityKind)} 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: true,\n relationship: 'child',\n })\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 const inAssociations = this.root.definitions.associations.filter((association) => {\n return association.targets.some((item) => {\n if (item.key === entity.key) {\n const related = association.getParentInstance()\n if (!related) {\n return false\n }\n if (related.isChildOf(rootKey)) {\n // No need to include this association as the related entity itself is being deleted\n return false\n }\n return true\n }\n return false\n })\n })\n if (inAssociations.length) {\n inAssociations.forEach((association) => {\n result.push({\n key: association.key,\n kind: association.kind,\n type: 'delete',\n impact: `The ${association.info.renderLabel} ${this.kindToLabel(DataAssociationKind)} will be broken because it has a target to ${entity.info.renderLabel}.`,\n resolution: `The ${association.info.renderLabel} ${this.kindToLabel(DataAssociationKind)} will be removed from ${entity.info.renderLabel}.`,\n blocking: true,\n })\n })\n this.report.canProceed = false\n }\n entity.properties.forEach((child) => {\n const items = this.deletePropertyAnalysis(child.key)\n result.push(...items)\n })\n entity.associations.forEach((child) => {\n const items = this.deleteAssociationAnalysis(child.key)\n result.push(...items)\n })\n return result\n }\n\n protected deletePropertyAnalysis(key: string): DomainImpactItem[] {\n const result: DomainImpactItem[] = []\n const property = this.root.findProperty(key)\n if (!property) {\n return result\n }\n result.push({\n key: property.key,\n kind: property.kind,\n type: 'delete',\n impact: `The ${property.info.renderLabel} ${this.kindToLabel(DataPropertyKind)} will be deleted.`,\n blocking: false,\n })\n return result\n }\n\n protected deleteAssociationAnalysis(key: string): DomainImpactItem[] {\n const result: DomainImpactItem[] = []\n const association = this.root.findAssociation(key)\n if (!association) {\n return result\n }\n result.push({\n key: association.key,\n kind: association.kind,\n type: 'delete',\n impact: `The ${association.info.renderLabel} ${this.kindToLabel(DataAssociationKind)} will be deleted.`,\n blocking: false,\n })\n return result\n }\n\n protected kindToLabel(kind: DomainImpactKinds): string {\n switch (kind) {\n case DataNamespaceKind:\n return 'namespace'\n case DataEntityKind:\n return 'entity'\n case DataModelKind:\n return 'data model'\n case DataPropertyKind:\n return 'property'\n case DataAssociationKind:\n return 'association'\n default:\n return 'unknown'\n }\n }\n}\n"]}
|
|
@@ -6,7 +6,7 @@ export interface DataDomainRemoveOptions {
|
|
|
6
6
|
* For example, when removing an entity that is a parent to another entity, it will
|
|
7
7
|
* removed itself as a parent from the child entity.
|
|
8
8
|
*
|
|
9
|
-
* Note, this option should only be used when the
|
|
9
|
+
* Note, this option should only be used when the DomainImpactAnalysis has been performed
|
|
10
10
|
* and the user was informed of the impact.
|
|
11
11
|
*/
|
|
12
12
|
force?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modeling/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface DataDomainRemoveOptions {\n /**\n * When true, the object will be forcebly removed.\n * The resolution defined in the `ImpactResolution` class will be applied.\n *\n * For example, when removing an entity that is a parent to another entity, it will\n * removed itself as a parent from the child entity.\n *\n * Note, this option should only be used when the
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modeling/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface DataDomainRemoveOptions {\n /**\n * When true, the object will be forcebly removed.\n * The resolution defined in the `ImpactResolution` class will be applied.\n *\n * For example, when removing an entity that is a parent to another entity, it will\n * removed itself as a parent from the child entity.\n *\n * Note, this option should only be used when the DomainImpactAnalysis has been performed\n * and the user was informed of the impact.\n */\n force?: boolean\n}\n"]}
|