@api-client/core 0.17.6 → 0.18.0
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/amf/ApiSchemaGenerator.d.ts +2 -2
- package/build/src/amf/ApiSchemaGenerator.d.ts.map +1 -1
- package/build/src/amf/ApiSchemaGenerator.js.map +1 -1
- package/build/src/amf/ApiSchemaValues.d.ts.map +1 -1
- package/build/src/amf/ApiSchemaValues.js +8 -1
- package/build/src/amf/ApiSchemaValues.js.map +1 -1
- package/build/src/amf/shape/ShapeBase.d.ts +1 -1
- package/build/src/amf/shape/ShapeBase.d.ts.map +1 -1
- package/build/src/amf/shape/ShapeBase.js.map +1 -1
- package/build/src/amf/shape/ShapeJsonSchemaGenerator.d.ts +1 -1
- package/build/src/amf/shape/ShapeJsonSchemaGenerator.d.ts.map +1 -1
- package/build/src/amf/shape/ShapeJsonSchemaGenerator.js +7 -1
- package/build/src/amf/shape/ShapeJsonSchemaGenerator.js.map +1 -1
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.d.ts +1 -1
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.d.ts.map +1 -1
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.js +8 -2
- package/build/src/amf/shape/ShapeXmlSchemaGenerator.js.map +1 -1
- package/build/src/mocking/RandExp.d.ts +55 -0
- package/build/src/mocking/RandExp.d.ts.map +1 -0
- package/build/src/mocking/RandExp.js +302 -0
- package/build/src/mocking/RandExp.js.map +1 -0
- package/build/src/mocking/lib/ret.d.ts +16 -0
- package/build/src/mocking/lib/ret.d.ts.map +1 -0
- package/build/src/mocking/lib/ret.js +284 -0
- package/build/src/mocking/lib/ret.js.map +1 -0
- package/build/src/modeling/Bindings.d.ts +0 -4
- package/build/src/modeling/Bindings.d.ts.map +1 -1
- package/build/src/modeling/Bindings.js.map +1 -1
- package/build/src/modeling/DomainEntity.js +3 -3
- package/build/src/modeling/DomainEntity.js.map +1 -1
- package/build/src/modeling/DomainProperty.d.ts +18 -0
- package/build/src/modeling/DomainProperty.d.ts.map +1 -1
- package/build/src/modeling/DomainProperty.js +31 -0
- package/build/src/modeling/DomainProperty.js.map +1 -1
- package/build/src/modeling/Semantics.d.ts.map +1 -1
- package/build/src/modeling/Semantics.js +2 -1
- package/build/src/modeling/Semantics.js.map +1 -1
- package/build/src/modeling/amf/ShapeGenerator.js +3 -3
- package/build/src/modeling/amf/ShapeGenerator.js.map +1 -1
- package/build/src/modeling/types.d.ts +4 -0
- package/build/src/modeling/types.d.ts.map +1 -1
- package/build/src/modeling/types.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +19 -19
- package/package.json +2 -2
- package/src/amf/ApiSchemaGenerator.ts +2 -2
- package/src/amf/ApiSchemaValues.ts +8 -1
- package/src/amf/shape/ShapeBase.ts +1 -1
- package/src/amf/shape/ShapeJsonSchemaGenerator.ts +7 -2
- package/src/amf/shape/ShapeXmlSchemaGenerator.ts +8 -3
- package/src/mocking/RandExp.ts +335 -0
- package/src/mocking/lib/ret.ts +279 -0
- package/src/modeling/Bindings.ts +0 -4
- package/src/modeling/DomainEntity.ts +3 -3
- package/src/modeling/DomainProperty.ts +33 -0
- package/src/modeling/Semantics.ts +2 -1
- package/src/modeling/amf/ShapeGenerator.ts +3 -3
- package/src/modeling/types.ts +4 -0
- package/tests/unit/modeling/amf/shape_generator.spec.ts +3 -8
- package/tests/unit/modeling/domain_property.spec.ts +335 -0
|
@@ -525,13 +525,14 @@ export const DataSemantics = {
|
|
|
525
525
|
//
|
|
526
526
|
// Computed Values
|
|
527
527
|
//
|
|
528
|
+
// Calculated field can be added to any data type as we can compute any value.
|
|
528
529
|
[SemanticType.Calculated]: {
|
|
529
530
|
id: SemanticType.Calculated,
|
|
530
531
|
displayName: 'Calculated',
|
|
531
532
|
scope: SemanticScope.Property,
|
|
532
533
|
description: 'Auto-calculated field value',
|
|
533
534
|
category: SemanticCategory.Computed,
|
|
534
|
-
applicableDataTypes: ['string'],
|
|
535
|
+
applicableDataTypes: ['string', 'number', 'boolean', 'date', 'datetime', 'time', 'binary'],
|
|
535
536
|
hasConfig: true,
|
|
536
537
|
},
|
|
537
538
|
[SemanticType.Derived]: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Semantics.js","sourceRoot":"","sources":["../../../src/modeling/Semantics.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,CAAN,IAAY,YA2MX;AA3MD,WAAY,YAAY;IACtB,EAAE;IACF,yBAAyB;IACzB,EAAE;IAEF;;OAEG;IACH,sCAAsB,CAAA;IAEtB,EAAE;IACF,2BAA2B;IAC3B,EAAE;IAEF;;;;OAIG;IACH,8CAA8B,CAAA;IAC9B;;;OAGG;IACH,8DAA8C,CAAA;IAC9C;;;OAGG;IACH,8DAA8C,CAAA;IAC9C;;;;;OAKG;IACH,8DAA8C,CAAA;IAC9C;;;;OAIG;IACH,oDAAoC,CAAA;IACpC;;;;;;;OAOG;IACH,8DAA8C,CAAA;IAC9C;;;;OAIG;IACH,wCAAwB,CAAA;IACxB;;;;;;OAMG;IACH,8CAA8B,CAAA;IAC9B;;;;;;;;;OASG;IACH,0CAA0B,CAAA;IAE1B;;;;OAIG;IACH,4CAA4B,CAAA;IAE5B;;;OAGG;IACH,8CAA8B,CAAA;IAE9B;;;OAGG;IACH,4CAA4B,CAAA;IAE5B;;;;;;OAMG;IACH,8CAA8B,CAAA;IAE9B;;;;;;OAMG;IACH,sCAAsB,CAAA;IAEtB;;;;;;;;;;;;;;;OAeG;IACH,wEAAwD,CAAA;IAExD;;OAEG;IACH,wCAAwB,CAAA;IACxB;;OAEG;IACH,wCAAwB,CAAA;IACxB;;;;;;;OAOG;IACH,8CAA8B,CAAA;IAC9B;;OAEG;IACH,oCAAoB,CAAA;IACpB;;;;OAIG;IACH,oCAAoB,CAAA;IACpB;;OAEG;IACH,oDAAoC,CAAA;IACpC;;OAEG;IACH,4CAA4B,CAAA;IAC5B;;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AC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAChD,yDAAyD;QACzD,IAAI,KAAK,IAAI,QAAQ,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;YACtC,OAAM;QACR,CAAC;QACD,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,QAA0B,EAAkB,EAAE;IACvF,OAAO,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAA;AAC1F,CAAC,CAAA","sourcesContent":["/* eslint-disable no-redeclare */\n/* eslint-disable max-len */\nimport type { DomainPropertyType } from './DataFormat.js'\n\n/**\n * Defines the names for all available data semantics.\n * Using a string enum makes it easy to add or remove semantics in a single place.\n */\nexport enum SemanticType {\n //\n // Entity-Level Semantics\n //\n\n /**\n * Designates a Data Entity that represents users of the system.\n */\n User = 'Semantic#User',\n\n //\n // Property-Level Semantics\n //\n\n /**\n * Annotates the field as the user password.\n * The runtime should treat this field with special care,\n * ensuring it is encrypted and not exposed in API responses.\n */\n Password = 'Semantic#Password',\n /**\n * Designates a Data Property as the `createdAt` timestamp of an entity.\n * This is used to track when the entity was first created.\n */\n CreatedTimestamp = 'Semantic#CreatedTimestamp',\n /**\n * Designates a Data Property as the `updatedAt` timestamp of an entity.\n * This is used to track when the entity was last modified.\n */\n UpdatedTimestamp = 'Semantic#UpdatedTimestamp',\n /**\n * Designates a Data Property as the `deletedAt` timestamp of an entity.\n * This is used to track when the entity was soft-deleted.\n * Soft-deletion means the entity is not physically removed from the database,\n * but marked as deleted for logical deletion purposes.\n */\n DeletedTimestamp = 'Semantic#DeletedTimestamp',\n /**\n * Designates a Data Property as a boolean flag indicating whether the entity is deleted.\n * This is used for soft-deletion, where the entity is not physically removed from the database,\n * but marked as deleted.\n */\n DeletedFlag = 'Semantic#DeletedFlag',\n /**\n * Designates a Data Property as a public identifier for a resource (the slug).\n * This is often used in URLs to provide a user-friendly way to access the resource.\n * For example, a blog post might have a public unique name like \"my-first-post\".\n * The runtime automatically generates a URL-safe string from another field (like a title).\n * By default, slugs are generated to be unique, but the configuration allows for duplicates\n * in scenarios where uniqueness is handled by a combination of fields (e.g., year and slug).\n */\n PublicUniqueName = 'Semantic#PublicUniqueName',\n /**\n * A semantic that describes a title of an article, blog post, and so on. This semantic is used with\n * the `PublicUniqueName` to determine which field is responsible for the slug generation. However,\n * we may add more automation related to the `title` property in the future.\n */\n Title = 'Semantic#Title',\n /**\n * Designates a Data Property as the `role` of a user within the system.\n * This is used to define the user's permissions and access levels.\n * For example, a user with the role of \"admin\" would have elevated permissions\n * compared to a user with the role of \"guest\".\n * Roles are defined on the entity as enums, or as a string property with a controlled vocabulary.\n */\n UserRole = 'Semantic#UserRole',\n /**\n * A text or enum field to represent the state of a record (e.g., `draft`, `published`, `pending_review`, `archived`).\n *\n * Defined behaviors:\n * - State-Based Filtering: Automatically prevents public users from seeing records in a draft state.\n * - State Transitions: In principle, the runtime should prevent the user from skipping some states.\n * For example, when the record is in the `draft` state, it cannot be moved to the `archived` state without publishing it first. However,\n * we do not have enough customer feedback to design this functionality correctly right now, so\n * it serves as a placeholder semantic annotation.\n */\n Status = 'Semantic#Status',\n\n /**\n * Annotates an integer field that automatically increments.\n * The runtime automatically increments this number on every update, providing a simple way\n * to track changes and implement optimistic locking to prevent mid-air collisions.\n */\n Version = 'Semantic#Version',\n\n /**\n * Annotates a field that holds a reference to an image data via an URL.\n * The application + runtime should validate that the input is a well-formed URL.\n */\n ImageURL = 'Semantic#ImageURL',\n\n /**\n * Annotates a field that holds a reference to a file object via an URL. Ity is distinct from the\n * `ImageURL` semantic as it implicitly states that the target is non-image, binary data (an attachment, for example).\n */\n FileURL = 'Semantic#FileURL',\n\n /**\n * Annotates the field as a markdown-interpreted field.\n * When an object is created, the runtime performs additional sanitization to prevent XSS attacks.\n *\n * The annotation describes whether the data should be translated to the HTML output when\n * record is read or the original MD content should be returned.\n */\n Markdown = 'Semantic#Markdown',\n\n /**\n * Annotates the field as containing HTML content.\n * The runtime performs sanitization to prevent XSS attacks and validates HTML structure.\n *\n * The annotation describes whether the data should be rendered as HTML output when\n * record is read or the original HTML content should be returned.\n */\n HTML = 'Semantic#HTML',\n\n /**\n * Annotates a field that holds geospatial coordinate data (latitude/longitude).\n * The runtime automatically generates API capabilities for location-based queries,\n * such as \"find all restaurants within a 5-mile radius.\"\n *\n * The field should contain coordinate data in a standard format:\n * - \"40.7128,-74.0060\" (lat,lon)\n * - \"POINT(-74.0060 40.7128)\" (PostGIS format)\n * - \"40.7128°N, 74.0060°W\" (degree format)\n *\n * Defined behaviors:\n * - Spatial Indexing: The runtime automatically creates spatial indexes for efficient location-based queries\n * - Distance Queries: Enables API endpoints for finding records within specified distances\n * - Coordinate Validation: Validates that the input follows proper coordinate format\n * - PostGIS Integration: When using PostgreSQL, automatically maps to PostGIS geometry types\n */\n GeospatialCoordinates = 'Semantic#GeospatialCoordinates',\n\n /**\n * Annotates a field as an email address with validation and verification options.\n */\n Email = 'Semantic#Email',\n /**\n * Annotates a field as a phone number with validation and formatting options.\n */\n Phone = 'Semantic#Phone',\n /**\n * Annotates a field as a monetary value with currency support and precision control.\n * Can store simple decimal amounts or complex objects with amount and currency.\n *\n * As a semantic, it provides flexibility by annotating a base `number` or `string` type,\n * allowing for different storage strategies (e.g., decimal, integer cents, or a JSON object)\n * while maintaining a consistent API for currency operations.\n */\n Currency = 'Semantic#Currency',\n /**\n * Annotates a field as a URL with validation and allowed protocols.\n */\n URL = 'Semantic#URL',\n /**\n * Annotates a field as a Stock Keeping Unit (SKU).\n * Enforces uniqueness at the database level, critical for product catalogs.\n * Provides automatic validation and formatting for product identification codes.\n */\n SKU = 'Semantic#SKU',\n /**\n * Annotates a field as a long-form description.\n */\n Description = 'Semantic#Description',\n /**\n * Annotates a field as a short summary.\n */\n Summary = 'Semantic#Summary',\n /**\n * Annotates a field as a calculated value based on a formula.\n */\n Calculated = 'Semantic#Calculated',\n /**\n * Annotates a field as derived from other fields.\n */\n Derived = 'Semantic#Derived',\n\n //\n // Association-Level Semantics\n //\n\n /**\n * Designates an association that links a resource to a \"User\" entity instance.\n * This is used to indicate ownership of the resource for access control purposes.\n * For example, a blog post might have a resource owner identifier that points to the user who created it.\n *\n * Defined behaviors:\n * - Automatic Ownership: When a new record is created, this field is automatically populated with the ID of the authenticated user. It also creates a foreign relationship to the `User` semantic object.\n * - Scoped Access: The runtime automatically filters list and read operations to show only records where the Owner matches the current user. update and delete operations are similarly restricted.\n */\n ResourceOwnerIdentifier = 'Semantic#ResourceOwnerIdentifier',\n /**\n * Annotates an association as supporting tag functionality.\n * Applied to associations between entities to enable tagging behavior.\n * For example, a Product-Category association with Tags semantic enables product tagging.\n */\n Tags = 'Semantic#Tags',\n /**\n * Annotates an association as supporting category functionality.\n * Applied to associations between entities to enable categorization behavior.\n * For example, a Product-Category association with Categories semantic enables product categorization.\n */\n Categories = 'Semantic#Categories',\n}\n\n/**\n * Defines the scope at which a semantic can be applied.\n */\nexport enum SemanticScope {\n /**\n * The semantic applies to an entire Data Entity.\n * This is used for semantics that provide context or constraints at the entity level.\n */\n Entity = 'Entity',\n /**\n * The semantic applies to a single Data Property.\n * This is used for semantics that provide context or constraints at the property level.\n */\n Property = 'Property',\n /**\n * The semantic applies to an Association between Data Entities.\n * This is used for semantics that provide context or constraints at the association level.\n */\n Association = 'Association',\n}\n\n/**\n * Defines categories for organizing semantics in the UI.\n */\nexport enum SemanticCategory {\n /**\n * User management, authentication, and access control\n */\n Identity = 'Identity & Authentication',\n /**\n * Timestamps, versioning, and record lifecycle\n */\n Lifecycle = 'Timestamps & Versioning',\n /**\n * Text content, media, and rich content types\n */\n Content = 'Content & Media',\n /**\n * Business-specific data like pricing, inventory, status\n */\n Business = 'Business Data',\n /**\n * Contact information and communication\n */\n Contact = 'Contact Information',\n /**\n * Organization, categorization, and tagging\n */\n Organization = 'Classification & Organization',\n /**\n * Location and geographical data\n */\n Location = 'Location & Geography',\n /**\n * Calculated and derived values\n */\n Computed = 'Computed Values',\n}\n\n/**\n * A base interface for all Data Semantics, containing common properties.\n * A semantic is an annotation applied to a Data Entity, Property, or Association\n * to provide additional context or constraints.\n * This interface is extended by more specific semantic types.\n */\ninterface BaseDataSemantic {\n /**\n * A unique identifier for the semantic definition.\n */\n id: SemanticType\n /**\n * A human-readable name for the semantic.\n */\n displayName: string\n /**\n * A description of the semantic's purpose and impact.\n */\n description: string\n /**\n * Specifies whether the semantic applies to an Entity, Property, or Association.\n */\n scope: SemanticScope\n /**\n * The category this semantic belongs to for UI organization.\n */\n category: SemanticCategory\n /**\n * Whether the semantic has a configuration or additional options.\n * This is used to determine if the semantic requires additional setup or configuration.\n */\n hasConfig: boolean\n}\n\n/**\n * Represents a semantic that can be applied to an entire Data Entity.\n */\nexport interface EntitySemantic extends BaseDataSemantic {\n scope: SemanticScope.Entity\n}\n\n/**\n * Represents a semantic that can be applied to a single property.\n */\nexport interface PropertySemantic extends BaseDataSemantic {\n scope: SemanticScope.Property\n /**\n * Optional array of data types this semantic can be applied to.\n * Enforces constraints, e.g., DeletedTimestamp on a DateTime property.\n */\n applicableDataTypes?: DomainPropertyType[]\n}\n\n/**\n * Represents a semantic that can be applied to an association between entities.\n */\nexport interface AssociationSemantic extends BaseDataSemantic {\n scope: SemanticScope.Association\n}\n\n/**\n * A type guard to check if a semantic is an EntitySemantic.\n */\nexport const isEntitySemantic = (semantic: DataSemantic): semantic is EntitySemantic =>\n semantic.scope === SemanticScope.Entity\n\n/**\n * A type guard to check if a semantic is a PropertySemantic.\n */\nexport const isPropertySemantic = (semantic: DataSemantic): semantic is PropertySemantic =>\n semantic.scope === SemanticScope.Property\n\n/**\n * A type guard to check if a semantic is a AssociationSemantic.\n */\nexport const isAssociationSemantic = (semantic: DataSemantic): semantic is AssociationSemantic =>\n semantic.scope === SemanticScope.Association\n\n/**\n * Union type for any kind of data semantic\n */\nexport type DataSemantic = EntitySemantic | PropertySemantic | AssociationSemantic\n\n/**\n * A map to store the definitions of all available data semantics.\n * This acts as a central registry for the application.\n */\nexport const DataSemantics: Record<SemanticType, DataSemantic> = {\n //\n // Identity & Authentication\n //\n\n [SemanticType.User]: {\n id: SemanticType.User,\n displayName: 'User Entity',\n scope: SemanticScope.Entity,\n description: 'System users and accounts',\n category: SemanticCategory.Identity,\n hasConfig: false,\n },\n [SemanticType.Password]: {\n id: SemanticType.Password,\n displayName: 'User Password',\n scope: SemanticScope.Property,\n description: 'Secure password field',\n category: SemanticCategory.Identity,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n [SemanticType.UserRole]: {\n id: SemanticType.UserRole,\n displayName: 'User Role Field',\n scope: SemanticScope.Property,\n description: 'User permissions and access level',\n category: SemanticCategory.Identity,\n applicableDataTypes: ['string'],\n hasConfig: false,\n },\n [SemanticType.ResourceOwnerIdentifier]: {\n id: SemanticType.ResourceOwnerIdentifier,\n displayName: 'Resource Owner Identifier',\n scope: SemanticScope.Association,\n description: 'Links record to owner user',\n category: SemanticCategory.Identity,\n hasConfig: false,\n },\n\n //\n // Timestamps & Versioning\n //\n\n [SemanticType.CreatedTimestamp]: {\n id: SemanticType.CreatedTimestamp,\n displayName: 'Creation Timestamp',\n scope: SemanticScope.Property,\n description: 'When record was created',\n category: SemanticCategory.Lifecycle,\n applicableDataTypes: ['datetime'],\n hasConfig: false,\n },\n [SemanticType.UpdatedTimestamp]: {\n id: SemanticType.UpdatedTimestamp,\n displayName: 'Update Timestamp',\n scope: SemanticScope.Property,\n description: 'When record was last modified',\n category: SemanticCategory.Lifecycle,\n applicableDataTypes: ['datetime'],\n hasConfig: false,\n },\n [SemanticType.DeletedTimestamp]: {\n id: SemanticType.DeletedTimestamp,\n displayName: 'Soft Delete Timestamp',\n scope: SemanticScope.Property,\n description: 'When record was marked deleted',\n category: SemanticCategory.Lifecycle,\n applicableDataTypes: ['datetime'],\n hasConfig: false,\n },\n [SemanticType.DeletedFlag]: {\n id: SemanticType.DeletedFlag,\n displayName: 'Soft Delete Flag',\n scope: SemanticScope.Property,\n description: 'Mark record as deleted',\n category: SemanticCategory.Lifecycle,\n applicableDataTypes: ['boolean'],\n hasConfig: false,\n },\n [SemanticType.Version]: {\n id: SemanticType.Version,\n displayName: 'Version Number',\n scope: SemanticScope.Property,\n description: 'Auto-incrementing version counter',\n category: SemanticCategory.Lifecycle,\n applicableDataTypes: ['number'],\n hasConfig: false,\n },\n\n //\n // Content & Media\n //\n\n [SemanticType.Title]: {\n id: SemanticType.Title,\n displayName: 'Record Title',\n scope: SemanticScope.Property,\n description: 'Main title or heading',\n category: SemanticCategory.Content,\n applicableDataTypes: ['string'],\n hasConfig: false,\n },\n [SemanticType.Description]: {\n id: SemanticType.Description,\n displayName: 'Description',\n scope: SemanticScope.Property,\n description: 'Detailed description text',\n category: SemanticCategory.Content,\n applicableDataTypes: ['string'],\n hasConfig: false,\n },\n [SemanticType.Summary]: {\n id: SemanticType.Summary,\n displayName: 'Summary',\n scope: SemanticScope.Property,\n description: 'Brief summary text',\n category: SemanticCategory.Content,\n applicableDataTypes: ['string'],\n hasConfig: false,\n },\n [SemanticType.Markdown]: {\n id: SemanticType.Markdown,\n displayName: 'Markdown Content',\n scope: SemanticScope.Property,\n description: 'Formatted text content',\n category: SemanticCategory.Content,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n [SemanticType.HTML]: {\n id: SemanticType.HTML,\n displayName: 'HTML Content',\n scope: SemanticScope.Property,\n description: 'Rich HTML content',\n category: SemanticCategory.Content,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n [SemanticType.ImageURL]: {\n id: SemanticType.ImageURL,\n displayName: 'Image URL',\n scope: SemanticScope.Property,\n description: 'Link to image file',\n category: SemanticCategory.Content,\n applicableDataTypes: ['string'],\n hasConfig: false,\n },\n [SemanticType.FileURL]: {\n id: SemanticType.FileURL,\n displayName: 'File URL',\n scope: SemanticScope.Property,\n description: 'Link to file attachment',\n category: SemanticCategory.Content,\n applicableDataTypes: ['string'],\n hasConfig: false,\n },\n\n //\n // Business Data\n //\n\n [SemanticType.Status]: {\n id: SemanticType.Status,\n displayName: 'Record Status',\n scope: SemanticScope.Property,\n description: 'Current state of record',\n category: SemanticCategory.Business,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n [SemanticType.Currency]: {\n id: SemanticType.Currency,\n displayName: 'Currency',\n scope: SemanticScope.Property,\n description: 'Monetary value with currency',\n category: SemanticCategory.Business,\n applicableDataTypes: ['number', 'string'],\n hasConfig: true,\n },\n [SemanticType.SKU]: {\n id: SemanticType.SKU,\n displayName: 'SKU',\n scope: SemanticScope.Property,\n description: 'Product identification code',\n category: SemanticCategory.Business,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n\n //\n // Contact Information\n //\n\n [SemanticType.Email]: {\n id: SemanticType.Email,\n displayName: 'Email',\n scope: SemanticScope.Property,\n description: 'Email address',\n category: SemanticCategory.Contact,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n [SemanticType.Phone]: {\n id: SemanticType.Phone,\n displayName: 'Phone',\n scope: SemanticScope.Property,\n description: 'Phone number',\n category: SemanticCategory.Contact,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n [SemanticType.URL]: {\n id: SemanticType.URL,\n displayName: 'URL',\n scope: SemanticScope.Property,\n description: 'Web address or link',\n category: SemanticCategory.Contact,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n\n //\n // Classification & Organization\n //\n\n [SemanticType.PublicUniqueName]: {\n id: SemanticType.PublicUniqueName,\n displayName: 'Public Unique Name (Slug)',\n scope: SemanticScope.Property,\n description: 'URL-friendly unique identifier',\n category: SemanticCategory.Organization,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n [SemanticType.Tags]: {\n id: SemanticType.Tags,\n displayName: 'Tags',\n scope: SemanticScope.Association,\n description: 'Enable tagging functionality',\n category: SemanticCategory.Organization,\n hasConfig: true,\n },\n [SemanticType.Categories]: {\n id: SemanticType.Categories,\n displayName: 'Categories',\n scope: SemanticScope.Association,\n description: 'Enable categorization functionality',\n category: SemanticCategory.Organization,\n hasConfig: true,\n },\n\n //\n // Location & Geography\n //\n\n [SemanticType.GeospatialCoordinates]: {\n id: SemanticType.GeospatialCoordinates,\n displayName: 'Geospatial Coordinates',\n scope: SemanticScope.Property,\n description: 'Location coordinates',\n category: SemanticCategory.Location,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n\n //\n // Computed Values\n //\n\n [SemanticType.Calculated]: {\n id: SemanticType.Calculated,\n displayName: 'Calculated',\n scope: SemanticScope.Property,\n description: 'Auto-calculated field value',\n category: SemanticCategory.Computed,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n [SemanticType.Derived]: {\n id: SemanticType.Derived,\n displayName: 'Derived',\n scope: SemanticScope.Property,\n description: 'Value derived from other fields',\n category: SemanticCategory.Computed,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n}\n\nexport function getSemanticsByCategory(): Record<SemanticCategory, DataSemantic[]>\nexport function getSemanticsByCategory(scope: SemanticScope.Entity): Record<SemanticCategory, EntitySemantic[]>\nexport function getSemanticsByCategory(scope: SemanticScope.Property): Record<SemanticCategory, PropertySemantic[]>\nexport function getSemanticsByCategory(\n scope: SemanticScope.Association\n): Record<SemanticCategory, AssociationSemantic[]>\n\n/**\n * Helper function to get all semantics grouped by category.\n * Useful for organizing semantics in UI dropdowns and forms.\n *\n * @param scope Optional scope to filter semantics by (Entity, Property, Association)\n */\nexport function getSemanticsByCategory(scope?: SemanticScope): Record<SemanticCategory, DataSemantic[]> {\n const result: Record<SemanticCategory, DataSemantic[]> = {\n [SemanticCategory.Identity]: [],\n [SemanticCategory.Lifecycle]: [],\n [SemanticCategory.Content]: [],\n [SemanticCategory.Business]: [],\n [SemanticCategory.Contact]: [],\n [SemanticCategory.Organization]: [],\n [SemanticCategory.Location]: [],\n [SemanticCategory.Computed]: [],\n }\n\n Object.values(DataSemantics).forEach((semantic) => {\n // If a scope is provided, filter semantics by that scope\n if (scope && semantic.scope !== scope) {\n return\n }\n result[semantic.category].push(semantic)\n })\n\n return result\n}\n\n/**\n * Helper function to get semantics for a specific category.\n * @param category The category to filter by\n * @returns Array of semantics in the specified category\n */\nexport const getSemanticsByCategoryType = (category: SemanticCategory): DataSemantic[] => {\n return Object.values(DataSemantics).filter((semantic) => semantic.category === category)\n}\n\n/**\n * Represents the application of a data semantic to a specific\n * entity or property within a user's data model.\n */\nexport interface AppliedDataSemantic {\n /**\n * The unique identifier of the semantic being applied.\n */\n id: SemanticType\n\n /**\n * Optional configuration or values specific to this application.\n */\n config?: Record<string, unknown>\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Semantics.js","sourceRoot":"","sources":["../../../src/modeling/Semantics.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,CAAN,IAAY,YA2MX;AA3MD,WAAY,YAAY;IACtB,EAAE;IACF,yBAAyB;IACzB,EAAE;IAEF;;OAEG;IACH,sCAAsB,CAAA;IAEtB,EAAE;IACF,2BAA2B;IAC3B,EAAE;IAEF;;;;OAIG;IACH,8CAA8B,CAAA;IAC9B;;;OAGG;IACH,8DAA8C,CAAA;IAC9C;;;OAGG;IACH,8DAA8C,CAAA;IAC9C;;;;;OAKG;IACH,8DAA8C,CAAA;IAC9C;;;;OAIG;IACH,oDAAoC,CAAA;IACpC;;;;;;;OAOG;IACH,8DAA8C,CAAA;IAC9C;;;;OAIG;IACH,wCAAwB,CAAA;IACxB;;;;;;OAMG;IACH,8CAA8B,CAAA;IAC9B;;;;;;;;;OASG;IACH,0CAA0B,CAAA;IAE1B;;;;OAIG;IACH,4CAA4B,CAAA;IAE5B;;;OAGG;IACH,8CAA8B,CAAA;IAE9B;;;OAGG;IACH,4CAA4B,CAAA;IAE5B;;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gB,CAAC,QAAQ,CAAC,EAAE,EAAE;QAC/B,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,EAAE;QAChC,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE;QAC9B,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,EAAE;QAC/B,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE;QAC9B,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,EAAE;QACnC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,EAAE;QAC/B,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,EAAE;KAChC,CAAA;IAED,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAChD,yDAAyD;QACzD,IAAI,KAAK,IAAI,QAAQ,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;YACtC,OAAM;QACR,CAAC;QACD,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,QAA0B,EAAkB,EAAE;IACvF,OAAO,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAA;AAC1F,CAAC,CAAA","sourcesContent":["/* eslint-disable no-redeclare */\n/* eslint-disable max-len */\nimport type { DomainPropertyType } from './DataFormat.js'\n\n/**\n * Defines the names for all available data semantics.\n * Using a string enum makes it easy to add or remove semantics in a single place.\n */\nexport enum SemanticType {\n //\n // Entity-Level Semantics\n //\n\n /**\n * Designates a Data Entity that represents users of the system.\n */\n User = 'Semantic#User',\n\n //\n // Property-Level Semantics\n //\n\n /**\n * Annotates the field as the user password.\n * The runtime should treat this field with special care,\n * ensuring it is encrypted and not exposed in API responses.\n */\n Password = 'Semantic#Password',\n /**\n * Designates a Data Property as the `createdAt` timestamp of an entity.\n * This is used to track when the entity was first created.\n */\n CreatedTimestamp = 'Semantic#CreatedTimestamp',\n /**\n * Designates a Data Property as the `updatedAt` timestamp of an entity.\n * This is used to track when the entity was last modified.\n */\n UpdatedTimestamp = 'Semantic#UpdatedTimestamp',\n /**\n * Designates a Data Property as the `deletedAt` timestamp of an entity.\n * This is used to track when the entity was soft-deleted.\n * Soft-deletion means the entity is not physically removed from the database,\n * but marked as deleted for logical deletion purposes.\n */\n DeletedTimestamp = 'Semantic#DeletedTimestamp',\n /**\n * Designates a Data Property as a boolean flag indicating whether the entity is deleted.\n * This is used for soft-deletion, where the entity is not physically removed from the database,\n * but marked as deleted.\n */\n DeletedFlag = 'Semantic#DeletedFlag',\n /**\n * Designates a Data Property as a public identifier for a resource (the slug).\n * This is often used in URLs to provide a user-friendly way to access the resource.\n * For example, a blog post might have a public unique name like \"my-first-post\".\n * The runtime automatically generates a URL-safe string from another field (like a title).\n * By default, slugs are generated to be unique, but the configuration allows for duplicates\n * in scenarios where uniqueness is handled by a combination of fields (e.g., year and slug).\n */\n PublicUniqueName = 'Semantic#PublicUniqueName',\n /**\n * A semantic that describes a title of an article, blog post, and so on. This semantic is used with\n * the `PublicUniqueName` to determine which field is responsible for the slug generation. However,\n * we may add more automation related to the `title` property in the future.\n */\n Title = 'Semantic#Title',\n /**\n * Designates a Data Property as the `role` of a user within the system.\n * This is used to define the user's permissions and access levels.\n * For example, a user with the role of \"admin\" would have elevated permissions\n * compared to a user with the role of \"guest\".\n * Roles are defined on the entity as enums, or as a string property with a controlled vocabulary.\n */\n UserRole = 'Semantic#UserRole',\n /**\n * A text or enum field to represent the state of a record (e.g., `draft`, `published`, `pending_review`, `archived`).\n *\n * Defined behaviors:\n * - State-Based Filtering: Automatically prevents public users from seeing records in a draft state.\n * - State Transitions: In principle, the runtime should prevent the user from skipping some states.\n * For example, when the record is in the `draft` state, it cannot be moved to the `archived` state without publishing it first. However,\n * we do not have enough customer feedback to design this functionality correctly right now, so\n * it serves as a placeholder semantic annotation.\n */\n Status = 'Semantic#Status',\n\n /**\n * Annotates an integer field that automatically increments.\n * The runtime automatically increments this number on every update, providing a simple way\n * to track changes and implement optimistic locking to prevent mid-air collisions.\n */\n Version = 'Semantic#Version',\n\n /**\n * Annotates a field that holds a reference to an image data via an URL.\n * The application + runtime should validate that the input is a well-formed URL.\n */\n ImageURL = 'Semantic#ImageURL',\n\n /**\n * Annotates a field that holds a reference to a file object via an URL. Ity is distinct from the\n * `ImageURL` semantic as it implicitly states that the target is non-image, binary data (an attachment, for example).\n */\n FileURL = 'Semantic#FileURL',\n\n /**\n * Annotates the field as a markdown-interpreted field.\n * When an object is created, the runtime performs additional sanitization to prevent XSS attacks.\n *\n * The annotation describes whether the data should be translated to the HTML output when\n * record is read or the original MD content should be returned.\n */\n Markdown = 'Semantic#Markdown',\n\n /**\n * Annotates the field as containing HTML content.\n * The runtime performs sanitization to prevent XSS attacks and validates HTML structure.\n *\n * The annotation describes whether the data should be rendered as HTML output when\n * record is read or the original HTML content should be returned.\n */\n HTML = 'Semantic#HTML',\n\n /**\n * Annotates a field that holds geospatial coordinate data (latitude/longitude).\n * The runtime automatically generates API capabilities for location-based queries,\n * such as \"find all restaurants within a 5-mile radius.\"\n *\n * The field should contain coordinate data in a standard format:\n * - \"40.7128,-74.0060\" (lat,lon)\n * - \"POINT(-74.0060 40.7128)\" (PostGIS format)\n * - \"40.7128°N, 74.0060°W\" (degree format)\n *\n * Defined behaviors:\n * - Spatial Indexing: The runtime automatically creates spatial indexes for efficient location-based queries\n * - Distance Queries: Enables API endpoints for finding records within specified distances\n * - Coordinate Validation: Validates that the input follows proper coordinate format\n * - PostGIS Integration: When using PostgreSQL, automatically maps to PostGIS geometry types\n */\n GeospatialCoordinates = 'Semantic#GeospatialCoordinates',\n\n /**\n * Annotates a field as an email address with validation and verification options.\n */\n Email = 'Semantic#Email',\n /**\n * Annotates a field as a phone number with validation and formatting options.\n */\n Phone = 'Semantic#Phone',\n /**\n * Annotates a field as a monetary value with currency support and precision control.\n * Can store simple decimal amounts or complex objects with amount and currency.\n *\n * As a semantic, it provides flexibility by annotating a base `number` or `string` type,\n * allowing for different storage strategies (e.g., decimal, integer cents, or a JSON object)\n * while maintaining a consistent API for currency operations.\n */\n Currency = 'Semantic#Currency',\n /**\n * Annotates a field as a URL with validation and allowed protocols.\n */\n URL = 'Semantic#URL',\n /**\n * Annotates a field as a Stock Keeping Unit (SKU).\n * Enforces uniqueness at the database level, critical for product catalogs.\n * Provides automatic validation and formatting for product identification codes.\n */\n SKU = 'Semantic#SKU',\n /**\n * Annotates a field as a long-form description.\n */\n Description = 'Semantic#Description',\n /**\n * Annotates a field as a short summary.\n */\n Summary = 'Semantic#Summary',\n /**\n * Annotates a field as a calculated value based on a formula.\n */\n Calculated = 'Semantic#Calculated',\n /**\n * Annotates a field as derived from other fields.\n */\n Derived = 'Semantic#Derived',\n\n //\n // Association-Level Semantics\n //\n\n /**\n * Designates an association that links a resource to a \"User\" entity instance.\n * This is used to indicate ownership of the resource for access control purposes.\n * For example, a blog post might have a resource owner identifier that points to the user who created it.\n *\n * Defined behaviors:\n * - Automatic Ownership: When a new record is created, this field is automatically populated with the ID of the authenticated user. It also creates a foreign relationship to the `User` semantic object.\n * - Scoped Access: The runtime automatically filters list and read operations to show only records where the Owner matches the current user. update and delete operations are similarly restricted.\n */\n ResourceOwnerIdentifier = 'Semantic#ResourceOwnerIdentifier',\n /**\n * Annotates an association as supporting tag functionality.\n * Applied to associations between entities to enable tagging behavior.\n * For example, a Product-Category association with Tags semantic enables product tagging.\n */\n Tags = 'Semantic#Tags',\n /**\n * Annotates an association as supporting category functionality.\n * Applied to associations between entities to enable categorization behavior.\n * For example, a Product-Category association with Categories semantic enables product categorization.\n */\n Categories = 'Semantic#Categories',\n}\n\n/**\n * Defines the scope at which a semantic can be applied.\n */\nexport enum SemanticScope {\n /**\n * The semantic applies to an entire Data Entity.\n * This is used for semantics that provide context or constraints at the entity level.\n */\n Entity = 'Entity',\n /**\n * The semantic applies to a single Data Property.\n * This is used for semantics that provide context or constraints at the property level.\n */\n Property = 'Property',\n /**\n * The semantic applies to an Association between Data Entities.\n * This is used for semantics that provide context or constraints at the association level.\n */\n Association = 'Association',\n}\n\n/**\n * Defines categories for organizing semantics in the UI.\n */\nexport enum SemanticCategory {\n /**\n * User management, authentication, and access control\n */\n Identity = 'Identity & Authentication',\n /**\n * Timestamps, versioning, and record lifecycle\n */\n Lifecycle = 'Timestamps & Versioning',\n /**\n * Text content, media, and rich content types\n */\n Content = 'Content & Media',\n /**\n * Business-specific data like pricing, inventory, status\n */\n Business = 'Business Data',\n /**\n * Contact information and communication\n */\n Contact = 'Contact Information',\n /**\n * Organization, categorization, and tagging\n */\n Organization = 'Classification & Organization',\n /**\n * Location and geographical data\n */\n Location = 'Location & Geography',\n /**\n * Calculated and derived values\n */\n Computed = 'Computed Values',\n}\n\n/**\n * A base interface for all Data Semantics, containing common properties.\n * A semantic is an annotation applied to a Data Entity, Property, or Association\n * to provide additional context or constraints.\n * This interface is extended by more specific semantic types.\n */\ninterface BaseDataSemantic {\n /**\n * A unique identifier for the semantic definition.\n */\n id: SemanticType\n /**\n * A human-readable name for the semantic.\n */\n displayName: string\n /**\n * A description of the semantic's purpose and impact.\n */\n description: string\n /**\n * Specifies whether the semantic applies to an Entity, Property, or Association.\n */\n scope: SemanticScope\n /**\n * The category this semantic belongs to for UI organization.\n */\n category: SemanticCategory\n /**\n * Whether the semantic has a configuration or additional options.\n * This is used to determine if the semantic requires additional setup or configuration.\n */\n hasConfig: boolean\n}\n\n/**\n * Represents a semantic that can be applied to an entire Data Entity.\n */\nexport interface EntitySemantic extends BaseDataSemantic {\n scope: SemanticScope.Entity\n}\n\n/**\n * Represents a semantic that can be applied to a single property.\n */\nexport interface PropertySemantic extends BaseDataSemantic {\n scope: SemanticScope.Property\n /**\n * Optional array of data types this semantic can be applied to.\n * Enforces constraints, e.g., DeletedTimestamp on a DateTime property.\n */\n applicableDataTypes?: DomainPropertyType[]\n}\n\n/**\n * Represents a semantic that can be applied to an association between entities.\n */\nexport interface AssociationSemantic extends BaseDataSemantic {\n scope: SemanticScope.Association\n}\n\n/**\n * A type guard to check if a semantic is an EntitySemantic.\n */\nexport const isEntitySemantic = (semantic: DataSemantic): semantic is EntitySemantic =>\n semantic.scope === SemanticScope.Entity\n\n/**\n * A type guard to check if a semantic is a PropertySemantic.\n */\nexport const isPropertySemantic = (semantic: DataSemantic): semantic is PropertySemantic =>\n semantic.scope === SemanticScope.Property\n\n/**\n * A type guard to check if a semantic is a AssociationSemantic.\n */\nexport const isAssociationSemantic = (semantic: DataSemantic): semantic is AssociationSemantic =>\n semantic.scope === SemanticScope.Association\n\n/**\n * Union type for any kind of data semantic\n */\nexport type DataSemantic = EntitySemantic | PropertySemantic | AssociationSemantic\n\n/**\n * A map to store the definitions of all available data semantics.\n * This acts as a central registry for the application.\n */\nexport const DataSemantics: Record<SemanticType, DataSemantic> = {\n //\n // Identity & Authentication\n //\n\n [SemanticType.User]: {\n id: SemanticType.User,\n displayName: 'User Entity',\n scope: SemanticScope.Entity,\n description: 'System users and accounts',\n category: SemanticCategory.Identity,\n hasConfig: false,\n },\n [SemanticType.Password]: {\n id: SemanticType.Password,\n displayName: 'User Password',\n scope: SemanticScope.Property,\n description: 'Secure password field',\n category: SemanticCategory.Identity,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n [SemanticType.UserRole]: {\n id: SemanticType.UserRole,\n displayName: 'User Role Field',\n scope: SemanticScope.Property,\n description: 'User permissions and access level',\n category: SemanticCategory.Identity,\n applicableDataTypes: ['string'],\n hasConfig: false,\n },\n [SemanticType.ResourceOwnerIdentifier]: {\n id: SemanticType.ResourceOwnerIdentifier,\n displayName: 'Resource Owner Identifier',\n scope: SemanticScope.Association,\n description: 'Links record to owner user',\n category: SemanticCategory.Identity,\n hasConfig: false,\n },\n\n //\n // Timestamps & Versioning\n //\n\n [SemanticType.CreatedTimestamp]: {\n id: SemanticType.CreatedTimestamp,\n displayName: 'Creation Timestamp',\n scope: SemanticScope.Property,\n description: 'When record was created',\n category: SemanticCategory.Lifecycle,\n applicableDataTypes: ['datetime'],\n hasConfig: false,\n },\n [SemanticType.UpdatedTimestamp]: {\n id: SemanticType.UpdatedTimestamp,\n displayName: 'Update Timestamp',\n scope: SemanticScope.Property,\n description: 'When record was last modified',\n category: SemanticCategory.Lifecycle,\n applicableDataTypes: ['datetime'],\n hasConfig: false,\n },\n [SemanticType.DeletedTimestamp]: {\n id: SemanticType.DeletedTimestamp,\n displayName: 'Soft Delete Timestamp',\n scope: SemanticScope.Property,\n description: 'When record was marked deleted',\n category: SemanticCategory.Lifecycle,\n applicableDataTypes: ['datetime'],\n hasConfig: false,\n },\n [SemanticType.DeletedFlag]: {\n id: SemanticType.DeletedFlag,\n displayName: 'Soft Delete Flag',\n scope: SemanticScope.Property,\n description: 'Mark record as deleted',\n category: SemanticCategory.Lifecycle,\n applicableDataTypes: ['boolean'],\n hasConfig: false,\n },\n [SemanticType.Version]: {\n id: SemanticType.Version,\n displayName: 'Version Number',\n scope: SemanticScope.Property,\n description: 'Auto-incrementing version counter',\n category: SemanticCategory.Lifecycle,\n applicableDataTypes: ['number'],\n hasConfig: false,\n },\n\n //\n // Content & Media\n //\n\n [SemanticType.Title]: {\n id: SemanticType.Title,\n displayName: 'Record Title',\n scope: SemanticScope.Property,\n description: 'Main title or heading',\n category: SemanticCategory.Content,\n applicableDataTypes: ['string'],\n hasConfig: false,\n },\n [SemanticType.Description]: {\n id: SemanticType.Description,\n displayName: 'Description',\n scope: SemanticScope.Property,\n description: 'Detailed description text',\n category: SemanticCategory.Content,\n applicableDataTypes: ['string'],\n hasConfig: false,\n },\n [SemanticType.Summary]: {\n id: SemanticType.Summary,\n displayName: 'Summary',\n scope: SemanticScope.Property,\n description: 'Brief summary text',\n category: SemanticCategory.Content,\n applicableDataTypes: ['string'],\n hasConfig: false,\n },\n [SemanticType.Markdown]: {\n id: SemanticType.Markdown,\n displayName: 'Markdown Content',\n scope: SemanticScope.Property,\n description: 'Formatted text content',\n category: SemanticCategory.Content,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n [SemanticType.HTML]: {\n id: SemanticType.HTML,\n displayName: 'HTML Content',\n scope: SemanticScope.Property,\n description: 'Rich HTML content',\n category: SemanticCategory.Content,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n [SemanticType.ImageURL]: {\n id: SemanticType.ImageURL,\n displayName: 'Image URL',\n scope: SemanticScope.Property,\n description: 'Link to image file',\n category: SemanticCategory.Content,\n applicableDataTypes: ['string'],\n hasConfig: false,\n },\n [SemanticType.FileURL]: {\n id: SemanticType.FileURL,\n displayName: 'File URL',\n scope: SemanticScope.Property,\n description: 'Link to file attachment',\n category: SemanticCategory.Content,\n applicableDataTypes: ['string'],\n hasConfig: false,\n },\n\n //\n // Business Data\n //\n\n [SemanticType.Status]: {\n id: SemanticType.Status,\n displayName: 'Record Status',\n scope: SemanticScope.Property,\n description: 'Current state of record',\n category: SemanticCategory.Business,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n [SemanticType.Currency]: {\n id: SemanticType.Currency,\n displayName: 'Currency',\n scope: SemanticScope.Property,\n description: 'Monetary value with currency',\n category: SemanticCategory.Business,\n applicableDataTypes: ['number', 'string'],\n hasConfig: true,\n },\n [SemanticType.SKU]: {\n id: SemanticType.SKU,\n displayName: 'SKU',\n scope: SemanticScope.Property,\n description: 'Product identification code',\n category: SemanticCategory.Business,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n\n //\n // Contact Information\n //\n\n [SemanticType.Email]: {\n id: SemanticType.Email,\n displayName: 'Email',\n scope: SemanticScope.Property,\n description: 'Email address',\n category: SemanticCategory.Contact,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n [SemanticType.Phone]: {\n id: SemanticType.Phone,\n displayName: 'Phone',\n scope: SemanticScope.Property,\n description: 'Phone number',\n category: SemanticCategory.Contact,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n [SemanticType.URL]: {\n id: SemanticType.URL,\n displayName: 'URL',\n scope: SemanticScope.Property,\n description: 'Web address or link',\n category: SemanticCategory.Contact,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n\n //\n // Classification & Organization\n //\n\n [SemanticType.PublicUniqueName]: {\n id: SemanticType.PublicUniqueName,\n displayName: 'Public Unique Name (Slug)',\n scope: SemanticScope.Property,\n description: 'URL-friendly unique identifier',\n category: SemanticCategory.Organization,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n [SemanticType.Tags]: {\n id: SemanticType.Tags,\n displayName: 'Tags',\n scope: SemanticScope.Association,\n description: 'Enable tagging functionality',\n category: SemanticCategory.Organization,\n hasConfig: true,\n },\n [SemanticType.Categories]: {\n id: SemanticType.Categories,\n displayName: 'Categories',\n scope: SemanticScope.Association,\n description: 'Enable categorization functionality',\n category: SemanticCategory.Organization,\n hasConfig: true,\n },\n\n //\n // Location & Geography\n //\n\n [SemanticType.GeospatialCoordinates]: {\n id: SemanticType.GeospatialCoordinates,\n displayName: 'Geospatial Coordinates',\n scope: SemanticScope.Property,\n description: 'Location coordinates',\n category: SemanticCategory.Location,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n\n //\n // Computed Values\n //\n\n // Calculated field can be added to any data type as we can compute any value.\n [SemanticType.Calculated]: {\n id: SemanticType.Calculated,\n displayName: 'Calculated',\n scope: SemanticScope.Property,\n description: 'Auto-calculated field value',\n category: SemanticCategory.Computed,\n applicableDataTypes: ['string', 'number', 'boolean', 'date', 'datetime', 'time', 'binary'],\n hasConfig: true,\n },\n [SemanticType.Derived]: {\n id: SemanticType.Derived,\n displayName: 'Derived',\n scope: SemanticScope.Property,\n description: 'Value derived from other fields',\n category: SemanticCategory.Computed,\n applicableDataTypes: ['string'],\n hasConfig: true,\n },\n}\n\nexport function getSemanticsByCategory(): Record<SemanticCategory, DataSemantic[]>\nexport function getSemanticsByCategory(scope: SemanticScope.Entity): Record<SemanticCategory, EntitySemantic[]>\nexport function getSemanticsByCategory(scope: SemanticScope.Property): Record<SemanticCategory, PropertySemantic[]>\nexport function getSemanticsByCategory(\n scope: SemanticScope.Association\n): Record<SemanticCategory, AssociationSemantic[]>\n\n/**\n * Helper function to get all semantics grouped by category.\n * Useful for organizing semantics in UI dropdowns and forms.\n *\n * @param scope Optional scope to filter semantics by (Entity, Property, Association)\n */\nexport function getSemanticsByCategory(scope?: SemanticScope): Record<SemanticCategory, DataSemantic[]> {\n const result: Record<SemanticCategory, DataSemantic[]> = {\n [SemanticCategory.Identity]: [],\n [SemanticCategory.Lifecycle]: [],\n [SemanticCategory.Content]: [],\n [SemanticCategory.Business]: [],\n [SemanticCategory.Contact]: [],\n [SemanticCategory.Organization]: [],\n [SemanticCategory.Location]: [],\n [SemanticCategory.Computed]: [],\n }\n\n Object.values(DataSemantics).forEach((semantic) => {\n // If a scope is provided, filter semantics by that scope\n if (scope && semantic.scope !== scope) {\n return\n }\n result[semantic.category].push(semantic)\n })\n\n return result\n}\n\n/**\n * Helper function to get semantics for a specific category.\n * @param category The category to filter by\n * @returns Array of semantics in the specified category\n */\nexport const getSemanticsByCategoryType = (category: SemanticCategory): DataSemantic[] => {\n return Object.values(DataSemantics).filter((semantic) => semantic.category === category)\n}\n\n/**\n * Represents the application of a data semantic to a specific\n * entity or property within a user's data model.\n */\nexport interface AppliedDataSemantic {\n /**\n * The unique identifier of the semantic being applied.\n */\n id: SemanticType\n\n /**\n * Optional configuration or values specific to this application.\n */\n config?: Record<string, unknown>\n}\n"]}
|
|
@@ -403,11 +403,11 @@ export class ShapeGenerator {
|
|
|
403
403
|
if (bindings?.xml) {
|
|
404
404
|
result.xmlSerialization = bindings.xml;
|
|
405
405
|
}
|
|
406
|
-
if (bindings?.pattern) {
|
|
407
|
-
result.pattern = bindings.pattern;
|
|
408
|
-
}
|
|
409
406
|
const { schema, type } = input;
|
|
410
407
|
if (schema) {
|
|
408
|
+
if (schema.pattern) {
|
|
409
|
+
result.pattern = schema.pattern;
|
|
410
|
+
}
|
|
411
411
|
if (typeof schema.multipleOf === 'number') {
|
|
412
412
|
result.multipleOf = schema.multipleOf;
|
|
413
413
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShapeGenerator.js","sourceRoot":"","sources":["../../../../src/modeling/amf/ShapeGenerator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACjE,OAAO,EACL,QAAQ,EACR,UAAU,EACV,SAAS,EAYT,SAAS,EACT,aAAa,EACb,cAAc,EACd,WAAW,EACX,UAAU,GACX,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAG5E,MAAM,iBAAiB,GAAG,OAAO,CAAA;AACjC,MAAM,iBAAiB,GAAG,OAAO,CAAA;AACjC,MAAM,iBAAiB,GAAG,OAAO,CAAA;AACjC,MAAM,cAAc,GAAG,KAAK,CAAA;AAC5B,MAAM,gBAAgB,GAAG,QAAQ,CAAA;AACjC,MAAM,gBAAgB,GAAG,QAAQ,CAAA;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,cAAc;IACzB,eAAe,CAAqB;IAEpC;;;;OAIG;IACH,IAAI,cAAc;QAChB,oEAAoE;QACpE,uEAAuE;QACvE,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1B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AgB,EAAE,CAAC;YAC3C,MAAM,CAAC,UAAU,GAAI,KAAsB,CAAC,UAAU,CAAA;QACxD,CAAC;IACH,CAAC;IAES,oBAAoB,CAAC,KAAmB;QAChD,OAAO,cAAc,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;;;OAOG;IACO,oBAAoB,CAAC,EAAU,EAAE,KAAkB;QAC3D,MAAM,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC,CAAA;QAC7B,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;QACpB,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import { type AssociationBindings, type PropertyWebBindings } from '../Bindings.js'\nimport type { DomainAssociation } from '../DomainAssociation.js'\nimport type { DomainProperty } from '../DomainProperty.js'\nimport type { DomainEntity } from '../DomainEntity.js'\nimport { IAmfExampleTypes, modelTypeToAmfDataType } from '../../amf/AmfTypes.js'\nimport { AmfNamespace } from '../../amf/definitions/Namespace.js'\nimport {\n anyShape,\n arrayShape,\n fileShape,\n IApiAnyShape,\n IApiArrayShape,\n IApiDataExample,\n IApiFileShape,\n IApiNodeShape,\n IApiPropertyShape,\n IApiRecursiveShape,\n IApiScalarShape,\n IApiShape,\n IApiUnionShape,\n IShapeUnion,\n nodeShape,\n propertyShape,\n recursiveShape,\n scalarShape,\n unionShape,\n} from '../../amf/definitions/Shapes.js'\nimport { AmfDataNode } from '../../amf/models/AmfDataNode.js'\nimport { DataValueGenerator } from '../../amf/DataValueGenerator.js'\nimport { nanoid } from '../../nanoid.js'\nimport { DomainEntityKind, DomainPropertyKind } from '../../models/kinds.js'\nimport type { PropertySchema } from '../types.js'\n\nconst UNION_TYPE_ANY_OF = 'anyOf'\nconst UNION_TYPE_ALL_OF = 'allOf'\nconst UNION_TYPE_ONE_OF = 'oneOf'\nconst UNION_TYPE_NOT = 'not'\nconst DATA_TYPE_STRING = 'string'\nconst DATA_TYPE_BINARY = 'binary'\n\n/**\n * Serializes Data Domain elements (DomainEntity, DomainProperty, DomainAssociation)\n * to AMF shapes.\n *\n * This class provides a mechanism to translate a data domain model, defined using\n * custom classes like `DomainEntity`, `DomainProperty`, and `DomainAssociation`,\n * into AMF (API Modeling Framework) shapes. AMF shapes are a standardized way\n * to represent API structures and data models, enabling interoperability and tooling.\n *\n * This is particularly useful when you have a custom data model and need to\n * generate API definitions (e.g., RAML or OAS) from it.\n *\n * **Key Features:**\n *\n * - **Data Domain to AMF Translation:** Converts data domain elements into\n * their corresponding AMF shape representations.\n * - **Recursive Shape Handling:** Detects and handles recursive relationships\n * within the data model to prevent infinite loops during shape generation.\n * - **Union Type Support:** Supports the creation of union types in AMF\n * to represent associations that can point to multiple different entity types.\n * - **Binding Integration:** Leverages binding information (e.g., web bindings)\n * to customize the generated AMF shapes based on the target API format.\n * - **Example and Default Value Generation:** Integrates with a `DataValueGenerator`\n * to automatically generate example values and default values for properties\n * within the AMF shapes.\n *\n * **Usage:**\n *\n * 1. Create an instance of the `ShapeGenerator`.\n * 2. Call the appropriate method (e.g., `entity()`, `property()`, `associationShape()`)\n * to generate the AMF shape for a specific data domain element.\n * 3. The returned AMF shape can then be used with other AMF tools to generate\n * API definitions or perform other API-related tasks.\n */\nexport class ShapeGenerator {\n #valueGenerator?: DataValueGenerator\n\n /**\n * Used with data domain value generation for entity properties.\n * Lazily loaded class only when functions are used.\n * This needs to be a class instances because some functions are incremental\n */\n get valueGenerator(): DataValueGenerator {\n // we need a new instance of the generator for each shape generation\n // as the generator is stateful and we need to reset it for each shape.\n if (!this.#valueGenerator) {\n this.#valueGenerator = new DataValueGenerator()\n }\n return this.#valueGenerator\n }\n\n /**\n * Serializes a `DomainEntity` to an AMF node shape.\n *\n * This method is the entry point for converting a `DomainEntity` into its\n * AMF representation. It handles recursive relationships, property serialization,\n * and inheritance from parent entities.\n *\n * @param input The `DomainEntity` to serialize.\n * @param visited A `Set` of keys of already generated entities. This prevents\n * recursive shape generation and avoids infinite loops. Defaults to a new empty `Set`.\n * @returns An `IApiNodeShape` or `IApiRecursiveShape` representing the entity in AMF.\n * Returns a `IApiRecursiveShape` if a recursive loop is detected.\n * @example\n * ```typescript\n * const generator = new ShapeGenerator();\n * const amfShape = generator.entity(myDomainEntity);\n * ```\n */\n entity(input: DomainEntity, visited = new Set<string>()): IApiNodeShape | IApiRecursiveShape {\n if (visited.has(input.key)) {\n // create a recursive shape.\n return this.createRecursiveShape(input)\n }\n visited.add(input.key)\n const result = nodeShape(input.key)\n result.id = input.key\n this.updateBaseProperties(input, result)\n result.properties = []\n for (const item of input.listProperties()) {\n // we check whether the property is hidden.\n // This is not happening when calling the `property()` because this method\n // always returns the AMF shape.\n const wb = item.readBinding('web') as PropertyWebBindings | undefined\n if (wb && wb.hidden) {\n continue\n }\n const shape = this.property(item)\n result.properties.push(shape)\n }\n for (const assoc of input.listAssociations()) {\n const wb = assoc.readBinding('web') as AssociationBindings | undefined\n if (wb && wb.hidden) {\n continue\n }\n const prop = this.associationProperty(assoc, visited)\n result.properties.push(prop)\n }\n for (const parent of input.listParents()) {\n const shape = this.entity(parent, visited)\n result.inherits.push(shape)\n }\n return result\n }\n\n /**\n * Serializes a `DomainProperty` to an AMF property shape.\n *\n * This method converts a `DomainProperty` into an `IApiPropertyShape`,\n * defining its characteristics such as data type, required status, and\n * range (the shape of the property's value).\n *\n * @param input The `DomainProperty` to serialize.\n * @returns An `IApiPropertyShape` representing the property in AMF.\n * @example\n * ```typescript\n * const generator = new ShapeGenerator();\n * const amfShape = generator.property(myDomainProperty);\n * ```\n */\n property(input: DomainProperty): IApiPropertyShape {\n const { required, key } = input\n const result = propertyShape(key)\n result.path = `${AmfNamespace.aml.vocabularies.data.key}${input.info.name}`\n if (required) {\n result.minCount = 1\n }\n result.range = this.getRange(input)\n\n // for example, Example generator needs to know the name of the property\n // as it does not look into the \"range\" object.\n this.updateBaseProperties(input, result)\n\n // sync the name of the property shape with the range, in case it was changed by the bindings\n if (result.range.name) {\n result.name = result.range.name\n }\n return result\n }\n\n /**\n * Serializes a `DomainAssociation` to an AMF property shape, handling the\n * association's target entity or entities.\n *\n * This method is similar to `property()`, but it specifically handles\n * associations between entities. It determines the range of the property\n * based on the association's target(s) and generates the appropriate\n * AMF shape (e.g., a scalar shape for a linked schema, a union shape for\n * multiple targets).\n *\n * @param input The `DomainAssociation` to serialize.\n * @param visited A `Set` of keys of already generated entities. This prevents\n * recursive shape generation and avoids infinite loops. Defaults to a new empty `Set`.\n * @returns An `IApiPropertyShape` representing the association in AMF.\n * @example\n * ```typescript\n * const generator = new ShapeGenerator();\n * const amfShape = generator.associationProperty(myDomainAssociation);\n * ```\n */\n associationProperty(input: DomainAssociation, visited: Set<string> = new Set<string>()): IApiPropertyShape {\n const { required, key } = input\n const result = propertyShape(key)\n result.path = `${AmfNamespace.aml.vocabularies.data.key}${input.info.name}`\n if (required) {\n result.minCount = 1\n }\n result.range = this.associationShape(input, visited)\n\n this.updateBaseProperties(input, result)\n return result\n }\n\n /**\n * Generates a shape for an association. Most likely you want to use the `associationProperty()` method instead.\n *\n * @param input The data association instance.\n * @param visited A `Set` of keys of already generated entities. This prevents\n * recursive shape generation and avoids infinite loops. Defaults to a new empty `Set`.\n * @returns The range value for the PropertyShape.\n */\n associationShape(input: DomainAssociation, visited: Set<string> = new Set<string>()): IShapeUnion | undefined {\n const schema = input.schema\n if (schema && schema.linked) {\n return this.createLinkedShape(input)\n }\n const items = this.associationUnion(input, visited)\n if (!items) {\n return\n }\n if (Array.isArray(items)) {\n return this.createUnionShape(input, items)\n }\n const unionType = (schema && schema.unionType) || UNION_TYPE_ANY_OF\n if (unionType === UNION_TYPE_NOT) {\n // Need to investigate more about \"not\" union type.\n // AMF supports it, but I am not sure how to handle it.\n const wrapper = anyShape(input.key)\n wrapper.id = `not-shape-${input.key}`\n wrapper.not = items\n return wrapper\n }\n if (input.multiple) {\n return this.refactorShapeToArray(input.key, items)\n }\n return items\n }\n\n /**\n * @param input The data association instance.\n * @returns An AMF API scalar shape with the link to the schema.\n */\n protected createLinkedShape(input: DomainAssociation): IApiScalarShape {\n // This is a link to the schema. In an API that would be the id\n // of a resource to request the data from.\n const range = scalarShape(input.key)\n range.id = `link-${input.key}`\n range.dataType = modelTypeToAmfDataType(DATA_TYPE_STRING)\n return range\n }\n\n protected createUnionShape(input: DomainAssociation, items: IShapeUnion[]): IApiUnionShape | IApiArrayShape {\n const range = unionShape(input.key)\n this.updateBaseProperties(input, range)\n range.anyOf = []\n const unionType = (input.schema && input.schema.unionType) || UNION_TYPE_ANY_OF\n if (unionType === UNION_TYPE_ANY_OF) {\n range.anyOf = items\n } else if (unionType === UNION_TYPE_ALL_OF) {\n range.and = items\n } else if (unionType === UNION_TYPE_ONE_OF) {\n range.xone = items\n } else {\n // the \"not\" union type only supports a single schema.\n // I am not sure how this should be handled. Will take the first one\n // for now.\n range.not = items[0]\n }\n if (input.multiple) {\n return this.refactorShapeToArray(input.key, range)\n }\n return range\n }\n\n /**\n * Generates a shape list for an union. Most likely you want to use the `associationProperty()` method instead.\n *\n * @param input The data association instance.\n * @returns The range value for the PropertyShape.\n */\n associationUnion(\n input: DomainAssociation,\n visited: Set<string> = new Set<string>()\n ): IShapeUnion | IShapeUnion[] | undefined {\n const result: IShapeUnion[] = []\n for (const item of input.listTargets()) {\n result.push(this.entity(item, visited))\n }\n if (!result.length) {\n return undefined\n }\n if (result.length > 1) {\n return result\n }\n return result[0]\n }\n\n /**\n * The DomainProperty may have both the `schema` and the `bindings`. For AMF shape we read `schema` for\n * default value, examples, and enum values. We also look for the `web`\n * bindings for more detailed definition of a shape.\n *\n * @param input\n */\n protected getRange(input: DomainProperty): IApiArrayShape | IApiFileShape | IApiScalarShape {\n const bindings = input.readBinding('web') as PropertyWebBindings | undefined\n let schema: PropertySchema | undefined\n if (input.schema) {\n schema = input.schema\n }\n const { multiple, type } = input\n if (multiple) {\n return this.createArrayShape(input, schema, bindings)\n }\n if (type === DATA_TYPE_BINARY) {\n return this.createFileShape(input, bindings)\n }\n return this.createScalarShape(input, schema, bindings)\n }\n\n /**\n * Normally this would be part of generating a scalar schema but the the property is an array this\n * is generated on the array and not on the range.\n *\n * @param result The scalar or array shape.\n * @param schema The property schema\n * @param type The data type of the parent property as set on the `range`\n * @param isArray Whether the DomainProperty is multiple\n */\n protected setShapeSchema(\n input: DomainProperty,\n result: IApiAnyShape,\n schema: PropertySchema,\n type: string,\n isArray?: boolean\n ): void {\n if (schema.defaultValue) {\n const { type: dfFormat } = schema.defaultValue\n const { value } = schema.defaultValue\n if (dfFormat === 'function') {\n const tmp = this.valueGenerator.generate(value, input.type)\n if (tmp !== DataValueGenerator.noValue) {\n const dt = AmfDataNode.scalar(tmp as string, dfFormat)\n result.defaultValue = dt.toJSON()\n }\n } else {\n const dt = AmfDataNode.scalar(value, type)\n result.defaultValue = dt.toJSON()\n }\n }\n if (Array.isArray(schema.enum)) {\n result.values = schema.enum.map((i) => AmfDataNode.scalar(i, type).toJSON())\n }\n if (Array.isArray(schema.examples)) {\n if (isArray) {\n result.examples = this.createArrayExamples(schema.examples, type)\n } else {\n result.examples = this.createExamples(schema.examples, type)\n }\n }\n }\n\n protected createArrayShape(\n input: DomainProperty,\n schema?: PropertySchema,\n bindings?: PropertyWebBindings\n ): IApiArrayShape {\n const result = arrayShape(input.key)\n const { type } = input\n if (type === DATA_TYPE_BINARY) {\n // we do not pass schema to the range generator as we set schema's properties on the array shape.\n result.items = this.createFileShape(input, bindings)\n } else {\n result.items = this.createScalarShape(input, undefined, bindings)\n }\n if (schema) {\n const type = (result.items as IApiScalarShape).dataType as string\n this.setShapeSchema(input, result, schema, type, input.multiple)\n }\n return result\n }\n\n protected createScalarShape(\n input: DomainProperty,\n schema?: PropertySchema,\n bindings?: PropertyWebBindings\n ): IApiScalarShape {\n const result = scalarShape(input.key)\n this.updateBaseProperties(input, result)\n this.setScalarCommonProperties(result, input, bindings)\n if (!result.dataType) {\n result.dataType = modelTypeToAmfDataType(input.type, bindings)\n }\n if (schema) {\n this.setShapeSchema(input, result, schema, result.dataType as string, input.multiple)\n }\n return result\n }\n\n protected createExamples(examples: string[], type: string): IApiDataExample[] {\n const result: IApiDataExample[] = []\n for (const current of examples) {\n const item: IApiDataExample = {\n id: nanoid(),\n customDomainProperties: [],\n strict: true,\n types: IAmfExampleTypes,\n structuredValue: AmfDataNode.scalar(current, type).toJSON(),\n }\n result.push(item)\n }\n return result\n }\n\n protected createArrayExamples(examples: string[], type: string): IApiDataExample[] {\n const item: IApiDataExample = {\n id: nanoid(),\n customDomainProperties: [],\n strict: true,\n types: IAmfExampleTypes,\n }\n const value = new AmfDataNode('array')\n for (const item of examples) {\n const member = AmfDataNode.scalar(item, type)\n value.addMember(member)\n }\n item.structuredValue = value.toJSON()\n return [item]\n }\n\n protected createFileShape(input: DomainProperty, bindings?: PropertyWebBindings): IApiFileShape {\n const result = fileShape(input.key)\n this.updateBaseProperties(input, result)\n if (bindings) {\n if (Array.isArray(bindings.fileTypes)) {\n result.fileTypes = bindings.fileTypes\n }\n this.setScalarCommonProperties(result, input, bindings)\n if (bindings.format === 'base64') {\n result.format = AmfNamespace.w3.xmlSchema.base64Binary\n }\n }\n return result\n }\n\n protected setScalarCommonProperties(\n result: IApiFileShape | IApiScalarShape,\n input: DomainProperty,\n bindings?: PropertyWebBindings\n ): void {\n if (bindings?.name) {\n result.name = bindings.name\n }\n if (bindings?.xml) {\n result.xmlSerialization = bindings.xml\n }\n if (bindings?.pattern) {\n result.pattern = bindings.pattern\n }\n const { schema, type } = input\n if (schema) {\n if (typeof schema.multipleOf === 'number') {\n result.multipleOf = schema.multipleOf\n }\n if (typeof schema.minimum === 'number') {\n if (type === DATA_TYPE_STRING) {\n result.minLength = schema.minimum\n } else {\n result.minimum = schema.minimum\n }\n }\n if (typeof schema.maximum === 'number') {\n if (type === DATA_TYPE_STRING) {\n result.maxLength = schema.maximum\n } else {\n result.maximum = schema.maximum\n }\n }\n if (typeof schema.exclusiveMinimum === 'boolean') {\n result.exclusiveMinimum = schema.exclusiveMinimum\n }\n if (typeof schema.exclusiveMaximum === 'boolean') {\n result.exclusiveMaximum = schema.exclusiveMaximum\n }\n }\n if (bindings?.format) {\n switch (bindings.format) {\n case 'base64':\n result.format = AmfNamespace.w3.xmlSchema.base64Binary\n break\n case 'double':\n result.format = AmfNamespace.w3.xmlSchema.double\n break\n case 'float':\n result.format = AmfNamespace.w3.xmlSchema.float\n break\n case 'int32':\n result.format = AmfNamespace.w3.xmlSchema.integer\n break\n case 'int64':\n result.format = AmfNamespace.w3.xmlSchema.integer\n break\n }\n // result.format = bindings.format\n }\n if (typeof input.readOnly === 'boolean') {\n result.readOnly = input.readOnly\n }\n if (typeof input.writeOnly === 'boolean') {\n result.writeOnly = input.writeOnly\n }\n }\n\n protected updateBaseProperties(input: DomainProperty | DomainAssociation | DomainEntity, target: IApiShape): void {\n target.name = input.info.name\n target.displayName = input.info.displayName\n target.description = input.info.description\n if (input.kind === DomainPropertyKind) {\n target.deprecated = (input as DomainProperty).deprecated\n } else if (input.kind === DomainEntityKind) {\n target.deprecated = (input as DomainEntity).deprecated\n }\n }\n\n protected createRecursiveShape(input: DomainEntity): IApiRecursiveShape {\n return recursiveShape(input.key, input.key)\n }\n\n /**\n * Translates the shape to an array shape. This happens when data model property\n * is changed from 'multiple' to not-multiple and back.\n *\n * @param id The key of the parameter or an association\n * @param shape The shape to wrap as an array.\n * @returns Array shape.\n */\n protected refactorShapeToArray(id: string, shape: IShapeUnion): IApiArrayShape {\n const result = arrayShape(id)\n result.items = shape\n return result\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ShapeGenerator.js","sourceRoot":"","sources":["../../../../src/modeling/amf/ShapeGenerator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACjE,OAAO,EACL,QAAQ,EACR,UAAU,EACV,SAAS,EAYT,SAAS,EACT,aAA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CAAA;oBACjD,MAAK;YACT,CAAC;YACD,kCAAkC;QACpC,CAAC;QACD,IAAI,OAAO,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACxC,MAAM,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAA;QAClC,CAAC;QACD,IAAI,OAAO,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACzC,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAA;QACpC,CAAC;IACH,CAAC;IAES,oBAAoB,CAAC,KAAwD,EAAE,MAAiB;QACxG,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAA;QAC7B,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAA;QAC3C,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAA;QAC3C,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;YACtC,MAAM,CAAC,UAAU,GAAI,KAAwB,CAAC,UAAU,CAAA;QAC1D,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;YAC3C,MAAM,CAAC,UAAU,GAAI,KAAsB,CAAC,UAAU,CAAA;QACxD,CAAC;IACH,CAAC;IAES,oBAAoB,CAAC,KAAmB;QAChD,OAAO,cAAc,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;;;OAOG;IACO,oBAAoB,CAAC,EAAU,EAAE,KAAkB;QAC3D,MAAM,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC,CAAA;QAC7B,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;QACpB,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import { type AssociationBindings, type PropertyWebBindings } from '../Bindings.js'\nimport type { DomainAssociation } from '../DomainAssociation.js'\nimport type { DomainProperty } from '../DomainProperty.js'\nimport type { DomainEntity } from '../DomainEntity.js'\nimport { IAmfExampleTypes, modelTypeToAmfDataType } from '../../amf/AmfTypes.js'\nimport { AmfNamespace } from '../../amf/definitions/Namespace.js'\nimport {\n anyShape,\n arrayShape,\n fileShape,\n IApiAnyShape,\n IApiArrayShape,\n IApiDataExample,\n IApiFileShape,\n IApiNodeShape,\n IApiPropertyShape,\n IApiRecursiveShape,\n IApiScalarShape,\n IApiShape,\n IApiUnionShape,\n IShapeUnion,\n nodeShape,\n propertyShape,\n recursiveShape,\n scalarShape,\n unionShape,\n} from '../../amf/definitions/Shapes.js'\nimport { AmfDataNode } from '../../amf/models/AmfDataNode.js'\nimport { DataValueGenerator } from '../../amf/DataValueGenerator.js'\nimport { nanoid } from '../../nanoid.js'\nimport { DomainEntityKind, DomainPropertyKind } from '../../models/kinds.js'\nimport type { PropertySchema } from '../types.js'\n\nconst UNION_TYPE_ANY_OF = 'anyOf'\nconst UNION_TYPE_ALL_OF = 'allOf'\nconst UNION_TYPE_ONE_OF = 'oneOf'\nconst UNION_TYPE_NOT = 'not'\nconst DATA_TYPE_STRING = 'string'\nconst DATA_TYPE_BINARY = 'binary'\n\n/**\n * Serializes Data Domain elements (DomainEntity, DomainProperty, DomainAssociation)\n * to AMF shapes.\n *\n * This class provides a mechanism to translate a data domain model, defined using\n * custom classes like `DomainEntity`, `DomainProperty`, and `DomainAssociation`,\n * into AMF (API Modeling Framework) shapes. AMF shapes are a standardized way\n * to represent API structures and data models, enabling interoperability and tooling.\n *\n * This is particularly useful when you have a custom data model and need to\n * generate API definitions (e.g., RAML or OAS) from it.\n *\n * **Key Features:**\n *\n * - **Data Domain to AMF Translation:** Converts data domain elements into\n * their corresponding AMF shape representations.\n * - **Recursive Shape Handling:** Detects and handles recursive relationships\n * within the data model to prevent infinite loops during shape generation.\n * - **Union Type Support:** Supports the creation of union types in AMF\n * to represent associations that can point to multiple different entity types.\n * - **Binding Integration:** Leverages binding information (e.g., web bindings)\n * to customize the generated AMF shapes based on the target API format.\n * - **Example and Default Value Generation:** Integrates with a `DataValueGenerator`\n * to automatically generate example values and default values for properties\n * within the AMF shapes.\n *\n * **Usage:**\n *\n * 1. Create an instance of the `ShapeGenerator`.\n * 2. Call the appropriate method (e.g., `entity()`, `property()`, `associationShape()`)\n * to generate the AMF shape for a specific data domain element.\n * 3. The returned AMF shape can then be used with other AMF tools to generate\n * API definitions or perform other API-related tasks.\n */\nexport class ShapeGenerator {\n #valueGenerator?: DataValueGenerator\n\n /**\n * Used with data domain value generation for entity properties.\n * Lazily loaded class only when functions are used.\n * This needs to be a class instances because some functions are incremental\n */\n get valueGenerator(): DataValueGenerator {\n // we need a new instance of the generator for each shape generation\n // as the generator is stateful and we need to reset it for each shape.\n if (!this.#valueGenerator) {\n this.#valueGenerator = new DataValueGenerator()\n }\n return this.#valueGenerator\n }\n\n /**\n * Serializes a `DomainEntity` to an AMF node shape.\n *\n * This method is the entry point for converting a `DomainEntity` into its\n * AMF representation. It handles recursive relationships, property serialization,\n * and inheritance from parent entities.\n *\n * @param input The `DomainEntity` to serialize.\n * @param visited A `Set` of keys of already generated entities. This prevents\n * recursive shape generation and avoids infinite loops. Defaults to a new empty `Set`.\n * @returns An `IApiNodeShape` or `IApiRecursiveShape` representing the entity in AMF.\n * Returns a `IApiRecursiveShape` if a recursive loop is detected.\n * @example\n * ```typescript\n * const generator = new ShapeGenerator();\n * const amfShape = generator.entity(myDomainEntity);\n * ```\n */\n entity(input: DomainEntity, visited = new Set<string>()): IApiNodeShape | IApiRecursiveShape {\n if (visited.has(input.key)) {\n // create a recursive shape.\n return this.createRecursiveShape(input)\n }\n visited.add(input.key)\n const result = nodeShape(input.key)\n result.id = input.key\n this.updateBaseProperties(input, result)\n result.properties = []\n for (const item of input.listProperties()) {\n // we check whether the property is hidden.\n // This is not happening when calling the `property()` because this method\n // always returns the AMF shape.\n const wb = item.readBinding('web') as PropertyWebBindings | undefined\n if (wb && wb.hidden) {\n continue\n }\n const shape = this.property(item)\n result.properties.push(shape)\n }\n for (const assoc of input.listAssociations()) {\n const wb = assoc.readBinding('web') as AssociationBindings | undefined\n if (wb && wb.hidden) {\n continue\n }\n const prop = this.associationProperty(assoc, visited)\n result.properties.push(prop)\n }\n for (const parent of input.listParents()) {\n const shape = this.entity(parent, visited)\n result.inherits.push(shape)\n }\n return result\n }\n\n /**\n * Serializes a `DomainProperty` to an AMF property shape.\n *\n * This method converts a `DomainProperty` into an `IApiPropertyShape`,\n * defining its characteristics such as data type, required status, and\n * range (the shape of the property's value).\n *\n * @param input The `DomainProperty` to serialize.\n * @returns An `IApiPropertyShape` representing the property in AMF.\n * @example\n * ```typescript\n * const generator = new ShapeGenerator();\n * const amfShape = generator.property(myDomainProperty);\n * ```\n */\n property(input: DomainProperty): IApiPropertyShape {\n const { required, key } = input\n const result = propertyShape(key)\n result.path = `${AmfNamespace.aml.vocabularies.data.key}${input.info.name}`\n if (required) {\n result.minCount = 1\n }\n result.range = this.getRange(input)\n\n // for example, Example generator needs to know the name of the property\n // as it does not look into the \"range\" object.\n this.updateBaseProperties(input, result)\n\n // sync the name of the property shape with the range, in case it was changed by the bindings\n if (result.range.name) {\n result.name = result.range.name\n }\n return result\n }\n\n /**\n * Serializes a `DomainAssociation` to an AMF property shape, handling the\n * association's target entity or entities.\n *\n * This method is similar to `property()`, but it specifically handles\n * associations between entities. It determines the range of the property\n * based on the association's target(s) and generates the appropriate\n * AMF shape (e.g., a scalar shape for a linked schema, a union shape for\n * multiple targets).\n *\n * @param input The `DomainAssociation` to serialize.\n * @param visited A `Set` of keys of already generated entities. This prevents\n * recursive shape generation and avoids infinite loops. Defaults to a new empty `Set`.\n * @returns An `IApiPropertyShape` representing the association in AMF.\n * @example\n * ```typescript\n * const generator = new ShapeGenerator();\n * const amfShape = generator.associationProperty(myDomainAssociation);\n * ```\n */\n associationProperty(input: DomainAssociation, visited: Set<string> = new Set<string>()): IApiPropertyShape {\n const { required, key } = input\n const result = propertyShape(key)\n result.path = `${AmfNamespace.aml.vocabularies.data.key}${input.info.name}`\n if (required) {\n result.minCount = 1\n }\n result.range = this.associationShape(input, visited)\n\n this.updateBaseProperties(input, result)\n return result\n }\n\n /**\n * Generates a shape for an association. Most likely you want to use the `associationProperty()` method instead.\n *\n * @param input The data association instance.\n * @param visited A `Set` of keys of already generated entities. This prevents\n * recursive shape generation and avoids infinite loops. Defaults to a new empty `Set`.\n * @returns The range value for the PropertyShape.\n */\n associationShape(input: DomainAssociation, visited: Set<string> = new Set<string>()): IShapeUnion | undefined {\n const schema = input.schema\n if (schema && schema.linked) {\n return this.createLinkedShape(input)\n }\n const items = this.associationUnion(input, visited)\n if (!items) {\n return\n }\n if (Array.isArray(items)) {\n return this.createUnionShape(input, items)\n }\n const unionType = (schema && schema.unionType) || UNION_TYPE_ANY_OF\n if (unionType === UNION_TYPE_NOT) {\n // Need to investigate more about \"not\" union type.\n // AMF supports it, but I am not sure how to handle it.\n const wrapper = anyShape(input.key)\n wrapper.id = `not-shape-${input.key}`\n wrapper.not = items\n return wrapper\n }\n if (input.multiple) {\n return this.refactorShapeToArray(input.key, items)\n }\n return items\n }\n\n /**\n * @param input The data association instance.\n * @returns An AMF API scalar shape with the link to the schema.\n */\n protected createLinkedShape(input: DomainAssociation): IApiScalarShape {\n // This is a link to the schema. In an API that would be the id\n // of a resource to request the data from.\n const range = scalarShape(input.key)\n range.id = `link-${input.key}`\n range.dataType = modelTypeToAmfDataType(DATA_TYPE_STRING)\n return range\n }\n\n protected createUnionShape(input: DomainAssociation, items: IShapeUnion[]): IApiUnionShape | IApiArrayShape {\n const range = unionShape(input.key)\n this.updateBaseProperties(input, range)\n range.anyOf = []\n const unionType = (input.schema && input.schema.unionType) || UNION_TYPE_ANY_OF\n if (unionType === UNION_TYPE_ANY_OF) {\n range.anyOf = items\n } else if (unionType === UNION_TYPE_ALL_OF) {\n range.and = items\n } else if (unionType === UNION_TYPE_ONE_OF) {\n range.xone = items\n } else {\n // the \"not\" union type only supports a single schema.\n // I am not sure how this should be handled. Will take the first one\n // for now.\n range.not = items[0]\n }\n if (input.multiple) {\n return this.refactorShapeToArray(input.key, range)\n }\n return range\n }\n\n /**\n * Generates a shape list for an union. Most likely you want to use the `associationProperty()` method instead.\n *\n * @param input The data association instance.\n * @returns The range value for the PropertyShape.\n */\n associationUnion(\n input: DomainAssociation,\n visited: Set<string> = new Set<string>()\n ): IShapeUnion | IShapeUnion[] | undefined {\n const result: IShapeUnion[] = []\n for (const item of input.listTargets()) {\n result.push(this.entity(item, visited))\n }\n if (!result.length) {\n return undefined\n }\n if (result.length > 1) {\n return result\n }\n return result[0]\n }\n\n /**\n * The DomainProperty may have both the `schema` and the `bindings`. For AMF shape we read `schema` for\n * default value, examples, and enum values. We also look for the `web`\n * bindings for more detailed definition of a shape.\n *\n * @param input\n */\n protected getRange(input: DomainProperty): IApiArrayShape | IApiFileShape | IApiScalarShape {\n const bindings = input.readBinding('web') as PropertyWebBindings | undefined\n let schema: PropertySchema | undefined\n if (input.schema) {\n schema = input.schema\n }\n const { multiple, type } = input\n if (multiple) {\n return this.createArrayShape(input, schema, bindings)\n }\n if (type === DATA_TYPE_BINARY) {\n return this.createFileShape(input, bindings)\n }\n return this.createScalarShape(input, schema, bindings)\n }\n\n /**\n * Normally this would be part of generating a scalar schema but the the property is an array this\n * is generated on the array and not on the range.\n *\n * @param result The scalar or array shape.\n * @param schema The property schema\n * @param type The data type of the parent property as set on the `range`\n * @param isArray Whether the DomainProperty is multiple\n */\n protected setShapeSchema(\n input: DomainProperty,\n result: IApiAnyShape,\n schema: PropertySchema,\n type: string,\n isArray?: boolean\n ): void {\n if (schema.defaultValue) {\n const { type: dfFormat } = schema.defaultValue\n const { value } = schema.defaultValue\n if (dfFormat === 'function') {\n const tmp = this.valueGenerator.generate(value, input.type)\n if (tmp !== DataValueGenerator.noValue) {\n const dt = AmfDataNode.scalar(tmp as string, dfFormat)\n result.defaultValue = dt.toJSON()\n }\n } else {\n const dt = AmfDataNode.scalar(value, type)\n result.defaultValue = dt.toJSON()\n }\n }\n if (Array.isArray(schema.enum)) {\n result.values = schema.enum.map((i) => AmfDataNode.scalar(i, type).toJSON())\n }\n if (Array.isArray(schema.examples)) {\n if (isArray) {\n result.examples = this.createArrayExamples(schema.examples, type)\n } else {\n result.examples = this.createExamples(schema.examples, type)\n }\n }\n }\n\n protected createArrayShape(\n input: DomainProperty,\n schema?: PropertySchema,\n bindings?: PropertyWebBindings\n ): IApiArrayShape {\n const result = arrayShape(input.key)\n const { type } = input\n if (type === DATA_TYPE_BINARY) {\n // we do not pass schema to the range generator as we set schema's properties on the array shape.\n result.items = this.createFileShape(input, bindings)\n } else {\n result.items = this.createScalarShape(input, undefined, bindings)\n }\n if (schema) {\n const type = (result.items as IApiScalarShape).dataType as string\n this.setShapeSchema(input, result, schema, type, input.multiple)\n }\n return result\n }\n\n protected createScalarShape(\n input: DomainProperty,\n schema?: PropertySchema,\n bindings?: PropertyWebBindings\n ): IApiScalarShape {\n const result = scalarShape(input.key)\n this.updateBaseProperties(input, result)\n this.setScalarCommonProperties(result, input, bindings)\n if (!result.dataType) {\n result.dataType = modelTypeToAmfDataType(input.type, bindings)\n }\n if (schema) {\n this.setShapeSchema(input, result, schema, result.dataType as string, input.multiple)\n }\n return result\n }\n\n protected createExamples(examples: string[], type: string): IApiDataExample[] {\n const result: IApiDataExample[] = []\n for (const current of examples) {\n const item: IApiDataExample = {\n id: nanoid(),\n customDomainProperties: [],\n strict: true,\n types: IAmfExampleTypes,\n structuredValue: AmfDataNode.scalar(current, type).toJSON(),\n }\n result.push(item)\n }\n return result\n }\n\n protected createArrayExamples(examples: string[], type: string): IApiDataExample[] {\n const item: IApiDataExample = {\n id: nanoid(),\n customDomainProperties: [],\n strict: true,\n types: IAmfExampleTypes,\n }\n const value = new AmfDataNode('array')\n for (const item of examples) {\n const member = AmfDataNode.scalar(item, type)\n value.addMember(member)\n }\n item.structuredValue = value.toJSON()\n return [item]\n }\n\n protected createFileShape(input: DomainProperty, bindings?: PropertyWebBindings): IApiFileShape {\n const result = fileShape(input.key)\n this.updateBaseProperties(input, result)\n if (bindings) {\n if (Array.isArray(bindings.fileTypes)) {\n result.fileTypes = bindings.fileTypes\n }\n this.setScalarCommonProperties(result, input, bindings)\n if (bindings.format === 'base64') {\n result.format = AmfNamespace.w3.xmlSchema.base64Binary\n }\n }\n return result\n }\n\n protected setScalarCommonProperties(\n result: IApiFileShape | IApiScalarShape,\n input: DomainProperty,\n bindings?: PropertyWebBindings\n ): void {\n if (bindings?.name) {\n result.name = bindings.name\n }\n if (bindings?.xml) {\n result.xmlSerialization = bindings.xml\n }\n const { schema, type } = input\n if (schema) {\n if (schema.pattern) {\n result.pattern = schema.pattern\n }\n if (typeof schema.multipleOf === 'number') {\n result.multipleOf = schema.multipleOf\n }\n if (typeof schema.minimum === 'number') {\n if (type === DATA_TYPE_STRING) {\n result.minLength = schema.minimum\n } else {\n result.minimum = schema.minimum\n }\n }\n if (typeof schema.maximum === 'number') {\n if (type === DATA_TYPE_STRING) {\n result.maxLength = schema.maximum\n } else {\n result.maximum = schema.maximum\n }\n }\n if (typeof schema.exclusiveMinimum === 'boolean') {\n result.exclusiveMinimum = schema.exclusiveMinimum\n }\n if (typeof schema.exclusiveMaximum === 'boolean') {\n result.exclusiveMaximum = schema.exclusiveMaximum\n }\n }\n if (bindings?.format) {\n switch (bindings.format) {\n case 'base64':\n result.format = AmfNamespace.w3.xmlSchema.base64Binary\n break\n case 'double':\n result.format = AmfNamespace.w3.xmlSchema.double\n break\n case 'float':\n result.format = AmfNamespace.w3.xmlSchema.float\n break\n case 'int32':\n result.format = AmfNamespace.w3.xmlSchema.integer\n break\n case 'int64':\n result.format = AmfNamespace.w3.xmlSchema.integer\n break\n }\n // result.format = bindings.format\n }\n if (typeof input.readOnly === 'boolean') {\n result.readOnly = input.readOnly\n }\n if (typeof input.writeOnly === 'boolean') {\n result.writeOnly = input.writeOnly\n }\n }\n\n protected updateBaseProperties(input: DomainProperty | DomainAssociation | DomainEntity, target: IApiShape): void {\n target.name = input.info.name\n target.displayName = input.info.displayName\n target.description = input.info.description\n if (input.kind === DomainPropertyKind) {\n target.deprecated = (input as DomainProperty).deprecated\n } else if (input.kind === DomainEntityKind) {\n target.deprecated = (input as DomainEntity).deprecated\n }\n }\n\n protected createRecursiveShape(input: DomainEntity): IApiRecursiveShape {\n return recursiveShape(input.key, input.key)\n }\n\n /**\n * Translates the shape to an array shape. This happens when data model property\n * is changed from 'multiple' to not-multiple and back.\n *\n * @param id The key of the parameter or an association\n * @param shape The shape to wrap as an array.\n * @returns Array shape.\n */\n protected refactorShapeToArray(id: string, shape: IShapeUnion): IApiArrayShape {\n const result = arrayShape(id)\n result.items = shape\n return result\n }\n}\n"]}
|
|
@@ -168,6 +168,10 @@ export interface PropertySchema {
|
|
|
168
168
|
* They are always encoded as strings. The actual type is defined in the `dataType` property.
|
|
169
169
|
*/
|
|
170
170
|
examples?: string[];
|
|
171
|
+
/**
|
|
172
|
+
* The pattern to use with a string scalar.
|
|
173
|
+
*/
|
|
174
|
+
pattern?: string;
|
|
171
175
|
}
|
|
172
176
|
/**
|
|
173
177
|
* The shortcut type for the data domain graph.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/modeling/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAA;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAC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IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAA;IAE9C;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,iBAAiB,GACzB,OAAO,mBAAmB,GAC1B,OAAO,gBAAgB,GACvB,OAAO,eAAe,GACtB,OAAO,kBAAkB,GACzB,OAAO,qBAAqB,GAC5B,OAAO,cAAc,CAAA;AAEzB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;;OAGG;IACH,IAAI,EAAE,iBAAiB,CAAA;IACvB;;OAEG;IACH,MAAM,EAAE,gBAAgB,EAAE,CAAA;IAC1B;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC1B;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;IACtC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
|
|
@@ -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} from '../models/kinds.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 AssociationAddOptions {\n /**\n * When set, it is the the association target's origin data domain.\n * The key of the target data domain where this target entity is defined.\n * Only used when `key` is specified.\n */\n domain?: string\n /**\n * The key of the association target, if known.\n * If the target of the association is not specified, and the association has no other targets,\n * the association is ignored in the namespace while processing.\n */\n key?: string\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 entiry (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\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 ExposedEntity {\n /**\n * The key of the Data Entity from the Data Domain.\n */\n key: string\n\n /**\n * Optional configuration for resource-wide rate limiting and throttling.\n * Defines rules to protect the resource from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\n /**\n * Access control rules defining who can perform actions on this resource or collection.\n * It override the top-level access rules defined in the API model.\n */\n accessRule?: AccessRule[]\n\n /**\n * The collection of API actions (e.g., List, Read, Create) enabled for this entity.\n */\n actions: ApiAction[]\n}\n\n/**\n * Represents a specific, configurable API operation applied to a Data Entity.\n * Corresponds to common RESTful interactions.\n */\nexport type ApiAction = ListAction | ReadAction | CreateAction | UpdateAction | DeleteAction | SearchAction\n\n/**\n * A base interface for common properties across all actions.\n */\ninterface Action {\n /**\n * The specific kind of action (e.g., 'List', 'Read', etc.)\n */\n kind: string\n /**\n * Access control rules defining who can perform this action. It is only applied if the\n * authorization strategy is set to 'RBAC'.\n * If no rules grant access, it's denied by default making it essentially private.\n *\n * Note, the API can defined top level access rules that apply to all actions. If this property is set,\n * it overrides the top level access rules for this specific action.\n *\n * It is an ordered list, meaning the first rule that matches the user will be applied.\n * If multiple rules match, the first one in the list takes precedence.\n * If no rules match, the action is denied.\n */\n accessRule?: AccessRule[]\n /**\n * Optional configuration for action-wide rate limiting and throttling.\n * Defines rules to protect the action from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\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\n/**\n * Enables retrieving a collection of resources.\n * Endpoint: GET /[entity-collection-name]\n */\nexport interface ListAction extends Action {\n kind: 'list'\n /**\n * The pagination strategy used for this action.\n * This defines how the results are paginated when retrieving a collection of resources.\n * It can be either 'cursor' or 'offset'.\n */\n pagination: PaginationStrategy\n /**\n * Fields from the entity that can be used for filtering.\n * Must be marked as \"indexable\" in the Data Model.\n */\n filterableFields: string[]\n /**\n * Fields from the entity that can be used for sorting.\n */\n sortableFields: string[]\n}\n\n/**\n * Enables retrieving a single resource by its ID.\n * Endpoint: GET /[entity-collection-name]/{id}\n */\nexport interface ReadAction extends Action {\n kind: 'read'\n // Association handling (Link IDs vs. Embed) is defined on the\n // data association itself in the Data Modeler.\n}\n\n/**\n * Enables adding a new resource to a collection.\n * Endpoint: POST /[entity-collection-name]\n */\nexport interface CreateAction extends Action {\n kind: 'create'\n}\n\n/**\n * Enables modifying an existing resource.\n * Endpoints: PUT or PATCH /[entity-collection-name]/{id}\n */\nexport interface UpdateAction extends Action {\n kind: 'update'\n /**\n * The allowed HTTP methods for updates. Default: PATCH only.\n *\n * These two methods represent the two common ways to update a resource:\n * - PUT: Replaces the entire resource with the provided data.\n * - PATCH: Applies a partial update to the resource, allowing for specific fields to be modified.\n */\n allowedMethods: ('PUT' | 'PATCH')[]\n}\n\n/**\n * Enables removing an existing resource.\n * Endpoint: DELETE /[entity-collection-name]/{id}\n */\nexport interface DeleteAction extends Action {\n kind: 'delete'\n /**\n * The strategy for deletion. Default: Soft Delete.\n *\n * @default 'soft'\n */\n strategy?: 'soft' | 'hard'\n}\n\n/**\n * Enables keyword-based search across specified fields.\n * Endpoint: GET /[entity-collection-name]/search\n */\nexport interface SearchAction extends Action {\n kind: 'search'\n /**\n * The fields within the entity to be included in the search scope.\n * Must be \"indexable\" and typically text-based.\n */\n fields: string[]\n}\n\n/**\n * Defines the access control policy for a specific API action.\n * Based on the predefined rule types for session-based authentication.\n */\nexport type AccessRule =\n | AllowPublicAccessRule\n | AllowAuthenticatedAccessRule\n | MatchResourceOwnerAccessRule\n | MatchUserRoleAccessRule\n | MatchUserPropertyAccessRule\n | MatchEmailDomainAccessRule\n\nexport interface BaseAccessRule {\n /**\n * The unique identifier for the access rule.\n * This is used to reference the rule in the API configuration.\n */\n type: string\n}\n\n/**\n * The action is allowed for all users, including unauthenticated ones.\n * This is typically used for public APIs or resources that do not require authentication.\n * It is the most permissive rule and should be used with caution.\n */\nexport interface AllowPublicAccessRule extends BaseAccessRule {\n type: 'public'\n}\n/**\n * The action is allowed for any authenticated user.\n * This rule does not impose any additional restrictions based on user properties or resource ownership.\n * It is used for resources that should be accessible to all logged-in users.\n */\nexport interface AllowAuthenticatedAccessRule extends BaseAccessRule {\n type: 'authenticated'\n}\n/**\n * The action is allowed if the authenticated user's ID matches a specific property on the resource.\n * This is typically used to restrict access to resources owned by the user.\n * For example, a user can only access their own profile or documents.\n */\nexport interface MatchResourceOwnerAccessRule extends BaseAccessRule {\n type: 'resourceOwner'\n /**\n * The property on the resource that should match the authenticated user's ID.\n * This is typically the ID of the user who owns the resource.\n *\n * The domain model should annotate this property with the \"ResourceOwnerIdentifier\" semantic\n * to indicate that it is used for ownership checks.\n */\n property: string\n}\n\n/**\n * The action is allowed if the authenticated user has a specific role.\n * This is used to enforce role-based access control (RBAC).\n * For example, only users with the \"admin\" role can perform certain actions.\n */\nexport interface MatchUserRoleAccessRule extends BaseAccessRule {\n type: 'matchUserRole'\n /**\n * The role that the authenticated user must have to access the resource.\n * This is typically a property on the user entity that defines their role.\n *\n * The domain model should annotate this property with the \"UserRole\" semantic\n * to indicate that it is used for role-based access control.\n */\n role: string\n}\n/**\n * The action is allowed if a specific property on the authenticated user matches an expected value.\n * This is used to enforce other user-specific restrictions.\n */\nexport interface MatchUserPropertyAccessRule extends BaseAccessRule {\n type: 'matchUserProperty'\n /**\n * The property on the authenticated user that should match the expected value.\n */\n property: string\n /**\n * The expected value for the user property.\n */\n value: string\n}\n/**\n * The action is allowed if the authenticated user's email domain matches a specific domain.\n * This is used to restrict access based on the user's email address.\n * For example, only users with an email address from \"mycompany.com\" can access certain resources.\n */\nexport interface MatchEmailDomainAccessRule extends BaseAccessRule {\n type: 'matchEmailDomain'\n /**\n * The email domain that the authenticated user's email must match.\n */\n domain: string\n}\n\n/**\n * Defines the rate limiting and throttling policies for the entire API.\n */\nexport interface RateLimitingConfiguration {\n /**\n * An ordered list of rules. The first rule that matches an incoming\n * request will be applied.\n */\n rules: RateLimitRule[]\n}\n\n/**\n * Represents a single rate limiting rule that applies to a specific\n * type of client, using a token bucket algorithm.\n */\nexport interface RateLimitRule {\n /**\n * A human-readable description of what this rule is for.\n * e.g., \"Limit anonymous users to 60 requests per hour.\"\n */\n description?: string\n\n /**\n * Defines how to group requests for rate limiting. This determines\n * who the limit applies to.\n *\n * - 'ip': Keys on the client's IP address. Best for anonymous traffic.\n * - 'userId': Keys on the authenticated user's ID. Best for logged-in users.\n * - 'role': Applies a shared limit to all users of a specific role.\n */\n key: { type: 'ip' } | { type: 'userId' } | { type: 'role'; value: string }\n\n /**\n * The number of requests allowed over the defined interval.\n * This is the rate at which tokens are added to the bucket.\n */\n rate: number\n\n /**\n * The time interval for the rate.\n */\n interval: 'second' | 'minute' | 'hour' | 'day'\n\n /**\n * The maximum number of requests that can be made in a burst.\n * This represents the \"bucket size.\" A larger burst allows for\n * more requests to be made in a short period before throttling begins.\n */\n burst: number\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"]}
|
|
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} from '../models/kinds.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 AssociationAddOptions {\n /**\n * When set, it is the the association target's origin data domain.\n * The key of the target data domain where this target entity is defined.\n * Only used when `key` is specified.\n */\n domain?: string\n /**\n * The key of the association target, if known.\n * If the target of the association is not specified, and the association has no other targets,\n * the association is ignored in the namespace while processing.\n */\n key?: string\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 entiry (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 ExposedEntity {\n /**\n * The key of the Data Entity from the Data Domain.\n */\n key: string\n\n /**\n * Optional configuration for resource-wide rate limiting and throttling.\n * Defines rules to protect the resource from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\n /**\n * Access control rules defining who can perform actions on this resource or collection.\n * It override the top-level access rules defined in the API model.\n */\n accessRule?: AccessRule[]\n\n /**\n * The collection of API actions (e.g., List, Read, Create) enabled for this entity.\n */\n actions: ApiAction[]\n}\n\n/**\n * Represents a specific, configurable API operation applied to a Data Entity.\n * Corresponds to common RESTful interactions.\n */\nexport type ApiAction = ListAction | ReadAction | CreateAction | UpdateAction | DeleteAction | SearchAction\n\n/**\n * A base interface for common properties across all actions.\n */\ninterface Action {\n /**\n * The specific kind of action (e.g., 'List', 'Read', etc.)\n */\n kind: string\n /**\n * Access control rules defining who can perform this action. It is only applied if the\n * authorization strategy is set to 'RBAC'.\n * If no rules grant access, it's denied by default making it essentially private.\n *\n * Note, the API can defined top level access rules that apply to all actions. If this property is set,\n * it overrides the top level access rules for this specific action.\n *\n * It is an ordered list, meaning the first rule that matches the user will be applied.\n * If multiple rules match, the first one in the list takes precedence.\n * If no rules match, the action is denied.\n */\n accessRule?: AccessRule[]\n /**\n * Optional configuration for action-wide rate limiting and throttling.\n * Defines rules to protect the action from overuse.\n */\n rateLimiting?: RateLimitingConfiguration\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\n/**\n * Enables retrieving a collection of resources.\n * Endpoint: GET /[entity-collection-name]\n */\nexport interface ListAction extends Action {\n kind: 'list'\n /**\n * The pagination strategy used for this action.\n * This defines how the results are paginated when retrieving a collection of resources.\n * It can be either 'cursor' or 'offset'.\n */\n pagination: PaginationStrategy\n /**\n * Fields from the entity that can be used for filtering.\n * Must be marked as \"indexable\" in the Data Model.\n */\n filterableFields: string[]\n /**\n * Fields from the entity that can be used for sorting.\n */\n sortableFields: string[]\n}\n\n/**\n * Enables retrieving a single resource by its ID.\n * Endpoint: GET /[entity-collection-name]/{id}\n */\nexport interface ReadAction extends Action {\n kind: 'read'\n // Association handling (Link IDs vs. Embed) is defined on the\n // data association itself in the Data Modeler.\n}\n\n/**\n * Enables adding a new resource to a collection.\n * Endpoint: POST /[entity-collection-name]\n */\nexport interface CreateAction extends Action {\n kind: 'create'\n}\n\n/**\n * Enables modifying an existing resource.\n * Endpoints: PUT or PATCH /[entity-collection-name]/{id}\n */\nexport interface UpdateAction extends Action {\n kind: 'update'\n /**\n * The allowed HTTP methods for updates. Default: PATCH only.\n *\n * These two methods represent the two common ways to update a resource:\n * - PUT: Replaces the entire resource with the provided data.\n * - PATCH: Applies a partial update to the resource, allowing for specific fields to be modified.\n */\n allowedMethods: ('PUT' | 'PATCH')[]\n}\n\n/**\n * Enables removing an existing resource.\n * Endpoint: DELETE /[entity-collection-name]/{id}\n */\nexport interface DeleteAction extends Action {\n kind: 'delete'\n /**\n * The strategy for deletion. Default: Soft Delete.\n *\n * @default 'soft'\n */\n strategy?: 'soft' | 'hard'\n}\n\n/**\n * Enables keyword-based search across specified fields.\n * Endpoint: GET /[entity-collection-name]/search\n */\nexport interface SearchAction extends Action {\n kind: 'search'\n /**\n * The fields within the entity to be included in the search scope.\n * Must be \"indexable\" and typically text-based.\n */\n fields: string[]\n}\n\n/**\n * Defines the access control policy for a specific API action.\n * Based on the predefined rule types for session-based authentication.\n */\nexport type AccessRule =\n | AllowPublicAccessRule\n | AllowAuthenticatedAccessRule\n | MatchResourceOwnerAccessRule\n | MatchUserRoleAccessRule\n | MatchUserPropertyAccessRule\n | MatchEmailDomainAccessRule\n\nexport interface BaseAccessRule {\n /**\n * The unique identifier for the access rule.\n * This is used to reference the rule in the API configuration.\n */\n type: string\n}\n\n/**\n * The action is allowed for all users, including unauthenticated ones.\n * This is typically used for public APIs or resources that do not require authentication.\n * It is the most permissive rule and should be used with caution.\n */\nexport interface AllowPublicAccessRule extends BaseAccessRule {\n type: 'public'\n}\n/**\n * The action is allowed for any authenticated user.\n * This rule does not impose any additional restrictions based on user properties or resource ownership.\n * It is used for resources that should be accessible to all logged-in users.\n */\nexport interface AllowAuthenticatedAccessRule extends BaseAccessRule {\n type: 'authenticated'\n}\n/**\n * The action is allowed if the authenticated user's ID matches a specific property on the resource.\n * This is typically used to restrict access to resources owned by the user.\n * For example, a user can only access their own profile or documents.\n */\nexport interface MatchResourceOwnerAccessRule extends BaseAccessRule {\n type: 'resourceOwner'\n /**\n * The property on the resource that should match the authenticated user's ID.\n * This is typically the ID of the user who owns the resource.\n *\n * The domain model should annotate this property with the \"ResourceOwnerIdentifier\" semantic\n * to indicate that it is used for ownership checks.\n */\n property: string\n}\n\n/**\n * The action is allowed if the authenticated user has a specific role.\n * This is used to enforce role-based access control (RBAC).\n * For example, only users with the \"admin\" role can perform certain actions.\n */\nexport interface MatchUserRoleAccessRule extends BaseAccessRule {\n type: 'matchUserRole'\n /**\n * The role that the authenticated user must have to access the resource.\n * This is typically a property on the user entity that defines their role.\n *\n * The domain model should annotate this property with the \"UserRole\" semantic\n * to indicate that it is used for role-based access control.\n */\n role: string\n}\n/**\n * The action is allowed if a specific property on the authenticated user matches an expected value.\n * This is used to enforce other user-specific restrictions.\n */\nexport interface MatchUserPropertyAccessRule extends BaseAccessRule {\n type: 'matchUserProperty'\n /**\n * The property on the authenticated user that should match the expected value.\n */\n property: string\n /**\n * The expected value for the user property.\n */\n value: string\n}\n/**\n * The action is allowed if the authenticated user's email domain matches a specific domain.\n * This is used to restrict access based on the user's email address.\n * For example, only users with an email address from \"mycompany.com\" can access certain resources.\n */\nexport interface MatchEmailDomainAccessRule extends BaseAccessRule {\n type: 'matchEmailDomain'\n /**\n * The email domain that the authenticated user's email must match.\n */\n domain: string\n}\n\n/**\n * Defines the rate limiting and throttling policies for the entire API.\n */\nexport interface RateLimitingConfiguration {\n /**\n * An ordered list of rules. The first rule that matches an incoming\n * request will be applied.\n */\n rules: RateLimitRule[]\n}\n\n/**\n * Represents a single rate limiting rule that applies to a specific\n * type of client, using a token bucket algorithm.\n */\nexport interface RateLimitRule {\n /**\n * A human-readable description of what this rule is for.\n * e.g., \"Limit anonymous users to 60 requests per hour.\"\n */\n description?: string\n\n /**\n * Defines how to group requests for rate limiting. This determines\n * who the limit applies to.\n *\n * - 'ip': Keys on the client's IP address. Best for anonymous traffic.\n * - 'userId': Keys on the authenticated user's ID. Best for logged-in users.\n * - 'role': Applies a shared limit to all users of a specific role.\n */\n key: { type: 'ip' } | { type: 'userId' } | { type: 'role'; value: string }\n\n /**\n * The number of requests allowed over the defined interval.\n * This is the rate at which tokens are added to the bucket.\n */\n rate: number\n\n /**\n * The time interval for the rate.\n */\n interval: 'second' | 'minute' | 'hour' | 'day'\n\n /**\n * The maximum number of requests that can be made in a burst.\n * This represents the \"bucket size.\" A larger burst allows for\n * more requests to be made in a short period before throttling begins.\n */\n burst: number\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"]}
|