@api-client/core 0.11.0 → 0.11.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"DataEntity.js","sourceRoot":"","sources":["../../../src/modeling/DataEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAEjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAA;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAA;AAC1F,OAAO,EAAE,eAAe,EAA+B,MAAM,mCAAmC,CAAA;AAChG,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAA;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAA;AA6D5F;;;GAGG;AACH,MAAM,OAAO,UAAU;IA0DZ;IAzDT,IAAI,GAAG,cAAc,CAAA;IAErB,GAAG,GAAG,EAAE,CAAA;IAER;;OAEG;IACH,IAAI,GAAU,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAEhC;;OAEG;IACH,IAAI,GAAa,EAAE,CAAA;IAEnB;;;;OAIG;IACH,QAAQ,GAAa,EAAE,CAAA;IAEvB;;OAEG;IACH,UAAU,GAAmB,EAAE,CAAA;IAE/B;;OAEG;IACH,YAAY,GAAsB,EAAE,CAAA;IAEpC;;;;;;;;OAQG;IACH,OAAO,GAAa,EAAE,CAAA;IA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AI,CAAC,CAAA;QACxB,CAAC;QACD,MAAM,OAAO,GAAG,CAAC,GAAa,EAAE,MAAgB,EAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;QAClG,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;YAC3B,KAAK,MAAM,EAAE,IAAI,WAAW,EAAE,CAAC;gBAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;gBAC9B,IAAI,MAAM,EAAE,CAAC;oBACX,OAAO,MAAM,CAAA;gBACf,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF","sourcesContent":["import { IThing, Thing } from '../models/Thing.js'\nimport v4 from '../lib/uuid.js'\nimport { DataNamespace } from './DataNamespace.js'\nimport { DataProperty } from './DataProperty.js'\nimport { type DataPropertyType } from './DataFormat.js'\nimport { DataAssociation } from './DataAssociation.js'\nimport { FileBreadcrumb } from '../models/store/File.js'\nimport { DataEntityKind } from '../models/kinds.js'\nimport { DataModel } from './DataModel.js'\nimport { IApiNodeShape, IShapeUnion } from '../amf/definitions/Shapes.js'\nimport { AmfShapeGenerator } from '../amf/AmfShapeGenerator.js'\nimport { ApiSchemaGenerator } from '../amf/ApiSchemaGenerator.js'\nimport { IShapeRenderOptions } from '../amf/shape/ShapeBase.js'\nimport { RemovePropertyException } from '../exceptions/remove_property_exception.js'\nimport { RemoveAssociationException } from '../exceptions/remove_association_exception.js'\nimport { ValidationError, type FieldValidationMessage } from '../exceptions/validation_error.js'\nimport { RemoveEntityException } from '../exceptions/remove_entity_exception.js'\nimport { ForeignAssociationException } from '../exceptions/foreign_association_exception.js'\n\n/**\n * Data entity is the smallest description of a data in the system\n * It contains properties and associations. At least one entity describe a data model.\n */\nexport interface IDataEntity {\n kind: typeof DataEntityKind\n /**\n * The key of the namespace.\n */\n key: string\n /**\n * The data 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 list of keys of properties that belong to this entity.\n */\n properties?: string[]\n\n /**\n * The list of keys of associations that belong to this entity.\n */\n associations?: string[]\n\n /**\n * The list of keys of entities that are parents to this entity.\n *\n * This potentially may cause a conflict when two parents declare the same\n * property. In such situation this entity should define own property\n * with the same name to shadow parent property. When the property is\n * not shadowed this may cause unexpected results as the processing could result\n * with inconsistent definition of a schema because the last read property wins.\n */\n parents?: string[]\n\n /**\n * Whether this entity is deprecated.\n */\n deprecated?: boolean\n\n /**\n * The schema allowing to translate the model into a specific format (like JSON, RAML, XML, etc.)\n */\n schema?: IApiNodeShape\n}\n\n/**\n * Data entity is the smallest description of a data in the system\n * It contains properties and associations. At least one entity describe a data model.\n */\nexport class DataEntity {\n kind = DataEntityKind\n\n key = ''\n\n /**\n * The description of the data namespace.\n */\n info: Thing = Thing.fromName('')\n\n /**\n * Optional general purpose tags for the UI.\n */\n tags: string[] = []\n\n /**\n * Reserved for future use.\n *\n * The keys of the taxonomy items associated with the entity.\n */\n taxonomy: string[] = []\n\n /**\n * The list of keys of properties that belong to this entity.\n */\n properties: DataProperty[] = []\n\n /**\n * The list of keys of associations that belong to this entity.\n */\n associations: DataAssociation[] = []\n\n /**\n * The list of keys of entities that are parents to this entity.\n *\n * This potentially may cause a conflict when two parents declare the same\n * property. In such situation this entity should define own property\n * with the same name to shadow parent property. When the property is\n * not shadowed this may cause unexpected results as the processing could result\n * with inconsistent definition of a schema because the last read property wins.\n */\n parents: string[] = []\n\n /**\n * Whether this entity is deprecated.\n */\n deprecated?: boolean\n\n static fromName(root: DataNamespace, name: string): DataEntity {\n const entity = new DataEntity(root)\n entity.info = Thing.fromName(name)\n return entity\n }\n\n /**\n * @param input The data entity definition to restore.\n */\n constructor(\n public root: DataNamespace,\n input?: string | IDataEntity\n ) {\n let init: IDataEntity\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: DataEntityKind,\n key: v4(),\n info: Thing.fromName('').toJSON(),\n }\n }\n this.new(init)\n }\n\n new(init: IDataEntity): void {\n DataEntity.validate(init)\n const {\n info,\n key = v4(),\n kind = DataEntityKind,\n tags,\n taxonomy,\n parents,\n properties,\n associations,\n deprecated,\n } = init\n this.kind = kind\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(tags)) {\n this.tags = [...tags]\n } else {\n this.tags = []\n }\n if (Array.isArray(taxonomy)) {\n this.taxonomy = [...taxonomy]\n } else {\n this.taxonomy = []\n }\n if (Array.isArray(parents)) {\n this.parents = [...parents]\n } else {\n this.parents = []\n }\n this.properties = []\n if (Array.isArray(properties)) {\n properties.forEach((key) => {\n const value = this._readProperty(key)\n if (value) {\n this.properties.push(value)\n }\n })\n }\n this.associations = []\n if (Array.isArray(associations)) {\n associations.forEach((key) => {\n const value = this._readAssociation(key)\n if (value) {\n this.associations.push(value)\n }\n })\n }\n if (typeof deprecated === 'boolean') {\n this.deprecated = deprecated\n } else {\n this.deprecated = undefined\n }\n }\n\n static validate(input: unknown): void {\n const typed = input as IDataEntity\n const messages: FieldValidationMessage[] = []\n if (!typed) {\n messages.push({\n field: '',\n message: 'The input is required. None given',\n rule: 'required',\n })\n throw new ValidationError(messages)\n }\n if (typed.kind !== DataEntityKind) {\n messages.push({\n field: 'kind',\n message: `The kind property must be ${DataEntityKind}`,\n rule: 'invalid',\n })\n }\n if (messages.length) {\n throw new ValidationError(messages, { message: 'Invalid data entity definition.' })\n }\n }\n\n toJSON(): IDataEntity {\n const result: IDataEntity = {\n kind: DataEntityKind,\n key: this.key,\n info: this.info.toJSON(),\n }\n if (Array.isArray(this.tags) && this.tags.length) {\n result.tags = [...this.tags]\n }\n if (Array.isArray(this.taxonomy) && this.taxonomy.length) {\n result.taxonomy = [...this.taxonomy]\n }\n if (Array.isArray(this.parents) && this.parents.length) {\n result.parents = [...this.parents]\n }\n if (Array.isArray(this.properties) && this.properties.length) {\n result.properties = this.properties.map((i) => i.key)\n }\n if (Array.isArray(this.associations) && this.associations.length) {\n result.associations = this.associations.map((i) => i.key)\n }\n if (typeof this.deprecated === 'boolean') {\n result.deprecated = this.deprecated\n }\n return result\n }\n\n protected _readAssociation(key: string): DataAssociation | undefined {\n return this.root.definitions.associations.find((i) => i.key === key)\n }\n\n protected _readProperty(key: string): DataProperty | undefined {\n return this.root.definitions.properties.find((i) => i.key === key)\n }\n\n /**\n * Creates a property with a passed type.\n * @param type The type of the property\n * @returns The created property\n */\n addTypedProperty(type: DataPropertyType, name?: string): DataProperty {\n const property = DataProperty.fromType(this.root, type)\n if (name) {\n property.info.name = name\n }\n this.root.definitions.properties.push(property)\n this.properties.push(property)\n return property\n }\n\n /**\n * Creates a property with a passed type.\n * @param name The name of the property.\n * @returns The created property\n */\n addNamedProperty(name: string): DataProperty {\n const property = DataProperty.fromName(this.root, name)\n this.root.definitions.properties.push(property)\n this.properties.push(property)\n return property\n }\n\n /**\n * Removes the property from the entity and namespace definitions.\n * @param key The key of the property to remove.\n */\n removeProperty(key: string): void {\n const thisIndex = this.properties.findIndex((i) => i.key === key)\n if (thisIndex < 0) {\n throw new RemovePropertyException(`Trying to remove the ${key} property, but it doesn't exist.`)\n }\n const propertyToRemove = this.properties[thisIndex]\n this.properties.splice(thisIndex, 1)\n const defIndex = this.root.definitions.properties.findIndex((i) => i.key === key)\n if (defIndex >= 0) {\n this.root.definitions.properties.splice(defIndex, 1)\n }\n propertyToRemove.remove()\n }\n\n /**\n * Lists all properties for this Entity.\n * @returns The list of properties that belong to this entity.\n */\n listProperties(): DataProperty[] {\n const result: DataProperty[] = []\n for (const prop of this.properties) {\n this.root.definitions.properties.find((p) => p.key === prop.key)\n if (prop) {\n result.push(prop)\n }\n }\n return result\n }\n\n /**\n * Creates an association for a given name, adds it to definitions, and returns it.\n * @param name The name of the association\n * @returns The created association\n */\n addNamedAssociation(name: string): DataAssociation {\n const result = DataAssociation.fromName(this.root, name)\n this.root.definitions.associations.push(result)\n this.associations.push(result)\n return result\n }\n\n /**\n * Creates an association for a given target, adds it to definitions, and returns it.\n *\n * @param target The target entity key of the association\n * @param namespace The target entity namespace when different to the current namespace.\n * @param name Optional name.\n * @returns The created association\n */\n addTargetAssociation(target: string | DataEntity, name?: string): DataAssociation {\n let key: string\n if (typeof target === 'string') {\n key = target\n } else {\n key = target.key\n }\n const result = DataAssociation.fromTarget(this.root, key)\n if (name) {\n result.info.name = name\n }\n this.root.definitions.associations.push(result)\n this.associations.push(result)\n return result\n }\n\n /**\n * Creates an association for a given target that is in another namespace\n * @param target The target entity key of the association\n * @param namespace The target entity namespace when different to the current namespace.\n * @param name Optional name.\n * @returns The created association\n */\n addForeignAssociation(target: string | DataEntity, namespace: string, name?: string): DataAssociation {\n let key: string\n if (typeof target === 'string') {\n key = target\n } else {\n key = target.key\n }\n if (!this.root.hasForeignNamespace(namespace)) {\n throw new ForeignAssociationException(\n `Trying to add a foreign association but the foreign namespace is not defined.`\n )\n }\n const result = DataAssociation.fromTarget(this.root, key, namespace)\n if (name) {\n result.info.name = name\n }\n this.root.definitions.associations.push(result)\n this.associations.push(result)\n return result\n }\n\n /**\n * Removes an association from the entity and, namespace definitions.\n * @param key The key of the association to remove.\n */\n removeAssociation(key: string): void {\n const thisIndex = this.associations.findIndex((i) => i.key === key)\n if (thisIndex < 0) {\n // return\n throw new RemoveAssociationException(`Trying to remove the ${key} association, but it doesn't exist.`)\n }\n const associationToRemove = this.associations[thisIndex]\n this.associations.splice(thisIndex, 1)\n const defIndex = this.root.definitions.associations.findIndex((i) => i.key === key)\n if (defIndex >= 0) {\n this.root.definitions.associations.splice(defIndex, 1)\n }\n associationToRemove.remove()\n }\n\n /**\n * Reads the list of parents for the entity, inside the root namespace. The computed list contains the list of all\n * parents in the inheritance chain in no particular order.\n * @param recursive Whether to include parent parents as well.\n */\n getComputedParents(recursive?: boolean): DataEntity[] {\n const { entities } = this.root.definitions\n let result: DataEntity[] = []\n this.parents.forEach((key) => {\n const parent = entities.find((i) => i.key === key)\n if (parent) {\n result.push(parent)\n if (recursive) {\n result = result.concat(parent.getComputedParents())\n }\n }\n })\n return result\n }\n\n /**\n * Computes list of all children, inside the root namespace, that extends this entity.\n * The children are not ordered.\n */\n getComputedChildren(): DataEntity[] {\n const { entities } = this.root.definitions\n return entities.filter((i) => i.parents.includes(this.key))\n }\n\n /**\n * Computes a list of entities that are associated with the current entity.\n */\n getComputedAssociations(): DataEntity[] {\n const { associations } = this\n const result: DataEntity[] = []\n associations.forEach((assoc) => {\n if (!assoc.targets.length) {\n return\n }\n const entities = this.root.findAssociatedEntities(assoc.targets)\n entities.forEach((entity) => {\n if (entity) {\n result.push(entity)\n }\n })\n })\n return result\n }\n\n /**\n * Removes self from the namespace with all properties and attributes.\n */\n remove(): void {\n const { key, properties, associations, root } = this\n // check if some entity has reference to this entity as a target\n const associationsToEntity = this.root.definitions.associations.filter((a) =>\n a.targets.some((t) => t.key === this.key)\n )\n if (associationsToEntity.length > 0) {\n const entitiesNames = associationsToEntity.reduce<string[]>((acc, association) => {\n const entity = root.definitions.entities.find((e) => e.associations.includes(association))\n if (entity) {\n acc.push(entity.info.name as string)\n }\n return acc\n }, [])\n throw new RemoveEntityException(\n `Cannot remove entity ${this.info.name} because it is used as a target in associations in entities: ${entitiesNames.join(', ')}.`\n )\n }\n\n // remove own stuff\n properties.forEach((p) => this.removeProperty(p.key))\n associations.forEach((a) => this.removeAssociation(a.key))\n // remove from the root\n const index = root.definitions.entities.findIndex((i) => i.key === key)\n if (index >= 0) {\n root.definitions.entities.splice(index, 1)\n }\n // remove from the parent\n const model = this.getParent()\n if (model) {\n const entityIndex = model.entities.findIndex((e) => e === this)\n model.entities.splice(entityIndex, 1)\n }\n }\n\n /**\n * Returns a parent data model where this entity exist.\n */\n getParent(): DataModel | undefined {\n return this.root.definitions.models.find((m) => m.entities.some((e) => e === this))\n }\n\n addParent(key: string): this {\n // Prevent adding self as parent\n if (key === 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 // check if parent exists\n const parent = this.root.definitions.entities.find((i) => i.key === key)\n if (!parent) {\n const message = `Entity with key \"${key}\" not found.`\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'not-exists',\n },\n ],\n { message }\n )\n }\n // Check for circular inheritance\n if (this.hasCircularParent(key)) {\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 this.parents.push(key)\n return this\n }\n\n /**\n * Checks if the entity has a circular parent relationship when attempting to add a new parent.\n * @param key The key of the parent being added.\n * @returns true if adding this parent would create a circular relationship.\n */\n hasCircularParent(key: string): boolean {\n const { entities } = this.root.definitions\n // Check if new parent is one of the children.\n const children = this.getComputedChildren()\n if (children.some((c) => c.key === key)) {\n return true\n }\n // check if this entity is in parents chain.\n let current: DataEntity | undefined = entities.find((e) => e.key === key)\n while (current) {\n if (current.key === this.key) {\n return true\n }\n // for (const parentKey of current.parents) {\n // current = parentKey ? entities.find((e) => e.key === parentKey) : undefined\n // }\n const parentKey = current.parents[0] // Assuming single inheritance\n current = parentKey ? entities.find((e) => e.key === parentKey) : undefined\n }\n return false\n }\n\n /**\n * Tests whether one entity is associated with another.\n *\n * @param entity1 The source entity\n * @param entity2 The target entity\n * @returns true when there's any path from one entity to another.\n */\n static isAssociated(entity1: DataEntity, entity2: DataEntity): boolean {\n return entity1.isAssociated(entity2.key)\n }\n\n /**\n * Tests whether this entity is somehow associated with another entity.\n * @param target The key of the target entity to test for association with.\n * @returns true if this entity has any association to the `target` entity.\n */\n isAssociated(target: string): boolean {\n const it = this.associationPath(target)\n const path = it.next().value\n return !!path\n }\n\n /**\n * Prints out all associations from one entity to another through all entities that may be in between.\n * @param toEntity The key to the target entity\n * @yields The path containing keys of entities from this entity to the `toEntity`\n * (inclusive) and all entities in between.\n */\n *associationPath(toEntity: string): Generator<string[]> {\n const graph = this.root.associationGraph()\n for (const path of this.root.associationPath(this.key, toEntity, graph)) {\n yield path\n }\n }\n\n /**\n * Returns a list of entities that are associated with this entity through an association\n * that the target property points to this entity.\n *\n * In other words, if entity `A` has association target with `B`, then asking `B` for related entities will\n * result with `[A]`.\n *\n * ```plain\n * A -> B -> C\n * D -> C\n *\n * C => [B, D]\n * B => [A, C]\n * ```\n */\n getRelatedEntities(): DataEntity[] {\n const { key, root } = this\n const result = DataEntity.getRelatedEntities(root, key)\n root.foreign.forEach((ns) => {\n const other = DataEntity.getRelatedEntities(ns, key)\n other.forEach((entity) => {\n if (!result.includes(entity)) {\n result.push(entity)\n }\n })\n })\n return result\n }\n\n static getRelatedEntities(namespace: DataNamespace, entity: string): DataEntity[] {\n const result: DataEntity[] = []\n const inverse = namespace.definitions.associations.filter((i) => i.targets.some((j) => j.key === entity))\n inverse.forEach((assoc) => {\n const entity = namespace.definitions.entities.find((e) => e.associations.includes(assoc))\n if (entity && !result.includes(entity)) {\n result.push(entity)\n }\n })\n return result\n }\n\n /**\n * Creates breadcrumbs from this entity to the root namespace.\n */\n breadcrumbs(): FileBreadcrumb[] {\n const result: FileBreadcrumb[] = []\n result.push({\n key: this.key,\n name: this.info.name || 'Unnamed entity',\n kind: DataEntityKind,\n })\n const model = this.getParent()\n if (model) {\n result.push({\n key: model.key,\n kind: model.kind,\n name: model.info.name || 'Unnamed data model',\n })\n let parent = model.getParent()\n while (parent && parent !== this.root) {\n result.push({\n key: parent.key,\n kind: parent.kind,\n name: parent.info.name || 'Unnamed namespace',\n })\n parent = parent.getParent()\n }\n }\n result.push({\n key: this.root.key,\n name: this.root.info.name || 'Unnamed namespace',\n kind: this.root.kind,\n })\n return result.reverse()\n }\n\n /**\n * Adds a new tag to the property. It also populates the root namespace's tags when tag is new.\n *\n * Note, it does nothing when the tag is already defined.\n *\n * @param tag The tag to add.\n */\n addTag(tag: string): void {\n if (!tag) {\n return\n }\n const lower = tag.toLowerCase()\n const { tags } = this\n if (tags.some((t) => t.toLowerCase() === lower)) {\n return\n }\n tags.push(tag)\n const { definitions } = this.root\n if (!definitions.tags.some((t) => t.toLowerCase() === lower)) {\n definitions.tags.push(tag)\n }\n }\n\n /**\n * Removes a tag from the property. Unlike the `addTag()` this won't remove a `tag` from the root namespace.\n *\n * @param tag The tag to remove.\n */\n removeTag(tag: string): void {\n if (!tag) {\n return\n }\n const lower = tag.toLowerCase()\n const { tags } = this\n const index = tags.findIndex((t) => t.toLowerCase() === lower)\n if (index >= 0) {\n tags.splice(index, 1)\n }\n }\n\n /**\n * Creates a Shape of AMF.\n * The property itself is auto-generated. If the `schema` is defined then it is used\n * as the `range` of the property. Otherwise basic shape is generated for the range.\n *\n * This is a preferred way of reading the AMF shape as this synchronizes changed\n * data properties with the shape definition.\n *\n * @returns AMF property shape definition.\n */\n toApiShape(): IShapeUnion {\n const serializer = new AmfShapeGenerator()\n return serializer.entity(this)\n }\n\n /**\n * Reads the schema of the Entity and generates an example for it.\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 hasClosedCycle(rootEntity: string, targetEntity: string): boolean {\n if (targetEntity === this.key) {\n // self association\n return true\n }\n const g = this.root.associationGraph()\n const selfPaths: string[][] = []\n const targetPaths: string[][] = []\n for (const path of this.root.associationPath(rootEntity, this.key, g)) {\n selfPaths.push(path)\n }\n for (const path of this.root.associationPath(targetEntity, this.key, g)) {\n targetPaths.push(path)\n }\n const checker = (arr: string[], target: string[]): boolean => target.every((v) => arr.includes(v))\n for (const sp of selfPaths) {\n for (const tp of targetPaths) {\n const result = checker(sp, tp)\n if (result) {\n return result\n }\n }\n }\n return false\n }\n}\n"]}
1
+ {"version":3,"file":"DataEntity.js","sourceRoot":"","sources":["../../../src/modeling/DataEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAEjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAA;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAA;AAC1F,OAAO,EAAE,eAAe,EAA+B,MAAM,mCAAmC,CAAA;AAChG,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAA;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAA;AA6E5F;;;GAGG;AACH,MAAM,OAAO,UAAU;IAkEZ;IAjET,IAAI,GAAG,cAAc,CAAA;IAErB,GAAG,GAAG,EAAE,CAAA;IAER;;OAEG;IACH,IAAI,GAAU,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAEhC;;OAEG;IACH,IAAI,GAAa,EAAE,CAAA;IAEnB;;;;OAIG;IACH,QAAQ,GAAa,EAAE,CAAA;IAEvB;;OAEG;IACH,UAAU,GAAmB,EAAE,CAAA;IAE/B;;OAEG;IACH,YAAY,GAAsB,EA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A;QAChC,MAAM,WAAW,GAAe,EAAE,CAAA;QAClC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;YACtE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACtB,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;YACxE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACxB,CAAC;QACD,MAAM,OAAO,GAAG,CAAC,GAAa,EAAE,MAAgB,EAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;QAClG,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;YAC3B,KAAK,MAAM,EAAE,IAAI,WAAW,EAAE,CAAC;gBAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;gBAC9B,IAAI,MAAM,EAAE,CAAC;oBACX,OAAO,MAAM,CAAA;gBACf,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF","sourcesContent":["import { IThing, Thing } from '../models/Thing.js'\nimport v4 from '../lib/uuid.js'\nimport { DataNamespace } from './DataNamespace.js'\nimport { DataProperty } from './DataProperty.js'\nimport { type DataPropertyType } from './DataFormat.js'\nimport { DataAssociation } from './DataAssociation.js'\nimport { FileBreadcrumb } from '../models/store/File.js'\nimport { DataEntityKind } from '../models/kinds.js'\nimport { DataModel } from './DataModel.js'\nimport { IApiNodeShape, IShapeUnion } from '../amf/definitions/Shapes.js'\nimport { AmfShapeGenerator } from '../amf/AmfShapeGenerator.js'\nimport { ApiSchemaGenerator } from '../amf/ApiSchemaGenerator.js'\nimport { IShapeRenderOptions } from '../amf/shape/ShapeBase.js'\nimport { RemovePropertyException } from '../exceptions/remove_property_exception.js'\nimport { RemoveAssociationException } from '../exceptions/remove_association_exception.js'\nimport { ValidationError, type FieldValidationMessage } from '../exceptions/validation_error.js'\nimport { RemoveEntityException } from '../exceptions/remove_entity_exception.js'\nimport { ForeignAssociationException } from '../exceptions/foreign_association_exception.js'\n\ninterface OrderedItem {\n type: 'property' | 'association'\n key: string\n}\n\n/**\n * Data entity is the smallest description of a data in the system\n * It contains properties and associations. At least one entity describe a data model.\n */\nexport interface IDataEntity {\n kind: typeof DataEntityKind\n /**\n * The key of the namespace.\n */\n key: string\n /**\n * The data 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 list of keys of properties that belong to this entity.\n */\n properties?: string[]\n\n /**\n * The list of keys of associations that belong to this entity.\n */\n associations?: 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?: OrderedItem[]\n\n /**\n * The list of keys of entities that are parents to this entity.\n *\n * This potentially may cause a conflict when two parents declare the same\n * property. In such situation this entity should define own property\n * with the same name to shadow parent property. When the property is\n * not shadowed this may cause unexpected results as the processing could result\n * with inconsistent definition of a schema because the last read property wins.\n *\n * @todo(jarrodek): This should also hold a reference to a namespace to support\n * foreign entities as parents.\n */\n parents?: string[]\n\n /**\n * Whether this entity is deprecated.\n */\n deprecated?: boolean\n\n /**\n * The schema allowing to translate the model into a specific format (like JSON, RAML, XML, etc.)\n */\n schema?: IApiNodeShape\n}\n\n/**\n * Data entity is the smallest description of a data in the system\n * It contains properties and associations. At least one entity describe a data model.\n */\nexport class DataEntity {\n kind = DataEntityKind\n\n key = ''\n\n /**\n * The description of the data namespace.\n */\n info: Thing = Thing.fromName('')\n\n /**\n * Optional general purpose tags for the UI.\n */\n tags: string[] = []\n\n /**\n * Reserved for future use.\n *\n * The keys of the taxonomy items associated with the entity.\n */\n taxonomy: string[] = []\n\n /**\n * The list of keys of properties that belong to this entity.\n */\n properties: DataProperty[] = []\n\n /**\n * The list of keys of associations that belong to this entity.\n */\n associations: DataAssociation[] = []\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: OrderedItem[] = []\n\n /**\n * The list of keys of entities that are parents to this entity.\n *\n * This potentially may cause a conflict when two parents declare the same\n * property. In such situation this entity should define own property\n * with the same name to shadow parent property. When the property is\n * not shadowed this may cause unexpected results as the processing could result\n * with inconsistent definition of a schema because the last read property wins.\n */\n parents: string[] = []\n\n /**\n * Whether this entity is deprecated.\n */\n deprecated?: boolean\n\n static fromName(root: DataNamespace, name: string): DataEntity {\n const entity = new DataEntity(root)\n entity.info = Thing.fromName(name)\n return entity\n }\n\n /**\n * @param input The data entity definition to restore.\n */\n constructor(\n public root: DataNamespace,\n input?: string | IDataEntity\n ) {\n let init: IDataEntity\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: DataEntityKind,\n key: v4(),\n info: Thing.fromName('').toJSON(),\n }\n }\n this.new(init)\n }\n\n new(init: IDataEntity): void {\n DataEntity.validate(init)\n const {\n info,\n key = v4(),\n kind = DataEntityKind,\n tags,\n taxonomy,\n parents,\n properties,\n associations,\n fields,\n deprecated,\n } = init\n this.kind = kind\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(tags)) {\n this.tags = [...tags]\n } else {\n this.tags = []\n }\n if (Array.isArray(taxonomy)) {\n this.taxonomy = [...taxonomy]\n } else {\n this.taxonomy = []\n }\n if (Array.isArray(parents)) {\n this.parents = [...parents]\n } else {\n this.parents = []\n }\n this.properties = []\n if (Array.isArray(properties)) {\n properties.forEach((key) => {\n const value = this._readProperty(key)\n if (value) {\n this.properties.push(value)\n }\n })\n }\n this.associations = []\n if (Array.isArray(associations)) {\n associations.forEach((key) => {\n const value = this._readAssociation(key)\n if (value) {\n this.associations.push(value)\n }\n })\n }\n if (Array.isArray(fields)) {\n this.fields = [...fields]\n } else {\n this.fields = this.createOrderedFields()\n }\n if (typeof deprecated === 'boolean') {\n this.deprecated = deprecated\n } else {\n this.deprecated = undefined\n }\n }\n\n private createOrderedFields(): OrderedItem[] {\n const result: OrderedItem[] = []\n this.properties.forEach((i) => {\n result.push({\n type: 'property',\n key: i.key,\n })\n })\n this.associations.forEach((i) => {\n result.push({\n type: 'association',\n key: i.key,\n })\n })\n return result\n }\n\n static validate(input: unknown): void {\n const typed = input as IDataEntity\n const messages: FieldValidationMessage[] = []\n if (!typed) {\n messages.push({\n field: '',\n message: 'The input is required. None given',\n rule: 'required',\n })\n throw new ValidationError(messages)\n }\n if (typed.kind !== DataEntityKind) {\n messages.push({\n field: 'kind',\n message: `The kind property must be ${DataEntityKind}`,\n rule: 'invalid',\n })\n }\n if (messages.length) {\n throw new ValidationError(messages, { message: 'Invalid data entity definition.' })\n }\n }\n\n toJSON(): IDataEntity {\n const result: IDataEntity = {\n kind: DataEntityKind,\n key: this.key,\n info: this.info.toJSON(),\n }\n if (Array.isArray(this.tags) && this.tags.length) {\n result.tags = [...this.tags]\n }\n if (Array.isArray(this.taxonomy) && this.taxonomy.length) {\n result.taxonomy = [...this.taxonomy]\n }\n if (Array.isArray(this.parents) && this.parents.length) {\n result.parents = [...this.parents]\n }\n if (Array.isArray(this.properties) && this.properties.length) {\n result.properties = this.properties.map((i) => i.key)\n }\n if (Array.isArray(this.associations) && this.associations.length) {\n result.associations = this.associations.map((i) => i.key)\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 = [...this.taxonomy]\n }\n if (Array.isArray(this.tags) && this.tags.length) {\n result.tags = [...this.tags]\n }\n if (typeof this.deprecated === 'boolean') {\n result.deprecated = this.deprecated\n }\n return result\n }\n\n protected _readAssociation(key: string): DataAssociation | undefined {\n return this.root.definitions.associations.find((i) => i.key === key)\n }\n\n protected _readProperty(key: string): DataProperty | undefined {\n return this.root.definitions.properties.find((i) => i.key === key)\n }\n\n /**\n * Creates a property with a passed type.\n * @param type The type of the property\n * @returns The created property\n */\n addTypedProperty(type: DataPropertyType, name?: string): DataProperty {\n const property = DataProperty.fromType(this.root, type)\n if (name) {\n property.info.name = name\n }\n this.root.definitions.properties.push(property)\n this.properties.push(property)\n this.fields.push({ type: 'property', key: property.key })\n return property\n }\n\n /**\n * Creates a property with a passed type.\n * @param name The name of the property.\n * @returns The created property\n */\n addNamedProperty(name: string): DataProperty {\n const property = DataProperty.fromName(this.root, name)\n this.root.definitions.properties.push(property)\n this.properties.push(property)\n this.fields.push({ type: 'property', key: property.key })\n return property\n }\n\n /**\n * Removes the property from the entity and namespace definitions.\n * @param key The key of the property to remove.\n */\n removeProperty(key: string): void {\n const thisIndex = this.properties.findIndex((i) => i.key === key)\n if (thisIndex < 0) {\n throw new RemovePropertyException(`Trying to remove the ${key} property, but it doesn't exist.`)\n }\n const propertyToRemove = this.properties[thisIndex]\n this.properties.splice(thisIndex, 1)\n const defIndex = this.root.definitions.properties.findIndex((i) => i.key === key)\n if (defIndex >= 0) {\n this.root.definitions.properties.splice(defIndex, 1)\n }\n this.removeField(key)\n propertyToRemove.remove()\n }\n\n private removeField(key: string): void {\n this.fields = this.fields.filter((item) => item.key !== key)\n }\n\n /**\n * Lists all properties for this Entity.\n * @returns The list of properties that belong to this entity.\n */\n listProperties(): DataProperty[] {\n return [...this.properties]\n }\n\n /**\n * Lists all associations for this Entity.\n * @returns The list of associations that belong to this entity.\n */\n listAssociations(): DataAssociation[] {\n return [...this.associations]\n }\n\n /**\n * Generates an ordered list of fields (properties and associations) for this entity.\n *\n * @returns The list of fields (properties and associations) that belong to this entity.\n */\n listFields(): (DataAssociation | DataProperty)[] {\n const result: (DataAssociation | DataProperty)[] = []\n this.fields.forEach((i) => {\n if (i.type === 'property') {\n const property = this.properties.find((p) => p.key === i.key)\n if (property) {\n result.push(property)\n }\n } else if (i.type === 'association') {\n const association = this.associations.find((a) => a.key === i.key)\n if (association) {\n result.push(association)\n }\n }\n })\n return result\n }\n\n /**\n * Moves the field to a new index.\n * @param key The key of the field to move.\n * @param toIndex The new index to which move the field to.\n */\n moveField(key: string, toIndex: number): void {\n const fromIndex = this.fields.findIndex((i) => i.key === key)\n if (fromIndex < 0) {\n throw new ValidationError([{ field: 'fields', message: `Field ${key} not found.`, rule: 'not-found' }])\n }\n if (toIndex < 0 || toIndex >= this.fields.length) {\n throw new ValidationError([{ field: 'fields', message: `Invalid index ${toIndex}.`, rule: 'invalid' }])\n }\n const [item] = this.fields.splice(fromIndex, 1)\n this.fields.splice(toIndex, 0, item)\n }\n\n /**\n * Creates an association for a given name, adds it to definitions, and returns it.\n * @param name The name of the association\n * @returns The created association\n */\n addNamedAssociation(name: string): DataAssociation {\n const result = DataAssociation.fromName(this.root, name)\n this.root.definitions.associations.push(result)\n this.associations.push(result)\n this.fields.push({ type: 'association', key: result.key })\n return result\n }\n\n /**\n * Creates an association for a given target, adds it to definitions, and returns it.\n *\n * @param target The target entity key of the association\n * @param namespace The target entity namespace when different to the current namespace.\n * @param name Optional name.\n * @returns The created association\n */\n addTargetAssociation(target: string | DataEntity, name?: string): DataAssociation {\n let key: string\n if (typeof target === 'string') {\n key = target\n } else {\n key = target.key\n }\n const result = DataAssociation.fromTarget(this.root, key)\n if (name) {\n result.info.name = name\n }\n this.root.definitions.associations.push(result)\n this.associations.push(result)\n this.fields.push({ type: 'association', key: result.key })\n return result\n }\n\n /**\n * Creates an association for a given target that is in another namespace\n * @param target The target entity key of the association\n * @param namespace The target entity namespace when different to the current namespace.\n * @param name Optional name.\n * @returns The created association\n */\n addForeignAssociation(target: string | DataEntity, namespace: string, name?: string): DataAssociation {\n let key: string\n if (typeof target === 'string') {\n key = target\n } else {\n key = target.key\n }\n if (!this.root.hasForeignNamespace(namespace)) {\n throw new ForeignAssociationException(\n `Trying to add a foreign association but the foreign namespace is not defined.`\n )\n }\n const result = DataAssociation.fromTarget(this.root, key, namespace)\n if (name) {\n result.info.name = name\n }\n this.root.definitions.associations.push(result)\n this.associations.push(result)\n this.fields.push({ type: 'association', key: result.key })\n return result\n }\n\n /**\n * Removes an association from the entity and, namespace definitions.\n * @param key The key of the association to remove.\n */\n removeAssociation(key: string): void {\n const thisIndex = this.associations.findIndex((i) => i.key === key)\n if (thisIndex < 0) {\n // return\n throw new RemoveAssociationException(`Trying to remove the ${key} association, but it doesn't exist.`)\n }\n const associationToRemove = this.associations[thisIndex]\n this.associations.splice(thisIndex, 1)\n const defIndex = this.root.definitions.associations.findIndex((i) => i.key === key)\n if (defIndex >= 0) {\n this.root.definitions.associations.splice(defIndex, 1)\n }\n this.removeField(key)\n associationToRemove.remove()\n }\n\n /**\n * Reads the list of parents for the entity, inside the root namespace. The computed list contains the list of all\n * parents in the inheritance chain in no particular order.\n * @param recursive Whether to include parent parents as well.\n */\n getComputedParents(recursive?: boolean): DataEntity[] {\n const { entities } = this.root.definitions\n let result: DataEntity[] = []\n this.parents.forEach((key) => {\n const parent = entities.find((i) => i.key === key)\n if (parent) {\n result.push(parent)\n if (recursive) {\n result = result.concat(parent.getComputedParents())\n }\n }\n })\n return result\n }\n\n /**\n * Computes list of all children, inside the root namespace, that extends this entity.\n * The children are not ordered.\n */\n getComputedChildren(): DataEntity[] {\n const { entities } = this.root.definitions\n return entities.filter((i) => i.parents.includes(this.key))\n }\n\n /**\n * Computes a list of entities that are associated with the current entity.\n */\n getComputedAssociations(): DataEntity[] {\n const { associations } = this\n const result: DataEntity[] = []\n associations.forEach((assoc) => {\n if (!assoc.targets.length) {\n return\n }\n const entities = this.root.findAssociatedEntities(assoc.targets)\n entities.forEach((entity) => {\n if (entity) {\n result.push(entity)\n }\n })\n })\n return result\n }\n\n /**\n * Removes self from the namespace with all properties and attributes.\n */\n remove(): void {\n const { key, properties, associations, root } = this\n // check if some entity has reference to this entity as a target\n const associationsToEntity = this.root.definitions.associations.filter((a) =>\n a.targets.some((t) => t.key === this.key)\n )\n if (associationsToEntity.length > 0) {\n const entitiesNames = associationsToEntity.reduce<string[]>((acc, association) => {\n const entity = root.definitions.entities.find((e) => e.associations.includes(association))\n if (entity) {\n acc.push(entity.info.name as string)\n }\n return acc\n }, [])\n throw new RemoveEntityException(\n `Cannot remove entity ${this.info.name} because it is used as a target in associations in entities: ${entitiesNames.join(', ')}.`\n )\n }\n\n // remove own stuff\n properties.forEach((p) => this.removeProperty(p.key))\n associations.forEach((a) => this.removeAssociation(a.key))\n // remove from the root\n const index = root.definitions.entities.findIndex((i) => i.key === key)\n if (index >= 0) {\n root.definitions.entities.splice(index, 1)\n }\n // remove from the parent\n const model = this.getParent()\n if (model) {\n const entityIndex = model.entities.findIndex((e) => e === this)\n model.entities.splice(entityIndex, 1)\n }\n }\n\n /**\n * Returns a parent data model where this entity exist.\n */\n getParent(): DataModel | undefined {\n return this.root.definitions.models.find((m) => m.entities.some((e) => e === this))\n }\n\n /**\n * Adds a parent reference to this entity.\n * This will not add the parent to the namespace. It only adds a reference to the parent.\n * @param key The key of the parent entity to add.\n * @returns `this` for chaining.\n */\n addParent(key: string): this {\n // Prevent adding self as parent\n if (key === 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 // check if parent exists\n const parent = this.root.definitions.entities.find((i) => i.key === key)\n if (!parent) {\n const message = `Entity with key \"${key}\" not found.`\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'not-exists',\n },\n ],\n { message }\n )\n }\n // Check for circular inheritance\n if (this.hasCircularParent(key)) {\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 const has = this.parents.some((i) => i === key)\n if (has) {\n const message = `Parent ${key} already exists.`\n throw new ValidationError(\n [\n {\n field: 'parents',\n message,\n rule: 'exists',\n },\n ],\n { message }\n )\n }\n this.parents.push(key)\n return this\n }\n\n /**\n * Checks if the entity has a circular parent relationship when attempting to add a new parent.\n * @param key The key of the parent being added.\n * @returns true if adding this parent would create a circular relationship.\n */\n hasCircularParent(key: string): boolean {\n const { entities } = this.root.definitions\n // Check if new parent is one of the children.\n const children = this.getComputedChildren()\n if (children.some((c) => c.key === key)) {\n return true\n }\n // check if this entity is in parents chain.\n let current: DataEntity | undefined = entities.find((e) => e.key === key)\n while (current) {\n if (current.key === this.key) {\n return true\n }\n // for (const parentKey of current.parents) {\n // current = parentKey ? entities.find((e) => e.key === parentKey) : undefined\n // }\n const parentKey = current.parents[0] // Assuming single inheritance\n current = parentKey ? entities.find((e) => e.key === parentKey) : undefined\n }\n return false\n }\n\n /**\n * Tests whether one entity is associated with another.\n *\n * @param entity1 The source entity\n * @param entity2 The target entity\n * @returns true when there's any path from one entity to another.\n */\n static isAssociated(entity1: DataEntity, entity2: DataEntity): boolean {\n return entity1.isAssociated(entity2.key)\n }\n\n /**\n * Tests whether this entity is somehow associated with another entity.\n * @param target The key of the target entity to test for association with.\n * @returns true if this entity has any association to the `target` entity.\n */\n isAssociated(target: string): boolean {\n const it = this.associationPath(target)\n const path = it.next().value\n return !!path\n }\n\n /**\n * Prints out all associations from one entity to another through all entities that may be in between.\n * @param toEntity The key to the target entity\n * @yields The path containing keys of entities from this entity to the `toEntity`\n * (inclusive) and all entities in between.\n */\n *associationPath(toEntity: string): Generator<string[]> {\n const graph = this.root.associationGraph()\n for (const path of this.root.associationPath(this.key, toEntity, graph)) {\n yield path\n }\n }\n\n /**\n * Returns a list of entities that are associated with this entity as a target.\n *\n * This method identifies entities that have an association where this entity is a target.\n * In other words, it finds entities that \"point to\" this entity through an association.\n *\n * For example, consider the following relationships:\n *\n * ```plain\n * A -> B (A has an association that targets B)\n * C -> B (C has an association that targets B)\n * B -> D (B has an association that targets D)\n *\n * Calling `getRelatedEntities()` on B would return [A, C]\n * Calling `getRelatedEntities()` on D would return [B]\n * Calling `getRelatedEntities()` on A would return []\n * ```\n *\n * Note, this method only returns entities that are directly associated with this entity as a target.\n * It does not traverse the association graph to find indirectly related entities.\n *\n * @returns An array of `DataEntity` instances that have an association targeting this entity.\n */\n getRelatedEntities(): DataEntity[] {\n const { key, root } = this\n const result = DataEntity.getRelatedEntities(root, key)\n root.foreign.forEach((ns) => {\n const other = DataEntity.getRelatedEntities(ns, key)\n other.forEach((entity) => {\n if (!result.includes(entity)) {\n result.push(entity)\n }\n })\n })\n return result\n }\n\n static getRelatedEntities(namespace: DataNamespace, entityKey: string): DataEntity[] {\n const result: DataEntity[] = []\n const inverse = namespace.definitions.associations.filter((i) => i.targets.some((j) => j.key === entityKey))\n inverse.forEach((assoc) => {\n const entity = namespace.definitions.entities.find((e) => e.associations.includes(assoc))\n if (entity && !result.includes(entity)) {\n result.push(entity)\n }\n })\n return result\n }\n\n /**\n * Creates breadcrumbs from this entity to the root namespace.\n */\n breadcrumbs(): FileBreadcrumb[] {\n const result: FileBreadcrumb[] = []\n result.push({\n key: this.key,\n name: this.info.name || 'Unnamed entity',\n kind: DataEntityKind,\n })\n const model = this.getParent()\n if (model) {\n result.push({\n key: model.key,\n kind: model.kind,\n name: model.info.name || 'Unnamed data model',\n })\n let parent = model.getParent()\n while (parent && parent !== this.root) {\n result.push({\n key: parent.key,\n kind: parent.kind,\n name: parent.info.name || 'Unnamed namespace',\n })\n parent = parent.getParent()\n }\n }\n result.push({\n key: this.root.key,\n name: this.root.info.name || 'Unnamed namespace',\n kind: this.root.kind,\n })\n return result.reverse()\n }\n\n /**\n * Adds a new tag to the property. It also populates the root namespace's tags when tag is new.\n *\n * Note, it does nothing when the tag is already defined.\n *\n * @param tag The tag to add.\n */\n addTag(tag: string): void {\n if (!tag) {\n return\n }\n const lower = tag.toLowerCase()\n const { tags } = this\n if (tags.some((t) => t.toLowerCase() === lower)) {\n return\n }\n tags.push(tag)\n const { definitions } = this.root\n if (!definitions.tags.some((t) => t.toLowerCase() === lower)) {\n definitions.tags.push(tag)\n }\n }\n\n /**\n * Removes a tag from the property. Unlike the `addTag()` this won't remove a `tag` from the root namespace.\n *\n * @param tag The tag to remove.\n */\n removeTag(tag: string): void {\n if (!tag) {\n return\n }\n const lower = tag.toLowerCase()\n const { tags } = this\n const index = tags.findIndex((t) => t.toLowerCase() === lower)\n if (index >= 0) {\n tags.splice(index, 1)\n }\n }\n\n /**\n * Creates a Shape of AMF.\n * The property itself is auto-generated. If the `schema` is defined then it is used\n * as the `range` of the property. Otherwise basic shape is generated for the range.\n *\n * This is a preferred way of reading the AMF shape as this synchronizes changed\n * data properties with the shape definition.\n *\n * @returns AMF property shape definition.\n */\n toApiShape(): IShapeUnion {\n const serializer = new AmfShapeGenerator()\n return serializer.entity(this)\n }\n\n /**\n * Reads the schema of the Entity and generates an example for it.\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 hasClosedCycle(rootEntity: string, targetEntity: string): boolean {\n if (targetEntity === this.key) {\n // self association\n return true\n }\n const g = this.root.associationGraph()\n const selfPaths: string[][] = []\n const targetPaths: string[][] = []\n for (const path of this.root.associationPath(rootEntity, this.key, g)) {\n selfPaths.push(path)\n }\n for (const path of this.root.associationPath(targetEntity, this.key, g)) {\n targetPaths.push(path)\n }\n const checker = (arr: string[], target: string[]): boolean => target.every((v) => arr.includes(v))\n for (const sp of selfPaths) {\n for (const tp of targetPaths) {\n const result = checker(sp, tp)\n if (result) {\n return result\n }\n }\n }\n return false\n }\n}\n"]}
@@ -11,8 +11,16 @@ export declare enum DataPropertyList {
11
11
  time = "time",
12
12
  file = "binary"
13
13
  }
14
+ /**
15
+ * The data property "attributes".
16
+ */
14
17
  export type DataPropertyAttribute = 'required' | 'multiple' | 'primary' | 'index' | 'readOnly' | 'writeOnly' | 'deprecated';
15
18
  export declare const DataPropertyAttributes: DataPropertyAttribute[];
19
+ /**
20
+ * The data attribute "attributes".
21
+ */
22
+ export type DataAttributeAttribute = 'required' | 'multiple';
23
+ export declare const DataAttributeAttributes: DataAttributeAttribute[];
16
24
  /**
17
25
  * Note, OAS supports the `integer` data type and not format.
18
26
  * We need to account for that.
@@ -1 +1 @@
1
- {"version":3,"file":"DataFormat.d.ts","sourceRoot":"","sources":["../../../src/modeling/DataFormat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAA;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,QAAQ,GAER,SAAS,GACT,MAAM,GACN,UAAU,GACV,MAAM,GAEN,QAAQ,CAAA;AACZ,eAAO,MAAM,iBAAiB,EAAE,gBAAgB,EAoB/C,CAAA;AAED,oBAAY,gBAAgB;IAC1B,MAAM,WAAW;IACjB,MAAM,WAAW;IAEjB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,IAAI,SAAS;IAEb,IAAI,WAAW;CAChB;AAED,MAAM,MAAM,qBAAqB,GAC7B,UAAU,GACV,UAAU,GACV,SAAS,GACT,OAAO,GACP,UAAU,GACV,WAAW,GACX,YAAY,CAAA;AAEhB,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EAQzD,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,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YAAY,GAAG,uBAAuB,CAkGpF"}
@@ -40,6 +40,7 @@ export const DataPropertyAttributes = [
40
40
  'writeOnly',
41
41
  'deprecated',
42
42
  ];
43
+ export const DataAttributeAttributes = ['required', 'multiple'];
43
44
  export const NumberFormats = ['float', 'double', 'int32', 'int64'];
44
45
  export const BinaryFormats = ['hex', 'base64'];
45
46
  export function getFormatInfo(format) {
@@ -1 +1 @@
1
- {"version":3,"file":"DataFormat.js","sourceRoot":"","sources":["../../../src/modeling/DataFormat.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,iBAAiB,GAAuB;IACnD,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,SAAS;IACT;;;;OAIG;IACH,MAAM;IACN;;;;OAIG;IACH,UAAU;IACV,MAAM;IACN,SAAS;IACT,QAAQ;CACT,CAAA;AAED,MAAM,CAAN,IAAY,gBAUX;AAVD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;IACjB,eAAe;IACf,uCAAmB,CAAA;IACnB,iCAAa,CAAA;IACb,yCAAqB,CAAA;IACrB,iCAAa,CAAA;IACb,eAAe;IACf,mCAAe,CAAA;AACjB,CAAC,EAVW,gBAAgB,KAAhB,gBAAgB,QAU3B;AAWD,MAAM,CAAC,MAAM,sBAAsB,GAA4B;IAC7D,UAAU;IACV,UAAU;IACV,SAAS;IACT,OAAO;IACP,UAAU;IACV,WAAW;IACX,YAAY;CACb,CAAA;AAaD,MAAM,CAAC,MAAM,aAAa,GAAmB,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;AAQlF,MAAM,CAAC,MAAM,aAAa,GAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AAI9D,MAAM,UAAU,aAAa,CAAC,MAA0B;IACtD,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QACvB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,6BAA6B,EAAE,CAAA;I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AAE,CAAC;QAC9B,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAA;QACtB,MAAM,CAAC,IAAI,GAAG,CAAC,CAAA;QACf,MAAM,CAAC,IAAI,GAAG,wCAAwC,CAAA;QACtD,MAAM,CAAC,GAAG,GAAG,CAAC,UAAU,CAAA;QACxB,MAAM,CAAC,GAAG,GAAG,UAAU,CAAA;QACvB,OAAO,MAAM,CAAA;IACf,CAAC;SAAM,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAA;QACtB,MAAM,CAAC,IAAI,GAAG,CAAC,CAAA;QACf,MAAM,CAAC,IAAI,GAAG,qCAAqC,CAAA;QACnD,OAAO,MAAM,CAAA;IACf,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import type { TextFieldType } from '@material/web/textfield/outlined-text-field.js'\nimport type { DataProperty } from './DataProperty.js'\n\nexport type DataPropertyType =\n | 'string'\n | 'number'\n // | 'nil'\n | 'boolean'\n | 'date'\n | 'datetime'\n | 'time'\n // | 'any'\n | 'binary'\nexport const DataPropertyTypes: DataPropertyType[] = [\n 'string',\n 'number',\n // 'nil',\n 'boolean',\n /**\n * full-date notation as defined by RFC 3339, section 5.6, for example, 2017-07-21\n *\n * @see {@link https://tools.ietf.org/html/rfc3339#section-5.6}\n */\n 'date',\n /**\n * the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z\n *\n * @see {@link https://tools.ietf.org/html/rfc3339#section-5.6}\n */\n 'datetime',\n 'time',\n // 'any',\n 'binary',\n]\n\nexport enum DataPropertyList {\n string = 'string',\n number = 'number',\n // nil = 'nil',\n boolean = 'boolean',\n date = 'date',\n datetime = 'datetime',\n time = 'time',\n // any = 'any',\n file = 'binary',\n}\n\nexport type DataPropertyAttribute =\n | 'required'\n | 'multiple'\n | 'primary'\n | 'index'\n | 'readOnly'\n | 'writeOnly'\n | 'deprecated'\n\nexport const DataPropertyAttributes: DataPropertyAttribute[] = [\n 'required',\n 'multiple',\n 'primary',\n 'index',\n 'readOnly',\n 'writeOnly',\n 'deprecated',\n]\n\n/**\n * Note, OAS supports the `integer` data type and not format.\n * We need to account for that.\n *\n * - `float` - 32-bit floating point numbers\n * - `double` - 64-bit floating point numbers\n * - `int32` - Signed 32 bit number\n * - `int64` - Signed 64 bit number (OAS `long`)\n */\nexport type NumberFormat = 'float' | 'double' | 'int32' | 'int64'\n\nexport const NumberFormats: NumberFormat[] = ['float', 'double', 'int32', 'int64']\n\n/**\n * - `hex` - Hex-encoded binary data\n * - `base64` - Base64-encoded binary data\n */\nexport type BinaryFormat = 'hex' | 'base64'\n\nexport const BinaryFormats: BinaryFormat[] = ['hex', 'base64']\n\nexport type DataPropertyFormat = NumberFormat | BinaryFormat\n\nexport function getFormatInfo(format: DataPropertyFormat): { label: string; help: string } {\n if (format === 'float') {\n return { label: 'Float', help: '32-bit number with decimals' }\n }\n if (format === 'double') {\n return { label: 'Double', help: '64-bit number with decimals' }\n }\n if (format === 'int32') {\n return { label: 'Integer (32-bit)', help: '-2,147,483,648…+2,147,483,647' }\n }\n if (format === 'int64') {\n return { label: 'Integer (64-bit)', help: 'Negative or positive 64-bit integer' }\n }\n if (format === 'hex') {\n return { label: 'Hex', help: 'Hex-encoded binary data' }\n }\n if (format === 'base64') {\n return { label: 'Base64', help: 'Base64-encoded binary data' }\n }\n return { label: 'Unknown', help: 'An error occured...' }\n}\n\nexport interface DataPropertyInputConfig {\n /**\n * The input's type\n */\n type: TextFieldType\n /**\n * The `pattern` to set on the input.\n */\n pattern?: string\n /**\n * The `min` to set on the input.\n */\n min?: number\n /**\n * The `max` to set on the input.\n */\n max?: number\n /**\n * The `step` to set on the input.\n */\n step?: number\n /**\n * The `supportingText` to set on the Material Text Field.\n */\n help?: string\n}\n\n/**\n * Gathers information about the HTML input's requirements for the given DataProperty.\n *\n * @param model The data property model to gather HTML input's configuration for.\n * @returns Input attributes to set.\n */\nexport function getPropertyInputOptions(model: DataProperty): DataPropertyInputConfig {\n const result: DataPropertyInputConfig = { type: 'text' }\n const wb = model.getWebBinding()\n if (!wb) {\n return result\n }\n const format = wb.format\n // if (format === 'no-tz') {\n // result.pattern = '^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{3}$'\n // result.help = 'yyyy-mm-ddThh:mm:ss.sss'\n // } else if (format === 'utc') {\n // result.pattern = '^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{3}Z$'\n // result.help = 'yyyy-mm-ddThh:mm:ss.sssZ'\n // } else if (format === 'offset') {\n // result.pattern = '^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{3}[+-]\\\\d{2}$'\n // result.help = 'yyyy-mm-ddThh:mm:ss.sss±hh'\n // } else if (format === 'time-offset') {\n // result.pattern = '^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{3}[+-]\\\\d{2}:\\\\d{2}$'\n // result.help = 'yyyy-mm-ddThh:mm:ss.sss±hh:mm'\n // } else if (format === 'timestamp') {\n // result.type = 'number'\n // result.min = 0\n // result.step = 1\n // result.help = `Example: ${Date.now()}`\n // } else if (format === 'integer') {\n // result.type = 'number'\n // result.step = 1\n // result.help = 'Arbitrary-size integer numbers'\n // } else if (format === 'decimal') {\n // result.type = 'number'\n // result.step = 0.01\n // result.help = 'Arbitrary-precision decimal numbers'\n // } else if (format === 'double') {\n // else if (format === 'byte') {\n // result.type = 'number'\n // result.step = 1\n // result.help = '-128…+127 (8 bit)'\n // result.min = -128\n // result.max = 127\n // } else if (format === 'short') {\n // result.type = 'number'\n // result.step = 1\n // result.help = '-32,768…+32,767 (16 bit)'\n // result.min = -32768\n // result.max = 32767\n // }\n // else if (format === 'long') {\n // result.type = 'number'\n // result.step = 1\n // result.help = 'Signed 64 bit number'\n // } else if (format === 'unsignedByte') {\n // result.type = 'number'\n // result.step = 1\n // result.help = '0…255 (8 bit)'\n // result.min = 0\n // result.max = 255\n // } else if (format === 'unsignedShort') {\n // result.type = 'number'\n // result.step = 1\n // result.help = '0…65,535 (16 bit)'\n // result.min = 0\n // result.max = 65535\n // } else if (format === 'unsignedInt') {\n // result.type = 'number'\n // result.step = 1\n // result.help = '0…4,294,967,295 (32 bit)'\n // result.min = 0\n // result.max = 4294967295\n // } else if (format === 'unsignedLong') {\n // result.type = 'number'\n // result.step = 1\n // result.help = 'Unsigned 64 bit number'\n // }\n if (format === 'float') {\n result.type = 'number'\n result.step = 0.000001\n result.help = '32-bit number with decimals'\n return result\n }\n if (format === 'double') {\n result.type = 'number'\n result.step = 0.000001\n result.help = '64-bit number with decimals'\n return result\n } else if (format === 'int32') {\n result.type = 'number'\n result.step = 1\n result.help = '-2,147,483,648…+2,147,483,647 (32 bit)'\n result.min = -2147483648\n result.max = 2147483647\n return result\n } else if (format === 'int64') {\n result.type = 'number'\n result.step = 1\n result.help = 'Negative or positive 64-bit integer'\n return result\n }\n return result\n}\n"]}
1
+ {"version":3,"file":"DataFormat.js","sourceRoot":"","sources":["../../../src/modeling/DataFormat.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,iBAAiB,GAAuB;IACnD,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,SAAS;IACT;;;;OAIG;IACH,MAAM;IACN;;;;OAIG;IACH,UAAU;IACV,MAAM;IACN,SAAS;IACT,QAAQ;CACT,CAAA;AAED,MAAM,CAAN,IAAY,gBAUX;AAVD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;IACjB,eAAe;IACf,uCAAmB,CAAA;IACnB,iCAAa,CAAA;IACb,yCAAqB,CAAA;IACrB,iCAAa,CAAA;IACb,eAAe;IACf,mCAAe,CAAA;AACjB,CAAC,EAVW,gBAAgB,KAAhB,gBAAgB,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mB;IACnB,4BAA4B;IAC5B,0CAA0C;IAC1C,2BAA2B;IAC3B,oBAAoB;IACpB,2CAA2C;IAC3C,IAAI;IACJ,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QACvB,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAA;QACtB,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAA;QACtB,MAAM,CAAC,IAAI,GAAG,6BAA6B,CAAA;QAC3C,OAAO,MAAM,CAAA;IACf,CAAC;IACD,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QACxB,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAA;QACtB,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAA;QACtB,MAAM,CAAC,IAAI,GAAG,6BAA6B,CAAA;QAC3C,OAAO,MAAM,CAAA;IACf,CAAC;SAAM,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAA;QACtB,MAAM,CAAC,IAAI,GAAG,CAAC,CAAA;QACf,MAAM,CAAC,IAAI,GAAG,wCAAwC,CAAA;QACtD,MAAM,CAAC,GAAG,GAAG,CAAC,UAAU,CAAA;QACxB,MAAM,CAAC,GAAG,GAAG,UAAU,CAAA;QACvB,OAAO,MAAM,CAAA;IACf,CAAC;SAAM,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAA;QACtB,MAAM,CAAC,IAAI,GAAG,CAAC,CAAA;QACf,MAAM,CAAC,IAAI,GAAG,qCAAqC,CAAA;QACnD,OAAO,MAAM,CAAA;IACf,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import type { TextFieldType } from '@material/web/textfield/outlined-text-field.js'\nimport type { DataProperty } from './DataProperty.js'\n\nexport type DataPropertyType =\n | 'string'\n | 'number'\n // | 'nil'\n | 'boolean'\n | 'date'\n | 'datetime'\n | 'time'\n // | 'any'\n | 'binary'\nexport const DataPropertyTypes: DataPropertyType[] = [\n 'string',\n 'number',\n // 'nil',\n 'boolean',\n /**\n * full-date notation as defined by RFC 3339, section 5.6, for example, 2017-07-21\n *\n * @see {@link https://tools.ietf.org/html/rfc3339#section-5.6}\n */\n 'date',\n /**\n * the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z\n *\n * @see {@link https://tools.ietf.org/html/rfc3339#section-5.6}\n */\n 'datetime',\n 'time',\n // 'any',\n 'binary',\n]\n\nexport enum DataPropertyList {\n string = 'string',\n number = 'number',\n // nil = 'nil',\n boolean = 'boolean',\n date = 'date',\n datetime = 'datetime',\n time = 'time',\n // any = 'any',\n file = 'binary',\n}\n\n/**\n * The data property \"attributes\".\n */\nexport type DataPropertyAttribute =\n | 'required'\n | 'multiple'\n | 'primary'\n | 'index'\n | 'readOnly'\n | 'writeOnly'\n | 'deprecated'\n\nexport const DataPropertyAttributes: DataPropertyAttribute[] = [\n 'required',\n 'multiple',\n 'primary',\n 'index',\n 'readOnly',\n 'writeOnly',\n 'deprecated',\n]\n\n/**\n * The data attribute \"attributes\".\n */\nexport type DataAttributeAttribute = 'required' | 'multiple'\n\nexport const DataAttributeAttributes: DataAttributeAttribute[] = ['required', 'multiple']\n\n/**\n * Note, OAS supports the `integer` data type and not format.\n * We need to account for that.\n *\n * - `float` - 32-bit floating point numbers\n * - `double` - 64-bit floating point numbers\n * - `int32` - Signed 32 bit number\n * - `int64` - Signed 64 bit number (OAS `long`)\n */\nexport type NumberFormat = 'float' | 'double' | 'int32' | 'int64'\n\nexport const NumberFormats: NumberFormat[] = ['float', 'double', 'int32', 'int64']\n\n/**\n * - `hex` - Hex-encoded binary data\n * - `base64` - Base64-encoded binary data\n */\nexport type BinaryFormat = 'hex' | 'base64'\n\nexport const BinaryFormats: BinaryFormat[] = ['hex', 'base64']\n\nexport type DataPropertyFormat = NumberFormat | BinaryFormat\n\nexport function getFormatInfo(format: DataPropertyFormat): { label: string; help: string } {\n if (format === 'float') {\n return { label: 'Float', help: '32-bit number with decimals' }\n }\n if (format === 'double') {\n return { label: 'Double', help: '64-bit number with decimals' }\n }\n if (format === 'int32') {\n return { label: 'Integer (32-bit)', help: '-2,147,483,648…+2,147,483,647' }\n }\n if (format === 'int64') {\n return { label: 'Integer (64-bit)', help: 'Negative or positive 64-bit integer' }\n }\n if (format === 'hex') {\n return { label: 'Hex', help: 'Hex-encoded binary data' }\n }\n if (format === 'base64') {\n return { label: 'Base64', help: 'Base64-encoded binary data' }\n }\n return { label: 'Unknown', help: 'An error occured...' }\n}\n\nexport interface DataPropertyInputConfig {\n /**\n * The input's type\n */\n type: TextFieldType\n /**\n * The `pattern` to set on the input.\n */\n pattern?: string\n /**\n * The `min` to set on the input.\n */\n min?: number\n /**\n * The `max` to set on the input.\n */\n max?: number\n /**\n * The `step` to set on the input.\n */\n step?: number\n /**\n * The `supportingText` to set on the Material Text Field.\n */\n help?: string\n}\n\n/**\n * Gathers information about the HTML input's requirements for the given DataProperty.\n *\n * @param model The data property model to gather HTML input's configuration for.\n * @returns Input attributes to set.\n */\nexport function getPropertyInputOptions(model: DataProperty): DataPropertyInputConfig {\n const result: DataPropertyInputConfig = { type: 'text' }\n const wb = model.getWebBinding()\n if (!wb) {\n return result\n }\n const format = wb.format\n // if (format === 'no-tz') {\n // result.pattern = '^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{3}$'\n // result.help = 'yyyy-mm-ddThh:mm:ss.sss'\n // } else if (format === 'utc') {\n // result.pattern = '^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{3}Z$'\n // result.help = 'yyyy-mm-ddThh:mm:ss.sssZ'\n // } else if (format === 'offset') {\n // result.pattern = '^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{3}[+-]\\\\d{2}$'\n // result.help = 'yyyy-mm-ddThh:mm:ss.sss±hh'\n // } else if (format === 'time-offset') {\n // result.pattern = '^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{3}[+-]\\\\d{2}:\\\\d{2}$'\n // result.help = 'yyyy-mm-ddThh:mm:ss.sss±hh:mm'\n // } else if (format === 'timestamp') {\n // result.type = 'number'\n // result.min = 0\n // result.step = 1\n // result.help = `Example: ${Date.now()}`\n // } else if (format === 'integer') {\n // result.type = 'number'\n // result.step = 1\n // result.help = 'Arbitrary-size integer numbers'\n // } else if (format === 'decimal') {\n // result.type = 'number'\n // result.step = 0.01\n // result.help = 'Arbitrary-precision decimal numbers'\n // } else if (format === 'double') {\n // else if (format === 'byte') {\n // result.type = 'number'\n // result.step = 1\n // result.help = '-128…+127 (8 bit)'\n // result.min = -128\n // result.max = 127\n // } else if (format === 'short') {\n // result.type = 'number'\n // result.step = 1\n // result.help = '-32,768…+32,767 (16 bit)'\n // result.min = -32768\n // result.max = 32767\n // }\n // else if (format === 'long') {\n // result.type = 'number'\n // result.step = 1\n // result.help = 'Signed 64 bit number'\n // } else if (format === 'unsignedByte') {\n // result.type = 'number'\n // result.step = 1\n // result.help = '0…255 (8 bit)'\n // result.min = 0\n // result.max = 255\n // } else if (format === 'unsignedShort') {\n // result.type = 'number'\n // result.step = 1\n // result.help = '0…65,535 (16 bit)'\n // result.min = 0\n // result.max = 65535\n // } else if (format === 'unsignedInt') {\n // result.type = 'number'\n // result.step = 1\n // result.help = '0…4,294,967,295 (32 bit)'\n // result.min = 0\n // result.max = 4294967295\n // } else if (format === 'unsignedLong') {\n // result.type = 'number'\n // result.step = 1\n // result.help = 'Unsigned 64 bit number'\n // }\n if (format === 'float') {\n result.type = 'number'\n result.step = 0.000001\n result.help = '32-bit number with decimals'\n return result\n }\n if (format === 'double') {\n result.type = 'number'\n result.step = 0.000001\n result.help = '64-bit number with decimals'\n return result\n } else if (format === 'int32') {\n result.type = 'number'\n result.step = 1\n result.help = '-2,147,483,648…+2,147,483,647 (32 bit)'\n result.min = -2147483648\n result.max = 2147483647\n return result\n } else if (format === 'int64') {\n result.type = 'number'\n result.step = 1\n result.help = 'Negative or positive 64-bit integer'\n return result\n }\n return result\n}\n"]}
@@ -245,6 +245,12 @@ export declare class DataNamespace extends DataNamespaceParent {
245
245
  * @returns The property or undefined if not found.
246
246
  */
247
247
  findProperty(key: string): DataProperty | undefined;
248
+ /**
249
+ * Finds an association by its key.
250
+ * @param key The key of the property to find
251
+ * @returns The property or undefined if not found.
252
+ */
253
+ findAssociation(key: string): DataAssociation | undefined;
248
254
  /**
249
255
  * Searches for entities for association targets.
250
256
  * This is a helper function to discover entities in the current and foreign namespaces.
@@ -1 +1 @@
1
- {"version":3,"file":"DataNamespace.d.ts","sourceRoot":"","sources":["../../../src/modeling/DataNamespace.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC3F,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGrE,KAAK,QAAQ,GAAG,OAAO,iBAAiB,GAAG,OAAO,aAAa,CAAA;AAE/D,UAAU,gBAAgB;IACxB,MAAM,CAAC,EAAE,UAAU,EAAE,CAAA;IACrB,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAA;IACxB,UAAU,CAAC,EAAE,aAAa,EAAE,CAAA;IAC5B,YAAY,CAAC,EAAE,gBAAgB,EAAE,CAAA;IACjC,UAAU,CAAC,EAAE,cAAc,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
558
558
  return definitions.properties.find((i) => i.key === key);
559
559
  }
560
+ /**
561
+ * Finds an association by its key.
562
+ * @param key The key of the property to find
563
+ * @returns The property or undefined if not found.
564
+ */
565
+ findAssociation(key) {
566
+ const { definitions } = this.root || this;
567
+ return definitions.associations.find((i) => i.key === key);
568
+ }
560
569
  /**
561
570
  * Searches for entities for association targets.
562
571
  * This is a helper function to discover entities in the current and foreign namespaces.
@@ -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,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,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACrE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAsF/B,MAAM,mBAAmB;IACvB,IAAI,GAAG,iBAAiB,CAAA;IAExB,GAAG,GAAG,EAAE,CAAA;IAER;;OAEG;IACH,KAAK,GAAe,EAAE,CAAA;IAEtB;;OAEG;IACH,IAAI,GAAU,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAEhC;;;OAGG;IACH,IAAI,CAAgB;IAEpB,YAAY,IAAoB;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED;;OAEG;IACH,SAAS;QACP,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;QAC1B,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,MAAM,GAAI,IAAsB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;YACtD,IAAI,MA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AI,CAAC,SAAS,CAAC,CAAA;YACxB,CAAC;QACH,CAAC,CAAC,CAAA;QACF,OAAO,MAAM,CAAA;IACf,CAAC;IAED,UAAU,CAAC,EAAiB;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,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;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'\n\ntype ItemKind = typeof DataNamespaceKind | typeof DataModelKind\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 entities: DataEntity[]\n properties: DataProperty[]\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 foreigh 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\ninterface IDataNamespaceParent {\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\n/**\n * Data namespace is a logical description of the hierarchy in the data.\n */\nexport interface IDataNamespace extends IDataNamespaceParent {\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\nclass DataNamespaceParent {\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 constructor(root?: DataNamespace) {\n this.root = root\n }\n\n /**\n * @returns The parent namespace of this namespace. It returns `undefined` when this is the root namespace.\n */\n getParent(): DataNamespace | undefined {\n const { root, key } = this\n if (root) {\n const result = (root as DataNamespace).findParent(key)\n if (result === this.root) {\n return undefined\n }\n return result\n }\n // we are the root namespace.\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 */\n addNamespace(init: string | IDataNamespace | DataNamespace): DataNamespace {\n return (this.root as DataNamespace).addNamespace(init, this.key)\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(): 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())\n children.forEach((c) => c.remove())\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\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 extends DataNamespaceParent {\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 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 super(root)\n this.definitions = DataNamespace.definitions()\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 * 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 override 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 * 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 * 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 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"]}
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,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACrE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAyF/B,MAAM,mBAAmB;IACvB,IAAI,GAAG,iBAAiB,CAAA;IAExB,GAAG,GAAG,EAAE,CAAA;IAER;;OAEG;IACH,KAAK,GAAe,EAAE,CAAA;IAEtB;;OAEG;IACH,IAAI,GAAU,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAEhC;;;OAGG;IACH,IAAI,CAAgB;IAEpB,YAAY,IAAoB;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED;;OAEG;IACH,SAAS;QACP,MAAM,EAAE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","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'\n\ntype ItemKind = typeof DataNamespaceKind | typeof DataModelKind\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 foreigh 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\ninterface IDataNamespaceParent {\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\n/**\n * Data namespace is a logical description of the hierarchy in the data.\n */\nexport interface IDataNamespace extends IDataNamespaceParent {\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\nclass DataNamespaceParent {\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 constructor(root?: DataNamespace) {\n this.root = root\n }\n\n /**\n * @returns The parent namespace of this namespace. It returns `undefined` when this is the root namespace.\n */\n getParent(): DataNamespace | undefined {\n const { root, key } = this\n if (root) {\n const result = (root as DataNamespace).findParent(key)\n if (result === this.root) {\n return undefined\n }\n return result\n }\n // we are the root namespace.\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 */\n addNamespace(init: string | IDataNamespace | DataNamespace): DataNamespace {\n return (this.root as DataNamespace).addNamespace(init, this.key)\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(): 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())\n children.forEach((c) => c.remove())\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\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 extends DataNamespaceParent {\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 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 super(root)\n this.definitions = DataNamespace.definitions()\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 * 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 override 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 * 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 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"]}