@api-client/core 0.19.9 → 0.19.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/Testing.md +1 -1
  2. package/build/src/decorators/observed.d.ts.map +1 -1
  3. package/build/src/decorators/observed.js +91 -0
  4. package/build/src/decorators/observed.js.map +1 -1
  5. package/build/src/modeling/ApiModel.d.ts +21 -7
  6. package/build/src/modeling/ApiModel.d.ts.map +1 -1
  7. package/build/src/modeling/ApiModel.js +70 -29
  8. package/build/src/modeling/ApiModel.js.map +1 -1
  9. package/build/src/modeling/DomainValidation.d.ts +1 -1
  10. package/build/src/modeling/DomainValidation.d.ts.map +1 -1
  11. package/build/src/modeling/DomainValidation.js.map +1 -1
  12. package/build/src/modeling/ExposedEntity.d.ts +14 -0
  13. package/build/src/modeling/ExposedEntity.d.ts.map +1 -1
  14. package/build/src/modeling/ExposedEntity.js +59 -6
  15. package/build/src/modeling/ExposedEntity.js.map +1 -1
  16. package/build/src/modeling/actions/Action.d.ts +11 -1
  17. package/build/src/modeling/actions/Action.d.ts.map +1 -1
  18. package/build/src/modeling/actions/Action.js +21 -3
  19. package/build/src/modeling/actions/Action.js.map +1 -1
  20. package/build/src/modeling/actions/CreateAction.d.ts +2 -1
  21. package/build/src/modeling/actions/CreateAction.d.ts.map +1 -1
  22. package/build/src/modeling/actions/CreateAction.js +2 -2
  23. package/build/src/modeling/actions/CreateAction.js.map +1 -1
  24. package/build/src/modeling/actions/DeleteAction.d.ts +2 -1
  25. package/build/src/modeling/actions/DeleteAction.d.ts.map +1 -1
  26. package/build/src/modeling/actions/DeleteAction.js +2 -2
  27. package/build/src/modeling/actions/DeleteAction.js.map +1 -1
  28. package/build/src/modeling/actions/ListAction.d.ts +2 -1
  29. package/build/src/modeling/actions/ListAction.d.ts.map +1 -1
  30. package/build/src/modeling/actions/ListAction.js +2 -2
  31. package/build/src/modeling/actions/ListAction.js.map +1 -1
  32. package/build/src/modeling/actions/ReadAction.d.ts +2 -1
  33. package/build/src/modeling/actions/ReadAction.d.ts.map +1 -1
  34. package/build/src/modeling/actions/ReadAction.js +2 -2
  35. package/build/src/modeling/actions/ReadAction.js.map +1 -1
  36. package/build/src/modeling/actions/SearchAction.d.ts +2 -1
  37. package/build/src/modeling/actions/SearchAction.d.ts.map +1 -1
  38. package/build/src/modeling/actions/SearchAction.js +2 -2
  39. package/build/src/modeling/actions/SearchAction.js.map +1 -1
  40. package/build/src/modeling/actions/UpdateAction.d.ts +2 -1
  41. package/build/src/modeling/actions/UpdateAction.d.ts.map +1 -1
  42. package/build/src/modeling/actions/UpdateAction.js +2 -2
  43. package/build/src/modeling/actions/UpdateAction.js.map +1 -1
  44. package/build/src/modeling/actions/index.d.ts +2 -1
  45. package/build/src/modeling/actions/index.d.ts.map +1 -1
  46. package/build/src/modeling/actions/index.js +7 -7
  47. package/build/src/modeling/actions/index.js.map +1 -1
  48. package/build/src/modeling/index.d.ts +1 -0
  49. package/build/src/modeling/index.d.ts.map +1 -1
  50. package/build/src/modeling/index.js +1 -0
  51. package/build/src/modeling/index.js.map +1 -1
  52. package/build/src/modeling/types.d.ts +67 -0
  53. package/build/src/modeling/types.d.ts.map +1 -1
  54. package/build/src/modeling/types.js.map +1 -1
  55. package/build/src/modeling/validation/api_model_rules.d.ts +15 -0
  56. package/build/src/modeling/validation/api_model_rules.d.ts.map +1 -0
  57. package/build/src/modeling/validation/api_model_rules.js +599 -0
  58. package/build/src/modeling/validation/api_model_rules.js.map +1 -0
  59. package/build/src/modeling/validation/association_validation.d.ts.map +1 -1
  60. package/build/src/modeling/validation/association_validation.js +1 -3
  61. package/build/src/modeling/validation/association_validation.js.map +1 -1
  62. package/build/tsconfig.tsbuildinfo +1 -1
  63. package/data/models/example-generator-api.json +8 -8
  64. package/eslint.config.js +0 -1
  65. package/package.json +17 -122
  66. package/src/decorators/observed.ts +91 -0
  67. package/src/modeling/ApiModel.ts +73 -33
  68. package/src/modeling/DomainValidation.ts +1 -1
  69. package/src/modeling/ExposedEntity.ts +63 -9
  70. package/src/modeling/actions/Action.ts +25 -2
  71. package/src/modeling/actions/CreateAction.ts +3 -2
  72. package/src/modeling/actions/DeleteAction.ts +3 -2
  73. package/src/modeling/actions/ListAction.ts +3 -2
  74. package/src/modeling/actions/ReadAction.ts +3 -2
  75. package/src/modeling/actions/SearchAction.ts +3 -2
  76. package/src/modeling/actions/UpdateAction.ts +3 -2
  77. package/src/modeling/types.ts +70 -0
  78. package/src/modeling/validation/api_model_rules.ts +640 -0
  79. package/src/modeling/validation/api_model_validation_rules.md +58 -0
  80. package/src/modeling/validation/association_validation.ts +1 -3
  81. package/tests/unit/modeling/actions/Action.spec.ts +40 -8
  82. package/tests/unit/modeling/actions/CreateAction.spec.ts +5 -5
  83. package/tests/unit/modeling/actions/DeleteAction.spec.ts +6 -6
  84. package/tests/unit/modeling/actions/ListAction.spec.ts +7 -7
  85. package/tests/unit/modeling/actions/ReadAction.spec.ts +6 -6
  86. package/tests/unit/modeling/actions/SearchAction.spec.ts +6 -6
  87. package/tests/unit/modeling/actions/UpdateAction.spec.ts +6 -6
  88. package/tests/unit/modeling/api_model.spec.ts +190 -13
  89. package/tests/unit/modeling/api_model_expose_entity.spec.ts +43 -19
  90. package/tests/unit/modeling/api_model_remove_entity.spec.ts +6 -6
  91. package/tests/unit/modeling/exposed_entity.spec.ts +123 -3
  92. package/tests/unit/modeling/exposed_entity_actions.spec.ts +41 -18
  93. package/tests/unit/modeling/exposed_entity_setter_validation.spec.ts +1 -1
  94. package/tests/unit/modeling/rules/restoring_rules.spec.ts +9 -5
  95. package/tests/unit/modeling/validation/api_model_rules.spec.ts +324 -0
  96. package/tsconfig.browser.json +1 -1
  97. package/tsconfig.node.json +1 -1
  98. package/bin/test-web.ts +0 -6
@@ -1 +1 @@
1
- {"version":3,"file":"ApiModel.js","sourceRoot":"","sources":["../../../src/modeling/ApiModel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MA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K,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;;;SAnhBU,QAAQ","sourcesContent":["import { nanoid } from '../nanoid.js'\nimport { ApiModelKind, DataDomainKind, ExposedEntityKind } from '../models/kinds.js'\nimport { type IThing, Thing } from '../models/Thing.js'\nimport type {\n AssociationTarget,\n AuthenticationConfiguration,\n AuthorizationConfiguration,\n ExposedEntitySchema,\n RolesBasedAccessControl,\n SessionConfiguration,\n UsernamePasswordConfiguration,\n ExposeOptions,\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'\nimport pluralize from '@jarrodek/pluralize'\nimport { createDomainKey } from './helpers/keying.js'\nimport { ExposedEntity } from './ExposedEntity.js'\nimport { AccessRule, AccessRuleSchema } from './rules/AccessRule.js'\nimport { RateLimitingConfiguration, RateLimitingConfigurationSchema } from './rules/RateLimitingConfiguration.js'\nimport { restoreAccessRule } from './rules/index.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 API model 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 API model 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: ExposedEntitySchema[]\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?: AccessRuleSchema[]\n /**\n * Optional configuration for API-wide rate limiting and throttling.\n * Defines rules to protect the API from overuse.\n */\n rateLimiting?: RateLimitingConfigurationSchema\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 @observed({ deep: true }) accessor 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 @observed({ deep: true }) accessor accessRule: AccessRule[]\n /**\n * Optional configuration for API-wide rate limiting and throttling.\n * Defines rules to protect the API from overuse.\n */\n @observed() accessor rateLimiting: RateLimitingConfiguration | undefined\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 = structuredClone(input.user)\n }\n if (input.dependencyList) {\n result.dependencyList = structuredClone(input.dependencyList)\n }\n if (input.authentication) {\n result.authentication = structuredClone(input.authentication)\n }\n if (input.authorization) {\n result.authorization = structuredClone(input.authorization)\n }\n if (input.session) {\n result.session = structuredClone(input.session)\n }\n if (Array.isArray(input.accessRule)) {\n result.accessRule = structuredClone(input.accessRule)\n }\n if (input.rateLimiting) {\n result.rateLimiting = structuredClone(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 // Note that since we're using the `DependentModel` class, but the API Model can have only one dependency,\n // we keep the reference to the data domain under the `dependencyList` property.\n // It is all handled by the parent class `DependentModel`. This way we simplify the dependency management (loading)\n // process when the API model is loaded from the API.\n if (domain) {\n if (!domain.info.version) {\n throw new Error(`Domain ${domain.key} must have a version.`)\n }\n init.dependencyList = [{ key: domain.key, version: domain.info.version }]\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 = init.exposes.map((e) => new ExposedEntity(this, e))\n } else {\n this.exposes = []\n }\n if (Array.isArray(init.accessRule)) {\n this.accessRule = init.accessRule.map((rule) => restoreAccessRule(rule))\n } else {\n this.accessRule = []\n }\n if (init.rateLimiting) {\n this.rateLimiting = new RateLimitingConfiguration(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: this.exposes.map((e) => e.toJSON()),\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 (Array.isArray(this.accessRule) && this.accessRule.length > 0) {\n result.accessRule = this.accessRule.map((rule) => rule.toJSON())\n }\n if (this.rateLimiting) {\n result.rateLimiting = this.rateLimiting.toJSON()\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 *\n * The logic regarding exposing an entity:\n * - If the entity is already exposed as a root entity, it returns the existing one.\n * - If the entity has an association, we expose that entity as a nested entity (by setting the parent property).\n * - If the associated entity is already exposed as a root entity, we do not follow the association.\n *\n * @param entity The entity key and domain to expose.\n * @returns The exposed entity.\n */\n exposeEntity(entity: AssociationTarget, options?: ExposeOptions): ExposedEntity {\n const domain = this.domain\n if (!domain) {\n throw new Error(`No domain attached to API model`)\n }\n // checks whether the entity is already exposed as a root exposure.\n const existing = this.exposes.find(\n (e) => e.isRoot && e.entity.key === entity.key && e.entity.domain === entity.domain\n )\n if (existing) {\n // quietly return the existing exposure\n // TBD: should we throw an error here?\n return existing\n }\n const domainEntity = domain.findEntity(entity.key, entity.domain)\n if (!domainEntity) {\n throw new Error(`Entity not found in domain: ${entity.key}`)\n }\n const name = domainEntity.info.name || ''\n const segment = pluralize(name.toLocaleLowerCase())\n let relativeCollectionPath = `/${segment}`\n let relativeResourcePath = `/${segment}/{id}`\n\n // Check for root path collision and resolve by appending a number\n let counter = 1\n const originalCollectionPath = relativeCollectionPath\n while (this.exposes.some((e) => e.isRoot && e.collectionPath === relativeCollectionPath)) {\n relativeCollectionPath = `${originalCollectionPath}-${counter}`\n relativeResourcePath = `${relativeCollectionPath}/{id}`\n counter++\n }\n\n const newEntity: ExposedEntitySchema = {\n kind: ExposedEntityKind,\n key: nanoid(),\n entity: { ...entity },\n actions: [],\n isRoot: true,\n collectionPath: relativeCollectionPath,\n resourcePath: relativeResourcePath,\n hasCollection: true,\n }\n if (options) {\n newEntity.exposeOptions = { ...options }\n }\n const created = new ExposedEntity(this, newEntity)\n this.exposes.push(created)\n\n // Follow associations if requested\n if (options?.followAssociations) {\n if (options?.maxDepth === undefined || options.maxDepth > 0) {\n this.followEntityAssociations(newEntity, options)\n }\n }\n this.notifyChange()\n return created\n }\n\n /**\n * Follows associations for a newly exposed entity if configured to do so.\n * This creates nested exposures based on the entity's associations.\n *\n * @param parentExposure The root exposure to follow associations from\n * @param options The expose options containing follow configuration\n */\n private followEntityAssociations(parentExposure: ExposedEntitySchema, options: ExposeOptions): void {\n const domain = this.domain\n if (!domain) {\n return\n }\n const maxDepth = options.maxDepth ?? 6\n const follow = (currentEntity: AssociationTarget, parentKey: string, depth: number, currentPath: string[]) => {\n // Find the domain entity\n const domainEntity = domain.findEntity(currentEntity.key, currentEntity.domain)\n if (!domainEntity) return\n\n // Iterate through associations\n for (const association of domainEntity.listAssociations()) {\n for (const target of association.targets) {\n // Skip self-referencing associations\n if (target.key === currentEntity.key && target.domain === currentEntity.domain) {\n continue\n }\n\n const targetKeys = createDomainKey(target)\n // Circular dependency check: if this entity is already in our *current* traversal path\n if (currentPath.includes(targetKeys)) {\n continue\n }\n\n // Check if this entity is ALREADY exposed anywhere in the model\n const existingExposure = this.getExposedEntity(target)\n\n if (existingExposure) {\n // If it's already exposed and NOT root (i.e., it's currently a nested child of someone else),\n // promote it to ROOT to avoid duplicating it or deeply nesting it in multiple places.\n if (!existingExposure.isRoot) {\n // 1. Calculate new root paths (handling collisions)\n const targetDomEntity = domain.findEntity(target.key, target.domain)\n if (targetDomEntity) {\n const name = targetDomEntity.info.name || ''\n const segment = pluralize(name.toLocaleLowerCase())\n let relativeCollectionPath = `/${segment}`\n let relativeResourcePath = `/${segment}/{id}`\n\n let counter = 1\n const originalCollectionPath = relativeCollectionPath\n while (this.exposes.some((e) => e.isRoot && e.collectionPath === relativeCollectionPath)) {\n relativeCollectionPath = `${originalCollectionPath}-${counter}`\n relativeResourcePath = `${relativeCollectionPath}/{id}`\n counter++\n }\n\n // 2. Update properties to make it root\n existingExposure.isRoot = true\n existingExposure.parent = undefined\n existingExposure.collectionPath = relativeCollectionPath\n existingExposure.resourcePath = relativeResourcePath\n existingExposure.hasCollection = true\n }\n }\n // Whether it was already root or we just promoted it, we stop following here.\n continue\n }\n\n // Find the target domain entity for path generation\n const targetDomainEntity = domain.findEntity(target.key, target.domain)\n if (!targetDomainEntity) continue\n\n const name = association.info.name || ''\n const segment = pluralize(name.toLocaleLowerCase())\n const isCollection = association.multiple !== false\n const relativeCollectionPath = isCollection ? `/${segment}` : undefined\n const relativeResourcePath = isCollection ? `/${segment}/{id}` : `/${segment}`\n // Create nested exposure\n const nestedExposure: ExposedEntitySchema = {\n kind: ExposedEntityKind,\n key: nanoid(),\n entity: { ...target },\n actions: [],\n isRoot: false,\n collectionPath: relativeCollectionPath,\n resourcePath: relativeResourcePath,\n hasCollection: isCollection,\n parent: {\n key: parentKey,\n association: {\n key: association.key,\n domain: currentEntity.domain,\n },\n depth: depth + 1,\n },\n }\n\n this.exposes.push(new ExposedEntity(this, nestedExposure))\n if (depth + 1 >= maxDepth) {\n nestedExposure.truncated = true\n } else {\n // Recursively follow associations\n follow(target, nestedExposure.key, depth + 1, [...currentPath, targetKeys])\n }\n }\n }\n }\n\n // Start following from the root exposure\n // Initial path contains the root entity itself\n const rootKey = createDomainKey(parentExposure.entity)\n follow(parentExposure.entity, parentExposure.key, 0, [rootKey])\n }\n\n /**\n * Removes an exposed entity from the API model.\n * This also removes any nested exposed entities that are children of the removed entity.\n *\n * @param key The key of the exposed entity to remove.\n */\n removeExposedEntity(key: string): void {\n const index = this.exposes.findIndex((e) => e.key === key)\n if (index < 0) {\n throw new Error(`Exposed entity with key \"${key}\" not found.`)\n }\n this.removeWithChildren(key)\n }\n\n private removeWithChildren(key: string): void {\n const index = this.exposes.findIndex((e) => e.key === key)\n if (index < 0) {\n return\n }\n // Remove the parent itself\n this.exposes.splice(index, 1)\n // Remove all children recursively\n const removeChildren = (parentKey: string) => {\n // Find all exposures whose parent.key matches parentKey\n const children = this.exposes.filter((e) => e.parent?.key === parentKey)\n for (const child of children) {\n removeChildren(child.key)\n const childIndex = this.exposes.findIndex((e) => e.key === child.key)\n if (childIndex >= 0) {\n this.exposes.splice(childIndex, 1)\n }\n }\n }\n // Then also remove children\n removeChildren(key)\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(entity: AssociationTarget): ExposedEntity | undefined {\n return this.exposes.find((e) => e.entity.key === entity.key && e.entity.domain === entity.domain)\n }\n\n /**\n * Clears the API model for a new data domain change.\n * This method resets the dependencies, exposes, user,\n * authentication, authorization, and session properties.\n */\n cleanForDomainChange(): 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.cleanForDomainChange()\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,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACp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,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;QAED;;;;;;;WAOG;QACH,yBAAyB,CAAC,IAAY,EAAE,MAAe;YACrD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;gBACtC,IAAI,MAAM,IAAI,CAAC,CAAC,GAAG,KAAK,MAAM,EAAE,CAAC;oBAC/B,SAAQ;gBACV,CAAC;gBACD,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;oBACxC,OAAO,CAAC,CAAA;gBACV,CAAC;YACH,CAAC;YACD,OAAO,SAAS,CAAA;QAClB,CAAC;QAED;;;;;;;WAOG;QACH,2BAA2B,CAAC,IAAY,EAAE,MAAe;YACvD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;gBACtC,IAAI,MAAM,IAAI,CAAC,CAAC,GAAG,KAAK,MAAM,EAAE,CAAC;oBAC/B,SAAQ;gBACV,CAAC;gBACD,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,cAAc,KAAK,IAAI,EAAE,CAAC;oBAC7D,OAAO,CAAC,CAAA;gBACV,CAAC;YACH,CAAC;YACD,OAAO,SAAS,CAAA;QAClB,CAAC;;;SA3jBU,QAAQ","sourcesContent":["import { nanoid } from '../nanoid.js'\nimport { ApiModelKind, DataDomainKind, ExposedEntityKind } from '../models/kinds.js'\nimport { type IThing, Thing } from '../models/Thing.js'\nimport type {\n AssociationTarget,\n AuthenticationConfiguration,\n AuthorizationConfiguration,\n ExposedEntitySchema,\n RolesBasedAccessControl,\n SessionConfiguration,\n UsernamePasswordConfiguration,\n ExposeOptions,\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'\nimport pluralize from '@jarrodek/pluralize'\nimport { createDomainKey } from './helpers/keying.js'\nimport { ExposedEntity } from './ExposedEntity.js'\nimport { AccessRule, AccessRuleSchema } from './rules/AccessRule.js'\nimport { RateLimitingConfiguration, RateLimitingConfigurationSchema } from './rules/RateLimitingConfiguration.js'\nimport { restoreAccessRule } from './rules/index.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 API model 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 API model 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: ExposedEntitySchema[]\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?: AccessRuleSchema[]\n /**\n * Optional configuration for API-wide rate limiting and throttling.\n * Defines rules to protect the API from overuse.\n */\n rateLimiting?: RateLimitingConfigurationSchema\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 * The `key` is the key of the exposed entity. Using a Map to allow for quick lookups.\n */\n @observed({ deep: true }) accessor exposes: Map<string, 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 @observed({ deep: true }) accessor accessRule: AccessRule[]\n /**\n * Optional configuration for API-wide rate limiting and throttling.\n * Defines rules to protect the API from overuse.\n */\n @observed() accessor rateLimiting: RateLimitingConfiguration | undefined\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 = structuredClone(input.user)\n }\n if (input.dependencyList) {\n result.dependencyList = structuredClone(input.dependencyList)\n }\n if (input.authentication) {\n result.authentication = structuredClone(input.authentication)\n }\n if (input.authorization) {\n result.authorization = structuredClone(input.authorization)\n }\n if (input.session) {\n result.session = structuredClone(input.session)\n }\n if (Array.isArray(input.accessRule)) {\n result.accessRule = structuredClone(input.accessRule)\n }\n if (input.rateLimiting) {\n result.rateLimiting = structuredClone(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 // Note that since we're using the `DependentModel` class, but the API Model can have only one dependency,\n // we keep the reference to the data domain under the `dependencyList` property.\n // It is all handled by the parent class `DependentModel`. This way we simplify the dependency management (loading)\n // process when the API model is loaded from the API.\n if (domain) {\n if (!domain.info.version) {\n throw new Error(`Domain ${domain.key} must have a version.`)\n }\n init.dependencyList = [{ key: domain.key, version: domain.info.version }]\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 = new Map(init.exposes.map((e) => [e.key, new ExposedEntity(this, e)]))\n } else {\n this.exposes = new Map()\n }\n if (Array.isArray(init.accessRule)) {\n this.accessRule = init.accessRule.map((rule) => restoreAccessRule(rule))\n } else {\n this.accessRule = []\n }\n if (init.rateLimiting) {\n this.rateLimiting = new RateLimitingConfiguration(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: Array.from(this.exposes.values()).map((e) => e.toJSON()),\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 (Array.isArray(this.accessRule) && this.accessRule.length > 0) {\n result.accessRule = this.accessRule.map((rule) => rule.toJSON())\n }\n if (this.rateLimiting) {\n result.rateLimiting = this.rateLimiting.toJSON()\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 *\n * The logic regarding exposing an entity:\n * - If the entity is already exposed as a root entity, it returns the existing one.\n * - If the entity has an association, we expose that entity as a nested entity (by setting the parent property).\n * - If the associated entity is already exposed as a root entity, we do not follow the association.\n *\n * @param entity The entity key and domain to expose.\n * @returns The exposed entity.\n */\n exposeEntity(entity: AssociationTarget, options?: ExposeOptions): ExposedEntity {\n const domain = this.domain\n if (!domain) {\n throw new Error(`No domain attached to API model`)\n }\n // checks whether the entity is already exposed as a root exposure.\n let existing: ExposedEntity | undefined\n for (const exp of this.exposes.values()) {\n if (exp.isRoot && exp.entity.key === entity.key) {\n existing = exp\n break\n }\n }\n if (existing) {\n // quietly return the existing exposure\n // TBD: should we throw an error here?\n return existing\n }\n const domainEntity = domain.findEntity(entity.key, entity.domain)\n if (!domainEntity) {\n throw new Error(`Entity not found in domain: ${entity.key}`)\n }\n const name = domainEntity.info.name || ''\n const segment = pluralize(name.toLocaleLowerCase())\n let relativeCollectionPath = `/${segment}`\n let relativeResourcePath = `/${segment}/{id}`\n\n // Check for root path collision and resolve by appending a number\n let counter = 1\n const originalCollectionPath = relativeCollectionPath\n while (this.findCollectionPathCollision(relativeCollectionPath)) {\n relativeCollectionPath = `${originalCollectionPath}-${counter}`\n relativeResourcePath = `${relativeCollectionPath}/{id}`\n counter++\n }\n\n const newEntity: ExposedEntitySchema = {\n kind: ExposedEntityKind,\n key: nanoid(),\n entity: { ...entity },\n actions: [],\n isRoot: true,\n collectionPath: relativeCollectionPath,\n resourcePath: relativeResourcePath,\n hasCollection: true,\n }\n if (options) {\n newEntity.exposeOptions = { ...options }\n }\n const created = new ExposedEntity(this, newEntity)\n this.exposes.set(created.key, created)\n\n // Follow associations if requested\n if (options?.followAssociations) {\n if (options?.maxDepth === undefined || options.maxDepth > 0) {\n this.followEntityAssociations(newEntity, options)\n }\n }\n this.notifyChange()\n return created\n }\n\n /**\n * Follows associations for a newly exposed entity if configured to do so.\n * This creates nested exposures based on the entity's associations.\n *\n * @param parentExposure The root exposure to follow associations from\n * @param options The expose options containing follow configuration\n */\n private followEntityAssociations(parentExposure: ExposedEntitySchema, options: ExposeOptions): void {\n const domain = this.domain\n if (!domain) {\n return\n }\n const maxDepth = options.maxDepth ?? 6\n const follow = (currentEntity: AssociationTarget, parentKey: string, depth: number, currentPath: string[]) => {\n // Find the domain entity\n const domainEntity = domain.findEntity(currentEntity.key, currentEntity.domain)\n if (!domainEntity) return\n\n // Iterate through associations\n for (const association of domainEntity.listAssociations()) {\n for (const target of association.targets) {\n // Skip self-referencing associations\n if (target.key === currentEntity.key && target.domain === currentEntity.domain) {\n continue\n }\n\n const targetKeys = createDomainKey(target)\n // Circular dependency check: if this entity is already in our *current* traversal path\n if (currentPath.includes(targetKeys)) {\n continue\n }\n\n // Check if this entity is ALREADY exposed anywhere in the model\n let existingExposure: ExposedEntity | undefined\n for (const exp of this.exposes.values()) {\n if (exp.entity.key === target.key) {\n existingExposure = exp\n break\n }\n }\n\n if (existingExposure) {\n // If it's already exposed and NOT root (i.e., it's currently a nested child of someone else),\n // promote it to ROOT to avoid duplicating it or deeply nesting it in multiple places.\n if (!existingExposure.isRoot) {\n // 1. Calculate new root paths (handling collisions)\n const targetDomEntity = domain.findEntity(target.key, target.domain)\n if (targetDomEntity) {\n const name = targetDomEntity.info.name || ''\n const segment = pluralize(name.toLocaleLowerCase())\n let relativeCollectionPath = `/${segment}`\n let relativeResourcePath = `/${segment}/{id}`\n\n let counter = 1\n const originalCollectionPath = relativeCollectionPath\n while (this.findResourcePathCollision(relativeCollectionPath)) {\n relativeCollectionPath = `${originalCollectionPath}-${counter}`\n relativeResourcePath = `${relativeCollectionPath}/{id}`\n counter++\n }\n\n // 2. Update properties to make it root\n existingExposure.isRoot = true\n existingExposure.parent = undefined\n existingExposure.collectionPath = relativeCollectionPath\n existingExposure.resourcePath = relativeResourcePath\n existingExposure.hasCollection = true\n }\n }\n // Whether it was already root or we just promoted it, we stop following here.\n continue\n }\n\n // Find the target domain entity for path generation\n const targetDomainEntity = domain.findEntity(target.key, target.domain)\n if (!targetDomainEntity) continue\n\n const name = association.info.name || ''\n const segment = pluralize(name.toLocaleLowerCase())\n const isCollection = association.multiple !== false\n const relativeCollectionPath = isCollection ? `/${segment}` : undefined\n const relativeResourcePath = isCollection ? `/${segment}/{id}` : `/${segment}`\n // Create nested exposure\n const nestedExposure: ExposedEntitySchema = {\n kind: ExposedEntityKind,\n key: nanoid(),\n entity: { ...target },\n actions: [],\n isRoot: false,\n collectionPath: relativeCollectionPath,\n resourcePath: relativeResourcePath,\n hasCollection: isCollection,\n parent: {\n key: parentKey,\n association: {\n key: association.key,\n domain: currentEntity.domain,\n },\n depth: depth + 1,\n },\n }\n\n const inst = new ExposedEntity(this, nestedExposure)\n this.exposes.set(inst.key, inst)\n if (depth + 1 >= maxDepth) {\n nestedExposure.truncated = true\n } else {\n // Recursively follow associations\n follow(target, nestedExposure.key, depth + 1, [...currentPath, targetKeys])\n }\n }\n }\n }\n\n // Start following from the root exposure\n // Initial path contains the root entity itself\n const rootKey = createDomainKey(parentExposure.entity)\n follow(parentExposure.entity, parentExposure.key, 0, [rootKey])\n }\n\n /**\n * Removes an exposed entity from the API model.\n * This also removes any nested exposed entities that are children of the removed entity.\n *\n * @param key The key of the exposed entity to remove.\n */\n removeExposedEntity(key: string): void {\n if (!this.exposes.has(key)) {\n throw new Error(`Exposed entity with key \"${key}\" not found.`)\n }\n this.removeWithChildren(key)\n }\n\n private removeWithChildren(key: string): void {\n if (!this.exposes.has(key)) {\n return\n }\n // Remove the parent itself\n this.exposes.delete(key)\n // Remove all children recursively\n const removeChildren = (parentKey: string) => {\n // Find all exposures whose parent.key matches parentKey\n for (const child of this.exposes.values()) {\n if (child.parent?.key === parentKey) {\n removeChildren(child.key)\n this.exposes.delete(child.key)\n }\n }\n }\n // Then also remove children\n removeChildren(key)\n this.notifyChange()\n }\n\n /**\n * Clears the API model for a new data domain change.\n * This method resets the dependencies, exposes, user,\n * authentication, authorization, and session properties.\n */\n cleanForDomainChange(): void {\n this.dependencies.clear()\n this.dependencyList = []\n this.exposes = new Map()\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.cleanForDomainChange()\n this.dependencies.set(domain.key, domain)\n this.dependencyList = [{ key: domain.key, version: domain.info.version }]\n this.notifyChange()\n }\n\n /**\n * Finds an existing root exposed entity that has the given resource path.\n * Useful for detecting path collisions when adding or updating an exposed entity.\n *\n * @param path The resource path to check for collisions.\n * @param ignore Optional key of an exposed entity to ignore during the check (usually the entity being updated).\n * @returns The colliding `ExposedEntity` if found, otherwise `undefined`.\n */\n findResourcePathCollision(path: string, ignore?: string): ExposedEntity | undefined {\n for (const e of this.exposes.values()) {\n if (ignore && e.key === ignore) {\n continue\n }\n if (e.isRoot && e.resourcePath === path) {\n return e\n }\n }\n return undefined\n }\n\n /**\n * Finds an existing root exposed entity that has the given collection path.\n * Useful for detecting path collisions when adding or updating an exposed entity.\n *\n * @param path The collection path to check for collisions.\n * @param ignore Optional key of an exposed entity to ignore during the check (usually the entity being updated).\n * @returns The colliding `ExposedEntity` if found, otherwise `undefined`.\n */\n findCollectionPathCollision(path: string, ignore?: string): ExposedEntity | undefined {\n for (const e of this.exposes.values()) {\n if (ignore && e.key === ignore) {\n continue\n }\n if (e.isRoot && e.hasCollection && e.collectionPath === path) {\n return e\n }\n }\n return undefined\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { DataDomain } from './DataDomain.js';
2
- import { DomainImpactReport } from './types.js';
2
+ import type { DomainImpactReport } from './types.js';
3
3
  /**
4
4
  * DomainValidation performs comprehensive validation on a data domain and its components.
5
5
  *
@@ -1 +1 @@
1
- {"version":3,"file":"DomainValidation.d.ts","sourceRoot":"","sources":["../../../src/modeling/DomainValidation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAM/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,IAAI,CAAY;gBAEZ,IAAI,EAAE,UAAU;IAI5B;;;;;;;;OAQG;IACH,QAAQ,IAAI,kBAAkB;CAyF/B"}
1
+ {"version":3,"file":"DomainValidation.d.ts","sourceRoot":"","sources":["../../../src/modeling/DomainValidation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAMpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,IAAI,CAAY;gBAEZ,IAAI,EAAE,UAAU;IAI5B;;;;;;;;OAQG;IACH,QAAQ,IAAI,kBAAkB;CAyF/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"DomainValidation.js","sourceRoot":"","sources":["../../../src/modeling/DomainValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAGnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,MAAM,OAAO,gBAAgB;IACnB,IAAI,CAAY;IAExB,YAAY,IAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED;;;;;;;;OAQG;IACH,QAAQ;QACN,MAAM,MAAM,GAAuB;YACjC,GAAG,EAAE,EAAE;YACP,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,EAAE;YACV,UAAU,EAAE,IAAI;SACjB,CAAA;QACD,MAAM,eAAe,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACvD,MAAM,iBAAiB,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,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B;QACrB,MAAM,cAAc,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAA;QACnD,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;YAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAA;YAC1C,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,CAAC,QAAQ,CAAA;YAClD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;gBACjB,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,IAAI,CAAC,OAAO;gBACpB,UAAU,EAAE,IAAI,CAAC,IAAI;gBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import { DataDomainKind } from '../models/kinds.js'\nimport { DataDomain } from './DataDomain.js'\nimport { DomainImpactReport } from './types.js'\nimport { AssociationValidation } from './validation/association_validation.js'\nimport { EntityValidation } from './validation/entity_validation.js'\nimport { PropertyValidation } from './validation/property_validation.js'\nimport { SemanticValidation } from './validation/semantic_validation.js'\n\n/**\n * DomainValidation performs comprehensive validation on a data domain and its components.\n *\n * This class orchestrates validation across all domain elements including entities, properties,\n * associations, and semantics. It ensures that the data domain is well-formed and follows\n * established conventions before it can be published or used in API generation.\n *\n * ## Validation Scope\n *\n * The validation process covers:\n * - **Entities**: Structure, naming, primary keys, and inheritance\n * - **Properties**: Naming conventions, data types, and constraints\n * - **Associations**: Relationships, targets, and naming\n * - **Semantics**: Recommended patterns and best practices\n *\n * ## Validation Severity Levels\n *\n * - **Error**: Blocking issues that prevent domain publication\n * - **Warning**: Issues that may cause problems but don't block publication\n * - **Info**: Recommendations for best practices\n *\n * ## Usage\n *\n * ```typescript\n * const domain = new DataDomain()\n * // ... add entities, properties, associations\n *\n * const validator = new DomainValidation(domain)\n * const report = validator.validate()\n *\n * if (report.canProceed) {\n * // Domain is valid and can be published\n * } else {\n * // Handle validation errors\n * console.log(report.impact)\n * }\n * ```\n *\n * ## Validation Rules\n *\n * ### Entity Validation Rules\n * - **Primary Key**: Each entity must have a primary key (can be inherited)\n * - **Minimum Properties**: Entities should have properties or associations (can be inherited)\n * - **Naming**: Entity names must follow PostgreSQL naming conventions\n * - **Uniqueness**: Entity names must be unique within the domain\n *\n * ### Property Validation Rules\n * - **Naming**: Properties must follow PostgreSQL column naming conventions\n * - **Length**: Names must be 2-59 characters long\n * - **Format**: Names must start with letter/underscore, contain only alphanumeric/underscore\n * - **Reserved Words**: Names cannot be PostgreSQL reserved keywords\n * - **Case**: Snake case is recommended (lowercase with underscores)\n *\n * ### Association Validation Rules\n * - **Targets**: Associations must have at least one target entity\n * - **Target Existence**: Target entities must exist in the domain\n * - **Naming**: Same rules as properties\n *\n * ### Semantic Validation Rules\n * - **User Entity**: Recommended to have at least one entity with User semantic\n * - **Timestamps**: Recommended to have CreatedTimestamp and UpdatedTimestamp properties\n * - **Soft Delete**: Recommended to have soft delete capability for entities\n * - **Data Types**: Semantic-specific data type validation\n *\n * @see {@link EntityValidation} for detailed entity validation rules\n * @see {@link PropertyValidation} for detailed property validation rules\n * @see {@link AssociationValidation} for detailed association validation rules\n * @see {@link SemanticValidation} for detailed semantic validation rules\n */\nexport class DomainValidation {\n private root: DataDomain\n\n constructor(root: DataDomain) {\n this.root = root\n }\n\n /**\n * Performs comprehensive validation on the entire data domain.\n *\n * This method validates all entities, properties, associations, and semantics\n * in the domain. It returns a detailed report of all validation issues found,\n * categorized by severity level.\n *\n * @returns A comprehensive validation report with all issues found\n */\n validate(): DomainImpactReport {\n const result: DomainImpactReport = {\n key: '',\n kind: DataDomainKind,\n impact: [],\n canProceed: true,\n }\n const entityValidator = new EntityValidation(this.root)\n const propertyValidator = new PropertyValidation(this.root)\n const associationValidator = new AssociationValidation(this.root)\n const semanticValidator = new SemanticValidation(this.root)\n\n let hasEntities = false\n // Validate entities, properties, and associations\n for (const entity of this.root.listEntities()) {\n if (entity.domain.key !== this.root.key) {\n // we don't need to validate foreign entities\n continue\n }\n hasEntities = true\n const report = entityValidator.validate(entity)\n for (const item of report) {\n const blocking = item.severity === 'error'\n result.canProceed = result.canProceed && !blocking\n result.impact.push({\n key: item.key,\n kind: item.kind,\n type: 'publish',\n impact: item.message,\n resolution: item.help,\n severity: item.severity,\n parent: item.parent,\n })\n }\n for (const property of entity.properties) {\n const report = propertyValidator.validate(property)\n for (const item of report) {\n const blocking = item.severity === 'error'\n result.canProceed = result.canProceed && !blocking\n result.impact.push({\n key: item.key,\n kind: item.kind,\n type: 'publish',\n impact: item.message,\n resolution: item.help,\n severity: item.severity,\n parent: item.parent,\n })\n }\n }\n for (const association of entity.associations) {\n const report = associationValidator.validate(association)\n for (const item of report) {\n const blocking = item.severity === 'error'\n result.canProceed = result.canProceed && !blocking\n result.impact.push({\n key: item.key,\n kind: item.kind,\n type: 'publish',\n impact: item.message,\n resolution: item.help,\n severity: item.severity,\n parent: item.parent,\n })\n }\n }\n }\n if (!hasEntities) {\n // no entities, no need to validate anything else\n return result\n }\n // Validate semantics\n const semanticReport = semanticValidator.validate()\n for (const item of semanticReport) {\n const blocking = item.severity === 'error'\n result.canProceed = result.canProceed && !blocking\n result.impact.push({\n key: item.key,\n kind: item.kind,\n type: 'publish',\n impact: item.message,\n resolution: item.help,\n severity: item.severity,\n parent: item.parent,\n })\n }\n\n return result\n }\n}\n"]}
1
+ {"version":3,"file":"DomainValidation.js","sourceRoot":"","sources":["../../../src/modeling/DomainValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAGnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE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'\nimport { DataDomain } from './DataDomain.js'\nimport type { DomainImpactReport } from './types.js'\nimport { AssociationValidation } from './validation/association_validation.js'\nimport { EntityValidation } from './validation/entity_validation.js'\nimport { PropertyValidation } from './validation/property_validation.js'\nimport { SemanticValidation } from './validation/semantic_validation.js'\n\n/**\n * DomainValidation performs comprehensive validation on a data domain and its components.\n *\n * This class orchestrates validation across all domain elements including entities, properties,\n * associations, and semantics. It ensures that the data domain is well-formed and follows\n * established conventions before it can be published or used in API generation.\n *\n * ## Validation Scope\n *\n * The validation process covers:\n * - **Entities**: Structure, naming, primary keys, and inheritance\n * - **Properties**: Naming conventions, data types, and constraints\n * - **Associations**: Relationships, targets, and naming\n * - **Semantics**: Recommended patterns and best practices\n *\n * ## Validation Severity Levels\n *\n * - **Error**: Blocking issues that prevent domain publication\n * - **Warning**: Issues that may cause problems but don't block publication\n * - **Info**: Recommendations for best practices\n *\n * ## Usage\n *\n * ```typescript\n * const domain = new DataDomain()\n * // ... add entities, properties, associations\n *\n * const validator = new DomainValidation(domain)\n * const report = validator.validate()\n *\n * if (report.canProceed) {\n * // Domain is valid and can be published\n * } else {\n * // Handle validation errors\n * console.log(report.impact)\n * }\n * ```\n *\n * ## Validation Rules\n *\n * ### Entity Validation Rules\n * - **Primary Key**: Each entity must have a primary key (can be inherited)\n * - **Minimum Properties**: Entities should have properties or associations (can be inherited)\n * - **Naming**: Entity names must follow PostgreSQL naming conventions\n * - **Uniqueness**: Entity names must be unique within the domain\n *\n * ### Property Validation Rules\n * - **Naming**: Properties must follow PostgreSQL column naming conventions\n * - **Length**: Names must be 2-59 characters long\n * - **Format**: Names must start with letter/underscore, contain only alphanumeric/underscore\n * - **Reserved Words**: Names cannot be PostgreSQL reserved keywords\n * - **Case**: Snake case is recommended (lowercase with underscores)\n *\n * ### Association Validation Rules\n * - **Targets**: Associations must have at least one target entity\n * - **Target Existence**: Target entities must exist in the domain\n * - **Naming**: Same rules as properties\n *\n * ### Semantic Validation Rules\n * - **User Entity**: Recommended to have at least one entity with User semantic\n * - **Timestamps**: Recommended to have CreatedTimestamp and UpdatedTimestamp properties\n * - **Soft Delete**: Recommended to have soft delete capability for entities\n * - **Data Types**: Semantic-specific data type validation\n *\n * @see {@link EntityValidation} for detailed entity validation rules\n * @see {@link PropertyValidation} for detailed property validation rules\n * @see {@link AssociationValidation} for detailed association validation rules\n * @see {@link SemanticValidation} for detailed semantic validation rules\n */\nexport class DomainValidation {\n private root: DataDomain\n\n constructor(root: DataDomain) {\n this.root = root\n }\n\n /**\n * Performs comprehensive validation on the entire data domain.\n *\n * This method validates all entities, properties, associations, and semantics\n * in the domain. It returns a detailed report of all validation issues found,\n * categorized by severity level.\n *\n * @returns A comprehensive validation report with all issues found\n */\n validate(): DomainImpactReport {\n const result: DomainImpactReport = {\n key: '',\n kind: DataDomainKind,\n impact: [],\n canProceed: true,\n }\n const entityValidator = new EntityValidation(this.root)\n const propertyValidator = new PropertyValidation(this.root)\n const associationValidator = new AssociationValidation(this.root)\n const semanticValidator = new SemanticValidation(this.root)\n\n let hasEntities = false\n // Validate entities, properties, and associations\n for (const entity of this.root.listEntities()) {\n if (entity.domain.key !== this.root.key) {\n // we don't need to validate foreign entities\n continue\n }\n hasEntities = true\n const report = entityValidator.validate(entity)\n for (const item of report) {\n const blocking = item.severity === 'error'\n result.canProceed = result.canProceed && !blocking\n result.impact.push({\n key: item.key,\n kind: item.kind,\n type: 'publish',\n impact: item.message,\n resolution: item.help,\n severity: item.severity,\n parent: item.parent,\n })\n }\n for (const property of entity.properties) {\n const report = propertyValidator.validate(property)\n for (const item of report) {\n const blocking = item.severity === 'error'\n result.canProceed = result.canProceed && !blocking\n result.impact.push({\n key: item.key,\n kind: item.kind,\n type: 'publish',\n impact: item.message,\n resolution: item.help,\n severity: item.severity,\n parent: item.parent,\n })\n }\n }\n for (const association of entity.associations) {\n const report = associationValidator.validate(association)\n for (const item of report) {\n const blocking = item.severity === 'error'\n result.canProceed = result.canProceed && !blocking\n result.impact.push({\n key: item.key,\n kind: item.kind,\n type: 'publish',\n impact: item.message,\n resolution: item.help,\n severity: item.severity,\n parent: item.parent,\n })\n }\n }\n }\n if (!hasEntities) {\n // no entities, no need to validate anything else\n return result\n }\n // Validate semantics\n const semanticReport = semanticValidator.validate()\n for (const item of semanticReport) {\n const blocking = item.severity === 'error'\n result.canProceed = result.canProceed && !blocking\n result.impact.push({\n key: item.key,\n kind: item.kind,\n type: 'publish',\n impact: item.message,\n resolution: item.help,\n severity: item.severity,\n parent: item.parent,\n })\n }\n\n return result\n }\n}\n"]}
@@ -2,6 +2,7 @@ import { ExposedEntityKind } from '../models/kinds.js';
2
2
  import { Action } from './actions/Action.js';
3
3
  import type { ApiModel } from './ApiModel.js';
4
4
  import { AccessRule } from './rules/AccessRule.js';
5
+ import { type RateLimitRule } from './rules/index.js';
5
6
  import { RateLimitingConfiguration } from './rules/RateLimitingConfiguration.js';
6
7
  import type { AssociationTarget, ExposeOptions, ExposeParentRef, ExposedEntitySchema } from './types.js';
7
8
  /**
@@ -132,5 +133,18 @@ export declare class ExposedEntity extends EventTarget {
132
133
  * Returns undefined if this exposure has no collection.
133
134
  */
134
135
  getAbsoluteCollectionPath(): string | undefined;
136
+ /**
137
+ * Returns all access rules for this exposure, including the ones from all the parents up to the API.
138
+ */
139
+ getAllRules(): AccessRule[];
140
+ /**
141
+ * Returns all rate limiters for this exposure, including the ones from all the parents up to the API.
142
+ */
143
+ getAllRateLimiters(): RateLimitingConfiguration[];
144
+ /**
145
+ * Returns all rate limiter rules for this exposure, including the ones from all the parents up to the API.
146
+ * Similar to the getAllRules() method, but it flattens the rate limiters into a single list of rules.
147
+ */
148
+ getAllRateLimiterRules(): RateLimitRule[];
135
149
  }
136
150
  //# sourceMappingURL=ExposedEntity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExposedEntity.d.ts","sourceRoot":"","sources":["../../../src/modeling/ExposedEntity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAA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,CAAC,YAAY,EAAE,MAAM,CAAA;IAEzC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;;OAIG;IACH,MAAM,CAAC,EAAE,eAAe,CAAA;IAExB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,aAAa,CAAA;IAE7B;;OAEG;IACuB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAA;IAEpD;;OAEG;IACuB,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,GAAG,SAAS,CAAA;IAEvE;;OAEG;IACS,QAAQ,CAAC,YAAY,EAAE,yBAAyB,GAAG,SAAS,CAAA;IAExE;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IAcnB;;OAEG;IACH,GAAG,EAAE,QAAQ,CAAA;IAEb,MAAM,CAAC,YAAY,CAAC,KAAK,GAAE,OAAO,CAAC,mBAAmB,CAAM,GAAG,mBAAmB;gBA+CtE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC;IAoBjE,YAAY;IAYZ,MAAM,IAAI,mBAAmB;IAiC7B;;;;;;;;OAQG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM;IAmC9B;;;;;;;;OAQG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM;IAgD5B;;;;;OAKG;IACH,uBAAuB,IAAI,MAAM;IAcjC;;;;;;OAMG;IACH,yBAAyB,IAAI,MAAM,GAAG,SAAS;IAe/C;;OAEG;IACH,WAAW,IAAI,UAAU,EAAE;IAc3B;;OAEG;IACH,kBAAkB,IAAI,yBAAyB,EAAE;IAgBjD;;;OAGG;IACH,sBAAsB,IAAI,aAAa,EAAE;CAe1C"}
@@ -48,7 +48,7 @@ let ExposedEntity = (() => {
48
48
  _resourcePath_decorators = [observed()];
49
49
  _actions_decorators = [observed({ deep: true })];
50
50
  _accessRule_decorators = [observed({ deep: true })];
51
- _rateLimiting_decorators = [observed({ deep: true })];
51
+ _rateLimiting_decorators = [observed()];
52
52
  __esDecorate(this, null, _entity_decorators, { kind: "accessor", name: "entity", static: false, private: false, access: { has: obj => "entity" in obj, get: obj => obj.entity, set: (obj, value) => { obj.entity = value; } }, metadata: _metadata }, _entity_initializers, _entity_extraInitializers);
53
53
  __esDecorate(this, null, _collectionPath_decorators, { kind: "accessor", name: "collectionPath", static: false, private: false, access: { has: obj => "collectionPath" in obj, get: obj => obj.collectionPath, set: (obj, value) => { obj.collectionPath = value; } }, metadata: _metadata }, _collectionPath_initializers, _collectionPath_extraInitializers);
54
54
  __esDecorate(this, null, _resourcePath_decorators, { kind: "accessor", name: "resourcePath", static: false, private: false, access: { has: obj => "resourcePath" in obj, get: obj => obj.resourcePath, set: (obj, value) => { obj.resourcePath = value; } }, metadata: _metadata }, _resourcePath_initializers, _resourcePath_extraInitializers);
@@ -200,7 +200,7 @@ let ExposedEntity = (() => {
200
200
  this.isRoot = init.isRoot;
201
201
  this.parent = init.parent;
202
202
  this.exposeOptions = init.exposeOptions;
203
- this.actions = init.actions ? init.actions.map((a) => restoreAction(a)) : [];
203
+ this.actions = init.actions ? init.actions.map((a) => restoreAction(this, a)) : [];
204
204
  this.accessRule = init.accessRule ? init.accessRule.map((ar) => restoreAccessRule(ar)) : [];
205
205
  this.rateLimiting = init.rateLimiting ? new RateLimitingConfiguration(init.rateLimiting) : undefined;
206
206
  this.truncated = init.truncated;
@@ -271,7 +271,7 @@ let ExposedEntity = (() => {
271
271
  const normalizedCollection = `/${segments[0]}`;
272
272
  // Check for collision if this is a root entity
273
273
  if (this.isRoot) {
274
- const collision = this.api.exposes.find((e) => e.isRoot && e.key !== this.key && e.collectionPath === normalizedCollection);
274
+ const collision = this.api.findCollectionPathCollision(normalizedCollection, this.key);
275
275
  if (collision) {
276
276
  throw new Error(`Collection path "${normalizedCollection}" is already in use by another root entity.`);
277
277
  }
@@ -332,7 +332,7 @@ let ExposedEntity = (() => {
332
332
  }
333
333
  // Check for collision if this is a root entity (singleton case)
334
334
  if (this.isRoot) {
335
- const collision = this.api.exposes.find((e) => e.isRoot && e.key !== this.key && e.resourcePath === cleaned);
335
+ const collision = this.api.findResourcePathCollision(cleaned, this.key);
336
336
  if (collision) {
337
337
  throw new Error(`Resource path "${cleaned}" is already in use by another root entity.`);
338
338
  }
@@ -352,7 +352,7 @@ let ExposedEntity = (() => {
352
352
  // Traverse parents, always joining with the parent's resource path
353
353
  let parentKey = this.parent?.key;
354
354
  while (parentKey) {
355
- const parent = this.api.exposes.find((e) => e.key === parentKey);
355
+ const parent = this.api.exposes.get(parentKey);
356
356
  if (!parent)
357
357
  break;
358
358
  const parentResource = ensureLeadingSlash(parent.resourcePath);
@@ -375,7 +375,7 @@ let ExposedEntity = (() => {
375
375
  // Traverse parents, always joining with the parent's resource path
376
376
  let parentKey = this.parent?.key;
377
377
  while (parentKey) {
378
- const parent = this.api.exposes.find((e) => e.key === parentKey);
378
+ const parent = this.api.exposes.get(parentKey);
379
379
  if (!parent)
380
380
  break;
381
381
  const parentResource = ensureLeadingSlash(parent.resourcePath);
@@ -384,6 +384,59 @@ let ExposedEntity = (() => {
384
384
  }
385
385
  return absolute;
386
386
  }
387
+ /**
388
+ * Returns all access rules for this exposure, including the ones from all the parents up to the API.
389
+ */
390
+ getAllRules() {
391
+ const rules = [];
392
+ this.api.accessRule.forEach((rule) => rules.push(rule));
393
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
394
+ let current = this;
395
+ while (current) {
396
+ if (current.accessRule) {
397
+ rules.push(...current.accessRule);
398
+ }
399
+ current = current.parent ? this.api.exposes.get(current.parent.key) : undefined;
400
+ }
401
+ return rules;
402
+ }
403
+ /**
404
+ * Returns all rate limiters for this exposure, including the ones from all the parents up to the API.
405
+ */
406
+ getAllRateLimiters() {
407
+ const rateLimiters = [];
408
+ if (this.api.rateLimiting) {
409
+ rateLimiters.push(this.api.rateLimiting);
410
+ }
411
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
412
+ let current = this;
413
+ while (current) {
414
+ if (current.rateLimiting) {
415
+ rateLimiters.push(current.rateLimiting);
416
+ }
417
+ current = current.parent ? this.api.exposes.get(current.parent.key) : undefined;
418
+ }
419
+ return rateLimiters;
420
+ }
421
+ /**
422
+ * Returns all rate limiter rules for this exposure, including the ones from all the parents up to the API.
423
+ * Similar to the getAllRules() method, but it flattens the rate limiters into a single list of rules.
424
+ */
425
+ getAllRateLimiterRules() {
426
+ const rules = [];
427
+ if (this.api.rateLimiting) {
428
+ rules.push(...this.api.rateLimiting.rules);
429
+ }
430
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
431
+ let current = this;
432
+ while (current) {
433
+ if (current.rateLimiting) {
434
+ rules.push(...current.rateLimiting.rules);
435
+ }
436
+ current = current.parent ? this.api.exposes.get(current.parent.key) : undefined;
437
+ }
438
+ return rules;
439
+ }
387
440
  };
388
441
  })();
389
442
  export { ExposedEntity };
@@ -1 +1 @@
1
- {"version":3,"file":"ExposedEntity.js","sourceRoot":"","sources":["../../../src/modeling/ExposedEntity.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AAGhF;;;;;;;;;;;;;GAaG;IACU,aAAa;sBAAS,WAAW;;;;;;;;;;;;;;;;;;;iBAAjC,aAAc,SAAQ,WAAW;;;kCAe3C,QAAQ,EAAE;0CAeV,QAAQ,EAAE;wCAMV,QAAQ,EAAE;mCA4BV,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAA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C,MAAM,EAAE,GAAG,CAAA;YAChC,CAAC;YACD,OAAO,QAAQ,CAAA;QACjB,CAAC;QAED;;;;;;WAMG;QACH,yBAAyB;YACvB,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,cAAc;gBAAE,OAAO,SAAS,CAAA;YACjE,IAAI,QAAQ,GAAG,kBAAkB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;YACtD,mEAAmE;YACnE,IAAI,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,CAAA;YAChC,OAAO,SAAS,EAAE,CAAC;gBACjB,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,SAAS,CAAC,CAAA;gBAChE,IAAI,CAAC,MAAM;oBAAE,MAAK;gBAClB,MAAM,cAAc,GAAG,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;gBAC9D,QAAQ,GAAG,SAAS,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;gBAC9C,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAA;YAChC,CAAC;YACD,OAAO,QAAQ,CAAA;QACjB,CAAC;;;SAnWU,aAAa","sourcesContent":["import { observed } from '../decorators/observed.js'\nimport { ExposedEntityKind } from '../models/kinds.js'\nimport { nanoid } from '../nanoid.js'\nimport { Action } from './actions/Action.js'\nimport { restoreAction } from './actions/index.js'\nimport type { ApiModel } from './ApiModel.js'\nimport { ensureLeadingSlash, joinPaths } from './helpers/endpointHelpers.js'\nimport { AccessRule } from './rules/AccessRule.js'\nimport { restoreAccessRule } from './rules/index.js'\nimport { RateLimitingConfiguration } from './rules/RateLimitingConfiguration.js'\nimport type { AssociationTarget, ExposeOptions, ExposeParentRef, ExposedEntitySchema } from './types.js'\n\n/**\n * A class that specializes in representing an exposed Data Entity within an API Model.\n *\n * ## Design Note\n * This class enforces strict path constraints (e.g., single-segment collection paths like `/users`,\n * two-segment resource paths like `/users/{id}`).\n * This is an intentional design choice to support a UI paradigm for non-technical users, ensuring that\n * path segments are configured individually at each level of the exposure hierarchy.\n *\n * Flexibility is achieved by chaining exposed entities (parent/child relationships), where the final\n * absolute path is composed of all ancestral paths. See `getAbsoluteResourcePath()` and `getAbsoluteCollectionPath()`.\n *\n * @fires change - Emitted when the exposed entity has changed.\n */\nexport class ExposedEntity extends EventTarget {\n /**\n * The exposed entity kind recognizable by the ecosystem.\n */\n kind: typeof ExposedEntityKind\n\n /**\n * The unique key of the exposed entity.\n * This is a stable identifier that does not change across versions.\n */\n key: string\n\n /**\n * A pointer to a Data Entity from the Data Domain.\n */\n @observed() accessor entity: AssociationTarget\n\n /**\n * Indicates whether this exposure has a collection endpoint.\n * A collection endpoint is optional for nested exposures where the association is 1:1\n * and the schema is embedded directly under the parent resource.\n *\n * Note that this property is not observed for changes as it is immutable after creation.\n */\n hasCollection: boolean\n\n /**\n * Path to the collection endpoint for this exposure.\n * Starts with '/'. Not set for 1:1 nested exposures where collection does not exist.\n */\n @observed() accessor collectionPath: string | undefined\n\n /**\n * Path to the resource endpoint for this exposure.\n * Starts with '/'. For 1:1 nested exposures the resource path typically does not include an id segment.\n */\n @observed() accessor resourcePath: string\n\n /**\n * Whether this exposure is a root exposure (top-level collection).\n * If this is set then the `parent` reference must be populated.\n *\n * Note that this property is not observed for changes as it is immutable after creation.\n */\n isRoot?: boolean\n\n /**\n * Parent reference when this exposure was created via following an association.\n *\n * Note that this property is not observed for changes as it is immutable after creation.\n */\n parent?: ExposeParentRef\n\n /**\n * Expose-time config used to create this exposure (persisted for auditing/UI).\n * This is only populated for the root exposure. All children exposures inherit this config.\n *\n * Note that this property is not observed for changes as it is immutable after creation.\n */\n exposeOptions?: ExposeOptions\n\n /**\n * The list of enabled API actions for this exposure (List/Read/Create/etc.)\n */\n @observed({ deep: true }) accessor actions: Action[]\n\n /**\n * Optional array of access rules that define the access control policies for this exposure.\n */\n @observed({ deep: true }) accessor accessRule: AccessRule[] | undefined\n\n /**\n * Optional configuration for rate limiting for this exposure.\n */\n @observed({ deep: true }) accessor rateLimiting: RateLimitingConfiguration | undefined\n\n /**\n * When true, generation for this exposure hit configured limits\n *\n * Note that this property is not observed for changes as it is immutable after creation.\n */\n truncated?: boolean\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 * When the initializing flag is set to true,\n * the domain is not notified of changes.\n */\n #initializing = true\n /**\n * A reference to the parent API Model instance.\n */\n api: ApiModel\n\n static createSchema(input: Partial<ExposedEntitySchema> = {}): ExposedEntitySchema {\n const {\n key = nanoid(),\n entity = { key: '' },\n collectionPath,\n resourcePath = '/',\n hasCollection = true,\n isRoot,\n parent,\n exposeOptions,\n actions = [],\n accessRule,\n rateLimiting,\n truncated,\n } = input\n const result: ExposedEntitySchema = {\n kind: ExposedEntityKind,\n key,\n entity: { ...entity },\n hasCollection,\n resourcePath,\n actions: actions.map((a) => ({ ...a })),\n }\n if (collectionPath !== undefined) {\n result.collectionPath = collectionPath\n }\n if (isRoot !== undefined) {\n result.isRoot = isRoot\n }\n if (parent !== undefined) {\n result.parent = { ...parent }\n }\n if (exposeOptions !== undefined) {\n result.exposeOptions = { ...exposeOptions }\n }\n if (Array.isArray(accessRule)) {\n result.accessRule = accessRule.map((ar) => ({ ...ar }))\n }\n if (rateLimiting !== undefined) {\n result.rateLimiting = { ...rateLimiting }\n }\n if (truncated !== undefined) {\n result.truncated = truncated\n }\n return result\n }\n\n constructor(model: ApiModel, state?: Partial<ExposedEntitySchema>) {\n super()\n this.api = model\n const init = ExposedEntity.createSchema(state)\n this.kind = init.kind\n this.key = init.key\n this.entity = init.entity\n this.hasCollection = init.hasCollection\n this.collectionPath = init.collectionPath\n this.resourcePath = init.resourcePath\n this.isRoot = init.isRoot\n this.parent = init.parent\n this.exposeOptions = init.exposeOptions\n this.actions = init.actions ? init.actions.map((a) => restoreAction(a)) : []\n this.accessRule = init.accessRule ? init.accessRule.map((ar) => restoreAccessRule(ar)) : []\n this.rateLimiting = init.rateLimiting ? new RateLimitingConfiguration(init.rateLimiting) : undefined\n this.truncated = init.truncated\n this.#initializing = false\n }\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 toJSON(): ExposedEntitySchema {\n const result: ExposedEntitySchema = {\n kind: this.kind,\n key: this.key,\n entity: { ...this.entity },\n resourcePath: this.resourcePath,\n actions: this.actions.map((a) => a.toJSON()),\n hasCollection: this.hasCollection,\n }\n if (this.collectionPath !== undefined) {\n result.collectionPath = this.collectionPath\n }\n if (this.isRoot !== undefined) {\n result.isRoot = this.isRoot\n }\n if (this.parent !== undefined) {\n result.parent = { ...this.parent }\n }\n if (this.exposeOptions !== undefined) {\n result.exposeOptions = { ...this.exposeOptions }\n }\n if (Array.isArray(this.accessRule) && this.accessRule.length > 0) {\n result.accessRule = this.accessRule.map((ar) => ar.toJSON())\n }\n if (this.rateLimiting !== undefined) {\n result.rateLimiting = this.rateLimiting.toJSON()\n }\n if (this.truncated !== undefined) {\n result.truncated = this.truncated\n }\n return result\n }\n\n /**\n * Sets a new collection path for this exposed entity.\n *\n * It:\n * - updates the collectionPath property\n * - updates the absoluteCollectionPath property accordingly\n * - updates the resourcePath accordingly.\n * @param path The new path to set.\n */\n setCollectionPath(path: string) {\n if (!this.hasCollection) {\n throw new Error(`Cannot set collection path on an exposure that does not have a collection`)\n }\n const cleaned = ensureLeadingSlash(path)\n // Ensure exactly one non-empty segment\n const segments = cleaned.split('/').filter(Boolean)\n if (segments.length !== 1) {\n throw new Error(`Collection path must contain exactly one segment. Received: \"${path}\"`)\n }\n const normalizedCollection = `/${segments[0]}`\n\n // Check for collision if this is a root entity\n if (this.isRoot) {\n const collision = this.api.exposes.find(\n (e) => e.isRoot && e.key !== this.key && e.collectionPath === normalizedCollection\n )\n if (collision) {\n throw new Error(`Collection path \"${normalizedCollection}\" is already in use by another root entity.`)\n }\n }\n\n // Preserve current parameter name if present, otherwise default to {id}\n let param = '{id}'\n if (this.resourcePath) {\n const curSegments = this.resourcePath.split('/').filter(Boolean)\n const maybeParam = curSegments[1]\n if (maybeParam && /^\\{[A-Za-z_][A-Za-z0-9_]*\\}$/.test(maybeParam)) {\n param = maybeParam\n }\n }\n const nextResource = `${normalizedCollection}/${param}`\n this.collectionPath = normalizedCollection\n this.resourcePath = nextResource\n // rely on ApiModel.exposes deep observation to notify on property sets\n }\n\n /**\n * Sets a new resource path for this exposed entity.\n *\n * Rules:\n * - Must start with '/'.\n * - If this exposure has a collection, the path must be exactly the collection path plus a single\n * parameter segment (e.g. `/products/{productId}`) and only the parameter name may vary.\n * - If this exposure does NOT have a collection, the path can be any two segments (e.g. `/profile/{id}` or `/a/b`).\n */\n setResourcePath(path: string) {\n const cleaned = ensureLeadingSlash(path)\n const segments = cleaned.split('/').filter(Boolean)\n\n if (this.hasCollection) {\n if (!this.collectionPath) {\n throw new Error('Cannot set resource path: missing collection path for this exposure')\n }\n const colSegments = this.collectionPath.split('/').filter(Boolean)\n if (colSegments.length !== 1) {\n throw new Error(`Invalid stored collection path \"${this.collectionPath}\"`)\n }\n if (segments.length !== 2) {\n throw new Error(`Resource path must be exactly two segments (collection + parameter). Received: \"${cleaned}\"`)\n }\n const [s1, s2] = segments\n if (s1 !== colSegments[0]) {\n throw new Error(`Resource path must start with the collection segment \"${colSegments[0]}\". Received: \"${s1}\"`)\n }\n // s2 must be a parameter segment {name}\n if (!/^\\{[A-Za-z_][A-Za-z0-9_]*\\}$/.test(s2)) {\n throw new Error(`The second segment must be a parameter in braces, e.g. {id}. Received: \"${s2}\"`)\n }\n if (this.resourcePath !== cleaned) {\n this.resourcePath = `/${s1}/${s2}`\n }\n return\n }\n\n // No collection: allow any two segments\n if (segments.length !== 2) {\n throw new Error(\n `Resource path must contain exactly two segments when no collection is present. Received: \"${cleaned}\"`\n )\n }\n // Check for collision if this is a root entity (singleton case)\n if (this.isRoot) {\n const collision = this.api.exposes.find((e) => e.isRoot && e.key !== this.key && e.resourcePath === cleaned)\n if (collision) {\n throw new Error(`Resource path \"${cleaned}\" is already in use by another root entity.`)\n }\n }\n\n if (this.resourcePath !== cleaned) {\n this.resourcePath = `/${segments[0]}/${segments[1]}`\n }\n }\n\n /**\n * Computes the absolute path for this exposure's resource endpoint by\n * walking up the exposure tree using `parent.key` until reaching a root exposure.\n * The absolute path is composed by concatenating each ancestor's resource path\n * with this exposure's resource path.\n */\n getAbsoluteResourcePath(): string {\n let absolute = ensureLeadingSlash(this.resourcePath)\n // Traverse parents, always joining with the parent's resource path\n let parentKey = this.parent?.key\n while (parentKey) {\n const parent = this.api.exposes.find((e) => e.key === parentKey)\n if (!parent) break\n const parentResource = ensureLeadingSlash(parent.resourcePath)\n absolute = joinPaths(parentResource, absolute)\n parentKey = parent.parent?.key\n }\n return absolute\n }\n\n /**\n * Computes the absolute path for this exposure's collection endpoint (if any)\n * by walking up the exposure tree using `parent.key` until reaching a root exposure.\n * The absolute path is composed by concatenating each ancestor's resource path\n * with this exposure's collection path.\n * Returns undefined if this exposure has no collection.\n */\n getAbsoluteCollectionPath(): string | undefined {\n if (!this.hasCollection || !this.collectionPath) return undefined\n let absolute = ensureLeadingSlash(this.collectionPath)\n // Traverse parents, always joining with the parent's resource path\n let parentKey = this.parent?.key\n while (parentKey) {\n const parent = this.api.exposes.find((e) => e.key === parentKey)\n if (!parent) break\n const parentResource = ensureLeadingSlash(parent.resourcePath)\n absolute = joinPaths(parentResource, absolute)\n parentKey = parent.parent?.key\n }\n return absolute\n }\n}\n"]}
1
+ {"version":3,"file":"ExposedEntity.js","sourceRoot":"","sources":["../../../src/modeling/ExposedEntity.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,iBAAiB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C,OAAO,OAAO,EAAE,CAAC;gBACf,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;oBACzB,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;gBAC3C,CAAC;gBACD,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;YACjF,CAAC;YACD,OAAO,KAAK,CAAA;QACd,CAAC;;;SAzZU,aAAa","sourcesContent":["import { observed } from '../decorators/observed.js'\nimport { ExposedEntityKind } from '../models/kinds.js'\nimport { nanoid } from '../nanoid.js'\nimport { Action } from './actions/Action.js'\nimport { restoreAction } from './actions/index.js'\nimport type { ApiModel } from './ApiModel.js'\nimport { ensureLeadingSlash, joinPaths } from './helpers/endpointHelpers.js'\nimport { AccessRule } from './rules/AccessRule.js'\nimport { type RateLimitRule, restoreAccessRule } from './rules/index.js'\nimport { RateLimitingConfiguration } from './rules/RateLimitingConfiguration.js'\nimport type { AssociationTarget, ExposeOptions, ExposeParentRef, ExposedEntitySchema } from './types.js'\n\n/**\n * A class that specializes in representing an exposed Data Entity within an API Model.\n *\n * ## Design Note\n * This class enforces strict path constraints (e.g., single-segment collection paths like `/users`,\n * two-segment resource paths like `/users/{id}`).\n * This is an intentional design choice to support a UI paradigm for non-technical users, ensuring that\n * path segments are configured individually at each level of the exposure hierarchy.\n *\n * Flexibility is achieved by chaining exposed entities (parent/child relationships), where the final\n * absolute path is composed of all ancestral paths. See `getAbsoluteResourcePath()` and `getAbsoluteCollectionPath()`.\n *\n * @fires change - Emitted when the exposed entity has changed.\n */\nexport class ExposedEntity extends EventTarget {\n /**\n * The exposed entity kind recognizable by the ecosystem.\n */\n kind: typeof ExposedEntityKind\n\n /**\n * The unique key of the exposed entity.\n * This is a stable identifier that does not change across versions.\n */\n key: string\n\n /**\n * A pointer to a Data Entity from the Data Domain.\n */\n @observed() accessor entity: AssociationTarget\n\n /**\n * Indicates whether this exposure has a collection endpoint.\n * A collection endpoint is optional for nested exposures where the association is 1:1\n * and the schema is embedded directly under the parent resource.\n *\n * Note that this property is not observed for changes as it is immutable after creation.\n */\n hasCollection: boolean\n\n /**\n * Path to the collection endpoint for this exposure.\n * Starts with '/'. Not set for 1:1 nested exposures where collection does not exist.\n */\n @observed() accessor collectionPath: string | undefined\n\n /**\n * Path to the resource endpoint for this exposure.\n * Starts with '/'. For 1:1 nested exposures the resource path typically does not include an id segment.\n */\n @observed() accessor resourcePath: string\n\n /**\n * Whether this exposure is a root exposure (top-level collection).\n * If this is set then the `parent` reference must be populated.\n *\n * Note that this property is not observed for changes as it is immutable after creation.\n */\n isRoot?: boolean\n\n /**\n * Parent reference when this exposure was created via following an association.\n *\n * Note that this property is not observed for changes as it is immutable after creation.\n */\n parent?: ExposeParentRef\n\n /**\n * Expose-time config used to create this exposure (persisted for auditing/UI).\n * This is only populated for the root exposure. All children exposures inherit this config.\n *\n * Note that this property is not observed for changes as it is immutable after creation.\n */\n exposeOptions?: ExposeOptions\n\n /**\n * The list of enabled API actions for this exposure (List/Read/Create/etc.)\n */\n @observed({ deep: true }) accessor actions: Action[]\n\n /**\n * Optional array of access rules that define the access control policies for this exposure.\n */\n @observed({ deep: true }) accessor accessRule: AccessRule[] | undefined\n\n /**\n * Optional configuration for rate limiting for this exposure.\n */\n @observed() accessor rateLimiting: RateLimitingConfiguration | undefined\n\n /**\n * When true, generation for this exposure hit configured limits\n *\n * Note that this property is not observed for changes as it is immutable after creation.\n */\n truncated?: boolean\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 * When the initializing flag is set to true,\n * the domain is not notified of changes.\n */\n #initializing = true\n /**\n * A reference to the parent API Model instance.\n */\n api: ApiModel\n\n static createSchema(input: Partial<ExposedEntitySchema> = {}): ExposedEntitySchema {\n const {\n key = nanoid(),\n entity = { key: '' },\n collectionPath,\n resourcePath = '/',\n hasCollection = true,\n isRoot,\n parent,\n exposeOptions,\n actions = [],\n accessRule,\n rateLimiting,\n truncated,\n } = input\n const result: ExposedEntitySchema = {\n kind: ExposedEntityKind,\n key,\n entity: { ...entity },\n hasCollection,\n resourcePath,\n actions: actions.map((a) => ({ ...a })),\n }\n if (collectionPath !== undefined) {\n result.collectionPath = collectionPath\n }\n if (isRoot !== undefined) {\n result.isRoot = isRoot\n }\n if (parent !== undefined) {\n result.parent = { ...parent }\n }\n if (exposeOptions !== undefined) {\n result.exposeOptions = { ...exposeOptions }\n }\n if (Array.isArray(accessRule)) {\n result.accessRule = accessRule.map((ar) => ({ ...ar }))\n }\n if (rateLimiting !== undefined) {\n result.rateLimiting = { ...rateLimiting }\n }\n if (truncated !== undefined) {\n result.truncated = truncated\n }\n return result\n }\n\n constructor(model: ApiModel, state?: Partial<ExposedEntitySchema>) {\n super()\n this.api = model\n const init = ExposedEntity.createSchema(state)\n this.kind = init.kind\n this.key = init.key\n this.entity = init.entity\n this.hasCollection = init.hasCollection\n this.collectionPath = init.collectionPath\n this.resourcePath = init.resourcePath\n this.isRoot = init.isRoot\n this.parent = init.parent\n this.exposeOptions = init.exposeOptions\n this.actions = init.actions ? init.actions.map((a) => restoreAction(this, a)) : []\n this.accessRule = init.accessRule ? init.accessRule.map((ar) => restoreAccessRule(ar)) : []\n this.rateLimiting = init.rateLimiting ? new RateLimitingConfiguration(init.rateLimiting) : undefined\n this.truncated = init.truncated\n this.#initializing = false\n }\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 toJSON(): ExposedEntitySchema {\n const result: ExposedEntitySchema = {\n kind: this.kind,\n key: this.key,\n entity: { ...this.entity },\n resourcePath: this.resourcePath,\n actions: this.actions.map((a) => a.toJSON()),\n hasCollection: this.hasCollection,\n }\n if (this.collectionPath !== undefined) {\n result.collectionPath = this.collectionPath\n }\n if (this.isRoot !== undefined) {\n result.isRoot = this.isRoot\n }\n if (this.parent !== undefined) {\n result.parent = { ...this.parent }\n }\n if (this.exposeOptions !== undefined) {\n result.exposeOptions = { ...this.exposeOptions }\n }\n if (Array.isArray(this.accessRule) && this.accessRule.length > 0) {\n result.accessRule = this.accessRule.map((ar) => ar.toJSON())\n }\n if (this.rateLimiting !== undefined) {\n result.rateLimiting = this.rateLimiting.toJSON()\n }\n if (this.truncated !== undefined) {\n result.truncated = this.truncated\n }\n return result\n }\n\n /**\n * Sets a new collection path for this exposed entity.\n *\n * It:\n * - updates the collectionPath property\n * - updates the absoluteCollectionPath property accordingly\n * - updates the resourcePath accordingly.\n * @param path The new path to set.\n */\n setCollectionPath(path: string) {\n if (!this.hasCollection) {\n throw new Error(`Cannot set collection path on an exposure that does not have a collection`)\n }\n const cleaned = ensureLeadingSlash(path)\n // Ensure exactly one non-empty segment\n const segments = cleaned.split('/').filter(Boolean)\n if (segments.length !== 1) {\n throw new Error(`Collection path must contain exactly one segment. Received: \"${path}\"`)\n }\n const normalizedCollection = `/${segments[0]}`\n\n // Check for collision if this is a root entity\n if (this.isRoot) {\n const collision = this.api.findCollectionPathCollision(normalizedCollection, this.key)\n if (collision) {\n throw new Error(`Collection path \"${normalizedCollection}\" is already in use by another root entity.`)\n }\n }\n\n // Preserve current parameter name if present, otherwise default to {id}\n let param = '{id}'\n if (this.resourcePath) {\n const curSegments = this.resourcePath.split('/').filter(Boolean)\n const maybeParam = curSegments[1]\n if (maybeParam && /^\\{[A-Za-z_][A-Za-z0-9_]*\\}$/.test(maybeParam)) {\n param = maybeParam\n }\n }\n const nextResource = `${normalizedCollection}/${param}`\n this.collectionPath = normalizedCollection\n this.resourcePath = nextResource\n // rely on ApiModel.exposes deep observation to notify on property sets\n }\n\n /**\n * Sets a new resource path for this exposed entity.\n *\n * Rules:\n * - Must start with '/'.\n * - If this exposure has a collection, the path must be exactly the collection path plus a single\n * parameter segment (e.g. `/products/{productId}`) and only the parameter name may vary.\n * - If this exposure does NOT have a collection, the path can be any two segments (e.g. `/profile/{id}` or `/a/b`).\n */\n setResourcePath(path: string) {\n const cleaned = ensureLeadingSlash(path)\n const segments = cleaned.split('/').filter(Boolean)\n\n if (this.hasCollection) {\n if (!this.collectionPath) {\n throw new Error('Cannot set resource path: missing collection path for this exposure')\n }\n const colSegments = this.collectionPath.split('/').filter(Boolean)\n if (colSegments.length !== 1) {\n throw new Error(`Invalid stored collection path \"${this.collectionPath}\"`)\n }\n if (segments.length !== 2) {\n throw new Error(`Resource path must be exactly two segments (collection + parameter). Received: \"${cleaned}\"`)\n }\n const [s1, s2] = segments\n if (s1 !== colSegments[0]) {\n throw new Error(`Resource path must start with the collection segment \"${colSegments[0]}\". Received: \"${s1}\"`)\n }\n // s2 must be a parameter segment {name}\n if (!/^\\{[A-Za-z_][A-Za-z0-9_]*\\}$/.test(s2)) {\n throw new Error(`The second segment must be a parameter in braces, e.g. {id}. Received: \"${s2}\"`)\n }\n if (this.resourcePath !== cleaned) {\n this.resourcePath = `/${s1}/${s2}`\n }\n return\n }\n\n // No collection: allow any two segments\n if (segments.length !== 2) {\n throw new Error(\n `Resource path must contain exactly two segments when no collection is present. Received: \"${cleaned}\"`\n )\n }\n // Check for collision if this is a root entity (singleton case)\n if (this.isRoot) {\n const collision = this.api.findResourcePathCollision(cleaned, this.key)\n if (collision) {\n throw new Error(`Resource path \"${cleaned}\" is already in use by another root entity.`)\n }\n }\n\n if (this.resourcePath !== cleaned) {\n this.resourcePath = `/${segments[0]}/${segments[1]}`\n }\n }\n\n /**\n * Computes the absolute path for this exposure's resource endpoint by\n * walking up the exposure tree using `parent.key` until reaching a root exposure.\n * The absolute path is composed by concatenating each ancestor's resource path\n * with this exposure's resource path.\n */\n getAbsoluteResourcePath(): string {\n let absolute = ensureLeadingSlash(this.resourcePath)\n // Traverse parents, always joining with the parent's resource path\n let parentKey = this.parent?.key\n while (parentKey) {\n const parent = this.api.exposes.get(parentKey)\n if (!parent) break\n const parentResource = ensureLeadingSlash(parent.resourcePath)\n absolute = joinPaths(parentResource, absolute)\n parentKey = parent.parent?.key\n }\n return absolute\n }\n\n /**\n * Computes the absolute path for this exposure's collection endpoint (if any)\n * by walking up the exposure tree using `parent.key` until reaching a root exposure.\n * The absolute path is composed by concatenating each ancestor's resource path\n * with this exposure's collection path.\n * Returns undefined if this exposure has no collection.\n */\n getAbsoluteCollectionPath(): string | undefined {\n if (!this.hasCollection || !this.collectionPath) return undefined\n let absolute = ensureLeadingSlash(this.collectionPath)\n // Traverse parents, always joining with the parent's resource path\n let parentKey = this.parent?.key\n while (parentKey) {\n const parent = this.api.exposes.get(parentKey)\n if (!parent) break\n const parentResource = ensureLeadingSlash(parent.resourcePath)\n absolute = joinPaths(parentResource, absolute)\n parentKey = parent.parent?.key\n }\n return absolute\n }\n\n /**\n * Returns all access rules for this exposure, including the ones from all the parents up to the API.\n */\n getAllRules(): AccessRule[] {\n const rules: AccessRule[] = []\n this.api.accessRule.forEach((rule) => rules.push(rule))\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let current: ExposedEntity | undefined = this\n while (current) {\n if (current.accessRule) {\n rules.push(...current.accessRule)\n }\n current = current.parent ? this.api.exposes.get(current.parent.key) : undefined\n }\n return rules\n }\n\n /**\n * Returns all rate limiters for this exposure, including the ones from all the parents up to the API.\n */\n getAllRateLimiters(): RateLimitingConfiguration[] {\n const rateLimiters: RateLimitingConfiguration[] = []\n if (this.api.rateLimiting) {\n rateLimiters.push(this.api.rateLimiting)\n }\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let current: ExposedEntity | undefined = this\n while (current) {\n if (current.rateLimiting) {\n rateLimiters.push(current.rateLimiting)\n }\n current = current.parent ? this.api.exposes.get(current.parent.key) : undefined\n }\n return rateLimiters\n }\n\n /**\n * Returns all rate limiter rules for this exposure, including the ones from all the parents up to the API.\n * Similar to the getAllRules() method, but it flattens the rate limiters into a single list of rules.\n */\n getAllRateLimiterRules(): RateLimitRule[] {\n const rules: RateLimitRule[] = []\n if (this.api.rateLimiting) {\n rules.push(...this.api.rateLimiting.rules)\n }\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let current: ExposedEntity | undefined = this\n while (current) {\n if (current.rateLimiting) {\n rules.push(...current.rateLimiting.rules)\n }\n current = current.parent ? this.api.exposes.get(current.parent.key) : undefined\n }\n return rules\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { AccessRule, AccessRuleSchema } from '../rules/AccessRule.js';
2
2
  import { RateLimitingConfiguration, RateLimitingConfigurationSchema } from '../rules/RateLimitingConfiguration.js';
3
+ import type { ExposedEntity } from '../ExposedEntity.js';
3
4
  /**
4
5
  * A base interface for common properties across all actions.
5
6
  */
@@ -34,8 +35,17 @@ export declare class Action extends EventTarget implements ActionSchema {
34
35
  accessor kind: string;
35
36
  accessor accessRule: AccessRule[];
36
37
  accessor rateLimiting: RateLimitingConfiguration | undefined;
37
- constructor(state?: Partial<ActionSchema>);
38
+ protected parent: ExposedEntity;
39
+ constructor(parent: ExposedEntity, state?: Partial<ActionSchema>);
38
40
  notifyChange(): void;
39
41
  toJSON(): ActionSchema;
42
+ /**
43
+ * Returns all access rules for this action, including the ones from all the parents up to the API.
44
+ */
45
+ getAllRules(): AccessRule[];
46
+ /**
47
+ * Returns all rate limiters for this action, including the ones from all the parents up to the API.
48
+ */
49
+ getAllRateLimiters(): RateLimitingConfiguration[];
40
50
  }
41
51
  //# sourceMappingURL=Action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/Action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACrE,OAAO,EAAE,yBAAyB,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAA;AAIlH;;GAEG;AACH,MAAM,WA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