@api-client/core 0.19.17 → 0.19.18
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/browser.d.ts +12 -12
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js +3 -3
- package/build/src/browser.js.map +1 -1
- package/build/src/index.d.ts +12 -12
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +3 -3
- package/build/src/index.js.map +1 -1
- package/build/src/mocking/ProjectMock.d.ts +1 -1
- package/build/src/mocking/ProjectMock.d.ts.map +1 -1
- package/build/src/mocking/ProjectMock.js.map +1 -1
- package/build/src/mocking/lib/File.d.ts +5 -5
- package/build/src/mocking/lib/File.d.ts.map +1 -1
- package/build/src/mocking/lib/File.js.map +1 -1
- package/build/src/mocking/lib/Organization.d.ts +3 -3
- package/build/src/mocking/lib/Organization.d.ts.map +1 -1
- package/build/src/mocking/lib/Organization.js +2 -1
- package/build/src/mocking/lib/Organization.js.map +1 -1
- package/build/src/mocking/lib/Permission.d.ts +6 -6
- package/build/src/mocking/lib/Permission.d.ts.map +1 -1
- package/build/src/mocking/lib/Permission.js.map +1 -1
- package/build/src/mocking/lib/User.d.ts +8 -4
- package/build/src/mocking/lib/User.d.ts.map +1 -1
- package/build/src/mocking/lib/User.js.map +1 -1
- package/build/src/modeling/ApiFile.d.ts +8 -4
- package/build/src/modeling/ApiFile.d.ts.map +1 -1
- package/build/src/modeling/ApiFile.js.map +1 -1
- package/build/src/modeling/ApiModel.d.ts +2 -2
- package/build/src/modeling/ApiModel.d.ts.map +1 -1
- package/build/src/modeling/ApiModel.js.map +1 -1
- package/build/src/modeling/DataDomain.d.ts +2 -2
- package/build/src/modeling/DataDomain.d.ts.map +1 -1
- package/build/src/modeling/DataDomain.js.map +1 -1
- package/build/src/modeling/DomainAssociation.d.ts +2 -2
- package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
- package/build/src/modeling/DomainAssociation.js.map +1 -1
- package/build/src/modeling/DomainEntity.d.ts +2 -2
- package/build/src/modeling/DomainEntity.d.ts.map +1 -1
- package/build/src/modeling/DomainEntity.js.map +1 -1
- package/build/src/modeling/DomainFile.d.ts +8 -4
- package/build/src/modeling/DomainFile.d.ts.map +1 -1
- package/build/src/modeling/DomainFile.js.map +1 -1
- package/build/src/modeling/DomainModel.d.ts +2 -2
- package/build/src/modeling/DomainModel.d.ts.map +1 -1
- package/build/src/modeling/DomainModel.js.map +1 -1
- package/build/src/modeling/DomainNamespace.d.ts +2 -2
- package/build/src/modeling/DomainNamespace.d.ts.map +1 -1
- package/build/src/modeling/DomainNamespace.js.map +1 -1
- package/build/src/modeling/DomainProperty.d.ts +2 -2
- package/build/src/modeling/DomainProperty.d.ts.map +1 -1
- package/build/src/modeling/DomainProperty.js.map +1 -1
- package/build/src/modeling/helpers/Intelisense.d.ts +38 -38
- package/build/src/modeling/helpers/Intelisense.d.ts.map +1 -1
- package/build/src/modeling/helpers/Intelisense.js.map +1 -1
- package/build/src/models/AiMessage.d.ts +3 -3
- package/build/src/models/AiMessage.d.ts.map +1 -1
- package/build/src/models/AiMessage.js.map +1 -1
- package/build/src/models/AiSession.d.ts +3 -3
- package/build/src/models/AiSession.d.ts.map +1 -1
- package/build/src/models/AiSession.js.map +1 -1
- package/build/src/models/CertificateFile.d.ts +2 -2
- package/build/src/models/CertificateFile.d.ts.map +1 -1
- package/build/src/models/CertificateFile.js.map +1 -1
- package/build/src/models/Environment.d.ts +2 -2
- package/build/src/models/Environment.d.ts.map +1 -1
- package/build/src/models/Environment.js.map +1 -1
- package/build/src/models/Folder.d.ts +9 -5
- package/build/src/models/Folder.d.ts.map +1 -1
- package/build/src/models/Folder.js.map +1 -1
- package/build/src/models/HttpProject.d.ts +2 -2
- package/build/src/models/HttpProject.d.ts.map +1 -1
- package/build/src/models/HttpProject.js.map +1 -1
- package/build/src/models/ProjectFolder.d.ts +2 -2
- package/build/src/models/ProjectFolder.d.ts.map +1 -1
- package/build/src/models/ProjectFolder.js.map +1 -1
- package/build/src/models/Request.d.ts +3 -3
- package/build/src/models/Request.d.ts.map +1 -1
- package/build/src/models/Request.js.map +1 -1
- package/build/src/models/Thing.d.ts +9 -5
- package/build/src/models/Thing.d.ts.map +1 -1
- package/build/src/models/Thing.js.map +1 -1
- package/build/src/models/TrashEntry.d.ts +2 -2
- package/build/src/models/TrashEntry.d.ts.map +1 -1
- package/build/src/models/TrashEntry.js.map +1 -1
- package/build/src/models/store/Capabilities.d.ts +5 -1
- package/build/src/models/store/Capabilities.d.ts.map +1 -1
- package/build/src/models/store/Capabilities.js.map +1 -1
- package/build/src/models/store/Deletion.d.ts +5 -1
- package/build/src/models/store/Deletion.d.ts.map +1 -1
- package/build/src/models/store/Deletion.js.map +1 -1
- package/build/src/models/store/File.d.ts +45 -37
- package/build/src/models/store/File.d.ts.map +1 -1
- package/build/src/models/store/File.js +1 -1
- package/build/src/models/store/File.js.map +1 -1
- package/build/src/models/store/Group.d.ts +3 -3
- package/build/src/models/store/Group.d.ts.map +1 -1
- package/build/src/models/store/Group.js.map +1 -1
- package/build/src/models/store/Invitation.d.ts +3 -3
- package/build/src/models/store/Invitation.d.ts.map +1 -1
- package/build/src/models/store/Invitation.js.map +1 -1
- package/build/src/models/store/Modification.d.ts +5 -1
- package/build/src/models/store/Modification.d.ts.map +1 -1
- package/build/src/models/store/Modification.js.map +1 -1
- package/build/src/models/store/Organization.d.ts +18 -13
- package/build/src/models/store/Organization.d.ts.map +1 -1
- package/build/src/models/store/Organization.js +29 -47
- package/build/src/models/store/Organization.js.map +1 -1
- package/build/src/models/store/Permission.d.ts +9 -5
- package/build/src/models/store/Permission.d.ts.map +1 -1
- package/build/src/models/store/Permission.js.map +1 -1
- package/build/src/models/store/User.d.ts +18 -6
- package/build/src/models/store/User.d.ts.map +1 -1
- package/build/src/models/store/User.js.map +1 -1
- package/build/src/models/store/UserIdentity.d.ts +9 -5
- package/build/src/models/store/UserIdentity.d.ts.map +1 -1
- package/build/src/models/store/UserIdentity.js.map +1 -1
- package/build/src/sdk/FilesSdk.d.ts +15 -15
- package/build/src/sdk/FilesSdk.d.ts.map +1 -1
- package/build/src/sdk/FilesSdk.js +1 -1
- package/build/src/sdk/FilesSdk.js.map +1 -1
- package/build/src/sdk/OrganizationsSdk.d.ts +9 -9
- package/build/src/sdk/OrganizationsSdk.d.ts.map +1 -1
- package/build/src/sdk/OrganizationsSdk.js.map +1 -1
- package/build/src/sdk/SdkMock.js +6 -6
- package/build/src/sdk/SdkMock.js.map +1 -1
- package/build/src/sdk/SharedSdk.d.ts +2 -2
- package/build/src/sdk/SharedSdk.d.ts.map +1 -1
- package/build/src/sdk/SharedSdk.js.map +1 -1
- package/build/src/sdk/StoreSdkNode.d.ts +1 -1
- package/build/src/sdk/StoreSdkNode.d.ts.map +1 -1
- package/build/src/sdk/StoreSdkNode.js.map +1 -1
- package/build/src/sdk/StoreSdkWeb.d.ts +1 -1
- package/build/src/sdk/StoreSdkWeb.d.ts.map +1 -1
- package/build/src/sdk/StoreSdkWeb.js.map +1 -1
- package/build/src/sdk/UsersSdk.d.ts +5 -5
- package/build/src/sdk/UsersSdk.d.ts.map +1 -1
- package/build/src/sdk/UsersSdk.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/mocking/ProjectMock.ts +1 -1
- package/src/mocking/lib/File.ts +5 -5
- package/src/mocking/lib/Organization.ts +5 -3
- package/src/mocking/lib/Permission.ts +8 -8
- package/src/mocking/lib/User.ts +11 -6
- package/src/modeling/ApiFile.ts +11 -6
- package/src/modeling/ApiModel.ts +2 -2
- package/src/modeling/DataDomain.ts +2 -2
- package/src/modeling/DomainAssociation.ts +2 -2
- package/src/modeling/DomainEntity.ts +2 -2
- package/src/modeling/DomainFile.ts +11 -6
- package/src/modeling/DomainModel.ts +2 -2
- package/src/modeling/DomainNamespace.ts +2 -2
- package/src/modeling/DomainProperty.ts +2 -2
- package/src/modeling/helpers/Intelisense.ts +41 -38
- package/src/models/AiMessage.ts +3 -3
- package/src/models/AiSession.ts +3 -3
- package/src/models/CertificateFile.ts +2 -2
- package/src/models/Environment.ts +2 -2
- package/src/models/Folder.ts +13 -8
- package/src/models/HttpProject.ts +2 -2
- package/src/models/ProjectFolder.ts +2 -2
- package/src/models/Request.ts +3 -3
- package/src/models/Thing.ts +14 -9
- package/src/models/TrashEntry.ts +2 -2
- package/src/models/store/Capabilities.ts +6 -1
- package/src/models/store/Deletion.ts +6 -1
- package/src/models/store/File.ts +53 -43
- package/src/models/store/Group.ts +3 -3
- package/src/models/store/Invitation.ts +3 -3
- package/src/models/store/Modification.ts +6 -1
- package/src/models/store/Organization.ts +45 -60
- package/src/models/store/Permission.ts +17 -12
- package/src/models/store/User.ts +21 -6
- package/src/models/store/UserIdentity.ts +13 -8
- package/src/sdk/FilesSdk.ts +29 -25
- package/src/sdk/OrganizationsSdk.ts +20 -16
- package/src/sdk/SdkMock.ts +16 -16
- package/src/sdk/SharedSdk.ts +3 -3
- package/src/sdk/StoreSdkNode.ts +3 -3
- package/src/sdk/StoreSdkWeb.ts +3 -3
- package/src/sdk/UsersSdk.ts +6 -6
- package/tests/unit/mocking/current/File.spec.ts +5 -5
- package/tests/unit/mocking/current/Organization.spec.ts +4 -3
- package/tests/unit/mocking/current/Permission.spec.ts +2 -2
- package/tests/unit/mocking/current/User.spec.ts +2 -2
- package/tests/unit/modeling/domain_file.spec.ts +3 -3
- package/tests/unit/models/File/createFileCapabilities.spec.ts +3 -3
- package/tests/unit/models/File/new.spec.ts +2 -2
- package/tests/unit/models/File/setDeleted.spec.ts +3 -3
- package/tests/unit/models/File/setLastModified.spec.ts +3 -3
- package/tests/unit/models/File/toJSON.spec.ts +2 -2
- package/tests/unit/models/Folder/create.spec.ts +3 -3
- package/tests/unit/models/Permission/all.spec.ts +3 -3
- package/tests/unit/models/store/Invitation.spec.ts +2 -2
- package/tests/unit/models/store/Organization.spec.ts +100 -0
- package/tests/unit/models/store/Permission.spec.ts +16 -6
- package/tests/unit/models/thing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AAA;AACb,CAAC;AAED,SAAS,eAAe,CAAC,MAAoB,EAAE,MAAM,GAAG,KAAK;IAC3D,OAAO,iBAAiB,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAA;AACnG,CAAC","sourcesContent":["import type { DomainEntity } from '../DomainEntity.js'\nimport type { DomainElement } from '../DomainElement.js'\nimport type { DomainProperty } from '../DomainProperty.js'\nimport type { DomainAssociation } from '../DomainAssociation.js'\nimport type { IThing } from '../../models/Thing.js'\nimport { SemanticType } from '../Semantics.js'\nimport { createEmailSemantic, DEFAULT_EMAIL_CONFIG } from '../definitions/Email.js'\nimport { createPasswordSemantic, DEFAULT_PASSWORD_CONFIG } from '../definitions/Password.js'\nimport { createPhoneSemantic } from '../definitions/Phone.js'\nimport { createPublicUniqueNameSemantic, DEFAULT_PUBLIC_UNIQUE_NAME_CONFIG } from '../definitions/PublicUniqueName.js'\nimport { createDescriptionSemantic } from '../definitions/Description.js'\nimport { CURRENCY_PRESETS } from '../definitions/Currency.js'\nimport { createStatusSemantic } from '../definitions/Status.js'\nimport { SKU_PRESETS } from '../definitions/SKU.js'\nimport { createCountrySemantic, DEFAULT_COUNTRY_CONFIG } from '../definitions/Country.js'\nimport { createPostalCodeSemantic, DEFAULT_POSTAL_CODE_CONFIG } from '../definitions/PostalCode.js'\n\n/**\n * Adds a field to the given entity that is automatically generated by the system.\n *\n * @param entity The entity to which the auto field will be added.\n * @param autoField The name of the auto field to add.\n * @returns The added DomainElement representing the auto field.\n * @throws Error if the auto field is not supported.\n */\nexport function addAutoField(entity: DomainEntity, autoField: string): DomainElement {\n switch (autoField) {\n case 'id':\n return addIdField(entity)\n case 'email':\n return addEmailField(entity)\n case 'name':\n return addNameField(entity)\n case 'display-name':\n return addDisplayNameField(entity)\n case 'description':\n return addDescriptionField(entity)\n case 'status':\n return addStatusField(entity)\n case 'version':\n return addVersionField(entity)\n case 'owner':\n return addOwnerField(entity)\n case 'created':\n return addCreatedAtField(entity)\n // case 'created-by':\n // return addCreatedByField(entity)\n case 'updated':\n return addUpdatedAtField(entity)\n case 'updated-by':\n return addUpdatedByField(entity)\n case 'is-deleted':\n return addIsDeletedField(entity)\n case 'deleted':\n return addDeletedAtField(entity)\n case 'role':\n return addRoleField(entity)\n case 'first-name':\n return addFirstNameField(entity)\n case 'last-name':\n return addLastNameField(entity)\n case 'phone':\n return addPhoneField(entity)\n case 'avatar-url':\n return addAvatarUrlField(entity)\n case 'public-unique-name':\n return addPublicUniqueNameField(entity)\n case 'price':\n return addPriceField(entity)\n case 'sku':\n return addSkuField(entity)\n case 'quantity':\n return addQuantityField(entity)\n case 'weight':\n return addWeightField(entity)\n case 'images':\n return addImagesField(entity)\n case 'session-id':\n // This was removed from the UI. We will not support session id configuration\n // as the platform will handle it to separate the business logic from the transport layer.\n return addSessionIdField(entity)\n case 'expires-at':\n // This was removed from the UI. We will not support expires at configuration\n // as the platform will handle it to separate the business logic from the transport layer.\n return addExpiresAtField(entity)\n case 'unit-price':\n return addUnitPriceField(entity)\n case 'street-address':\n return addStreetAddressField(entity)\n case 'street-address-supplemental':\n return addStreetAddressSupplementalField(entity)\n case 'city':\n return addCityField(entity)\n case 'postal-code':\n return addPostalCodeField(entity)\n case 'country':\n return addCountryField(entity)\n case 'region':\n return addRegionField(entity)\n default:\n throw new Error(`Unsupported auto field: ${autoField}`)\n }\n}\n\n/**\n * Adds the primary field (ID) to the given entity.\n * If the ID field already exists, it returns the existing field.\n * Otherwise, it creates a new ID field with a name based on the entity's name.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'id'\n * - primary: true\n * - readOnly: true\n * - schema.defaultValue: { type: 'function', value: 'uuid-v4' }\n *\n * @param entity The entity to which the ID field will be added.\n * @returns The added primary field property.\n */\nexport function addIdField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findIdField(entity, true)\n if (existing) {\n // If the ID field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: `id`, ...info },\n primary: true,\n readOnly: true,\n // I don't think we need to index the ID field..\n // index: true,\n type: 'string',\n // @TODO: We should experiment with the random ID generation using the nano library.\n schema: { defaultValue: { type: 'function', value: 'uuid-v4' } },\n })\n return prop\n}\n\n/**\n * Adds an email field to the given entity.\n * If the email field already exists, it returns the existing field.\n * Otherwise, it creates a new email field with a semantic annotation.\n * @param entity The entity to which the email field will be added.\n * @returns The added email field property.\n */\nexport function addEmailField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findEmailField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'email', displayName: 'Email Address', ...info },\n type: 'string',\n required: true,\n index: true,\n })\n prop.addSemantic(createEmailSemantic(DEFAULT_EMAIL_CONFIG))\n return prop\n}\n\n/**\n * Adds a password field to the given entity.\n * If the password field already exists, it returns the existing field.\n * Otherwise, it creates a new password field with a semantic annotation.\n * @param entity The entity to which the password field will be added.\n * @param info Additional information for the password field.\n * @returns The added password field property.\n */\nexport function addPasswordField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findPasswordField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'password', displayName: 'Password', ...info },\n type: 'string',\n required: true,\n })\n prop.addSemantic(createPasswordSemantic(DEFAULT_PASSWORD_CONFIG))\n return prop\n}\n\n/**\n * Adds a version field to the given entity.\n * @param entity The entity to which the version field will be added.\n * The version field is used to track the version of the entity.\n * @returns The added version field property.\n */\nexport function addVersionField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findVersionField(entity, true)\n if (existing) {\n // If the version field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'version', displayName: 'Version', ...info },\n readOnly: true,\n index: true,\n type: 'number',\n schema: { defaultValue: { type: 'function', value: 'incremental' }, minimum: 0 },\n })\n prop.addSemantic({\n id: SemanticType.Version,\n })\n return prop\n}\n\nexport function addNameField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findNameField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'name', displayName: 'Name', ...info },\n type: 'string',\n })\n prop.addSemantic({\n id: SemanticType.Title,\n })\n return prop\n}\n\nexport function addDisplayNameField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findDisplayNameField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'display-name', displayName: 'Display Name', ...info },\n type: 'string',\n })\n prop.addSemantic({\n id: SemanticType.Name,\n })\n return prop\n}\n\n/**\n * Adds a description field to the specified entity.\n * If a description field already exists, it returns the existing field.\n * Otherwise, it creates a new description field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'description'\n * - info.displayName: 'Description'\n *\n * Set semantics:\n * - `SemanticType.Description`\n *\n * @param entity The entity to which the description field will be added.\n * @returns The added description field property.\n */\nexport function addDescriptionField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findDescriptionField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'description', displayName: 'Description', ...info },\n type: 'string',\n })\n prop.addSemantic(createDescriptionSemantic())\n return prop\n}\n\n/**\n * Adds a status field to the specified entity.\n * If a status field already exists, it returns the existing field.\n * Otherwise, it creates a new status field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'status'\n * - info.displayName: 'Status'\n * - schema.enum: ['Active', 'Draft', 'Archived']\n * - schema.defaultValue: { type: 'literal', value: 'Draft' }\n *\n * Set semantics:\n * - `SemanticType.Status`\n *\n * @param entity The entity to which the status field will be added.\n * @param info Additional information about the field.\n * @returns The added status field property.\n */\nexport function addStatusField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findStatusField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'status', displayName: 'Status', ...info },\n type: 'string',\n schema: {\n enum: ['Active', 'Draft', 'Archived'],\n defaultValue: { type: 'literal', value: 'Draft' },\n },\n })\n prop.addSemantic({\n id: SemanticType.Status,\n })\n return prop\n}\n\n/**\n * Adds an owner field to the specified entity.\n * If an owner field already exists, it returns the existing field.\n * Otherwise, it creates a new owner field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'owner'\n * - info.displayName: 'Owner'\n * - required: true\n *\n * Set semantics:\n * - `SemanticType.ResourceOwnerIdentifier`\n *\n * @param entity The entity to which the owner field will be added.\n * @param info Additional information about the field.\n * @returns The added owner field property.\n */\nexport function addOwnerField(entity: DomainEntity, info: Partial<IThing> = {}): DomainAssociation {\n const existing = findOwnerField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addAssociation({\n info: { name: 'owner', displayName: 'Owner', ...info },\n required: true,\n })\n prop.addSemantic({\n id: SemanticType.ResourceOwnerIdentifier,\n })\n return prop\n}\n\n// This is owner with different name. Use that one instead.\n// function addCreatedByField(entity: DomainEntity): DomainElement {\n// const existing = findCreatedByField(entity, true)\n// if (existing) {\n// return existing\n// }\n// const prop = entity.addProperty({\n// info: { name: 'created_by', displayName: 'Created By' },\n// type: 'string',\n// readOnly: true,\n// index: true,\n// })\n// prop.addSemantic({\n// id: SemanticType.CreatedTimestamp,\n// })\n// return prop\n// }\n\n/**\n * Adds an updated by field to the specified entity as an association to the User entity.\n * If an updated by field already exists, it returns the existing field.\n * Otherwise, it creates a new updated by field with the specified information.\n *\n * Set properties:\n * - info.name: 'updated_by'\n * - info.displayName: 'Updated By'\n * - required: true\n *\n * Set semantics:\n * - `SemanticType.ResourceOwnerIdentifier`\n *\n * @param entity The entity to which the updated by field will be added.\n * @param info Additional information about the field.\n * @returns The added updated by field property.\n */\nexport function addUpdatedByField(entity: DomainEntity, info: Partial<IThing> = {}): DomainAssociation {\n const existing = findUpdatedByField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addAssociation({\n info: { name: 'updated_by', displayName: 'Updated By', ...info },\n required: true,\n })\n prop.addSemantic({\n id: SemanticType.ResourceOwnerIdentifier,\n })\n return prop\n}\n\n/**\n * Adds a created at field to the specified entity.\n * If a created at field already exists, it returns the existing field.\n * Otherwise, it creates a new created at field with the specified information.\n *\n * Set properties:\n * - type: 'datetime'\n * - info.name: 'created_at'\n * - info.displayName: 'Created At'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'function', value: 'now' }\n *\n * Set semantics:\n * - `CreatedTimestamp`\n *\n * @param entity The entity to which the created at field will be added.\n * @param info Additional information about the field.\n * @returns The created created at field.\n */\nexport function addCreatedAtField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findCreatedAtField(entity, true)\n if (existing) {\n // If the created_at field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'created_at', displayName: 'Created At', ...info },\n readOnly: true,\n index: true,\n type: 'datetime',\n schema: { defaultValue: { type: 'function', value: 'now' } },\n })\n prop.addSemantic({\n id: SemanticType.CreatedTimestamp,\n })\n return prop\n}\n\n/**\n * Adds an updated at field to the specified entity.\n * If an updated at field already exists, it returns the existing field.\n * Otherwise, it creates a new updated at field with the specified information.\n *\n * Set properties:\n * - type: 'datetime'\n * - info.name: 'updated_at'\n * - info.displayName: 'Updated At'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'function', value: 'now' }\n *\n * Set semantics:\n * - `UpdatedTimestamp`\n *\n * @param entity The entity to which the updated at field will be added.\n * @param info Additional information about the field.\n * @returns The created updated at field.\n */\nexport function addUpdatedAtField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findUpdatedAtField(entity, true)\n if (existing) {\n // If the updated_at field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'updated_at', displayName: 'Updated At', ...info },\n readOnly: true,\n index: true,\n type: 'datetime',\n schema: { defaultValue: { type: 'function', value: 'now' } },\n })\n prop.addSemantic({\n id: SemanticType.UpdatedTimestamp,\n })\n return prop\n}\n\n/**\n * Adds a deleted at field to the specified entity.\n * If a deleted at field already exists, it returns the existing field.\n * Otherwise, it creates a new deleted at field with the specified information.\n *\n * Set properties:\n * - required: true\n * - type: 'datetime'\n * - info.name: 'deleted_at'\n * - info.displayName: 'Deleted At'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'function', value: 'now' }\n *\n * Set semantics:\n * - `SemanticType.DeletedTimestamp`\n *\n * @param entity The entity to which the deleted_at field will be added.\n * @param info Additional information about the field.\n * @returns The added deleted at field property.\n */\nexport function addDeletedAtField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findDeletedAtField(entity, true)\n if (existing) {\n // If the deleted_at field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'deleted_at', displayName: 'Deleted At', ...info },\n readOnly: true,\n index: true,\n type: 'datetime',\n schema: { defaultValue: { type: 'function', value: 'now' } },\n })\n prop.addSemantic({\n id: SemanticType.DeletedTimestamp,\n })\n return prop\n}\n\nexport function addRoleField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findRoleField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'role', displayName: 'Role', ...info },\n type: 'string',\n required: true,\n index: true,\n schema: { defaultValue: { type: 'literal', value: 'user' }, enum: ['user', 'admin'] },\n })\n prop.addSemantic({\n id: SemanticType.UserRole,\n })\n return prop\n}\n\n/**\n * Adds an is_deleted field to the specified entity.\n * If an is_deleted field already exists, it returns the existing field.\n * Otherwise, it creates a new is_deleted field with the specified information.\n *\n * Set properties:\n * - type: 'boolean'\n * - info.name: 'is_deleted'\n * - info.displayName: 'Is Deleted'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'literal', value: 'false' }\n *\n * Set semantics:\n * - `SemanticType.DeletedFlag`\n *\n * @param entity The entity to which the is_deleted field will be added.\n * @param info Additional information about the field.\n * @returns The added is_deleted field property.\n */\nexport function addIsDeletedField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findIsDeletedField(entity, true)\n if (existing) {\n // If the is_deleted field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'is_deleted', displayName: 'Is Deleted', ...info },\n readOnly: true,\n index: true,\n type: 'boolean',\n schema: { defaultValue: { type: 'literal', value: 'false' } },\n })\n prop.addSemantic({\n id: SemanticType.DeletedFlag,\n })\n return prop\n}\n\n/**\n * Adds a first name field to the specified entity.\n * If a first name field already exists, it returns the existing field.\n * Otherwise, it creates a new first name field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'first_name'\n * - info.displayName: 'First Name'\n *\n * @param entity The entity to which the first name field will be added.\n * @param info Additional information about the field.\n * @returns The created first name field.\n */\nexport function addFirstNameField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findFirstNameField(entity)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'first_name', displayName: 'First Name', ...info },\n type: 'string',\n })\n return prop\n}\n\n/**\n * Adds a first name field to the specified entity.\n * If a first name field already exists, it returns the existing field.\n * Otherwise, it creates a new first name field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'first_name'\n * - info.displayName: 'First Name'\n *\n * @param entity The entity to which the first name field will be added.\n * @param info Additional information about the field.\n * @returns The created first name field.\n */\nexport function addLastNameField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findLastNameField(entity)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'last_name', displayName: 'Last Name', ...info },\n type: 'string',\n })\n return prop\n}\n\n/**\n * Adds a phone field to the specified entity.\n * If a phone field already exists, it returns the existing field.\n * Otherwise, it creates a new phone field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'phone'\n * - info.displayName: 'Phone Number'\n * - index: true (to search by phone number)\n *\n * Set semantics:\n * - id: SemanticType.Phone\n *\n * @param entity The entity to which the phone field will be added.\n * @param info Additional information about the field.\n * @returns The created phone field.\n */\nexport function addPhoneField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findPhoneField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'phone', displayName: 'Phone Number', ...info },\n type: 'string',\n index: true,\n })\n prop.addSemantic(\n createPhoneSemantic({\n format: 'international',\n requireCountryCode: true,\n requireVerification: true,\n verificationMethod: 'sms',\n })\n )\n return prop\n}\n\n/**\n * Adds an avatar URL field to the specified entity.\n * If an avatar URL field already exists, it returns the existing field.\n * Otherwise, it creates a new avatar URL field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'avatar_url'\n * - info.displayName: 'Avatar URL'\n *\n * Set semantics:\n * - id: SemanticType.ImageURL\n *\n * @param entity The entity to which the avatar URL field will be added.\n * @param info Additional information about the field.\n * @returns The created avatar URL field.\n */\nexport function addAvatarUrlField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findAvatarUrlField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'avatar_url', displayName: 'Avatar URL', ...info },\n type: 'string',\n })\n prop.addSemantic({ id: SemanticType.ImageURL })\n return prop\n}\n\n/**\n * Adds a public unique name (slug) field to the specified entity.\n * If a public unique name field already exists, it returns the existing field.\n * Otherwise, it creates a new public unique name field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'slug'\n * - info.displayName: 'Public Unique Name'\n * - index: true\n * - required: true\n * - unique: true\n *\n * Set semantics:\n * - id: SemanticType.PublicUniqueName\n *\n * @param entity The entity to which the public unique name field will be added.\n * @param info Additional information about the field.\n * @returns The created public unique name field.\n */\nexport function addPublicUniqueNameField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findPublicUniqueNameField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'slug', displayName: 'Public Unique Name', ...info },\n type: 'string',\n index: true,\n required: true,\n unique: true,\n })\n prop.addSemantic(createPublicUniqueNameSemantic(DEFAULT_PUBLIC_UNIQUE_NAME_CONFIG))\n return prop\n}\n\n/**\n * Adds a SKU field to the specified entity.\n * If a SKU field already exists, it returns the existing field.\n * Otherwise, it creates a new SKU field with semantic annotation.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'sku'\n * - info.displayName: 'SKU'\n * - required: true\n * - unique: true\n *\n * @param entity The entity to which the SKU field will be added.\n * @param info Additional information about the field.\n * @returns The created SKU field.\n */\nexport function addSkuField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findSkuField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'sku', displayName: 'SKU', ...info },\n type: 'string',\n required: true,\n unique: true,\n })\n prop.addSemantic({ ...SKU_PRESETS.PRODUCT_STANDARD })\n return prop\n}\n\n/**\n * Adds a price field to the specified entity with currency semantic.\n * If a price field already exists, it returns the existing field.\n * Otherwise, it creates a new price field with proper currency handling.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'price'\n * - info.displayName: 'Price'\n * - required: true\n * - schema.maximum: 0\n *\n * @param entity The entity to which the price field will be added.\n * @param info Additional information about the field.\n * @returns The created price field.\n */\nexport function addPriceField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findPriceField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'price', displayName: 'Price', ...info },\n type: 'number',\n required: true,\n schema: {\n maximum: 0,\n },\n bindings: [\n {\n type: 'web',\n schema: {\n dataType: 'float',\n },\n },\n ],\n })\n prop.addSemantic({ ...CURRENCY_PRESETS.USD_CENTS })\n return prop\n}\n\n/**\n * Adds a quantity field to the specified entity.\n * If a quantity field already exists, it returns the existing field.\n * Otherwise, it creates a new quantity field with validation.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'quantity'\n * - info.displayName: 'Quantity'\n * - required: true\n * - schema.minimum: 0\n *\n * @param entity The entity to which the quantity field will be added.\n * @param info Additional information about the field.\n * @returns The created quantity field.\n */\nexport function addQuantityField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findQuantityField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'quantity', displayName: 'Quantity', ...info },\n type: 'number',\n required: true,\n schema: {\n minimum: 0,\n },\n })\n return prop\n}\n\n/**\n * Adds a weight field to the specified entity.\n * If a weight field already exists, it returns the existing field.\n * Otherwise, it creates a new weight field.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'weight'\n * - info.displayName: 'Weight'\n *\n * @param entity The entity to which the weight field will be added.\n * @param info Additional information about the field.\n * @returns The created weight field.\n */\nexport function addWeightField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findWeightField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'weight', displayName: 'Weight', ...info },\n type: 'number',\n })\n return prop\n}\n\n/**\n * Adds an images field to the specified entity for multiple image URLs.\n * If an images field already exists, it returns the existing field.\n * Otherwise, it creates a new images field with ImageURL semantic.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'images'\n * - info.displayName: 'Images'\n * - multiple: true\n *\n * @param entity The entity to which the images field will be added.\n * @param info Additional information about the field.\n * @returns The created images field.\n */\nexport function addImagesField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findImagesField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'images', displayName: 'Images', ...info },\n type: 'string',\n multiple: true,\n })\n prop.addSemantic({\n id: SemanticType.ImageURL,\n })\n return prop\n}\n\n/**\n * Adds a status field with custom enum values to the specified entity.\n * This is not a regular enum field, it should represent a record status.\n * If a status field already exists, it returns the existing field.\n * Otherwise, it creates a new status field with provided enum values.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'status'\n * - info.displayName: 'Status'\n * - required: true\n * - schema.enum: provided enum values\n * - schema.defaultValue: first enum value\n *\n * @param entity The entity to which the status field will be added.\n * @param enumValues Array of status values.\n * @param info Additional information about the field.\n * @returns The created status field.\n */\nexport function addCustomStatusField(\n entity: DomainEntity,\n enumValues: string[],\n info: Partial<IThing> = {}\n): DomainProperty {\n const existing = findStatusField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'status', displayName: 'Status', ...info },\n type: 'string',\n required: true,\n schema: {\n enum: enumValues,\n defaultValue: {\n type: 'literal',\n value: enumValues[0],\n },\n },\n })\n prop.addSemantic(createStatusSemantic())\n return prop\n}\n\n/**\n * Adds a boolean field to the specified entity.\n * If the field already exists, it returns the existing field.\n * Otherwise, it creates a new boolean field with default value.\n *\n * Set properties:\n * - type: 'boolean'\n * - required: true\n * - schema.defaultValue: provided default or 'false'\n *\n * @param entity The entity to which the boolean field will be added.\n * @param fieldName Name of the boolean field.\n * @param defaultValue Default boolean value.\n * @param info Additional information about the field.\n * @returns The created boolean field.\n */\nexport function addBooleanField(\n entity: DomainEntity,\n fieldName: string,\n defaultValue = 'false',\n info: Partial<IThing> = {}\n): DomainProperty {\n const existing = findBooleanField(entity, fieldName, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: fieldName, ...info },\n type: 'boolean',\n required: true,\n schema: {\n defaultValue: {\n type: 'literal',\n value: defaultValue,\n },\n },\n })\n return prop\n}\n\n/**\n * Adds a session ID field to the specified entity.\n * If a session ID field already exists, it returns the existing field.\n * Otherwise, it creates a new session ID field.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'sessionId'\n * - info.displayName: 'Session ID'\n *\n * @param entity The entity to which the session ID field will be added.\n * @param info Additional information about the field.\n * @returns The created session ID field.\n */\nexport function addSessionIdField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findSessionIdField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'sessionId', displayName: 'Session ID', ...info },\n type: 'string',\n })\n return prop\n}\n\n/**\n * Adds an expiration datetime field to the specified entity.\n * If an expiration field already exists, it returns the existing field.\n * Otherwise, it creates a new expiration field.\n *\n * Set properties:\n * - type: 'datetime'\n * - info.name: 'expiresAt'\n * - info.displayName: 'Expires At'\n *\n * @param entity The entity to which the expiration field will be added.\n * @param info Additional information about the field.\n * @returns The created expiration field.\n */\nexport function addExpiresAtField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findExpiresAtField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'expiresAt', displayName: 'Expires At', ...info },\n type: 'datetime',\n })\n return prop\n}\n\n/**\n * Adds a unit price field to the specified entity with currency semantic.\n * If a unit price field already exists, it returns the existing field.\n * Otherwise, it creates a new unit price field with proper currency handling.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'unitPrice'\n * - info.displayName: 'Unit Price'\n * - required: true\n *\n * @param entity The entity to which the unit price field will be added.\n * @param info Additional information about the field.\n * @returns The created unit price field.\n */\nexport function addUnitPriceField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findUnitPriceField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'unitPrice', displayName: 'Unit Price', ...info },\n type: 'number',\n required: true,\n })\n prop.addSemantic({ ...CURRENCY_PRESETS.USD_CENTS })\n return prop\n}\n\n/**\n * Adds a currency amount field (subtotal, tax, shipping, etc.).\n */\nexport function addCurrencyAmountField(\n entity: DomainEntity,\n fieldName: string,\n displayName: string,\n info: Partial<IThing> = {}\n): DomainProperty {\n const prop = entity.addProperty({\n info: {\n name: fieldName,\n displayName,\n ...info,\n },\n type: 'number',\n required: true,\n })\n prop.addSemantic({ ...CURRENCY_PRESETS.USD_CENTS })\n return prop\n}\n\n/**\n * Finds a field in the given entity that matches the specified predicate.\n * @param entity The entity to search within.\n * @param predicate A function that defines the search criteria.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found field property or undefined.\n */\nfunction findPropertyField(\n entity: DomainEntity,\n predicate: (property: DomainProperty) => boolean,\n direct = false\n): DomainProperty | undefined {\n for (const property of entity.properties) {\n if (predicate(property)) {\n return property\n }\n }\n if (direct) {\n return undefined\n }\n for (const parent of entity.listParents()) {\n // we can't call a recursive function here because it would scan vertically through the hierarchy\n // and not horizontally through all parents. We need to check each **direct** parent separately,\n // and then move up.\n for (const property of parent.properties) {\n if (predicate(property)) {\n return property\n }\n }\n }\n return undefined\n}\n\n/**\n * Finds a field in the given entity that matches the specified predicate.\n * @param entity The entity to search within.\n * @param predicate A function that defines the search criteria.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found field association or undefined.\n */\nfunction findAssociationField(\n entity: DomainEntity,\n predicate: (property: DomainAssociation) => boolean,\n direct = false\n): DomainAssociation | undefined {\n for (const assoc of entity.associations) {\n if (predicate(assoc)) {\n return assoc\n }\n }\n if (direct) {\n return undefined\n }\n for (const parent of entity.listParents()) {\n // we can't call a recursive function here because it would scan vertically through the hierarchy\n // and not horizontally through all parents. We need to check each **direct** parent separately,\n // and then move up.\n for (const assoc of parent.associations) {\n if (predicate(assoc)) {\n return assoc\n }\n }\n }\n return undefined\n}\n\n/**\n * Searches for the ID field in the given entity.\n * @param entity The entity to search for the ID field.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found ID field property or undefined.\n */\nfunction findIdField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n if (!direct) {\n // Find the primary key property in the entity, which can be inherited or defined on the entity itself.\n return entity.primaryKey()\n }\n for (const property of entity.properties) {\n if (property.primary) {\n return property\n }\n }\n}\n\n/**\n * Searches for the email field in the given entity.\n * @param entity The entity to search for the email field.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found email field property or undefined.\n */\nfunction findEmailField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Email), direct)\n}\n\n/**\n * Searches for the password field in the given entity.\n * @param entity The entity to search for the password field.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found password field property or undefined.\n */\nfunction findPasswordField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Password), direct)\n}\n\nfunction findVersionField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.Version)\n },\n direct\n )\n}\n\nfunction findNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Title), direct)\n}\n\nfunction findDisplayNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Name), direct)\n}\n\nfunction findDescriptionField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Description), direct)\n}\n\nfunction findStatusField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Status), direct)\n}\n\nfunction findOwnerField(entity: DomainEntity, direct = false): DomainAssociation | undefined {\n return findAssociationField(\n entity,\n (association) =>\n association.hasSemantic(SemanticType.ResourceOwnerIdentifier) &&\n ['owner', 'author'].includes(association.info.name || ''),\n direct\n )\n}\n\n// function findCreatedByField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n// return findField(entity, (property) => property.hasSemantic(SemanticType.CreatedTimestamp), direct)\n// }\n\nfunction findUpdatedByField(entity: DomainEntity, direct = false): DomainAssociation | undefined {\n return findAssociationField(\n entity,\n (association) =>\n association.hasSemantic(SemanticType.ResourceOwnerIdentifier) &&\n ['updated_by', 'updatedBy'].includes(association.info.name || ''),\n direct\n )\n}\n\nfunction findCreatedAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.CreatedTimestamp)\n },\n direct\n )\n}\n\nfunction findUpdatedAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.UpdatedTimestamp)\n },\n direct\n )\n}\n\nfunction findDeletedAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.DeletedTimestamp)\n },\n direct\n )\n}\n\nfunction findRoleField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.UserRole), direct)\n}\n\nfunction findIsDeletedField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.DeletedFlag), direct)\n}\n\nexport function addRecommendedFields(entity: DomainEntity): DomainElement[] {\n const fields: DomainElement[] = []\n if (!findIdField(entity)) {\n fields.push(addIdField(entity))\n }\n // The version field is not always recommended, so we don't add it by default.\n // if (!findVersionField(entity)) {\n // fields.push(addVersionField(entity))\n // }\n if (!findCreatedAtField(entity)) {\n fields.push(addCreatedAtField(entity))\n }\n // if (!findCreatedByField(entity)) {\n // fields.push(addCreatedByField(entity))\n // }\n if (!findUpdatedAtField(entity)) {\n fields.push(addUpdatedAtField(entity))\n }\n if (!findUpdatedByField(entity)) {\n fields.push(addUpdatedByField(entity))\n }\n if (!findDeletedAtField(entity)) {\n fields.push(addDeletedAtField(entity))\n }\n if (!findIsDeletedField(entity)) {\n fields.push(addIsDeletedField(entity))\n }\n return fields\n}\n\nfunction findFirstNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => ['first_name', 'firstName'].includes(property.info.name || ''), direct)\n}\n\nfunction findLastNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => ['last_name', 'lastName'].includes(property.info.name || ''), direct)\n}\n\n// Avatar URL has the `SemanticType.ImageURL` semantic, but it can be used for any image URL.\n// It is not a specific semantic, but it is a common field in many entities.\nfunction findAvatarUrlField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => ['avatar_url', 'avatarUrl'].includes(property.info.name || ''), direct)\n}\n\nfunction findPhoneField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Phone), direct)\n}\n\nfunction findPublicUniqueNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.PublicUniqueName), direct)\n}\n\nfunction findSkuField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.SKU), direct)\n}\n\nfunction findPriceField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) =>\n ['price', 'unitPrice', 'totalPrice'].includes(property.info.name || '') &&\n property.hasSemantic(SemanticType.Currency),\n direct\n )\n}\n\nfunction findQuantityField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => ['quantity', 'stock', 'amount'].includes(property.info.name || '') && property.type === 'number',\n direct\n )\n}\n\nfunction findWeightField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.info.name === 'weight' && property.type === 'number', direct)\n}\n\nfunction findImagesField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === 'images' && property.hasSemantic(SemanticType.ImageURL),\n direct\n )\n}\n\nfunction findBooleanField(entity: DomainEntity, fieldName: string, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === fieldName && property.type === 'boolean',\n direct\n )\n}\n\nfunction findSessionIdField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.info.name === 'sessionId', direct)\n}\n\nfunction findUnitPriceField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === 'unitPrice' && property.hasSemantic(SemanticType.Currency),\n direct\n )\n}\n\nfunction findExpiresAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === 'expiresAt' && property.type === 'datetime',\n direct\n )\n}\n\nexport function addStreetAddressField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findStreetAddressField(entity, true)\n if (existing) return existing\n const prop = entity.addProperty({\n info: { name: 'street_address', displayName: 'Street Address', ...info },\n type: 'string',\n required: true,\n })\n prop.addSemantic({ id: SemanticType.StreetAddress })\n return prop\n}\n\nfunction findStreetAddressField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.StreetAddress), direct)\n}\n\nexport function addStreetAddressSupplementalField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n // we do not look for duplicates here, because the address can have multiple supplements (like line2, line3, etc.)\n let latest = 0\n for (const prop of entity.properties) {\n if (prop.hasSemantic(SemanticType.StreetAddressSupplemental)) {\n const match = prop.info.name?.match(/street_address_(\\d+)/)\n if (match) {\n const num = parseInt(match[1], 10)\n if (num > latest) latest = num\n }\n }\n }\n const prop = entity.addProperty({\n info: { name: `street_address_${latest + 1}`, displayName: `Street Address ${latest + 1}`, ...info },\n type: 'string',\n required: false,\n })\n prop.addSemantic({ id: SemanticType.StreetAddressSupplemental })\n return prop\n}\n\nexport function addCityField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findCityField(entity, true)\n if (existing) return existing\n const prop = entity.addProperty({\n info: { name: 'city', displayName: 'City', ...info },\n type: 'string',\n required: true,\n index: true,\n })\n prop.addSemantic({ id: SemanticType.City })\n return prop\n}\n\nfunction findCityField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.City), direct)\n}\n\nexport function addPostalCodeField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findPostalCodeField(entity, true)\n if (existing) return existing\n const prop = entity.addProperty({\n info: { name: 'postal_code', displayName: 'Postal Code', ...info },\n type: 'string',\n required: true,\n index: true,\n })\n prop.addSemantic(createPostalCodeSemantic(DEFAULT_POSTAL_CODE_CONFIG))\n return prop\n}\n\nfunction findPostalCodeField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.PostalCode), direct)\n}\n\nexport function addCountryField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findCountryField(entity, true)\n if (existing) return existing\n const prop = entity.addProperty({\n info: { name: 'country', displayName: 'Country', ...info },\n type: 'string',\n required: true,\n index: true,\n })\n prop.addSemantic(createCountrySemantic(DEFAULT_COUNTRY_CONFIG))\n return prop\n}\n\nfunction findCountryField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Country), direct)\n}\n\nexport function addRegionField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findRegionField(entity, true)\n if (existing) return existing\n const prop = entity.addProperty({\n info: { name: 'region', displayName: 'Region', ...info },\n type: 'string',\n index: true,\n })\n prop.addSemantic({ id: SemanticType.Region })\n return prop\n}\n\nfunction findRegionField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Region), direct)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Intelisense.js","sourceRoot":"","sources":["../../../../src/modeling/helpers/Intelisense.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AACnF,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,8BAA8B,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CA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AC,WAAW,CAAC,qBAAqB,CAAC,sBAAsB,CAAC,CAAC,CAAA;IAC/D,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAoB,EAAE,MAAM,GAAG,KAAK;IAC5D,OAAO,iBAAiB,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAA;AACpG,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAoB,EAAE,OAA6B,EAAE;IAClF,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC9C,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAA;IAC7B,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC;QAC9B,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE;QACxD,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,IAAI;KACZ,CAAC,CAAA;IACF,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,YAAY,CAAC,MAAM,EAAE,CAAC,CAAA;IAC7C,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,eAAe,CAAC,MAAoB,EAAE,MAAM,GAAG,KAAK;IAC3D,OAAO,iBAAiB,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAA;AACnG,CAAC","sourcesContent":["import type { DomainEntity } from '../DomainEntity.js'\nimport type { DomainElement } from '../DomainElement.js'\nimport type { DomainProperty } from '../DomainProperty.js'\nimport type { DomainAssociation } from '../DomainAssociation.js'\nimport type { ThingSchema } from '../../models/Thing.js'\nimport { SemanticType } from '../Semantics.js'\nimport { createEmailSemantic, DEFAULT_EMAIL_CONFIG } from '../definitions/Email.js'\nimport { createPasswordSemantic, DEFAULT_PASSWORD_CONFIG } from '../definitions/Password.js'\nimport { createPhoneSemantic } from '../definitions/Phone.js'\nimport { createPublicUniqueNameSemantic, DEFAULT_PUBLIC_UNIQUE_NAME_CONFIG } from '../definitions/PublicUniqueName.js'\nimport { createDescriptionSemantic } from '../definitions/Description.js'\nimport { CURRENCY_PRESETS } from '../definitions/Currency.js'\nimport { createStatusSemantic } from '../definitions/Status.js'\nimport { SKU_PRESETS } from '../definitions/SKU.js'\nimport { createCountrySemantic, DEFAULT_COUNTRY_CONFIG } from '../definitions/Country.js'\nimport { createPostalCodeSemantic, DEFAULT_POSTAL_CODE_CONFIG } from '../definitions/PostalCode.js'\n\n/**\n * Adds a field to the given entity that is automatically generated by the system.\n *\n * @param entity The entity to which the auto field will be added.\n * @param autoField The name of the auto field to add.\n * @returns The added DomainElement representing the auto field.\n * @throws Error if the auto field is not supported.\n */\nexport function addAutoField(entity: DomainEntity, autoField: string): DomainElement {\n switch (autoField) {\n case 'id':\n return addIdField(entity)\n case 'email':\n return addEmailField(entity)\n case 'name':\n return addNameField(entity)\n case 'display-name':\n return addDisplayNameField(entity)\n case 'description':\n return addDescriptionField(entity)\n case 'status':\n return addStatusField(entity)\n case 'version':\n return addVersionField(entity)\n case 'owner':\n return addOwnerField(entity)\n case 'created':\n return addCreatedAtField(entity)\n // case 'created-by':\n // return addCreatedByField(entity)\n case 'updated':\n return addUpdatedAtField(entity)\n case 'updated-by':\n return addUpdatedByField(entity)\n case 'is-deleted':\n return addIsDeletedField(entity)\n case 'deleted':\n return addDeletedAtField(entity)\n case 'role':\n return addRoleField(entity)\n case 'first-name':\n return addFirstNameField(entity)\n case 'last-name':\n return addLastNameField(entity)\n case 'phone':\n return addPhoneField(entity)\n case 'avatar-url':\n return addAvatarUrlField(entity)\n case 'public-unique-name':\n return addPublicUniqueNameField(entity)\n case 'price':\n return addPriceField(entity)\n case 'sku':\n return addSkuField(entity)\n case 'quantity':\n return addQuantityField(entity)\n case 'weight':\n return addWeightField(entity)\n case 'images':\n return addImagesField(entity)\n case 'session-id':\n // This was removed from the UI. We will not support session id configuration\n // as the platform will handle it to separate the business logic from the transport layer.\n return addSessionIdField(entity)\n case 'expires-at':\n // This was removed from the UI. We will not support expires at configuration\n // as the platform will handle it to separate the business logic from the transport layer.\n return addExpiresAtField(entity)\n case 'unit-price':\n return addUnitPriceField(entity)\n case 'street-address':\n return addStreetAddressField(entity)\n case 'street-address-supplemental':\n return addStreetAddressSupplementalField(entity)\n case 'city':\n return addCityField(entity)\n case 'postal-code':\n return addPostalCodeField(entity)\n case 'country':\n return addCountryField(entity)\n case 'region':\n return addRegionField(entity)\n default:\n throw new Error(`Unsupported auto field: ${autoField}`)\n }\n}\n\n/**\n * Adds the primary field (ID) to the given entity.\n * If the ID field already exists, it returns the existing field.\n * Otherwise, it creates a new ID field with a name based on the entity's name.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'id'\n * - primary: true\n * - readOnly: true\n * - schema.defaultValue: { type: 'function', value: 'uuid-v4' }\n *\n * @param entity The entity to which the ID field will be added.\n * @returns The added primary field property.\n */\nexport function addIdField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findIdField(entity, true)\n if (existing) {\n // If the ID field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: `id`, ...info },\n primary: true,\n readOnly: true,\n // I don't think we need to index the ID field..\n // index: true,\n type: 'string',\n // @TODO: We should experiment with the random ID generation using the nano library.\n schema: { defaultValue: { type: 'function', value: 'uuid-v4' } },\n })\n return prop\n}\n\n/**\n * Adds an email field to the given entity.\n * If the email field already exists, it returns the existing field.\n * Otherwise, it creates a new email field with a semantic annotation.\n * @param entity The entity to which the email field will be added.\n * @returns The added email field property.\n */\nexport function addEmailField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findEmailField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'email', displayName: 'Email Address', ...info },\n type: 'string',\n required: true,\n index: true,\n })\n prop.addSemantic(createEmailSemantic(DEFAULT_EMAIL_CONFIG))\n return prop\n}\n\n/**\n * Adds a password field to the given entity.\n * If the password field already exists, it returns the existing field.\n * Otherwise, it creates a new password field with a semantic annotation.\n * @param entity The entity to which the password field will be added.\n * @param info Additional information for the password field.\n * @returns The added password field property.\n */\nexport function addPasswordField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findPasswordField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'password', displayName: 'Password', ...info },\n type: 'string',\n required: true,\n })\n prop.addSemantic(createPasswordSemantic(DEFAULT_PASSWORD_CONFIG))\n return prop\n}\n\n/**\n * Adds a version field to the given entity.\n * @param entity The entity to which the version field will be added.\n * The version field is used to track the version of the entity.\n * @returns The added version field property.\n */\nexport function addVersionField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findVersionField(entity, true)\n if (existing) {\n // If the version field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'version', displayName: 'Version', ...info },\n readOnly: true,\n index: true,\n type: 'number',\n schema: { defaultValue: { type: 'function', value: 'incremental' }, minimum: 0 },\n })\n prop.addSemantic({\n id: SemanticType.Version,\n })\n return prop\n}\n\nexport function addNameField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findNameField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'name', displayName: 'Name', ...info },\n type: 'string',\n })\n prop.addSemantic({\n id: SemanticType.Title,\n })\n return prop\n}\n\nexport function addDisplayNameField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findDisplayNameField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'display-name', displayName: 'Display Name', ...info },\n type: 'string',\n })\n prop.addSemantic({\n id: SemanticType.Name,\n })\n return prop\n}\n\n/**\n * Adds a description field to the specified entity.\n * If a description field already exists, it returns the existing field.\n * Otherwise, it creates a new description field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'description'\n * - info.displayName: 'Description'\n *\n * Set semantics:\n * - `SemanticType.Description`\n *\n * @param entity The entity to which the description field will be added.\n * @returns The added description field property.\n */\nexport function addDescriptionField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findDescriptionField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'description', displayName: 'Description', ...info },\n type: 'string',\n })\n prop.addSemantic(createDescriptionSemantic())\n return prop\n}\n\n/**\n * Adds a status field to the specified entity.\n * If a status field already exists, it returns the existing field.\n * Otherwise, it creates a new status field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'status'\n * - info.displayName: 'Status'\n * - schema.enum: ['Active', 'Draft', 'Archived']\n * - schema.defaultValue: { type: 'literal', value: 'Draft' }\n *\n * Set semantics:\n * - `SemanticType.Status`\n *\n * @param entity The entity to which the status field will be added.\n * @param info Additional information about the field.\n * @returns The added status field property.\n */\nexport function addStatusField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findStatusField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'status', displayName: 'Status', ...info },\n type: 'string',\n schema: {\n enum: ['Active', 'Draft', 'Archived'],\n defaultValue: { type: 'literal', value: 'Draft' },\n },\n })\n prop.addSemantic({\n id: SemanticType.Status,\n })\n return prop\n}\n\n/**\n * Adds an owner field to the specified entity.\n * If an owner field already exists, it returns the existing field.\n * Otherwise, it creates a new owner field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'owner'\n * - info.displayName: 'Owner'\n * - required: true\n *\n * Set semantics:\n * - `SemanticType.ResourceOwnerIdentifier`\n *\n * @param entity The entity to which the owner field will be added.\n * @param info Additional information about the field.\n * @returns The added owner field property.\n */\nexport function addOwnerField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainAssociation {\n const existing = findOwnerField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addAssociation({\n info: { name: 'owner', displayName: 'Owner', ...info },\n required: true,\n })\n prop.addSemantic({\n id: SemanticType.ResourceOwnerIdentifier,\n })\n return prop\n}\n\n// This is owner with different name. Use that one instead.\n// function addCreatedByField(entity: DomainEntity): DomainElement {\n// const existing = findCreatedByField(entity, true)\n// if (existing) {\n// return existing\n// }\n// const prop = entity.addProperty({\n// info: { name: 'created_by', displayName: 'Created By' },\n// type: 'string',\n// readOnly: true,\n// index: true,\n// })\n// prop.addSemantic({\n// id: SemanticType.CreatedTimestamp,\n// })\n// return prop\n// }\n\n/**\n * Adds an updated by field to the specified entity as an association to the User entity.\n * If an updated by field already exists, it returns the existing field.\n * Otherwise, it creates a new updated by field with the specified information.\n *\n * Set properties:\n * - info.name: 'updated_by'\n * - info.displayName: 'Updated By'\n * - required: true\n *\n * Set semantics:\n * - `SemanticType.ResourceOwnerIdentifier`\n *\n * @param entity The entity to which the updated by field will be added.\n * @param info Additional information about the field.\n * @returns The added updated by field property.\n */\nexport function addUpdatedByField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainAssociation {\n const existing = findUpdatedByField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addAssociation({\n info: { name: 'updated_by', displayName: 'Updated By', ...info },\n required: true,\n })\n prop.addSemantic({\n id: SemanticType.ResourceOwnerIdentifier,\n })\n return prop\n}\n\n/**\n * Adds a created at field to the specified entity.\n * If a created at field already exists, it returns the existing field.\n * Otherwise, it creates a new created at field with the specified information.\n *\n * Set properties:\n * - type: 'datetime'\n * - info.name: 'created_at'\n * - info.displayName: 'Created At'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'function', value: 'now' }\n *\n * Set semantics:\n * - `CreatedTimestamp`\n *\n * @param entity The entity to which the created at field will be added.\n * @param info Additional information about the field.\n * @returns The created created at field.\n */\nexport function addCreatedAtField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findCreatedAtField(entity, true)\n if (existing) {\n // If the created_at field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'created_at', displayName: 'Created At', ...info },\n readOnly: true,\n index: true,\n type: 'datetime',\n schema: { defaultValue: { type: 'function', value: 'now' } },\n })\n prop.addSemantic({\n id: SemanticType.CreatedTimestamp,\n })\n return prop\n}\n\n/**\n * Adds an updated at field to the specified entity.\n * If an updated at field already exists, it returns the existing field.\n * Otherwise, it creates a new updated at field with the specified information.\n *\n * Set properties:\n * - type: 'datetime'\n * - info.name: 'updated_at'\n * - info.displayName: 'Updated At'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'function', value: 'now' }\n *\n * Set semantics:\n * - `UpdatedTimestamp`\n *\n * @param entity The entity to which the updated at field will be added.\n * @param info Additional information about the field.\n * @returns The created updated at field.\n */\nexport function addUpdatedAtField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findUpdatedAtField(entity, true)\n if (existing) {\n // If the updated_at field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'updated_at', displayName: 'Updated At', ...info },\n readOnly: true,\n index: true,\n type: 'datetime',\n schema: { defaultValue: { type: 'function', value: 'now' } },\n })\n prop.addSemantic({\n id: SemanticType.UpdatedTimestamp,\n })\n return prop\n}\n\n/**\n * Adds a deleted at field to the specified entity.\n * If a deleted at field already exists, it returns the existing field.\n * Otherwise, it creates a new deleted at field with the specified information.\n *\n * Set properties:\n * - required: true\n * - type: 'datetime'\n * - info.name: 'deleted_at'\n * - info.displayName: 'Deleted At'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'function', value: 'now' }\n *\n * Set semantics:\n * - `SemanticType.DeletedTimestamp`\n *\n * @param entity The entity to which the deleted_at field will be added.\n * @param info Additional information about the field.\n * @returns The added deleted at field property.\n */\nexport function addDeletedAtField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findDeletedAtField(entity, true)\n if (existing) {\n // If the deleted_at field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'deleted_at', displayName: 'Deleted At', ...info },\n readOnly: true,\n index: true,\n type: 'datetime',\n schema: { defaultValue: { type: 'function', value: 'now' } },\n })\n prop.addSemantic({\n id: SemanticType.DeletedTimestamp,\n })\n return prop\n}\n\nexport function addRoleField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findRoleField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'role', displayName: 'Role', ...info },\n type: 'string',\n required: true,\n index: true,\n schema: { defaultValue: { type: 'literal', value: 'user' }, enum: ['user', 'admin'] },\n })\n prop.addSemantic({\n id: SemanticType.UserRole,\n })\n return prop\n}\n\n/**\n * Adds an is_deleted field to the specified entity.\n * If an is_deleted field already exists, it returns the existing field.\n * Otherwise, it creates a new is_deleted field with the specified information.\n *\n * Set properties:\n * - type: 'boolean'\n * - info.name: 'is_deleted'\n * - info.displayName: 'Is Deleted'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'literal', value: 'false' }\n *\n * Set semantics:\n * - `SemanticType.DeletedFlag`\n *\n * @param entity The entity to which the is_deleted field will be added.\n * @param info Additional information about the field.\n * @returns The added is_deleted field property.\n */\nexport function addIsDeletedField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findIsDeletedField(entity, true)\n if (existing) {\n // If the is_deleted field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'is_deleted', displayName: 'Is Deleted', ...info },\n readOnly: true,\n index: true,\n type: 'boolean',\n schema: { defaultValue: { type: 'literal', value: 'false' } },\n })\n prop.addSemantic({\n id: SemanticType.DeletedFlag,\n })\n return prop\n}\n\n/**\n * Adds a first name field to the specified entity.\n * If a first name field already exists, it returns the existing field.\n * Otherwise, it creates a new first name field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'first_name'\n * - info.displayName: 'First Name'\n *\n * @param entity The entity to which the first name field will be added.\n * @param info Additional information about the field.\n * @returns The created first name field.\n */\nexport function addFirstNameField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findFirstNameField(entity)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'first_name', displayName: 'First Name', ...info },\n type: 'string',\n })\n return prop\n}\n\n/**\n * Adds a first name field to the specified entity.\n * If a first name field already exists, it returns the existing field.\n * Otherwise, it creates a new first name field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'first_name'\n * - info.displayName: 'First Name'\n *\n * @param entity The entity to which the first name field will be added.\n * @param info Additional information about the field.\n * @returns The created first name field.\n */\nexport function addLastNameField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findLastNameField(entity)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'last_name', displayName: 'Last Name', ...info },\n type: 'string',\n })\n return prop\n}\n\n/**\n * Adds a phone field to the specified entity.\n * If a phone field already exists, it returns the existing field.\n * Otherwise, it creates a new phone field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'phone'\n * - info.displayName: 'Phone Number'\n * - index: true (to search by phone number)\n *\n * Set semantics:\n * - id: SemanticType.Phone\n *\n * @param entity The entity to which the phone field will be added.\n * @param info Additional information about the field.\n * @returns The created phone field.\n */\nexport function addPhoneField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findPhoneField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'phone', displayName: 'Phone Number', ...info },\n type: 'string',\n index: true,\n })\n prop.addSemantic(\n createPhoneSemantic({\n format: 'international',\n requireCountryCode: true,\n requireVerification: true,\n verificationMethod: 'sms',\n })\n )\n return prop\n}\n\n/**\n * Adds an avatar URL field to the specified entity.\n * If an avatar URL field already exists, it returns the existing field.\n * Otherwise, it creates a new avatar URL field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'avatar_url'\n * - info.displayName: 'Avatar URL'\n *\n * Set semantics:\n * - id: SemanticType.ImageURL\n *\n * @param entity The entity to which the avatar URL field will be added.\n * @param info Additional information about the field.\n * @returns The created avatar URL field.\n */\nexport function addAvatarUrlField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findAvatarUrlField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'avatar_url', displayName: 'Avatar URL', ...info },\n type: 'string',\n })\n prop.addSemantic({ id: SemanticType.ImageURL })\n return prop\n}\n\n/**\n * Adds a public unique name (slug) field to the specified entity.\n * If a public unique name field already exists, it returns the existing field.\n * Otherwise, it creates a new public unique name field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'slug'\n * - info.displayName: 'Public Unique Name'\n * - index: true\n * - required: true\n * - unique: true\n *\n * Set semantics:\n * - id: SemanticType.PublicUniqueName\n *\n * @param entity The entity to which the public unique name field will be added.\n * @param info Additional information about the field.\n * @returns The created public unique name field.\n */\nexport function addPublicUniqueNameField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findPublicUniqueNameField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'slug', displayName: 'Public Unique Name', ...info },\n type: 'string',\n index: true,\n required: true,\n unique: true,\n })\n prop.addSemantic(createPublicUniqueNameSemantic(DEFAULT_PUBLIC_UNIQUE_NAME_CONFIG))\n return prop\n}\n\n/**\n * Adds a SKU field to the specified entity.\n * If a SKU field already exists, it returns the existing field.\n * Otherwise, it creates a new SKU field with semantic annotation.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'sku'\n * - info.displayName: 'SKU'\n * - required: true\n * - unique: true\n *\n * @param entity The entity to which the SKU field will be added.\n * @param info Additional information about the field.\n * @returns The created SKU field.\n */\nexport function addSkuField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findSkuField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'sku', displayName: 'SKU', ...info },\n type: 'string',\n required: true,\n unique: true,\n })\n prop.addSemantic({ ...SKU_PRESETS.PRODUCT_STANDARD })\n return prop\n}\n\n/**\n * Adds a price field to the specified entity with currency semantic.\n * If a price field already exists, it returns the existing field.\n * Otherwise, it creates a new price field with proper currency handling.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'price'\n * - info.displayName: 'Price'\n * - required: true\n * - schema.maximum: 0\n *\n * @param entity The entity to which the price field will be added.\n * @param info Additional information about the field.\n * @returns The created price field.\n */\nexport function addPriceField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findPriceField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'price', displayName: 'Price', ...info },\n type: 'number',\n required: true,\n schema: {\n maximum: 0,\n },\n bindings: [\n {\n type: 'web',\n schema: {\n dataType: 'float',\n },\n },\n ],\n })\n prop.addSemantic({ ...CURRENCY_PRESETS.USD_CENTS })\n return prop\n}\n\n/**\n * Adds a quantity field to the specified entity.\n * If a quantity field already exists, it returns the existing field.\n * Otherwise, it creates a new quantity field with validation.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'quantity'\n * - info.displayName: 'Quantity'\n * - required: true\n * - schema.minimum: 0\n *\n * @param entity The entity to which the quantity field will be added.\n * @param info Additional information about the field.\n * @returns The created quantity field.\n */\nexport function addQuantityField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findQuantityField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'quantity', displayName: 'Quantity', ...info },\n type: 'number',\n required: true,\n schema: {\n minimum: 0,\n },\n })\n return prop\n}\n\n/**\n * Adds a weight field to the specified entity.\n * If a weight field already exists, it returns the existing field.\n * Otherwise, it creates a new weight field.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'weight'\n * - info.displayName: 'Weight'\n *\n * @param entity The entity to which the weight field will be added.\n * @param info Additional information about the field.\n * @returns The created weight field.\n */\nexport function addWeightField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findWeightField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'weight', displayName: 'Weight', ...info },\n type: 'number',\n })\n return prop\n}\n\n/**\n * Adds an images field to the specified entity for multiple image URLs.\n * If an images field already exists, it returns the existing field.\n * Otherwise, it creates a new images field with ImageURL semantic.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'images'\n * - info.displayName: 'Images'\n * - multiple: true\n *\n * @param entity The entity to which the images field will be added.\n * @param info Additional information about the field.\n * @returns The created images field.\n */\nexport function addImagesField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findImagesField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'images', displayName: 'Images', ...info },\n type: 'string',\n multiple: true,\n })\n prop.addSemantic({\n id: SemanticType.ImageURL,\n })\n return prop\n}\n\n/**\n * Adds a status field with custom enum values to the specified entity.\n * This is not a regular enum field, it should represent a record status.\n * If a status field already exists, it returns the existing field.\n * Otherwise, it creates a new status field with provided enum values.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'status'\n * - info.displayName: 'Status'\n * - required: true\n * - schema.enum: provided enum values\n * - schema.defaultValue: first enum value\n *\n * @param entity The entity to which the status field will be added.\n * @param enumValues Array of status values.\n * @param info Additional information about the field.\n * @returns The created status field.\n */\nexport function addCustomStatusField(\n entity: DomainEntity,\n enumValues: string[],\n info: Partial<ThingSchema> = {}\n): DomainProperty {\n const existing = findStatusField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'status', displayName: 'Status', ...info },\n type: 'string',\n required: true,\n schema: {\n enum: enumValues,\n defaultValue: {\n type: 'literal',\n value: enumValues[0],\n },\n },\n })\n prop.addSemantic(createStatusSemantic())\n return prop\n}\n\n/**\n * Adds a boolean field to the specified entity.\n * If the field already exists, it returns the existing field.\n * Otherwise, it creates a new boolean field with default value.\n *\n * Set properties:\n * - type: 'boolean'\n * - required: true\n * - schema.defaultValue: provided default or 'false'\n *\n * @param entity The entity to which the boolean field will be added.\n * @param fieldName Name of the boolean field.\n * @param defaultValue Default boolean value.\n * @param info Additional information about the field.\n * @returns The created boolean field.\n */\nexport function addBooleanField(\n entity: DomainEntity,\n fieldName: string,\n defaultValue = 'false',\n info: Partial<ThingSchema> = {}\n): DomainProperty {\n const existing = findBooleanField(entity, fieldName, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: fieldName, ...info },\n type: 'boolean',\n required: true,\n schema: {\n defaultValue: {\n type: 'literal',\n value: defaultValue,\n },\n },\n })\n return prop\n}\n\n/**\n * Adds a session ID field to the specified entity.\n * If a session ID field already exists, it returns the existing field.\n * Otherwise, it creates a new session ID field.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'sessionId'\n * - info.displayName: 'Session ID'\n *\n * @param entity The entity to which the session ID field will be added.\n * @param info Additional information about the field.\n * @returns The created session ID field.\n */\nexport function addSessionIdField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findSessionIdField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'sessionId', displayName: 'Session ID', ...info },\n type: 'string',\n })\n return prop\n}\n\n/**\n * Adds an expiration datetime field to the specified entity.\n * If an expiration field already exists, it returns the existing field.\n * Otherwise, it creates a new expiration field.\n *\n * Set properties:\n * - type: 'datetime'\n * - info.name: 'expiresAt'\n * - info.displayName: 'Expires At'\n *\n * @param entity The entity to which the expiration field will be added.\n * @param info Additional information about the field.\n * @returns The created expiration field.\n */\nexport function addExpiresAtField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findExpiresAtField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'expiresAt', displayName: 'Expires At', ...info },\n type: 'datetime',\n })\n return prop\n}\n\n/**\n * Adds a unit price field to the specified entity with currency semantic.\n * If a unit price field already exists, it returns the existing field.\n * Otherwise, it creates a new unit price field with proper currency handling.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'unitPrice'\n * - info.displayName: 'Unit Price'\n * - required: true\n *\n * @param entity The entity to which the unit price field will be added.\n * @param info Additional information about the field.\n * @returns The created unit price field.\n */\nexport function addUnitPriceField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findUnitPriceField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'unitPrice', displayName: 'Unit Price', ...info },\n type: 'number',\n required: true,\n })\n prop.addSemantic({ ...CURRENCY_PRESETS.USD_CENTS })\n return prop\n}\n\n/**\n * Adds a currency amount field (subtotal, tax, shipping, etc.).\n */\nexport function addCurrencyAmountField(\n entity: DomainEntity,\n fieldName: string,\n displayName: string,\n info: Partial<ThingSchema> = {}\n): DomainProperty {\n const prop = entity.addProperty({\n info: {\n name: fieldName,\n displayName,\n ...info,\n },\n type: 'number',\n required: true,\n })\n prop.addSemantic({ ...CURRENCY_PRESETS.USD_CENTS })\n return prop\n}\n\n/**\n * Finds a field in the given entity that matches the specified predicate.\n * @param entity The entity to search within.\n * @param predicate A function that defines the search criteria.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found field property or undefined.\n */\nfunction findPropertyField(\n entity: DomainEntity,\n predicate: (property: DomainProperty) => boolean,\n direct = false\n): DomainProperty | undefined {\n for (const property of entity.properties) {\n if (predicate(property)) {\n return property\n }\n }\n if (direct) {\n return undefined\n }\n for (const parent of entity.listParents()) {\n // we can't call a recursive function here because it would scan vertically through the hierarchy\n // and not horizontally through all parents. We need to check each **direct** parent separately,\n // and then move up.\n for (const property of parent.properties) {\n if (predicate(property)) {\n return property\n }\n }\n }\n return undefined\n}\n\n/**\n * Finds a field in the given entity that matches the specified predicate.\n * @param entity The entity to search within.\n * @param predicate A function that defines the search criteria.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found field association or undefined.\n */\nfunction findAssociationField(\n entity: DomainEntity,\n predicate: (property: DomainAssociation) => boolean,\n direct = false\n): DomainAssociation | undefined {\n for (const assoc of entity.associations) {\n if (predicate(assoc)) {\n return assoc\n }\n }\n if (direct) {\n return undefined\n }\n for (const parent of entity.listParents()) {\n // we can't call a recursive function here because it would scan vertically through the hierarchy\n // and not horizontally through all parents. We need to check each **direct** parent separately,\n // and then move up.\n for (const assoc of parent.associations) {\n if (predicate(assoc)) {\n return assoc\n }\n }\n }\n return undefined\n}\n\n/**\n * Searches for the ID field in the given entity.\n * @param entity The entity to search for the ID field.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found ID field property or undefined.\n */\nfunction findIdField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n if (!direct) {\n // Find the primary key property in the entity, which can be inherited or defined on the entity itself.\n return entity.primaryKey()\n }\n for (const property of entity.properties) {\n if (property.primary) {\n return property\n }\n }\n}\n\n/**\n * Searches for the email field in the given entity.\n * @param entity The entity to search for the email field.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found email field property or undefined.\n */\nfunction findEmailField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Email), direct)\n}\n\n/**\n * Searches for the password field in the given entity.\n * @param entity The entity to search for the password field.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found password field property or undefined.\n */\nfunction findPasswordField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Password), direct)\n}\n\nfunction findVersionField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.Version)\n },\n direct\n )\n}\n\nfunction findNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Title), direct)\n}\n\nfunction findDisplayNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Name), direct)\n}\n\nfunction findDescriptionField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Description), direct)\n}\n\nfunction findStatusField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Status), direct)\n}\n\nfunction findOwnerField(entity: DomainEntity, direct = false): DomainAssociation | undefined {\n return findAssociationField(\n entity,\n (association) =>\n association.hasSemantic(SemanticType.ResourceOwnerIdentifier) &&\n ['owner', 'author'].includes(association.info.name || ''),\n direct\n )\n}\n\n// function findCreatedByField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n// return findField(entity, (property) => property.hasSemantic(SemanticType.CreatedTimestamp), direct)\n// }\n\nfunction findUpdatedByField(entity: DomainEntity, direct = false): DomainAssociation | undefined {\n return findAssociationField(\n entity,\n (association) =>\n association.hasSemantic(SemanticType.ResourceOwnerIdentifier) &&\n ['updated_by', 'updatedBy'].includes(association.info.name || ''),\n direct\n )\n}\n\nfunction findCreatedAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.CreatedTimestamp)\n },\n direct\n )\n}\n\nfunction findUpdatedAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.UpdatedTimestamp)\n },\n direct\n )\n}\n\nfunction findDeletedAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.DeletedTimestamp)\n },\n direct\n )\n}\n\nfunction findRoleField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.UserRole), direct)\n}\n\nfunction findIsDeletedField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.DeletedFlag), direct)\n}\n\nexport function addRecommendedFields(entity: DomainEntity): DomainElement[] {\n const fields: DomainElement[] = []\n if (!findIdField(entity)) {\n fields.push(addIdField(entity))\n }\n // The version field is not always recommended, so we don't add it by default.\n // if (!findVersionField(entity)) {\n // fields.push(addVersionField(entity))\n // }\n if (!findCreatedAtField(entity)) {\n fields.push(addCreatedAtField(entity))\n }\n // if (!findCreatedByField(entity)) {\n // fields.push(addCreatedByField(entity))\n // }\n if (!findUpdatedAtField(entity)) {\n fields.push(addUpdatedAtField(entity))\n }\n if (!findUpdatedByField(entity)) {\n fields.push(addUpdatedByField(entity))\n }\n if (!findDeletedAtField(entity)) {\n fields.push(addDeletedAtField(entity))\n }\n if (!findIsDeletedField(entity)) {\n fields.push(addIsDeletedField(entity))\n }\n return fields\n}\n\nfunction findFirstNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => ['first_name', 'firstName'].includes(property.info.name || ''), direct)\n}\n\nfunction findLastNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => ['last_name', 'lastName'].includes(property.info.name || ''), direct)\n}\n\n// Avatar URL has the `SemanticType.ImageURL` semantic, but it can be used for any image URL.\n// It is not a specific semantic, but it is a common field in many entities.\nfunction findAvatarUrlField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => ['avatar_url', 'avatarUrl'].includes(property.info.name || ''), direct)\n}\n\nfunction findPhoneField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Phone), direct)\n}\n\nfunction findPublicUniqueNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.PublicUniqueName), direct)\n}\n\nfunction findSkuField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.SKU), direct)\n}\n\nfunction findPriceField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) =>\n ['price', 'unitPrice', 'totalPrice'].includes(property.info.name || '') &&\n property.hasSemantic(SemanticType.Currency),\n direct\n )\n}\n\nfunction findQuantityField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => ['quantity', 'stock', 'amount'].includes(property.info.name || '') && property.type === 'number',\n direct\n )\n}\n\nfunction findWeightField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.info.name === 'weight' && property.type === 'number', direct)\n}\n\nfunction findImagesField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === 'images' && property.hasSemantic(SemanticType.ImageURL),\n direct\n )\n}\n\nfunction findBooleanField(entity: DomainEntity, fieldName: string, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === fieldName && property.type === 'boolean',\n direct\n )\n}\n\nfunction findSessionIdField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.info.name === 'sessionId', direct)\n}\n\nfunction findUnitPriceField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === 'unitPrice' && property.hasSemantic(SemanticType.Currency),\n direct\n )\n}\n\nfunction findExpiresAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === 'expiresAt' && property.type === 'datetime',\n direct\n )\n}\n\nexport function addStreetAddressField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findStreetAddressField(entity, true)\n if (existing) return existing\n const prop = entity.addProperty({\n info: { name: 'street_address', displayName: 'Street Address', ...info },\n type: 'string',\n required: true,\n })\n prop.addSemantic({ id: SemanticType.StreetAddress })\n return prop\n}\n\nfunction findStreetAddressField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.StreetAddress), direct)\n}\n\nexport function addStreetAddressSupplementalField(\n entity: DomainEntity,\n info: Partial<ThingSchema> = {}\n): DomainProperty {\n // we do not look for duplicates here, because the address can have multiple supplements (like line2, line3, etc.)\n let latest = 0\n for (const prop of entity.properties) {\n if (prop.hasSemantic(SemanticType.StreetAddressSupplemental)) {\n const match = prop.info.name?.match(/street_address_(\\d+)/)\n if (match) {\n const num = parseInt(match[1], 10)\n if (num > latest) latest = num\n }\n }\n }\n const prop = entity.addProperty({\n info: { name: `street_address_${latest + 1}`, displayName: `Street Address ${latest + 1}`, ...info },\n type: 'string',\n required: false,\n })\n prop.addSemantic({ id: SemanticType.StreetAddressSupplemental })\n return prop\n}\n\nexport function addCityField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findCityField(entity, true)\n if (existing) return existing\n const prop = entity.addProperty({\n info: { name: 'city', displayName: 'City', ...info },\n type: 'string',\n required: true,\n index: true,\n })\n prop.addSemantic({ id: SemanticType.City })\n return prop\n}\n\nfunction findCityField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.City), direct)\n}\n\nexport function addPostalCodeField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findPostalCodeField(entity, true)\n if (existing) return existing\n const prop = entity.addProperty({\n info: { name: 'postal_code', displayName: 'Postal Code', ...info },\n type: 'string',\n required: true,\n index: true,\n })\n prop.addSemantic(createPostalCodeSemantic(DEFAULT_POSTAL_CODE_CONFIG))\n return prop\n}\n\nfunction findPostalCodeField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.PostalCode), direct)\n}\n\nexport function addCountryField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findCountryField(entity, true)\n if (existing) return existing\n const prop = entity.addProperty({\n info: { name: 'country', displayName: 'Country', ...info },\n type: 'string',\n required: true,\n index: true,\n })\n prop.addSemantic(createCountrySemantic(DEFAULT_COUNTRY_CONFIG))\n return prop\n}\n\nfunction findCountryField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Country), direct)\n}\n\nexport function addRegionField(entity: DomainEntity, info: Partial<ThingSchema> = {}): DomainProperty {\n const existing = findRegionField(entity, true)\n if (existing) return existing\n const prop = entity.addProperty({\n info: { name: 'region', displayName: 'Region', ...info },\n type: 'string',\n index: true,\n })\n prop.addSemantic({ id: SemanticType.Region })\n return prop\n}\n\nfunction findRegionField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Region), direct)\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DeletionSchema } from './store/Deletion.js';
|
|
2
2
|
import { AiMessageKind } from './kinds.js';
|
|
3
3
|
import type { AiDomainDelta } from '../modeling/ai/types.js';
|
|
4
4
|
export type AiMessageRole = 'user' | 'model';
|
|
@@ -42,7 +42,7 @@ export interface AiMessageSchemaBase {
|
|
|
42
42
|
* The information about the delete information.
|
|
43
43
|
* Always set when the `deleted` is true.
|
|
44
44
|
*/
|
|
45
|
-
deletedInfo?:
|
|
45
|
+
deletedInfo?: DeletionSchema;
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* The schema for a user message.
|
|
@@ -120,7 +120,7 @@ export declare abstract class AiMessageBase<T extends AiMessageSchemaBase = AiMe
|
|
|
120
120
|
session: string;
|
|
121
121
|
text: string;
|
|
122
122
|
deleted: boolean;
|
|
123
|
-
deletedInfo?:
|
|
123
|
+
deletedInfo?: DeletionSchema;
|
|
124
124
|
protected static createBaseSchema(input: Partial<AiMessageSchemaBase>): Omit<AiMessageSchemaBase, 'role'>;
|
|
125
125
|
constructor(input: Partial<T> | undefined, role: T['role']);
|
|
126
126
|
toJSON(): T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiMessage.d.ts","sourceRoot":"","sources":["../../../src/models/AiMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"AiMessage.d.ts","sourceRoot":"","sources":["../../../src/models/AiMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAI5D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,CAAA;AAC5C,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,CAAA;AAE5E;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,OAAO,aAAa,CAAA;IACnC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,IAAI,EAAE,aAAa,CAAA;IACnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,cAAc,CAAA;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,KAAK,EAAE,UAAU,CAAA;IACjB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,WAAW,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AAC;YACP,aAAa;QACf,CAAC;IACH,CAAC;CAgBF;AAED;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,cAA6B;IACzE;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,OAAe;QAChC,OAAO,IAAI,wBAAwB,CAAC;YAClC,OAAO;YACP,KAAK,EAAE,SAAS;SACjB,CAAC,CAAA;IACJ,CAAC;IAEQ,cAAc,CAAC,KAAoB;QAC1C,OAAO,eAAe,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IACzC,CAAC;CACF","sourcesContent":["import type { IDeletion } from './store/Deletion.js'\nimport { AiMessageKind } from './kinds.js'\nimport { nanoid } from '../nanoid.js'\nimport type { AiDomainDelta } from '../modeling/ai/types.js'\nimport { DataDomainDelta } from '../modeling/ai/DataDomainDelta.js'\nimport { detectReasoning } from '../modeling/ai/message_parser.js'\n\nexport type AiMessageRole = 'user' | 'model'\nexport type AiMessageState = 'loading' | 'complete' | 'error' | 'terminated'\n\n/**\n * The base interface representing a single message in the domain manipulation chat history.\n * It tracks metadata like timestamps, the associated session, and the raw text content.\n * See `AiUserMessage` and `AiModelMessage` for specific role implementations.\n */\nexport interface AiMessageSchemaBase {\n readonly kind: typeof AiMessageKind\n /**\n * The datastore key of the message.\n */\n key: string\n /**\n * The role of the message.\n */\n role: AiMessageRole\n /**\n * The timestamp of when the message was created.\n */\n createdAt: number\n /**\n * The timestamp of when the message was last updated.\n */\n updatedAt: number\n /**\n * The datastore key of the session.\n */\n session: string\n /**\n * The text of the message.\n */\n text: string\n /**\n * Whether the message is deleted.\n */\n deleted?: boolean\n /**\n * The information about the delete information.\n * Always set when the `deleted` is true.\n */\n deletedInfo?: IDeletion\n}\n\n/**\n * The schema for a user message.\n */\nexport interface AiUserMessageSchema extends AiMessageSchemaBase {\n /**\n * The role of the message.\n */\n role: 'user'\n /**\n * The state of the user message.\n * Can only be `complete`.\n */\n state: 'complete'\n /**\n * The user utterance.\n * Note, the actual message sent to the LLM may be different from the utterance\n * as it has additional instructions and the domain context. However, we are not storing\n * the full message in the datastore, only the utterance.\n */\n text: string\n}\n\n/**\n * The schema for a model message.\n */\nexport interface AiModelMessageSchema extends AiMessageSchemaBase {\n /**\n * The role of the message.\n */\n role: 'model'\n /**\n * The full text of the message returned by the LLM.\n * It is most likely a structured message that needs to be parsed\n * to the corresponding message object.\n */\n text: string\n /**\n * The state of the message.\n * - loading: the message is being generated\n * - complete: the message is complete\n * - error: the message generation failed\n * - terminated: the message generation was terminated by the user\n */\n state: AiMessageState\n /**\n * Whether the message has been applied.\n */\n applied?: boolean\n /**\n * The thoughts of the message.\n */\n thoughts?: string\n}\n\n/**\n * A union type representing any valid chat message in the AI session history.\n */\nexport type AiMessageSchema = AiUserMessageSchema | AiModelMessageSchema\n\n/**\n * The base class for all AI messages.\n * It provides common functionality for all message types.\n */\nexport abstract class AiMessageBase<\n T extends AiMessageSchemaBase = AiMessageSchemaBase,\n> implements AiMessageSchemaBase {\n /**\n * The kind of the schema.\n */\n static get Kind(): typeof AiMessageKind {\n return AiMessageKind\n }\n\n /**\n * The kind of the schema.\n */\n get kind(): typeof AiMessageKind {\n return AiMessageKind\n }\n\n key: string\n role: T['role']\n createdAt: number\n updatedAt: number\n session: string\n text: string\n deleted: boolean\n deletedInfo?: IDeletion\n\n protected static createBaseSchema(input: Partial<AiMessageSchemaBase>): Omit<AiMessageSchemaBase, 'role'> {\n const { key = nanoid(), session, text = '', createdAt = 0, updatedAt = 0 } = input\n if (!session) {\n throw new Error('Session is required to create an AiMessage.')\n }\n return {\n key,\n kind: AiMessageKind,\n session,\n text,\n createdAt,\n updatedAt,\n }\n }\n\n constructor(input: Partial<T> = {}, role: T['role']) {\n const base = AiMessageBase.createBaseSchema(input)\n this.key = base.key\n this.role = role\n this.session = base.session\n this.text = base.text\n this.createdAt = base.createdAt\n this.updatedAt = base.updatedAt\n this.deleted = input.deleted || false\n this.deletedInfo = input.deletedInfo\n }\n\n toJSON(): T {\n const result = {\n kind: this.kind,\n key: this.key,\n role: this.role,\n session: this.session,\n text: this.text,\n createdAt: this.createdAt,\n updatedAt: this.updatedAt,\n }\n if (this.deleted && this.deletedInfo) {\n Object.assign(result, {\n deleted: this.deleted,\n deletedInfo: { ...this.deletedInfo },\n })\n }\n return result as unknown as T\n }\n}\n\nexport class AiUserMessage extends AiMessageBase<AiUserMessageSchema> implements AiUserMessageSchema {\n state: 'complete'\n\n static createSchema(input: Partial<AiUserMessageSchema>): AiUserMessageSchema {\n const base = AiMessageBase.createBaseSchema(input)\n return {\n ...base,\n role: 'user',\n state: 'complete',\n }\n }\n\n constructor(input: Partial<AiUserMessageSchema> = {}) {\n super(input, 'user')\n this.state = 'complete'\n }\n\n override toJSON(): AiUserMessageSchema {\n return {\n ...super.toJSON(),\n state: this.state,\n }\n }\n}\n\n/**\n * Model messages have the `text` that most likely is a structured JSON\n * with the `delta` and `reasoning` properties. When an `AiModelMessage` is instantiated,\n * it will try to parse the `text` into the `delta` and `reasoning` properties, leaving the\n * `text` property unchanged.\n *\n * The delta object will be different for different models and different use cases.\n * It is up to the model to define the delta object. However, the delta object should\n * be normalized by each child class.\n *\n * @template D The type of the delta.\n */\nexport abstract class AiModelMessage<D = unknown>\n extends AiMessageBase<AiModelMessageSchema>\n implements AiModelMessageSchema\n{\n state: AiMessageState\n applied?: boolean\n thoughts: string\n\n /**\n * The extracted delta from the message.\n */\n delta?: D\n\n /**\n * The extracted reasoning from the message.\n * Format in markdown.\n */\n reasoning?: string\n\n #reasoningEnded = false\n\n static createSchema(input: Partial<AiModelMessageSchema>): AiModelMessageSchema {\n const base = AiMessageBase.createBaseSchema(input)\n return {\n ...base,\n role: 'model',\n state: input.state || 'loading',\n applied: input.applied,\n thoughts: input.thoughts || '',\n }\n }\n\n constructor(input: Partial<AiModelMessageSchema> = {}) {\n super(input, 'model')\n this.state = input.state || 'loading'\n this.applied = input.applied\n this.thoughts = input.thoughts || ''\n this.processMessageSafe()\n }\n\n override toJSON(): AiModelMessageSchema {\n const result: AiModelMessageSchema = {\n ...super.toJSON(),\n state: this.state,\n thoughts: this.thoughts,\n }\n if (this.applied !== undefined) {\n result.applied = this.applied\n }\n return result\n }\n\n /**\n * Adds a thought to the message. Useful when streaming.\n * @param thought The thought to add.\n */\n addThought(thought?: string): void {\n if (!thought) {\n return\n }\n this.thoughts += thought\n }\n\n /**\n * Adds a text chunk to the message. Useful when streaming.\n *\n * Note, this function progressively detects the reasoning on each chunk.\n * @param text The text chunk to add.\n */\n addText(text?: string): void {\n if (!text) {\n return\n }\n this.text += text\n if (this.#reasoningEnded) {\n return\n }\n const before = this.reasoning\n const after = detectReasoning(this.text)\n if (after && after === before) {\n this.#reasoningEnded = true\n }\n this.reasoning = after\n }\n\n /**\n * Processes the message.\n * If the message is not valid JSON, it will throw an error.\n * It sets the delta and reasoning fields, if found in the message.\n */\n processMessage(): void {\n const { text } = this\n if (!text) {\n return\n }\n const parsed = JSON.parse(text)\n if (parsed.delta) {\n this.delta = this.normalizeDelta(parsed.delta)\n }\n if (parsed.reasoning) {\n this.reasoning = parsed.reasoning\n }\n }\n\n /**\n * Processes the message safely.\n * If the message is not valid JSON, it will be ignored.\n */\n processMessageSafe(): void {\n try {\n this.processMessage()\n } catch {\n // do nothing\n }\n }\n\n /**\n * Normalizes the delta to the final shape required by the system.\n *\n * Probabilistic models can produce deltas that are not always what the author expected.\n * For example, the DataDomain delta has `modifiedEntities` property that sometimes is\n * populated multiple times by the same entity. This should be normalized to a single\n * operation so that the UI can correctly render the changes, without an expensive lookup\n * operations. The author of the message model should predict these situations and handle\n * them accordingly.\n *\n * @param delta The delta to normalize.\n * @returns The normalized delta.\n */\n abstract normalizeDelta(delta: D): D\n}\n\n/**\n * A model message that contains a delta of type `AiDomainDelta`.\n */\nexport class AiModelDataDomainMessage extends AiModelMessage<AiDomainDelta> {\n /**\n * Creates an empty model message. Useful when initializing LLM flow.\n * @param session The session key.\n * @returns An empty model message.\n */\n static createEmpty(session: string): AiModelDataDomainMessage {\n return new AiModelDataDomainMessage({\n session,\n state: 'loading',\n })\n }\n\n override normalizeDelta(delta: AiDomainDelta): AiDomainDelta {\n return DataDomainDelta.normalize(delta)\n }\n}\n\n/**\n * A union type representing any valid chat message in the AI session history.\n */\nexport type AiMessage = AiUserMessage | AiModelMessage | AiModelDataDomainMessage\n"]}
|
|
1
|
+
{"version":3,"file":"AiMessage.js","sourceRoot":"","sources":["../../../src/models/AiMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AA0GlE;;;GAGG;AACH,MAAM,OAAgB,aAAa;IAGjC;;OAEG;IACH,MAAM,KAAK,IAAI;QACb,OAAO,aAAa,CAAA;IACtB,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,aAAa,CAAA;IACtB,CAAC;IAED,GAAG,CAAQ;IACX,IAAI,CAAW;IACf,SAAS,CAAQ;IACjB,SAAS,CAAQ;IACjB,OAAO,CAAQ;IACf,IAAI,CAAQ;IACZ,OAAO,CAAS;IAChB,WAAW,CAAiB;IAElB,MAAM,CAAC,gBAAgB,CAAC,KAAmC;QACnE,MAAM,EAAE,GAAG,GAAG,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,CAAC,EAAE,GAAG,KAAK,CAAA;QAClF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;QAChE,CAAC;QACD,OAAO;YACL,GAAG;YACH,IAAI,EAAE,aAAa;YACnB,OAAO;YACP,IAAI;YACJ,SAAS;YACT,SAAS;SACV,CAAA;IACH,CAAC;IAED,YAAY,QAAoB,EAAE,EAAE,IAAe;QAC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C,CAAA;QAChD,CAAC;QACD,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACrB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAA;QACnC,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,kBAAkB;QAChB,IAAI,CAAC;YACH,IAAI,CAAC,cAAc,EAAE,CAAA;QACvB,CAAC;QAAC,MAAM,CAAC;YACP,aAAa;QACf,CAAC;IACH,CAAC;CAgBF;AAED;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,cAA6B;IACzE;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,OAAe;QAChC,OAAO,IAAI,wBAAwB,CAAC;YAClC,OAAO;YACP,KAAK,EAAE,SAAS;SACjB,CAAC,CAAA;IACJ,CAAC;IAEQ,cAAc,CAAC,KAAoB;QAC1C,OAAO,eAAe,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IACzC,CAAC;CACF","sourcesContent":["import type { DeletionSchema } from './store/Deletion.js'\nimport { AiMessageKind } from './kinds.js'\nimport { nanoid } from '../nanoid.js'\nimport type { AiDomainDelta } from '../modeling/ai/types.js'\nimport { DataDomainDelta } from '../modeling/ai/DataDomainDelta.js'\nimport { detectReasoning } from '../modeling/ai/message_parser.js'\n\nexport type AiMessageRole = 'user' | 'model'\nexport type AiMessageState = 'loading' | 'complete' | 'error' | 'terminated'\n\n/**\n * The base interface representing a single message in the domain manipulation chat history.\n * It tracks metadata like timestamps, the associated session, and the raw text content.\n * See `AiUserMessage` and `AiModelMessage` for specific role implementations.\n */\nexport interface AiMessageSchemaBase {\n readonly kind: typeof AiMessageKind\n /**\n * The datastore key of the message.\n */\n key: string\n /**\n * The role of the message.\n */\n role: AiMessageRole\n /**\n * The timestamp of when the message was created.\n */\n createdAt: number\n /**\n * The timestamp of when the message was last updated.\n */\n updatedAt: number\n /**\n * The datastore key of the session.\n */\n session: string\n /**\n * The text of the message.\n */\n text: string\n /**\n * Whether the message is deleted.\n */\n deleted?: boolean\n /**\n * The information about the delete information.\n * Always set when the `deleted` is true.\n */\n deletedInfo?: DeletionSchema\n}\n\n/**\n * The schema for a user message.\n */\nexport interface AiUserMessageSchema extends AiMessageSchemaBase {\n /**\n * The role of the message.\n */\n role: 'user'\n /**\n * The state of the user message.\n * Can only be `complete`.\n */\n state: 'complete'\n /**\n * The user utterance.\n * Note, the actual message sent to the LLM may be different from the utterance\n * as it has additional instructions and the domain context. However, we are not storing\n * the full message in the datastore, only the utterance.\n */\n text: string\n}\n\n/**\n * The schema for a model message.\n */\nexport interface AiModelMessageSchema extends AiMessageSchemaBase {\n /**\n * The role of the message.\n */\n role: 'model'\n /**\n * The full text of the message returned by the LLM.\n * It is most likely a structured message that needs to be parsed\n * to the corresponding message object.\n */\n text: string\n /**\n * The state of the message.\n * - loading: the message is being generated\n * - complete: the message is complete\n * - error: the message generation failed\n * - terminated: the message generation was terminated by the user\n */\n state: AiMessageState\n /**\n * Whether the message has been applied.\n */\n applied?: boolean\n /**\n * The thoughts of the message.\n */\n thoughts?: string\n}\n\n/**\n * A union type representing any valid chat message in the AI session history.\n */\nexport type AiMessageSchema = AiUserMessageSchema | AiModelMessageSchema\n\n/**\n * The base class for all AI messages.\n * It provides common functionality for all message types.\n */\nexport abstract class AiMessageBase<\n T extends AiMessageSchemaBase = AiMessageSchemaBase,\n> implements AiMessageSchemaBase {\n /**\n * The kind of the schema.\n */\n static get Kind(): typeof AiMessageKind {\n return AiMessageKind\n }\n\n /**\n * The kind of the schema.\n */\n get kind(): typeof AiMessageKind {\n return AiMessageKind\n }\n\n key: string\n role: T['role']\n createdAt: number\n updatedAt: number\n session: string\n text: string\n deleted: boolean\n deletedInfo?: DeletionSchema\n\n protected static createBaseSchema(input: Partial<AiMessageSchemaBase>): Omit<AiMessageSchemaBase, 'role'> {\n const { key = nanoid(), session, text = '', createdAt = 0, updatedAt = 0 } = input\n if (!session) {\n throw new Error('Session is required to create an AiMessage.')\n }\n return {\n key,\n kind: AiMessageKind,\n session,\n text,\n createdAt,\n updatedAt,\n }\n }\n\n constructor(input: Partial<T> = {}, role: T['role']) {\n const base = AiMessageBase.createBaseSchema(input)\n this.key = base.key\n this.role = role\n this.session = base.session\n this.text = base.text\n this.createdAt = base.createdAt\n this.updatedAt = base.updatedAt\n this.deleted = input.deleted || false\n this.deletedInfo = input.deletedInfo\n }\n\n toJSON(): T {\n const result = {\n kind: this.kind,\n key: this.key,\n role: this.role,\n session: this.session,\n text: this.text,\n createdAt: this.createdAt,\n updatedAt: this.updatedAt,\n }\n if (this.deleted && this.deletedInfo) {\n Object.assign(result, {\n deleted: this.deleted,\n deletedInfo: { ...this.deletedInfo },\n })\n }\n return result as unknown as T\n }\n}\n\nexport class AiUserMessage extends AiMessageBase<AiUserMessageSchema> implements AiUserMessageSchema {\n state: 'complete'\n\n static createSchema(input: Partial<AiUserMessageSchema>): AiUserMessageSchema {\n const base = AiMessageBase.createBaseSchema(input)\n return {\n ...base,\n role: 'user',\n state: 'complete',\n }\n }\n\n constructor(input: Partial<AiUserMessageSchema> = {}) {\n super(input, 'user')\n this.state = 'complete'\n }\n\n override toJSON(): AiUserMessageSchema {\n return {\n ...super.toJSON(),\n state: this.state,\n }\n }\n}\n\n/**\n * Model messages have the `text` that most likely is a structured JSON\n * with the `delta` and `reasoning` properties. When an `AiModelMessage` is instantiated,\n * it will try to parse the `text` into the `delta` and `reasoning` properties, leaving the\n * `text` property unchanged.\n *\n * The delta object will be different for different models and different use cases.\n * It is up to the model to define the delta object. However, the delta object should\n * be normalized by each child class.\n *\n * @template D The type of the delta.\n */\nexport abstract class AiModelMessage<D = unknown>\n extends AiMessageBase<AiModelMessageSchema>\n implements AiModelMessageSchema\n{\n state: AiMessageState\n applied?: boolean\n thoughts: string\n\n /**\n * The extracted delta from the message.\n */\n delta?: D\n\n /**\n * The extracted reasoning from the message.\n * Format in markdown.\n */\n reasoning?: string\n\n #reasoningEnded = false\n\n static createSchema(input: Partial<AiModelMessageSchema>): AiModelMessageSchema {\n const base = AiMessageBase.createBaseSchema(input)\n return {\n ...base,\n role: 'model',\n state: input.state || 'loading',\n applied: input.applied,\n thoughts: input.thoughts || '',\n }\n }\n\n constructor(input: Partial<AiModelMessageSchema> = {}) {\n super(input, 'model')\n this.state = input.state || 'loading'\n this.applied = input.applied\n this.thoughts = input.thoughts || ''\n this.processMessageSafe()\n }\n\n override toJSON(): AiModelMessageSchema {\n const result: AiModelMessageSchema = {\n ...super.toJSON(),\n state: this.state,\n thoughts: this.thoughts,\n }\n if (this.applied !== undefined) {\n result.applied = this.applied\n }\n return result\n }\n\n /**\n * Adds a thought to the message. Useful when streaming.\n * @param thought The thought to add.\n */\n addThought(thought?: string): void {\n if (!thought) {\n return\n }\n this.thoughts += thought\n }\n\n /**\n * Adds a text chunk to the message. Useful when streaming.\n *\n * Note, this function progressively detects the reasoning on each chunk.\n * @param text The text chunk to add.\n */\n addText(text?: string): void {\n if (!text) {\n return\n }\n this.text += text\n if (this.#reasoningEnded) {\n return\n }\n const before = this.reasoning\n const after = detectReasoning(this.text)\n if (after && after === before) {\n this.#reasoningEnded = true\n }\n this.reasoning = after\n }\n\n /**\n * Processes the message.\n * If the message is not valid JSON, it will throw an error.\n * It sets the delta and reasoning fields, if found in the message.\n */\n processMessage(): void {\n const { text } = this\n if (!text) {\n return\n }\n const parsed = JSON.parse(text)\n if (parsed.delta) {\n this.delta = this.normalizeDelta(parsed.delta)\n }\n if (parsed.reasoning) {\n this.reasoning = parsed.reasoning\n }\n }\n\n /**\n * Processes the message safely.\n * If the message is not valid JSON, it will be ignored.\n */\n processMessageSafe(): void {\n try {\n this.processMessage()\n } catch {\n // do nothing\n }\n }\n\n /**\n * Normalizes the delta to the final shape required by the system.\n *\n * Probabilistic models can produce deltas that are not always what the author expected.\n * For example, the DataDomain delta has `modifiedEntities` property that sometimes is\n * populated multiple times by the same entity. This should be normalized to a single\n * operation so that the UI can correctly render the changes, without an expensive lookup\n * operations. The author of the message model should predict these situations and handle\n * them accordingly.\n *\n * @param delta The delta to normalize.\n * @returns The normalized delta.\n */\n abstract normalizeDelta(delta: D): D\n}\n\n/**\n * A model message that contains a delta of type `AiDomainDelta`.\n */\nexport class AiModelDataDomainMessage extends AiModelMessage<AiDomainDelta> {\n /**\n * Creates an empty model message. Useful when initializing LLM flow.\n * @param session The session key.\n * @returns An empty model message.\n */\n static createEmpty(session: string): AiModelDataDomainMessage {\n return new AiModelDataDomainMessage({\n session,\n state: 'loading',\n })\n }\n\n override normalizeDelta(delta: AiDomainDelta): AiDomainDelta {\n return DataDomainDelta.normalize(delta)\n }\n}\n\n/**\n * A union type representing any valid chat message in the AI session history.\n */\nexport type AiMessage = AiUserMessage | AiModelMessage | AiModelDataDomainMessage\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DeletionSchema } from './store/Deletion.js';
|
|
2
2
|
import { AiSessionKind } from './kinds.js';
|
|
3
3
|
import type { AiModelMessage } from './AiMessage.js';
|
|
4
4
|
/**
|
|
@@ -54,7 +54,7 @@ export interface AiSessionSchema {
|
|
|
54
54
|
* The information about the delete information.
|
|
55
55
|
* Always set when the `delete` is true.
|
|
56
56
|
*/
|
|
57
|
-
deletedInfo?:
|
|
57
|
+
deletedInfo?: DeletionSchema;
|
|
58
58
|
/**
|
|
59
59
|
* If the session is related to a file (data domain, API model, etc.), this is the key of the file.
|
|
60
60
|
* It is useful to filter session by specific object.
|
|
@@ -72,7 +72,7 @@ export declare class AiSession implements AiSessionSchema {
|
|
|
72
72
|
createdAt: number;
|
|
73
73
|
updatedAt: number;
|
|
74
74
|
deleted: boolean;
|
|
75
|
-
deletedInfo?:
|
|
75
|
+
deletedInfo?: DeletionSchema;
|
|
76
76
|
fileKey?: string;
|
|
77
77
|
/**
|
|
78
78
|
* Checks if the given value is a valid AiSessionApp.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiSession.d.ts","sourceRoot":"","sources":["../../../src/models/AiSession.ts"],"names":[],"mappings":"AAAA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AAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,cAAc,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,YAAY;IAItD,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe;gBA4BzD,KAAK,GAAE,OAAO,CAAC,eAAe,CAAM;IAchD,MAAM,IAAI,eAAe;IAqBzB;;;;;;OAMG;IACH,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI;CAenE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiSession.js","sourceRoot":"","sources":["../../../src/models/AiSession.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAiErC,MAAM,OAAO,SAAS;IACpB,MAAM,KAAK,IAAI;QACb,OAAO,aAAa,CAAA;IACtB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,aAAa,CAAA;IACtB,CAAC;IAED,GAAG,CAAQ;IACX,GAAG,CAAc;IACjB,KAAK,CAAQ;IACb,MAAM,CAAS;IACf,WAAW,CAAS;IACpB,SAAS,CAAQ;IACjB,SAAS,CAAQ;IACjB,OAAO,CAAS;IAChB,WAAW,
|
|
1
|
+
{"version":3,"file":"AiSession.js","sourceRoot":"","sources":["../../../src/models/AiSession.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAiErC,MAAM,OAAO,SAAS;IACpB,MAAM,KAAK,IAAI;QACb,OAAO,aAAa,CAAA;IACtB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,aAAa,CAAA;IACtB,CAAC;I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,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC/B,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,mBAAmB,CAAC,OAAuB;QAChD,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,IAAI,CAAA;QACb,CAAC;QACD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC5B,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;gBACtB,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;YAClC,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF","sourcesContent":["import type { DeletionSchema } from './store/Deletion.js'\nimport { AiSessionKind } from './kinds.js'\nimport { nanoid } from '../nanoid.js'\nimport type { AiModelMessage } from './AiMessage.js'\n\n/**\n * The application the session is for.\n *\n * - `domain` - The session is for data domain modeling.\n * - `api` - The session is for API modeling.\n * - `general` - The session is for general AI chat.\n */\nexport type AiSessionApp = 'domain' | 'api' | 'general'\n\nexport interface AiSessionSchema {\n /**\n * The kind of the schema\n * This is set by the API and is used to identify the schema.\n * @readonly\n */\n readonly kind: typeof AiSessionKind\n /**\n * The key of the session\n * This is set by the API and is used to identify the session.\n */\n key: string\n /**\n * The application the session is for.\n * Each app must query for its own sessions.\n */\n app: AiSessionApp\n /**\n * The title of the session.\n */\n title: string\n /**\n * Whether the session is pinned.\n */\n pinned: boolean\n /**\n * Whether the user has renamed the session.\n */\n userRenamed: boolean\n /**\n * The creation timestamp of the session.\n */\n createdAt: number\n /**\n * The update timestamp of the session.\n */\n updatedAt: number\n /**\n * Whether the file object is deleted.\n */\n deleted?: boolean\n /**\n * The information about the delete information.\n * Always set when the `delete` is true.\n */\n deletedInfo?: DeletionSchema\n /**\n * If the session is related to a file (data domain, API model, etc.), this is the key of the file.\n * It is useful to filter session by specific object.\n */\n fileKey?: string\n}\n\nexport class AiSession implements AiSessionSchema {\n static get Kind(): typeof AiSessionKind {\n return AiSessionKind\n }\n\n get kind(): typeof AiSessionKind {\n return AiSessionKind\n }\n\n key: string\n app: AiSessionApp\n title: string\n pinned: boolean\n userRenamed: boolean\n createdAt: number\n updatedAt: number\n deleted: boolean\n deletedInfo?: DeletionSchema\n fileKey?: string\n\n /**\n * Checks if the given value is a valid AiSessionApp.\n */\n static isSessionApp(app: unknown): app is AiSessionApp {\n return ['domain', 'api', 'general'].includes(app as string)\n }\n\n static createSchema(input: Partial<AiSessionSchema>): AiSessionSchema {\n const { key = nanoid(), app, title = '', createdAt = 0, updatedAt = 0, pinned = false, userRenamed = false } = input\n if (!app) {\n throw new Error('App is required to create an AiSession schema.')\n }\n if (!AiSession.isSessionApp(app)) {\n throw new Error(`Invalid app: ${app}`)\n }\n const result: AiSessionSchema = {\n key,\n kind: AiSessionKind,\n app,\n title,\n pinned,\n userRenamed,\n createdAt,\n updatedAt,\n }\n if (input.deleted) {\n result.deleted = input.deleted\n result.deletedInfo = input.deletedInfo\n }\n if (input.fileKey) {\n result.fileKey = input.fileKey\n }\n return result\n }\n\n constructor(input: Partial<AiSessionSchema> = {}) {\n const init = AiSession.createSchema(input)\n this.key = init.key\n this.app = init.app\n this.title = init.title\n this.pinned = init.pinned\n this.userRenamed = init.userRenamed\n this.createdAt = init.createdAt\n this.updatedAt = init.updatedAt\n this.deleted = init.deleted || false\n this.deletedInfo = init.deletedInfo\n this.fileKey = init.fileKey\n }\n\n toJSON(): AiSessionSchema {\n const result: AiSessionSchema = {\n kind: this.kind,\n key: this.key,\n app: this.app,\n title: this.title,\n pinned: this.pinned,\n userRenamed: this.userRenamed,\n createdAt: this.createdAt,\n updatedAt: this.updatedAt,\n }\n if (this.deleted && this.deletedInfo) {\n result.deleted = this.deleted\n result.deletedInfo = { ...this.deletedInfo }\n }\n if (this.fileKey) {\n result.fileKey = this.fileKey\n }\n return result\n }\n\n /**\n * Processes the agent response and extracts the session title if available.\n * It looks for a JSON object in the response text and extracts the `sessionTitle`.\n *\n * @param message The agent response.\n * @returns {string | null} The session title if found, otherwise null.\n */\n static extractSessionTitle(message: AiModelMessage): string | null {\n const txt = message.text\n if (!txt) {\n return null\n }\n try {\n const json = JSON.parse(txt)\n if (json.sessionTitle) {\n return String(json.sessionTitle)\n }\n } catch {\n // ignore\n }\n return null\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Certificate, ICertificate } from './ClientCertificate.js';
|
|
2
2
|
import { CertificateFileKind } from './kinds.js';
|
|
3
|
-
import {
|
|
4
|
-
export interface ICertificateFile extends
|
|
3
|
+
import { FileSchema, File } from './store/File.js';
|
|
4
|
+
export interface ICertificateFile extends FileSchema {
|
|
5
5
|
kind: typeof CertificateFileKind;
|
|
6
6
|
}
|
|
7
7
|
export declare class CertificateFile extends File {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CertificateFile.d.ts","sourceRoot":"","sources":["../../../src/models/CertificateFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CertificateFile.d.ts","sourceRoot":"","sources":["../../../src/models/CertificateFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAGlD,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAClD,IAAI,EAAE,OAAO,mBAAmB,CAAA;CACjC;AAED,qBAAa,eAAgB,SAAQ,IAAI;IAC9B,IAAI,SAAsB;IAEnC,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,YAAY,GAAG,WAAW,GAAG,eAAe;IAahF;;OAEG;WACa,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe;gBAI3C,KAAK,CAAC,EAAE,MAAM,GAAG,gBAAgB;IAqBpC,GAAG,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAS1C,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAQpC,MAAM,IAAI,gBAAgB;CAOpC"}
|