@api-client/core 0.18.18 → 0.18.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/build/src/modeling/DataDomain.d.ts +35 -1
  2. package/build/src/modeling/DataDomain.d.ts.map +1 -1
  3. package/build/src/modeling/DataDomain.js +120 -0
  4. package/build/src/modeling/DataDomain.js.map +1 -1
  5. package/build/src/modeling/DomainProperty.d.ts +10 -0
  6. package/build/src/modeling/DomainProperty.d.ts.map +1 -1
  7. package/build/src/modeling/DomainProperty.js +26 -2
  8. package/build/src/modeling/DomainProperty.js.map +1 -1
  9. package/build/src/modeling/definitions/SKU.d.ts.map +1 -1
  10. package/build/src/modeling/definitions/SKU.js +2 -0
  11. package/build/src/modeling/definitions/SKU.js.map +1 -1
  12. package/build/src/modeling/helpers/Intelisense.d.ts +472 -0
  13. package/build/src/modeling/helpers/Intelisense.d.ts.map +1 -0
  14. package/build/src/modeling/helpers/Intelisense.js +1201 -0
  15. package/build/src/modeling/helpers/Intelisense.js.map +1 -0
  16. package/build/src/modeling/templates/blog-domain.d.ts +40 -0
  17. package/build/src/modeling/templates/blog-domain.d.ts.map +1 -0
  18. package/build/src/modeling/templates/blog-domain.js +621 -0
  19. package/build/src/modeling/templates/blog-domain.js.map +1 -0
  20. package/build/src/modeling/templates/ecommerce-domain.d.ts +39 -0
  21. package/build/src/modeling/templates/ecommerce-domain.d.ts.map +1 -0
  22. package/build/src/modeling/templates/ecommerce-domain.js +662 -0
  23. package/build/src/modeling/templates/ecommerce-domain.js.map +1 -0
  24. package/build/src/modeling/templates/types.d.ts +9 -0
  25. package/build/src/modeling/templates/types.d.ts.map +1 -0
  26. package/build/src/modeling/templates/types.js +2 -0
  27. package/build/src/modeling/templates/types.js.map +1 -0
  28. package/build/src/modeling/types.d.ts +49 -0
  29. package/build/src/modeling/types.d.ts.map +1 -1
  30. package/build/src/modeling/types.js.map +1 -1
  31. package/build/tsconfig.tsbuildinfo +1 -1
  32. package/data/models/example-generator-api.json +6 -6
  33. package/package.json +1 -1
  34. package/src/modeling/DataDomain.ts +144 -0
  35. package/src/modeling/DomainProperty.ts +23 -0
  36. package/src/modeling/definitions/SKU.ts +2 -0
  37. package/src/modeling/helpers/Intelisense.ts +1346 -0
  38. package/src/modeling/templates/blog-domain.ts +788 -0
  39. package/src/modeling/templates/ecommerce-domain.ts +834 -0
  40. package/src/modeling/templates/types.ts +9 -0
  41. package/src/modeling/types.ts +63 -0
  42. package/tests/unit/modeling/DataDomain.search.spec.ts +188 -0
  43. package/tests/unit/modeling/helpers/intellisense.spec.ts +971 -0
@@ -1,6 +1,6 @@
1
1
  import { Graph } from '@api-client/graph/graph/Graph.js';
2
2
  import { DataDomainKind } from '../models/kinds.js';
3
- import type { AssociationAddOptions, DeserializationIssue, DeserializationMode, DomainGraphEdge, DomainGraphNodeType, SerializedGraph } from './types.js';
3
+ import type { AssociationAddOptions, DeserializationIssue, DeserializationMode, DomainGraphEdge, DomainGraphNodeType, SerializedGraph, DomainSearchCriteria, DomainSearchResult } from './types.js';
4
4
  import { type DomainNamespaceSchema, DomainNamespace, type NamespaceOrderedItem } from './DomainNamespace.js';
5
5
  import { type DomainModelSchema, DomainModel } from './DomainModel.js';
6
6
  import { type DomainEntitySchema, DomainEntity } from './DomainEntity.js';
@@ -662,5 +662,39 @@ export declare class DataDomain extends DependentModel {
662
662
  * ```
663
663
  */
664
664
  removeDomainElement(key: string, kind: string): void;
665
+ /**
666
+ * Searches domain nodes by text content and/or node type.
667
+ *
668
+ * This function traverses the graph and filters nodes based on the provided search criteria.
669
+ * It can search through name, displayName, and description fields of domain objects,
670
+ * and optionally filter by specific node types.
671
+ *
672
+ * @param criteria Search criteria including query string/regex and filtering options.
673
+ * @returns An array of search results containing matching nodes and metadata.
674
+ *
675
+ * @example
676
+ * ```typescript
677
+ * // Search for nodes containing "user" in any text field
678
+ * const results = dataDomain.search({ query: 'user' });
679
+ *
680
+ * // Search for entities only
681
+ * const entityResults = dataDomain.search({
682
+ * nodeTypes: [DomainEntityKind]
683
+ * });
684
+ *
685
+ * // Search for "user" in entities and properties with case-sensitive matching
686
+ * const specificResults = dataDomain.search({
687
+ * query: 'User',
688
+ * nodeTypes: [DomainEntityKind, DomainPropertyKind],
689
+ * caseSensitive: true
690
+ * });
691
+ *
692
+ * // Search using regex pattern
693
+ * const regexResults = dataDomain.search({
694
+ * query: /^user/i
695
+ * });
696
+ * ```
697
+ */
698
+ search(criteria?: DomainSearchCriteria): DomainSearchResult[];
665
699
  }
666
700
  //# sourceMappingURL=DataDomain.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataDomain.d.ts","sourceRoot":"","sources":["../../../src/modeling/DataDomain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAA;AACxD,OAAO,EAEL,cAAc,EAKf,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,eAAe,EAChB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,KAAK,qBAAqB,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC7G,OAAO,EAAE,KAAK,iBAAiB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,KAAK,kBAAkB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAGvD,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtG,MAAM,WAAW,gBAAi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IAsBpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,MAAM,CAAC,QAAQ,GAAE,oBAAyB,GAAG,kBAAkB,EAAE;CA2GlE"}
@@ -1277,5 +1277,125 @@ export class DataDomain extends DependentModel {
1277
1277
  throw new Error(`Unknown kind ${kind} for the object ${key}`);
1278
1278
  }
1279
1279
  }
1280
+ /**
1281
+ * Searches domain nodes by text content and/or node type.
1282
+ *
1283
+ * This function traverses the graph and filters nodes based on the provided search criteria.
1284
+ * It can search through name, displayName, and description fields of domain objects,
1285
+ * and optionally filter by specific node types.
1286
+ *
1287
+ * @param criteria Search criteria including query string/regex and filtering options.
1288
+ * @returns An array of search results containing matching nodes and metadata.
1289
+ *
1290
+ * @example
1291
+ * ```typescript
1292
+ * // Search for nodes containing "user" in any text field
1293
+ * const results = dataDomain.search({ query: 'user' });
1294
+ *
1295
+ * // Search for entities only
1296
+ * const entityResults = dataDomain.search({
1297
+ * nodeTypes: [DomainEntityKind]
1298
+ * });
1299
+ *
1300
+ * // Search for "user" in entities and properties with case-sensitive matching
1301
+ * const specificResults = dataDomain.search({
1302
+ * query: 'User',
1303
+ * nodeTypes: [DomainEntityKind, DomainPropertyKind],
1304
+ * caseSensitive: true
1305
+ * });
1306
+ *
1307
+ * // Search using regex pattern
1308
+ * const regexResults = dataDomain.search({
1309
+ * query: /^user/i
1310
+ * });
1311
+ * ```
1312
+ */
1313
+ search(criteria = {}) {
1314
+ const { query, nodeTypes, includeForeignDomains = false, caseSensitive = false } = criteria;
1315
+ const results = [];
1316
+ // If no criteria provided, return all nodes
1317
+ const shouldReturnAll = !query && (!nodeTypes || nodeTypes.length === 0);
1318
+ // Helper function to check if a node matches the type filter
1319
+ const matchesNodeType = (nodeKind) => {
1320
+ if (!nodeTypes || nodeTypes.length === 0) {
1321
+ return true;
1322
+ }
1323
+ return nodeTypes.includes(nodeKind);
1324
+ };
1325
+ // Helper function to check if text matches the query
1326
+ const matchesQuery = (text) => {
1327
+ if (!text || !query) {
1328
+ return !query; // If no query, consider it a match
1329
+ }
1330
+ if (query instanceof RegExp) {
1331
+ return query.test(text);
1332
+ }
1333
+ // String query
1334
+ const searchText = caseSensitive ? text : text.toLowerCase();
1335
+ const searchQuery = caseSensitive ? query : query.toLowerCase();
1336
+ return searchText.includes(searchQuery);
1337
+ };
1338
+ // Helper function to get matched fields for a node
1339
+ const getMatchedFields = (node) => {
1340
+ if (!query) {
1341
+ return []; // No query means no specific field matching
1342
+ }
1343
+ const matched = [];
1344
+ const { info } = node;
1345
+ if (matchesQuery(info.name)) {
1346
+ matched.push('name');
1347
+ }
1348
+ if (matchesQuery(info.displayName)) {
1349
+ matched.push('displayName');
1350
+ }
1351
+ if (matchesQuery(info.description)) {
1352
+ matched.push('description');
1353
+ }
1354
+ return matched;
1355
+ };
1356
+ // Helper function to determine if a node key belongs to a foreign domain
1357
+ const isForeignNode = (nodeKey) => {
1358
+ return nodeKey.includes(':');
1359
+ };
1360
+ // Iterate through all nodes in the graph
1361
+ for (const nodeKey of this.graph.nodes()) {
1362
+ const node = this.graph.node(nodeKey);
1363
+ // Skip if node doesn't exist or doesn't have required properties
1364
+ if (!node || !node.info) {
1365
+ continue;
1366
+ }
1367
+ const isForeign = isForeignNode(nodeKey);
1368
+ // Skip foreign nodes if not requested
1369
+ if (isForeign && !includeForeignDomains) {
1370
+ continue;
1371
+ }
1372
+ // Check node type filter
1373
+ if (!matchesNodeType(node.kind)) {
1374
+ continue;
1375
+ }
1376
+ // If returning all nodes (no specific criteria), add the node
1377
+ if (shouldReturnAll) {
1378
+ results.push({
1379
+ node,
1380
+ matchedFields: [],
1381
+ key: nodeKey,
1382
+ isForeign,
1383
+ });
1384
+ continue;
1385
+ }
1386
+ // Check text query match
1387
+ const matchedFields = getMatchedFields(node);
1388
+ const hasTextMatch = !query || matchedFields.length > 0;
1389
+ if (hasTextMatch) {
1390
+ results.push({
1391
+ node,
1392
+ matchedFields,
1393
+ key: nodeKey,
1394
+ isForeign,
1395
+ });
1396
+ }
1397
+ }
1398
+ return results;
1399
+ }
1280
1400
  }
1281
1401
  //# sourceMappingURL=DataDomain.js.map
@@ -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;AAS3B,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;AACjG,OAAO,EAAE,cAAc,EAAoD,MAAM,qBAAqB,CAAA;AAetG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,MAAM,OAAO,UAAW,SAAQ,cAAc;IAC5C;;OAEG;IACH,IAAI,CAAuB;IAC3B;;OAEG;IACH,GAAG,CAAQ;IAEX;;OAEG;IACH,KAAK,CAAsD;IAE3D;;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;IAAvC,IAAS,MAAM,kDAAwB;IAEvC;;;OAGG;IACH,MAAM,GAA2B,EAAE,CAAA;IAEnC,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,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 DeserializationIssue,\n DeserializationMode,\n DomainGraphEdge,\n DomainGraphNodeType,\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'\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 /**\n * The list of issues encountered during deserialization.\n * This is only populated when deserialization fails in lenient mode.\n */\n issues: DeserializationIssue[] = []\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[] = [], mode?: DeserializationMode) {\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 const result = deserialize(this, {\n json: init.graph,\n dependencies: instances,\n mode: mode || 'strict',\n })\n this.graph = result.graph\n if (result.issues.length > 0 && mode === 'lenient') {\n this.issues = result.issues\n }\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 * Lists all namespaces in the graph that are part of specified domain.\n *\n * @param namespace The foreign namespace to search in. When not found, it throws an error.\n * @returns A generator that yields each `DomainNamespace`.\n * @throws Error When the foreign domain is not found.\n * @example\n * ```typescript\n * for (const ns of dataDomain.listForeignNamespaces('foreignDomainKey')) {\n * console.log(ns.key);\n * }\n * ```\n */\n *listForeignNamespaces(namespace: string): Generator<DomainNamespace> {\n const foreignDomain = this.dependencies.get(namespace)\n if (!foreignDomain) {\n throw new Error(`Foreign domain ${namespace} not found`)\n }\n for (const node of foreignDomain.listNamespaces()) {\n const key = `${namespace}:${node.key}`\n const value = this.graph.node(key)\n if (value) {\n yield node\n }\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 * Builds a reference key for a domain object.\n *\n * If the namespace is provided and it is different from the domain key,\n * it will return the key in the format `namespace:key`. The foreign namespace\n * must be registered in the domain's dependencies otherwise an error will be thrown.\n *\n * @param key The key of the namespace or model.\n * @param namespace The namespace to search in. When different from the domain key, it looks for a foreign namespace.\n * @returns The reference key in the format `namespace:key` or just `key` if no namespace is provided.\n * @throws Error When the foreign domain is not found.\n * @example\n * ```typescript\n * const refKey = dataDomain.buildReferenceKey('userModel', 'domainKey');\n * ```\n */\n buildReferenceKey(key: string, namespace?: string): string {\n if (namespace && namespace !== this.key) {\n if (typeof namespace !== 'string' || namespace.length === 0) {\n throw new Error(`Invalid namespace key. Expected a string, got ${typeof namespace}`)\n }\n const foreignDomain = this.dependencies.get(namespace)\n if (!foreignDomain) {\n throw new Error(`Foreign domain ${namespace} not found`)\n }\n return `${namespace}:${key}`\n }\n return key\n }\n\n /**\n * Finds a namespace by its key.\n *\n * @param key The key of the namespace to find.\n * @param namespace The namespace to search in. When different from the domain key, it looks for a foreign namespace.\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, namespace?: string): DomainNamespace | undefined {\n const result = this.graph.node(this.buildReferenceKey(key, namespace)) 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 model of namespace.listModels()) {\n * console.log(model.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 * Lists all models in the graph that are part of specified domain.\n *\n * @param namespace The foreign namespace to search in. When not found, it throws an error.\n * @returns A generator that yields each `DomainModel`.\n * @throws Error When the foreign domain is not found.\n * @example\n * ```typescript\n * for (const model of dataDomain.listForeignModels('foreignDomainKey')) {\n * console.log(model.key);\n * }\n * ```\n */\n *listForeignModels(namespace: string): Generator<DomainModel> {\n const foreignDomain = this.dependencies.get(namespace)\n if (!foreignDomain) {\n throw new Error(`Foreign domain ${namespace} not found`)\n }\n for (const node of foreignDomain.listModels()) {\n const key = `${namespace}:${node.key}`\n const value = this.graph.node(key)\n if (value) {\n yield node\n }\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 * @param namespace The namespace to search in. When different from the domain key, it looks for a foreign entity.\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, namespace?: string): DomainModel | undefined {\n const value = this.graph.node(this.buildReferenceKey(key, namespace)) 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 part of specified domain.\n *\n * @param namespace The foreign namespace to search in. When not found, it throws an error.\n * @returns A generator that yields each `DomainEntity`.\n * @throws Error When the foreign domain is not found.\n * @example\n * ```typescript\n * for (const model of dataDomain.listForeignEntities('foreignDomainKey')) {\n * console.log(model.key);\n * }\n * ```\n */\n *listForeignEntities(namespace: string): Generator<DomainEntity> {\n const foreignDomain = this.dependencies.get(namespace)\n if (!foreignDomain) {\n throw new Error(`Foreign domain ${namespace} not found`)\n }\n for (const node of foreignDomain.listEntities()) {\n const key = `${namespace}:${node.key}`\n const value = this.graph.node(key)\n if (value) {\n yield node\n }\n }\n }\n\n /**\n * Lists all entities in the graph that are not part of this domain.\n */\n *listAllForeignEntities(): 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 * @param namespace The namespace to search in. When different from the domain key, it looks for a foreign entity.\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, namespace?: string): DomainEntity | undefined {\n const node = this.graph.node(this.buildReferenceKey(key, namespace)) 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 * @param namespace The namespace to search in. When different from the domain key, it looks for a foreign association\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, namespace?: string): DomainAssociation | undefined {\n const node = this.graph.node(this.buildReferenceKey(key, namespace)) 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 * @param namespace The namespace to search in. When different from the domain key, it looks for a foreign property\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, namespace?: string): DomainProperty | undefined {\n const node = this.graph.node(this.buildReferenceKey(key, namespace)) 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 * @deprecated Use `findEntity` with the `namespace` parameter instead.\n * This method is kept for backward compatibility but will be removed in the future.\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;AAY3B,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;AACjG,OAAO,EAAE,cAAc,EAAoD,MAAM,qBAAqB,CAAA;AAetG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,MAAM,OAAO,UAAW,SAAQ,cAAc;IAC5C;;OAEG;I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ACX,IAAI;oBACJ,aAAa;oBACb,GAAG,EAAE,OAAO;oBACZ,SAAS;iBACV,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAA;IAChB,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 DeserializationIssue,\n DeserializationMode,\n DomainGraphEdge,\n DomainGraphNodeType,\n SerializedGraph,\n DomainSearchCriteria,\n DomainSearchResult,\n SearchableNodeType,\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'\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 /**\n * The list of issues encountered during deserialization.\n * This is only populated when deserialization fails in lenient mode.\n */\n issues: DeserializationIssue[] = []\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[] = [], mode?: DeserializationMode) {\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 const result = deserialize(this, {\n json: init.graph,\n dependencies: instances,\n mode: mode || 'strict',\n })\n this.graph = result.graph\n if (result.issues.length > 0 && mode === 'lenient') {\n this.issues = result.issues\n }\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 * Lists all namespaces in the graph that are part of specified domain.\n *\n * @param namespace The foreign namespace to search in. When not found, it throws an error.\n * @returns A generator that yields each `DomainNamespace`.\n * @throws Error When the foreign domain is not found.\n * @example\n * ```typescript\n * for (const ns of dataDomain.listForeignNamespaces('foreignDomainKey')) {\n * console.log(ns.key);\n * }\n * ```\n */\n *listForeignNamespaces(namespace: string): Generator<DomainNamespace> {\n const foreignDomain = this.dependencies.get(namespace)\n if (!foreignDomain) {\n throw new Error(`Foreign domain ${namespace} not found`)\n }\n for (const node of foreignDomain.listNamespaces()) {\n const key = `${namespace}:${node.key}`\n const value = this.graph.node(key)\n if (value) {\n yield node\n }\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 * Builds a reference key for a domain object.\n *\n * If the namespace is provided and it is different from the domain key,\n * it will return the key in the format `namespace:key`. The foreign namespace\n * must be registered in the domain's dependencies otherwise an error will be thrown.\n *\n * @param key The key of the namespace or model.\n * @param namespace The namespace to search in. When different from the domain key, it looks for a foreign namespace.\n * @returns The reference key in the format `namespace:key` or just `key` if no namespace is provided.\n * @throws Error When the foreign domain is not found.\n * @example\n * ```typescript\n * const refKey = dataDomain.buildReferenceKey('userModel', 'domainKey');\n * ```\n */\n buildReferenceKey(key: string, namespace?: string): string {\n if (namespace && namespace !== this.key) {\n if (typeof namespace !== 'string' || namespace.length === 0) {\n throw new Error(`Invalid namespace key. Expected a string, got ${typeof namespace}`)\n }\n const foreignDomain = this.dependencies.get(namespace)\n if (!foreignDomain) {\n throw new Error(`Foreign domain ${namespace} not found`)\n }\n return `${namespace}:${key}`\n }\n return key\n }\n\n /**\n * Finds a namespace by its key.\n *\n * @param key The key of the namespace to find.\n * @param namespace The namespace to search in. When different from the domain key, it looks for a foreign namespace.\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, namespace?: string): DomainNamespace | undefined {\n const result = this.graph.node(this.buildReferenceKey(key, namespace)) 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 model of namespace.listModels()) {\n * console.log(model.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 * Lists all models in the graph that are part of specified domain.\n *\n * @param namespace The foreign namespace to search in. When not found, it throws an error.\n * @returns A generator that yields each `DomainModel`.\n * @throws Error When the foreign domain is not found.\n * @example\n * ```typescript\n * for (const model of dataDomain.listForeignModels('foreignDomainKey')) {\n * console.log(model.key);\n * }\n * ```\n */\n *listForeignModels(namespace: string): Generator<DomainModel> {\n const foreignDomain = this.dependencies.get(namespace)\n if (!foreignDomain) {\n throw new Error(`Foreign domain ${namespace} not found`)\n }\n for (const node of foreignDomain.listModels()) {\n const key = `${namespace}:${node.key}`\n const value = this.graph.node(key)\n if (value) {\n yield node\n }\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 * @param namespace The namespace to search in. When different from the domain key, it looks for a foreign entity.\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, namespace?: string): DomainModel | undefined {\n const value = this.graph.node(this.buildReferenceKey(key, namespace)) 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 part of specified domain.\n *\n * @param namespace The foreign namespace to search in. When not found, it throws an error.\n * @returns A generator that yields each `DomainEntity`.\n * @throws Error When the foreign domain is not found.\n * @example\n * ```typescript\n * for (const model of dataDomain.listForeignEntities('foreignDomainKey')) {\n * console.log(model.key);\n * }\n * ```\n */\n *listForeignEntities(namespace: string): Generator<DomainEntity> {\n const foreignDomain = this.dependencies.get(namespace)\n if (!foreignDomain) {\n throw new Error(`Foreign domain ${namespace} not found`)\n }\n for (const node of foreignDomain.listEntities()) {\n const key = `${namespace}:${node.key}`\n const value = this.graph.node(key)\n if (value) {\n yield node\n }\n }\n }\n\n /**\n * Lists all entities in the graph that are not part of this domain.\n */\n *listAllForeignEntities(): 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 * @param namespace The namespace to search in. When different from the domain key, it looks for a foreign entity.\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, namespace?: string): DomainEntity | undefined {\n const node = this.graph.node(this.buildReferenceKey(key, namespace)) 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 * @param namespace The namespace to search in. When different from the domain key, it looks for a foreign association\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, namespace?: string): DomainAssociation | undefined {\n const node = this.graph.node(this.buildReferenceKey(key, namespace)) 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 * @param namespace The namespace to search in. When different from the domain key, it looks for a foreign property\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, namespace?: string): DomainProperty | undefined {\n const node = this.graph.node(this.buildReferenceKey(key, namespace)) 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 * @deprecated Use `findEntity` with the `namespace` parameter instead.\n * This method is kept for backward compatibility but will be removed in the future.\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 /**\n * Searches domain nodes by text content and/or node type.\n *\n * This function traverses the graph and filters nodes based on the provided search criteria.\n * It can search through name, displayName, and description fields of domain objects,\n * and optionally filter by specific node types.\n *\n * @param criteria Search criteria including query string/regex and filtering options.\n * @returns An array of search results containing matching nodes and metadata.\n *\n * @example\n * ```typescript\n * // Search for nodes containing \"user\" in any text field\n * const results = dataDomain.search({ query: 'user' });\n *\n * // Search for entities only\n * const entityResults = dataDomain.search({\n * nodeTypes: [DomainEntityKind]\n * });\n *\n * // Search for \"user\" in entities and properties with case-sensitive matching\n * const specificResults = dataDomain.search({\n * query: 'User',\n * nodeTypes: [DomainEntityKind, DomainPropertyKind],\n * caseSensitive: true\n * });\n *\n * // Search using regex pattern\n * const regexResults = dataDomain.search({\n * query: /^user/i\n * });\n * ```\n */\n search(criteria: DomainSearchCriteria = {}): DomainSearchResult[] {\n const { query, nodeTypes, includeForeignDomains = false, caseSensitive = false } = criteria\n\n const results: DomainSearchResult[] = []\n\n // If no criteria provided, return all nodes\n const shouldReturnAll = !query && (!nodeTypes || nodeTypes.length === 0)\n\n // Helper function to check if a node matches the type filter\n const matchesNodeType = (nodeKind: string): boolean => {\n if (!nodeTypes || nodeTypes.length === 0) {\n return true\n }\n return nodeTypes.includes(nodeKind as SearchableNodeType)\n }\n\n // Helper function to check if text matches the query\n const matchesQuery = (text: string | undefined): boolean => {\n if (!text || !query) {\n return !query // If no query, consider it a match\n }\n\n if (query instanceof RegExp) {\n return query.test(text)\n }\n\n // String query\n const searchText = caseSensitive ? text : text.toLowerCase()\n const searchQuery = caseSensitive ? query : query.toLowerCase()\n return searchText.includes(searchQuery)\n }\n\n // Helper function to get matched fields for a node\n const getMatchedFields = (node: DomainGraphNodeType): ('name' | 'displayName' | 'description')[] => {\n if (!query) {\n return [] // No query means no specific field matching\n }\n\n const matched: ('name' | 'displayName' | 'description')[] = []\n const { info } = node\n\n if (matchesQuery(info.name)) {\n matched.push('name')\n }\n if (matchesQuery(info.displayName)) {\n matched.push('displayName')\n }\n if (matchesQuery(info.description)) {\n matched.push('description')\n }\n\n return matched\n }\n\n // Helper function to determine if a node key belongs to a foreign domain\n const isForeignNode = (nodeKey: string): boolean => {\n return nodeKey.includes(':')\n }\n\n // Iterate through all nodes in the graph\n for (const nodeKey of this.graph.nodes()) {\n const node = this.graph.node(nodeKey) as DomainGraphNodeType\n\n // Skip if node doesn't exist or doesn't have required properties\n if (!node || !node.info) {\n continue\n }\n\n const isForeign = isForeignNode(nodeKey)\n\n // Skip foreign nodes if not requested\n if (isForeign && !includeForeignDomains) {\n continue\n }\n\n // Check node type filter\n if (!matchesNodeType(node.kind)) {\n continue\n }\n\n // If returning all nodes (no specific criteria), add the node\n if (shouldReturnAll) {\n results.push({\n node,\n matchedFields: [],\n key: nodeKey,\n isForeign,\n })\n continue\n }\n\n // Check text query match\n const matchedFields = getMatchedFields(node)\n const hasTextMatch = !query || matchedFields.length > 0\n\n if (hasTextMatch) {\n results.push({\n node,\n matchedFields,\n key: nodeKey,\n isForeign,\n })\n }\n }\n\n return results\n }\n}\n"]}
@@ -28,6 +28,11 @@ export interface DomainPropertySchema extends DomainElementSchema {
28
28
  * Whether this property describes a primary key of the entity.
29
29
  */
30
30
  primary?: boolean;
31
+ /**
32
+ * Whether this property describes a unique property of the entity.
33
+ * This is used to generate unique constraints in the database.
34
+ */
35
+ unique?: boolean;
31
36
  /**
32
37
  * Whether this property describes an indexed property of the entity.
33
38
  */
@@ -136,6 +141,11 @@ export declare class DomainProperty extends DomainElement {
136
141
  * Whether this property describes a primary key of the entity.
137
142
  */
138
143
  accessor primary: boolean | undefined;
144
+ /**
145
+ * Whether this property describes a unique property of the entity.
146
+ * This is used to generate unique constraints in the database.
147
+ */
148
+ accessor unique: boolean | undefined;
139
149
  /**
140
150
  * Whether this property describes an indexed property of the entity.
141
151
  */
@@ -1 +1 @@
1
- {"version":3,"file":"DomainProperty.d.ts","sourceRoot":"","sources":["../../../src/modeling/DomainProperty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE5E,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EAGL,KAAK,uBAAuB,EAE5B,KAAK,oBAAoB,EAEzB,KAAK,kBAAkB,EAIxB,MAAM,iBAAiB,CAAA;AAExB,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAC3F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAqC,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAE/G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAEpE,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D,IAAI,EAAE,OAAO,kBAAkB,CAAA;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,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