@api-client/core 0.18.17 → 0.18.19

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 (75) hide show
  1. package/build/src/{modeling → decorators}/observed.d.ts +3 -3
  2. package/build/src/decorators/observed.d.ts.map +1 -0
  3. package/build/src/{modeling → decorators}/observed.js +4 -4
  4. package/build/src/decorators/observed.js.map +1 -0
  5. package/build/src/modeling/ApiModel.js +1 -1
  6. package/build/src/modeling/ApiModel.js.map +1 -1
  7. package/build/src/modeling/DataDomain.d.ts +35 -1
  8. package/build/src/modeling/DataDomain.d.ts.map +1 -1
  9. package/build/src/modeling/DataDomain.js +120 -0
  10. package/build/src/modeling/DataDomain.js.map +1 -1
  11. package/build/src/modeling/DomainAssociation.d.ts +7 -0
  12. package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
  13. package/build/src/modeling/DomainAssociation.js +44 -1
  14. package/build/src/modeling/DomainAssociation.js.map +1 -1
  15. package/build/src/modeling/DomainEntity.d.ts +6 -0
  16. package/build/src/modeling/DomainEntity.d.ts.map +1 -1
  17. package/build/src/modeling/DomainEntity.js +21 -1
  18. package/build/src/modeling/DomainEntity.js.map +1 -1
  19. package/build/src/modeling/DomainModel.js +1 -1
  20. package/build/src/modeling/DomainModel.js.map +1 -1
  21. package/build/src/modeling/DomainNamespace.js +1 -1
  22. package/build/src/modeling/DomainNamespace.js.map +1 -1
  23. package/build/src/modeling/DomainProperty.d.ts +15 -0
  24. package/build/src/modeling/DomainProperty.d.ts.map +1 -1
  25. package/build/src/modeling/DomainProperty.js +64 -3
  26. package/build/src/modeling/DomainProperty.js.map +1 -1
  27. package/build/src/modeling/DomainSerialization.d.ts.map +1 -1
  28. package/build/src/modeling/DomainSerialization.js +2 -2
  29. package/build/src/modeling/DomainSerialization.js.map +1 -1
  30. package/build/src/modeling/definitions/SKU.d.ts.map +1 -1
  31. package/build/src/modeling/definitions/SKU.js +2 -0
  32. package/build/src/modeling/definitions/SKU.js.map +1 -1
  33. package/build/src/modeling/helpers/Intelisense.d.ts +472 -0
  34. package/build/src/modeling/helpers/Intelisense.d.ts.map +1 -0
  35. package/build/src/modeling/helpers/Intelisense.js +1200 -0
  36. package/build/src/modeling/helpers/Intelisense.js.map +1 -0
  37. package/build/src/modeling/templates/blog-domain.d.ts +40 -0
  38. package/build/src/modeling/templates/blog-domain.d.ts.map +1 -0
  39. package/build/src/modeling/templates/blog-domain.js +621 -0
  40. package/build/src/modeling/templates/blog-domain.js.map +1 -0
  41. package/build/src/modeling/templates/ecommerce-domain.d.ts +39 -0
  42. package/build/src/modeling/templates/ecommerce-domain.d.ts.map +1 -0
  43. package/build/src/modeling/templates/ecommerce-domain.js +663 -0
  44. package/build/src/modeling/templates/ecommerce-domain.js.map +1 -0
  45. package/build/src/modeling/types.d.ts +49 -0
  46. package/build/src/modeling/types.d.ts.map +1 -1
  47. package/build/src/modeling/types.js.map +1 -1
  48. package/build/src/models/Thing.js +1 -1
  49. package/build/src/models/Thing.js.map +1 -1
  50. package/build/tsconfig.tsbuildinfo +1 -1
  51. package/data/models/example-generator-api.json +6 -6
  52. package/package.json +2 -1
  53. package/src/{modeling → decorators}/observed.ts +5 -5
  54. package/src/modeling/ApiModel.ts +1 -1
  55. package/src/modeling/DataDomain.ts +144 -0
  56. package/src/modeling/DomainAssociation.ts +51 -1
  57. package/src/modeling/DomainEntity.ts +24 -1
  58. package/src/modeling/DomainModel.ts +1 -1
  59. package/src/modeling/DomainNamespace.ts +1 -1
  60. package/src/modeling/DomainProperty.ts +66 -1
  61. package/src/modeling/DomainSerialization.ts +2 -4
  62. package/src/modeling/definitions/SKU.ts +2 -0
  63. package/src/modeling/helpers/Intelisense.ts +1345 -0
  64. package/src/modeling/templates/blog-domain.ts +787 -0
  65. package/src/modeling/templates/ecommerce-domain.ts +834 -0
  66. package/src/modeling/types.ts +63 -0
  67. package/src/models/Thing.ts +1 -1
  68. package/tests/unit/decorators/observed.spec.ts +527 -0
  69. package/tests/unit/modeling/DataDomain.search.spec.ts +188 -0
  70. package/tests/unit/modeling/data_domain_serialization.spec.ts +6 -2
  71. package/tests/unit/modeling/domain_asociation.spec.ts +376 -0
  72. package/tests/unit/modeling/domain_entity.spec.ts +147 -0
  73. package/tests/unit/modeling/domain_property.spec.ts +273 -0
  74. package/build/src/modeling/observed.d.ts.map +0 -1
  75. package/build/src/modeling/observed.js.map +0 -1
@@ -48,10 +48,10 @@ export declare function toRaw<T extends object = object>(source: object, target:
48
48
  * - As a class property decorator
49
49
  * - As a class setter decorator
50
50
  *
51
- * The property class either has to have a `root` property
51
+ * The property class either has to have the `domain` property
52
52
  * or a `notifyChange` method. The decorator will call the
53
53
  * `notifyChange` method if it exists. Otherwise, it will
54
- * call the `notifyChange` method of the root domain.
54
+ * call the `notifyChange` method of the root domain (the `domain` property).
55
55
  */
56
56
  export declare function observed(config?: ObserveConfig): PropertyDecorator;
57
57
  /**
@@ -62,6 +62,6 @@ export declare function observed(config?: ObserveConfig): PropertyDecorator;
62
62
  * It does the same thing. It will notify about a change to the
63
63
  * property itself.
64
64
  */
65
- export declare function retargetChange(): <C extends DomainInstance, V extends EventTarget>(target: StandardPropertyTarget<C, V>, context: StandardPropertyContext<C, V>) => any;
65
+ export declare function retargetChange(): <C extends DomainInstance, V extends EventTarget | undefined>(target: StandardPropertyTarget<C, V>, context: StandardPropertyContext<C, V>) => any;
66
66
  export {};
67
67
  //# sourceMappingURL=observed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observed.d.ts","sourceRoot":"","sources":["../../../src/decorators/observed.ts"],"names":[],"mappings":"AAIA,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE;QAAE,YAAY,IAAI,IAAI,CAAA;KAAE,CAAA;IACjC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAEhC,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,EAC1B,MAAM,EAAE,4BAA4B,CAAC,CAAC,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@@ export function toRaw(source, target) {
42
42
  * - As a class property decorator
43
43
  * - As a class setter decorator
44
44
  *
45
- * The property class either has to have a `root` property
45
+ * The property class either has to have the `domain` property
46
46
  * or a `notifyChange` method. The decorator will call the
47
47
  * `notifyChange` method if it exists. Otherwise, it will
48
- * call the `notifyChange` method of the root domain.
48
+ * call the `notifyChange` method of the root domain (the `domain` property).
49
49
  */
50
50
  export function observed(config = {}) {
51
51
  return (target, context) => {
@@ -99,7 +99,7 @@ export function observed(config = {}) {
99
99
  map = {};
100
100
  Reflect.set(this, reactiveSymbol, map);
101
101
  }
102
- if (map[context.name] === context.name) {
102
+ if (map[context.name] === value) {
103
103
  return;
104
104
  }
105
105
  const notify = () => {
@@ -175,7 +175,7 @@ export function retargetChange() {
175
175
  map = {};
176
176
  Reflect.set(this, reactiveSymbol, map);
177
177
  }
178
- if (map[context.name] === context.name) {
178
+ if (map[context.name] === value) {
179
179
  return;
180
180
  }
181
181
  const oldValue = map[context.name];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observed.js","sourceRoot":"","sources":["../../../src/decorators/observed.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACzC,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AA+BnC;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAA4B,MAAc,EAAE,MAAS;IACxE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAwB,CAAA;IACvE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;QAC7C,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;YACrB,OAAO,GAAQ,CAAA;QACjB,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;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B,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;oBAC3C,CAAC;oBACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;wBAChB,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAA;oBAC5B,CAAC;gBACH,CAAC;gBAED,GAAG;oBACD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,EAAE,CAAA;oBACnD,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;gBAC1B,CAAC;aACF,CAAA;QACH,CAAC;aAAM,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;YACxB,OAAO,UAAgC,KAAQ;gBAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAA4B,CAAiB,CAAA;gBACnE,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;oBACvB,OAAM;gBACR,CAAC;gBACD,CAAC;gBAAC,MAA6B,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;gBACjD,IAAI,QAAQ,IAAI,OAAO,EAAE,CAAC;oBACxB,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;gBACjD,CAAC;gBACD,IAAI,KAAK,EAAE,CAAC;oBACV,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;oBAC7B,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;gBAC3C,CAAC;YACH,CAAC,CAAA;QACH,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,mCAAmC,IAAI,EAAE,CAAC,CAAA;IAC5D,CAAC,CAAA;AACH,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nconst reactiveSymbol = Symbol('reactive')\nconst proxySymbol = Symbol('proxy')\n\ninterface DomainInstance {\n domain?: { notifyChange(): void }\n notifyChange?: () => void\n}\n\nexport interface PropertyDecorator {\n // accessor decorator signature\n <C extends DomainInstance, V>(\n target: ClassAccessorDecoratorTarget<C, V>,\n context: ClassAccessorDecoratorContext<C, V>\n ): ClassAccessorDecoratorResult<C, V>\n // setter decorator signature\n <C extends DomainInstance, V>(\n target: (value: V) => void,\n context: ClassSetterDecoratorContext<C, V>\n ): (this: C, value: V) => void\n}\n\ntype StandardPropertyContext<C, V> = ClassAccessorDecoratorContext<C, V> | ClassSetterDecoratorContext<C, V>\ntype StandardPropertyTarget<C, V> = ClassAccessorDecoratorTarget<C, V> | ((value: V) => void)\n\nexport interface ObserveConfig {\n /**\n * To be used when observing an object and not a primitive.\n * It creates a proxy that observes changes in the object.\n */\n deep?: boolean\n}\n\n/**\n * Reads the raw value of the object, that is, not proxied object.\n * @param source The source object that contains the object\n * @param target The target object set on the source object\n * @returns The not proxied object or undefined\n */\nexport function toRaw<T extends object = object>(source: object, target: T): T | undefined {\n const proxies = Reflect.get(source, proxySymbol) as Map<object, object>\n if (!proxies) {\n return undefined\n }\n for (const [key, value] of proxies.entries()) {\n if (value === target) {\n return key as T\n }\n }\n}\n\n/**\n * Turns a class property or a setter into an observed property\n * that notifies the root domain when changed.\n *\n * A property has to be declared with the `accessor` type to be\n * observed.\n *\n * ```typescript\n * @observed() accessor name: string | undefined\n *\n * @observed()\n * set height(value: number) {\n * this.#height = value\n * }\n *\n * get height(): number {\n * return this.#height\n * }\n * ```\n *\n * The decorator can be used in the following ways:\n * - As a class property decorator\n * - As a class setter decorator\n *\n * The property class either has to have the `domain` property\n * or a `notifyChange` method. The decorator will call the\n * `notifyChange` method if it exists. Otherwise, it will\n * call the `notifyChange` method of the root domain (the `domain` property).\n */\nexport function observed(config: ObserveConfig = {}): PropertyDecorator {\n return <C extends DomainInstance, V>(\n target: StandardPropertyTarget<C, V>,\n context: StandardPropertyContext<C, V>\n ): any => {\n const { kind } = context\n const { deep } = config\n\n function createDeepProxy(this: DomainInstance, obj: unknown, notifyChange: () => void): any {\n if (typeof obj !== 'object' || obj === null) {\n return obj\n }\n // instead of using the target object to store the proxy info, we\n // reflect the proxy info to the object itself. This way we can\n // keep the stored values clean, which helps with testing (deep equal would include symbols)\n // Keys are original objects, values are proxies\n let proxies = Reflect.get(this, proxySymbol) as Map<object, object>\n if (!proxies) {\n proxies = new Map()\n Reflect.set(this, proxySymbol, proxies)\n }\n\n if (proxies.has(obj)) {\n return obj\n }\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const targetObject = this\n\n const proxy = new Proxy(obj, {\n get(target, prop) {\n const value = Reflect.get(target, prop)\n return createDeepProxy.bind(targetObject)(value, notifyChange)\n },\n set(target, prop, value) {\n const oldValue = Reflect.get(target, prop)\n if (oldValue !== value) {\n Reflect.set(target, prop, value)\n notifyChange()\n }\n return true\n },\n deleteProperty(target, prop) {\n Reflect.deleteProperty(target, prop)\n notifyChange()\n return true\n },\n })\n proxies.set(obj, proxy)\n return proxy\n }\n\n if (kind === 'accessor') {\n return {\n set(this: DomainInstance, value: V): void {\n let map = Reflect.get(this, reactiveSymbol)\n if (!map) {\n map = {}\n Reflect.set(this, reactiveSymbol, map)\n }\n if (map[context.name] === value) {\n return\n }\n const notify = () => {\n if (this.domain) {\n this.domain.notifyChange()\n } else if (this.notifyChange) {\n this.notifyChange()\n }\n }\n if (deep) {\n value = createDeepProxy.bind(this)(value, notify)\n }\n if (value === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete map[context.name]\n } else {\n map[context.name] = value\n }\n notify()\n },\n\n get(): V {\n const map = Reflect.get(this, reactiveSymbol) || {}\n return map[context.name]\n },\n }\n } else if (kind === 'setter') {\n const { name } = context\n return function (this: DomainInstance, value: V): void {\n const oldValue = this[name as keyof DomainInstance]\n if (value === oldValue) {\n return\n }\n const notify = () => {\n if (this.domain) {\n this.domain.notifyChange()\n } else if (this.notifyChange) {\n this.notifyChange()\n }\n }\n ;(target as (value: V) => void).call(this, value)\n notify()\n }\n }\n throw new Error(`Unsupported decorator location: ${kind}`)\n }\n}\n\n/**\n * A decorator that can be used to retarget the change event\n * of a property to the root domain.\n *\n * This decorator should not be used with the `observed` decorator.\n * It does the same thing. It will notify about a change to the\n * property itself.\n */\nexport function retargetChange() {\n return <C extends DomainInstance, V extends EventTarget | undefined>(\n target: StandardPropertyTarget<C, V>,\n context: StandardPropertyContext<C, V>\n ): any => {\n const { kind } = context\n function observer(this: DomainInstance) {\n if (this.domain) {\n this.domain.notifyChange()\n }\n }\n let binding: ((this: DomainInstance) => void) | undefined\n if (kind === 'accessor') {\n return {\n set(this: DomainInstance, value: V): void {\n let map = Reflect.get(this, reactiveSymbol)\n if (!map) {\n map = {}\n Reflect.set(this, reactiveSymbol, map)\n }\n if (map[context.name] === value) {\n return\n }\n const oldValue = map[context.name]\n if (oldValue === value) {\n return\n }\n if (value === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete map[context.name]\n } else {\n map[context.name] = value\n }\n if (oldValue && binding) {\n oldValue.removeEventListener('change', binding)\n }\n if (value) {\n binding = observer.bind(this)\n value.addEventListener('change', binding)\n }\n if (this.domain) {\n this.domain.notifyChange()\n }\n },\n\n get(): V {\n const map = Reflect.get(this, reactiveSymbol) || {}\n return map[context.name]\n },\n }\n } else if (kind === 'setter') {\n const { name } = context\n return function (this: DomainInstance, value: V): void {\n const oldValue = this[name as keyof DomainInstance] as unknown as V\n if (value === oldValue) {\n return\n }\n ;(target as (value: V) => void).call(this, value)\n if (oldValue && binding) {\n oldValue.removeEventListener('change', binding)\n }\n if (value) {\n binding = observer.bind(this)\n value.addEventListener('change', binding)\n }\n }\n }\n throw new Error(`Unsupported decorator location: ${kind}`)\n }\n}\n"]}
@@ -4,7 +4,7 @@ import { ApiModelKind, DataDomainKind } from '../models/kinds.js';
4
4
  import { Thing } from '../models/Thing.js';
5
5
  import { DataDomain } from './DataDomain.js';
6
6
  import { DependentModel } from './DependentModel.js';
7
- import { observed, toRaw } from './observed.js';
7
+ import { observed, toRaw } from '../decorators/observed.js';
8
8
  let ApiModel = (() => {
9
9
  let _classSuper = DependentModel;
10
10
  let _termsOfService_decorators;
@@ -1 +1 @@
1
- {"version":3,"file":"ApiModel.js","sourceRoot":"","sources":["../../../src/modeling/ApiModel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAe,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAYvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAoD,MAAM,qBAAqB,CAAA;AACtG,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;IA4GlC,QAAQ;sBAAS,cAAc;;;;;;;;;;iBAA/B,QAAS,SAAQ,WAAc;;;0CA8DzC,QAAQ,EAAE;mCAIV,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;mCAIxB,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;YARb,+LAAS,cAAc,6BAAd,cAAc,uGAAoB;YAI7B,0KAAS,OAAO,6BAAP,OAAO,yFAAwB;YAIxC,0KAAS,OAAO,6BAAP,OAAO,yFAAwB;;;QArElE;;WAEG;QACH,IAAI,CAAqB;QACzB;;;WAGG;QACH,GAAG,CAAQ;QAEX;;WAEG;QACH,IAAI,CAAO;QACX;;;;;WAKG;QACH,IAAI,CAAoB;QAExB;;;WAGG;QACH,cAAc,CAA8B;QAE5C;;;WAGG;QACH,aAAa,CAA6B;QAE1C;;;WAGG;QACH,OAAO,CAAuB;QAC9B;;;WAGG;QACH,OAAO,CAAiB;QACxB;;;;;;;WAOG;QACH,UAAU,CAAe;QACzB;;;WAGG;QACH,YAAY,CAA4B;QAI5B,iGAA2C;QAHvD;;WAEG;QACS,IA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ACzB,IAAI,CAAC,cAAc,GAAG,EAAE,CAAA;YACxB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;YACjB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAA;YACrB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,EAAE,CAAA;YAC9B,CAAC;YACD,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,KAAK,kBAAkB,EAAE,CAAC;gBAC/E,MAAM,KAAK,GAAG,IAAI,CAAC,cAA+C,CAAA;gBAClE,KAAK,CAAC,WAAW,GAAG,SAAS,CAAA;YAC/B,CAAC;YACD,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,IAAI,MAAM,EAAE,CAAC;gBAChE,MAAM,KAAK,GAAG,IAAI,CAAC,aAAwC,CAAA;gBAC3D,KAAK,CAAC,OAAO,GAAG,EAAE,CAAA;YACpB,CAAC;QACH,CAAC;QAED;;;;;;WAMG;QACH,gBAAgB,CAAC,MAAkB;YACjC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CAAC,wFAAwF,CAAC,CAAA;YAC3G,CAAC;YACD,IAAI,CAAC,oBAAoB,EAAE,CAAA;YAC3B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;YACzC,IAAI,CAAC,cAAc,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;YACzE,IAAI,CAAC,YAAY,EAAE,CAAA;QACrB,CAAC;;;SAzUU,QAAQ","sourcesContent":["import { nanoid } from '../nanoid.js'\nimport { ApiModelKind, DataDomainKind } from '../models/kinds.js'\nimport { type IThing, Thing } from '../models/Thing.js'\nimport type {\n AccessRule,\n AssociationTarget,\n AuthenticationConfiguration,\n AuthorizationConfiguration,\n ExposedEntity,\n RateLimitingConfiguration,\n RolesBasedAccessControl,\n SessionConfiguration,\n UsernamePasswordConfiguration,\n} from './types.js'\nimport { DataDomain } from './DataDomain.js'\nimport { DependentModel, type DependentModelSchema, type DomainDependency } from './DependentModel.js'\nimport { observed, toRaw } from './observed.js'\n\n/**\n * Contact information for the exposed API.\n */\nexport interface ApiContact {\n /**\n * The identifying name of the contact person/organization.\n */\n name?: string\n /**\n * The URL pointing to the contact information. MUST be in the format of a URL.\n */\n url?: string\n /**\n * The email address of the contact person/organization. MUST be in the format of an email address.\n */\n email?: string\n}\n\n/**\n * License information for the exposed API.\n */\nexport interface ApiLicense {\n /**\n * The license name used for the API. It is recommended to be an SPDX license identifier.\n */\n name: string\n /**\n * A URL to the license used for the API. MUST be in the format of a URL.\n */\n url?: string\n}\n\nexport interface ApiModelSchema extends DependentModelSchema {\n /**\n * The data domain kind recognizable by the ecosystem.\n */\n kind: typeof ApiModelKind\n /**\n * The unique key of the data domain schema.\n * This is a stable identifier that does not change across versions.\n */\n key: string\n /**\n * Contains the name, display name, description, and the version of the data domain schema.\n */\n info: IThing\n\n /**\n * The designated Data Entity that represents a \"User\".\n * This entity should be marked with the \"User\" semantic in the Data Modeler.\n *\n * This property is required to publish the API.\n */\n user?: AssociationTarget\n\n /**\n * Configuration for how users prove their identity.\n * The API model is invalid if this is not set.\n */\n authentication?: AuthenticationConfiguration\n\n /**\n * Configuration for what authenticated users are allowed to do.\n * The API model is invalid if this is not set.\n */\n authorization?: AuthorizationConfiguration\n\n /**\n * Configuration for the transport and payload of the user session.\n * The API model is invalid if this is not set.\n */\n session?: SessionConfiguration\n /**\n * The specific subset of Data Entities to be exposed by this API.\n * These are the entities that are included in the data domain schema.\n */\n exposes: ExposedEntity[]\n\n /**\n * Optional array of access rules that define the access control policies\n * for the API. These rules are used to enforce security and permissions\n * on the exposed entities.\n *\n * These rules apply to all exposed entities and actions. An API action\n * can declare its own access rules, which will override these.\n */\n accessRule?: AccessRule[]\n /**\n * Optional configuration for API-wide rate limiting and throttling.\n * Defines rules to protect the API from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\n /**\n * A URL to the Terms of Service for the API.\n */\n termsOfService?: string\n /**\n * The contact information for the exposed API.\n */\n contact?: ApiContact\n /**\n * The license information for the API.\n */\n license?: ApiLicense\n}\n\nexport class ApiModel extends DependentModel {\n /**\n * The data domain kind recognizable by the ecosystem.\n */\n kind: typeof ApiModelKind\n /**\n * The unique key of the data domain schema.\n * This is a stable identifier that does not change across versions.\n */\n key: string\n\n /**\n * The description of the domain property.\n */\n info: Thing\n /**\n * The designated Data Entity that represents a \"User\".\n * This entity must be marked with the \"User\" semantic in the Data Modeler.\n *\n * This property is required to publish the API.\n */\n user?: AssociationTarget\n\n /**\n * Configuration for how users prove their identity.\n * The API model is invalid if this is not set.\n */\n authentication?: AuthenticationConfiguration\n\n /**\n * Configuration for what authenticated users are allowed to do.\n * The API model is invalid if this is not set.\n */\n authorization?: AuthorizationConfiguration\n\n /**\n * Configuration for the transport and payload of the user session.\n * The API model is invalid if this is not set.\n */\n session?: SessionConfiguration\n /**\n * The specific subset of Data Entities to be exposed by this API.\n * These are the entities that are included in the data domain schema.\n */\n exposes: ExposedEntity[]\n /**\n * Optional array of access rules that define the access control policies\n * for the API. These rules are used to enforce security and permissions\n * on the exposed entities.\n *\n * These rules apply to all exposed entities and actions. An API action\n * can declare its own access rules, which will override these.\n */\n accessRule?: AccessRule[]\n /**\n * Optional configuration for API-wide rate limiting and throttling.\n * Defines rules to protect the API from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\n /**\n * A URL to the Terms of Service for the API.\n */\n @observed() accessor termsOfService: string | undefined\n /**\n * The contact information for the exposed API.\n */\n @observed({ deep: true }) accessor contact: ApiContact | undefined\n /**\n * The license information for the API.\n */\n @observed({ deep: true }) accessor license: ApiLicense | undefined\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 * A convenience getter that returns the DataDomain associated with this API model.\n * Since the API model can have only one DataDomain,\n * this getter returns the first dependency in the list.\n *\n * The parent interface `DependentModel` allows for multiple dependencies,\n * to unify the dependency management across different models.\n */\n get domain(): DataDomain | undefined {\n if (this.dependencyList.length === 0) {\n return undefined\n }\n const domain = this.dependencyList[0]\n return this.dependencies.get(domain.key)\n }\n\n static createSchema(input: Partial<ApiModelSchema> = {}): ApiModelSchema {\n const { key = nanoid(), exposes = [] } = input\n const info = Thing.fromJSON(input.info, { name: 'Unnamed API' }).toJSON()\n const result: ApiModelSchema = {\n kind: ApiModelKind,\n key,\n info,\n exposes,\n }\n if (input.user) {\n result.user = { ...input.user }\n }\n if (input.dependencyList) {\n result.dependencyList = structuredClone(input.dependencyList)\n }\n if (input.authentication) {\n result.authentication = input.authentication\n }\n if (input.authorization) {\n result.authorization = input.authorization\n }\n if (input.session) {\n result.session = input.session\n }\n if (input.accessRule) {\n result.accessRule = input.accessRule\n }\n if (input.rateLimiting) {\n result.rateLimiting = input.rateLimiting\n }\n if (input.termsOfService) {\n result.termsOfService = input.termsOfService\n }\n if (input.contact) {\n result.contact = structuredClone(input.contact)\n }\n if (input.license) {\n result.license = structuredClone(input.license)\n }\n return result\n }\n\n constructor(state?: Partial<ApiModelSchema>, domain?: DomainDependency) {\n const init = ApiModel.createSchema(state)\n const instances: DataDomain[] = []\n if (domain instanceof DataDomain) {\n instances.push(domain)\n } else if (typeof domain === 'object' && domain.kind === DataDomainKind) {\n instances.push(new DataDomain(domain))\n } else if (domain) {\n throw new Error(`Invalid domain provided. Expected a DataDomain instance or schema.`)\n }\n super(init.dependencyList, instances)\n this.kind = init.kind\n this.key = init.key\n this.info = new Thing(init.info)\n this.user = init.user\n if (init.authentication) {\n this.authentication = structuredClone(init.authentication)\n }\n if (init.authorization) {\n this.authorization = structuredClone(init.authorization)\n }\n if (init.session) {\n this.session = structuredClone(init.session)\n }\n if (Array.isArray(init.exposes)) {\n this.exposes = structuredClone(init.exposes)\n } else {\n this.exposes = []\n }\n if (init.accessRule) {\n this.accessRule = structuredClone(init.accessRule)\n }\n if (init.rateLimiting) {\n this.rateLimiting = structuredClone(init.rateLimiting)\n }\n if (init.termsOfService) {\n this.termsOfService = init.termsOfService\n }\n if (init.contact) {\n this.contact = init.contact\n }\n if (init.license) {\n this.license = init.license\n }\n this.#initializing = false\n this.info.addEventListener('change', () => {\n this.notifyChange()\n })\n }\n\n toJSON(): ApiModelSchema {\n const result: ApiModelSchema = {\n kind: this.kind,\n key: this.key,\n info: this.info.toJSON(),\n exposes: structuredClone(this.exposes),\n }\n if (this.user) {\n result.user = { ...this.user }\n }\n if (this.dependencyList.length > 0) {\n result.dependencyList = structuredClone(this.dependencyList)\n }\n if (this.authentication) {\n result.authentication = structuredClone(this.authentication)\n }\n if (this.authorization) {\n result.authorization = structuredClone(this.authorization)\n }\n if (this.session) {\n result.session = structuredClone(this.session)\n }\n if (this.accessRule) {\n result.accessRule = structuredClone(this.accessRule)\n }\n if (this.rateLimiting) {\n result.rateLimiting = structuredClone(this.rateLimiting)\n }\n if (this.termsOfService) {\n result.termsOfService = this.termsOfService\n }\n if (this.contact) {\n result.contact = structuredClone(toRaw(this, this.contact))\n }\n if (this.license) {\n result.license = structuredClone(toRaw(this, this.license))\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 /**\n * Exposes a new entity in the API model.\n * If the entity already exists, it returns the existing one.\n * @param entityKey The key of the entity to expose.\n * @returns The exposed entity.\n */\n exposeEntity(entityKey: string): ExposedEntity {\n const existing = this.exposes.find((e) => e.key === entityKey)\n if (existing) {\n return existing\n }\n const newEntity: ExposedEntity = {\n key: entityKey,\n actions: [],\n }\n this.exposes.push(newEntity)\n this.notifyChange()\n return newEntity\n }\n\n /**\n * Removes an entity from the API model.\n * @param entityKey The key of the entity to remove.\n */\n removeEntity(entityKey: string): void {\n const index = this.exposes.findIndex((e) => e.key === entityKey)\n if (index !== -1) {\n this.exposes.splice(index, 1)\n this.notifyChange()\n }\n }\n /**\n * Returns the exposed entity by its key.\n * @param entityKey The key of the entity to find.\n * @returns The exposed entity or undefined if not found.\n */\n getExposedEntity(entityKey: string): ExposedEntity | undefined {\n return this.exposes.find((e) => e.key === entityKey)\n }\n\n /**\n * Clears the API model for a new entity change.\n * This method resets the dependencies, exposes, user,\n * authentication, authorization, and session properties.\n */\n cleanForEntityChange(): void {\n this.dependencies.clear()\n this.dependencyList = []\n this.exposes = []\n this.user = undefined\n if (this.session) {\n this.session.properties = []\n }\n if (this.authentication && this.authentication.strategy === 'UsernamePassword') {\n const typed = this.authentication as UsernamePasswordConfiguration\n typed.passwordKey = undefined\n }\n if (this.authorization && this.authorization.strategy == 'RBAC') {\n const typed = this.authorization as RolesBasedAccessControl\n typed.roleKey = ''\n }\n }\n\n /**\n * Attaches a DataDomain to this API model.\n * This method clears any existing dependencies and sets the new domain.\n *\n * @param domain The DataDomain to attach to this API model.\n * @throws Error if the domain does not have a version set in its info.\n */\n attachDataDomain(domain: DataDomain): void {\n if (!domain.info.version) {\n throw new Error(`Cannot attach DataDomain without a version. Please set the version in the domain info.`)\n }\n this.cleanForEntityChange()\n this.dependencies.set(domain.key, domain)\n this.dependencyList = [{ key: domain.key, version: domain.info.version }]\n this.notifyChange()\n }\n}\n"]}
1
+ {"version":3,"file":"ApiModel.js","sourceRoot":"","sources":["../../../src/modeling/ApiModel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OA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cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,KAAK,kBAAkB,EAAE,CAAC;gBAC/E,MAAM,KAAK,GAAG,IAAI,CAAC,cAA+C,CAAA;gBAClE,KAAK,CAAC,WAAW,GAAG,SAAS,CAAA;YAC/B,CAAC;YACD,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,IAAI,MAAM,EAAE,CAAC;gBAChE,MAAM,KAAK,GAAG,IAAI,CAAC,aAAwC,CAAA;gBAC3D,KAAK,CAAC,OAAO,GAAG,EAAE,CAAA;YACpB,CAAC;QACH,CAAC;QAED;;;;;;WAMG;QACH,gBAAgB,CAAC,MAAkB;YACjC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CAAC,wFAAwF,CAAC,CAAA;YAC3G,CAAC;YACD,IAAI,CAAC,oBAAoB,EAAE,CAAA;YAC3B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;YACzC,IAAI,CAAC,cAAc,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;YACzE,IAAI,CAAC,YAAY,EAAE,CAAA;QACrB,CAAC;;;SAzUU,QAAQ","sourcesContent":["import { nanoid } from '../nanoid.js'\nimport { ApiModelKind, DataDomainKind } from '../models/kinds.js'\nimport { type IThing, Thing } from '../models/Thing.js'\nimport type {\n AccessRule,\n AssociationTarget,\n AuthenticationConfiguration,\n AuthorizationConfiguration,\n ExposedEntity,\n RateLimitingConfiguration,\n RolesBasedAccessControl,\n SessionConfiguration,\n UsernamePasswordConfiguration,\n} from './types.js'\nimport { DataDomain } from './DataDomain.js'\nimport { DependentModel, type DependentModelSchema, type DomainDependency } from './DependentModel.js'\nimport { observed, toRaw } from '../decorators/observed.js'\n\n/**\n * Contact information for the exposed API.\n */\nexport interface ApiContact {\n /**\n * The identifying name of the contact person/organization.\n */\n name?: string\n /**\n * The URL pointing to the contact information. MUST be in the format of a URL.\n */\n url?: string\n /**\n * The email address of the contact person/organization. MUST be in the format of an email address.\n */\n email?: string\n}\n\n/**\n * License information for the exposed API.\n */\nexport interface ApiLicense {\n /**\n * The license name used for the API. It is recommended to be an SPDX license identifier.\n */\n name: string\n /**\n * A URL to the license used for the API. MUST be in the format of a URL.\n */\n url?: string\n}\n\nexport interface ApiModelSchema extends DependentModelSchema {\n /**\n * The data domain kind recognizable by the ecosystem.\n */\n kind: typeof ApiModelKind\n /**\n * The unique key of the data domain schema.\n * This is a stable identifier that does not change across versions.\n */\n key: string\n /**\n * Contains the name, display name, description, and the version of the data domain schema.\n */\n info: IThing\n\n /**\n * The designated Data Entity that represents a \"User\".\n * This entity should be marked with the \"User\" semantic in the Data Modeler.\n *\n * This property is required to publish the API.\n */\n user?: AssociationTarget\n\n /**\n * Configuration for how users prove their identity.\n * The API model is invalid if this is not set.\n */\n authentication?: AuthenticationConfiguration\n\n /**\n * Configuration for what authenticated users are allowed to do.\n * The API model is invalid if this is not set.\n */\n authorization?: AuthorizationConfiguration\n\n /**\n * Configuration for the transport and payload of the user session.\n * The API model is invalid if this is not set.\n */\n session?: SessionConfiguration\n /**\n * The specific subset of Data Entities to be exposed by this API.\n * These are the entities that are included in the data domain schema.\n */\n exposes: ExposedEntity[]\n\n /**\n * Optional array of access rules that define the access control policies\n * for the API. These rules are used to enforce security and permissions\n * on the exposed entities.\n *\n * These rules apply to all exposed entities and actions. An API action\n * can declare its own access rules, which will override these.\n */\n accessRule?: AccessRule[]\n /**\n * Optional configuration for API-wide rate limiting and throttling.\n * Defines rules to protect the API from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\n /**\n * A URL to the Terms of Service for the API.\n */\n termsOfService?: string\n /**\n * The contact information for the exposed API.\n */\n contact?: ApiContact\n /**\n * The license information for the API.\n */\n license?: ApiLicense\n}\n\nexport class ApiModel extends DependentModel {\n /**\n * The data domain kind recognizable by the ecosystem.\n */\n kind: typeof ApiModelKind\n /**\n * The unique key of the data domain schema.\n * This is a stable identifier that does not change across versions.\n */\n key: string\n\n /**\n * The description of the domain property.\n */\n info: Thing\n /**\n * The designated Data Entity that represents a \"User\".\n * This entity must be marked with the \"User\" semantic in the Data Modeler.\n *\n * This property is required to publish the API.\n */\n user?: AssociationTarget\n\n /**\n * Configuration for how users prove their identity.\n * The API model is invalid if this is not set.\n */\n authentication?: AuthenticationConfiguration\n\n /**\n * Configuration for what authenticated users are allowed to do.\n * The API model is invalid if this is not set.\n */\n authorization?: AuthorizationConfiguration\n\n /**\n * Configuration for the transport and payload of the user session.\n * The API model is invalid if this is not set.\n */\n session?: SessionConfiguration\n /**\n * The specific subset of Data Entities to be exposed by this API.\n * These are the entities that are included in the data domain schema.\n */\n exposes: ExposedEntity[]\n /**\n * Optional array of access rules that define the access control policies\n * for the API. These rules are used to enforce security and permissions\n * on the exposed entities.\n *\n * These rules apply to all exposed entities and actions. An API action\n * can declare its own access rules, which will override these.\n */\n accessRule?: AccessRule[]\n /**\n * Optional configuration for API-wide rate limiting and throttling.\n * Defines rules to protect the API from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\n /**\n * A URL to the Terms of Service for the API.\n */\n @observed() accessor termsOfService: string | undefined\n /**\n * The contact information for the exposed API.\n */\n @observed({ deep: true }) accessor contact: ApiContact | undefined\n /**\n * The license information for the API.\n */\n @observed({ deep: true }) accessor license: ApiLicense | undefined\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 * A convenience getter that returns the DataDomain associated with this API model.\n * Since the API model can have only one DataDomain,\n * this getter returns the first dependency in the list.\n *\n * The parent interface `DependentModel` allows for multiple dependencies,\n * to unify the dependency management across different models.\n */\n get domain(): DataDomain | undefined {\n if (this.dependencyList.length === 0) {\n return undefined\n }\n const domain = this.dependencyList[0]\n return this.dependencies.get(domain.key)\n }\n\n static createSchema(input: Partial<ApiModelSchema> = {}): ApiModelSchema {\n const { key = nanoid(), exposes = [] } = input\n const info = Thing.fromJSON(input.info, { name: 'Unnamed API' }).toJSON()\n const result: ApiModelSchema = {\n kind: ApiModelKind,\n key,\n info,\n exposes,\n }\n if (input.user) {\n result.user = { ...input.user }\n }\n if (input.dependencyList) {\n result.dependencyList = structuredClone(input.dependencyList)\n }\n if (input.authentication) {\n result.authentication = input.authentication\n }\n if (input.authorization) {\n result.authorization = input.authorization\n }\n if (input.session) {\n result.session = input.session\n }\n if (input.accessRule) {\n result.accessRule = input.accessRule\n }\n if (input.rateLimiting) {\n result.rateLimiting = input.rateLimiting\n }\n if (input.termsOfService) {\n result.termsOfService = input.termsOfService\n }\n if (input.contact) {\n result.contact = structuredClone(input.contact)\n }\n if (input.license) {\n result.license = structuredClone(input.license)\n }\n return result\n }\n\n constructor(state?: Partial<ApiModelSchema>, domain?: DomainDependency) {\n const init = ApiModel.createSchema(state)\n const instances: DataDomain[] = []\n if (domain instanceof DataDomain) {\n instances.push(domain)\n } else if (typeof domain === 'object' && domain.kind === DataDomainKind) {\n instances.push(new DataDomain(domain))\n } else if (domain) {\n throw new Error(`Invalid domain provided. Expected a DataDomain instance or schema.`)\n }\n super(init.dependencyList, instances)\n this.kind = init.kind\n this.key = init.key\n this.info = new Thing(init.info)\n this.user = init.user\n if (init.authentication) {\n this.authentication = structuredClone(init.authentication)\n }\n if (init.authorization) {\n this.authorization = structuredClone(init.authorization)\n }\n if (init.session) {\n this.session = structuredClone(init.session)\n }\n if (Array.isArray(init.exposes)) {\n this.exposes = structuredClone(init.exposes)\n } else {\n this.exposes = []\n }\n if (init.accessRule) {\n this.accessRule = structuredClone(init.accessRule)\n }\n if (init.rateLimiting) {\n this.rateLimiting = structuredClone(init.rateLimiting)\n }\n if (init.termsOfService) {\n this.termsOfService = init.termsOfService\n }\n if (init.contact) {\n this.contact = init.contact\n }\n if (init.license) {\n this.license = init.license\n }\n this.#initializing = false\n this.info.addEventListener('change', () => {\n this.notifyChange()\n })\n }\n\n toJSON(): ApiModelSchema {\n const result: ApiModelSchema = {\n kind: this.kind,\n key: this.key,\n info: this.info.toJSON(),\n exposes: structuredClone(this.exposes),\n }\n if (this.user) {\n result.user = { ...this.user }\n }\n if (this.dependencyList.length > 0) {\n result.dependencyList = structuredClone(this.dependencyList)\n }\n if (this.authentication) {\n result.authentication = structuredClone(this.authentication)\n }\n if (this.authorization) {\n result.authorization = structuredClone(this.authorization)\n }\n if (this.session) {\n result.session = structuredClone(this.session)\n }\n if (this.accessRule) {\n result.accessRule = structuredClone(this.accessRule)\n }\n if (this.rateLimiting) {\n result.rateLimiting = structuredClone(this.rateLimiting)\n }\n if (this.termsOfService) {\n result.termsOfService = this.termsOfService\n }\n if (this.contact) {\n result.contact = structuredClone(toRaw(this, this.contact))\n }\n if (this.license) {\n result.license = structuredClone(toRaw(this, this.license))\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 /**\n * Exposes a new entity in the API model.\n * If the entity already exists, it returns the existing one.\n * @param entityKey The key of the entity to expose.\n * @returns The exposed entity.\n */\n exposeEntity(entityKey: string): ExposedEntity {\n const existing = this.exposes.find((e) => e.key === entityKey)\n if (existing) {\n return existing\n }\n const newEntity: ExposedEntity = {\n key: entityKey,\n actions: [],\n }\n this.exposes.push(newEntity)\n this.notifyChange()\n return newEntity\n }\n\n /**\n * Removes an entity from the API model.\n * @param entityKey The key of the entity to remove.\n */\n removeEntity(entityKey: string): void {\n const index = this.exposes.findIndex((e) => e.key === entityKey)\n if (index !== -1) {\n this.exposes.splice(index, 1)\n this.notifyChange()\n }\n }\n /**\n * Returns the exposed entity by its key.\n * @param entityKey The key of the entity to find.\n * @returns The exposed entity or undefined if not found.\n */\n getExposedEntity(entityKey: string): ExposedEntity | undefined {\n return this.exposes.find((e) => e.key === entityKey)\n }\n\n /**\n * Clears the API model for a new entity change.\n * This method resets the dependencies, exposes, user,\n * authentication, authorization, and session properties.\n */\n cleanForEntityChange(): void {\n this.dependencies.clear()\n this.dependencyList = []\n this.exposes = []\n this.user = undefined\n if (this.session) {\n this.session.properties = []\n }\n if (this.authentication && this.authentication.strategy === 'UsernamePassword') {\n const typed = this.authentication as UsernamePasswordConfiguration\n typed.passwordKey = undefined\n }\n if (this.authorization && this.authorization.strategy == 'RBAC') {\n const typed = this.authorization as RolesBasedAccessControl\n typed.roleKey = ''\n }\n }\n\n /**\n * Attaches a DataDomain to this API model.\n * This method clears any existing dependencies and sets the new domain.\n *\n * @param domain The DataDomain to attach to this API model.\n * @throws Error if the domain does not have a version set in its info.\n */\n attachDataDomain(domain: DataDomain): void {\n if (!domain.info.version) {\n throw new Error(`Cannot attach DataDomain without a version. Please set the version in the domain info.`)\n }\n this.cleanForEntityChange()\n this.dependencies.set(domain.key, domain)\n this.dependencyList = [{ key: domain.key, version: domain.info.version }]\n this.notifyChange()\n }\n}\n"]}
@@ -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,CAA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IACH,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAQzE;;;;;;;;;;;;;;OAcG;IACH,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAmB/C;;;;OAIG;IACH,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAY1C;;;;;;;;;;;;;;;;;;OAkBG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAajF;;;;;;;;;;;OAWG;IACH,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;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