@api-client/core 0.19.19 → 0.19.21
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/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/helpers/Intelisense.d.ts +1 -1
- package/build/src/modeling/helpers/Intelisense.d.ts.map +1 -1
- package/build/src/modeling/helpers/Intelisense.js +4 -2
- package/build/src/modeling/helpers/Intelisense.js.map +1 -1
- 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/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/tsconfig.tsbuildinfo +1 -1
- package/eslint.config.js +6 -0
- package/package.json +3 -1
- package/src/authorization/Utils.ts +3 -3
- 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/helpers/Intelisense.ts +4 -2
- 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/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/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/helpers/intellisense.spec.ts +1 -1
- package/tests/unit/modeling/validation/api_model_rules.spec.ts +113 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modeling/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { GraphJson } from '@api-client/graph/graph/types.js'\nimport type { Graph } from '@api-client/graph/graph/Graph.js'\nimport type { DomainAssociation } from './DomainAssociation.js'\nimport type { DomainEntity } from './DomainEntity.js'\nimport type { DomainModel } from './DomainModel.js'\nimport type { DomainNamespace } from './DomainNamespace.js'\nimport type { DomainProperty } from './DomainProperty.js'\nimport type {\n DomainNamespaceKind,\n DomainEntityKind,\n DomainModelKind,\n DomainPropertyKind,\n DomainAssociationKind,\n DataDomainKind,\n ExposedEntityKind,\n} from '../models/kinds.js'\nimport type { DataDomain } from './DataDomain.js'\nimport { AccessRuleSchema } from './rules/AccessRule.js'\nimport { RateLimitingConfigurationSchema } from './rules/RateLimitingConfiguration.js'\nimport { ActionSchema } from './actions/Action.js'\n\nexport interface DataDomainRemoveOptions {\n /**\n * When true, the object will be forcibly removed.\n * The resolution defined in the `ImpactResolution` class will be applied.\n *\n * For example, when removing an entity that is a parent to another entity, it will\n * removed itself as a parent from the child entity.\n *\n * Note, this option should only be used when the DomainImpactAnalysis has been performed\n * and the user was informed of the impact.\n */\n force?: boolean\n}\n\nexport interface DomainGraphEdge {\n /**\n * Indicates that the edge is to or from a foreign domain.\n */\n foreign?: boolean\n /**\n * The key of the foreign domain. Always set with the `foreign` property.\n */\n domain?: string\n /**\n * The type of the edge.\n * - `association` The edge is to an association object.\n * - When coming **from** an entity (the `v` property), that entity owns the association.\n * - When coming **to** an entity (the `w` property), that entity is the target of the association.\n * An association can have multiple targets.\n * - `property` The edge is to a property object. Can only be created between an entity and a property.\n * - The **from** (`v`) is the entity.\n * - The **to** (`w`) is the property.\n * - `parent` The edge is to a parent object.\n * - The **from** (`v`) is the child entity.\n * - The **to** (`w`) is the parent entity.\n */\n type: 'association' | 'property' | 'parent'\n}\n\nexport type DomainGraphNodeType = DomainNamespace | DomainModel | DomainEntity | DomainProperty | DomainAssociation\n\n/**\n * An interface that describes the data domain dependency.\n */\nexport interface ForeignDomainDependency {\n /**\n * The system registered key of the foreign domain.\n */\n key: string\n /**\n * The version of the foreign domain used in this domain.\n */\n version: string\n}\n\nexport interface AssociationTarget {\n /**\n * The key of the target entity.\n */\n key: string\n /**\n * The key of the target data domain.\n * This is only set when the target is in a different data domain.\n */\n domain?: string\n}\n\n/**\n * Describes the default value set on a property schema.\n */\nexport interface SchemaDefaultValue {\n /**\n * The type of the default value.\n *\n * - `literal` The `value` should be used as-is.\n * - `function` The value represents the name of the function to be used.\n */\n type: 'literal' | 'function'\n /**\n * The actual value type depends on the `type`.\n * It is always a string and it has to be casted to the property's data type.\n */\n value: string\n}\n\n/**\n * A general schema definition for a property.\n * This is propagated to all bindings (when they support these properties).\n */\nexport interface PropertySchema {\n /**\n * The minimum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMinimum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n minimum?: number\n /**\n * The maximum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMaximum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n maximum?: number\n /**\n * When set, the minimum value is exclusive.\n *\n * - When `false`: value ≥ minimum.\n * - When `true`: value > minimum.\n */\n exclusiveMinimum?: boolean\n /**\n * When set, the exclusiveMaximum value is exclusive.\n *\n * - When `false`: value ≤ maximum.\n * - When `true`: value < minimum.\n */\n exclusiveMaximum?: boolean\n /**\n * The multiplier value for a number scalar.\n *\n * Examples:\n * - if `1` then every integer is allowed\n * - if `2` than every even number is allowed\n * - if `0.5` than every number dividable by `0.5` is allowed\n */\n multipleOf?: number\n /**\n * The enum values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n enum?: string[]\n /**\n * The default value for the property.\n * This is always encoded as a string. The actual type is defined in the `dataType` property.\n */\n defaultValue?: SchemaDefaultValue\n /**\n * The example values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n examples?: string[]\n /**\n * The pattern to use with a string scalar.\n */\n pattern?: string\n}\n\n/**\n * The shortcut type for the data domain graph.\n */\nexport type DataDomainGraph = Graph<unknown, DomainGraphNodeType, DomainGraphEdge>\n/**\n * The serialized version of the data domain graph.\n */\nexport type SerializedGraph = GraphJson<unknown, object, DomainGraphEdge>\n\n/**\n * Represents a standardized, machine-readable error response body\n * as defined by RFC 7807 for HTTP APIs.\n */\nexport interface ProblemDetails {\n /**\n * A URI that identifies the specific problem type. Should resolve to human-readable docs.\n * e.g., \"https://docs.apinow.app/errors/validation-failed\"\n */\n type: string\n\n /**\n * A short, human-readable summary of the problem type.\n * e.g., \"Validation Error\"\n */\n title: string\n\n /**\n * The HTTP status code generated by the origin server for this problem.\n */\n status?: number\n\n /**\n * A human-readable explanation specific to this occurrence of the problem.\n */\n detail?: string\n\n /**\n * A URI that identifies the specific occurrence of the problem.\n * Can be the API request path that caused the error.\n */\n instance: string\n}\n\n/**\n * The set of supported filter operators for the List action.\n * These are used in query parameters, e.g., ?price[gte]=100\n *\n * - eq: Equal\n * - nq: Not Equal\n * - lt: Less Than\n * - lte: Less Than or Equal\n * - gt: Greater Than\n * - gte: Greater Than or Equal\n * - ex: Checks if the field exists\n * - re: Regular expression match\n * - bf: Date before a specific value\n * - af: Date after a specific value\n * - cn: String contains substring / Array contains element\n * - st: String starts with\n * - end: String ends with\n * - in: Value is one of the elements in the provided array\n * - nin: Value is not one of the elements in the provided array\n */\nexport type ResourceFilterOperator =\n | 'eq' // Equal\n | 'nq' // Not equal\n | 'lt' // Less than\n | 'lte' // Less than or equal\n | 'gt' // Greater than\n | 'gte' // Greater than or equal\n | 'ex' // Checks if the field exists\n | 're' // Regular expression match\n | 'bf' // Date before a specific value\n | 'af' // Date after a specific value\n | 'cn' // String contains substring / Array contains element\n | 'st' // String starts with\n | 'end' // String ends with\n | 'in' // Value is one of the elements in the provided array\n | 'nin' // Value is not one of the elements in the provided array\n\n/**\n * The session transport configuration interface.\n * This defines the properties that are common to all session transports.\n */\ninterface SessionTransport {\n /**\n * Whether the session transport is enabled.\n */\n enabled: boolean\n /**\n * The kind of session transport. Each interface defines its own kind.\n */\n kind: string\n}\n\n/**\n * Configuration for cookie-based session transport.\n */\nexport interface CookieConfiguration extends SessionTransport {\n kind: 'cookie'\n /**\n * The lifetime of the cookie session.\n * This is a string representing the duration, e.g., \"7d\" for 7 days or \"24h\" for 24 hours.\n *\n * @default \"7d\"\n */\n lifetime: string\n /**\n * Whether the cookie can only be accessed by the server.\n * This is a security feature to prevent client-side scripts from accessing the cookie.\n * If set to false, the cookie can be accessed by client-side scripts.\n * @default true\n */\n httpOnly: boolean // Defaults to true\n /**\n * Whether the cookie should only be sent over secure connections (HTTPS).\n * This is a security feature to prevent the cookie from being sent over unencrypted connections.\n * @default true\n */\n secure: boolean\n /**\n * The SameSite attribute of the cookie.\n * This attribute controls whether the cookie is sent with cross-site requests.\n * - 'none' means the cookie is sent with cross-site requests.\n * - 'lax' means the cookie is sent with top-level navigations and will be sent along with GET\n * requests initiated by third-party websites.\n * @default 'none'\n */\n sameSite: 'none' | 'lax'\n /**\n * The name of the cookie.\n * This is the key under which the session data will be stored in the cookie.\n * @default 'as' - 'as' stands for \"api session\"\n */\n name: string\n}\n\n/**\n * Configuration for JWT-based session transport.\n */\nexport interface JwtConfiguration extends SessionTransport {\n kind: 'jwt'\n /**\n * The lifetime of the JWT token.\n * This is a string representing the duration, e.g., \"7d\" for 7 days or \"15m\" for 15 minutes.\n *\n * @default \"7d\"\n */\n lifetime: string\n}\n\nexport interface SessionConfiguration {\n /**\n * The secret used to sign the JWT and cookies. Should be handled securely.\n * Not visible in the UI after being set.\n */\n secret: string\n /**\n * The properties from the `User` entity to be encoded into the session payload (JWT/cookie).\n * These properties become available in the `request.auth` object at runtime.\n *\n * In practice, these are the ids of the properties in the `User` entity.\n */\n properties: string[]\n /**\n * The cookie-based session transport configuration.\n */\n cookie?: CookieConfiguration\n\n /**\n * The JWT-based session transport configuration.\n */\n jwt?: JwtConfiguration\n}\n\n/**\n * Defines the authorization strategy for the API.\n * It is a base interface that can be extended for different strategies.\n * For MVP, we will start with Roles-Based Access Control (RBAC).\n */\nexport interface AuthorizationConfiguration {\n /**\n * The authorization strategy. For MVP, we will start with RBAC.\n * Post-MVP will include Permission-Based Access Control (PBAC).\n * The strategy determines how users are granted access to resources.\n *\n * - RBAC (Roles-Based Access Control): Users are assigned roles, and permissions are granted to those roles.\n * - PBAC (Permission-Based Access Control): Users are granted permissions directly, allowing for more\n * granular control.\n */\n strategy: string\n}\n\nexport interface RolesBasedAccessControl extends AuthorizationConfiguration {\n strategy: 'RBAC'\n /**\n * The property within the designated \"User\" entity that defines the user's role.\n * This field is used in access rules to grant permissions.\n *\n * This property must be marked with the \"Role\" data semantic in the Data Modeler.\n * It is required to publish the API.\n */\n roleKey: string\n}\n\n/**\n * Configures the strategy for authenticating end-users.\n * An API can only support one authentication strategy at a time.\n * This is a base interface that can be extended for different strategies.\n */\nexport interface AuthenticationConfiguration {\n /**\n * The authentication method. For MVP, this is focused on username/password.\n * This can be extended in the future to include 'SSO'.\n */\n strategy: string\n}\n\n/**\n * Configuration for username/password authentication.\n * This is the primary authentication method for the API (MVP).\n */\nexport interface UsernamePasswordConfiguration extends AuthenticationConfiguration {\n strategy: 'UsernamePassword'\n /**\n * The specific property within the User entity that holds the password.\n * This property must be marked with the \"Password\" data semantic in the Data Modeler.\n *\n * This property is required to publish the API.\n */\n passwordKey?: string\n}\n\n/**\n * Represents a Data Entity from the Data Domain that the API will expose and operate upon.\n */\nexport interface ExposedEntitySchema {\n kind: typeof ExposedEntityKind\n /**\n * The unique identifier for this exposure instance.\n * In the exposure model, we need to uniquely identify each exposure instance, because\n * an entity can be exposed multiple times in different contexts. Consider the following structure:\n *\n * ```\n * /categories/{categoryId}\n * /products/{productId}/categories\n * /products/{productId}/categories/{categoryId}\n * /promotions/{promotionId}/categories\n * /promotions/{promotionId}/categories/{categoryId}\n * ```\n *\n * The `category` entity would be exposed multiple times (as root and nested under products and promotions).\n * We need a way to distinguish between these different exposure instances.\n */\n key: string\n /**\n * A pointer to a Data Entity from the Data Domain.\n */\n entity: AssociationTarget\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 hasCollection: boolean\n /**\n * A 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 collectionPath?: string\n\n /**\n * A 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 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 isRoot?: boolean\n\n /**\n * Parent reference when this exposure was created via following an association.\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 exposeOptions?: ExposeOptions\n\n /**\n * The list of enabled API actions for this exposure (List/Read/Create/etc.)\n */\n actions: ActionSchema[]\n\n /**\n * Optional array of access rules that define the access control policies for this exposure.\n */\n accessRule?: AccessRuleSchema[]\n\n /**\n * Optional configuration for rate limiting for this exposure.\n */\n rateLimiting?: RateLimitingConfigurationSchema\n\n /**\n * When true, generation for this exposure hit configured limits\n */\n truncated?: boolean\n}\n\n/**\n * Parent reference stored on a nested exposure\n */\nexport interface ExposeParentRef {\n /**\n * The key of the parent exposed entity. This references the `ExposedEntity.key` property.\n */\n key: string\n /**\n * The association from the parent that produced this exposure.\n * A sub-entity must always have a parent association.\n */\n association: AssociationTarget\n /**\n * The numeric depth from the root exposure (root = 0)\n */\n depth?: number\n}\n\n/**\n * Options passed when creating a new exposure\n */\nexport interface ExposeOptions {\n /**\n * Whether to follow associations when creating the exposure.\n * When not set, it only exposes the passed entity.\n */\n followAssociations?: boolean\n /**\n * The maximum depth to follow associations when creating the exposure.\n */\n maxDepth?: number\n}\n\n/**\n * Represents a pagination strategy for API actions that return collections of resources.\n * This is a base interface that can be extended for different pagination strategies.\n */\nexport interface PaginationStrategy {\n /**\n * The kind of pagination strategy. This is used to identify the specific pagination method.\n * For example, 'cursor' for cursor-based pagination or 'offset' for offset-based pagination.\n */\n kind: string\n /**\n * The default page size for the pagination strategy.\n * This is the number of items returned per page when no specific page size is requested.\n */\n pageSize?: number\n}\n\n/**\n * Represents the cursor-based pagination strategy.\n */\nexport interface CursorPaginationStrategy extends PaginationStrategy {\n kind: 'cursor'\n}\n\n/**\n * Represents the offset-based pagination strategy.\n */\nexport interface OffsetPaginationStrategy extends PaginationStrategy {\n kind: 'offset'\n}\n\nexport type DomainImpactKinds =\n | typeof DomainNamespaceKind\n | typeof DomainEntityKind\n | typeof DomainModelKind\n | typeof DomainPropertyKind\n | typeof DomainAssociationKind\n | typeof DataDomainKind\n\n/**\n * The impact analysis report\n */\nexport interface DomainImpactReport {\n /**\n * The key of the impacted data object.\n * This is the key of the object that is being changed.\n */\n key: string\n /**\n * The kind of the impacted data object.\n * This is the kind of the object that is being changed.\n */\n kind: DomainImpactKinds\n /**\n * The list of impacted data objects.\n */\n impact: DomainImpactItem[]\n /**\n * Whether it is possible to proceed with the change.\n * If the change is not possible, the reason will be in the impact list.\n */\n canProceed: boolean\n}\n\nexport interface DomainImpactItem {\n /**\n * The key of the impacted data object.\n */\n key: string\n /**\n * The kind of the impacted data object.\n */\n kind: string\n /**\n * The type of the impact.\n *\n * - `delete` - The data object would be deleted.\n */\n type: 'delete' | 'publish'\n /**\n * The impact description.\n * Explains what will happen to the impacted data object.\n * This is a human-readable description of the impact.\n * It should be clear and concise.\n */\n impact: string\n /**\n * The severity of the impact.\n *\n * - `info` - The impact is informational.\n * - `warning` - The impact can potentially cause problems but is not a blocker.\n * - `error` - The impact is a blocker and needs to be resolved before proceeding.\n */\n severity: 'info' | 'warning' | 'error'\n /**\n * The type of the relationship between two impacted objects.\n */\n relationship?: 'child'\n /**\n * The resolution of the conflict if the change will be forced.\n */\n resolution?: string\n /**\n * The optional parent of the impacted data object.\n * For example, if the impacted item is a property, this will be the entity it belongs to.\n */\n parent?: string\n}\n\nexport interface DeserializeOptions {\n /**\n * The mode to use for deserialization.\n */\n mode?: DeserializationMode\n /**\n * The serialized graph to deserialize.\n * This is the JSON representation of the graph.\n */\n json?: SerializedGraph\n /**\n * The list of foreign domains that this domain depends on.\n */\n dependencies?: DataDomain[]\n}\n\n/**\n * Describes the mode for deserializing a domain graph.\n */\nexport type DeserializationMode = 'strict' | 'lenient'\n\n/**\n * Describes an issue found during deserialization.\n */\nexport interface DeserializationIssue {\n /**\n * The type of issue encountered.\n */\n type: 'missing_node' | 'missing_edge' | 'invalid_parent' | 'missing_dependency' | 'malformed_entry' | 'unknown_kind'\n /**\n * The severity of the issue.\n */\n severity: 'error' | 'warning' | 'info'\n /**\n * A human-readable description of the issue.\n */\n message: string\n /**\n * The key of the affected node, edge, or entity if applicable.\n */\n affectedKey?: string\n /**\n * Additional context about the issue.\n */\n context?: Record<string, unknown>\n /**\n * The action taken to handle this issue in lenient mode.\n */\n resolution?: string\n}\n\n/**\n * The result of a deserialization operation.\n */\nexport interface DeserializationResult {\n /**\n * The deserialized graph.\n */\n graph: DataDomainGraph\n /**\n * Issues encountered during deserialization.\n */\n issues: DeserializationIssue[]\n /**\n * Whether the deserialization was successful.\n * This is set to true when a critical failures occurred.\n */\n success: boolean\n}\n\n/**\n * Available node types for search filtering.\n */\nexport type SearchableNodeType =\n | typeof DomainNamespaceKind\n | typeof DomainModelKind\n | typeof DomainEntityKind\n | typeof DomainPropertyKind\n | typeof DomainAssociationKind\n\n/**\n * Search criteria for filtering domain nodes.\n */\nexport interface DomainSearchCriteria {\n /**\n * Text query to search for in name, displayName, and description fields.\n * Can be a string for exact match or RegExp for pattern matching.\n */\n query?: string | RegExp\n\n /**\n * Filter by specific node types. If not provided, all node types are included.\n */\n nodeTypes?: SearchableNodeType[]\n\n /**\n * Whether to include nodes from foreign domains in the search results.\n * Defaults to false.\n */\n includeForeignDomains?: boolean\n\n /**\n * Case-sensitive search when using string query.\n * Defaults to false (case-insensitive).\n */\n caseSensitive?: boolean\n}\n\n/**\n * A search result containing a matching domain node and metadata.\n */\nexport interface DomainSearchResult {\n /**\n * The matching domain node.\n */\n node: DomainGraphNodeType\n\n /**\n * The field(s) that matched the search query.\n */\n matchedFields: ('name' | 'displayName' | 'description')[]\n\n /**\n * The key used to identify this node in the graph.\n */\n key: string\n\n /**\n * Whether this node belongs to a foreign domain.\n */\n isForeign: boolean\n}\n\n/**\n * Contextual information about where the API Model validation issue occurred.\n * This allows the UI to trace back a validation error to a specific module or component.\n */\nexport interface ApiModelValidationContext {\n /**\n * The key of the ApiModel itself.\n */\n apiModelKey: string\n /**\n * The kind of the affected component (e.g., 'ApiModel', 'ExposedEntity', 'Action').\n */\n kind: string\n /**\n * The key of the specific entity or action where the issue occurred.\n * If the error is at the root API model, this might be the ApiModel's key.\n */\n key: string\n /**\n * The specific property being validated, if applicable.\n */\n property?: string\n /**\n * The key of the parent ExposedEntity, if this issue occurred on a nested entity or an action.\n */\n parentExposedEntityKey?: string\n}\n\n/**\n * Represents a single validation issue found within an ApiModel.\n */\nexport interface ApiModelValidationItem {\n /**\n * A unique code identifying the type of validation error. This enables\n * programmatic handling or auto-fixing in the UI (e.g., 'API_MISSING_NAME', 'LIST_ACTION_MISSING_PAGINATION').\n */\n code: string\n /**\n * A human-readable description of the problem.\n */\n message: string\n /**\n * A human-readable suggestion on how to fix the issue.\n */\n suggestion: string\n /**\n * The severity of the validation issue.\n */\n severity: 'error' | 'warning' | 'info'\n /**\n * Contextual information to trace the issue back to its source component.\n */\n context: ApiModelValidationContext\n}\n\n/**\n * The consolidated result of validating an entire ApiModel or a subset of it.\n */\nexport interface ApiModelValidationResult {\n /**\n * A boolean indicating whether the model is structurally sound and ready for publication.\n * Typically true if there are no 'error' severity issues.\n */\n isValid: boolean\n /**\n * The aggregated list of all validation issues found.\n */\n issues: ApiModelValidationItem[]\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modeling/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { GraphJson } from '@api-client/graph/graph/types.js'\nimport type { Graph } from '@api-client/graph/graph/Graph.js'\nimport type { DomainAssociation } from './DomainAssociation.js'\nimport type { DomainEntity } from './DomainEntity.js'\nimport type { DomainModel } from './DomainModel.js'\nimport type { DomainNamespace } from './DomainNamespace.js'\nimport type { DomainProperty } from './DomainProperty.js'\nimport type {\n DomainNamespaceKind,\n DomainEntityKind,\n DomainModelKind,\n DomainPropertyKind,\n DomainAssociationKind,\n DataDomainKind,\n ExposedEntityKind,\n} from '../models/kinds.js'\nimport type { DataDomain } from './DataDomain.js'\nimport { AccessRuleSchema } from './rules/AccessRule.js'\nimport { RateLimitingConfigurationSchema } from './rules/RateLimitingConfiguration.js'\nimport { ActionSchema } from './actions/Action.js'\n\nexport interface DataDomainRemoveOptions {\n /**\n * When true, the object will be forcibly removed.\n * The resolution defined in the `ImpactResolution` class will be applied.\n *\n * For example, when removing an entity that is a parent to another entity, it will\n * removed itself as a parent from the child entity.\n *\n * Note, this option should only be used when the DomainImpactAnalysis has been performed\n * and the user was informed of the impact.\n */\n force?: boolean\n}\n\nexport interface DomainGraphEdge {\n /**\n * Indicates that the edge is to or from a foreign domain.\n */\n foreign?: boolean\n /**\n * The key of the foreign domain. Always set with the `foreign` property.\n */\n domain?: string\n /**\n * The type of the edge.\n * - `association` The edge is to an association object.\n * - When coming **from** an entity (the `v` property), that entity owns the association.\n * - When coming **to** an entity (the `w` property), that entity is the target of the association.\n * An association can have multiple targets.\n * - `property` The edge is to a property object. Can only be created between an entity and a property.\n * - The **from** (`v`) is the entity.\n * - The **to** (`w`) is the property.\n * - `parent` The edge is to a parent object.\n * - The **from** (`v`) is the child entity.\n * - The **to** (`w`) is the parent entity.\n */\n type: 'association' | 'property' | 'parent'\n}\n\nexport type DomainGraphNodeType = DomainNamespace | DomainModel | DomainEntity | DomainProperty | DomainAssociation\n\n/**\n * An interface that describes the data domain dependency.\n */\nexport interface ForeignDomainDependency {\n /**\n * The system registered key of the foreign domain.\n */\n key: string\n /**\n * The version of the foreign domain used in this domain.\n */\n version: string\n}\n\nexport interface AssociationTarget {\n /**\n * The key of the target entity.\n */\n key: string\n /**\n * The key of the target data domain.\n * This is only set when the target is in a different data domain.\n */\n domain?: string\n}\n\n/**\n * Describes the default value set on a property schema.\n */\nexport interface SchemaDefaultValue {\n /**\n * The type of the default value.\n *\n * - `literal` The `value` should be used as-is.\n * - `function` The value represents the name of the function to be used.\n */\n type: 'literal' | 'function'\n /**\n * The actual value type depends on the `type`.\n * It is always a string and it has to be casted to the property's data type.\n */\n value: string\n}\n\n/**\n * A general schema definition for a property.\n * This is propagated to all bindings (when they support these properties).\n */\nexport interface PropertySchema {\n /**\n * The minimum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMinimum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n minimum?: number\n /**\n * The maximum value of the property.\n *\n * By default it is inclusive value. Use the `exclusiveMaximum` property to make it exclusive.\n *\n * Used with:\n * - string\n * - number\n * - date\n * - time\n * - datetime\n */\n maximum?: number\n /**\n * When set, the minimum value is exclusive.\n *\n * - When `false`: value ≥ minimum.\n * - When `true`: value > minimum.\n */\n exclusiveMinimum?: boolean\n /**\n * When set, the exclusiveMaximum value is exclusive.\n *\n * - When `false`: value ≤ maximum.\n * - When `true`: value < minimum.\n */\n exclusiveMaximum?: boolean\n /**\n * The multiplier value for a number scalar.\n *\n * Examples:\n * - if `1` then every integer is allowed\n * - if `2` than every even number is allowed\n * - if `0.5` than every number dividable by `0.5` is allowed\n */\n multipleOf?: number\n /**\n * The enum values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n enum?: string[]\n /**\n * The default value for the property.\n * This is always encoded as a string. The actual type is defined in the `dataType` property.\n */\n defaultValue?: SchemaDefaultValue\n /**\n * The example values for the property.\n * They are always encoded as strings. The actual type is defined in the `dataType` property.\n */\n examples?: string[]\n /**\n * The pattern to use with a string scalar.\n */\n pattern?: string\n}\n\n/**\n * The shortcut type for the data domain graph.\n */\nexport type DataDomainGraph = Graph<unknown, DomainGraphNodeType, DomainGraphEdge>\n/**\n * The serialized version of the data domain graph.\n */\nexport type SerializedGraph = GraphJson<unknown, object, DomainGraphEdge>\n\n/**\n * Represents a standardized, machine-readable error response body\n * as defined by RFC 7807 for HTTP APIs.\n */\nexport interface ProblemDetails {\n /**\n * A URI that identifies the specific problem type. Should resolve to human-readable docs.\n * e.g., \"https://docs.apinow.app/errors/validation-failed\"\n */\n type: string\n\n /**\n * A short, human-readable summary of the problem type.\n * e.g., \"Validation Error\"\n */\n title: string\n\n /**\n * The HTTP status code generated by the origin server for this problem.\n */\n status?: number\n\n /**\n * A human-readable explanation specific to this occurrence of the problem.\n */\n detail?: string\n\n /**\n * A URI that identifies the specific occurrence of the problem.\n * Can be the API request path that caused the error.\n */\n instance: string\n}\n\n/**\n * The set of supported filter operators for the List and search action.\n * These are used in query parameters, e.g., ?price[gte]=100\n *\n * - eq: Equal\n * - neq: Not Equal\n * - in: Value is one of the elements in the provided array\n * - nin: Value is not one of the elements in the provided array\n * - lt: Less Than\n * - lte: Less Than or Equal\n * - gt: Greater Than\n * - gte: Greater Than or Equal\n * - exists: Checks if the field exists\n *\n * Search filters only:\n * - contains: String contains substring / Array contains element (Substring Match)\n * - match: Lexical Match, multi-word queries against long text.\n */\nexport type ResourceFilterOperator =\n | 'eq' // Equal\n | 'neq' // Not equal\n | 'in' // Value is one of the elements in the provided array\n | 'nin' // Value is not one of the elements in the provided array\n | 'lt' // Less than\n | 'lte' // Less than or equal\n | 'gt' // Greater than\n | 'gte' // Greater than or equal\n | 'exists' // Checks if the field exists\n | 'contains' // String contains substring / Array contains element (Substring Match)\n | 'match' // Lexical Match, multi-word queries against long text.\n\n/**\n * The session transport configuration interface.\n * This defines the properties that are common to all session transports.\n */\ninterface SessionTransport {\n /**\n * Whether the session transport is enabled.\n */\n enabled: boolean\n /**\n * The kind of session transport. Each interface defines its own kind.\n */\n kind: string\n}\n\n/**\n * Configuration for cookie-based session transport.\n */\nexport interface CookieConfiguration extends SessionTransport {\n kind: 'cookie'\n /**\n * The lifetime of the cookie session.\n * This is a string representing the duration, e.g., \"7d\" for 7 days or \"24h\" for 24 hours.\n *\n * @default \"7d\"\n */\n lifetime: string\n /**\n * Whether the cookie can only be accessed by the server.\n * This is a security feature to prevent client-side scripts from accessing the cookie.\n * If set to false, the cookie can be accessed by client-side scripts.\n * @default true\n */\n httpOnly: boolean // Defaults to true\n /**\n * Whether the cookie should only be sent over secure connections (HTTPS).\n * This is a security feature to prevent the cookie from being sent over unencrypted connections.\n * @default true\n */\n secure: boolean\n /**\n * The SameSite attribute of the cookie.\n * This attribute controls whether the cookie is sent with cross-site requests.\n * - 'none' means the cookie is sent with cross-site requests.\n * - 'lax' means the cookie is sent with top-level navigations and will be sent along with GET\n * requests initiated by third-party websites.\n * @default 'none'\n */\n sameSite: 'none' | 'lax'\n /**\n * The name of the cookie.\n * This is the key under which the session data will be stored in the cookie.\n * @default 'as' - 'as' stands for \"api session\"\n */\n name: string\n}\n\n/**\n * Configuration for JWT-based session transport.\n */\nexport interface JwtConfiguration extends SessionTransport {\n kind: 'jwt'\n /**\n * The lifetime of the JWT token.\n * This is a string representing the duration, e.g., \"7d\" for 7 days or \"15m\" for 15 minutes.\n *\n * @default \"7d\"\n */\n lifetime: string\n}\n\nexport interface SessionConfiguration {\n /**\n * The secret used to sign the JWT and cookies. Should be handled securely.\n * Not visible in the UI after being set.\n */\n secret: string\n /**\n * The properties from the `User` entity to be encoded into the session payload (JWT/cookie).\n * These properties become available in the `request.auth` object at runtime.\n *\n * In practice, these are the ids of the properties in the `User` entity.\n */\n properties: string[]\n /**\n * The cookie-based session transport configuration.\n */\n cookie?: CookieConfiguration\n\n /**\n * The JWT-based session transport configuration.\n */\n jwt?: JwtConfiguration\n}\n\n/**\n * Defines the authorization strategy for the API.\n * It is a base interface that can be extended for different strategies.\n * For MVP, we will start with Roles-Based Access Control (RBAC).\n */\nexport interface AuthorizationConfiguration {\n /**\n * The authorization strategy. For MVP, we will start with RBAC.\n * Post-MVP will include Permission-Based Access Control (PBAC).\n * The strategy determines how users are granted access to resources.\n *\n * - RBAC (Roles-Based Access Control): Users are assigned roles, and permissions are granted to those roles.\n * - PBAC (Permission-Based Access Control): Users are granted permissions directly, allowing for more\n * granular control.\n */\n strategy: string\n}\n\nexport interface RolesBasedAccessControl extends AuthorizationConfiguration {\n strategy: 'RBAC'\n /**\n * The property within the designated \"User\" entity that defines the user's role.\n * This field is used in access rules to grant permissions.\n *\n * This property must be marked with the \"Role\" data semantic in the Data Modeler.\n * It is required to publish the API.\n */\n roleKey: string\n}\n\nexport type AuthorizationStrategy = RolesBasedAccessControl\n\n/**\n * Configures the strategy for authenticating end-users.\n * An API can only support one authentication strategy at a time.\n * This is a base interface that can be extended for different strategies.\n */\nexport interface AuthenticationConfiguration {\n /**\n * The authentication method. For MVP, this is focused on username/password.\n * This can be extended in the future to include 'SSO'.\n */\n strategy: string\n}\n\n/**\n * Configuration for username/password authentication.\n * This is the primary authentication method for the API (MVP).\n */\nexport interface UsernamePasswordConfiguration extends AuthenticationConfiguration {\n strategy: 'UsernamePassword'\n /**\n * The specific property within the User entity that holds the password.\n * This property must be marked with the \"Password\" data semantic in the Data Modeler.\n *\n * This property is required to publish the API.\n */\n passwordKey?: string\n}\n\nexport type AuthenticationStrategy = UsernamePasswordConfiguration\n\n/**\n * Represents a Data Entity from the Data Domain that the API will expose and operate upon.\n */\nexport interface ExposedEntitySchema {\n kind: typeof ExposedEntityKind\n /**\n * The unique identifier for this exposure instance.\n * In the exposure model, we need to uniquely identify each exposure instance, because\n * an entity can be exposed multiple times in different contexts. Consider the following structure:\n *\n * ```\n * /categories/{categoryId}\n * /products/{productId}/categories\n * /products/{productId}/categories/{categoryId}\n * /promotions/{promotionId}/categories\n * /promotions/{promotionId}/categories/{categoryId}\n * ```\n *\n * The `category` entity would be exposed multiple times (as root and nested under products and promotions).\n * We need a way to distinguish between these different exposure instances.\n */\n key: string\n /**\n * A pointer to a Data Entity from the Data Domain.\n */\n entity: AssociationTarget\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 hasCollection: boolean\n /**\n * A 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 collectionPath?: string\n\n /**\n * A 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 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 isRoot?: boolean\n\n /**\n * Parent reference when this exposure was created via following an association.\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 exposeOptions?: ExposeOptions\n\n /**\n * The list of enabled API actions for this exposure (List/Read/Create/etc.)\n */\n actions: ActionSchema[]\n\n /**\n * Optional array of access rules that define the access control policies for this exposure.\n */\n accessRule?: AccessRuleSchema[]\n\n /**\n * Optional configuration for rate limiting for this exposure.\n */\n rateLimiting?: RateLimitingConfigurationSchema\n\n /**\n * When true, generation for this exposure hit configured limits\n */\n truncated?: boolean\n /**\n * Pagination contract for this exposure.\n */\n paginationContract?: PaginationContract\n}\n\n/**\n * Parent reference stored on a nested exposure\n */\nexport interface ExposeParentRef {\n /**\n * The key of the parent exposed entity. This references the `ExposedEntity.key` property.\n */\n key: string\n /**\n * The association from the parent that produced this exposure.\n * A sub-entity must always have a parent association.\n */\n association: AssociationTarget\n /**\n * The numeric depth from the root exposure (root = 0)\n */\n depth?: number\n}\n\n/**\n * Options passed when creating a new exposure\n */\nexport interface ExposeOptions {\n /**\n * Whether to follow associations when creating the exposure.\n * When not set, it only exposes the passed entity.\n */\n followAssociations?: boolean\n /**\n * The maximum depth to follow associations when creating the exposure.\n */\n maxDepth?: number\n}\n\n/**\n * Represents a pagination strategy for API actions that return collections of resources.\n * This is a base interface that can be extended for different pagination strategies.\n */\nexport interface PaginationStrategy {\n /**\n * The kind of pagination strategy. This is used to identify the specific pagination method.\n * For example, 'cursor' for cursor-based pagination or 'offset' for offset-based pagination.\n */\n kind: string\n /**\n * The default page size for the pagination strategy.\n * This is the number of items returned per page when no specific page size is requested.\n */\n defaultLimit?: number\n /**\n * The maximum page size for the pagination strategy.\n * This is the maximum number of items that can be returned per page.\n * The API runtime defined the upper limit to prevent abuse.\n */\n maxLimit?: number\n}\n\n/**\n * Represents the cursor-based pagination strategy.\n */\nexport interface CursorPaginationStrategy extends PaginationStrategy {\n kind: 'cursor'\n}\n\n/**\n * Represents the offset-based pagination strategy.\n */\nexport interface OffsetPaginationStrategy extends PaginationStrategy {\n kind: 'offset'\n}\n\n/**\n * Represents the contract for pagination. Defines which fields can be used for filtering, sorting,\n * and searching.\n */\nexport interface PaginationContract {\n /**\n * The list of fields (property keys) that can be used for filtering.\n */\n filterableFields: string[]\n /**\n * The list of fields (property keys) that can be used for sorting.\n */\n sortableFields: string[]\n /**\n * The list of fields (property keys) that can be used for searching.\n * Note that these properties must be of type string or array of strings.\n */\n searchableFields: string[]\n /**\n * The default sort order for the pagination strategy.\n * This is the sort order that will be used when no sort order is specified.\n */\n defaultSort?: { field: string; direction: 'asc' | 'desc' }[]\n}\n\nexport type DomainImpactKinds =\n | typeof DomainNamespaceKind\n | typeof DomainEntityKind\n | typeof DomainModelKind\n | typeof DomainPropertyKind\n | typeof DomainAssociationKind\n | typeof DataDomainKind\n\n/**\n * The impact analysis report\n */\nexport interface DomainImpactReport {\n /**\n * The key of the impacted data object.\n * This is the key of the object that is being changed.\n */\n key: string\n /**\n * The kind of the impacted data object.\n * This is the kind of the object that is being changed.\n */\n kind: DomainImpactKinds\n /**\n * The list of impacted data objects.\n */\n impact: DomainImpactItem[]\n /**\n * Whether it is possible to proceed with the change.\n * If the change is not possible, the reason will be in the impact list.\n */\n canProceed: boolean\n}\n\nexport interface DomainImpactItem {\n /**\n * The key of the impacted data object.\n */\n key: string\n /**\n * The kind of the impacted data object.\n */\n kind: string\n /**\n * The type of the impact.\n *\n * - `delete` - The data object would be deleted.\n */\n type: 'delete' | 'publish'\n /**\n * The impact description.\n * Explains what will happen to the impacted data object.\n * This is a human-readable description of the impact.\n * It should be clear and concise.\n */\n impact: string\n /**\n * The severity of the impact.\n *\n * - `info` - The impact is informational.\n * - `warning` - The impact can potentially cause problems but is not a blocker.\n * - `error` - The impact is a blocker and needs to be resolved before proceeding.\n */\n severity: 'info' | 'warning' | 'error'\n /**\n * The type of the relationship between two impacted objects.\n */\n relationship?: 'child'\n /**\n * The resolution of the conflict if the change will be forced.\n */\n resolution?: string\n /**\n * The optional parent of the impacted data object.\n * For example, if the impacted item is a property, this will be the entity it belongs to.\n */\n parent?: string\n}\n\nexport interface DeserializeOptions {\n /**\n * The mode to use for deserialization.\n */\n mode?: DeserializationMode\n /**\n * The serialized graph to deserialize.\n * This is the JSON representation of the graph.\n */\n json?: SerializedGraph\n /**\n * The list of foreign domains that this domain depends on.\n */\n dependencies?: DataDomain[]\n}\n\n/**\n * Describes the mode for deserializing a domain graph.\n */\nexport type DeserializationMode = 'strict' | 'lenient'\n\n/**\n * Describes an issue found during deserialization.\n */\nexport interface DeserializationIssue {\n /**\n * The type of issue encountered.\n */\n type: 'missing_node' | 'missing_edge' | 'invalid_parent' | 'missing_dependency' | 'malformed_entry' | 'unknown_kind'\n /**\n * The severity of the issue.\n */\n severity: 'error' | 'warning' | 'info'\n /**\n * A human-readable description of the issue.\n */\n message: string\n /**\n * The key of the affected node, edge, or entity if applicable.\n */\n affectedKey?: string\n /**\n * Additional context about the issue.\n */\n context?: Record<string, unknown>\n /**\n * The action taken to handle this issue in lenient mode.\n */\n resolution?: string\n}\n\n/**\n * The result of a deserialization operation.\n */\nexport interface DeserializationResult {\n /**\n * The deserialized graph.\n */\n graph: DataDomainGraph\n /**\n * Issues encountered during deserialization.\n */\n issues: DeserializationIssue[]\n /**\n * Whether the deserialization was successful.\n * This is set to true when a critical failures occurred.\n */\n success: boolean\n}\n\n/**\n * Available node types for search filtering.\n */\nexport type SearchableNodeType =\n | typeof DomainNamespaceKind\n | typeof DomainModelKind\n | typeof DomainEntityKind\n | typeof DomainPropertyKind\n | typeof DomainAssociationKind\n\n/**\n * Search criteria for filtering domain nodes.\n */\nexport interface DomainSearchCriteria {\n /**\n * Text query to search for in name, displayName, and description fields.\n * Can be a string for exact match or RegExp for pattern matching.\n */\n query?: string | RegExp\n\n /**\n * Filter by specific node types. If not provided, all node types are included.\n */\n nodeTypes?: SearchableNodeType[]\n\n /**\n * Whether to include nodes from foreign domains in the search results.\n * Defaults to false.\n */\n includeForeignDomains?: boolean\n\n /**\n * Case-sensitive search when using string query.\n * Defaults to false (case-insensitive).\n */\n caseSensitive?: boolean\n}\n\n/**\n * A search result containing a matching domain node and metadata.\n */\nexport interface DomainSearchResult {\n /**\n * The matching domain node.\n */\n node: DomainGraphNodeType\n\n /**\n * The field(s) that matched the search query.\n */\n matchedFields: ('name' | 'displayName' | 'description')[]\n\n /**\n * The key used to identify this node in the graph.\n */\n key: string\n\n /**\n * Whether this node belongs to a foreign domain.\n */\n isForeign: boolean\n}\n\n/**\n * Contextual information about where the API Model validation issue occurred.\n * This allows the UI to trace back a validation error to a specific module or component.\n */\nexport interface ApiModelValidationContext {\n /**\n * The key of the ApiModel itself.\n */\n apiModelKey: string\n /**\n * The kind of the affected component (e.g., 'ApiModel', 'ExposedEntity', 'Action').\n */\n kind: string\n /**\n * The key of the specific entity or action where the issue occurred.\n * If the error is at the root API model, this might be the ApiModel's key.\n */\n key: string\n /**\n * The specific property being validated, if applicable.\n */\n property?: string\n /**\n * The key of the parent ExposedEntity, if this issue occurred on a nested entity or an action.\n */\n parentExposedEntityKey?: string\n}\n\n/**\n * Represents a single validation issue found within an ApiModel.\n */\nexport interface ApiModelValidationItem {\n /**\n * A unique code identifying the type of validation error. This enables\n * programmatic handling or auto-fixing in the UI (e.g., 'API_MISSING_NAME', 'LIST_ACTION_MISSING_PAGINATION').\n */\n code: string\n /**\n * A human-readable description of the problem.\n */\n message: string\n /**\n * A human-readable suggestion on how to fix the issue.\n */\n suggestion: string\n /**\n * The severity of the validation issue.\n */\n severity: 'error' | 'warning' | 'info'\n /**\n * Contextual information to trace the issue back to its source component.\n */\n context: ApiModelValidationContext\n}\n\n/**\n * The consolidated result of validating an entire ApiModel or a subset of it.\n */\nexport interface ApiModelValidationResult {\n /**\n * A boolean indicating whether the model is structurally sound and ready for publication.\n * Typically true if there are no 'error' severity issues.\n */\n isValid: boolean\n /**\n * The aggregated list of all validation issues found.\n */\n issues: ApiModelValidationItem[]\n}\n"]}
|
|
@@ -9,6 +9,7 @@ export declare function validateApiModelInfo(model: ApiModel): ApiModelValidatio
|
|
|
9
9
|
export declare function validateApiModelDependency(model: ApiModel): ApiModelValidationItem[];
|
|
10
10
|
export declare function validateApiModelSecurity(model: ApiModel): ApiModelValidationItem[];
|
|
11
11
|
export declare function validateApiModelMetadata(model: ApiModel): ApiModelValidationItem[];
|
|
12
|
+
export declare function validateApiPagination(model: ApiModel): ApiModelValidationItem[];
|
|
12
13
|
export declare function validateAction(action: Action, parent: ExposedEntity, apiModelKey: string): ApiModelValidationItem[];
|
|
13
14
|
export declare function validateExposedEntity(entity: ExposedEntity, apiModel: ApiModel): ApiModelValidationItem[];
|
|
14
15
|
//# sourceMappingURL=api_model_rules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api_model_rules.d.ts","sourceRoot":"","sources":["../../../../src/modeling/validation/api_model_rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAMlD,OAAO,KAAK,EAAE,sBAAsB,EAA6B,MAAM,aAAa,CAAA;AAapF;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,GAAG,sBAAsB,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aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAG,sBAAsB,EAAE,CAiOzG"}
|
|
@@ -321,46 +321,63 @@ export function validateApiModelMetadata(model) {
|
|
|
321
321
|
}
|
|
322
322
|
return issues;
|
|
323
323
|
}
|
|
324
|
-
export function
|
|
324
|
+
export function validateApiPagination(model) {
|
|
325
325
|
const issues = [];
|
|
326
326
|
const context = {
|
|
327
|
-
apiModelKey,
|
|
328
|
-
kind:
|
|
329
|
-
key:
|
|
330
|
-
parentExposedEntityKey: parent.key,
|
|
327
|
+
apiModelKey: model.key,
|
|
328
|
+
kind: ApiModelKind,
|
|
329
|
+
key: model.key,
|
|
331
330
|
};
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
severity: 'error',
|
|
339
|
-
context: { ...context, property: 'pagination' },
|
|
340
|
-
});
|
|
331
|
+
// We only need pagination when the API contains at least one List or Search action
|
|
332
|
+
let validate = false;
|
|
333
|
+
for (const exposure of model.exposes.values()) {
|
|
334
|
+
if (exposure.actions.some((action) => ListAction.isListAction(action) || SearchAction.isSearchAction(action))) {
|
|
335
|
+
validate = true;
|
|
336
|
+
break;
|
|
341
337
|
}
|
|
342
|
-
|
|
343
|
-
|
|
338
|
+
}
|
|
339
|
+
if (!validate) {
|
|
340
|
+
return issues;
|
|
341
|
+
}
|
|
342
|
+
if (!model.pagination || !model.pagination.kind) {
|
|
343
|
+
issues.push({
|
|
344
|
+
code: createCode('API', 'MISSING_PAGINATION'),
|
|
345
|
+
message: 'The API must have a defined pagination strategy when it exposes List or Search actions.',
|
|
346
|
+
suggestion: 'Configure how results are loaded (e.g. by page or by a continuous cursor).',
|
|
347
|
+
severity: 'error',
|
|
348
|
+
context: { ...context, property: 'pagination' },
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
if (model.pagination.defaultLimit === undefined) {
|
|
344
353
|
issues.push({
|
|
345
|
-
code: createCode('
|
|
346
|
-
message: '
|
|
347
|
-
suggestion: '
|
|
348
|
-
severity: '
|
|
349
|
-
context,
|
|
354
|
+
code: createCode('API', 'MISSING_PAGINATION_DEFAULT_LIMIT'),
|
|
355
|
+
message: "The API doesn't have a defined default page limit when it exposes List or Search actions.",
|
|
356
|
+
suggestion: 'Set a default page limit for the pagination otherwise the API will use its default limit.',
|
|
357
|
+
severity: 'info',
|
|
358
|
+
context: { ...context, property: 'pagination.defaultLimit' },
|
|
350
359
|
});
|
|
351
360
|
}
|
|
352
|
-
|
|
353
|
-
if (SearchAction.isSearchAction(action)) {
|
|
354
|
-
if (!action.fields || action.fields.length === 0) {
|
|
361
|
+
if (model.pagination.maxLimit === undefined) {
|
|
355
362
|
issues.push({
|
|
356
|
-
code: createCode('
|
|
357
|
-
message: '
|
|
358
|
-
suggestion: '
|
|
359
|
-
severity: '
|
|
360
|
-
context: { ...context, property: '
|
|
363
|
+
code: createCode('API', 'MISSING_PAGINATION_MAX_LIMIT'),
|
|
364
|
+
message: "The API doesn't have a defined page size max limit when it exposes List or Search actions.",
|
|
365
|
+
suggestion: 'Set a max page size limit for the pagination otherwise the API will use its default max limit.',
|
|
366
|
+
severity: 'info',
|
|
367
|
+
context: { ...context, property: 'pagination.maxLimit' },
|
|
361
368
|
});
|
|
362
369
|
}
|
|
363
370
|
}
|
|
371
|
+
return issues;
|
|
372
|
+
}
|
|
373
|
+
export function validateAction(action, parent, apiModelKey) {
|
|
374
|
+
const issues = [];
|
|
375
|
+
const context = {
|
|
376
|
+
apiModelKey,
|
|
377
|
+
kind: 'Action',
|
|
378
|
+
key: action.kind, // Actions lack nanoids, kind represents its type
|
|
379
|
+
parentExposedEntityKey: parent.key,
|
|
380
|
+
};
|
|
364
381
|
if (DeleteAction.isDeleteAction(action)) {
|
|
365
382
|
if (!action.strategy) {
|
|
366
383
|
issues.push({
|
|
@@ -537,8 +554,14 @@ export function validateExposedEntity(entity, apiModel) {
|
|
|
537
554
|
});
|
|
538
555
|
}
|
|
539
556
|
else {
|
|
557
|
+
let hasSearch = false;
|
|
558
|
+
let hasList = false;
|
|
540
559
|
for (const action of entity.actions) {
|
|
541
560
|
issues.push(...validateAction(action, entity, apiModel.key));
|
|
561
|
+
if (SearchAction.isSearchAction(action))
|
|
562
|
+
hasSearch = true;
|
|
563
|
+
if (ListAction.isListAction(action))
|
|
564
|
+
hasList = true;
|
|
542
565
|
// Check inheritance of access rules
|
|
543
566
|
// For a rule to exist, it might be on the action, the exposure, any parent, or the apiModel.
|
|
544
567
|
let hasAuth = false;
|
|
@@ -568,6 +591,59 @@ export function validateExposedEntity(entity, apiModel) {
|
|
|
568
591
|
});
|
|
569
592
|
}
|
|
570
593
|
}
|
|
594
|
+
if (hasList || hasSearch) {
|
|
595
|
+
const contract = entity.paginationContract;
|
|
596
|
+
if (!contract) {
|
|
597
|
+
issues.push({
|
|
598
|
+
code: createCode('EXPOSURE', 'MISSING_PAGINATION_CONTRACT'),
|
|
599
|
+
message: 'The List or Search action needs a pagination contract.',
|
|
600
|
+
suggestion: 'Add a pagination contract to the exposed entity.',
|
|
601
|
+
severity: 'error',
|
|
602
|
+
context,
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
else {
|
|
606
|
+
if (hasList) {
|
|
607
|
+
if (!contract.filterableFields || contract.filterableFields.length === 0) {
|
|
608
|
+
issues.push({
|
|
609
|
+
code: createCode('EXPOSURE', 'LIST_MISSING_FILTERS'),
|
|
610
|
+
message: 'Listing all elements without filters could be overwhelming for large tables.',
|
|
611
|
+
suggestion: 'Select a few important fields to allow filtering.',
|
|
612
|
+
severity: 'warning',
|
|
613
|
+
context,
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
if (!contract.sortableFields || contract.sortableFields.length === 0) {
|
|
617
|
+
issues.push({
|
|
618
|
+
code: createCode('EXPOSURE', 'LIST_MISSING_SORTING'),
|
|
619
|
+
message: 'Listing all elements without sorting could be overwhelming for large tables.',
|
|
620
|
+
suggestion: 'Select a few important fields to allow sorting.',
|
|
621
|
+
severity: 'warning',
|
|
622
|
+
context,
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
if (hasSearch) {
|
|
627
|
+
// Search and technically be used for filtering.
|
|
628
|
+
const all = [];
|
|
629
|
+
if (Array.isArray(contract.searchableFields)) {
|
|
630
|
+
all.push(...contract.searchableFields);
|
|
631
|
+
}
|
|
632
|
+
if (Array.isArray(contract.filterableFields)) {
|
|
633
|
+
all.push(...contract.filterableFields);
|
|
634
|
+
}
|
|
635
|
+
if (!all.length) {
|
|
636
|
+
issues.push({
|
|
637
|
+
code: createCode('EXPOSURE', 'SEARCH_MISSING_FIELDS'),
|
|
638
|
+
message: 'Search action needs to know which fields to look in.',
|
|
639
|
+
suggestion: 'Select a few important fields to allow searching or full-text search.',
|
|
640
|
+
severity: 'warning',
|
|
641
|
+
context,
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
571
647
|
}
|
|
572
648
|
return issues;
|
|
573
649
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api_model_rules.js","sourceRoot":"","sources":["../../../../src/modeling/validation/api_model_rules.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAGzD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;;GAIG;AACH,SAAS,UAAU,CAAC,MAAc,EAAE,KAAa;IAC/C,OAAO,GAAG,MAAM,IAAI,KAAK,EAAE,CAAA;AAC7B,CAAC;AAED;;GAEG;AACH,M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AC,UAAU,CAAC,MAAM,GAAG,CAAC;gBAAE,OAAO,GAAG,IAAI,CAAA;YAErF,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE,UAAU,CAAC,QAAQ,EAAE,sBAAsB,CAAC;oBAClD,OAAO,EAAE,OAAO,MAAM,CAAC,IAAI,kFAAkF;oBAC7G,UAAU,EAAE,qDAAqD;oBACjE,QAAQ,EAAE,OAAO;oBACjB,kDAAkD;oBAClD,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,CAAC,IAAI,EAAE,sBAAsB,EAAE,MAAM,CAAC,GAAG,EAAE;iBAC9F,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import type { ApiModel } from '../ApiModel.js'\nimport type { ExposedEntity } from '../ExposedEntity.js'\nimport type { Action } from '../actions/Action.js'\nimport { ListAction } from '../actions/ListAction.js'\nimport { DeleteAction } from '../actions/DeleteAction.js'\nimport { UpdateAction } from '../actions/UpdateAction.js'\nimport { SearchAction } from '../actions/SearchAction.js'\nimport type { RolesBasedAccessControl, UsernamePasswordConfiguration } from '../types.js'\nimport type { ApiModelValidationItem, ApiModelValidationContext } from '../types.js'\nimport { ApiModelKind, ExposedEntityKind } from '../../models/kinds.js'\nimport { SemanticType } from '../Semantics.js'\n\n/**\n * Creates a unique validation code.\n * @param entity The entity type (e.g., 'API', 'EXPOSURE', 'ACTION')\n * @param issue The issue identifier (e.g., 'MISSING_NAME')\n */\nfunction createCode(entity: string, issue: string): string {\n return `${entity}_${issue}`\n}\n\n/**\n * Validates the core properties and metadata of an ApiModel.\n */\nexport function validateApiModelInfo(model: ApiModel): ApiModelValidationItem[] {\n const issues: ApiModelValidationItem[] = []\n const context: ApiModelValidationContext = {\n apiModelKey: model.key,\n kind: ApiModelKind,\n key: model.key,\n }\n\n if (model.kind !== ApiModelKind) {\n issues.push({\n code: createCode('API', 'INVALID_KIND'),\n message: 'The API model type is incorrect.',\n suggestion: 'Set the model type to \"ApiModel\".',\n severity: 'error',\n context: { ...context, property: 'kind' },\n })\n }\n\n if (!model.key || typeof model.key !== 'string' || model.key.trim() === '') {\n issues.push({\n code: createCode('API', 'MISSING_KEY'),\n message: 'The API model is missing a unique identifier.',\n suggestion: 'Provide a valid name to use as a unique identifier.',\n severity: 'error',\n context: { ...context, property: 'key' },\n })\n }\n\n if (!model.info || !model.info.name || model.info.name.trim() === '') {\n issues.push({\n code: createCode('API', 'MISSING_NAME'),\n message: 'The API model has no defined name.',\n suggestion: 'Provide a descriptive name for your API.',\n severity: 'error',\n context: { ...context, property: 'info.name' },\n })\n }\n\n if (!model.info || !model.info.description || model.info.description.trim() === '') {\n issues.push({\n code: createCode('API', 'MISSING_DESCRIPTION'),\n message: 'Adding a description helps others understand your API.',\n suggestion: 'Add a description to clarify the purpose of this API.',\n severity: 'warning',\n context: { ...context, property: 'info.description' },\n })\n }\n\n return issues\n}\n\nexport function validateApiModelDependency(model: ApiModel): ApiModelValidationItem[] {\n const issues: ApiModelValidationItem[] = []\n const context: ApiModelValidationContext = {\n apiModelKey: model.key,\n kind: ApiModelKind,\n key: model.key,\n }\n\n const domain = model.domain\n if (!domain) {\n issues.push({\n code: createCode('API', 'MISSING_DOMAIN'),\n message: 'No Data Domain is attached to the API.',\n suggestion: 'Select a Data Domain from the settings to power your API.',\n severity: 'error',\n context,\n })\n return issues // Can't validate version if it doesn't exist\n }\n\n if (!domain.info || !domain.info.version) {\n issues.push({\n code: createCode('API', 'MISSING_DOMAIN_VERSION'),\n message: 'The selected Data Domain is missing a version number.',\n suggestion: 'Specify a version for the attached Data Domain.',\n severity: 'error',\n context,\n })\n }\n\n return issues\n}\n\nexport function validateApiModelSecurity(model: ApiModel): ApiModelValidationItem[] {\n const issues: ApiModelValidationItem[] = []\n const context: ApiModelValidationContext = {\n apiModelKey: model.key,\n kind: ApiModelKind,\n key: model.key,\n }\n\n // Resolve User target\n const userEntity = model.domain && model.user ? model.domain.findEntity(model.user.key, model.user.domain) : undefined\n\n // Authentication\n if (!model.authentication) {\n issues.push({\n code: createCode('API', 'MISSING_AUTHENTICATION'),\n message: 'The API is missing authentication settings.',\n suggestion: 'Go to the security settings and configure how users authenticate.',\n severity: 'error',\n context: { ...context, property: 'authentication' },\n })\n } else if (model.authentication.strategy === 'UsernamePassword') {\n const auth = model.authentication as UsernamePasswordConfiguration\n if (!auth.passwordKey) {\n issues.push({\n code: createCode('API', 'MISSING_PASSWORD_KEY'),\n message: 'Username & Password authentication requires a specific field for the password.',\n suggestion:\n 'Select which field in your user profile should store the password. ' +\n 'The data domain model should have a password data semantic on that property.',\n severity: 'error',\n context: { ...context, property: 'authentication.passwordKey' },\n })\n } else if (userEntity) {\n const passwordProp = Array.from(userEntity.properties).find((p) => p.key === auth.passwordKey)\n if (passwordProp && !passwordProp.hasSemantic(SemanticType.Password)) {\n issues.push({\n code: createCode('API', 'MISSING_PASSWORD_SEMANTIC'),\n message: 'The selected password field is missing the Password data semantic.',\n suggestion: 'Go to the Data Modeler and add the \"Password\" semantic to this property.',\n severity: 'error',\n context: { ...context, property: 'authentication.passwordKey' },\n })\n }\n }\n\n if (userEntity) {\n const hasUsernameSemantic = Array.from(userEntity.properties).some(\n (p) => typeof p.hasSemantic === 'function' && p.hasSemantic(SemanticType.Username)\n )\n if (!hasUsernameSemantic) {\n issues.push({\n code: createCode('API', 'MISSING_USERNAME_SEMANTIC'),\n message: 'Username & Password authentication requires a field with the Username data semantic.',\n suggestion: 'Go to the Data Modeler and add the \"Username\" semantic to the property used for login.',\n severity: 'error',\n context: { ...context, property: 'user' },\n })\n }\n }\n }\n\n // Authorization\n if (!model.authorization) {\n issues.push({\n code: createCode('API', 'MISSING_AUTHORIZATION'),\n message: 'The API is missing authorization settings.',\n suggestion: 'Go to the security settings and configure how to handle user permissions.',\n severity: 'error',\n context: { ...context, property: 'authorization' },\n })\n } else if (model.authorization.strategy === 'RBAC') {\n const rbac = model.authorization as RolesBasedAccessControl\n if (!rbac.roleKey) {\n issues.push({\n code: createCode('API', 'MISSING_ROLE_KEY'),\n message: 'Role-based access control is selected but no role field has been defined.',\n suggestion: \"Select which field in your user profile determines the user's role.\",\n severity: 'error',\n context: { ...context, property: 'authorization.roleKey' },\n })\n } else if (userEntity) {\n const roleProp = Array.from(userEntity.properties).find((p) => p.key === rbac.roleKey)\n if (roleProp && !roleProp.hasSemantic(SemanticType.UserRole)) {\n issues.push({\n code: createCode('API', 'MISSING_ROLE_SEMANTIC'),\n message: 'The selected role field is missing the User Role data semantic.',\n suggestion: 'Go to the Data Modeler and add the \"User Role\" semantic to this property.',\n severity: 'error',\n context: { ...context, property: 'authorization.roleKey' },\n })\n }\n }\n }\n\n // Session\n if (!model.session) {\n issues.push({\n code: createCode('API', 'MISSING_SESSION'),\n message: 'The API is missing session configuration.',\n suggestion: 'Configure how user sessions will be handled.',\n severity: 'error',\n context: { ...context, property: 'session' },\n })\n } else {\n if (!model.session.secret) {\n issues.push({\n code: createCode('API', 'MISSING_SESSION_SECRET'),\n message: 'A secure encryption key is required for sessions.',\n suggestion: 'Provide a strong security key in the session settings.',\n severity: 'error',\n context: { ...context, property: 'session.secret' },\n })\n }\n\n if (!model.session.properties || model.session.properties.length === 0) {\n issues.push({\n code: createCode('API', 'MISSING_SESSION_PROPERTIES'),\n message: 'The session token needs to include at least one piece of user information, like an ID.',\n suggestion: 'Select fields that should be stored securely inside the session payload.',\n severity: 'error',\n context: { ...context, property: 'session.properties' },\n })\n } else if (model.authorization && model.authorization.strategy === 'RBAC') {\n const rbac = model.authorization as RolesBasedAccessControl\n if (rbac.roleKey && !model.session.properties.includes(rbac.roleKey)) {\n issues.push({\n code: createCode('API', 'MISSING_RBAC_SESSION_PROPERTY'),\n message: 'The user role must be included in the session data for permissions to work.',\n suggestion: 'Make sure your selected role field is checked in the session settings.',\n severity: 'error',\n context: { ...context, property: 'session.properties' },\n })\n }\n }\n\n const { cookie, jwt } = model.session\n if ((!cookie || !cookie.enabled) && (!jwt || !jwt.enabled)) {\n issues.push({\n code: createCode('API', 'MISSING_SESSION_TRANSPORT'),\n message: 'No delivery method for sessions (like cookies or tokens) is enabled.',\n suggestion: 'Enable at least one session delivery mechanism in the security settings.',\n severity: 'error',\n context: { ...context, property: 'session' },\n })\n }\n }\n\n // User Target\n if (!model.user) {\n issues.push({\n code: createCode('API', 'MISSING_USER_ENTITY'),\n message: 'You need to specify what kind of object represents your users.',\n suggestion: 'Select a model from your domain that stores your user accounts.',\n severity: 'error',\n context: { ...context, property: 'user' },\n })\n } else if (model.domain && !model.domain.findEntity(model.user.key, model.user.domain)) {\n issues.push({\n code: createCode('API', 'INVALID_USER_ENTITY'),\n message: 'The selected user model no longer exists in your data domain.',\n suggestion: 'Please navigate to security settings and select a valid user model.',\n severity: 'error',\n context: { ...context, property: 'user' },\n })\n }\n\n return issues\n}\n\nexport function validateApiModelMetadata(model: ApiModel): ApiModelValidationItem[] {\n const issues: ApiModelValidationItem[] = []\n const context: ApiModelValidationContext = {\n apiModelKey: model.key,\n kind: ApiModelKind,\n key: model.key,\n }\n\n const urlRegex = /^https?:\\/\\//i\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\n\n if (model.contact) {\n if (model.contact.email && !emailRegex.test(model.contact.email)) {\n issues.push({\n code: createCode('API', 'INVALID_CONTACT_EMAIL'),\n message: 'The contact email address looks invalid.',\n suggestion: 'Please double check the email address formatting.',\n severity: 'error',\n context: { ...context, property: 'contact.email' },\n })\n }\n if (model.contact.url && !urlRegex.test(model.contact.url)) {\n issues.push({\n code: createCode('API', 'INVALID_CONTACT_URL'),\n message: 'The contact link looks invalid.',\n suggestion: 'Provide a working link, starting with http:// or https://.',\n severity: 'error',\n context: { ...context, property: 'contact.url' },\n })\n }\n } else {\n issues.push({\n code: createCode('API', 'MISSING_CONTACT'),\n message: 'A contact email or link is highly recommended for API consumers.',\n suggestion: 'Add an email or help desk link in the metadata tab.',\n severity: 'info',\n context: { ...context, property: 'contact' },\n })\n }\n\n if (model.license) {\n if (model.license.url && !urlRegex.test(model.license.url)) {\n issues.push({\n code: createCode('API', 'INVALID_LICENSE_URL'),\n message: 'The license link looks invalid.',\n suggestion: 'Provide a working link, starting with http:// or https://.',\n severity: 'error',\n context: { ...context, property: 'license.url' },\n })\n }\n } else {\n issues.push({\n code: createCode('API', 'MISSING_LICENSE'),\n message: 'Adding a license to your API helps users understand its usage rights.',\n suggestion: 'Add the name and a link to your API license terms.',\n severity: 'info',\n context: { ...context, property: 'license' },\n })\n }\n\n if (!model.termsOfService) {\n issues.push({\n code: createCode('API', 'MISSING_TOS'),\n message: 'Terms of Service help legal compliance.',\n suggestion: 'Add a link to the terms of your API service.',\n severity: 'info',\n context: { ...context, property: 'termsOfService' },\n })\n }\n\n return issues\n}\n\nexport function validateAction(action: Action, parent: ExposedEntity, apiModelKey: string): ApiModelValidationItem[] {\n const issues: ApiModelValidationItem[] = []\n const context: ApiModelValidationContext = {\n apiModelKey,\n kind: 'Action',\n key: action.kind, // Actions lack nanoids, kind represents its type\n parentExposedEntityKey: parent.key,\n }\n\n if (ListAction.isListAction(action)) {\n if (!action.pagination || !action.pagination.kind) {\n issues.push({\n code: createCode('ACTION', 'LIST_MISSING_PAGINATION'),\n message: 'A List action must have a defined pagination strategy.',\n suggestion: 'Configure how results are loaded (e.g. by page or by a continuous cursor).',\n severity: 'error',\n context: { ...context, property: 'pagination' },\n })\n }\n if (\n (!action.filterableFields || action.filterableFields.length === 0) &&\n (!action.sortableFields || action.sortableFields.length === 0)\n ) {\n issues.push({\n code: createCode('ACTION', 'LIST_MISSING_FILTERS'),\n message: 'Listing all elements without filters or sorting could be overwhelming for large tables.',\n suggestion: 'Select a few important fields to allow sorting and searching by.',\n severity: 'warning',\n context,\n })\n }\n }\n\n if (SearchAction.isSearchAction(action)) {\n if (!action.fields || action.fields.length === 0) {\n issues.push({\n code: createCode('ACTION', 'SEARCH_MISSING_FIELDS'),\n message: 'A Search action needs to know which fields to look in.',\n suggestion: 'Select the properties (like names or emails) that the search will run on.',\n severity: 'error',\n context: { ...context, property: 'fields' },\n })\n }\n }\n\n if (DeleteAction.isDeleteAction(action)) {\n if (!action.strategy) {\n issues.push({\n code: createCode('ACTION', 'DELETE_MISSING_STRATEGY'),\n message: 'A Delete action must know if you want to completely erase the record, or just hide it.',\n suggestion: 'Configure the deletion type (permanent or soft).',\n severity: 'error',\n context: { ...context, property: 'strategy' },\n })\n } else if (action.strategy === 'hard') {\n issues.push({\n code: createCode('ACTION', 'DELETE_HARD_WARNING'),\n message: 'Permanent delete is active. There will be no way to restore deleted data.',\n suggestion: 'Consider switching to \"soft delete\" if users might need to undo mistakes.',\n severity: 'info',\n context: { ...context, property: 'strategy' },\n })\n }\n }\n\n if (UpdateAction.isUpdateAction(action)) {\n if (!action.allowedMethods || action.allowedMethods.length === 0) {\n issues.push({\n code: createCode('ACTION', 'UPDATE_MISSING_METHODS'),\n message:\n 'An Update action must define how the data is sent (PUT replaces everything; PATCH applies partial changes).',\n suggestion: 'Select at least one allowed HTTP method.',\n severity: 'error',\n context: { ...context, property: 'allowedMethods' },\n })\n }\n }\n\n const allRateLimiters = action.getAllRateLimiters()\n const oneHasRules = allRateLimiters.some((i) => i.rules.length)\n if (!oneHasRules) {\n issues.push({\n code: createCode('ACTION', 'MISSING_RATE_LIMITS'),\n message: 'It is best practice to configure a rate limit so your API is not overwhelmed.',\n suggestion: 'Set a reasonable maximum request speed for this operation.',\n severity: 'warning',\n context,\n })\n }\n\n return issues\n}\n\nexport function validateExposedEntity(entity: ExposedEntity, apiModel: ApiModel): ApiModelValidationItem[] {\n const issues: ApiModelValidationItem[] = []\n const context: ApiModelValidationContext = {\n apiModelKey: apiModel.key,\n kind: ExposedEntityKind,\n key: entity.key,\n }\n\n // Valid Entity Reference\n if (!entity.entity || !entity.entity.key) {\n issues.push({\n code: createCode('EXPOSURE', 'MISSING_ENTITY_REF'),\n message: 'This exposed endpoint does not point to a specific data model.',\n suggestion: 'Select which database entity this endpoint should serve.',\n severity: 'error',\n context: { ...context, property: 'entity' },\n })\n } else if (apiModel.domain && !apiModel.domain.findEntity(entity.entity.key, entity.entity.domain)) {\n issues.push({\n code: createCode('EXPOSURE', 'INVALID_ENTITY_REF'),\n message: 'This endpoint points to a data model that no longer exists.',\n suggestion: 'Select a new valid database model or delete this endpoint.',\n severity: 'error',\n context: { ...context, property: 'entity' },\n })\n }\n\n // Path Integrity\n if (entity.hasCollection) {\n if (!entity.collectionPath) {\n issues.push({\n code: createCode('EXPOSURE', 'MISSING_COLLECTION_PATH'),\n message: 'When an endpoint exposes a collection, it must define what its base URL path is.',\n suggestion: 'Add a path (e.g., \"/items\").',\n severity: 'error',\n context: { ...context, property: 'collectionPath' },\n })\n } else {\n const parts = entity.collectionPath.split('/').filter(Boolean)\n if (parts.length !== 1 || !entity.collectionPath.startsWith('/')) {\n issues.push({\n code: createCode('EXPOSURE', 'INVALID_COLLECTION_PATH'),\n message: 'The collection URL should start with \"/\" and have no extra slashes.',\n suggestion: `Ensure the path looks like exactly \"/${parts[0] || 'subresource'}\".`,\n severity: 'error',\n context: { ...context, property: 'collectionPath' },\n })\n }\n }\n\n if (!entity.resourcePath) {\n issues.push({\n code: createCode('EXPOSURE', 'MISSING_RESOURCE_PATH'),\n message: 'You need an identifier to locate single items.',\n suggestion: 'Specify the identification parameter format, like \"{id}\".',\n severity: 'error',\n context: { ...context, property: 'resourcePath' },\n })\n } else if (entity.collectionPath) {\n const colRegex = new RegExp(`^${entity.collectionPath}/\\\\{[a-zA-Z0-9_]+\\\\}$`)\n if (!colRegex.test(entity.resourcePath)) {\n issues.push({\n code: createCode('EXPOSURE', 'INVALID_RESOURCE_PATH_FORMAT'),\n message: 'The single item route should match exactly your collection path plus one identifier variable.',\n suggestion: `Make sure the item path is formatted exactly like \"${entity.collectionPath}/{id}\".`,\n severity: 'error',\n context: { ...context, property: 'resourcePath' },\n })\n }\n }\n } else {\n if (!entity.resourcePath) {\n issues.push({\n code: createCode('EXPOSURE', 'MISSING_RESOURCE_PATH'),\n message: 'Endpoints representing a single item must declare their URL route.',\n suggestion: 'Set the URL path (such as \"/profile\").',\n severity: 'error',\n context: { ...context, property: 'resourcePath' },\n })\n } else {\n const parts = entity.resourcePath.split('/').filter(Boolean)\n if (parts.length !== 1 || !entity.resourcePath.startsWith('/')) {\n issues.push({\n code: createCode('EXPOSURE', 'INVALID_RESOURCE_PATH_FORMAT'),\n message: 'The URL route must only contain one exact part or level.',\n suggestion: 'Simplify the endpoint URL to a single segment.',\n severity: 'error',\n context: { ...context, property: 'resourcePath' },\n })\n }\n }\n }\n\n // Path Collisions\n if (entity.isRoot) {\n if (entity.collectionPath) {\n const collectionCollision = apiModel.findCollectionPathCollision(entity.collectionPath, entity.key)\n if (collectionCollision) {\n issues.push({\n code: createCode('EXPOSURE', 'ROOT_COLLECTION_COLLISION'),\n message: `The route \"${entity.collectionPath}\" is already used by another view.`,\n suggestion: 'Give this resource a different path to avoid conflicts.',\n severity: 'error',\n context: { ...context, property: 'collectionPath' },\n })\n }\n }\n\n if (entity.resourcePath) {\n const resourceCollision = apiModel.findResourcePathCollision(entity.resourcePath, entity.key)\n if (resourceCollision) {\n issues.push({\n code: createCode('EXPOSURE', 'ROOT_RESOURCE_COLLISION'),\n message: `The route \"${entity.resourcePath}\" is already used by another view.`,\n suggestion: 'Give this single-item resource a different path to avoid conflicts.',\n severity: 'error',\n context: { ...context, property: 'resourcePath' },\n })\n }\n }\n }\n\n // Minimum Actions\n if (!entity.actions || entity.actions.length === 0) {\n issues.push({\n code: createCode('EXPOSURE', 'MISSING_ACTIONS'),\n message: 'This exposed view does not let users do anything.',\n suggestion: 'Enable at least one operation like Create, Read, or Update.',\n severity: 'error',\n context: { ...context, property: 'actions' },\n })\n } else {\n for (const action of entity.actions) {\n issues.push(...validateAction(action, entity, apiModel.key))\n\n // Check inheritance of access rules\n // For a rule to exist, it might be on the action, the exposure, any parent, or the apiModel.\n let hasAuth = false\n if (action.accessRule && action.accessRule.length > 0) hasAuth = true\n if (!hasAuth && entity.accessRule && entity.accessRule.length > 0) hasAuth = true\n\n let curr = entity.parent?.key\n while (curr && !hasAuth) {\n const p = apiModel.exposes.get(curr)\n if (p && p.accessRule && p.accessRule.length > 0) {\n hasAuth = true\n break\n }\n curr = p?.parent?.key\n }\n\n if (!hasAuth && apiModel.accessRule && apiModel.accessRule.length > 0) hasAuth = true\n\n if (!hasAuth) {\n issues.push({\n code: createCode('ACTION', 'MISSING_ACCESS_RULES'),\n message: `The ${action.kind} action has no security rules attached, making it entirely inaccessible or open.`,\n suggestion: 'Allow specific user roles to access this operation.',\n severity: 'error',\n // using action.kind as the key context equivalent\n context: { ...context, kind: 'Action', key: action.kind, parentExposedEntityKey: entity.key },\n })\n }\n }\n }\n\n return issues\n}\n"]}
|
|
1
|
+
{"version":3,"file":"api_model_rules.js","sourceRoot":"","sources":["../../../../src/modeling/validation/api_model_rules.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAGzD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;;GAIG;AACH,SAAS,UAAU,CAAC,MAAc,EAAE,KAAa;IAC/C,OAAO,GAAG,MAAM,IAAI,KAAK,EAAE,CAAA;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAe;IAClD,MAAM,MAAM,GAA6B,EAAE,CAAA;IAC3C,MAAM,OAAO,GAA8B;QACzC,WAAW,EAAE,KAAK,CAAC,GAAG;QAC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,CAAC,CAAA;oBACxC,CAAC;oBACD,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;wBAChB,MAAM,CAAC,IAAI,CAAC;4BACV,IAAI,EAAE,UAAU,CAAC,UAAU,EAAE,uBAAuB,CAAC;4BACrD,OAAO,EAAE,sDAAsD;4BAC/D,UAAU,EAAE,uEAAuE;4BACnF,QAAQ,EAAE,SAAS;4BACnB,OAAO;yBACR,CAAC,CAAA;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import type { ApiModel } from '../ApiModel.js'\nimport type { ExposedEntity } from '../ExposedEntity.js'\nimport type { Action } from '../actions/Action.js'\nimport { ListAction } from '../actions/ListAction.js'\nimport { DeleteAction } from '../actions/DeleteAction.js'\nimport { UpdateAction } from '../actions/UpdateAction.js'\nimport { SearchAction } from '../actions/SearchAction.js'\nimport type { RolesBasedAccessControl, UsernamePasswordConfiguration } from '../types.js'\nimport type { ApiModelValidationItem, ApiModelValidationContext } from '../types.js'\nimport { ApiModelKind, ExposedEntityKind } from '../../models/kinds.js'\nimport { SemanticType } from '../Semantics.js'\n\n/**\n * Creates a unique validation code.\n * @param entity The entity type (e.g., 'API', 'EXPOSURE', 'ACTION')\n * @param issue The issue identifier (e.g., 'MISSING_NAME')\n */\nfunction createCode(entity: string, issue: string): string {\n return `${entity}_${issue}`\n}\n\n/**\n * Validates the core properties and metadata of an ApiModel.\n */\nexport function validateApiModelInfo(model: ApiModel): ApiModelValidationItem[] {\n const issues: ApiModelValidationItem[] = []\n const context: ApiModelValidationContext = {\n apiModelKey: model.key,\n kind: ApiModelKind,\n key: model.key,\n }\n\n if (model.kind !== ApiModelKind) {\n issues.push({\n code: createCode('API', 'INVALID_KIND'),\n message: 'The API model type is incorrect.',\n suggestion: 'Set the model type to \"ApiModel\".',\n severity: 'error',\n context: { ...context, property: 'kind' },\n })\n }\n\n if (!model.key || typeof model.key !== 'string' || model.key.trim() === '') {\n issues.push({\n code: createCode('API', 'MISSING_KEY'),\n message: 'The API model is missing a unique identifier.',\n suggestion: 'Provide a valid name to use as a unique identifier.',\n severity: 'error',\n context: { ...context, property: 'key' },\n })\n }\n\n if (!model.info || !model.info.name || model.info.name.trim() === '') {\n issues.push({\n code: createCode('API', 'MISSING_NAME'),\n message: 'The API model has no defined name.',\n suggestion: 'Provide a descriptive name for your API.',\n severity: 'error',\n context: { ...context, property: 'info.name' },\n })\n }\n\n if (!model.info || !model.info.description || model.info.description.trim() === '') {\n issues.push({\n code: createCode('API', 'MISSING_DESCRIPTION'),\n message: 'Adding a description helps others understand your API.',\n suggestion: 'Add a description to clarify the purpose of this API.',\n severity: 'warning',\n context: { ...context, property: 'info.description' },\n })\n }\n\n return issues\n}\n\nexport function validateApiModelDependency(model: ApiModel): ApiModelValidationItem[] {\n const issues: ApiModelValidationItem[] = []\n const context: ApiModelValidationContext = {\n apiModelKey: model.key,\n kind: ApiModelKind,\n key: model.key,\n }\n\n const domain = model.domain\n if (!domain) {\n issues.push({\n code: createCode('API', 'MISSING_DOMAIN'),\n message: 'No Data Domain is attached to the API.',\n suggestion: 'Select a Data Domain from the settings to power your API.',\n severity: 'error',\n context,\n })\n return issues // Can't validate version if it doesn't exist\n }\n\n if (!domain.info || !domain.info.version) {\n issues.push({\n code: createCode('API', 'MISSING_DOMAIN_VERSION'),\n message: 'The selected Data Domain is missing a version number.',\n suggestion: 'Specify a version for the attached Data Domain.',\n severity: 'error',\n context,\n })\n }\n\n return issues\n}\n\nexport function validateApiModelSecurity(model: ApiModel): ApiModelValidationItem[] {\n const issues: ApiModelValidationItem[] = []\n const context: ApiModelValidationContext = {\n apiModelKey: model.key,\n kind: ApiModelKind,\n key: model.key,\n }\n\n // Resolve User target\n const userEntity = model.domain && model.user ? model.domain.findEntity(model.user.key, model.user.domain) : undefined\n\n // Authentication\n if (!model.authentication) {\n issues.push({\n code: createCode('API', 'MISSING_AUTHENTICATION'),\n message: 'The API is missing authentication settings.',\n suggestion: 'Go to the security settings and configure how users authenticate.',\n severity: 'error',\n context: { ...context, property: 'authentication' },\n })\n } else if (model.authentication.strategy === 'UsernamePassword') {\n const auth = model.authentication as UsernamePasswordConfiguration\n if (!auth.passwordKey) {\n issues.push({\n code: createCode('API', 'MISSING_PASSWORD_KEY'),\n message: 'Username & Password authentication requires a specific field for the password.',\n suggestion:\n 'Select which field in your user profile should store the password. ' +\n 'The data domain model should have a password data semantic on that property.',\n severity: 'error',\n context: { ...context, property: 'authentication.passwordKey' },\n })\n } else if (userEntity) {\n const passwordProp = Array.from(userEntity.properties).find((p) => p.key === auth.passwordKey)\n if (passwordProp && !passwordProp.hasSemantic(SemanticType.Password)) {\n issues.push({\n code: createCode('API', 'MISSING_PASSWORD_SEMANTIC'),\n message: 'The selected password field is missing the Password data semantic.',\n suggestion: 'Go to the Data Modeler and add the \"Password\" semantic to this property.',\n severity: 'error',\n context: { ...context, property: 'authentication.passwordKey' },\n })\n }\n }\n\n if (userEntity) {\n const hasUsernameSemantic = Array.from(userEntity.properties).some(\n (p) => typeof p.hasSemantic === 'function' && p.hasSemantic(SemanticType.Username)\n )\n if (!hasUsernameSemantic) {\n issues.push({\n code: createCode('API', 'MISSING_USERNAME_SEMANTIC'),\n message: 'Username & Password authentication requires a field with the Username data semantic.',\n suggestion: 'Go to the Data Modeler and add the \"Username\" semantic to the property used for login.',\n severity: 'error',\n context: { ...context, property: 'user' },\n })\n }\n }\n }\n\n // Authorization\n if (!model.authorization) {\n issues.push({\n code: createCode('API', 'MISSING_AUTHORIZATION'),\n message: 'The API is missing authorization settings.',\n suggestion: 'Go to the security settings and configure how to handle user permissions.',\n severity: 'error',\n context: { ...context, property: 'authorization' },\n })\n } else if (model.authorization.strategy === 'RBAC') {\n const rbac = model.authorization as RolesBasedAccessControl\n if (!rbac.roleKey) {\n issues.push({\n code: createCode('API', 'MISSING_ROLE_KEY'),\n message: 'Role-based access control is selected but no role field has been defined.',\n suggestion: \"Select which field in your user profile determines the user's role.\",\n severity: 'error',\n context: { ...context, property: 'authorization.roleKey' },\n })\n } else if (userEntity) {\n const roleProp = Array.from(userEntity.properties).find((p) => p.key === rbac.roleKey)\n if (roleProp && !roleProp.hasSemantic(SemanticType.UserRole)) {\n issues.push({\n code: createCode('API', 'MISSING_ROLE_SEMANTIC'),\n message: 'The selected role field is missing the User Role data semantic.',\n suggestion: 'Go to the Data Modeler and add the \"User Role\" semantic to this property.',\n severity: 'error',\n context: { ...context, property: 'authorization.roleKey' },\n })\n }\n }\n }\n\n // Session\n if (!model.session) {\n issues.push({\n code: createCode('API', 'MISSING_SESSION'),\n message: 'The API is missing session configuration.',\n suggestion: 'Configure how user sessions will be handled.',\n severity: 'error',\n context: { ...context, property: 'session' },\n })\n } else {\n if (!model.session.secret) {\n issues.push({\n code: createCode('API', 'MISSING_SESSION_SECRET'),\n message: 'A secure encryption key is required for sessions.',\n suggestion: 'Provide a strong security key in the session settings.',\n severity: 'error',\n context: { ...context, property: 'session.secret' },\n })\n }\n\n if (!model.session.properties || model.session.properties.length === 0) {\n issues.push({\n code: createCode('API', 'MISSING_SESSION_PROPERTIES'),\n message: 'The session token needs to include at least one piece of user information, like an ID.',\n suggestion: 'Select fields that should be stored securely inside the session payload.',\n severity: 'error',\n context: { ...context, property: 'session.properties' },\n })\n } else if (model.authorization && model.authorization.strategy === 'RBAC') {\n const rbac = model.authorization as RolesBasedAccessControl\n if (rbac.roleKey && !model.session.properties.includes(rbac.roleKey)) {\n issues.push({\n code: createCode('API', 'MISSING_RBAC_SESSION_PROPERTY'),\n message: 'The user role must be included in the session data for permissions to work.',\n suggestion: 'Make sure your selected role field is checked in the session settings.',\n severity: 'error',\n context: { ...context, property: 'session.properties' },\n })\n }\n }\n\n const { cookie, jwt } = model.session\n if ((!cookie || !cookie.enabled) && (!jwt || !jwt.enabled)) {\n issues.push({\n code: createCode('API', 'MISSING_SESSION_TRANSPORT'),\n message: 'No delivery method for sessions (like cookies or tokens) is enabled.',\n suggestion: 'Enable at least one session delivery mechanism in the security settings.',\n severity: 'error',\n context: { ...context, property: 'session' },\n })\n }\n }\n\n // User Target\n if (!model.user) {\n issues.push({\n code: createCode('API', 'MISSING_USER_ENTITY'),\n message: 'You need to specify what kind of object represents your users.',\n suggestion: 'Select a model from your domain that stores your user accounts.',\n severity: 'error',\n context: { ...context, property: 'user' },\n })\n } else if (model.domain && !model.domain.findEntity(model.user.key, model.user.domain)) {\n issues.push({\n code: createCode('API', 'INVALID_USER_ENTITY'),\n message: 'The selected user model no longer exists in your data domain.',\n suggestion: 'Please navigate to security settings and select a valid user model.',\n severity: 'error',\n context: { ...context, property: 'user' },\n })\n }\n\n return issues\n}\n\nexport function validateApiModelMetadata(model: ApiModel): ApiModelValidationItem[] {\n const issues: ApiModelValidationItem[] = []\n const context: ApiModelValidationContext = {\n apiModelKey: model.key,\n kind: ApiModelKind,\n key: model.key,\n }\n\n const urlRegex = /^https?:\\/\\//i\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\n\n if (model.contact) {\n if (model.contact.email && !emailRegex.test(model.contact.email)) {\n issues.push({\n code: createCode('API', 'INVALID_CONTACT_EMAIL'),\n message: 'The contact email address looks invalid.',\n suggestion: 'Please double check the email address formatting.',\n severity: 'error',\n context: { ...context, property: 'contact.email' },\n })\n }\n if (model.contact.url && !urlRegex.test(model.contact.url)) {\n issues.push({\n code: createCode('API', 'INVALID_CONTACT_URL'),\n message: 'The contact link looks invalid.',\n suggestion: 'Provide a working link, starting with http:// or https://.',\n severity: 'error',\n context: { ...context, property: 'contact.url' },\n })\n }\n } else {\n issues.push({\n code: createCode('API', 'MISSING_CONTACT'),\n message: 'A contact email or link is highly recommended for API consumers.',\n suggestion: 'Add an email or help desk link in the metadata tab.',\n severity: 'info',\n context: { ...context, property: 'contact' },\n })\n }\n\n if (model.license) {\n if (model.license.url && !urlRegex.test(model.license.url)) {\n issues.push({\n code: createCode('API', 'INVALID_LICENSE_URL'),\n message: 'The license link looks invalid.',\n suggestion: 'Provide a working link, starting with http:// or https://.',\n severity: 'error',\n context: { ...context, property: 'license.url' },\n })\n }\n } else {\n issues.push({\n code: createCode('API', 'MISSING_LICENSE'),\n message: 'Adding a license to your API helps users understand its usage rights.',\n suggestion: 'Add the name and a link to your API license terms.',\n severity: 'info',\n context: { ...context, property: 'license' },\n })\n }\n\n if (!model.termsOfService) {\n issues.push({\n code: createCode('API', 'MISSING_TOS'),\n message: 'Terms of Service help legal compliance.',\n suggestion: 'Add a link to the terms of your API service.',\n severity: 'info',\n context: { ...context, property: 'termsOfService' },\n })\n }\n\n return issues\n}\n\nexport function validateApiPagination(model: ApiModel): ApiModelValidationItem[] {\n const issues: ApiModelValidationItem[] = []\n const context: ApiModelValidationContext = {\n apiModelKey: model.key,\n kind: ApiModelKind,\n key: model.key,\n }\n // We only need pagination when the API contains at least one List or Search action\n let validate = false\n for (const exposure of model.exposes.values()) {\n if (exposure.actions.some((action) => ListAction.isListAction(action) || SearchAction.isSearchAction(action))) {\n validate = true\n break\n }\n }\n if (!validate) {\n return issues\n }\n if (!model.pagination || !model.pagination.kind) {\n issues.push({\n code: createCode('API', 'MISSING_PAGINATION'),\n message: 'The API must have a defined pagination strategy when it exposes List or Search actions.',\n suggestion: 'Configure how results are loaded (e.g. by page or by a continuous cursor).',\n severity: 'error',\n context: { ...context, property: 'pagination' },\n })\n } else {\n if (model.pagination.defaultLimit === undefined) {\n issues.push({\n code: createCode('API', 'MISSING_PAGINATION_DEFAULT_LIMIT'),\n message: \"The API doesn't have a defined default page limit when it exposes List or Search actions.\",\n suggestion: 'Set a default page limit for the pagination otherwise the API will use its default limit.',\n severity: 'info',\n context: { ...context, property: 'pagination.defaultLimit' },\n })\n }\n if (model.pagination.maxLimit === undefined) {\n issues.push({\n code: createCode('API', 'MISSING_PAGINATION_MAX_LIMIT'),\n message: \"The API doesn't have a defined page size max limit when it exposes List or Search actions.\",\n suggestion: 'Set a max page size limit for the pagination otherwise the API will use its default max limit.',\n severity: 'info',\n context: { ...context, property: 'pagination.maxLimit' },\n })\n }\n }\n return issues\n}\n\nexport function validateAction(action: Action, parent: ExposedEntity, apiModelKey: string): ApiModelValidationItem[] {\n const issues: ApiModelValidationItem[] = []\n const context: ApiModelValidationContext = {\n apiModelKey,\n kind: 'Action',\n key: action.kind, // Actions lack nanoids, kind represents its type\n parentExposedEntityKey: parent.key,\n }\n\n if (DeleteAction.isDeleteAction(action)) {\n if (!action.strategy) {\n issues.push({\n code: createCode('ACTION', 'DELETE_MISSING_STRATEGY'),\n message: 'A Delete action must know if you want to completely erase the record, or just hide it.',\n suggestion: 'Configure the deletion type (permanent or soft).',\n severity: 'error',\n context: { ...context, property: 'strategy' },\n })\n } else if (action.strategy === 'hard') {\n issues.push({\n code: createCode('ACTION', 'DELETE_HARD_WARNING'),\n message: 'Permanent delete is active. There will be no way to restore deleted data.',\n suggestion: 'Consider switching to \"soft delete\" if users might need to undo mistakes.',\n severity: 'info',\n context: { ...context, property: 'strategy' },\n })\n }\n }\n\n if (UpdateAction.isUpdateAction(action)) {\n if (!action.allowedMethods || action.allowedMethods.length === 0) {\n issues.push({\n code: createCode('ACTION', 'UPDATE_MISSING_METHODS'),\n message:\n 'An Update action must define how the data is sent (PUT replaces everything; PATCH applies partial changes).',\n suggestion: 'Select at least one allowed HTTP method.',\n severity: 'error',\n context: { ...context, property: 'allowedMethods' },\n })\n }\n }\n\n const allRateLimiters = action.getAllRateLimiters()\n const oneHasRules = allRateLimiters.some((i) => i.rules.length)\n if (!oneHasRules) {\n issues.push({\n code: createCode('ACTION', 'MISSING_RATE_LIMITS'),\n message: 'It is best practice to configure a rate limit so your API is not overwhelmed.',\n suggestion: 'Set a reasonable maximum request speed for this operation.',\n severity: 'warning',\n context,\n })\n }\n\n return issues\n}\n\nexport function validateExposedEntity(entity: ExposedEntity, apiModel: ApiModel): ApiModelValidationItem[] {\n const issues: ApiModelValidationItem[] = []\n const context: ApiModelValidationContext = {\n apiModelKey: apiModel.key,\n kind: ExposedEntityKind,\n key: entity.key,\n }\n\n // Valid Entity Reference\n if (!entity.entity || !entity.entity.key) {\n issues.push({\n code: createCode('EXPOSURE', 'MISSING_ENTITY_REF'),\n message: 'This exposed endpoint does not point to a specific data model.',\n suggestion: 'Select which database entity this endpoint should serve.',\n severity: 'error',\n context: { ...context, property: 'entity' },\n })\n } else if (apiModel.domain && !apiModel.domain.findEntity(entity.entity.key, entity.entity.domain)) {\n issues.push({\n code: createCode('EXPOSURE', 'INVALID_ENTITY_REF'),\n message: 'This endpoint points to a data model that no longer exists.',\n suggestion: 'Select a new valid database model or delete this endpoint.',\n severity: 'error',\n context: { ...context, property: 'entity' },\n })\n }\n\n // Path Integrity\n if (entity.hasCollection) {\n if (!entity.collectionPath) {\n issues.push({\n code: createCode('EXPOSURE', 'MISSING_COLLECTION_PATH'),\n message: 'When an endpoint exposes a collection, it must define what its base URL path is.',\n suggestion: 'Add a path (e.g., \"/items\").',\n severity: 'error',\n context: { ...context, property: 'collectionPath' },\n })\n } else {\n const parts = entity.collectionPath.split('/').filter(Boolean)\n if (parts.length !== 1 || !entity.collectionPath.startsWith('/')) {\n issues.push({\n code: createCode('EXPOSURE', 'INVALID_COLLECTION_PATH'),\n message: 'The collection URL should start with \"/\" and have no extra slashes.',\n suggestion: `Ensure the path looks like exactly \"/${parts[0] || 'subresource'}\".`,\n severity: 'error',\n context: { ...context, property: 'collectionPath' },\n })\n }\n }\n\n if (!entity.resourcePath) {\n issues.push({\n code: createCode('EXPOSURE', 'MISSING_RESOURCE_PATH'),\n message: 'You need an identifier to locate single items.',\n suggestion: 'Specify the identification parameter format, like \"{id}\".',\n severity: 'error',\n context: { ...context, property: 'resourcePath' },\n })\n } else if (entity.collectionPath) {\n const colRegex = new RegExp(`^${entity.collectionPath}/\\\\{[a-zA-Z0-9_]+\\\\}$`)\n if (!colRegex.test(entity.resourcePath)) {\n issues.push({\n code: createCode('EXPOSURE', 'INVALID_RESOURCE_PATH_FORMAT'),\n message: 'The single item route should match exactly your collection path plus one identifier variable.',\n suggestion: `Make sure the item path is formatted exactly like \"${entity.collectionPath}/{id}\".`,\n severity: 'error',\n context: { ...context, property: 'resourcePath' },\n })\n }\n }\n } else {\n if (!entity.resourcePath) {\n issues.push({\n code: createCode('EXPOSURE', 'MISSING_RESOURCE_PATH'),\n message: 'Endpoints representing a single item must declare their URL route.',\n suggestion: 'Set the URL path (such as \"/profile\").',\n severity: 'error',\n context: { ...context, property: 'resourcePath' },\n })\n } else {\n const parts = entity.resourcePath.split('/').filter(Boolean)\n if (parts.length !== 1 || !entity.resourcePath.startsWith('/')) {\n issues.push({\n code: createCode('EXPOSURE', 'INVALID_RESOURCE_PATH_FORMAT'),\n message: 'The URL route must only contain one exact part or level.',\n suggestion: 'Simplify the endpoint URL to a single segment.',\n severity: 'error',\n context: { ...context, property: 'resourcePath' },\n })\n }\n }\n }\n\n // Path Collisions\n if (entity.isRoot) {\n if (entity.collectionPath) {\n const collectionCollision = apiModel.findCollectionPathCollision(entity.collectionPath, entity.key)\n if (collectionCollision) {\n issues.push({\n code: createCode('EXPOSURE', 'ROOT_COLLECTION_COLLISION'),\n message: `The route \"${entity.collectionPath}\" is already used by another view.`,\n suggestion: 'Give this resource a different path to avoid conflicts.',\n severity: 'error',\n context: { ...context, property: 'collectionPath' },\n })\n }\n }\n\n if (entity.resourcePath) {\n const resourceCollision = apiModel.findResourcePathCollision(entity.resourcePath, entity.key)\n if (resourceCollision) {\n issues.push({\n code: createCode('EXPOSURE', 'ROOT_RESOURCE_COLLISION'),\n message: `The route \"${entity.resourcePath}\" is already used by another view.`,\n suggestion: 'Give this single-item resource a different path to avoid conflicts.',\n severity: 'error',\n context: { ...context, property: 'resourcePath' },\n })\n }\n }\n }\n\n // Minimum Actions\n if (!entity.actions || entity.actions.length === 0) {\n issues.push({\n code: createCode('EXPOSURE', 'MISSING_ACTIONS'),\n message: 'This exposed view does not let users do anything.',\n suggestion: 'Enable at least one operation like Create, Read, or Update.',\n severity: 'error',\n context: { ...context, property: 'actions' },\n })\n } else {\n let hasSearch = false\n let hasList = false\n for (const action of entity.actions) {\n issues.push(...validateAction(action, entity, apiModel.key))\n\n if (SearchAction.isSearchAction(action)) hasSearch = true\n if (ListAction.isListAction(action)) hasList = true\n\n // Check inheritance of access rules\n // For a rule to exist, it might be on the action, the exposure, any parent, or the apiModel.\n let hasAuth = false\n if (action.accessRule && action.accessRule.length > 0) hasAuth = true\n if (!hasAuth && entity.accessRule && entity.accessRule.length > 0) hasAuth = true\n\n let curr = entity.parent?.key\n while (curr && !hasAuth) {\n const p = apiModel.exposes.get(curr)\n if (p && p.accessRule && p.accessRule.length > 0) {\n hasAuth = true\n break\n }\n curr = p?.parent?.key\n }\n\n if (!hasAuth && apiModel.accessRule && apiModel.accessRule.length > 0) hasAuth = true\n\n if (!hasAuth) {\n issues.push({\n code: createCode('ACTION', 'MISSING_ACCESS_RULES'),\n message: `The ${action.kind} action has no security rules attached, making it entirely inaccessible or open.`,\n suggestion: 'Allow specific user roles to access this operation.',\n severity: 'error',\n // using action.kind as the key context equivalent\n context: { ...context, kind: 'Action', key: action.kind, parentExposedEntityKey: entity.key },\n })\n }\n }\n\n if (hasList || hasSearch) {\n const contract = entity.paginationContract\n if (!contract) {\n issues.push({\n code: createCode('EXPOSURE', 'MISSING_PAGINATION_CONTRACT'),\n message: 'The List or Search action needs a pagination contract.',\n suggestion: 'Add a pagination contract to the exposed entity.',\n severity: 'error',\n context,\n })\n } else {\n if (hasList) {\n if (!contract.filterableFields || contract.filterableFields.length === 0) {\n issues.push({\n code: createCode('EXPOSURE', 'LIST_MISSING_FILTERS'),\n message: 'Listing all elements without filters could be overwhelming for large tables.',\n suggestion: 'Select a few important fields to allow filtering.',\n severity: 'warning',\n context,\n })\n }\n if (!contract.sortableFields || contract.sortableFields.length === 0) {\n issues.push({\n code: createCode('EXPOSURE', 'LIST_MISSING_SORTING'),\n message: 'Listing all elements without sorting could be overwhelming for large tables.',\n suggestion: 'Select a few important fields to allow sorting.',\n severity: 'warning',\n context,\n })\n }\n }\n if (hasSearch) {\n // Search and technically be used for filtering.\n const all: string[] = []\n if (Array.isArray(contract.searchableFields)) {\n all.push(...contract.searchableFields)\n }\n if (Array.isArray(contract.filterableFields)) {\n all.push(...contract.filterableFields)\n }\n if (!all.length) {\n issues.push({\n code: createCode('EXPOSURE', 'SEARCH_MISSING_FIELDS'),\n message: 'Search action needs to know which fields to look in.',\n suggestion: 'Select a few important fields to allow searching or full-text search.',\n severity: 'warning',\n context,\n })\n }\n }\n }\n }\n }\n\n return issues\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectRequest.d.ts","sourceRoot":"","sources":["../../../src/models/ProjectRequest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAA;AACtG,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,YAAY,EAA2B,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAGhE,eAAO,MAAM,IAAI,wBAAwB,CAAA;AAEzC,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACnC;AAED,MAAM,WAAW,eAAgB,SAAQ,0BAA0B,EAAE,QAAQ;IAC3E,IAAI,EAAE,OAAO,IAAI,CAAA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BAAyB,GAAG,cAAc;IAetD;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,GAAE,oBAAyB,GAAG,cAAc;IAK7G;;OAEG;IACH,cAAc,IAAI,WAAW,GAAG,SAAS;IAQzC;;OAEG;IACH,gBAAgB,IAAI,WAAW,EAAE;IAQjC;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,IAAI,GAAE,qBAA0B,GAAG,MAAM,GAAG,SAAS;IAiF7D,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI;IAQ7D;;;;;;;;OAQG;IACH,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAyB3F;;;;;;;;OAQG;IACH,iBAAiB,IAAI,oBAAoB,EAAE;IAkB3C;;OAEG;IACH,SAAS,CAAC,4BAA4B,IAAI,oBAAoB,EAAE,GAAG,SAAS;IAW5E;;OAEG;IACH,SAAS,CAAC,6BAA6B,IAAI,oBAAoB,EAAE,GAAG,SAAS;CAQ9E"}
|
|
@@ -244,10 +244,6 @@ export class ProjectRequest extends Request {
|
|
|
244
244
|
if (!environment) {
|
|
245
245
|
return undefined;
|
|
246
246
|
}
|
|
247
|
-
let parent = this.getParent();
|
|
248
|
-
if (parent === project) {
|
|
249
|
-
parent = undefined;
|
|
250
|
-
}
|
|
251
247
|
return project.findEnvironment(environment);
|
|
252
248
|
}
|
|
253
249
|
/**
|