@api-client/core 0.14.6 → 0.14.7

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":"DataDomain.js","sourceRoot":"","sources":["../../../src/modeling/DataDomain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,oBAAoB,CAAA;AAQ3B,OAAO,EAA8B,eAAe,EAA6B,MAAM,sBAAsB,CAAA;AAC7G,OAAO,EAA0B,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAItE,OAAO,EAAe,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAgBjG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,MAAM,OAAO,UAAW,SAAQ,WAAW;IACzC;;OAEG;IACH,IAAI,CAAuB;IAC3B;;OAEG;IACH,GAAG,CAAQ;IAEX;;OAEG;IACH,KAAK,CAAsD;IAE3D;;;;OAIG;IACH,YAAY,GAA4B,IAAI,GAAG,EAAsB,CAAA;IAErE;;OAEG;IACH,cAAc,GAA8B,EAAE,CAAA;IAE9C;;OAEG;IACH,IAAI,CAAO;IAEX;;;OAGG;IACH,aAAa,GAAG,IAAI,CAAA;IAEpB;;;;;OAKG;IACH,UAAU,GAAG,KAAK,CAAA;IAElB;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAA;IACb,CAAC;IAOD,yBAAuC;IALvC;;;;OAIG;IACH,IAAS,MAAM,4CAAwB;I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IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;YAC3C,OAAO,IAAoB,CAAA;QAC7B,CAAC;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,mBAAmB,CAAC,GAAW,EAAE,IAAY;QAC3C,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,mBAAmB;gBACtB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAA;gBACzB,MAAK;YACP,KAAK,eAAe;gBAClB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;gBACrB,MAAK;YACP,KAAK,gBAAgB;gBACnB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;gBACtB,MAAK;YACP,KAAK,kBAAkB;gBACrB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAA;gBACxB,MAAK;YACP,KAAK,qBAAqB;gBACxB,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAA;gBAC3B,MAAK;YACP;gBACE,MAAM,IAAI,KAAK,CAAC,gBAAgB,IAAI,mBAAmB,GAAG,EAAE,CAAC,CAAA;QACjE,CAAC;IACH,CAAC;CACF","sourcesContent":["import { nanoid } from '../nanoid.js'\nimport { Graph } from '@api-client/graph/graph/Graph.js'\nimport {\n DomainAssociationKind,\n DataDomainKind,\n DomainEntityKind,\n DomainModelKind,\n DomainNamespaceKind,\n DomainPropertyKind,\n} from '../models/kinds.js'\nimport type {\n AssociationAddOptions,\n DomainGraphEdge,\n DomainGraphNodeType,\n ForeignDomainDependency,\n SerializedGraph,\n} from './types.js'\nimport { type DomainNamespaceSchema, DomainNamespace, type NamespaceOrderedItem } from './DomainNamespace.js'\nimport { type DomainModelSchema, DomainModel } from './DomainModel.js'\nimport { type DomainEntitySchema, DomainEntity } from './DomainEntity.js'\nimport { DomainAssociation } from './DomainAssociation.js'\nimport { DomainProperty, DomainPropertySchema } from './DomainProperty.js'\nimport { type IThing, Thing } from '../models/Thing.js'\nimport { removeGraphNode } from './GraphUtils.js'\nimport { serialize, deserialize, mergeGraph, removeForeignGraph } from './DomainSerialization.js'\n\nexport interface DataDomainSchema {\n info: IThing\n kind: typeof DataDomainKind\n key: string\n graph?: SerializedGraph\n dependencyList?: ForeignDomainDependency[]\n /**\n * The ordered list of fields (namespace and models) in the schema.\n * These only keep references to define the order of these properties\n * in the schema as graph won't do it.\n */\n fields?: NamespaceOrderedItem[]\n}\n\n/**\n * Represents the root of a data domain model.\n *\n * The `DataDomain` class serves as the top-level container\n * for a collection of data models, namespaces, entities,\n * properties, and associations. It provides methods for\n * managing and manipulating these data elements, enabling\n * the creation of complex and interconnected data\n * structures.\n *\n * **Key Features:**\n *\n * - **Root Container:** Holds all data elements within a domain.\n * - **Graph-Based Structure:** Uses a graph to represent relationships between data elements.\n * - **Namespace Management:** Supports creating and managing namespaces to organize data models.\n * - **Data Model Management:** Supports creating and managing data models to group entities.\n * - **Entity Management:** Supports creating and managing entities, which define the structure of data.\n * - **Property Management:** Supports creating and managing properties, which define the data elements\n * within entities.\n * - **Association Management:** Supports creating and managing associations, which define relationships\n * between entities.\n * - **Foreign Domain Support:** Allows registering and integrating data from external domains.\n * - **Change Notification:** Notifies listeners when changes occur within the data domain.\n *\n * **Usage:**\n *\n * 1. Create an instance of the `DataDomain`.\n * 2. Use methods like `addNamespace()`, `addModel()`,\n * `addEntity()`, `addProperty()`, and `addAssociation()`\n * to build the data domain structure.\n * 3. Use methods like `findNamespace()`, `findModel()`,\n * `findEntity()`, `findProperty()`, and\n * `findAssociation()` to retrieve data elements.\n * 4. Use methods like `listNamespaces()`, `listGraphNamespaces()`, `listModels()`,\n * and `listEntities()` to iterate over collections of\n * data elements.\n * 5. Use `registerForeignDomain()` to integrate data from\n * external domains.\n * 6. Listen for the `change` event to be notified of\n * changes within the data domain.\n *\n * **Example:**\n *\n * ```typescript\n * const dataDomain = new DataDomain();\n * const userNamespace = dataDomain.addNamespace({\n * key: 'userNamespace',\n * });\n * const userModel = userNamespace.addModel({\n * key: 'userModel',\n * });\n * const userEntity = userModel.addEntity({\n * key: 'user',\n * });\n * const nameProperty = userEntity.addProperty({\n * key: 'name',\n * type: 'string',\n * });\n * ```\n *\n * @fires DataDomain#change {Event} - Fired when the data\n * domain changes.\n *\n * @todo: Implement a mechanism to move an entity to a new\n * parent model.\n */\nexport class DataDomain extends EventTarget {\n /**\n * The kind of the domain element.\n */\n kind: typeof DataDomainKind\n /**\n * The unique key of the domain element.\n */\n key: string\n\n /**\n * The graph used to store the data domain structure.\n */\n graph: Graph<unknown, DomainGraphNodeType, DomainGraphEdge>\n\n /**\n * A map of foreign data domains.\n * Key: The unique identifier of the foreign domain.\n * Value: The foreign DataDomain instance.\n */\n dependencies: Map<string, DataDomain> = new Map<string, DataDomain>()\n\n /**\n * The list of foreign domain dependencies.\n */\n dependencyList: ForeignDomainDependency[] = []\n\n /**\n * The description of the domain property.\n */\n info: Thing\n\n /**\n * When the initializing flag is set to true,\n * the domain is not notified of changes.\n */\n #initializing = true\n\n /**\n * When the notifying flag is set to true,\n * the domain is pending a notification.\n * No other notifications will be sent until\n * the current notification is sent.\n */\n #notifying = false\n\n /**\n * This is to keep it consistent with the domain elements.\n */\n get domain(): DataDomain {\n return this\n }\n\n /**\n * The ordered list of fields (namespace and models) in the schema.\n * These only keep references to define the order of these properties\n * in the schema as graph won't do it.\n */\n accessor fields: NamespaceOrderedItem[]\n\n static createSchema(input: Partial<DataDomainSchema> = {}): DataDomainSchema {\n const { key = nanoid(), fields } = input\n const info = Thing.fromJSON(input.info, { name: 'Unnamed domain' }).toJSON()\n const result: DataDomainSchema = {\n kind: DataDomainKind,\n key,\n info,\n }\n if (input.dependencyList) {\n result.dependencyList = structuredClone(input.dependencyList)\n }\n if (input.graph) {\n result.graph = input.graph\n }\n if (Array.isArray(fields)) {\n result.fields = [...fields]\n }\n return result\n }\n\n /**\n * Creates a new instance of the `DataDomain` class.\n *\n * When creating a new Data Domain arguments should not be set.\n * When restoring a Data Domain from a previous state, you should provide\n * the serialized graph state as well as the same list of dependencies\n * used when the graph was deserialized. Edges to missing dependency nodes\n * will be ignored.\n *\n * @param state The previously serialized state of the graph.\n * @param dependencies An array of foreign data domains to register with this domain.\n */\n constructor(state?: Partial<DataDomainSchema>, dependencies?: DataDomain[]) {\n super()\n const init = DataDomain.createSchema(state)\n this.kind = init.kind\n this.key = init.key\n this.info = new Thing(init.info)\n this.graph = deserialize(this, init.graph, dependencies)\n if (Array.isArray(init.fields)) {\n this.fields = [...init.fields]\n } else {\n this.fields = []\n }\n if (Array.isArray(init.dependencyList)) {\n this.dependencyList = [...init.dependencyList]\n } else {\n this.dependencyList = []\n }\n this.#initializing = false\n this.info.addEventListener('change', () => {\n this.notifyChange()\n })\n }\n\n /**\n * Serializes the DataDomain instance to a JSON object.\n * It does not serialize the foreign domain dependencies. The serialized nodes\n * are the ones that are local to this data domain.\n * @returns The serialized data domain ready for storage or transport.\n */\n toJSON(): DataDomainSchema {\n const result: DataDomainSchema = {\n info: this.info.toJSON(),\n kind: this.kind,\n key: this.key,\n graph: serialize(this.graph, this.key),\n }\n if (this.dependencyList.length > 0) {\n result.dependencyList = structuredClone(this.dependencyList)\n }\n if (Array.isArray(this.fields) && this.fields.length) {\n result.fields = [...this.fields]\n }\n return result\n }\n\n /**\n * This function is used internally by all domain elements to notify that something has changed.\n * Since we want to notify listeners after the operation commits, we use microtask\n * to ensure that the event is dispatched after the current operation.\n */\n notifyChange() {\n if (this.#notifying || this.#initializing) {\n return\n }\n this.#notifying = true\n queueMicrotask(() => {\n this.#notifying = false\n const event = new Event('change')\n this.dispatchEvent(event)\n })\n }\n\n private removeField(key: string): void {\n this.fields = this.fields.filter((item) => item.key !== key)\n }\n\n /**\n * Checks if this data domain has any fields (namespace and models).\n *\n * @returns True if the data domain has fields.\n * @example\n * ```typescript\n * if (domain.hasFields()) {\n * // ...\n * }\n * ```\n */\n hasFields(): boolean {\n return this.fields.length > 0\n }\n\n /**\n * Lists all fields (namespace and models) of this namespace.\n *\n * @returns A generator that yields each `DomainAssociation` or `DomainProperty`.\n * @example\n * ```typescript\n * for (const field of namespace.listFields()) {\n * console.log(field.key);\n * }\n * ```\n */\n *listFields(): Generator<DomainNamespace | DomainModel> {\n for (const { key } of this.fields) {\n const node = this.graph.node(key)\n if (!node) {\n continue\n }\n if (node.kind === DomainNamespaceKind || node.kind === DomainModelKind) {\n yield node\n }\n }\n }\n\n /**\n * Adds a new data domain instance to the graph.\n *\n * @param value The partial namespace schema. All missing\n * values will be filled with default values.\n * @param parent The parent namespace key. If not provided,\n * the new namespace will be added to the root of the\n * graph.\n * @returns The created namespace instance.\n * @throws Error When the parent does not exist or is not\n * a namespace.\n * @example\n * ```typescript\n * const newNamespace = dataDomain.addNamespace({\n * key: 'newNamespace',\n * });\n * ```\n */\n addNamespace(value?: Partial<DomainNamespaceSchema>, parent?: string): DomainNamespace {\n if (parent) {\n if (!this.graph.hasNode(parent)) {\n throw new Error(`Parent namespace ${parent} does not exist`)\n }\n const instance = this.graph.node(parent) as DomainNamespace\n if (!instance || instance.kind !== DomainNamespaceKind) {\n throw new Error(`Parent namespace ${parent} is not a valid namespace`)\n }\n if (instance.domain.key !== this.key) {\n throw new Error(`Cannot add a namespace to a foreign domain`)\n }\n return instance.addNamespace(value)\n }\n const item = new DomainNamespace(this, value)\n this.graph.setNode(item.key, item)\n this.fields.push({\n type: 'namespace',\n key: item.key,\n })\n this.notifyChange()\n return item\n }\n\n /**\n * Removes a namespace from the graph.\n *\n * @param key The key of the namespace to remove.\n * @returns The current DataDomain instance.\n * @throws Error When the namespace does not exist.\n * @example\n * ```typescript\n * dataDomain.removeNamespace('userNamespace');\n * ```\n */\n removeNamespace(key: string): this {\n if (!this.graph.hasNode(key)) {\n throw new Error(`Namespace ${key} does not exist`)\n }\n const ns = this.graph.node(key) as DomainNamespace\n if (!ns || ns.kind !== DomainNamespaceKind) {\n throw new Error(`Namespace ${key} not found`)\n }\n if (ns.domain.key !== this.key) {\n throw new Error(`Cannot remove a namespace from a foreign domain`)\n }\n const parent = ns.getParentInstance()\n if (parent === this) {\n removeGraphNode(this.graph, key)\n this.removeField(key)\n this.notifyChange()\n } else {\n parent.removeNamespace(key)\n }\n return this\n }\n\n /**\n * Lists all namespaces of this data domain that are direct children of it.\n *\n * Note, it accounts for the order of the namespaces as defined in the `fields` array.\n *\n * @returns A generator that yields each `DomainNamespace`.\n * @example\n * ```typescript\n * for (const ns of domain.listNamespaces()) {\n * console.log(ns.key);\n * }\n * ```\n */\n *listNamespaces(): Generator<DomainNamespace> {\n for (const { key, type } of this.fields) {\n if (type !== 'namespace') {\n continue\n }\n const node = this.graph.node(key)\n if (!node || node.kind !== DomainNamespaceKind) {\n continue\n }\n yield node\n }\n }\n\n /**\n * Checks if this data domain has any namespaces.\n *\n * @returns True if the data domain has namespaces.\n * @example\n * ```typescript\n * if (domain.hasNamespaces()) {\n * // ...\n * }\n * ```\n */\n hasNamespaces(): boolean {\n return this.fields.some((item) => item.type === 'namespace')\n }\n\n /**\n * Lists all namespaces in the graph.\n *\n * @param parent The key of the parent namespace. If not\n * provided, all root namespaces will be listed.\n * @returns A generator that yields each `DomainNamespace`.\n * @example\n * ```typescript\n * for (const ns of dataDomain.listGraphNamespaces()) {\n * console.log(ns.key);\n * }\n * ```\n */\n *listGraphNamespaces(parent?: string): Generator<DomainNamespace> {\n for (const node of this.graph.children(parent)) {\n const value = this.graph.node(node) as DomainGraphNodeType\n if (value.kind === DomainNamespaceKind && value.domain.key === this.key) {\n yield value\n }\n }\n }\n\n /**\n * Finds a namespace by its key.\n *\n * @param key The key of the namespace to find.\n * @returns The namespace instance or undefined if not\n * found.\n * @example\n * ```typescript\n * const ns = dataDomain.findNamespace('userNamespace');\n * if (ns) {\n * console.log(ns.key);\n * }\n * ```\n */\n findNamespace(key: string): DomainNamespace | undefined {\n const result = this.graph.node(key) as DomainNamespace | undefined\n if (result && result.kind === DomainNamespaceKind) {\n return result\n }\n }\n\n /**\n * Moves a namespace to a new parent.\n *\n * @param key The key of the namespace to move.\n * @param parent The new parent namespace key. If\n * undefined, the namespace will be moved to the root.\n * @returns The current DataDomain instance.\n * @throws Error When the namespace or parent does not\n * exist, or when a namespace is moved to itself or\n * its own child.\n * @example\n * ```typescript\n * dataDomain.moveNamespace('userNamespace', 'root');\n * ```\n */\n moveNamespace(key: string, parent?: string): this {\n if (!this.graph.hasNode(key)) {\n throw new Error(`Namespace ${key} does not exist`)\n }\n\n const namespace = this.findNamespace(key)\n if (!namespace) {\n throw new Error(`Namespace ${key} not found in the graph`)\n }\n\n if (parent) {\n const instance = this.findNamespace(parent)\n if (instance && instance.domain.key !== this.key) {\n throw new Error(`Cannot move a namespace to a foreign domain`)\n }\n if (!instance) {\n throw new Error(`Parent namespace ${parent} does not exist`)\n }\n }\n\n if (key === parent) {\n throw new Error(`Cannot move a namespace to itself`)\n }\n\n if (namespace.domain.key !== this.key) {\n throw new Error(`Cannot move a namespace from a foreign domain`)\n }\n let parentNamespace: DomainNamespace | undefined\n if (parent) {\n parentNamespace = this.findNamespace(parent)\n if (!parentNamespace) {\n throw new Error(`Parent namespace ${parent} not found`)\n }\n if (this.isChildOf(parent, key)) {\n throw new Error(`Cannot move a namespace to its own child`)\n }\n }\n\n // namespaces can only have one parent\n const currentParentKey = this.graph.parent(key)\n if (currentParentKey && !parent) {\n // The new parent namespace will detach the namespace when attaching to self.\n const currentParent = this.graph.node(currentParentKey) as DomainNamespace\n currentParent.detachNamespace(key)\n } else if (!currentParentKey) {\n // The namespace is a root namespace.\n this.removeField(key)\n }\n // Add to new parent\n if (parent && parentNamespace) {\n parentNamespace.attachNamespace(key)\n } else {\n // The namespace is a root namespace.\n this.fields.push({\n type: 'namespace',\n key,\n })\n }\n this.notifyChange()\n return this\n }\n\n /**\n * Checks if a namespace is a child of another namespace.\n * @param parentKey The key of the parent namespace.\n * @param childKey The key of the child namespace.\n * @returns True if the namespace is a child of another namespace.\n */\n private isChildOf(parentKey: string, childKey: string): boolean {\n const children = this.graph.children(childKey)\n for (const child of children) {\n if (child === parentKey) {\n return true\n }\n if (this.isChildOf(parentKey, child)) {\n return true\n }\n }\n return false\n }\n\n /**\n * Adds a data model to the graph.\n *\n * @param input The partial data model schema.\n * @param parent The parent namespace key. If not\n * provided, the new data model will be added to the\n * root of the graph.\n * @returns The created data model instance.\n * @throws Error When the parent does not exist or is not\n * a namespace.\n * @example\n * ```typescript\n * const newModel = dataDomain.addModel({\n * key: 'newModel',\n * });\n * ```\n */\n addModel(input?: Partial<DomainModelSchema>, parent?: string): DomainModel {\n if (parent) {\n if (!this.graph.hasNode(parent)) {\n throw new Error(`Parent ${parent} does not exist`)\n }\n const instance = this.findNamespace(parent)\n if (!instance) {\n throw new Error(`Parent namespace ${parent} is not a valid namespace`)\n }\n if (instance.domain.key !== this.key) {\n throw new Error(`Cannot add a model to a foreign domain`)\n }\n return instance.addModel(input)\n }\n const item = new DomainModel(this, input)\n this.graph.setNode(item.key, item)\n this.fields.push({\n type: 'model',\n key: item.key,\n })\n return item\n }\n\n /**\n * Removes a data model from the graph.\n *\n * @param key The key of the data model to remove.\n * @returns The current DataDomain instance.\n * @throws Error When the data model does not exist.\n * @example\n * ```typescript\n * dataDomain.removeModel('userModel');\n * ```\n */\n removeModel(key: string): this {\n if (!this.graph.hasNode(key)) {\n throw new Error(`Data model ${key} does not exist`)\n }\n const model = this.graph.node(key) as DomainModel\n if (!model || model.kind !== DomainModelKind) {\n throw new Error(`Data model ${key} not found`)\n }\n if (model.domain.key !== this.key) {\n throw new Error(`Cannot remove a model from a foreign domain`)\n }\n const parent = model.getParentInstance()\n if (parent === this) {\n removeGraphNode(this.graph, key)\n this.removeField(key)\n this.notifyChange()\n } else {\n parent.removeModel(key)\n }\n return this\n }\n\n /**\n * Lists all models of this data domain that are direct children of it.\n *\n * Note, it accounts for the order of the models as\n * defined in the `fields` array.\n *\n * @returns A generator that yields each `DomainModel`.\n * @example\n * ```typescript\n * for (const ns of namespace.listModels()) {\n * console.log(ns.key);\n * }\n * ```\n */\n *listModels(): Generator<DomainModel> {\n for (const { key, type } of this.fields) {\n if (type !== 'model') {\n continue\n }\n const node = this.graph.node(key)\n if (!node || node.kind !== DomainModelKind) {\n continue\n }\n yield node\n }\n }\n\n /**\n * Checks if this data domain has any direct models.\n *\n * @returns True if the data domain has models.\n * @example\n * ```typescript\n * if (domain.hasModels()) {\n * // ...\n * }\n * ```\n */\n hasModels(): boolean {\n return this.fields.some((item) => item.type === 'model')\n }\n\n /**\n * Lists all data models in the graph.\n *\n * @param parent The key of the parent namespace. If not\n * provided, all root data models will be listed.\n * @returns A generator that yields each `DomainModel`.\n * @example\n * ```typescript\n * for (const model of dataDomain.listGraphModels()) {\n * console.log(model.key);\n * }\n * ```\n */\n *listGraphModels(parent?: string): Generator<DomainModel> {\n for (const node of this.graph.children(parent)) {\n const value = this.graph.node(node) as DomainGraphNodeType\n if (value.kind === DomainModelKind && value.domain.key === this.key) {\n yield value\n }\n }\n }\n\n /**\n * Finds a data model by its key.\n *\n * @param key The key of the data model to find.\n * @returns The data model instance or undefined if not\n * found.\n * @example\n * ```typescript\n * const model = dataDomain.findModel('userModel');\n * if (model) {\n * console.log(model.key);\n * }\n * ```\n */\n findModel(key: string): DomainModel | undefined {\n const value = this.graph.node(key) as DomainModel | undefined\n if (value && value.kind === DomainModelKind) {\n return value\n }\n return undefined\n }\n\n /**\n * Moves a data model to a new parent.\n *\n * @param key The key of the data model to move.\n * @param parent The new parent namespace key. If\n * undefined, the data model will be moved to the root.\n * @returns The current DataDomain instance.\n * @throws Error When the data model or parent does not\n * exist, or when a data model is moved to a foreign\n * domain.\n * @example\n * ```typescript\n * dataDomain.moveModel('userModel', 'newNamespace');\n * ```\n */\n moveModel(key: string, parent?: string): this {\n if (!this.graph.hasNode(key)) {\n throw new Error(`Data model ${key} does not exist`)\n }\n\n const model = this.findModel(key)\n if (!model) {\n throw new Error(`Data model ${key} not found in the graph`)\n }\n\n if (parent) {\n const instance = this.findNamespace(parent)\n if (instance && instance.domain.key !== this.key) {\n throw new Error(`Cannot move a model to a foreign domain`)\n }\n if (!instance) {\n throw new Error(`Parent namespace ${parent} does not exist`)\n }\n }\n\n if (model.domain.key !== this.key) {\n throw new Error(`Cannot move a data model to a foreign domain`)\n }\n\n // namespaces can only have one parent\n const currentParentKey = this.graph.parent(key)\n // Remove from current parent\n if (currentParentKey && !parent) {\n // The new parent namespace will detach the model when attaching to self.\n const currentParent = this.findNamespace(currentParentKey)\n if (!currentParent) {\n throw new Error(`The parent namespace ${currentParentKey} not found`)\n }\n currentParent.detachModel(key)\n } else if (!currentParentKey) {\n // The model is a root model.\n this.removeField(key)\n }\n\n // Add to new parent\n if (parent) {\n const parentNamespace = this.findNamespace(parent) as DomainNamespace\n parentNamespace.attachModel(key)\n } else {\n // The model is becoming a root model.\n this.fields.push({\n type: 'model',\n key,\n })\n }\n\n this.notifyChange()\n return this\n }\n\n /**\n * Adds an entity to a data model.\n *\n * @param input The partial entity schema.\n * @param parent The key of the parent data model.\n * @returns The created entity instance.\n * @throws {Error} When the parent does not exist or is not a data model.\n * @example\n * ```typescript\n * const userEntity = dataDomain.addEntity({\n * key: 'user',\n * }, 'userModel');\n * ```\n */\n addEntity(parent: string, input?: Partial<DomainEntitySchema>): DomainEntity {\n if (!parent) {\n throw new Error(`An entity expects a DomainModel parent`)\n }\n if (!this.graph.hasNode(parent)) {\n throw new Error(`The parent ${parent} does not exist`)\n }\n const instance = this.findModel(parent)\n if (!instance) {\n throw new Error(`Parent model ${parent} is not a valid model`)\n }\n if (instance.domain.key !== this.key) {\n throw new Error(`Cannot add an entity to a foreign domain`)\n }\n return instance.addEntity(input)\n }\n\n /**\n * Removes an entity from the graph.\n *\n * @param key The key of the entity to remove.\n * @returns The current DataDomain instance.\n * @throws Error When the entity does not exist.\n * @example\n * ```typescript\n * dataDomain.removeEntity('user');\n * ```\n */\n removeEntity(key: string): this {\n if (!this.graph.hasNode(key)) {\n throw new Error(`Entity ${key} does not exist`)\n }\n const parentKey = this.graph.parent(key)\n if (!parentKey) {\n throw new Error(`Parent model not found for entity ${key}`)\n }\n const parent = this.findModel(parentKey)\n if (!parent) {\n throw new Error(`Parent model ${parentKey} not found`)\n }\n if (parent.domain.key !== this.key) {\n throw new Error(`Cannot remove an entity from a foreign domain`)\n }\n parent.removeEntity(key)\n return this\n }\n\n /**\n * Lists all entities in a data model, or, if the model key is not provided,\n * all entities in the domain.\n *\n * @param parent The key of the parent data model.\n * @returns A generator that yields each `DomainEntity`.\n * @example\n * ```typescript\n * for (const entity of dataDomain.listEntities('userModel')) {\n * console.log(entity.key);\n * }\n * ```\n */\n *listEntities(parent?: string): Generator<DomainEntity> {\n const iterator = parent ? this.graph.children(parent) : this.graph.nodes()\n for (const node of iterator) {\n const value = this.graph.node(node) as DomainGraphNodeType\n if (value.kind === DomainEntityKind && value.domain.key === this.key) {\n yield value\n }\n }\n }\n\n /**\n * Lists all entities in the graph that are not part of this domain.\n */\n *listForeignEntities(): Generator<DomainEntity> {\n for (const node of this.graph.nodes()) {\n const value = this.graph.node(node) as DomainGraphNodeType\n if (value.kind === DomainEntityKind && value.domain.key !== this.key) {\n yield value\n }\n }\n }\n\n /**\n * Finds an entity by its key.\n *\n * @param key The key of the entity to find.\n * @returns The entity instance or undefined if not found.\n * @example\n * ```typescript\n * const entity = dataDomain.findEntity('user');\n * if (entity) {\n * console.log(entity.key);\n * }\n * ```\n */\n findEntity(key: string): DomainEntity | undefined {\n const node = this.graph.node(key) as DomainEntity | undefined\n if (node && node.kind === DomainEntityKind) {\n return node\n }\n return undefined\n }\n\n /**\n * Moves an entity from one model to another.\n *\n * @param entityKey The key of the entity to move.\n * @param sourceModelKey The key of the source model.\n * @param targetModelKey The key of the target model.\n * @throws Error When the entity, source model, or target model does not exist.\n * @throws Error When the entity is not in the same domain.\n * @throws Error When the source and target models are the same.\n * @throws Error When moving to an unsupported object.\n */\n moveEntity(entityKey: string, sourceModelKey: string, targetModelKey: string): void {\n if (sourceModelKey === targetModelKey) {\n throw new Error(`Cannot move an entity to the same model`)\n }\n if (!this.graph.hasNode(entityKey)) {\n throw new Error(`Entity ${entityKey} does not exist`)\n }\n if (!this.graph.hasNode(sourceModelKey)) {\n throw new Error(`Source model ${sourceModelKey} does not exist`)\n }\n if (!this.graph.hasNode(targetModelKey)) {\n throw new Error(`Target model ${targetModelKey} does not exist`)\n }\n\n const entity = this.findEntity(entityKey)\n const sourceModel = this.findModel(sourceModelKey)\n const targetModel = this.findModel(targetModelKey)\n\n if (!entity || !sourceModel || !targetModel) {\n throw new Error(`Entity or models not found in the graph`)\n }\n\n if (entity.domain.key !== this.key) {\n // this also applied to the parent model.\n throw new Error(`Cannot move an entity from a foreign domain`)\n }\n if (targetModel.domain.key !== this.key) {\n throw new Error(`Cannot move an entity to a foreign domain`)\n }\n // The target model detaches the entity when attaching to self.\n targetModel.attachEntity(entityKey)\n this.notifyChange()\n }\n\n /**\n * Adds an association between two entities.\n *\n * This function is a shortcut that finds the entity and\n * calls the `addAssociation` method on it.\n *\n * @param source The key of the source entity.\n * @param init The association options.\n * @returns The created association.\n * @throws Error When the source entity does not exist.\n * @example\n * ```typescript\n * const addressAssociation = dataDomain.addAssociation(\n * 'user', { key: 'address' }\n * );\n * ```\n */\n addAssociation(source: string, init?: AssociationAddOptions): DomainAssociation {\n if (!this.graph.hasNode(source)) {\n throw new Error(`Source entity ${source} not found`)\n }\n const entity = this.findEntity(source)\n if (!entity) {\n throw new Error(`Source entity ${source} not found`)\n }\n if (entity.domain.key !== this.key) {\n throw new Error(`Cannot add an association to a foreign domain`)\n }\n return entity.addAssociation(init)\n }\n\n /**\n * Removes an association from the graph.\n *\n * @param key The key of the association to remove.\n * @returns The current DataDomain instance.\n * @throws Error When the association does not exist or\n * when the parent entity is not found.\n * @example\n * ```typescript\n * dataDomain.removeAssociation('address');\n * ```\n */\n removeAssociation(key: string): this {\n if (!this.graph.hasNode(key)) {\n throw new Error(`Association ${key} does not exist`)\n }\n const instance = this.graph.node(key) as DomainAssociation\n if (!instance || instance.kind !== DomainAssociationKind) {\n throw new Error(`Association ${key} not found`)\n }\n const entity = instance.getParentInstance()\n if (!entity) {\n throw new Error(`Parent entity not found for association ${key}`)\n }\n if (entity.domain.key !== this.key) {\n throw new Error(`Cannot remove an association from a foreign domain`)\n }\n entity.removeAssociation(key)\n return this\n }\n\n /**\n * Finds an association by its key.\n *\n * @param key The key of the association to find.\n * @returns The association instance or undefined if not\n * found.\n * @example\n * ```typescript\n * const assoc = dataDomain.findAssociation('address');\n * if (assoc) {\n * console.log(assoc.key);\n * }\n * ```\n */\n findAssociation(key: string): DomainAssociation | undefined {\n const node = this.graph.node(key) as DomainAssociation | undefined\n if (node && node.kind === DomainAssociationKind) {\n return node\n }\n return undefined\n }\n\n /**\n * Adds a property to an entity.\n *\n * @param parent The key of the parent entity.\n * @param property The partial property schema.\n * @returns The created property instance.\n * @throws Error When the parent does not exist or is not\n * an entity.\n * @example\n * ```typescript\n * const nameProperty = dataDomain.addProperty(\n * 'user', { key: 'name', type: 'string' }\n * );\n * ```\n */\n addProperty(parent: string, property?: Partial<DomainPropertySchema>): DomainProperty {\n if (!parent) {\n throw new Error(`A property expects a DomainEntity parent`)\n }\n if (!this.graph.hasNode(parent)) {\n throw new Error(`Parent entity ${parent} does not exist`)\n }\n const entity = this.findEntity(parent)\n if (!entity) {\n throw new Error(`Parent entity ${parent} not found`)\n }\n if (entity.domain.key !== this.key) {\n throw new Error(`Cannot add a property to a foreign domain`)\n }\n return entity.addProperty(property)\n }\n\n /**\n * Removes a property from the graph.\n *\n * @param key The key of the property to remove.\n * @returns The current DataDomain instance.\n * @throws Error When the property does not exist or when\n * the parent entity is not found.\n * @example\n * ```typescript\n * dataDomain.removeProperty('name');\n * ```\n */\n removeProperty(key: string): this {\n if (!this.graph.hasNode(key)) {\n throw new Error(`Property ${key} does not exist`)\n }\n const instance = this.graph.node(key) as DomainProperty\n if (!instance || instance.kind !== DomainPropertyKind) {\n throw new Error(`Property ${key} not found`)\n }\n const entity = instance.getParentInstance()\n if (!entity) {\n throw new Error(`Parent entity not found for property ${key}`)\n }\n if (entity.domain.key !== this.key) {\n throw new Error(`Cannot remove a property from a foreign domain`)\n }\n entity.removeProperty(key)\n return this\n }\n\n /**\n * Finds a property by its key.\n *\n * @param key The key of the property to find.\n * @returns The property instance or undefined if not\n * found.\n * @example\n * ```typescript\n * const prop = dataDomain.findProperty('name');\n * if (prop) {\n * console.log(prop.key);\n * }\n * ```\n */\n findProperty(key: string): DomainProperty | undefined {\n const node = this.graph.node(key) as DomainProperty | undefined\n if (node && node.kind === DomainPropertyKind) {\n return node\n }\n return undefined\n }\n\n /**\n * Registers a foreign DataDomain.\n *\n * @param domain The foreign DataDomain instance.\n * @param key The unique identifier for the foreign\n * domain.\n * @param version The version of the foreign domain.\n * @throws Error When a foreign domain with the same key is already registered.\n * @example\n * ```typescript\n * dataDomain.registerForeignDomain(\n * foreignDomain, 'foreignDomain', '1.0.0'\n * );\n * ```\n */\n registerForeignDomain(domain: DataDomain): void {\n const { info, key } = domain\n if (!info.version) {\n // @TODO: make the data domain immutable after a version is set.\n // This will prevent the user from changing the version\n // after the domain is registered.\n throw new Error(`Foreign domain ${key} does not have a version set`)\n }\n if (this.dependencies.has(key)) {\n throw new Error(`Foreign domain with key ${key} already registered`)\n }\n this.dependencies.set(key, domain)\n this.dependencyList.push({ key, version: info.version })\n // Copy the relevant parts of the foreign domain's graph into the local graph.\n // this.copyForeignDomainGraph(domain)\n mergeGraph(this.graph, domain.graph, domain.key)\n this.notifyChange()\n }\n\n /**\n * Un-registers a foreign DataDomain. It removes all defined by the foreign domain\n * information from the graph.\n * @param key The key of the foreign domain to unregister.\n */\n unregisterForeignDomain(key: string): void {\n const foreignDomain = this.dependencies.get(key)\n if (!foreignDomain) {\n throw new Error(`Foreign domain with key ${key} not found`)\n }\n this.dependencies.delete(key)\n this.dependencyList = this.dependencyList.filter((dependency) => dependency.key !== key)\n // Remove the foreign domain's nodes from the local graph.\n removeForeignGraph(this.graph, foreignDomain.key)\n this.notifyChange()\n }\n\n /**\n * Finds an entity in a foreign domain.\n *\n * @param entityKey The key of the entity to find.\n * @param domainKey The key of the foreign domain.\n * @returns The entity instance or undefined if not\n * found.\n * @example\n * ```typescript\n * const foreignUser = dataDomain.findForeignEntity(\n * 'user', 'foreignDomain'\n * );\n * if (foreignUser) {\n * console.log(foreignUser.key);\n * }\n * ```\n */\n findForeignEntity(entityKey: string, domainKey: string): DomainEntity | undefined {\n const foreignDomain = this.dependencies.get(domainKey)\n if (!foreignDomain) {\n return undefined\n }\n const foreignKey = `${domainKey}:${entityKey}`\n const node = this.graph.node(foreignKey)\n if (node && node.kind === DomainEntityKind) {\n return node as DomainEntity\n }\n return undefined\n }\n\n /**\n * A convenience function to remove an object from the\n * namespace.\n *\n * @param key The key of the object to remove.\n * @param kind The kind of the object to remove.\n * @throws Error when the kind is not known.\n * @example\n * ```typescript\n * dataDomain.removeDomainElement('user', DomainEntityKind);\n * ```\n */\n removeDomainElement(key: string, kind: string): void {\n switch (kind) {\n case DomainNamespaceKind:\n this.removeNamespace(key)\n break\n case DomainModelKind:\n this.removeModel(key)\n break\n case DomainEntityKind:\n this.removeEntity(key)\n break\n case DomainPropertyKind:\n this.removeProperty(key)\n break\n case DomainAssociationKind:\n this.removeAssociation(key)\n break\n default:\n throw new Error(`Unknown kind ${kind} for the object ${key}`)\n }\n }\n}\n"]}
1
+ {"version":3,"file":"DataDomain.js","sourceRoot":"","sources":["../../../src/modeling/DataDomain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAA8B,eAAe,EAA6B,MAAM,sBAAsB,CAAA;AAC7G,OAAO,EAA0B,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAItE,OAAO,EAAe,KAAK,EAAE,MAAM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,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;YAC3C,OAAO,IAAoB,CAAA;QAC7B,CAAC;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,mBAAmB,CAAC,GAAW,EAAE,IAAY;QAC3C,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,mBAAmB;gBACtB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAA;gBACzB,MAAK;YACP,KAAK,eAAe;gBAClB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;gBACrB,MAAK;YACP,KAAK,gBAAgB;gBACnB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;gBACtB,MAAK;YACP,KAAK,kBAAkB;gBACrB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAA;gBACxB,MAAK;YACP,KAAK,qBAAqB;gBACxB,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAA;gBAC3B,MAAK;YACP;gBACE,MAAM,IAAI,KAAK,CAAC,gBAAgB,IAAI,mBAAmB,GAAG,EAAE,CAAC,CAAA;QACjE,CAAC;IACH,CAAC;CACF","sourcesContent":["import { nanoid } from '../nanoid.js'\nimport { Graph } from '@api-client/graph/graph/Graph.js'\nimport {\n DomainAssociationKind,\n DataDomainKind,\n DomainEntityKind,\n DomainModelKind,\n DomainNamespaceKind,\n DomainPropertyKind,\n} from '../models/kinds.js'\nimport type { AssociationAddOptions, DomainGraphEdge, DomainGraphNodeType, SerializedGraph } from './types.js'\nimport { type DomainNamespaceSchema, DomainNamespace, type NamespaceOrderedItem } from './DomainNamespace.js'\nimport { type DomainModelSchema, DomainModel } from './DomainModel.js'\nimport { type DomainEntitySchema, DomainEntity } from './DomainEntity.js'\nimport { DomainAssociation } from './DomainAssociation.js'\nimport { DomainProperty, DomainPropertySchema } from './DomainProperty.js'\nimport { type IThing, Thing } from '../models/Thing.js'\nimport { removeGraphNode } from './GraphUtils.js'\nimport { serialize, deserialize, mergeGraph, removeForeignGraph } from './DomainSerialization.js'\nimport { DependentModel, type DependentModelSchema, type DomainDependency } from './DependentModel.js'\n\nexport interface DataDomainSchema extends DependentModelSchema {\n info: IThing\n kind: typeof DataDomainKind\n key: string\n graph?: SerializedGraph\n /**\n * The ordered list of fields (namespace and models) in the schema.\n * These only keep references to define the order of these properties\n * in the schema as graph won't do it.\n */\n fields?: NamespaceOrderedItem[]\n}\n\n/**\n * Represents the root of a data domain model.\n *\n * The `DataDomain` class serves as the top-level container\n * for a collection of data models, namespaces, entities,\n * properties, and associations. It provides methods for\n * managing and manipulating these data elements, enabling\n * the creation of complex and interconnected data\n * structures.\n *\n * **Key Features:**\n *\n * - **Root Container:** Holds all data elements within a domain.\n * - **Graph-Based Structure:** Uses a graph to represent relationships between data elements.\n * - **Namespace Management:** Supports creating and managing namespaces to organize data models.\n * - **Data Model Management:** Supports creating and managing data models to group entities.\n * - **Entity Management:** Supports creating and managing entities, which define the structure of data.\n * - **Property Management:** Supports creating and managing properties, which define the data elements\n * within entities.\n * - **Association Management:** Supports creating and managing associations, which define relationships\n * between entities.\n * - **Foreign Domain Support:** Allows registering and integrating data from external domains.\n * - **Change Notification:** Notifies listeners when changes occur within the data domain.\n *\n * **Usage:**\n *\n * 1. Create an instance of the `DataDomain`.\n * 2. Use methods like `addNamespace()`, `addModel()`,\n * `addEntity()`, `addProperty()`, and `addAssociation()`\n * to build the data domain structure.\n * 3. Use methods like `findNamespace()`, `findModel()`,\n * `findEntity()`, `findProperty()`, and\n * `findAssociation()` to retrieve data elements.\n * 4. Use methods like `listNamespaces()`, `listGraphNamespaces()`, `listModels()`,\n * and `listEntities()` to iterate over collections of\n * data elements.\n * 5. Use `registerForeignDomain()` to integrate data from\n * external domains.\n * 6. Listen for the `change` event to be notified of\n * changes within the data domain.\n *\n * **Example:**\n *\n * ```typescript\n * const dataDomain = new DataDomain();\n * const userNamespace = dataDomain.addNamespace({\n * key: 'userNamespace',\n * });\n * const userModel = userNamespace.addModel({\n * key: 'userModel',\n * });\n * const userEntity = userModel.addEntity({\n * key: 'user',\n * });\n * const nameProperty = userEntity.addProperty({\n * key: 'name',\n * type: 'string',\n * });\n * ```\n *\n * @fires DataDomain#change {Event} - Fired when the data\n * domain changes.\n *\n * @todo: Implement a mechanism to move an entity to a new\n * parent model.\n */\nexport class DataDomain extends DependentModel {\n /**\n * The kind of the domain element.\n */\n kind: typeof DataDomainKind\n /**\n * The unique key of the domain element.\n */\n key: string\n\n /**\n * The graph used to store the data domain structure.\n */\n graph: Graph<unknown, DomainGraphNodeType, DomainGraphEdge>\n\n /**\n * The description of the domain property.\n */\n info: Thing\n\n /**\n * When the initializing flag is set to true,\n * the domain is not notified of changes.\n */\n #initializing = true\n\n /**\n * When the notifying flag is set to true,\n * the domain is pending a notification.\n * No other notifications will be sent until\n * the current notification is sent.\n */\n #notifying = false\n\n /**\n * This is to keep it consistent with the domain elements.\n */\n get domain(): DataDomain {\n return this\n }\n\n /**\n * The ordered list of fields (namespace and models) in the schema.\n * These only keep references to define the order of these properties\n * in the schema as graph won't do it.\n */\n accessor fields: NamespaceOrderedItem[]\n\n static createSchema(input: Partial<DataDomainSchema> = {}): DataDomainSchema {\n const { key = nanoid(), fields } = input\n const info = Thing.fromJSON(input.info, { name: 'Unnamed domain' }).toJSON()\n const result: DataDomainSchema = {\n kind: DataDomainKind,\n key,\n info,\n }\n if (input.dependencyList) {\n result.dependencyList = structuredClone(input.dependencyList)\n }\n if (input.graph) {\n result.graph = input.graph\n }\n if (Array.isArray(fields)) {\n result.fields = [...fields]\n }\n return result\n }\n\n /**\n * Creates a new instance of the `DataDomain` class.\n *\n * When creating a new Data Domain arguments should not be set.\n * When restoring a Data Domain from a previous state, you should provide\n * the serialized graph state as well as the same list of dependencies\n * used when the graph was deserialized. Edges to missing dependency nodes\n * will be ignored.\n *\n * @param state The previously serialized state of the graph.\n * @param dependencies An array of foreign data domains to register with this domain.\n */\n constructor(state?: Partial<DataDomainSchema>, dependencies: DomainDependency[] = []) {\n const init = DataDomain.createSchema(state)\n const instances: DataDomain[] = []\n for (const dep of dependencies) {\n if (dep instanceof DataDomain) {\n instances.push(dep)\n } else if (typeof dep === 'object' && dep.kind === DataDomainKind && dep.key) {\n const domain = new DataDomain(dep)\n instances.push(domain)\n } else {\n throw new Error(`Invalid foreign domain dependency: ${dep}`)\n }\n }\n super(init.dependencyList, instances)\n this.kind = init.kind\n this.key = init.key\n this.info = new Thing(init.info)\n this.graph = deserialize(this, init.graph, instances)\n if (Array.isArray(init.fields)) {\n this.fields = [...init.fields]\n } else {\n this.fields = []\n }\n if (Array.isArray(init.dependencyList)) {\n this.dependencyList = [...init.dependencyList]\n } else {\n this.dependencyList = []\n }\n this.#initializing = false\n this.info.addEventListener('change', () => {\n this.notifyChange()\n })\n }\n\n /**\n * Serializes the DataDomain instance to a JSON object.\n * It does not serialize the foreign domain dependencies. The serialized nodes\n * are the ones that are local to this data domain.\n * @returns The serialized data domain ready for storage or transport.\n */\n toJSON(): DataDomainSchema {\n const result: DataDomainSchema = {\n info: this.info.toJSON(),\n kind: this.kind,\n key: this.key,\n graph: serialize(this.graph, this.key),\n }\n if (this.dependencyList.length > 0) {\n result.dependencyList = structuredClone(this.dependencyList)\n }\n if (Array.isArray(this.fields) && this.fields.length) {\n result.fields = [...this.fields]\n }\n return result\n }\n\n /**\n * This function is used internally by all domain elements to notify that something has changed.\n * Since we want to notify listeners after the operation commits, we use microtask\n * to ensure that the event is dispatched after the current operation.\n */\n notifyChange() {\n if (this.#notifying || this.#initializing) {\n return\n }\n this.#notifying = true\n queueMicrotask(() => {\n this.#notifying = false\n const event = new Event('change')\n this.dispatchEvent(event)\n })\n }\n\n private removeField(key: string): void {\n this.fields = this.fields.filter((item) => item.key !== key)\n }\n\n /**\n * Checks if this data domain has any fields (namespace and models).\n *\n * @returns True if the data domain has fields.\n * @example\n * ```typescript\n * if (domain.hasFields()) {\n * // ...\n * }\n * ```\n */\n hasFields(): boolean {\n return this.fields.length > 0\n }\n\n /**\n * Lists all fields (namespace and models) of this namespace.\n *\n * @returns A generator that yields each `DomainAssociation` or `DomainProperty`.\n * @example\n * ```typescript\n * for (const field of namespace.listFields()) {\n * console.log(field.key);\n * }\n * ```\n */\n *listFields(): Generator<DomainNamespace | DomainModel> {\n for (const { key } of this.fields) {\n const node = this.graph.node(key)\n if (!node) {\n continue\n }\n if (node.kind === DomainNamespaceKind || node.kind === DomainModelKind) {\n yield node\n }\n }\n }\n\n /**\n * Adds a new data domain instance to the graph.\n *\n * @param value The partial namespace schema. All missing\n * values will be filled with default values.\n * @param parent The parent namespace key. If not provided,\n * the new namespace will be added to the root of the\n * graph.\n * @returns The created namespace instance.\n * @throws Error When the parent does not exist or is not\n * a namespace.\n * @example\n * ```typescript\n * const newNamespace = dataDomain.addNamespace({\n * key: 'newNamespace',\n * });\n * ```\n */\n addNamespace(value?: Partial<DomainNamespaceSchema>, parent?: string): DomainNamespace {\n if (parent) {\n if (!this.graph.hasNode(parent)) {\n throw new Error(`Parent namespace ${parent} does not exist`)\n }\n const instance = this.graph.node(parent) as DomainNamespace\n if (!instance || instance.kind !== DomainNamespaceKind) {\n throw new Error(`Parent namespace ${parent} is not a valid namespace`)\n }\n if (instance.domain.key !== this.key) {\n throw new Error(`Cannot add a namespace to a foreign domain`)\n }\n return instance.addNamespace(value)\n }\n const item = new DomainNamespace(this, value)\n this.graph.setNode(item.key, item)\n this.fields.push({\n type: 'namespace',\n key: item.key,\n })\n this.notifyChange()\n return item\n }\n\n /**\n * Removes a namespace from the graph.\n *\n * @param key The key of the namespace to remove.\n * @returns The current DataDomain instance.\n * @throws Error When the namespace does not exist.\n * @example\n * ```typescript\n * dataDomain.removeNamespace('userNamespace');\n * ```\n */\n removeNamespace(key: string): this {\n if (!this.graph.hasNode(key)) {\n throw new Error(`Namespace ${key} does not exist`)\n }\n const ns = this.graph.node(key) as DomainNamespace\n if (!ns || ns.kind !== DomainNamespaceKind) {\n throw new Error(`Namespace ${key} not found`)\n }\n if (ns.domain.key !== this.key) {\n throw new Error(`Cannot remove a namespace from a foreign domain`)\n }\n const parent = ns.getParentInstance()\n if (parent === this) {\n removeGraphNode(this.graph, key)\n this.removeField(key)\n this.notifyChange()\n } else {\n parent.removeNamespace(key)\n }\n return this\n }\n\n /**\n * Lists all namespaces of this data domain that are direct children of it.\n *\n * Note, it accounts for the order of the namespaces as defined in the `fields` array.\n *\n * @returns A generator that yields each `DomainNamespace`.\n * @example\n * ```typescript\n * for (const ns of domain.listNamespaces()) {\n * console.log(ns.key);\n * }\n * ```\n */\n *listNamespaces(): Generator<DomainNamespace> {\n for (const { key, type } of this.fields) {\n if (type !== 'namespace') {\n continue\n }\n const node = this.graph.node(key)\n if (!node || node.kind !== DomainNamespaceKind) {\n continue\n }\n yield node\n }\n }\n\n /**\n * Checks if this data domain has any namespaces.\n *\n * @returns True if the data domain has namespaces.\n * @example\n * ```typescript\n * if (domain.hasNamespaces()) {\n * // ...\n * }\n * ```\n */\n hasNamespaces(): boolean {\n return this.fields.some((item) => item.type === 'namespace')\n }\n\n /**\n * Lists all namespaces in the graph.\n *\n * @param parent The key of the parent namespace. If not\n * provided, all root namespaces will be listed.\n * @returns A generator that yields each `DomainNamespace`.\n * @example\n * ```typescript\n * for (const ns of dataDomain.listGraphNamespaces()) {\n * console.log(ns.key);\n * }\n * ```\n */\n *listGraphNamespaces(parent?: string): Generator<DomainNamespace> {\n for (const node of this.graph.children(parent)) {\n const value = this.graph.node(node) as DomainGraphNodeType\n if (value.kind === DomainNamespaceKind && value.domain.key === this.key) {\n yield value\n }\n }\n }\n\n /**\n * Finds a namespace by its key.\n *\n * @param key The key of the namespace to find.\n * @returns The namespace instance or undefined if not\n * found.\n * @example\n * ```typescript\n * const ns = dataDomain.findNamespace('userNamespace');\n * if (ns) {\n * console.log(ns.key);\n * }\n * ```\n */\n findNamespace(key: string): DomainNamespace | undefined {\n const result = this.graph.node(key) as DomainNamespace | undefined\n if (result && result.kind === DomainNamespaceKind) {\n return result\n }\n }\n\n /**\n * Moves a namespace to a new parent.\n *\n * @param key The key of the namespace to move.\n * @param parent The new parent namespace key. If\n * undefined, the namespace will be moved to the root.\n * @returns The current DataDomain instance.\n * @throws Error When the namespace or parent does not\n * exist, or when a namespace is moved to itself or\n * its own child.\n * @example\n * ```typescript\n * dataDomain.moveNamespace('userNamespace', 'root');\n * ```\n */\n moveNamespace(key: string, parent?: string): this {\n if (!this.graph.hasNode(key)) {\n throw new Error(`Namespace ${key} does not exist`)\n }\n\n const namespace = this.findNamespace(key)\n if (!namespace) {\n throw new Error(`Namespace ${key} not found in the graph`)\n }\n\n if (parent) {\n const instance = this.findNamespace(parent)\n if (instance && instance.domain.key !== this.key) {\n throw new Error(`Cannot move a namespace to a foreign domain`)\n }\n if (!instance) {\n throw new Error(`Parent namespace ${parent} does not exist`)\n }\n }\n\n if (key === parent) {\n throw new Error(`Cannot move a namespace to itself`)\n }\n\n if (namespace.domain.key !== this.key) {\n throw new Error(`Cannot move a namespace from a foreign domain`)\n }\n let parentNamespace: DomainNamespace | undefined\n if (parent) {\n parentNamespace = this.findNamespace(parent)\n if (!parentNamespace) {\n throw new Error(`Parent namespace ${parent} not found`)\n }\n if (this.isChildOf(parent, key)) {\n throw new Error(`Cannot move a namespace to its own child`)\n }\n }\n\n // namespaces can only have one parent\n const currentParentKey = this.graph.parent(key)\n if (currentParentKey && !parent) {\n // The new parent namespace will detach the namespace when attaching to self.\n const currentParent = this.graph.node(currentParentKey) as DomainNamespace\n currentParent.detachNamespace(key)\n } else if (!currentParentKey) {\n // The namespace is a root namespace.\n this.removeField(key)\n }\n // Add to new parent\n if (parent && parentNamespace) {\n parentNamespace.attachNamespace(key)\n } else {\n // The namespace is a root namespace.\n this.fields.push({\n type: 'namespace',\n key,\n })\n }\n this.notifyChange()\n return this\n }\n\n /**\n * Checks if a namespace is a child of another namespace.\n * @param parentKey The key of the parent namespace.\n * @param childKey The key of the child namespace.\n * @returns True if the namespace is a child of another namespace.\n */\n private isChildOf(parentKey: string, childKey: string): boolean {\n const children = this.graph.children(childKey)\n for (const child of children) {\n if (child === parentKey) {\n return true\n }\n if (this.isChildOf(parentKey, child)) {\n return true\n }\n }\n return false\n }\n\n /**\n * Adds a data model to the graph.\n *\n * @param input The partial data model schema.\n * @param parent The parent namespace key. If not\n * provided, the new data model will be added to the\n * root of the graph.\n * @returns The created data model instance.\n * @throws Error When the parent does not exist or is not\n * a namespace.\n * @example\n * ```typescript\n * const newModel = dataDomain.addModel({\n * key: 'newModel',\n * });\n * ```\n */\n addModel(input?: Partial<DomainModelSchema>, parent?: string): DomainModel {\n if (parent) {\n if (!this.graph.hasNode(parent)) {\n throw new Error(`Parent ${parent} does not exist`)\n }\n const instance = this.findNamespace(parent)\n if (!instance) {\n throw new Error(`Parent namespace ${parent} is not a valid namespace`)\n }\n if (instance.domain.key !== this.key) {\n throw new Error(`Cannot add a model to a foreign domain`)\n }\n return instance.addModel(input)\n }\n const item = new DomainModel(this, input)\n this.graph.setNode(item.key, item)\n this.fields.push({\n type: 'model',\n key: item.key,\n })\n return item\n }\n\n /**\n * Removes a data model from the graph.\n *\n * @param key The key of the data model to remove.\n * @returns The current DataDomain instance.\n * @throws Error When the data model does not exist.\n * @example\n * ```typescript\n * dataDomain.removeModel('userModel');\n * ```\n */\n removeModel(key: string): this {\n if (!this.graph.hasNode(key)) {\n throw new Error(`Data model ${key} does not exist`)\n }\n const model = this.graph.node(key) as DomainModel\n if (!model || model.kind !== DomainModelKind) {\n throw new Error(`Data model ${key} not found`)\n }\n if (model.domain.key !== this.key) {\n throw new Error(`Cannot remove a model from a foreign domain`)\n }\n const parent = model.getParentInstance()\n if (parent === this) {\n removeGraphNode(this.graph, key)\n this.removeField(key)\n this.notifyChange()\n } else {\n parent.removeModel(key)\n }\n return this\n }\n\n /**\n * Lists all models of this data domain that are direct children of it.\n *\n * Note, it accounts for the order of the models as\n * defined in the `fields` array.\n *\n * @returns A generator that yields each `DomainModel`.\n * @example\n * ```typescript\n * for (const ns of namespace.listModels()) {\n * console.log(ns.key);\n * }\n * ```\n */\n *listModels(): Generator<DomainModel> {\n for (const { key, type } of this.fields) {\n if (type !== 'model') {\n continue\n }\n const node = this.graph.node(key)\n if (!node || node.kind !== DomainModelKind) {\n continue\n }\n yield node\n }\n }\n\n /**\n * Checks if this data domain has any direct models.\n *\n * @returns True if the data domain has models.\n * @example\n * ```typescript\n * if (domain.hasModels()) {\n * // ...\n * }\n * ```\n */\n hasModels(): boolean {\n return this.fields.some((item) => item.type === 'model')\n }\n\n /**\n * Lists all data models in the graph.\n *\n * @param parent The key of the parent namespace. If not\n * provided, all root data models will be listed.\n * @returns A generator that yields each `DomainModel`.\n * @example\n * ```typescript\n * for (const model of dataDomain.listGraphModels()) {\n * console.log(model.key);\n * }\n * ```\n */\n *listGraphModels(parent?: string): Generator<DomainModel> {\n for (const node of this.graph.children(parent)) {\n const value = this.graph.node(node) as DomainGraphNodeType\n if (value.kind === DomainModelKind && value.domain.key === this.key) {\n yield value\n }\n }\n }\n\n /**\n * Finds a data model by its key.\n *\n * @param key The key of the data model to find.\n * @returns The data model instance or undefined if not\n * found.\n * @example\n * ```typescript\n * const model = dataDomain.findModel('userModel');\n * if (model) {\n * console.log(model.key);\n * }\n * ```\n */\n findModel(key: string): DomainModel | undefined {\n const value = this.graph.node(key) as DomainModel | undefined\n if (value && value.kind === DomainModelKind) {\n return value\n }\n return undefined\n }\n\n /**\n * Moves a data model to a new parent.\n *\n * @param key The key of the data model to move.\n * @param parent The new parent namespace key. If\n * undefined, the data model will be moved to the root.\n * @returns The current DataDomain instance.\n * @throws Error When the data model or parent does not\n * exist, or when a data model is moved to a foreign\n * domain.\n * @example\n * ```typescript\n * dataDomain.moveModel('userModel', 'newNamespace');\n * ```\n */\n moveModel(key: string, parent?: string): this {\n if (!this.graph.hasNode(key)) {\n throw new Error(`Data model ${key} does not exist`)\n }\n\n const model = this.findModel(key)\n if (!model) {\n throw new Error(`Data model ${key} not found in the graph`)\n }\n\n if (parent) {\n const instance = this.findNamespace(parent)\n if (instance && instance.domain.key !== this.key) {\n throw new Error(`Cannot move a model to a foreign domain`)\n }\n if (!instance) {\n throw new Error(`Parent namespace ${parent} does not exist`)\n }\n }\n\n if (model.domain.key !== this.key) {\n throw new Error(`Cannot move a data model to a foreign domain`)\n }\n\n // namespaces can only have one parent\n const currentParentKey = this.graph.parent(key)\n // Remove from current parent\n if (currentParentKey && !parent) {\n // The new parent namespace will detach the model when attaching to self.\n const currentParent = this.findNamespace(currentParentKey)\n if (!currentParent) {\n throw new Error(`The parent namespace ${currentParentKey} not found`)\n }\n currentParent.detachModel(key)\n } else if (!currentParentKey) {\n // The model is a root model.\n this.removeField(key)\n }\n\n // Add to new parent\n if (parent) {\n const parentNamespace = this.findNamespace(parent) as DomainNamespace\n parentNamespace.attachModel(key)\n } else {\n // The model is becoming a root model.\n this.fields.push({\n type: 'model',\n key,\n })\n }\n\n this.notifyChange()\n return this\n }\n\n /**\n * Adds an entity to a data model.\n *\n * @param input The partial entity schema.\n * @param parent The key of the parent data model.\n * @returns The created entity instance.\n * @throws {Error} When the parent does not exist or is not a data model.\n * @example\n * ```typescript\n * const userEntity = dataDomain.addEntity({\n * key: 'user',\n * }, 'userModel');\n * ```\n */\n addEntity(parent: string, input?: Partial<DomainEntitySchema>): DomainEntity {\n if (!parent) {\n throw new Error(`An entity expects a DomainModel parent`)\n }\n if (!this.graph.hasNode(parent)) {\n throw new Error(`The parent ${parent} does not exist`)\n }\n const instance = this.findModel(parent)\n if (!instance) {\n throw new Error(`Parent model ${parent} is not a valid model`)\n }\n if (instance.domain.key !== this.key) {\n throw new Error(`Cannot add an entity to a foreign domain`)\n }\n return instance.addEntity(input)\n }\n\n /**\n * Removes an entity from the graph.\n *\n * @param key The key of the entity to remove.\n * @returns The current DataDomain instance.\n * @throws Error When the entity does not exist.\n * @example\n * ```typescript\n * dataDomain.removeEntity('user');\n * ```\n */\n removeEntity(key: string): this {\n if (!this.graph.hasNode(key)) {\n throw new Error(`Entity ${key} does not exist`)\n }\n const parentKey = this.graph.parent(key)\n if (!parentKey) {\n throw new Error(`Parent model not found for entity ${key}`)\n }\n const parent = this.findModel(parentKey)\n if (!parent) {\n throw new Error(`Parent model ${parentKey} not found`)\n }\n if (parent.domain.key !== this.key) {\n throw new Error(`Cannot remove an entity from a foreign domain`)\n }\n parent.removeEntity(key)\n return this\n }\n\n /**\n * Lists all entities in a data model, or, if the model key is not provided,\n * all entities in the domain.\n *\n * @param parent The key of the parent data model.\n * @returns A generator that yields each `DomainEntity`.\n * @example\n * ```typescript\n * for (const entity of dataDomain.listEntities('userModel')) {\n * console.log(entity.key);\n * }\n * ```\n */\n *listEntities(parent?: string): Generator<DomainEntity> {\n const iterator = parent ? this.graph.children(parent) : this.graph.nodes()\n for (const node of iterator) {\n const value = this.graph.node(node) as DomainGraphNodeType\n if (value.kind === DomainEntityKind && value.domain.key === this.key) {\n yield value\n }\n }\n }\n\n /**\n * Lists all entities in the graph that are not part of this domain.\n */\n *listForeignEntities(): Generator<DomainEntity> {\n for (const node of this.graph.nodes()) {\n const value = this.graph.node(node) as DomainGraphNodeType\n if (value.kind === DomainEntityKind && value.domain.key !== this.key) {\n yield value\n }\n }\n }\n\n /**\n * Finds an entity by its key.\n *\n * @param key The key of the entity to find.\n * @returns The entity instance or undefined if not found.\n * @example\n * ```typescript\n * const entity = dataDomain.findEntity('user');\n * if (entity) {\n * console.log(entity.key);\n * }\n * ```\n */\n findEntity(key: string): DomainEntity | undefined {\n const node = this.graph.node(key) as DomainEntity | undefined\n if (node && node.kind === DomainEntityKind) {\n return node\n }\n return undefined\n }\n\n /**\n * Moves an entity from one model to another.\n *\n * @param entityKey The key of the entity to move.\n * @param sourceModelKey The key of the source model.\n * @param targetModelKey The key of the target model.\n * @throws Error When the entity, source model, or target model does not exist.\n * @throws Error When the entity is not in the same domain.\n * @throws Error When the source and target models are the same.\n * @throws Error When moving to an unsupported object.\n */\n moveEntity(entityKey: string, sourceModelKey: string, targetModelKey: string): void {\n if (sourceModelKey === targetModelKey) {\n throw new Error(`Cannot move an entity to the same model`)\n }\n if (!this.graph.hasNode(entityKey)) {\n throw new Error(`Entity ${entityKey} does not exist`)\n }\n if (!this.graph.hasNode(sourceModelKey)) {\n throw new Error(`Source model ${sourceModelKey} does not exist`)\n }\n if (!this.graph.hasNode(targetModelKey)) {\n throw new Error(`Target model ${targetModelKey} does not exist`)\n }\n\n const entity = this.findEntity(entityKey)\n const sourceModel = this.findModel(sourceModelKey)\n const targetModel = this.findModel(targetModelKey)\n\n if (!entity || !sourceModel || !targetModel) {\n throw new Error(`Entity or models not found in the graph`)\n }\n\n if (entity.domain.key !== this.key) {\n // this also applied to the parent model.\n throw new Error(`Cannot move an entity from a foreign domain`)\n }\n if (targetModel.domain.key !== this.key) {\n throw new Error(`Cannot move an entity to a foreign domain`)\n }\n // The target model detaches the entity when attaching to self.\n targetModel.attachEntity(entityKey)\n this.notifyChange()\n }\n\n /**\n * Adds an association between two entities.\n *\n * This function is a shortcut that finds the entity and\n * calls the `addAssociation` method on it.\n *\n * @param source The key of the source entity.\n * @param init The association options.\n * @returns The created association.\n * @throws Error When the source entity does not exist.\n * @example\n * ```typescript\n * const addressAssociation = dataDomain.addAssociation(\n * 'user', { key: 'address' }\n * );\n * ```\n */\n addAssociation(source: string, init?: AssociationAddOptions): DomainAssociation {\n if (!this.graph.hasNode(source)) {\n throw new Error(`Source entity ${source} not found`)\n }\n const entity = this.findEntity(source)\n if (!entity) {\n throw new Error(`Source entity ${source} not found`)\n }\n if (entity.domain.key !== this.key) {\n throw new Error(`Cannot add an association to a foreign domain`)\n }\n return entity.addAssociation(init)\n }\n\n /**\n * Removes an association from the graph.\n *\n * @param key The key of the association to remove.\n * @returns The current DataDomain instance.\n * @throws Error When the association does not exist or\n * when the parent entity is not found.\n * @example\n * ```typescript\n * dataDomain.removeAssociation('address');\n * ```\n */\n removeAssociation(key: string): this {\n if (!this.graph.hasNode(key)) {\n throw new Error(`Association ${key} does not exist`)\n }\n const instance = this.graph.node(key) as DomainAssociation\n if (!instance || instance.kind !== DomainAssociationKind) {\n throw new Error(`Association ${key} not found`)\n }\n const entity = instance.getParentInstance()\n if (!entity) {\n throw new Error(`Parent entity not found for association ${key}`)\n }\n if (entity.domain.key !== this.key) {\n throw new Error(`Cannot remove an association from a foreign domain`)\n }\n entity.removeAssociation(key)\n return this\n }\n\n /**\n * Finds an association by its key.\n *\n * @param key The key of the association to find.\n * @returns The association instance or undefined if not\n * found.\n * @example\n * ```typescript\n * const assoc = dataDomain.findAssociation('address');\n * if (assoc) {\n * console.log(assoc.key);\n * }\n * ```\n */\n findAssociation(key: string): DomainAssociation | undefined {\n const node = this.graph.node(key) as DomainAssociation | undefined\n if (node && node.kind === DomainAssociationKind) {\n return node\n }\n return undefined\n }\n\n /**\n * Adds a property to an entity.\n *\n * @param parent The key of the parent entity.\n * @param property The partial property schema.\n * @returns The created property instance.\n * @throws Error When the parent does not exist or is not\n * an entity.\n * @example\n * ```typescript\n * const nameProperty = dataDomain.addProperty(\n * 'user', { key: 'name', type: 'string' }\n * );\n * ```\n */\n addProperty(parent: string, property?: Partial<DomainPropertySchema>): DomainProperty {\n if (!parent) {\n throw new Error(`A property expects a DomainEntity parent`)\n }\n if (!this.graph.hasNode(parent)) {\n throw new Error(`Parent entity ${parent} does not exist`)\n }\n const entity = this.findEntity(parent)\n if (!entity) {\n throw new Error(`Parent entity ${parent} not found`)\n }\n if (entity.domain.key !== this.key) {\n throw new Error(`Cannot add a property to a foreign domain`)\n }\n return entity.addProperty(property)\n }\n\n /**\n * Removes a property from the graph.\n *\n * @param key The key of the property to remove.\n * @returns The current DataDomain instance.\n * @throws Error When the property does not exist or when\n * the parent entity is not found.\n * @example\n * ```typescript\n * dataDomain.removeProperty('name');\n * ```\n */\n removeProperty(key: string): this {\n if (!this.graph.hasNode(key)) {\n throw new Error(`Property ${key} does not exist`)\n }\n const instance = this.graph.node(key) as DomainProperty\n if (!instance || instance.kind !== DomainPropertyKind) {\n throw new Error(`Property ${key} not found`)\n }\n const entity = instance.getParentInstance()\n if (!entity) {\n throw new Error(`Parent entity not found for property ${key}`)\n }\n if (entity.domain.key !== this.key) {\n throw new Error(`Cannot remove a property from a foreign domain`)\n }\n entity.removeProperty(key)\n return this\n }\n\n /**\n * Finds a property by its key.\n *\n * @param key The key of the property to find.\n * @returns The property instance or undefined if not\n * found.\n * @example\n * ```typescript\n * const prop = dataDomain.findProperty('name');\n * if (prop) {\n * console.log(prop.key);\n * }\n * ```\n */\n findProperty(key: string): DomainProperty | undefined {\n const node = this.graph.node(key) as DomainProperty | undefined\n if (node && node.kind === DomainPropertyKind) {\n return node\n }\n return undefined\n }\n\n /**\n * Registers a foreign DataDomain.\n *\n * @param domain The foreign DataDomain instance.\n * @param key The unique identifier for the foreign\n * domain.\n * @param version The version of the foreign domain.\n * @throws Error When a foreign domain with the same key is already registered.\n * @example\n * ```typescript\n * dataDomain.registerForeignDomain(\n * foreignDomain, 'foreignDomain', '1.0.0'\n * );\n * ```\n */\n registerForeignDomain(domain: DataDomain): void {\n const { info, key } = domain\n if (!info.version) {\n // @TODO: make the data domain immutable after a version is set.\n // This will prevent the user from changing the version\n // after the domain is registered.\n throw new Error(`Foreign domain ${key} does not have a version set`)\n }\n if (this.dependencies.has(key)) {\n throw new Error(`Foreign domain with key ${key} already registered`)\n }\n this.dependencies.set(key, domain)\n this.dependencyList.push({ key, version: info.version })\n // Copy the relevant parts of the foreign domain's graph into the local graph.\n // this.copyForeignDomainGraph(domain)\n mergeGraph(this.graph, domain.graph, domain.key)\n this.notifyChange()\n }\n\n /**\n * Un-registers a foreign DataDomain. It removes all defined by the foreign domain\n * information from the graph.\n * @param key The key of the foreign domain to unregister.\n */\n unregisterForeignDomain(key: string): void {\n const foreignDomain = this.dependencies.get(key)\n if (!foreignDomain) {\n throw new Error(`Foreign domain with key ${key} not found`)\n }\n this.dependencies.delete(key)\n this.dependencyList = this.dependencyList.filter((dependency) => dependency.key !== key)\n // Remove the foreign domain's nodes from the local graph.\n removeForeignGraph(this.graph, foreignDomain.key)\n this.notifyChange()\n }\n\n /**\n * Finds an entity in a foreign domain.\n *\n * @param entityKey The key of the entity to find.\n * @param domainKey The key of the foreign domain.\n * @returns The entity instance or undefined if not\n * found.\n * @example\n * ```typescript\n * const foreignUser = dataDomain.findForeignEntity(\n * 'user', 'foreignDomain'\n * );\n * if (foreignUser) {\n * console.log(foreignUser.key);\n * }\n * ```\n */\n findForeignEntity(entityKey: string, domainKey: string): DomainEntity | undefined {\n const foreignDomain = this.dependencies.get(domainKey)\n if (!foreignDomain) {\n return undefined\n }\n const foreignKey = `${domainKey}:${entityKey}`\n const node = this.graph.node(foreignKey)\n if (node && node.kind === DomainEntityKind) {\n return node as DomainEntity\n }\n return undefined\n }\n\n /**\n * A convenience function to remove an object from the\n * namespace.\n *\n * @param key The key of the object to remove.\n * @param kind The kind of the object to remove.\n * @throws Error when the kind is not known.\n * @example\n * ```typescript\n * dataDomain.removeDomainElement('user', DomainEntityKind);\n * ```\n */\n removeDomainElement(key: string, kind: string): void {\n switch (kind) {\n case DomainNamespaceKind:\n this.removeNamespace(key)\n break\n case DomainModelKind:\n this.removeModel(key)\n break\n case DomainEntityKind:\n this.removeEntity(key)\n break\n case DomainPropertyKind:\n this.removeProperty(key)\n break\n case DomainAssociationKind:\n this.removeAssociation(key)\n break\n default:\n throw new Error(`Unknown kind ${kind} for the object ${key}`)\n }\n }\n}\n"]}
@@ -0,0 +1,26 @@
1
+ import type { DataDomain, DataDomainSchema } from './DataDomain.js';
2
+ import type { ForeignDomainDependency } from './types.js';
3
+ export type DomainDependency = DataDomain | DataDomainSchema;
4
+ export interface DependentModelSchema {
5
+ /**
6
+ * A list of foreign domain dependencies.
7
+ */
8
+ dependencyList?: ForeignDomainDependency[];
9
+ }
10
+ /**
11
+ * A base model that has dependencies on foreign data domains.
12
+ */
13
+ export declare class DependentModel extends EventTarget {
14
+ /**
15
+ * A map of foreign data domains.
16
+ * Key: The unique identifier of the foreign domain.
17
+ * Value: The foreign DataDomain instance.
18
+ */
19
+ dependencies: Map<string, DataDomain>;
20
+ /**
21
+ * The list of foreign domain dependencies.
22
+ */
23
+ dependencyList: ForeignDomainDependency[];
24
+ constructor(items?: ForeignDomainDependency[], instances?: DataDomain[]);
25
+ }
26
+ //# sourceMappingURL=DependentModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DependentModel.d.ts","sourceRoot":"","sources":["../../../src/modeling/DependentModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AAEzD,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,gBAAgB,CAAA;AAE5D,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,cAAc,CAAC,EAAE,uBAAuB,EAAE,CAAA;CAC3C;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC7C;;;;OAIG;IACH,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAgC;IAErE;;OAEG;IACH,cAAc,EAAE,uBAAuB,EAAE,CAAK;gBAElC,KAAK,GAAE,uBAAuB,EAAO,EAAE,SAAS,GAAE,UAAU,EAAO;CAOhF"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A base model that has dependencies on foreign data domains.
3
+ */
4
+ export class DependentModel extends EventTarget {
5
+ /**
6
+ * A map of foreign data domains.
7
+ * Key: The unique identifier of the foreign domain.
8
+ * Value: The foreign DataDomain instance.
9
+ */
10
+ dependencies = new Map();
11
+ /**
12
+ * The list of foreign domain dependencies.
13
+ */
14
+ dependencyList = [];
15
+ constructor(items = [], instances = []) {
16
+ super();
17
+ this.dependencyList = [...items];
18
+ for (const dep of instances) {
19
+ this.dependencies.set(dep.key, dep);
20
+ }
21
+ }
22
+ }
23
+ //# sourceMappingURL=DependentModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DependentModel.js","sourceRoot":"","sources":["../../../src/modeling/DependentModel.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC7C;;;;OAIG;IACH,YAAY,GAA4B,IAAI,GAAG,EAAsB,CAAA;IAErE;;OAEG;IACH,cAAc,GAA8B,EAAE,CAAA;IAE9C,YAAY,QAAmC,EAAE,EAAE,YAA0B,EAAE;QAC7E,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,cAAc,GAAG,CAAC,GAAG,KAAK,CAAC,CAAA;QAChC,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;YAC5B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;QACrC,CAAC;IACH,CAAC;CACF","sourcesContent":["import type { DataDomain, DataDomainSchema } from './DataDomain.js'\nimport type { ForeignDomainDependency } from './types.js'\n\nexport type DomainDependency = DataDomain | DataDomainSchema\n\nexport interface DependentModelSchema {\n /**\n * A list of foreign domain dependencies.\n */\n dependencyList?: ForeignDomainDependency[]\n}\n\n/**\n * A base model that has dependencies on foreign data domains.\n */\nexport class DependentModel extends EventTarget {\n /**\n * A map of foreign data domains.\n * Key: The unique identifier of the foreign domain.\n * Value: The foreign DataDomain instance.\n */\n dependencies: Map<string, DataDomain> = new Map<string, DataDomain>()\n\n /**\n * The list of foreign domain dependencies.\n */\n dependencyList: ForeignDomainDependency[] = []\n\n constructor(items: ForeignDomainDependency[] = [], instances: DataDomain[] = []) {\n super()\n this.dependencyList = [...items]\n for (const dep of instances) {\n this.dependencies.set(dep.key, dep)\n }\n }\n}\n"]}
@@ -303,6 +303,8 @@ export interface SessionConfiguration {
303
303
  /**
304
304
  * The properties from the `User` entity to be encoded into the session payload (JWT/cookie).
305
305
  * These properties become available in the `request.auth` object at runtime.
306
+ *
307
+ * In practice, these are the ids of the properties in the `User` entity.
306
308
  */
307
309
  properties: string[];
308
310
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/modeling/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAA;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;;;;;;;;OAYG;IACH,IAAI,EAAE,aAAa,GAAG,UAAU,GAAG,QAAQ,CAAA;CAC5C;AAED,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG,WAAW,GAAG,YAAY,GAAG,cAAc,GAAG,iBAAiB,CAAA;AAEnH;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX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,CAAA;CACd;AACD;;;;GAIG;AACH,MAAM,WAAW,0BAA2B,SAAQ,cAAc;IAChE,IAAI,EAAE,kBAAkB,CAAA;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,KAAK,EAAE,aAAa,EAAE,CAAA;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;;;;;OAOG;IACH,GAAG,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAE1E;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAA;IAE9C;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAA;CACd"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modeling/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { GraphJson } from '@api-client/graph/graph/types.js'\nimport type { Graph } from '@api-client/graph/graph/Graph.js'\nimport type { DomainAssociation } from './DomainAssociation.js'\nimport type { DomainEntity } from './DomainEntity.js'\nimport type { DomainModel } from './DomainModel.js'\nimport type { DomainNamespace } from './DomainNamespace.js'\nimport type { DomainProperty } from './DomainProperty.js'\n\nexport interface DataDomainRemoveOptions {\n /**\n * When true, the object will be forcibly removed.\n * The resolution defined in the `ImpactResolution` class will be applied.\n *\n * For example, when removing an entity that is a parent to another entity, it will\n * removed itself as a parent from the child entity.\n *\n * Note, this option should only be used when the DomainImpactAnalysis has been performed\n * and the user was informed of the impact.\n */\n force?: boolean\n}\n\nexport interface AssociationAddOptions {\n /**\n * When set, it is the the association target's origin data domain.\n * The key of the target data domain where this target entity is defined.\n * Only used when `key` is specified.\n */\n domain?: string\n /**\n * The key of the association target, if known.\n * If the target of the association is not specified, and the association has no other targets,\n * the association is ignored in the namespace while processing.\n */\n key?: string\n}\n\nexport interface DomainGraphEdge {\n /**\n * Indicates that the edge is to or from a foreign domain.\n */\n foreign?: boolean\n /**\n * The key of the foreign domain. Always set with the `foreign` property.\n */\n domain?: string\n /**\n * The type of the edge.\n * - `association` The edge is to an association object.\n * - When coming **from** an entiry (the `v` property), that entity owns the association.\n * - When coming **to** an entity (the `w` property), that entity is the target of the association.\n * An association can have multiple targets.\n * - `property` The edge is to a property object. Can only be created between an entity and a property.\n * - The **from** (`v`) is the entity.\n * - The **to** (`w`) is the property.\n * - `parent` The edge is to a parent object.\n * - The **from** (`v`) is the child entity.\n * - The **to** (`w`) is the parent entity.\n */\n type: 'association' | 'property' | 'parent'\n}\n\nexport type DomainGraphNodeType = DomainNamespace | DomainModel | DomainEntity | DomainProperty | DomainAssociation\n\n/**\n * An interface that describes the data domain dependency.\n */\nexport interface ForeignDomainDependency {\n /**\n * The system registered key of the foreign domain.\n */\n key: string\n /**\n * The version of the foreign domain used in this domain.\n */\n version: string\n}\n\nexport interface AssociationTarget {\n /**\n * The key of the target entity.\n */\n key: string\n /**\n * The key of the target data domain.\n * This is only set when the target is in a different data domain.\n */\n domain?: string\n}\n\n/**\n * Describes the default value set on a property schema.\n */\nexport interface SchemaDefaultValue {\n /**\n * The type of the default value.\n *\n * - `literal` The `value` should be used as-is.\n * - `function` The value represents the name of the function to be used.\n */\n type: 'literal' | 'function'\n /**\n * The actual value type depends on the `type`.\n * It is always a string and it has to be casted to the property's data type.\n */\n value: string\n}\n\n/**\n * A general schema definition for a property.\n * This is propagated to all bindings (when they support these properties).\n */\nexport interface PropertySchema {\n /**\n * The minimum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMinimum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n minimum?: number\n /**\n * The maximum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMaximum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n maximum?: number\n /**\n * When set, the minimum value is exclusive.\n *\n * - When `false`: value ≥ minimum.\n * - When `true`: value > minimum.\n */\n exclusiveMinimum?: boolean\n /**\n * When set, the exclusiveMaximum value is exclusive.\n *\n * - When `false`: value ≤ maximum.\n * - When `true`: value < minimum.\n */\n exclusiveMaximum?: boolean\n /**\n * The multiplier value for a number scalar.\n *\n * Examples:\n * - if `1` then every integer is allowed\n * - if `2` than every even number is allowed\n * - if `0.5` than every number dividable by `0.5` is allowed\n */\n multipleOf?: number\n /**\n * The enum values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n enum?: string[]\n /**\n * The default value for the property.\n * This is always encoded as a string. The actual type is defined in the `dataType` property.\n */\n defaultValue?: SchemaDefaultValue\n /**\n * The example values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n examples?: string[]\n}\n\n/**\n * The shortcut type for the data domain graph.\n */\nexport type DataDomainGraph = Graph<unknown, DomainGraphNodeType, DomainGraphEdge>\n/**\n * The serialized version of the data domain graph.\n */\nexport type SerializedGraph = GraphJson<unknown, object, DomainGraphEdge>\n\n/**\n * Represents a standardized, machine-readable error response body\n * as defined by RFC 7807 for HTTP APIs.\n */\nexport interface ProblemDetails {\n /**\n * A URI that identifies the specific problem type. Should resolve to human-readable docs.\n * e.g., \"https://docs.apinow.app/errors/validation-failed\"\n */\n type: string\n\n /**\n * A short, human-readable summary of the problem type.\n * e.g., \"Validation Error\"\n */\n title: string\n\n /**\n * The HTTP status code generated by the origin server for this problem.\n */\n status?: number\n\n /**\n * A human-readable explanation specific to this occurrence of the problem.\n */\n detail?: string\n\n /**\n * A URI that identifies the specific occurrence of the problem.\n * Can be the API request path that caused the error.\n */\n instance: string\n}\n\n/**\n * The set of supported filter operators for the List action.\n * These are used in query parameters, e.g., ?price[gte]=100\n *\n * - eq: Equal\n * - nq: Not Equal\n * - lt: Less Than\n * - lte: Less Than or Equal\n * - gt: Greater Than\n * - gte: Greater Than or Equal\n * - ex: Checks if the field exists\n * - re: Regular expression match\n * - bf: Date before a specific value\n * - af: Date after a specific value\n * - cn: String contains substring / Array contains element\n * - st: String starts with\n * - end: String ends with\n * - in: Value is one of the elements in the provided array\n * - nin: Value is not one of the elements in the provided array\n */\nexport type ResourceFilterOperator =\n | 'eq' // Equal\n | 'nq' // Not equal\n | 'lt' // Less than\n | 'lte' // Less than or equal\n | 'gt' // Greater than\n | 'gte' // Greater than or equal\n | 'ex' // Checks if the field exists\n | 're' // Regular expression match\n | 'bf' // Date before a specific value\n | 'af' // Date after a specific value\n | 'cn' // String contains substring / Array contains element\n | 'st' // String starts with\n | 'end' // String ends with\n | 'in' // Value is one of the elements in the provided array\n | 'nin' // Value is not one of the elements in the provided array\n\n/**\n * The session transport configuration interface.\n * This defines the properties that are common to all session transports.\n */\ninterface SessionTransport {\n /**\n * Whether the session transport is enabled.\n */\n enabled: boolean\n /**\n * The kind of session transport. Each interface defines its own kind.\n */\n kind: string\n}\n\n/**\n * Configuration for cookie-based session transport.\n */\nexport interface CookieConfiguration extends SessionTransport {\n kind: 'cookie'\n /**\n * The lifetime of the cookie session.\n * This is a string representing the duration, e.g., \"7d\" for 7 days or \"24h\" for 24 hours.\n *\n * @default \"7d\"\n */\n lifetime: string\n /**\n * Whether the cookie can only be accessed by the server.\n * This is a security feature to prevent client-side scripts from accessing the cookie.\n * If set to false, the cookie can be accessed by client-side scripts.\n * @default true\n */\n httpOnly: boolean // Defaults to true\n /**\n * Whether the cookie should only be sent over secure connections (HTTPS).\n * This is a security feature to prevent the cookie from being sent over unencrypted connections.\n * @default true\n */\n secure: boolean\n /**\n * The SameSite attribute of the cookie.\n * This attribute controls whether the cookie is sent with cross-site requests.\n * - 'none' means the cookie is sent with cross-site requests.\n * - 'lax' means the cookie is sent with top-level navigations and will be sent along with GET\n * requests initiated by third-party websites.\n * @default 'none'\n */\n sameSite: 'none' | 'lax'\n /**\n * The name of the cookie.\n * This is the key under which the session data will be stored in the cookie.\n * @default 'as' - 'as' stands for \"api session\"\n */\n name: string\n}\n\n/**\n * Configuration for JWT-based session transport.\n */\nexport interface JwtConfiguration extends SessionTransport {\n kind: 'jwt'\n /**\n * The lifetime of the JWT token.\n * This is a string representing the duration, e.g., \"7d\" for 7 days or \"15m\" for 15 minutes.\n *\n * @default \"7d\"\n */\n lifetime: string\n}\n\nexport interface SessionConfiguration {\n /**\n * The secret used to sign the JWT and cookies. Should be handled securely.\n * Not visible in the UI after being set.\n */\n secret: string\n /**\n * The properties from the `User` entity to be encoded into the session payload (JWT/cookie).\n * These properties become available in the `request.auth` object at runtime.\n */\n properties: string[]\n /**\n * The cookie-based session transport configuration.\n */\n cookie?: CookieConfiguration\n\n /**\n * The JWT-based session transport configuration.\n */\n jwt?: JwtConfiguration\n}\n\n/**\n * Defines the authorization strategy for the API.\n * It is a base interface that can be extended for different strategies.\n * For MVP, we will start with Roles-Based Access Control (RBAC).\n */\nexport interface AuthorizationConfiguration {\n /**\n * The authorization strategy. For MVP, we will start with RBAC.\n * Post-MVP will include Permission-Based Access Control (PBAC).\n * The strategy determines how users are granted access to resources.\n *\n * - RBAC (Roles-Based Access Control): Users are assigned roles, and permissions are granted to those roles.\n * - PBAC (Permission-Based Access Control): Users are granted permissions directly, allowing for more\n * granular control.\n */\n strategy: string\n}\n\nexport interface RolesBasedAccessControl extends AuthorizationConfiguration {\n strategy: 'RBAC'\n /**\n * The property within the designated \"User\" entity that defines the user's role.\n * This field is used in access rules to grant permissions.\n *\n * This property must be marked with the \"Role\" data semantic in the Data Modeler.\n * It is required to publish the API.\n */\n roleKey: string\n}\n\n/**\n * Configures the strategy for authenticating end-users.\n * An API can only support one authentication strategy at a time.\n * This is a base interface that can be extended for different strategies.\n */\nexport interface AuthenticationConfiguration {\n /**\n * The authentication method. For MVP, this is focused on username/password.\n * This can be extended in the future to include 'SSO'.\n */\n strategy: string\n}\n\n/**\n * Configuration for username/password authentication.\n * This is the primary authentication method for the API (MVP).\n */\nexport interface UsernamePasswordConfiguration extends AuthenticationConfiguration {\n strategy: 'UsernamePassword'\n /**\n * The specific property within the User entity that holds the password.\n * This property must be marked with the \"Password\" data semantic in the Data Modeler.\n *\n * This property is required to publish the API.\n */\n passwordKey?: string\n}\n\n/**\n * Represents a Data Entity from the Data Domain that the API will expose and operate upon.\n */\nexport interface ExposedEntity {\n /**\n * The key of the Data Entity from the Data Domain.\n */\n key: string\n\n /**\n * Optional configuration for resource-wide rate limiting and throttling.\n * Defines rules to protect the resource from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\n /**\n * Access control rules defining who can perform actions on this resource or collection.\n * It override the top-level access rules defined in the API model.\n */\n accessRule?: AccessRule[]\n\n /**\n * The collection of API actions (e.g., List, Read, Create) enabled for this entity.\n */\n actions: ApiAction[]\n}\n\n/**\n * Represents a specific, configurable API operation applied to a Data Entity.\n * Corresponds to common RESTful interactions.\n */\nexport type ApiAction = ListAction | ReadAction | CreateAction | UpdateAction | DeleteAction | SearchAction\n\n/**\n * A base interface for common properties across all actions.\n */\ninterface Action {\n /**\n * The specific kind of action (e.g., 'List', 'Read', etc.)\n */\n kind: string\n /**\n * Access control rules defining who can perform this action. It is only applied if the\n * authorization strategy is set to 'RBAC'.\n * If no rules grant access, it's denied by default making it essentially private.\n *\n * Note, the API can defined top level access rules that apply to all actions. If this property is set,\n * it overrides the top level access rules for this specific action.\n *\n * It is an ordered list, meaning the first rule that matches the user will be applied.\n * If multiple rules match, the first one in the list takes precedence.\n * If no rules match, the action is denied.\n */\n accessRule?: AccessRule[]\n /**\n * Optional configuration for action-wide rate limiting and throttling.\n * Defines rules to protect the action from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\n}\n\n/**\n * Represents a pagination strategy for API actions that return collections of resources.\n * This is a base interface that can be extended for different pagination strategies.\n */\nexport interface PaginationStrategy {\n /**\n * The kind of pagination strategy. This is used to identify the specific pagination method.\n * For example, 'cursor' for cursor-based pagination or 'offset' for offset-based pagination.\n */\n kind: string\n /**\n * The default page size for the pagination strategy.\n * This is the number of items returned per page when no specific page size is requested.\n */\n pageSize?: number\n}\n\n/**\n * Represents the cursor-based pagination strategy.\n */\nexport interface CursorPaginationStrategy extends PaginationStrategy {\n kind: 'cursor'\n}\n\n/**\n * Represents the offset-based pagination strategy.\n */\nexport interface OffsetPaginationStrategy extends PaginationStrategy {\n kind: 'offset'\n}\n\n/**\n * Enables retrieving a collection of resources.\n * Endpoint: GET /[entity-collection-name]\n */\nexport interface ListAction extends Action {\n kind: 'list'\n /**\n * The pagination strategy used for this action.\n * This defines how the results are paginated when retrieving a collection of resources.\n * It can be either 'cursor' or 'offset'.\n */\n pagination: PaginationStrategy\n /**\n * Fields from the entity that can be used for filtering.\n * Must be marked as \"indexable\" in the Data Model.\n */\n filterableFields: string[]\n /**\n * Fields from the entity that can be used for sorting.\n */\n sortableFields: string[]\n}\n\n/**\n * Enables retrieving a single resource by its ID.\n * Endpoint: GET /[entity-collection-name]/{id}\n */\nexport interface ReadAction extends Action {\n kind: 'read'\n // Association handling (Link IDs vs. Embed) is defined on the\n // data association itself in the Data Modeler.\n}\n\n/**\n * Enables adding a new resource to a collection.\n * Endpoint: POST /[entity-collection-name]\n */\nexport interface CreateAction extends Action {\n kind: 'create'\n}\n\n/**\n * Enables modifying an existing resource.\n * Endpoints: PUT or PATCH /[entity-collection-name]/{id}\n */\nexport interface UpdateAction extends Action {\n kind: 'update'\n /**\n * The allowed HTTP methods for updates. Default: PATCH only.\n *\n * These two methods represent the two common ways to update a resource:\n * - PUT: Replaces the entire resource with the provided data.\n * - PATCH: Applies a partial update to the resource, allowing for specific fields to be modified.\n */\n allowedMethods: ('PUT' | 'PATCH')[]\n}\n\n/**\n * Enables removing an existing resource.\n * Endpoint: DELETE /[entity-collection-name]/{id}\n */\nexport interface DeleteAction extends Action {\n kind: 'delete'\n /**\n * The strategy for deletion. Default: Soft Delete.\n *\n * @default 'soft'\n */\n strategy?: 'soft' | 'hard'\n}\n\n/**\n * Enables keyword-based search across specified fields.\n * Endpoint: GET /[entity-collection-name]/search\n */\nexport interface SearchAction extends Action {\n kind: 'search'\n /**\n * The fields within the entity to be included in the search scope.\n * Must be \"indexable\" and typically text-based.\n */\n fields: string[]\n}\n\n/**\n * Defines the access control policy for a specific API action.\n * Based on the predefined rule types for session-based authentication.\n */\nexport type AccessRule =\n | AllowPublicAccessRule\n | AllowAuthenticatedAccessRule\n | MatchResourceOwnerAccessRule\n | MatchUserRoleAccessRule\n | MatchUserPropertyAccessRule\n | MatchEmailDomainAccessRule\n\nexport interface BaseAccessRule {\n /**\n * The unique identifier for the access rule.\n * This is used to reference the rule in the API configuration.\n */\n type: string\n}\n\n/**\n * The action is allowed for all users, including unauthenticated ones.\n * This is typically used for public APIs or resources that do not require authentication.\n * It is the most permissive rule and should be used with caution.\n */\nexport interface AllowPublicAccessRule extends BaseAccessRule {\n type: 'public'\n}\n/**\n * The action is allowed for any authenticated user.\n * This rule does not impose any additional restrictions based on user properties or resource ownership.\n * It is used for resources that should be accessible to all logged-in users.\n */\nexport interface AllowAuthenticatedAccessRule extends BaseAccessRule {\n type: 'authenticated'\n}\n/**\n * The action is allowed if the authenticated user's ID matches a specific property on the resource.\n * This is typically used to restrict access to resources owned by the user.\n * For example, a user can only access their own profile or documents.\n */\nexport interface MatchResourceOwnerAccessRule extends BaseAccessRule {\n type: 'resourceOwner'\n /**\n * The property on the resource that should match the authenticated user's ID.\n * This is typically the ID of the user who owns the resource.\n *\n * The domain model should annotate this property with the \"ResourceOwnerIdentifier\" semantic\n * to indicate that it is used for ownership checks.\n */\n property: string\n}\n\n/**\n * The action is allowed if the authenticated user has a specific role.\n * This is used to enforce role-based access control (RBAC).\n * For example, only users with the \"admin\" role can perform certain actions.\n */\nexport interface MatchUserRoleAccessRule extends BaseAccessRule {\n type: 'matchUserRole'\n /**\n * The role that the authenticated user must have to access the resource.\n * This is typically a property on the user entity that defines their role.\n *\n * The domain model should annotate this property with the \"UserRole\" semantic\n * to indicate that it is used for role-based access control.\n */\n role: string\n}\n/**\n * The action is allowed if a specific property on the authenticated user matches an expected value.\n * This is used to enforce other user-specific restrictions.\n */\nexport interface MatchUserPropertyAccessRule extends BaseAccessRule {\n type: 'matchUserProperty'\n /**\n * The property on the authenticated user that should match the expected value.\n */\n property: string\n /**\n * The expected value for the user property.\n */\n value: string\n}\n/**\n * The action is allowed if the authenticated user's email domain matches a specific domain.\n * This is used to restrict access based on the user's email address.\n * For example, only users with an email address from \"mycompany.com\" can access certain resources.\n */\nexport interface MatchEmailDomainAccessRule extends BaseAccessRule {\n type: 'matchEmailDomain'\n /**\n * The email domain that the authenticated user's email must match.\n */\n domain: string\n}\n\n/**\n * Defines the rate limiting and throttling policies for the entire API.\n */\nexport interface RateLimitingConfiguration {\n /**\n * An ordered list of rules. The first rule that matches an incoming\n * request will be applied.\n */\n rules: RateLimitRule[]\n}\n\n/**\n * Represents a single rate limiting rule that applies to a specific\n * type of client, using a token bucket algorithm.\n */\nexport interface RateLimitRule {\n /**\n * A human-readable description of what this rule is for.\n * e.g., \"Limit anonymous users to 60 requests per hour.\"\n */\n description?: string\n\n /**\n * Defines how to group requests for rate limiting. This determines\n * who the limit applies to.\n *\n * - 'ip': Keys on the client's IP address. Best for anonymous traffic.\n * - 'userId': Keys on the authenticated user's ID. Best for logged-in users.\n * - 'role': Applies a shared limit to all users of a specific role.\n */\n key: { type: 'ip' } | { type: 'userId' } | { type: 'role'; value: string }\n\n /**\n * The number of requests allowed over the defined interval.\n * This is the rate at which tokens are added to the bucket.\n */\n rate: number\n\n /**\n * The time interval for the rate.\n */\n interval: 'second' | 'minute' | 'hour' | 'day'\n\n /**\n * The maximum number of requests that can be made in a burst.\n * This represents the \"bucket size.\" A larger burst allows for\n * more requests to be made in a short period before throttling begins.\n */\n burst: number\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modeling/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { GraphJson } from '@api-client/graph/graph/types.js'\nimport type { Graph } from '@api-client/graph/graph/Graph.js'\nimport type { DomainAssociation } from './DomainAssociation.js'\nimport type { DomainEntity } from './DomainEntity.js'\nimport type { DomainModel } from './DomainModel.js'\nimport type { DomainNamespace } from './DomainNamespace.js'\nimport type { DomainProperty } from './DomainProperty.js'\n\nexport interface DataDomainRemoveOptions {\n /**\n * When true, the object will be forcibly removed.\n * The resolution defined in the `ImpactResolution` class will be applied.\n *\n * For example, when removing an entity that is a parent to another entity, it will\n * removed itself as a parent from the child entity.\n *\n * Note, this option should only be used when the DomainImpactAnalysis has been performed\n * and the user was informed of the impact.\n */\n force?: boolean\n}\n\nexport interface AssociationAddOptions {\n /**\n * When set, it is the the association target's origin data domain.\n * The key of the target data domain where this target entity is defined.\n * Only used when `key` is specified.\n */\n domain?: string\n /**\n * The key of the association target, if known.\n * If the target of the association is not specified, and the association has no other targets,\n * the association is ignored in the namespace while processing.\n */\n key?: string\n}\n\nexport interface DomainGraphEdge {\n /**\n * Indicates that the edge is to or from a foreign domain.\n */\n foreign?: boolean\n /**\n * The key of the foreign domain. Always set with the `foreign` property.\n */\n domain?: string\n /**\n * The type of the edge.\n * - `association` The edge is to an association object.\n * - When coming **from** an entiry (the `v` property), that entity owns the association.\n * - When coming **to** an entity (the `w` property), that entity is the target of the association.\n * An association can have multiple targets.\n * - `property` The edge is to a property object. Can only be created between an entity and a property.\n * - The **from** (`v`) is the entity.\n * - The **to** (`w`) is the property.\n * - `parent` The edge is to a parent object.\n * - The **from** (`v`) is the child entity.\n * - The **to** (`w`) is the parent entity.\n */\n type: 'association' | 'property' | 'parent'\n}\n\nexport type DomainGraphNodeType = DomainNamespace | DomainModel | DomainEntity | DomainProperty | DomainAssociation\n\n/**\n * An interface that describes the data domain dependency.\n */\nexport interface ForeignDomainDependency {\n /**\n * The system registered key of the foreign domain.\n */\n key: string\n /**\n * The version of the foreign domain used in this domain.\n */\n version: string\n}\n\nexport interface AssociationTarget {\n /**\n * The key of the target entity.\n */\n key: string\n /**\n * The key of the target data domain.\n * This is only set when the target is in a different data domain.\n */\n domain?: string\n}\n\n/**\n * Describes the default value set on a property schema.\n */\nexport interface SchemaDefaultValue {\n /**\n * The type of the default value.\n *\n * - `literal` The `value` should be used as-is.\n * - `function` The value represents the name of the function to be used.\n */\n type: 'literal' | 'function'\n /**\n * The actual value type depends on the `type`.\n * It is always a string and it has to be casted to the property's data type.\n */\n value: string\n}\n\n/**\n * A general schema definition for a property.\n * This is propagated to all bindings (when they support these properties).\n */\nexport interface PropertySchema {\n /**\n * The minimum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMinimum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n minimum?: number\n /**\n * The maximum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMaximum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n maximum?: number\n /**\n * When set, the minimum value is exclusive.\n *\n * - When `false`: value ≥ minimum.\n * - When `true`: value > minimum.\n */\n exclusiveMinimum?: boolean\n /**\n * When set, the exclusiveMaximum value is exclusive.\n *\n * - When `false`: value ≤ maximum.\n * - When `true`: value < minimum.\n */\n exclusiveMaximum?: boolean\n /**\n * The multiplier value for a number scalar.\n *\n * Examples:\n * - if `1` then every integer is allowed\n * - if `2` than every even number is allowed\n * - if `0.5` than every number dividable by `0.5` is allowed\n */\n multipleOf?: number\n /**\n * The enum values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n enum?: string[]\n /**\n * The default value for the property.\n * This is always encoded as a string. The actual type is defined in the `dataType` property.\n */\n defaultValue?: SchemaDefaultValue\n /**\n * The example values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n examples?: string[]\n}\n\n/**\n * The shortcut type for the data domain graph.\n */\nexport type DataDomainGraph = Graph<unknown, DomainGraphNodeType, DomainGraphEdge>\n/**\n * The serialized version of the data domain graph.\n */\nexport type SerializedGraph = GraphJson<unknown, object, DomainGraphEdge>\n\n/**\n * Represents a standardized, machine-readable error response body\n * as defined by RFC 7807 for HTTP APIs.\n */\nexport interface ProblemDetails {\n /**\n * A URI that identifies the specific problem type. Should resolve to human-readable docs.\n * e.g., \"https://docs.apinow.app/errors/validation-failed\"\n */\n type: string\n\n /**\n * A short, human-readable summary of the problem type.\n * e.g., \"Validation Error\"\n */\n title: string\n\n /**\n * The HTTP status code generated by the origin server for this problem.\n */\n status?: number\n\n /**\n * A human-readable explanation specific to this occurrence of the problem.\n */\n detail?: string\n\n /**\n * A URI that identifies the specific occurrence of the problem.\n * Can be the API request path that caused the error.\n */\n instance: string\n}\n\n/**\n * The set of supported filter operators for the List action.\n * These are used in query parameters, e.g., ?price[gte]=100\n *\n * - eq: Equal\n * - nq: Not Equal\n * - lt: Less Than\n * - lte: Less Than or Equal\n * - gt: Greater Than\n * - gte: Greater Than or Equal\n * - ex: Checks if the field exists\n * - re: Regular expression match\n * - bf: Date before a specific value\n * - af: Date after a specific value\n * - cn: String contains substring / Array contains element\n * - st: String starts with\n * - end: String ends with\n * - in: Value is one of the elements in the provided array\n * - nin: Value is not one of the elements in the provided array\n */\nexport type ResourceFilterOperator =\n | 'eq' // Equal\n | 'nq' // Not equal\n | 'lt' // Less than\n | 'lte' // Less than or equal\n | 'gt' // Greater than\n | 'gte' // Greater than or equal\n | 'ex' // Checks if the field exists\n | 're' // Regular expression match\n | 'bf' // Date before a specific value\n | 'af' // Date after a specific value\n | 'cn' // String contains substring / Array contains element\n | 'st' // String starts with\n | 'end' // String ends with\n | 'in' // Value is one of the elements in the provided array\n | 'nin' // Value is not one of the elements in the provided array\n\n/**\n * The session transport configuration interface.\n * This defines the properties that are common to all session transports.\n */\ninterface SessionTransport {\n /**\n * Whether the session transport is enabled.\n */\n enabled: boolean\n /**\n * The kind of session transport. Each interface defines its own kind.\n */\n kind: string\n}\n\n/**\n * Configuration for cookie-based session transport.\n */\nexport interface CookieConfiguration extends SessionTransport {\n kind: 'cookie'\n /**\n * The lifetime of the cookie session.\n * This is a string representing the duration, e.g., \"7d\" for 7 days or \"24h\" for 24 hours.\n *\n * @default \"7d\"\n */\n lifetime: string\n /**\n * Whether the cookie can only be accessed by the server.\n * This is a security feature to prevent client-side scripts from accessing the cookie.\n * If set to false, the cookie can be accessed by client-side scripts.\n * @default true\n */\n httpOnly: boolean // Defaults to true\n /**\n * Whether the cookie should only be sent over secure connections (HTTPS).\n * This is a security feature to prevent the cookie from being sent over unencrypted connections.\n * @default true\n */\n secure: boolean\n /**\n * The SameSite attribute of the cookie.\n * This attribute controls whether the cookie is sent with cross-site requests.\n * - 'none' means the cookie is sent with cross-site requests.\n * - 'lax' means the cookie is sent with top-level navigations and will be sent along with GET\n * requests initiated by third-party websites.\n * @default 'none'\n */\n sameSite: 'none' | 'lax'\n /**\n * The name of the cookie.\n * This is the key under which the session data will be stored in the cookie.\n * @default 'as' - 'as' stands for \"api session\"\n */\n name: string\n}\n\n/**\n * Configuration for JWT-based session transport.\n */\nexport interface JwtConfiguration extends SessionTransport {\n kind: 'jwt'\n /**\n * The lifetime of the JWT token.\n * This is a string representing the duration, e.g., \"7d\" for 7 days or \"15m\" for 15 minutes.\n *\n * @default \"7d\"\n */\n lifetime: string\n}\n\nexport interface SessionConfiguration {\n /**\n * The secret used to sign the JWT and cookies. Should be handled securely.\n * Not visible in the UI after being set.\n */\n secret: string\n /**\n * The properties from the `User` entity to be encoded into the session payload (JWT/cookie).\n * These properties become available in the `request.auth` object at runtime.\n *\n * In practice, these are the ids of the properties in the `User` entity.\n */\n properties: string[]\n /**\n * The cookie-based session transport configuration.\n */\n cookie?: CookieConfiguration\n\n /**\n * The JWT-based session transport configuration.\n */\n jwt?: JwtConfiguration\n}\n\n/**\n * Defines the authorization strategy for the API.\n * It is a base interface that can be extended for different strategies.\n * For MVP, we will start with Roles-Based Access Control (RBAC).\n */\nexport interface AuthorizationConfiguration {\n /**\n * The authorization strategy. For MVP, we will start with RBAC.\n * Post-MVP will include Permission-Based Access Control (PBAC).\n * The strategy determines how users are granted access to resources.\n *\n * - RBAC (Roles-Based Access Control): Users are assigned roles, and permissions are granted to those roles.\n * - PBAC (Permission-Based Access Control): Users are granted permissions directly, allowing for more\n * granular control.\n */\n strategy: string\n}\n\nexport interface RolesBasedAccessControl extends AuthorizationConfiguration {\n strategy: 'RBAC'\n /**\n * The property within the designated \"User\" entity that defines the user's role.\n * This field is used in access rules to grant permissions.\n *\n * This property must be marked with the \"Role\" data semantic in the Data Modeler.\n * It is required to publish the API.\n */\n roleKey: string\n}\n\n/**\n * Configures the strategy for authenticating end-users.\n * An API can only support one authentication strategy at a time.\n * This is a base interface that can be extended for different strategies.\n */\nexport interface AuthenticationConfiguration {\n /**\n * The authentication method. For MVP, this is focused on username/password.\n * This can be extended in the future to include 'SSO'.\n */\n strategy: string\n}\n\n/**\n * Configuration for username/password authentication.\n * This is the primary authentication method for the API (MVP).\n */\nexport interface UsernamePasswordConfiguration extends AuthenticationConfiguration {\n strategy: 'UsernamePassword'\n /**\n * The specific property within the User entity that holds the password.\n * This property must be marked with the \"Password\" data semantic in the Data Modeler.\n *\n * This property is required to publish the API.\n */\n passwordKey?: string\n}\n\n/**\n * Represents a Data Entity from the Data Domain that the API will expose and operate upon.\n */\nexport interface ExposedEntity {\n /**\n * The key of the Data Entity from the Data Domain.\n */\n key: string\n\n /**\n * Optional configuration for resource-wide rate limiting and throttling.\n * Defines rules to protect the resource from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\n /**\n * Access control rules defining who can perform actions on this resource or collection.\n * It override the top-level access rules defined in the API model.\n */\n accessRule?: AccessRule[]\n\n /**\n * The collection of API actions (e.g., List, Read, Create) enabled for this entity.\n */\n actions: ApiAction[]\n}\n\n/**\n * Represents a specific, configurable API operation applied to a Data Entity.\n * Corresponds to common RESTful interactions.\n */\nexport type ApiAction = ListAction | ReadAction | CreateAction | UpdateAction | DeleteAction | SearchAction\n\n/**\n * A base interface for common properties across all actions.\n */\ninterface Action {\n /**\n * The specific kind of action (e.g., 'List', 'Read', etc.)\n */\n kind: string\n /**\n * Access control rules defining who can perform this action. It is only applied if the\n * authorization strategy is set to 'RBAC'.\n * If no rules grant access, it's denied by default making it essentially private.\n *\n * Note, the API can defined top level access rules that apply to all actions. If this property is set,\n * it overrides the top level access rules for this specific action.\n *\n * It is an ordered list, meaning the first rule that matches the user will be applied.\n * If multiple rules match, the first one in the list takes precedence.\n * If no rules match, the action is denied.\n */\n accessRule?: AccessRule[]\n /**\n * Optional configuration for action-wide rate limiting and throttling.\n * Defines rules to protect the action from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\n}\n\n/**\n * Represents a pagination strategy for API actions that return collections of resources.\n * This is a base interface that can be extended for different pagination strategies.\n */\nexport interface PaginationStrategy {\n /**\n * The kind of pagination strategy. This is used to identify the specific pagination method.\n * For example, 'cursor' for cursor-based pagination or 'offset' for offset-based pagination.\n */\n kind: string\n /**\n * The default page size for the pagination strategy.\n * This is the number of items returned per page when no specific page size is requested.\n */\n pageSize?: number\n}\n\n/**\n * Represents the cursor-based pagination strategy.\n */\nexport interface CursorPaginationStrategy extends PaginationStrategy {\n kind: 'cursor'\n}\n\n/**\n * Represents the offset-based pagination strategy.\n */\nexport interface OffsetPaginationStrategy extends PaginationStrategy {\n kind: 'offset'\n}\n\n/**\n * Enables retrieving a collection of resources.\n * Endpoint: GET /[entity-collection-name]\n */\nexport interface ListAction extends Action {\n kind: 'list'\n /**\n * The pagination strategy used for this action.\n * This defines how the results are paginated when retrieving a collection of resources.\n * It can be either 'cursor' or 'offset'.\n */\n pagination: PaginationStrategy\n /**\n * Fields from the entity that can be used for filtering.\n * Must be marked as \"indexable\" in the Data Model.\n */\n filterableFields: string[]\n /**\n * Fields from the entity that can be used for sorting.\n */\n sortableFields: string[]\n}\n\n/**\n * Enables retrieving a single resource by its ID.\n * Endpoint: GET /[entity-collection-name]/{id}\n */\nexport interface ReadAction extends Action {\n kind: 'read'\n // Association handling (Link IDs vs. Embed) is defined on the\n // data association itself in the Data Modeler.\n}\n\n/**\n * Enables adding a new resource to a collection.\n * Endpoint: POST /[entity-collection-name]\n */\nexport interface CreateAction extends Action {\n kind: 'create'\n}\n\n/**\n * Enables modifying an existing resource.\n * Endpoints: PUT or PATCH /[entity-collection-name]/{id}\n */\nexport interface UpdateAction extends Action {\n kind: 'update'\n /**\n * The allowed HTTP methods for updates. Default: PATCH only.\n *\n * These two methods represent the two common ways to update a resource:\n * - PUT: Replaces the entire resource with the provided data.\n * - PATCH: Applies a partial update to the resource, allowing for specific fields to be modified.\n */\n allowedMethods: ('PUT' | 'PATCH')[]\n}\n\n/**\n * Enables removing an existing resource.\n * Endpoint: DELETE /[entity-collection-name]/{id}\n */\nexport interface DeleteAction extends Action {\n kind: 'delete'\n /**\n * The strategy for deletion. Default: Soft Delete.\n *\n * @default 'soft'\n */\n strategy?: 'soft' | 'hard'\n}\n\n/**\n * Enables keyword-based search across specified fields.\n * Endpoint: GET /[entity-collection-name]/search\n */\nexport interface SearchAction extends Action {\n kind: 'search'\n /**\n * The fields within the entity to be included in the search scope.\n * Must be \"indexable\" and typically text-based.\n */\n fields: string[]\n}\n\n/**\n * Defines the access control policy for a specific API action.\n * Based on the predefined rule types for session-based authentication.\n */\nexport type AccessRule =\n | AllowPublicAccessRule\n | AllowAuthenticatedAccessRule\n | MatchResourceOwnerAccessRule\n | MatchUserRoleAccessRule\n | MatchUserPropertyAccessRule\n | MatchEmailDomainAccessRule\n\nexport interface BaseAccessRule {\n /**\n * The unique identifier for the access rule.\n * This is used to reference the rule in the API configuration.\n */\n type: string\n}\n\n/**\n * The action is allowed for all users, including unauthenticated ones.\n * This is typically used for public APIs or resources that do not require authentication.\n * It is the most permissive rule and should be used with caution.\n */\nexport interface AllowPublicAccessRule extends BaseAccessRule {\n type: 'public'\n}\n/**\n * The action is allowed for any authenticated user.\n * This rule does not impose any additional restrictions based on user properties or resource ownership.\n * It is used for resources that should be accessible to all logged-in users.\n */\nexport interface AllowAuthenticatedAccessRule extends BaseAccessRule {\n type: 'authenticated'\n}\n/**\n * The action is allowed if the authenticated user's ID matches a specific property on the resource.\n * This is typically used to restrict access to resources owned by the user.\n * For example, a user can only access their own profile or documents.\n */\nexport interface MatchResourceOwnerAccessRule extends BaseAccessRule {\n type: 'resourceOwner'\n /**\n * The property on the resource that should match the authenticated user's ID.\n * This is typically the ID of the user who owns the resource.\n *\n * The domain model should annotate this property with the \"ResourceOwnerIdentifier\" semantic\n * to indicate that it is used for ownership checks.\n */\n property: string\n}\n\n/**\n * The action is allowed if the authenticated user has a specific role.\n * This is used to enforce role-based access control (RBAC).\n * For example, only users with the \"admin\" role can perform certain actions.\n */\nexport interface MatchUserRoleAccessRule extends BaseAccessRule {\n type: 'matchUserRole'\n /**\n * The role that the authenticated user must have to access the resource.\n * This is typically a property on the user entity that defines their role.\n *\n * The domain model should annotate this property with the \"UserRole\" semantic\n * to indicate that it is used for role-based access control.\n */\n role: string\n}\n/**\n * The action is allowed if a specific property on the authenticated user matches an expected value.\n * This is used to enforce other user-specific restrictions.\n */\nexport interface MatchUserPropertyAccessRule extends BaseAccessRule {\n type: 'matchUserProperty'\n /**\n * The property on the authenticated user that should match the expected value.\n */\n property: string\n /**\n * The expected value for the user property.\n */\n value: string\n}\n/**\n * The action is allowed if the authenticated user's email domain matches a specific domain.\n * This is used to restrict access based on the user's email address.\n * For example, only users with an email address from \"mycompany.com\" can access certain resources.\n */\nexport interface MatchEmailDomainAccessRule extends BaseAccessRule {\n type: 'matchEmailDomain'\n /**\n * The email domain that the authenticated user's email must match.\n */\n domain: string\n}\n\n/**\n * Defines the rate limiting and throttling policies for the entire API.\n */\nexport interface RateLimitingConfiguration {\n /**\n * An ordered list of rules. The first rule that matches an incoming\n * request will be applied.\n */\n rules: RateLimitRule[]\n}\n\n/**\n * Represents a single rate limiting rule that applies to a specific\n * type of client, using a token bucket algorithm.\n */\nexport interface RateLimitRule {\n /**\n * A human-readable description of what this rule is for.\n * e.g., \"Limit anonymous users to 60 requests per hour.\"\n */\n description?: string\n\n /**\n * Defines how to group requests for rate limiting. This determines\n * who the limit applies to.\n *\n * - 'ip': Keys on the client's IP address. Best for anonymous traffic.\n * - 'userId': Keys on the authenticated user's ID. Best for logged-in users.\n * - 'role': Applies a shared limit to all users of a specific role.\n */\n key: { type: 'ip' } | { type: 'userId' } | { type: 'role'; value: string }\n\n /**\n * The number of requests allowed over the defined interval.\n * This is the rate at which tokens are added to the bucket.\n */\n rate: number\n\n /**\n * The time interval for the rate.\n */\n interval: 'second' | 'minute' | 'hour' | 'day'\n\n /**\n * The maximum number of requests that can be made in a burst.\n * This represents the \"bucket size.\" A larger burst allows for\n * more requests to be made in a short period before throttling begins.\n */\n burst: number\n}\n"]}