@api-client/core 0.18.0 → 0.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"ApiModel.js","sourceRoot":"","sources":["../../../src/modeling/ApiModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAe,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAWvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAoD,MAAM,qBAAqB,CAAA;AAgEtG,MAAM,OAAO,QAAS,SAAQ,cAAc;IAC1C;;OAEG;IACH,IAAI,CAAqB;IACzB;;;OAGG;IACH,GAAG,CAAQ;IAEX;;OAEG;IACH,IAAI,CAAO;IACX;;;;;OAKG;IACH,OAAO,CAAS;IAEhB;;;OAGG;IACH,cAAc,CAA8B;IAE5C;;;OAGG;IACH,aAAa,CAA6B;IAE1C;;;OAGG;IACH,OAAO,CAAuB;IAC9B;;;OAGG;IACH,OAAO,CAAiB;IACxB;;;;;;;OAOG;IACH,UAAU,CAAe;IACzB;;;OAGG;IACH,YAAY,CAA4B;IAExC;;;OAGG;IACH,aAAa,GAAG,IAAI,CAAA;IAEpB;;;;;OAKG;IACH,UAAU,GAAG,KAAK,CAAA;IAElB;;;;;;;OAOG;IACH,IAAI,MAAM;QACR,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrC,OAAO,SAAS,CAAA;QAClB,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAA;QACrC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC1C,CAAC;IAED,MAAM,C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AAK,CAAC,OAAO,GAAG,EAAE,CAAA;QACpB,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,gBAAgB,CAAC,MAAkB;QACjC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,wFAAwF,CAAC,CAAA;QAC3G,CAAC;QACD,IAAI,CAAC,oBAAoB,EAAE,CAAA;QAC3B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;QACzC,IAAI,CAAC,cAAc,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;QACzE,IAAI,CAAC,YAAY,EAAE,CAAA;IACrB,CAAC;CACF","sourcesContent":["import { nanoid } from '../nanoid.js'\nimport { ApiModelKind, DataDomainKind } from '../models/kinds.js'\nimport { type IThing, Thing } from '../models/Thing.js'\nimport type {\n AccessRule,\n AuthenticationConfiguration,\n AuthorizationConfiguration,\n ExposedEntity,\n RateLimitingConfiguration,\n RolesBasedAccessControl,\n SessionConfiguration,\n UsernamePasswordConfiguration,\n} from './types.js'\nimport { DataDomain } from './DataDomain.js'\nimport { DependentModel, type DomainDependency, type DependentModelSchema } from './DependentModel.js'\n\nexport interface ApiModelSchema extends DependentModelSchema {\n /**\n * The data domain kind recognizable by the ecosystem.\n */\n kind: typeof ApiModelKind\n /**\n * The unique key of the data domain schema.\n * This is a stable identifier that does not change across versions.\n */\n key: string\n /**\n * Contains the name, display name, description, and the version of the data domain schema.\n */\n info: IThing\n\n /**\n * The designated Data Entity that represents a \"User\".\n * This entity must be marked with the \"User\" semantic in the Data Modeler.\n *\n * This property is required to publish the API.\n */\n userKey?: string\n\n /**\n * Configuration for how users prove their identity.\n * The API model is invalid if this is not set.\n */\n authentication?: AuthenticationConfiguration\n\n /**\n * Configuration for what authenticated users are allowed to do.\n * The API model is invalid if this is not set.\n */\n authorization?: AuthorizationConfiguration\n\n /**\n * Configuration for the transport and payload of the user session.\n * The API model is invalid if this is not set.\n */\n session?: SessionConfiguration\n /**\n * The specific subset of Data Entities to be exposed by this API.\n * These are the entities that are included in the data domain schema.\n */\n exposes: ExposedEntity[]\n\n /**\n * Optional array of access rules that define the access control policies\n * for the API. These rules are used to enforce security and permissions\n * on the exposed entities.\n *\n * These rules apply to all exposed entities and actions. An API action\n * can declare its own access rules, which will override these.\n */\n accessRule?: AccessRule[]\n /**\n * Optional configuration for API-wide rate limiting and throttling.\n * Defines rules to protect the API from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\n}\n\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 userKey?: string\n\n /**\n * Configuration for how users prove their identity.\n * The API model is invalid if this is not set.\n */\n authentication?: AuthenticationConfiguration\n\n /**\n * Configuration for what authenticated users are allowed to do.\n * The API model is invalid if this is not set.\n */\n authorization?: AuthorizationConfiguration\n\n /**\n * Configuration for the transport and payload of the user session.\n * The API model is invalid if this is not set.\n */\n session?: SessionConfiguration\n /**\n * The specific subset of Data Entities to be exposed by this API.\n * These are the entities that are included in the data domain schema.\n */\n exposes: ExposedEntity[]\n /**\n * Optional array of access rules that define the access control policies\n * for the API. These rules are used to enforce security and permissions\n * on the exposed entities.\n *\n * These rules apply to all exposed entities and actions. An API action\n * can declare its own access rules, which will override these.\n */\n accessRule?: AccessRule[]\n /**\n * Optional configuration for API-wide rate limiting and throttling.\n * Defines rules to protect the API from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\n\n /**\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.userKey) {\n result.userKey = input.userKey\n }\n if (input.dependencyList) {\n result.dependencyList = structuredClone(input.dependencyList)\n }\n if (input.authentication) {\n result.authentication = input.authentication\n }\n if (input.authorization) {\n result.authorization = input.authorization\n }\n if (input.session) {\n result.session = input.session\n }\n if (input.accessRule) {\n result.accessRule = input.accessRule\n }\n if (input.rateLimiting) {\n result.rateLimiting = input.rateLimiting\n }\n return result\n }\n\n constructor(state?: Partial<ApiModelSchema>, domain?: DomainDependency) {\n const init = ApiModel.createSchema(state)\n const instances: DataDomain[] = []\n if (domain instanceof DataDomain) {\n instances.push(domain)\n } else if (typeof domain === 'object' && domain.kind === DataDomainKind) {\n instances.push(new DataDomain(domain))\n } else if (domain) {\n throw new Error(`Invalid domain provided. Expected a DataDomain instance or schema.`)\n }\n super(init.dependencyList, instances)\n this.kind = init.kind\n this.key = init.key\n this.info = new Thing(init.info)\n this.userKey = init.userKey\n if (init.authentication) {\n this.authentication = structuredClone(init.authentication)\n }\n if (init.authorization) {\n this.authorization = structuredClone(init.authorization)\n }\n if (init.session) {\n this.session = structuredClone(init.session)\n }\n if (Array.isArray(init.exposes)) {\n this.exposes = structuredClone(init.exposes)\n } else {\n this.exposes = []\n }\n if (init.accessRule) {\n this.accessRule = structuredClone(init.accessRule)\n }\n if (init.rateLimiting) {\n this.rateLimiting = structuredClone(init.rateLimiting)\n }\n this.#initializing = false\n this.info.addEventListener('change', () => {\n this.notifyChange()\n })\n }\n\n toJSON(): ApiModelSchema {\n const result: ApiModelSchema = {\n kind: this.kind,\n key: this.key,\n info: this.info.toJSON(),\n exposes: structuredClone(this.exposes),\n }\n if (this.userKey) {\n result.userKey = this.userKey\n }\n if (this.dependencyList.length > 0) {\n result.dependencyList = structuredClone(this.dependencyList)\n }\n if (this.authentication) {\n result.authentication = structuredClone(this.authentication)\n }\n if (this.authorization) {\n result.authorization = structuredClone(this.authorization)\n }\n if (this.session) {\n result.session = structuredClone(this.session)\n }\n if (this.accessRule) {\n result.accessRule = structuredClone(this.accessRule)\n }\n if (this.rateLimiting) {\n result.rateLimiting = structuredClone(this.rateLimiting)\n }\n return result\n }\n\n /**\n * This function is used internally by all domain elements to notify that something has changed.\n * Since we want to notify listeners after the operation commits, we use microtask\n * to ensure that the event is dispatched after the current operation.\n */\n notifyChange() {\n if (this.#notifying || this.#initializing) {\n return\n }\n this.#notifying = true\n queueMicrotask(() => {\n this.#notifying = false\n const event = new Event('change')\n this.dispatchEvent(event)\n })\n }\n\n /**\n * Exposes a new entity in the API model.\n * If the entity already exists, it returns the existing one.\n * @param entityKey The key of the entity to expose.\n * @returns The exposed entity.\n */\n exposeEntity(entityKey: string): ExposedEntity {\n const existing = this.exposes.find((e) => e.key === entityKey)\n if (existing) {\n return existing\n }\n const newEntity: ExposedEntity = {\n key: entityKey,\n actions: [],\n }\n this.exposes.push(newEntity)\n this.notifyChange()\n return newEntity\n }\n\n /**\n * Removes an entity from the API model.\n * @param entityKey The key of the entity to remove.\n */\n removeEntity(entityKey: string): void {\n const index = this.exposes.findIndex((e) => e.key === entityKey)\n if (index !== -1) {\n this.exposes.splice(index, 1)\n this.notifyChange()\n }\n }\n /**\n * Returns the exposed entity by its key.\n * @param entityKey The key of the entity to find.\n * @returns The exposed entity or undefined if not found.\n */\n getExposedEntity(entityKey: string): ExposedEntity | undefined {\n return this.exposes.find((e) => e.key === entityKey)\n }\n\n /**\n * Clears the API model for a new entity change.\n * This method resets the dependencies, exposes, userKey,\n * authentication, authorization, and session properties.\n */\n cleanForEntityChange(): void {\n this.dependencies.clear()\n this.dependencyList = []\n this.exposes = []\n this.userKey = undefined\n if (this.session) {\n this.session.properties = []\n }\n if (this.authentication && this.authentication.strategy === 'UsernamePassword') {\n const typed = this.authentication as UsernamePasswordConfiguration\n typed.passwordKey = undefined\n }\n if (this.authorization && this.authorization.strategy == 'RBAC') {\n const typed = this.authorization as RolesBasedAccessControl\n typed.roleKey = ''\n }\n }\n\n /**\n * Attaches a DataDomain to this API model.\n * This method clears any existing dependencies and sets the new domain.\n *\n * @param domain The DataDomain to attach to this API model.\n * @throws Error if the domain does not have a version set in its info.\n */\n attachDataDomain(domain: DataDomain): void {\n if (!domain.info.version) {\n throw new Error(`Cannot attach DataDomain without a version. Please set the version in the domain info.`)\n }\n this.cleanForEntityChange()\n this.dependencies.set(domain.key, domain)\n this.dependencyList = [{ key: domain.key, version: domain.info.version }]\n this.notifyChange()\n }\n}\n"]}
1
+ {"version":3,"file":"ApiModel.js","sourceRoot":"","sources":["../../../src/modeling/ApiModel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAe,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAWvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAoD,MAAM,qBAAqB,CAAA;AACtG,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;IA4GlC,QAAQ;sBAAS,cAAc;;;;;;;;;;iBAA/B,QAAS,SAAQ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ACpB,CAAC;QACH,CAAC;QAED;;;;;;WAMG;QACH,gBAAgB,CAAC,MAAkB;YACjC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CAAC,wFAAwF,CAAC,CAAA;YAC3G,CAAC;YACD,IAAI,CAAC,oBAAoB,EAAE,CAAA;YAC3B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;YACzC,IAAI,CAAC,cAAc,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;YACzE,IAAI,CAAC,YAAY,EAAE,CAAA;QACrB,CAAC;;;SAzUU,QAAQ","sourcesContent":["import { nanoid } from '../nanoid.js'\nimport { ApiModelKind, DataDomainKind } from '../models/kinds.js'\nimport { type IThing, Thing } from '../models/Thing.js'\nimport type {\n AccessRule,\n AuthenticationConfiguration,\n AuthorizationConfiguration,\n ExposedEntity,\n RateLimitingConfiguration,\n RolesBasedAccessControl,\n SessionConfiguration,\n UsernamePasswordConfiguration,\n} from './types.js'\nimport { DataDomain } from './DataDomain.js'\nimport { DependentModel, type DependentModelSchema, type DomainDependency } from './DependentModel.js'\nimport { observed, toRaw } from './observed.js'\n\n/**\n * Contact information for the exposed API.\n */\nexport interface ApiContact {\n /**\n * The identifying name of the contact person/organization.\n */\n name?: string\n /**\n * The URL pointing to the contact information. MUST be in the format of a URL.\n */\n url?: string\n /**\n * The email address of the contact person/organization. MUST be in the format of an email address.\n */\n email?: string\n}\n\n/**\n * License information for the exposed API.\n */\nexport interface ApiLicense {\n /**\n * The license name used for the API. It is recommended to be an SPDX license identifier.\n */\n name: string\n /**\n * A URL to the license used for the API. MUST be in the format of a URL.\n */\n url?: string\n}\n\nexport interface ApiModelSchema extends DependentModelSchema {\n /**\n * The data domain kind recognizable by the ecosystem.\n */\n kind: typeof ApiModelKind\n /**\n * The unique key of the data domain schema.\n * This is a stable identifier that does not change across versions.\n */\n key: string\n /**\n * Contains the name, display name, description, and the version of the data domain schema.\n */\n info: IThing\n\n /**\n * The designated Data Entity that represents a \"User\".\n * This entity must be marked with the \"User\" semantic in the Data Modeler.\n *\n * This property is required to publish the API.\n */\n userKey?: string\n\n /**\n * Configuration for how users prove their identity.\n * The API model is invalid if this is not set.\n */\n authentication?: AuthenticationConfiguration\n\n /**\n * Configuration for what authenticated users are allowed to do.\n * The API model is invalid if this is not set.\n */\n authorization?: AuthorizationConfiguration\n\n /**\n * Configuration for the transport and payload of the user session.\n * The API model is invalid if this is not set.\n */\n session?: SessionConfiguration\n /**\n * The specific subset of Data Entities to be exposed by this API.\n * These are the entities that are included in the data domain schema.\n */\n exposes: ExposedEntity[]\n\n /**\n * Optional array of access rules that define the access control policies\n * for the API. These rules are used to enforce security and permissions\n * on the exposed entities.\n *\n * These rules apply to all exposed entities and actions. An API action\n * can declare its own access rules, which will override these.\n */\n accessRule?: AccessRule[]\n /**\n * Optional configuration for API-wide rate limiting and throttling.\n * Defines rules to protect the API from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\n /**\n * A URL to the Terms of Service for the API.\n */\n termsOfService?: string\n /**\n * The contact information for the exposed API.\n */\n contact?: ApiContact\n /**\n * The license information for the API.\n */\n license?: ApiLicense\n}\n\nexport class ApiModel extends DependentModel {\n /**\n * The data domain kind recognizable by the ecosystem.\n */\n kind: typeof ApiModelKind\n /**\n * The unique key of the data domain schema.\n * This is a stable identifier that does not change across versions.\n */\n key: string\n\n /**\n * The description of the domain property.\n */\n info: Thing\n /**\n * The designated Data Entity that represents a \"User\".\n * This entity must be marked with the \"User\" semantic in the Data Modeler.\n *\n * This property is required to publish the API.\n */\n userKey?: string\n\n /**\n * Configuration for how users prove their identity.\n * The API model is invalid if this is not set.\n */\n authentication?: AuthenticationConfiguration\n\n /**\n * Configuration for what authenticated users are allowed to do.\n * The API model is invalid if this is not set.\n */\n authorization?: AuthorizationConfiguration\n\n /**\n * Configuration for the transport and payload of the user session.\n * The API model is invalid if this is not set.\n */\n session?: SessionConfiguration\n /**\n * The specific subset of Data Entities to be exposed by this API.\n * These are the entities that are included in the data domain schema.\n */\n exposes: ExposedEntity[]\n /**\n * Optional array of access rules that define the access control policies\n * for the API. These rules are used to enforce security and permissions\n * on the exposed entities.\n *\n * These rules apply to all exposed entities and actions. An API action\n * can declare its own access rules, which will override these.\n */\n accessRule?: AccessRule[]\n /**\n * Optional configuration for API-wide rate limiting and throttling.\n * Defines rules to protect the API from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\n /**\n * A URL to the Terms of Service for the API.\n */\n @observed() accessor termsOfService: string | undefined\n /**\n * The contact information for the exposed API.\n */\n @observed({ deep: true }) accessor contact: ApiContact | undefined\n /**\n * The license information for the API.\n */\n @observed({ deep: true }) accessor license: ApiLicense | undefined\n\n /**\n * When the initializing flag is set to true,\n * the domain is not notified of changes.\n */\n #initializing = true\n\n /**\n * When the notifying flag is set to true,\n * the domain is pending a notification.\n * No other notifications will be sent until\n * the current notification is sent.\n */\n #notifying = false\n\n /**\n * A convenience getter that returns the DataDomain associated with this API model.\n * Since the API model can have only one DataDomain,\n * this getter returns the first dependency in the list.\n *\n * The parent interface `DependentModel` allows for multiple dependencies,\n * to unify the dependency management across different models.\n */\n get domain(): DataDomain | undefined {\n if (this.dependencyList.length === 0) {\n return undefined\n }\n const domain = this.dependencyList[0]\n return this.dependencies.get(domain.key)\n }\n\n static createSchema(input: Partial<ApiModelSchema> = {}): ApiModelSchema {\n const { key = nanoid(), exposes = [] } = input\n const info = Thing.fromJSON(input.info, { name: 'Unnamed API' }).toJSON()\n const result: ApiModelSchema = {\n kind: ApiModelKind,\n key,\n info,\n exposes,\n }\n if (input.userKey) {\n result.userKey = input.userKey\n }\n if (input.dependencyList) {\n result.dependencyList = structuredClone(input.dependencyList)\n }\n if (input.authentication) {\n result.authentication = input.authentication\n }\n if (input.authorization) {\n result.authorization = input.authorization\n }\n if (input.session) {\n result.session = input.session\n }\n if (input.accessRule) {\n result.accessRule = input.accessRule\n }\n if (input.rateLimiting) {\n result.rateLimiting = input.rateLimiting\n }\n if (input.termsOfService) {\n result.termsOfService = input.termsOfService\n }\n if (input.contact) {\n result.contact = structuredClone(input.contact)\n }\n if (input.license) {\n result.license = structuredClone(input.license)\n }\n return result\n }\n\n constructor(state?: Partial<ApiModelSchema>, domain?: DomainDependency) {\n const init = ApiModel.createSchema(state)\n const instances: DataDomain[] = []\n if (domain instanceof DataDomain) {\n instances.push(domain)\n } else if (typeof domain === 'object' && domain.kind === DataDomainKind) {\n instances.push(new DataDomain(domain))\n } else if (domain) {\n throw new Error(`Invalid domain provided. Expected a DataDomain instance or schema.`)\n }\n super(init.dependencyList, instances)\n this.kind = init.kind\n this.key = init.key\n this.info = new Thing(init.info)\n this.userKey = init.userKey\n if (init.authentication) {\n this.authentication = structuredClone(init.authentication)\n }\n if (init.authorization) {\n this.authorization = structuredClone(init.authorization)\n }\n if (init.session) {\n this.session = structuredClone(init.session)\n }\n if (Array.isArray(init.exposes)) {\n this.exposes = structuredClone(init.exposes)\n } else {\n this.exposes = []\n }\n if (init.accessRule) {\n this.accessRule = structuredClone(init.accessRule)\n }\n if (init.rateLimiting) {\n this.rateLimiting = structuredClone(init.rateLimiting)\n }\n if (init.termsOfService) {\n this.termsOfService = init.termsOfService\n }\n if (init.contact) {\n this.contact = init.contact\n }\n if (init.license) {\n this.license = init.license\n }\n this.#initializing = false\n this.info.addEventListener('change', () => {\n this.notifyChange()\n })\n }\n\n toJSON(): ApiModelSchema {\n const result: ApiModelSchema = {\n kind: this.kind,\n key: this.key,\n info: this.info.toJSON(),\n exposes: structuredClone(this.exposes),\n }\n if (this.userKey) {\n result.userKey = this.userKey\n }\n if (this.dependencyList.length > 0) {\n result.dependencyList = structuredClone(this.dependencyList)\n }\n if (this.authentication) {\n result.authentication = structuredClone(this.authentication)\n }\n if (this.authorization) {\n result.authorization = structuredClone(this.authorization)\n }\n if (this.session) {\n result.session = structuredClone(this.session)\n }\n if (this.accessRule) {\n result.accessRule = structuredClone(this.accessRule)\n }\n if (this.rateLimiting) {\n result.rateLimiting = structuredClone(this.rateLimiting)\n }\n if (this.termsOfService) {\n result.termsOfService = this.termsOfService\n }\n if (this.contact) {\n result.contact = structuredClone(toRaw(this, this.contact))\n }\n if (this.license) {\n result.license = structuredClone(toRaw(this, this.license))\n }\n return result\n }\n\n /**\n * This function is used internally by all domain elements to notify that something has changed.\n * Since we want to notify listeners after the operation commits, we use microtask\n * to ensure that the event is dispatched after the current operation.\n */\n notifyChange() {\n if (this.#notifying || this.#initializing) {\n return\n }\n this.#notifying = true\n queueMicrotask(() => {\n this.#notifying = false\n const event = new Event('change')\n this.dispatchEvent(event)\n })\n }\n\n /**\n * Exposes a new entity in the API model.\n * If the entity already exists, it returns the existing one.\n * @param entityKey The key of the entity to expose.\n * @returns The exposed entity.\n */\n exposeEntity(entityKey: string): ExposedEntity {\n const existing = this.exposes.find((e) => e.key === entityKey)\n if (existing) {\n return existing\n }\n const newEntity: ExposedEntity = {\n key: entityKey,\n actions: [],\n }\n this.exposes.push(newEntity)\n this.notifyChange()\n return newEntity\n }\n\n /**\n * Removes an entity from the API model.\n * @param entityKey The key of the entity to remove.\n */\n removeEntity(entityKey: string): void {\n const index = this.exposes.findIndex((e) => e.key === entityKey)\n if (index !== -1) {\n this.exposes.splice(index, 1)\n this.notifyChange()\n }\n }\n /**\n * Returns the exposed entity by its key.\n * @param entityKey The key of the entity to find.\n * @returns The exposed entity or undefined if not found.\n */\n getExposedEntity(entityKey: string): ExposedEntity | undefined {\n return this.exposes.find((e) => e.key === entityKey)\n }\n\n /**\n * Clears the API model for a new entity change.\n * This method resets the dependencies, exposes, userKey,\n * authentication, authorization, and session properties.\n */\n cleanForEntityChange(): void {\n this.dependencies.clear()\n this.dependencyList = []\n this.exposes = []\n this.userKey = undefined\n if (this.session) {\n this.session.properties = []\n }\n if (this.authentication && this.authentication.strategy === 'UsernamePassword') {\n const typed = this.authentication as UsernamePasswordConfiguration\n typed.passwordKey = undefined\n }\n if (this.authorization && this.authorization.strategy == 'RBAC') {\n const typed = this.authorization as RolesBasedAccessControl\n typed.roleKey = ''\n }\n }\n\n /**\n * Attaches a DataDomain to this API model.\n * This method clears any existing dependencies and sets the new domain.\n *\n * @param domain The DataDomain to attach to this API model.\n * @throws Error if the domain does not have a version set in its info.\n */\n attachDataDomain(domain: DataDomain): void {\n if (!domain.info.version) {\n throw new Error(`Cannot attach DataDomain without a version. Please set the version in the domain info.`)\n }\n this.cleanForEntityChange()\n this.dependencies.set(domain.key, domain)\n this.dependencyList = [{ key: domain.key, version: domain.info.version }]\n this.notifyChange()\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import type { DataCatalogLifecycle } from './DataCatalogVersion.js';
1
2
  import { DataCatalogKind } from './kinds.js';
2
3
  export type DataCatalogScope = 'public' | 'private' | 'organization';
3
4
  export interface DataCatalogSchema {
@@ -99,6 +100,16 @@ export interface DataCatalogSchema {
99
100
  */
100
101
  tags: string[];
101
102
  }
103
+ export interface DataCatalogSchemaVersion {
104
+ /**
105
+ * The version of the data catalog entry.
106
+ */
107
+ version: string;
108
+ /**
109
+ * The lifecycle of the data catalog version.
110
+ */
111
+ lifecycle: DataCatalogLifecycle;
112
+ }
102
113
  /**
103
114
  * Used with API communication when listing data catalog entries.
104
115
  */
@@ -107,7 +118,7 @@ export interface DataCatalogSchemaWithVersion extends DataCatalogSchema {
107
118
  * The list of published versions of the data catalog entry.
108
119
  * Note, this is limited to the last 20 versions.
109
120
  */
110
- versions: string[];
121
+ versions: DataCatalogSchemaVersion[];
111
122
  }
112
123
  export interface DataCatalogVersionInfo {
113
124
  key: string;
@@ -1 +1 @@
1
- {"version":3,"file":"DataCatalog.d.ts","sourceRoot":"","sources":["../../../src/models/DataCatalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE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,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAA;QACnD,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,aAAa,KAAK,QAAQ,EAAE,CAAC;YAC3C,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAA;QAC3C,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import { DataCatalogKind } from './kinds.js'\n\nexport type DataCatalogScope = 'public' | 'private' | 'organization'\n\nexport interface DataCatalogSchema {\n /**\n * The key of the data catalog entry.\n * When the value is missing it will be generated by the API.\n *\n * The key can only be set when creating a new data catalog entry.\n * @readonly\n */\n key: string\n /**\n * The kind of the schema\n * This is set by the API and is used to identify the schema.\n * @readonly\n */\n readonly kind: typeof DataCatalogKind\n /**\n * The key of the organization.\n * @required\n */\n organization: string\n /**\n * The key of the related data catalog file entry.\n * @required\n */\n file: string\n /**\n * The scope of the data catalog entry.\n * @required\n */\n scope: DataCatalogScope\n /**\n * The name of the data catalog entry.\n * It is required when creating a new data catalog entry.\n * @required\n */\n name: string\n /**\n * A short description of the data catalog entry.\n * @required\n */\n description: string\n /**\n * The id of the user who created the data catalog entry.\n * It is ignored when creating or updating a data catalog entry.\n * @readonly\n */\n publishedBy: string\n /**\n * The time when the last version was published.\n * It is ignored when creating or updating a data catalog entry.\n * @readonly\n */\n publishedAt: number\n /**\n * The time when the data catalog entry was created.\n * It is ignored when creating or updating a data catalog entry.\n * @readonly\n */\n createdAt: number\n /**\n * The time when the data catalog entry was last updated.\n * It is ignored when creating or updating a data catalog entry.\n * @readonly\n */\n updatedAt: number\n /**\n * The timestamp when this entry was unpublished.\n * Only set when the entry was unpublished.\n * @readonly\n */\n unpublishedAt?: number\n /**\n * A flag indicating if the entry is deprecated.\n * @readonly\n */\n deprecated?: boolean\n /**\n * The timestamp when the entry was deprecated.\n * Only set when the entry was deprecated.\n * @readonly\n */\n deprecatedAt?: number\n /**\n * The id of the user who deprecated the entry.\n * Only set when the entry was deprecated.\n * @readonly\n */\n deprecatedBy?: string\n /**\n * The reason why the entry was deprecated.\n * Only set when the entry was deprecated.\n */\n deprecationReason?: string\n /**\n * The list of tags associated with the data catalog entry.\n * @readonly Use the API endpoints to manage tags.\n */\n tags: string[]\n}\n\n/**\n * Used with API communication when listing data catalog entries.\n */\nexport interface DataCatalogSchemaWithVersion extends DataCatalogSchema {\n /**\n * The list of published versions of the data catalog entry.\n * Note, this is limited to the last 20 versions.\n */\n versions: string[]\n}\n\nexport interface DataCatalogVersionInfo {\n key: string\n version: string\n published: number\n}\n\nexport interface DataCatalogStatus extends DataCatalogSchema {\n versions: DataCatalogVersionInfo[]\n}\n\nexport class DataCatalog implements DataCatalogSchema {\n key: string\n\n get kind(): typeof DataCatalogKind {\n return DataCatalogKind\n }\n\n organization: string\n file: string\n scope: DataCatalogScope\n name: string\n description: string\n publishedBy: string\n publishedAt: number\n createdAt: number\n updatedAt: number\n unpublishedAt?: number | undefined\n deprecated?: boolean | undefined\n deprecatedAt?: number | undefined\n deprecatedBy?: string | undefined\n deprecationReason?: string | undefined\n tags: string[]\n\n static createSchema(input: Partial<DataCatalogSchema>): DataCatalogSchema {\n const {\n key = '',\n organization = '',\n file = '',\n scope = 'private',\n name = '',\n description = '',\n publishedBy = '',\n publishedAt = 0,\n createdAt = 0,\n updatedAt = 0,\n tags = [],\n } = input\n if (['public', 'private', 'organization'].indexOf(scope) === -1) {\n throw new Error(`Invalid scope: ${scope}`)\n }\n const result: DataCatalogSchema = {\n key,\n kind: DataCatalogKind,\n organization,\n file,\n scope,\n name,\n description,\n publishedBy,\n publishedAt,\n createdAt,\n updatedAt,\n tags,\n }\n if (typeof input.deprecated === 'boolean') {\n result.deprecated = input.deprecated\n }\n if (typeof input.deprecatedAt === 'number') {\n result.deprecatedAt = input.deprecatedAt\n }\n if (typeof input.deprecatedBy === 'string') {\n result.deprecatedBy = input.deprecatedBy\n }\n if (typeof input.deprecationReason === 'string') {\n result.deprecationReason = input.deprecationReason\n }\n if (typeof input.unpublishedAt === 'number') {\n result.unpublishedAt = input.unpublishedAt\n }\n return result\n }\n\n constructor(input: Partial<DataCatalogSchema> = {}) {\n const init = DataCatalog.createSchema(input)\n this.key = init.key\n this.organization = init.organization\n this.file = init.file\n this.scope = init.scope\n this.name = init.name\n this.description = init.description\n this.publishedBy = init.publishedBy\n this.publishedAt = init.publishedAt\n this.createdAt = init.createdAt\n this.updatedAt = init.updatedAt\n this.tags = init.tags\n if (typeof init.deprecated === 'boolean') {\n this.deprecated = init.deprecated\n }\n if (typeof init.deprecatedAt === 'number') {\n this.deprecatedAt = init.deprecatedAt\n }\n if (typeof init.deprecatedBy === 'string') {\n this.deprecatedBy = init.deprecatedBy\n }\n if (typeof init.deprecationReason === 'string') {\n this.deprecationReason = init.deprecationReason\n }\n if (typeof init.unpublishedAt === 'number') {\n this.unpublishedAt = init.unpublishedAt\n }\n }\n\n toJSON(): DataCatalogSchema {\n const result: DataCatalogSchema = {\n key: this.key,\n kind: DataCatalogKind,\n organization: this.organization,\n file: this.file,\n scope: this.scope,\n name: this.name,\n description: this.description,\n publishedBy: this.publishedBy,\n publishedAt: this.publishedAt,\n createdAt: this.createdAt,\n updatedAt: this.updatedAt,\n tags: [...this.tags],\n }\n if (typeof this.deprecated === 'boolean') {\n result.deprecated = this.deprecated\n }\n if (typeof this.deprecatedAt === 'number') {\n result.deprecatedAt = this.deprecatedAt\n }\n if (typeof this.deprecatedBy === 'string') {\n result.deprecatedBy = this.deprecatedBy\n }\n if (typeof this.deprecationReason === 'string') {\n result.deprecationReason = this.deprecationReason\n }\n if (typeof this.unpublishedAt === 'number') {\n result.unpublishedAt = this.unpublishedAt\n }\n return result\n }\n}\n"]}
1
+ {"version":3,"file":"DataCatalog.js","sourceRoot":"","sources":["../../../src/models/DataCatalog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAwI5C,MAAM,OAAO,WAAW;IACtB,GAAG,CAAQ;IAEX,IAAI,IAAI;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Y,KAAK,QAAQ,EAAE,CAAC;YAC1C,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAA;QACzC,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,QAAQ,EAAE,CAAC;YAC1C,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAA;QACzC,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,iBAAiB,KAAK,QAAQ,EAAE,CAAC;YAC/C,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAA;QACnD,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,aAAa,KAAK,QAAQ,EAAE,CAAC;YAC3C,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAA;QAC3C,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import type { DataCatalogLifecycle } from './DataCatalogVersion.js'\nimport { DataCatalogKind } from './kinds.js'\n\nexport type DataCatalogScope = 'public' | 'private' | 'organization'\n\nexport interface DataCatalogSchema {\n /**\n * The key of the data catalog entry.\n * When the value is missing it will be generated by the API.\n *\n * The key can only be set when creating a new data catalog entry.\n * @readonly\n */\n key: string\n /**\n * The kind of the schema\n * This is set by the API and is used to identify the schema.\n * @readonly\n */\n readonly kind: typeof DataCatalogKind\n /**\n * The key of the organization.\n * @required\n */\n organization: string\n /**\n * The key of the related data catalog file entry.\n * @required\n */\n file: string\n /**\n * The scope of the data catalog entry.\n * @required\n */\n scope: DataCatalogScope\n /**\n * The name of the data catalog entry.\n * It is required when creating a new data catalog entry.\n * @required\n */\n name: string\n /**\n * A short description of the data catalog entry.\n * @required\n */\n description: string\n /**\n * The id of the user who created the data catalog entry.\n * It is ignored when creating or updating a data catalog entry.\n * @readonly\n */\n publishedBy: string\n /**\n * The time when the last version was published.\n * It is ignored when creating or updating a data catalog entry.\n * @readonly\n */\n publishedAt: number\n /**\n * The time when the data catalog entry was created.\n * It is ignored when creating or updating a data catalog entry.\n * @readonly\n */\n createdAt: number\n /**\n * The time when the data catalog entry was last updated.\n * It is ignored when creating or updating a data catalog entry.\n * @readonly\n */\n updatedAt: number\n /**\n * The timestamp when this entry was unpublished.\n * Only set when the entry was unpublished.\n * @readonly\n */\n unpublishedAt?: number\n /**\n * A flag indicating if the entry is deprecated.\n * @readonly\n */\n deprecated?: boolean\n /**\n * The timestamp when the entry was deprecated.\n * Only set when the entry was deprecated.\n * @readonly\n */\n deprecatedAt?: number\n /**\n * The id of the user who deprecated the entry.\n * Only set when the entry was deprecated.\n * @readonly\n */\n deprecatedBy?: string\n /**\n * The reason why the entry was deprecated.\n * Only set when the entry was deprecated.\n */\n deprecationReason?: string\n /**\n * The list of tags associated with the data catalog entry.\n * @readonly Use the API endpoints to manage tags.\n */\n tags: string[]\n}\n\nexport interface DataCatalogSchemaVersion {\n /**\n * The version of the data catalog entry.\n */\n version: string\n /**\n * The lifecycle of the data catalog version.\n */\n lifecycle: DataCatalogLifecycle\n}\n\n/**\n * Used with API communication when listing data catalog entries.\n */\nexport interface DataCatalogSchemaWithVersion extends DataCatalogSchema {\n /**\n * The list of published versions of the data catalog entry.\n * Note, this is limited to the last 20 versions.\n */\n versions: DataCatalogSchemaVersion[]\n}\n\nexport interface DataCatalogVersionInfo {\n key: string\n version: string\n published: number\n}\n\nexport interface DataCatalogStatus extends DataCatalogSchema {\n versions: DataCatalogVersionInfo[]\n}\n\nexport class DataCatalog implements DataCatalogSchema {\n key: string\n\n get kind(): typeof DataCatalogKind {\n return DataCatalogKind\n }\n\n organization: string\n file: string\n scope: DataCatalogScope\n name: string\n description: string\n publishedBy: string\n publishedAt: number\n createdAt: number\n updatedAt: number\n unpublishedAt?: number | undefined\n deprecated?: boolean | undefined\n deprecatedAt?: number | undefined\n deprecatedBy?: string | undefined\n deprecationReason?: string | undefined\n tags: string[]\n\n static createSchema(input: Partial<DataCatalogSchema>): DataCatalogSchema {\n const {\n key = '',\n organization = '',\n file = '',\n scope = 'private',\n name = '',\n description = '',\n publishedBy = '',\n publishedAt = 0,\n createdAt = 0,\n updatedAt = 0,\n tags = [],\n } = input\n if (['public', 'private', 'organization'].indexOf(scope) === -1) {\n throw new Error(`Invalid scope: ${scope}`)\n }\n const result: DataCatalogSchema = {\n key,\n kind: DataCatalogKind,\n organization,\n file,\n scope,\n name,\n description,\n publishedBy,\n publishedAt,\n createdAt,\n updatedAt,\n tags,\n }\n if (typeof input.deprecated === 'boolean') {\n result.deprecated = input.deprecated\n }\n if (typeof input.deprecatedAt === 'number') {\n result.deprecatedAt = input.deprecatedAt\n }\n if (typeof input.deprecatedBy === 'string') {\n result.deprecatedBy = input.deprecatedBy\n }\n if (typeof input.deprecationReason === 'string') {\n result.deprecationReason = input.deprecationReason\n }\n if (typeof input.unpublishedAt === 'number') {\n result.unpublishedAt = input.unpublishedAt\n }\n return result\n }\n\n constructor(input: Partial<DataCatalogSchema> = {}) {\n const init = DataCatalog.createSchema(input)\n this.key = init.key\n this.organization = init.organization\n this.file = init.file\n this.scope = init.scope\n this.name = init.name\n this.description = init.description\n this.publishedBy = init.publishedBy\n this.publishedAt = init.publishedAt\n this.createdAt = init.createdAt\n this.updatedAt = init.updatedAt\n this.tags = init.tags\n if (typeof init.deprecated === 'boolean') {\n this.deprecated = init.deprecated\n }\n if (typeof init.deprecatedAt === 'number') {\n this.deprecatedAt = init.deprecatedAt\n }\n if (typeof init.deprecatedBy === 'string') {\n this.deprecatedBy = init.deprecatedBy\n }\n if (typeof init.deprecationReason === 'string') {\n this.deprecationReason = init.deprecationReason\n }\n if (typeof init.unpublishedAt === 'number') {\n this.unpublishedAt = init.unpublishedAt\n }\n }\n\n toJSON(): DataCatalogSchema {\n const result: DataCatalogSchema = {\n key: this.key,\n kind: DataCatalogKind,\n organization: this.organization,\n file: this.file,\n scope: this.scope,\n name: this.name,\n description: this.description,\n publishedBy: this.publishedBy,\n publishedAt: this.publishedAt,\n createdAt: this.createdAt,\n updatedAt: this.updatedAt,\n tags: [...this.tags],\n }\n if (typeof this.deprecated === 'boolean') {\n result.deprecated = this.deprecated\n }\n if (typeof this.deprecatedAt === 'number') {\n result.deprecatedAt = this.deprecatedAt\n }\n if (typeof this.deprecatedBy === 'string') {\n result.deprecatedBy = this.deprecatedBy\n }\n if (typeof this.deprecationReason === 'string') {\n result.deprecationReason = this.deprecationReason\n }\n if (typeof this.unpublishedAt === 'number') {\n result.unpublishedAt = this.unpublishedAt\n }\n return result\n }\n}\n"]}