@api-client/core 0.19.18 → 0.19.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/authorization/Utils.js +3 -3
- package/build/src/authorization/Utils.js.map +1 -1
- package/build/src/browser.d.ts +1 -1
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js.map +1 -1
- package/build/src/index.d.ts +1 -1
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js.map +1 -1
- package/build/src/mocking/lib/Organization.d.ts +5 -1
- package/build/src/mocking/lib/Organization.d.ts.map +1 -1
- package/build/src/mocking/lib/Organization.js +17 -0
- package/build/src/mocking/lib/Organization.js.map +1 -1
- package/build/src/modeling/ApiModel.d.ts +16 -5
- package/build/src/modeling/ApiModel.d.ts.map +1 -1
- package/build/src/modeling/ApiModel.js +17 -2
- package/build/src/modeling/ApiModel.js.map +1 -1
- package/build/src/modeling/ApiValidation.d.ts.map +1 -1
- package/build/src/modeling/ApiValidation.js +2 -1
- package/build/src/modeling/ApiValidation.js.map +1 -1
- package/build/src/modeling/DomainProperty.d.ts +12 -0
- package/build/src/modeling/DomainProperty.d.ts.map +1 -1
- package/build/src/modeling/DomainProperty.js +23 -28
- package/build/src/modeling/DomainProperty.js.map +1 -1
- package/build/src/modeling/DomainSerialization.js +1 -1
- package/build/src/modeling/DomainSerialization.js.map +1 -1
- package/build/src/modeling/ExposedEntity.d.ts +15 -1
- package/build/src/modeling/ExposedEntity.d.ts.map +1 -1
- package/build/src/modeling/ExposedEntity.js +42 -4
- package/build/src/modeling/ExposedEntity.js.map +1 -1
- package/build/src/modeling/actions/Action.d.ts.map +1 -1
- package/build/src/modeling/actions/Action.js +1 -0
- package/build/src/modeling/actions/Action.js.map +1 -1
- package/build/src/modeling/actions/ListAction.d.ts +3 -17
- package/build/src/modeling/actions/ListAction.d.ts.map +1 -1
- package/build/src/modeling/actions/ListAction.js +18 -38
- package/build/src/modeling/actions/ListAction.js.map +1 -1
- package/build/src/modeling/actions/SearchAction.d.ts +4 -4
- package/build/src/modeling/actions/SearchAction.d.ts.map +1 -1
- package/build/src/modeling/actions/SearchAction.js +16 -13
- package/build/src/modeling/actions/SearchAction.js.map +1 -1
- package/build/src/modeling/generators/oas_312/OasGenerator.d.ts +32 -0
- package/build/src/modeling/generators/oas_312/OasGenerator.d.ts.map +1 -0
- package/build/src/modeling/generators/oas_312/OasGenerator.js +1452 -0
- package/build/src/modeling/generators/oas_312/OasGenerator.js.map +1 -0
- package/build/src/modeling/generators/oas_312/OasSchemaGenerator.d.ts +27 -0
- package/build/src/modeling/generators/oas_312/OasSchemaGenerator.d.ts.map +1 -0
- package/build/src/modeling/generators/oas_312/OasSchemaGenerator.js +295 -0
- package/build/src/modeling/generators/oas_312/OasSchemaGenerator.js.map +1 -0
- package/build/src/modeling/generators/oas_312/types.d.ts +1010 -0
- package/build/src/modeling/generators/oas_312/types.d.ts.map +1 -0
- package/build/src/modeling/generators/oas_312/types.js +2 -0
- package/build/src/modeling/generators/oas_312/types.js.map +1 -0
- package/build/src/modeling/generators/oas_320/OasGenerator.d.ts +16 -0
- package/build/src/modeling/generators/oas_320/OasGenerator.d.ts.map +1 -0
- package/build/src/modeling/generators/oas_320/OasGenerator.js +306 -0
- package/build/src/modeling/generators/oas_320/OasGenerator.js.map +1 -0
- package/build/src/modeling/generators/oas_320/OasSchemaGenerator.d.ts +25 -0
- package/build/src/modeling/generators/oas_320/OasSchemaGenerator.d.ts.map +1 -0
- package/build/src/modeling/generators/oas_320/OasSchemaGenerator.js +237 -0
- package/build/src/modeling/generators/oas_320/OasSchemaGenerator.js.map +1 -0
- package/build/src/modeling/generators/oas_320/types.d.ts +1219 -0
- package/build/src/modeling/generators/oas_320/types.d.ts.map +1 -0
- package/build/src/modeling/generators/oas_320/types.js +2 -0
- package/build/src/modeling/generators/oas_320/types.js.map +1 -0
- package/build/src/modeling/types.d.ts +50 -13
- package/build/src/modeling/types.d.ts.map +1 -1
- package/build/src/modeling/types.js.map +1 -1
- package/build/src/modeling/validation/api_model_rules.d.ts +1 -0
- package/build/src/modeling/validation/api_model_rules.d.ts.map +1 -1
- package/build/src/modeling/validation/api_model_rules.js +105 -29
- package/build/src/modeling/validation/api_model_rules.js.map +1 -1
- package/build/src/models/ProjectRequest.d.ts.map +1 -1
- package/build/src/models/ProjectRequest.js +0 -4
- package/build/src/models/ProjectRequest.js.map +1 -1
- package/build/src/models/store/Organization.d.ts +13 -0
- package/build/src/models/store/Organization.d.ts.map +1 -1
- package/build/src/models/store/Organization.js.map +1 -1
- package/build/src/models/transformers/ArcDexieTransformer.d.ts.map +1 -1
- package/build/src/models/transformers/ArcDexieTransformer.js +0 -4
- package/build/src/models/transformers/ArcDexieTransformer.js.map +1 -1
- package/build/src/models/transformers/ImportUtils.js +1 -1
- package/build/src/models/transformers/ImportUtils.js.map +1 -1
- package/build/src/models/transformers/PostmanBackupTransformer.d.ts.map +1 -1
- package/build/src/models/transformers/PostmanBackupTransformer.js +0 -4
- package/build/src/models/transformers/PostmanBackupTransformer.js.map +1 -1
- package/build/src/runtime/constants.d.ts +7 -0
- package/build/src/runtime/constants.d.ts.map +1 -0
- package/build/src/runtime/constants.js +8 -0
- package/build/src/runtime/constants.js.map +1 -0
- package/build/src/runtime/http-engine/ntlm/Des.d.ts.map +1 -1
- package/build/src/runtime/http-engine/ntlm/Des.js +1 -0
- package/build/src/runtime/http-engine/ntlm/Des.js.map +1 -1
- package/build/src/runtime/variables/EvalFunctions.d.ts.map +1 -1
- package/build/src/runtime/variables/EvalFunctions.js +0 -1
- package/build/src/runtime/variables/EvalFunctions.js.map +1 -1
- package/build/src/sdk/OrganizationsSdk.d.ts +17 -1
- package/build/src/sdk/OrganizationsSdk.d.ts.map +1 -1
- package/build/src/sdk/OrganizationsSdk.js +76 -0
- package/build/src/sdk/OrganizationsSdk.js.map +1 -1
- package/build/src/sdk/RouteBuilder.d.ts +2 -0
- package/build/src/sdk/RouteBuilder.d.ts.map +1 -1
- package/build/src/sdk/RouteBuilder.js +6 -0
- package/build/src/sdk/RouteBuilder.js.map +1 -1
- package/build/src/sdk/SdkMock.d.ts +12 -0
- package/build/src/sdk/SdkMock.d.ts.map +1 -1
- package/build/src/sdk/SdkMock.js +32 -0
- package/build/src/sdk/SdkMock.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/eslint.config.js +6 -0
- package/package.json +3 -1
- package/src/authorization/Utils.ts +3 -3
- package/src/mocking/lib/Organization.ts +22 -1
- package/src/modeling/ApiModel.ts +23 -8
- package/src/modeling/ApiValidation.ts +2 -0
- package/src/modeling/DomainProperty.ts +22 -18
- package/src/modeling/DomainSerialization.ts +1 -1
- package/src/modeling/ExposedEntity.ts +44 -4
- package/src/modeling/actions/Action.ts +1 -0
- package/src/modeling/actions/ListAction.ts +12 -30
- package/src/modeling/actions/SearchAction.ts +11 -8
- package/src/modeling/generators/oas_312/OasGenerator.ts +1685 -0
- package/src/modeling/generators/oas_312/OasSchemaGenerator.ts +322 -0
- package/src/modeling/generators/oas_312/types.ts +1052 -0
- package/src/modeling/generators/oas_320/OasGenerator.ts +359 -0
- package/src/modeling/generators/oas_320/OasSchemaGenerator.ts +255 -0
- package/src/modeling/generators/oas_320/types.ts +1259 -0
- package/src/modeling/types.ts +55 -22
- package/src/modeling/validation/api_model_rules.ts +103 -32
- package/src/models/ProjectRequest.ts +0 -4
- package/src/models/store/Organization.ts +14 -0
- package/src/models/transformers/ArcDexieTransformer.ts +0 -4
- package/src/models/transformers/ImportUtils.ts +1 -1
- package/src/models/transformers/PostmanBackupTransformer.ts +0 -5
- package/src/runtime/constants.ts +9 -0
- package/src/runtime/http-engine/ntlm/Des.ts +1 -0
- package/src/runtime/variables/EvalFunctions.ts +0 -1
- package/src/sdk/OrganizationsSdk.ts +81 -1
- package/src/sdk/RouteBuilder.ts +8 -0
- package/src/sdk/SdkMock.ts +50 -0
- package/tests/test-utils.ts +6 -2
- package/tests/unit/decorators/observed.spec.ts +8 -24
- package/tests/unit/decorators/observed_recursive.spec.ts +0 -1
- package/tests/unit/events/EventsTestHelpers.ts +0 -1
- package/tests/unit/events/events_polyfills.ts +0 -1
- package/tests/unit/legacy-transformers/DataTestHelper.ts +0 -2
- package/tests/unit/legacy-transformers/LegacyExportProcessor.spec.ts +0 -1
- package/tests/unit/modeling/actions/ListAction.spec.ts +9 -69
- package/tests/unit/modeling/actions/SearchAction.spec.ts +9 -35
- package/tests/unit/modeling/api_model.spec.ts +28 -0
- package/tests/unit/modeling/definitions/sku.spec.ts +0 -2
- package/tests/unit/modeling/domain_property.spec.ts +20 -1
- package/tests/unit/modeling/exposed_entity.spec.ts +71 -0
- package/tests/unit/modeling/generators/OasGenerator.spec.ts +302 -0
- package/tests/unit/modeling/validation/api_model_rules.spec.ts +113 -15
|
@@ -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,EAAsB,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACxE,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,EAAE,CAAC;sCAKxB,QAAQ,CAAC,EAAE,IAAI,EAAE,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C,OAAO,OAAO,EAAE,CAAC;gBACf,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;oBACzB,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;gBACzC,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,YAAY,CAAA;QACrB,CAAC;QAED;;;WAGG;QACH,sBAAsB;YACpB,MAAM,KAAK,GAAoB,EAAE,CAAA;YACjC,IAAI,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;gBAC1B,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;YAC5C,CAAC;YACD,4DAA4D;YAC5D,IAAI,OAAO,GAA8B,IAAI,CAAA;YAC7C,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 exactly one segment\n if (segments.length !== 1) {\n throw new Error(\n `Resource path must contain exactly one segment 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]}`\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
|
+
{"version":3,"file":"ExposedEntity.js","sourceRoot":"","sources":["../../../src/modeling/ExposedEntity.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,OAAO,EAAwB,aAAa,EAAE,MAAM,o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AAI,CAAC,MAAM,CAAC,CAAA;YACzB,OAAO,MAAM,CAAA;QACf,CAAC;;;SA3bU,aAAa","sourcesContent":["import { observed, toRaw } from '../decorators/observed.js'\nimport { ExposedEntityKind } from '../models/kinds.js'\nimport { nanoid } from '../nanoid.js'\nimport { Action } from './actions/Action.js'\nimport { type ApiActionSchema, 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 {\n AssociationTarget,\n ExposeOptions,\n ExposeParentRef,\n ExposedEntitySchema,\n PaginationContract,\n} 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 * Pagination contract for this exposure.\n * Defines a list of fields that can be used for filtering, sorting, and searching.\n * The pagination contract is only valid for that specific exposure. It cannot be inherited\n * by other exposures.\n */\n @observed({ deep: true }) accessor paginationContract: PaginationContract | 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 paginationContract,\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 if (paginationContract !== undefined) {\n result.paginationContract = structuredClone(paginationContract)\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 if (init.rateLimiting) {\n this.rateLimiting = new RateLimitingConfiguration(init.rateLimiting)\n }\n this.truncated = init.truncated\n if (init.paginationContract) {\n this.paginationContract = structuredClone(init.paginationContract)\n }\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 if (this.paginationContract) {\n result.paginationContract = structuredClone(toRaw(this, this.paginationContract))\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 exactly one segment\n if (segments.length !== 1) {\n throw new Error(\n `Resource path must contain exactly one segment 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]}`\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 /**\n * Adds an action to the exposure.\n * @param schema The schema of the action to add.\n * @returns The added action.\n */\n addAction(schema: ApiActionSchema): Action {\n if (this.actions.some((action) => action.kind === schema.kind)) {\n throw new Error(`Action of kind \"${schema.kind}\" already exists for this exposure`)\n }\n const action = restoreAction(this, schema)\n this.actions.push(action)\n return action\n }\n}\n"]}
|
|
@@ -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;AAGlH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAExD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,+BAA+B,CAAA;CAC/C;AAED;;GAEG;AACH,qBAAa,MAAO,SAAQ,WAAY,YAAW,YAAY;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACP,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,CAAA;IAC/C,QAAQ,CAAC,YAAY,EAAE,yBAAyB,GAAG,SAAS,CAAA;IAExE,SAAS,CAAC,MAAM,EAAE,aAAa,CAAA;gBAEnB,MAAM,EAAE,aAAa,EAAE,KAAK,GAAE,OAAO,CAAC,YAAY,CAAM;IAQpE,YAAY;
|
|
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;AAGlH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAExD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,+BAA+B,CAAA;CAC/C;AAED;;GAEG;AACH,qBAAa,MAAO,SAAQ,WAAY,YAAW,YAAY;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACP,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,CAAA;IAC/C,QAAQ,CAAC,YAAY,EAAE,yBAAyB,GAAG,SAAS,CAAA;IAExE,SAAS,CAAC,MAAM,EAAE,aAAa,CAAA;gBAEnB,MAAM,EAAE,aAAa,EAAE,KAAK,GAAE,OAAO,CAAC,YAAY,CAAM;IAQpE,YAAY;IAKZ,MAAM,IAAI,YAAY;IAatB;;OAEG;IACH,WAAW,IAAI,UAAU,EAAE;IAK3B;;OAEG;IACH,kBAAkB,IAAI,yBAAyB,EAAE;CAOlD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Action.js","sourceRoot":"","sources":["../../../../src/modeling/actions/Action.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,yBAAyB,EAAmC,MAAM,u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AyB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QACxG,CAAC;QAED,YAAY;YACV,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;YACvC,iCAAiC;QACnC,CAAC;QAED,MAAM;YACJ,MAAM,MAAM,GAAiB;gBAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CAAA;YACD,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;gBAC3B,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;YAClE,CAAC;YACD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;gBACtB,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAA;YAClD,CAAC;YACD,OAAO,MAAM,CAAA;QACf,CAAC;QAED;;WAEG;QACH,WAAW;YACT,MAAM,KAAK,GAAiB,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,CAAA;YAC9E,OAAO,KAAK,CAAA;QACd,CAAC;QAED;;WAEG;QACH,kBAAkB;YAChB,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAA;YACrD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;gBACtB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;YACtC,CAAC;YACD,OAAO,YAAY,CAAA;QACrB,CAAC;;;SAlDU,MAAM","sourcesContent":["import { AccessRule, AccessRuleSchema } from '../rules/AccessRule.js'\nimport { RateLimitingConfiguration, RateLimitingConfigurationSchema } from '../rules/RateLimitingConfiguration.js'\nimport { observed } from '../../decorators/observed.js'\nimport { restoreAccessRule } from '../rules/index.js'\nimport type { ExposedEntity } from '../ExposedEntity.js'\n\n/**\n * A base interface for common properties across all actions.\n */\nexport interface ActionSchema {\n /**\n * The specific kind of action (e.g., 'List', 'Read', etc.)\n */\n kind: string\n /**\n * Access control rules defining who can perform this action. It is only applied if the\n * authorization strategy is set to 'RBAC'.\n * If no rules grant access, it's denied by default making it essentially private.\n *\n * Note, the API can defined top level access rules that apply to all actions. If this property is set,\n * it overrides the top level access rules for this specific action.\n *\n * It is an ordered list, meaning the first rule that matches the user will be applied.\n * If multiple rules match, the first one in the list takes precedence.\n * If no rules match, the action is denied.\n */\n accessRule?: AccessRuleSchema[]\n /**\n * Optional configuration for action-wide rate limiting and throttling.\n * Defines rules to protect the action from overuse.\n */\n rateLimiting?: RateLimitingConfigurationSchema\n}\n\n/**\n * A base class for common properties across all actions.\n */\nexport class Action extends EventTarget implements ActionSchema {\n @observed() accessor kind: string\n @observed({ deep: true }) accessor accessRule: AccessRule[]\n @observed() accessor rateLimiting: RateLimitingConfiguration | undefined\n\n protected parent: ExposedEntity\n\n constructor(parent: ExposedEntity, state: Partial<ActionSchema> = {}) {\n super()\n this.parent = parent\n this.kind = state.kind || ''\n this.accessRule = state.accessRule ? state.accessRule.map((rule) => restoreAccessRule(rule)) : []\n this.rateLimiting = state.rateLimiting ? new RateLimitingConfiguration(state.rateLimiting) : undefined\n }\n\n notifyChange() {\n this.dispatchEvent(new Event('change'))\n // this.parent.api.notifyChange()\n }\n\n toJSON(): ActionSchema {\n const result: ActionSchema = {\n kind: this.kind,\n }\n if (this.accessRule.length) {\n result.accessRule = this.accessRule.map((rule) => rule.toJSON())\n }\n if (this.rateLimiting) {\n result.rateLimiting = this.rateLimiting.toJSON()\n }\n return result\n }\n\n /**\n * Returns all access rules for this action, including the ones from all the parents up to the API.\n */\n getAllRules(): AccessRule[] {\n const rules: AccessRule[] = [...this.parent.getAllRules(), ...this.accessRule]\n return rules\n }\n\n /**\n * Returns all rate limiters for this action, including the ones from all the parents up to the API.\n */\n getAllRateLimiters(): RateLimitingConfiguration[] {\n const rateLimiters = this.parent.getAllRateLimiters()\n if (this.rateLimiting) {\n rateLimiters.push(this.rateLimiting)\n }\n return rateLimiters\n }\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { PaginationStrategy } from '../types.js';
|
|
2
1
|
import { Action, type ActionSchema } from './Action.js';
|
|
3
2
|
import type { ExposedEntity } from '../ExposedEntity.js';
|
|
4
3
|
/**
|
|
@@ -8,20 +7,9 @@ import type { ExposedEntity } from '../ExposedEntity.js';
|
|
|
8
7
|
export interface ListActionSchema extends ActionSchema {
|
|
9
8
|
kind: 'list';
|
|
10
9
|
/**
|
|
11
|
-
* The
|
|
12
|
-
* This defines how the results are paginated when retrieving a collection of resources.
|
|
13
|
-
* It can be either 'cursor' or 'offset'.
|
|
10
|
+
* The time to live for the cache in seconds.
|
|
14
11
|
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Fields from the entity that can be used for filtering.
|
|
18
|
-
* Must be marked as "indexable" in the Data Model.
|
|
19
|
-
*/
|
|
20
|
-
filterableFields: string[];
|
|
21
|
-
/**
|
|
22
|
-
* Fields from the entity that can be used for sorting.
|
|
23
|
-
*/
|
|
24
|
-
sortableFields: string[];
|
|
12
|
+
cacheTtl?: number;
|
|
25
13
|
}
|
|
26
14
|
/**
|
|
27
15
|
* Enables retrieving a collection of resources.
|
|
@@ -29,9 +17,7 @@ export interface ListActionSchema extends ActionSchema {
|
|
|
29
17
|
*/
|
|
30
18
|
export declare class ListAction extends Action implements ListActionSchema {
|
|
31
19
|
accessor kind: 'list';
|
|
32
|
-
accessor
|
|
33
|
-
accessor filterableFields: string[];
|
|
34
|
-
accessor sortableFields: string[];
|
|
20
|
+
accessor cacheTtl: number | undefined;
|
|
35
21
|
constructor(parent: ExposedEntity, state?: Partial<ListActionSchema>);
|
|
36
22
|
toJSON(): ListActionSchema;
|
|
37
23
|
static isListAction(action: Action): action is ListAction;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListAction.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/ListAction.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ListAction.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/ListAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGxD;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;GAGG;AACH,qBAAa,UAAW,SAAQ,MAAO,YAAW,gBAAgB;IAChE,SAA8B,IAAI,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;gBAErC,MAAM,EAAE,aAAa,EAAE,KAAK,GAAE,OAAO,CAAC,gBAAgB,CAAM;IAM/D,MAAM,IAAI,gBAAgB;IAWnC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,UAAU;IAIzD,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,gBAAgB;CAG5E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
2
|
import { Action } from './Action.js';
|
|
3
|
-
import { observed
|
|
3
|
+
import { observed } from '../../decorators/observed.js';
|
|
4
4
|
/**
|
|
5
5
|
* Enables retrieving a collection of resources.
|
|
6
6
|
* Endpoint: GET /[entity-collection-name]
|
|
@@ -10,59 +10,39 @@ let ListAction = (() => {
|
|
|
10
10
|
let _kind_decorators;
|
|
11
11
|
let _kind_initializers = [];
|
|
12
12
|
let _kind_extraInitializers = [];
|
|
13
|
-
let
|
|
14
|
-
let
|
|
15
|
-
let
|
|
16
|
-
let _filterableFields_decorators;
|
|
17
|
-
let _filterableFields_initializers = [];
|
|
18
|
-
let _filterableFields_extraInitializers = [];
|
|
19
|
-
let _sortableFields_decorators;
|
|
20
|
-
let _sortableFields_initializers = [];
|
|
21
|
-
let _sortableFields_extraInitializers = [];
|
|
13
|
+
let _cacheTtl_decorators;
|
|
14
|
+
let _cacheTtl_initializers = [];
|
|
15
|
+
let _cacheTtl_extraInitializers = [];
|
|
22
16
|
return class ListAction extends _classSuper {
|
|
23
17
|
static {
|
|
24
18
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
25
19
|
_kind_decorators = [observed()];
|
|
26
|
-
|
|
27
|
-
_filterableFields_decorators = [observed({ deep: true })];
|
|
28
|
-
_sortableFields_decorators = [observed({ deep: true })];
|
|
20
|
+
_cacheTtl_decorators = [observed()];
|
|
29
21
|
__esDecorate(this, null, _kind_decorators, { kind: "accessor", name: "kind", static: false, private: false, access: { has: obj => "kind" in obj, get: obj => obj.kind, set: (obj, value) => { obj.kind = value; } }, metadata: _metadata }, _kind_initializers, _kind_extraInitializers);
|
|
30
|
-
__esDecorate(this, null,
|
|
31
|
-
__esDecorate(this, null, _filterableFields_decorators, { kind: "accessor", name: "filterableFields", static: false, private: false, access: { has: obj => "filterableFields" in obj, get: obj => obj.filterableFields, set: (obj, value) => { obj.filterableFields = value; } }, metadata: _metadata }, _filterableFields_initializers, _filterableFields_extraInitializers);
|
|
32
|
-
__esDecorate(this, null, _sortableFields_decorators, { kind: "accessor", name: "sortableFields", static: false, private: false, access: { has: obj => "sortableFields" in obj, get: obj => obj.sortableFields, set: (obj, value) => { obj.sortableFields = value; } }, metadata: _metadata }, _sortableFields_initializers, _sortableFields_extraInitializers);
|
|
22
|
+
__esDecorate(this, null, _cacheTtl_decorators, { kind: "accessor", name: "cacheTtl", static: false, private: false, access: { has: obj => "cacheTtl" in obj, get: obj => obj.cacheTtl, set: (obj, value) => { obj.cacheTtl = value; } }, metadata: _metadata }, _cacheTtl_initializers, _cacheTtl_extraInitializers);
|
|
33
23
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
34
24
|
}
|
|
35
25
|
#kind_accessor_storage = __runInitializers(this, _kind_initializers, void 0);
|
|
36
26
|
get kind() { return this.#kind_accessor_storage; }
|
|
37
27
|
set kind(value) { this.#kind_accessor_storage = value; }
|
|
38
|
-
#
|
|
39
|
-
get
|
|
40
|
-
set
|
|
41
|
-
#filterableFields_accessor_storage = (__runInitializers(this, _pagination_extraInitializers), __runInitializers(this, _filterableFields_initializers, []));
|
|
42
|
-
get filterableFields() { return this.#filterableFields_accessor_storage; }
|
|
43
|
-
set filterableFields(value) { this.#filterableFields_accessor_storage = value; }
|
|
44
|
-
#sortableFields_accessor_storage = (__runInitializers(this, _filterableFields_extraInitializers), __runInitializers(this, _sortableFields_initializers, []));
|
|
45
|
-
get sortableFields() { return this.#sortableFields_accessor_storage; }
|
|
46
|
-
set sortableFields(value) { this.#sortableFields_accessor_storage = value; }
|
|
28
|
+
#cacheTtl_accessor_storage = (__runInitializers(this, _kind_extraInitializers), __runInitializers(this, _cacheTtl_initializers, void 0));
|
|
29
|
+
get cacheTtl() { return this.#cacheTtl_accessor_storage; }
|
|
30
|
+
set cacheTtl(value) { this.#cacheTtl_accessor_storage = value; }
|
|
47
31
|
constructor(parent, state = {}) {
|
|
48
32
|
super(parent, state);
|
|
49
|
-
__runInitializers(this,
|
|
50
|
-
this.kind =
|
|
51
|
-
this.
|
|
52
|
-
? { ...state.pagination }
|
|
53
|
-
: {
|
|
54
|
-
kind: 'offset',
|
|
55
|
-
};
|
|
56
|
-
this.filterableFields = state.filterableFields ? [...state.filterableFields] : [];
|
|
57
|
-
this.sortableFields = state.sortableFields ? [...state.sortableFields] : [];
|
|
33
|
+
__runInitializers(this, _cacheTtl_extraInitializers);
|
|
34
|
+
this.kind = 'list';
|
|
35
|
+
this.cacheTtl = state.cacheTtl;
|
|
58
36
|
}
|
|
59
37
|
toJSON() {
|
|
60
|
-
|
|
38
|
+
const result = {
|
|
61
39
|
...super.toJSON(),
|
|
62
|
-
|
|
63
|
-
filterableFields: structuredClone(toRaw(this, this.filterableFields)),
|
|
64
|
-
sortableFields: structuredClone(toRaw(this, this.sortableFields)),
|
|
40
|
+
kind: 'list',
|
|
65
41
|
};
|
|
42
|
+
if (this.cacheTtl !== undefined) {
|
|
43
|
+
result.cacheTtl = this.cacheTtl;
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
66
46
|
}
|
|
67
47
|
static isListAction(action) {
|
|
68
48
|
return action.kind === 'list';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListAction.js","sourceRoot":"","sources":["../../../../src/modeling/actions/ListAction.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ListAction.js","sourceRoot":"","sources":["../../../../src/modeling/actions/ListAction.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAcvD;;;GAGG;IACU,UAAU;sBAAS,MAAM;;;;;;;iBAAzB,UAAW,SAAQ,WAAM;;;gCACnC,QAAQ,EAAE;oCACV,QAAQ,EAAE;YADC,iKAAkB,IAAI,6BAAJ,IAAI,mFAAQ;YAC9B,6KAAS,QAAQ,6BAAR,QAAQ,2FAAoB;;;QADrC,6EAA8B;QAA9B,IAAkB,IAAI,0CAAQ;QAA9B,IAAkB,IAAI,gDAAQ;QAC9B,yIAAqC;QAArC,IAAS,QAAQ,8CAAoB;QAArC,IAAS,QAAQ,oDAAoB;QAEjD,YAAY,MAAqB,EAAE,QAAmC,EAAE;YACtE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;;YACpB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAA;YAClB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAA;SAC/B;QAEQ,MAAM;YACb,MAAM,MAAM,GAAqB;gBAC/B,GAAI,KAAK,CAAC,MAAM,EAAuB;gBACvC,IAAI,EAAE,MAAM;aACb,CAAA;YACD,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAChC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;YACjC,CAAC;YACD,OAAO,MAAM,CAAA;QACf,CAAC;QAED,MAAM,CAAC,YAAY,CAAC,MAAc;YAChC,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,CAAA;QAC/B,CAAC;QAED,MAAM,CAAC,kBAAkB,CAAC,MAAoB;YAC5C,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,CAAA;QAC/B,CAAC;;;SA3BU,UAAU","sourcesContent":["import { Action, type ActionSchema } from './Action.js'\nimport type { ExposedEntity } from '../ExposedEntity.js'\nimport { observed } from '../../decorators/observed.js'\n\n/**\n * Enables retrieving a collection of resources.\n * Endpoint: GET /[entity-collection-name]\n */\nexport interface ListActionSchema extends ActionSchema {\n kind: 'list'\n /**\n * The time to live for the cache in seconds.\n */\n cacheTtl?: number\n}\n\n/**\n * Enables retrieving a collection of resources.\n * Endpoint: GET /[entity-collection-name]\n */\nexport class ListAction extends Action implements ListActionSchema {\n @observed() override accessor kind: 'list'\n @observed() accessor cacheTtl: number | undefined\n\n constructor(parent: ExposedEntity, state: Partial<ListActionSchema> = {}) {\n super(parent, state)\n this.kind = 'list'\n this.cacheTtl = state.cacheTtl\n }\n\n override toJSON(): ListActionSchema {\n const result: ListActionSchema = {\n ...(super.toJSON() as ListActionSchema),\n kind: 'list',\n }\n if (this.cacheTtl !== undefined) {\n result.cacheTtl = this.cacheTtl\n }\n return result\n }\n\n static isListAction(action: Action): action is ListAction {\n return action.kind === 'list'\n }\n\n static isListActionSchema(schema: ActionSchema): schema is ListActionSchema {\n return schema.kind === 'list'\n }\n}\n"]}
|
|
@@ -7,10 +7,10 @@ import type { ExposedEntity } from '../ExposedEntity.js';
|
|
|
7
7
|
export interface SearchActionSchema extends ActionSchema {
|
|
8
8
|
kind: 'search';
|
|
9
9
|
/**
|
|
10
|
-
* The
|
|
11
|
-
*
|
|
10
|
+
* The maximum depth of the Abstract Syntax Tree (AST) that will be used to parse the search query.
|
|
11
|
+
* This is used to prevent denial of service attacks.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
maxAstDepth?: number;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Enables keyword-based search across specified fields.
|
|
@@ -18,7 +18,7 @@ export interface SearchActionSchema extends ActionSchema {
|
|
|
18
18
|
*/
|
|
19
19
|
export declare class SearchAction extends Action implements SearchActionSchema {
|
|
20
20
|
accessor kind: 'search';
|
|
21
|
-
accessor
|
|
21
|
+
accessor maxAstDepth: number | undefined;
|
|
22
22
|
constructor(parent: ExposedEntity, state?: Partial<SearchActionSchema>);
|
|
23
23
|
toJSON(): SearchActionSchema;
|
|
24
24
|
static isSearchActionSchema(schema: ActionSchema): schema is SearchActionSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchAction.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/SearchAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"SearchAction.d.ts","sourceRoot":"","sources":["../../../../src/modeling/actions/SearchAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGxD;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,IAAI,EAAE,QAAQ,CAAA;IACd;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,MAAO,YAAW,kBAAkB;IACpE,SAA8B,IAAI,EAAE,QAAQ,CAAA;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;gBAExC,MAAM,EAAE,aAAa,EAAE,KAAK,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAMjE,MAAM,IAAI,kBAAkB;IAWrC,MAAM,CAAC,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,kBAAkB;IAI/E,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,YAAY;CAG9D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
2
|
import { Action } from './Action.js';
|
|
3
|
-
import { observed
|
|
3
|
+
import { observed } from '../../decorators/observed.js';
|
|
4
4
|
/**
|
|
5
5
|
* Enables keyword-based search across specified fields.
|
|
6
6
|
* Endpoint: GET /[entity-collection-name]/search
|
|
@@ -10,36 +10,39 @@ let SearchAction = (() => {
|
|
|
10
10
|
let _kind_decorators;
|
|
11
11
|
let _kind_initializers = [];
|
|
12
12
|
let _kind_extraInitializers = [];
|
|
13
|
-
let
|
|
14
|
-
let
|
|
15
|
-
let
|
|
13
|
+
let _maxAstDepth_decorators;
|
|
14
|
+
let _maxAstDepth_initializers = [];
|
|
15
|
+
let _maxAstDepth_extraInitializers = [];
|
|
16
16
|
return class SearchAction extends _classSuper {
|
|
17
17
|
static {
|
|
18
18
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
19
19
|
_kind_decorators = [observed()];
|
|
20
|
-
|
|
20
|
+
_maxAstDepth_decorators = [observed()];
|
|
21
21
|
__esDecorate(this, null, _kind_decorators, { kind: "accessor", name: "kind", static: false, private: false, access: { has: obj => "kind" in obj, get: obj => obj.kind, set: (obj, value) => { obj.kind = value; } }, metadata: _metadata }, _kind_initializers, _kind_extraInitializers);
|
|
22
|
-
__esDecorate(this, null,
|
|
22
|
+
__esDecorate(this, null, _maxAstDepth_decorators, { kind: "accessor", name: "maxAstDepth", static: false, private: false, access: { has: obj => "maxAstDepth" in obj, get: obj => obj.maxAstDepth, set: (obj, value) => { obj.maxAstDepth = value; } }, metadata: _metadata }, _maxAstDepth_initializers, _maxAstDepth_extraInitializers);
|
|
23
23
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
24
24
|
}
|
|
25
25
|
#kind_accessor_storage = __runInitializers(this, _kind_initializers, void 0);
|
|
26
26
|
get kind() { return this.#kind_accessor_storage; }
|
|
27
27
|
set kind(value) { this.#kind_accessor_storage = value; }
|
|
28
|
-
#
|
|
29
|
-
get
|
|
30
|
-
set
|
|
28
|
+
#maxAstDepth_accessor_storage = (__runInitializers(this, _kind_extraInitializers), __runInitializers(this, _maxAstDepth_initializers, void 0));
|
|
29
|
+
get maxAstDepth() { return this.#maxAstDepth_accessor_storage; }
|
|
30
|
+
set maxAstDepth(value) { this.#maxAstDepth_accessor_storage = value; }
|
|
31
31
|
constructor(parent, state = {}) {
|
|
32
32
|
super(parent, state);
|
|
33
|
-
__runInitializers(this,
|
|
33
|
+
__runInitializers(this, _maxAstDepth_extraInitializers);
|
|
34
34
|
this.kind = 'search';
|
|
35
|
-
this.
|
|
35
|
+
this.maxAstDepth = state.maxAstDepth;
|
|
36
36
|
}
|
|
37
37
|
toJSON() {
|
|
38
|
-
|
|
38
|
+
const result = {
|
|
39
39
|
...super.toJSON(),
|
|
40
40
|
kind: 'search',
|
|
41
|
-
fields: structuredClone(toRaw(this, this.fields)),
|
|
42
41
|
};
|
|
42
|
+
if (this.maxAstDepth !== undefined) {
|
|
43
|
+
result.maxAstDepth = this.maxAstDepth;
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
43
46
|
}
|
|
44
47
|
static isSearchActionSchema(schema) {
|
|
45
48
|
return schema.kind === 'search';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchAction.js","sourceRoot":"","sources":["../../../../src/modeling/actions/SearchAction.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"SearchAction.js","sourceRoot":"","sources":["../../../../src/modeling/actions/SearchAction.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAA;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAevD;;;GAGG;IACU,YAAY;sBAAS,MAAM;;;;;;;iBAA3B,YAAa,SAAQ,WAAM;;;gCACrC,QAAQ,EAAE;uCACV,QAAQ,EAAE;YADC,iKAAkB,IAAI,6BAAJ,IAAI,mFAAU;YAChC,sLAAS,WAAW,6BAAX,WAAW,iGAAoB;;;QADxC,6EAAgC;QAAhC,IAAkB,IAAI,0CAAU;QAAhC,IAAkB,IAAI,gDAAU;QAChC,+IAAwC;QAAxC,IAAS,WAAW,iDAAoB;QAAxC,IAAS,WAAW,uDAAoB;QAEpD,YAAY,MAAqB,EAAE,QAAqC,EAAE;YACxE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;;YACpB,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAA;YACpB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAA;SACrC;QAEQ,MAAM;YACb,MAAM,MAAM,GAAuB;gBACjC,GAAI,KAAK,CAAC,MAAM,EAAyB;gBACzC,IAAI,EAAE,QAAQ;aACf,CAAA;YACD,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;gBACnC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAA;YACvC,CAAC;YACD,OAAO,MAAM,CAAA;QACf,CAAC;QAED,MAAM,CAAC,oBAAoB,CAAC,MAAoB;YAC9C,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAA;QACjC,CAAC;QAED,MAAM,CAAC,cAAc,CAAC,MAAc;YAClC,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAA;QACjC,CAAC;;;SA3BU,YAAY","sourcesContent":["import { Action, type ActionSchema } from './Action.js'\nimport type { ExposedEntity } from '../ExposedEntity.js'\nimport { observed } from '../../decorators/observed.js'\n\n/**\n * Enables keyword-based search across specified fields.\n * Endpoint: GET /[entity-collection-name]/search\n */\nexport interface SearchActionSchema extends ActionSchema {\n kind: 'search'\n /**\n * The maximum depth of the Abstract Syntax Tree (AST) that will be used to parse the search query.\n * This is used to prevent denial of service attacks.\n */\n maxAstDepth?: number\n}\n\n/**\n * Enables keyword-based search across specified fields.\n * Endpoint: GET /[entity-collection-name]/search\n */\nexport class SearchAction extends Action implements SearchActionSchema {\n @observed() override accessor kind: 'search'\n @observed() accessor maxAstDepth: number | undefined\n\n constructor(parent: ExposedEntity, state: Partial<SearchActionSchema> = {}) {\n super(parent, state)\n this.kind = 'search'\n this.maxAstDepth = state.maxAstDepth\n }\n\n override toJSON(): SearchActionSchema {\n const result: SearchActionSchema = {\n ...(super.toJSON() as SearchActionSchema),\n kind: 'search',\n }\n if (this.maxAstDepth !== undefined) {\n result.maxAstDepth = this.maxAstDepth\n }\n return result\n }\n\n static isSearchActionSchema(schema: ActionSchema): schema is SearchActionSchema {\n return schema.kind === 'search'\n }\n\n static isSearchAction(action: Action): action is SearchAction {\n return action.kind === 'search'\n }\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { OpenApi312 } from './types.js';
|
|
2
|
+
import type { ApiModel } from '../../ApiModel.js';
|
|
3
|
+
export declare class OasGenerator {
|
|
4
|
+
#private;
|
|
5
|
+
private model;
|
|
6
|
+
private whereAstInjected;
|
|
7
|
+
get hasListAction(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* A flag that determines whether any of the entities has the `Search` action.
|
|
10
|
+
*/
|
|
11
|
+
get hasSearchAction(): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* @param model The API model to generate OAS for.
|
|
14
|
+
*/
|
|
15
|
+
constructor(model: ApiModel);
|
|
16
|
+
generate(): OpenApi312;
|
|
17
|
+
private generateInfo;
|
|
18
|
+
private generateSecuritySchemes;
|
|
19
|
+
private generateErrorSchemas;
|
|
20
|
+
private generatePaths;
|
|
21
|
+
private extractPathParameters;
|
|
22
|
+
private applyActionSecurity;
|
|
23
|
+
private applyStandardResponse;
|
|
24
|
+
private resolvePaginationDefault;
|
|
25
|
+
private resolvePaginationMaximum;
|
|
26
|
+
private createCursorPaginationQueryParameters;
|
|
27
|
+
private createOffsetPaginationQueryParameters;
|
|
28
|
+
private createListParameters;
|
|
29
|
+
private createListParameter;
|
|
30
|
+
private createSortParameter;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=OasGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OasGenerator.d.ts","sourceRoot":"","sources":["../../../../../src/modeling/generators/oas_312/OasGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,UAAU,EASX,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AA4BjD,qBAAa,YAAY;;IAqBX,OAAO,CAAC,KAAK;IApBzB,OAAO,CAAC,gBAAgB,CAAQ;IAIhC,IAAI,aAAa,IAAI,OAAO,CAE3B;IAID;;OAEG;IACH,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED;;OAEG;gBACiB,KAAK,EAAE,QAAQ;IAEnC,QAAQ,IAAI,UAAU;IAwKtB,OAAO,CAAC,YAAY;IAyBpB,OAAO,CAAC,uBAAuB;IA2B/B,OAAO,CAAC,oBAAoB;IA0H5B,OAAO,CAAC,aAAa;IAgYrB,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,mBAAmB;IAqC3B,OAAO,CAAC,qBAAqB;IAuH7B,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,wBAAwB;IAOhC,OAAO,CAAC,qCAAqC;IAwC7C,OAAO,CAAC,qCAAqC;IA0C7C,OAAO,CAAC,oBAAoB;IA4B5B,OAAO,CAAC,mBAAmB;IA2C3B,OAAO,CAAC,mBAAmB;CAyB5B"}
|