UNPKG

@sphereon/ssi-sdk.data-store

Version:

1,318 lines (1,299 loc) • 475 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var index_exports = {}; __export(index_exports, { AbstractEventLoggerStore: () => import_ssi_sdk36.AbstractEventLoggerStore, AuditEventEntity: () => AuditEventEntity, BackgroundAttributesEntity: () => BackgroundAttributesEntity, BaseConfigEntity: () => BaseConfigEntity, BaseContactEntity: () => BaseContactEntity, BaseLocaleBrandingEntity: () => BaseLocaleBrandingEntity, BitstringStatusListEntity: () => BitstringStatusListEntity, BitstringStatusListEntryEntity: () => BitstringStatusListEntryEntity, ConnectionEntity: () => ConnectionEntity, ContactMetadataItemEntity: () => ContactMetadataItemEntity, ContactStore: () => ContactStore, CorrelationIdentifierEntity: () => CorrelationIdentifierEntity, CredentialBrandingEntity: () => CredentialBrandingEntity, CredentialClaimsEntity: () => CredentialClaimsEntity, CredentialLocaleBrandingEntity: () => CredentialLocaleBrandingEntity, DataStoreContactEntities: () => DataStoreContactEntities, DataStoreContactMigrations: () => DataStoreContactMigrations, DataStoreDigitalCredentialEntities: () => DataStoreDigitalCredentialEntities, DataStoreDigitalCredentialMigrations: () => DataStoreDigitalCredentialMigrations, DataStoreEntities: () => DataStoreEntities, DataStoreEntitiesWithVeramo: () => DataStoreEntitiesWithVeramo, DataStoreEventLoggerEntities: () => DataStoreEventLoggerEntities, DataStoreEventLoggerMigrations: () => DataStoreEventLoggerMigrations, DataStoreIssuanceBrandingEntities: () => DataStoreIssuanceBrandingEntities, DataStoreIssuanceBrandingMigrations: () => DataStoreIssuanceBrandingMigrations, DataStoreMachineStateEntities: () => DataStoreMachineStateEntities, DataStoreMachineStateMigrations: () => DataStoreMachineStateMigrations, DataStoreMigrations: () => DataStoreMigrations, DataStoreMigrationsWithVeramo: () => DataStoreMigrationsWithVeramo, DataStoreOid4vcStateEntities: () => DataStoreOid4vcStateEntities, DataStorePresentationDefinitionEntities: () => DataStorePresentationDefinitionEntities, DataStorePresentationDefinitionMigrations: () => DataStorePresentationDefinitionMigrations, DataStoreServiceMigrations: () => DataStoreServiceMigrations, DataStoreStatusListEntities: () => DataStoreStatusListEntities, DataStoreStatusListMigrations: () => DataStoreStatusListMigrations, DcqlQueryItemEntity: () => DcqlQueryItemEntity, DidAuthConfigEntity: () => DidAuthConfigEntity, DigitalCredentialEntity: () => DigitalCredentialEntity, DigitalCredentialStore: () => DigitalCredentialStore, ElectronicAddressEntity: () => ElectronicAddressEntity, EventLoggerStore: () => EventLoggerStore, IdentityEntity: () => IdentityEntity, IdentityMetadataItemEntity: () => IdentityMetadataItemEntity, ImageAttributesEntity: () => ImageAttributesEntity, ImageDimensionsEntity: () => ImageDimensionsEntity, IssuanceBrandingStore: () => IssuanceBrandingStore, IssuerBrandingEntity: () => IssuerBrandingEntity, IssuerLocaleBrandingEntity: () => IssuerLocaleBrandingEntity, MachineStateInfoEntity: () => MachineStateInfoEntity, MachineStateStore: () => MachineStateStore, OAuthStatusListEntity: () => OAuthStatusListEntity, Oid4vcStateEntity: () => Oid4vcStateEntity, OpenIdConfigEntity: () => OpenIdConfigEntity, PDStore: () => PDStore, PartyEntity: () => PartyEntity, PhysicalAddressEntity: () => PhysicalAddressEntity, StatusList2021Entity: () => StatusList2021Entity, StatusListEntity: () => StatusListEntity, StatusListEntryEntity: () => StatusListEntryEntity, StatusListStore: () => StatusListStore, TextAttributesEntity: () => TextAttributesEntity, VeramoDataStoreEntities: () => import_data_store.Entities, VeramoDataStoreMigrations: () => import_data_store.migrations, activityEventEntityFrom: () => activityEventEntityFrom, activityEventFrom: () => activityEventFrom, auditEventEntityFrom: () => auditEventEntityFrom, auditEventFrom: () => auditEventFrom, backgroundAttributesEntityFrom: () => backgroundAttributesEntityFrom, configFrom: () => configFrom, connectionEntityFrom: () => connectionEntityFrom, connectionFrom: () => connectionFrom, contactEntityFrom: () => contactEntityFrom, contactFrom: () => contactFrom, contactMetadataItemEntityFrom: () => contactMetadataItemEntityFrom, correlationIdentifierEntityFrom: () => correlationIdentifierEntityFrom, correlationIdentifierFrom: () => correlationIdentifierFrom, credentialBrandingEntityFrom: () => credentialBrandingEntityFrom, credentialBrandingFrom: () => credentialBrandingFrom, credentialClaimsEntityFrom: () => credentialClaimsEntityFrom, credentialLocaleBrandingEntityFrom: () => credentialLocaleBrandingEntityFrom, credentialLocaleBrandingFromEntity: () => credentialLocaleBrandingFromEntity, dcqlQueryEntityItemFrom: () => dcqlQueryEntityItemFrom, dcqlQueryItemFrom: () => dcqlQueryItemFrom, didAuthConfigEntityFrom: () => didAuthConfigEntityFrom, didAuthConfigFrom: () => didAuthConfigFrom, digitalCredentialFrom: () => digitalCredentialFrom, digitalCredentialsFrom: () => digitalCredentialsFrom, electronicAddressEntityFrom: () => electronicAddressEntityFrom, electronicAddressFrom: () => electronicAddressFrom, identityEntityFrom: () => identityEntityFrom, identityFrom: () => identityFrom, identityMetadataItemEntityFrom: () => identityMetadataItemEntityFrom, imageAttributesEntityFrom: () => imageAttributesEntityFrom, imageDimensionsEntityFrom: () => imageDimensionsEntityFrom, isDidAuthConfig: () => isDidAuthConfig, isHex: () => isHex, isNaturalPerson: () => isNaturalPerson, isOpenIdConfig: () => isOpenIdConfig, isOrganization: () => isOrganization, isPresentationDefinitionEqual: () => isPresentationDefinitionEqual, issuerBrandingEntityFrom: () => issuerBrandingEntityFrom, issuerBrandingFrom: () => issuerBrandingFrom, issuerLocaleBrandingEntityFrom: () => issuerLocaleBrandingEntityFrom, localeBrandingFrom: () => localeBrandingFrom, metadataItemFrom: () => metadataItemFrom, naturalPersonEntityFrom: () => naturalPersonEntityFrom, naturalPersonFrom: () => naturalPersonFrom, nonPersistedDigitalCredentialEntityFromAddArgs: () => nonPersistedDigitalCredentialEntityFromAddArgs, normalizeNullableFields: () => normalizeNullableFields, openIdConfigEntityFrom: () => openIdConfigEntityFrom, openIdConfigFrom: () => openIdConfigFrom, organizationEntityFrom: () => organizationEntityFrom, organizationFrom: () => organizationFrom, parseRawDocument: () => parseRawDocument, partyEntityFrom: () => partyEntityFrom, partyFrom: () => partyFrom, partyRelationshipEntityFrom: () => partyRelationshipEntityFrom, partyRelationshipFrom: () => partyRelationshipFrom, partyTypeEntityFrom: () => partyTypeEntityFrom, partyTypeFrom: () => partyTypeFrom, persistedDigitalCredentialEntityFromStateArgs: () => persistedDigitalCredentialEntityFromStateArgs, persistedDigitalCredentialEntityFromUpdateArgs: () => persistedDigitalCredentialEntityFromUpdateArgs, physicalAddressEntityFrom: () => physicalAddressEntityFrom, physicalAddressFrom: () => physicalAddressFrom, textAttributesEntityFrom: () => textAttributesEntityFrom }); module.exports = __toCommonJS(index_exports); var import_data_store2 = require("@veramo/data-store"); // src/entities/contact/BaseConfigEntity.ts var import_typeorm12 = require("typeorm"); // src/entities/contact/ConnectionEntity.ts var import_ssi_sdk13 = require("@sphereon/ssi-sdk.data-store-types"); var import_typeorm11 = require("typeorm"); // src/entities/contact/IdentityEntity.ts var import_ssi_sdk11 = require("@sphereon/ssi-sdk.agent-config"); var import_ssi_sdk12 = require("@sphereon/ssi-sdk.data-store-types"); var import_class_validator9 = require("class-validator"); var import_typeorm10 = require("typeorm"); // src/utils/ValidatorUtils.ts var getConstraint = /* @__PURE__ */ __name((validation) => { if (validation.children && validation.children.length > 0) { return getConstraint(validation.children[0]); } else { return validation.constraints; } }, "getConstraint"); // src/entities/contact/CorrelationIdentifierEntity.ts var import_ssi_sdk = require("@sphereon/ssi-sdk.data-store-types"); var import_class_validator = require("class-validator"); var import_typeorm = require("typeorm"); function _ts_decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } __name(_ts_decorate, "_ts_decorate"); function _ts_metadata(k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); } __name(_ts_metadata, "_ts_metadata"); var CorrelationIdentifierEntity = class extends import_typeorm.BaseEntity { static { __name(this, "CorrelationIdentifierEntity"); } id; type; correlationId; ownerId; tenantId; identity; async validate() { const validation = await (0, import_class_validator.validate)(this); if (validation.length > 0) { const constraint = getConstraint(validation[0]); if (constraint) { const message = Object.values(constraint)[0]; return Promise.reject(Error(message)); } } } }; _ts_decorate([ (0, import_typeorm.PrimaryGeneratedColumn)("uuid"), _ts_metadata("design:type", String) ], CorrelationIdentifierEntity.prototype, "id", void 0); _ts_decorate([ (0, import_typeorm.Column)("simple-enum", { name: "type", enum: import_ssi_sdk.CorrelationIdentifierType, nullable: false }), _ts_metadata("design:type", typeof import_ssi_sdk.CorrelationIdentifierType === "undefined" ? Object : import_ssi_sdk.CorrelationIdentifierType) ], CorrelationIdentifierEntity.prototype, "type", void 0); _ts_decorate([ (0, import_typeorm.Column)("text", { name: "correlation_id", nullable: false, unique: true }), (0, import_class_validator.IsNotEmpty)({ message: "Blank correlation ids are not allowed" }), _ts_metadata("design:type", String) ], CorrelationIdentifierEntity.prototype, "correlationId", void 0); _ts_decorate([ (0, import_typeorm.Column)("text", { name: "owner_id", nullable: true }), _ts_metadata("design:type", String) ], CorrelationIdentifierEntity.prototype, "ownerId", void 0); _ts_decorate([ (0, import_typeorm.Column)("text", { name: "tenant_id", nullable: true }), _ts_metadata("design:type", String) ], CorrelationIdentifierEntity.prototype, "tenantId", void 0); _ts_decorate([ (0, import_typeorm.OneToOne)(() => IdentityEntity, (identity) => identity.identifier, { onDelete: "CASCADE" }), (0, import_typeorm.JoinColumn)({ name: "identity_id" }), _ts_metadata("design:type", typeof IdentityEntity === "undefined" ? Object : IdentityEntity) ], CorrelationIdentifierEntity.prototype, "identity", void 0); _ts_decorate([ (0, import_typeorm.BeforeInsert)(), (0, import_typeorm.BeforeUpdate)(), _ts_metadata("design:type", Function), _ts_metadata("design:paramtypes", []), _ts_metadata("design:returntype", Promise) ], CorrelationIdentifierEntity.prototype, "validate", null); CorrelationIdentifierEntity = _ts_decorate([ (0, import_typeorm.Entity)("CorrelationIdentifier") ], CorrelationIdentifierEntity); // src/entities/contact/IdentityMetadataItemEntity.ts var import_ssi_sdk2 = require("@sphereon/ssi-sdk.agent-config"); var import_class_validator2 = require("class-validator"); var import_typeorm2 = require("typeorm"); function _ts_decorate2(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } __name(_ts_decorate2, "_ts_decorate"); function _ts_metadata2(k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); } __name(_ts_metadata2, "_ts_metadata"); var IdentityMetadataItemEntity = class extends import_typeorm2.BaseEntity { static { __name(this, "IdentityMetadataItemEntity"); } id; label; valueType; stringValue; numberValue; dateValue; boolValue; identity; async validate() { const validation = await (0, import_class_validator2.validate)(this); if (validation.length > 0) { const constraint = getConstraint(validation[0]); if (constraint) { const message = Object.values(constraint)[0]; return Promise.reject(Error(message)); } } } }; _ts_decorate2([ (0, import_typeorm2.PrimaryGeneratedColumn)("uuid"), _ts_metadata2("design:type", String) ], IdentityMetadataItemEntity.prototype, "id", void 0); _ts_decorate2([ (0, import_typeorm2.Column)("varchar", { name: "label", length: 255, nullable: false }), (0, import_class_validator2.IsNotEmpty)({ message: "Blank metadata labels are not allowed" }), _ts_metadata2("design:type", String) ], IdentityMetadataItemEntity.prototype, "label", void 0); _ts_decorate2([ (0, import_typeorm2.Column)("varchar", { name: "valueType", nullable: false }), (0, import_class_validator2.IsNotEmpty)({ message: "valueType must not be empty" }), _ts_metadata2("design:type", String) ], IdentityMetadataItemEntity.prototype, "valueType", void 0); _ts_decorate2([ (0, import_typeorm2.Column)("varchar", { name: "stringValue", length: 255, nullable: true }), _ts_metadata2("design:type", String) ], IdentityMetadataItemEntity.prototype, "stringValue", void 0); _ts_decorate2([ (0, import_typeorm2.Column)("numeric", { name: "numberValue", nullable: true }), _ts_metadata2("design:type", Number) ], IdentityMetadataItemEntity.prototype, "numberValue", void 0); _ts_decorate2([ (0, import_typeorm2.Column)({ name: "dateValue", nullable: true, type: (0, import_ssi_sdk2.typeOrmDateTime)() }), _ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date) ], IdentityMetadataItemEntity.prototype, "dateValue", void 0); _ts_decorate2([ (0, import_typeorm2.Column)("boolean", { name: "boolValue", nullable: true }), _ts_metadata2("design:type", Boolean) ], IdentityMetadataItemEntity.prototype, "boolValue", void 0); _ts_decorate2([ (0, import_typeorm2.ManyToOne)(() => IdentityEntity, (identity) => identity.metadata, { cascade: [ "insert", "update" ], onDelete: "CASCADE" }), _ts_metadata2("design:type", typeof IdentityEntity === "undefined" ? Object : IdentityEntity) ], IdentityMetadataItemEntity.prototype, "identity", void 0); _ts_decorate2([ (0, import_typeorm2.BeforeInsert)(), (0, import_typeorm2.BeforeUpdate)(), _ts_metadata2("design:type", Function), _ts_metadata2("design:paramtypes", []), _ts_metadata2("design:returntype", Promise) ], IdentityMetadataItemEntity.prototype, "validate", null); IdentityMetadataItemEntity = _ts_decorate2([ (0, import_typeorm2.Entity)("IdentityMetadata") ], IdentityMetadataItemEntity); // src/entities/contact/PartyEntity.ts var import_ssi_sdk10 = require("@sphereon/ssi-sdk.agent-config"); var import_class_validator8 = require("class-validator"); var import_typeorm9 = require("typeorm"); // src/entities/contact/BaseContactEntity.ts var import_ssi_sdk4 = require("@sphereon/ssi-sdk.agent-config"); var import_typeorm4 = require("typeorm"); // src/entities/contact/ContactMetadataItemEntity.ts var import_ssi_sdk3 = require("@sphereon/ssi-sdk.agent-config"); var import_class_validator3 = require("class-validator"); var import_typeorm3 = require("typeorm"); function _ts_decorate3(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } __name(_ts_decorate3, "_ts_decorate"); function _ts_metadata3(k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); } __name(_ts_metadata3, "_ts_metadata"); var ContactMetadataItemEntity = class extends import_typeorm3.BaseEntity { static { __name(this, "ContactMetadataItemEntity"); } id; label; valueType; stringValue; numberValue; dateValue; boolValue; contact; async validate() { const validation = await (0, import_class_validator3.validate)(this); if (validation.length > 0) { const constraint = getConstraint(validation[0]); if (constraint) { const message = Object.values(constraint)[0]; return Promise.reject(Error(message)); } } } }; _ts_decorate3([ (0, import_typeorm3.PrimaryGeneratedColumn)("uuid"), _ts_metadata3("design:type", String) ], ContactMetadataItemEntity.prototype, "id", void 0); _ts_decorate3([ (0, import_typeorm3.Column)("varchar", { name: "label", length: 255, nullable: false }), (0, import_class_validator3.IsNotEmpty)({ message: "Blank metadata labels are not allowed" }), _ts_metadata3("design:type", String) ], ContactMetadataItemEntity.prototype, "label", void 0); _ts_decorate3([ (0, import_typeorm3.Column)("varchar", { name: "valueType", nullable: false }), (0, import_class_validator3.IsNotEmpty)({ message: "valueType must not be empty" }), _ts_metadata3("design:type", String) ], ContactMetadataItemEntity.prototype, "valueType", void 0); _ts_decorate3([ (0, import_typeorm3.Column)("varchar", { name: "stringValue", length: 255, nullable: true }), _ts_metadata3("design:type", String) ], ContactMetadataItemEntity.prototype, "stringValue", void 0); _ts_decorate3([ (0, import_typeorm3.Column)("numeric", { name: "numberValue", nullable: true }), _ts_metadata3("design:type", Number) ], ContactMetadataItemEntity.prototype, "numberValue", void 0); _ts_decorate3([ (0, import_typeorm3.Column)({ name: "dateValue", nullable: true, type: (0, import_ssi_sdk3.typeOrmDateTime)() }), _ts_metadata3("design:type", typeof Date === "undefined" ? Object : Date) ], ContactMetadataItemEntity.prototype, "dateValue", void 0); _ts_decorate3([ (0, import_typeorm3.Column)("boolean", { name: "boolValue", nullable: true }), _ts_metadata3("design:type", Boolean) ], ContactMetadataItemEntity.prototype, "boolValue", void 0); _ts_decorate3([ (0, import_typeorm3.ManyToOne)(() => BaseContactEntity, (contact) => contact.metadata, { cascade: [ "insert", "update" ], onDelete: "CASCADE" }), _ts_metadata3("design:type", typeof BaseContactEntity === "undefined" ? Object : BaseContactEntity) ], ContactMetadataItemEntity.prototype, "contact", void 0); _ts_decorate3([ (0, import_typeorm3.BeforeInsert)(), (0, import_typeorm3.BeforeUpdate)(), _ts_metadata3("design:type", Function), _ts_metadata3("design:paramtypes", []), _ts_metadata3("design:returntype", Promise) ], ContactMetadataItemEntity.prototype, "validate", null); ContactMetadataItemEntity = _ts_decorate3([ (0, import_typeorm3.Entity)("ContactMetadata") ], ContactMetadataItemEntity); // src/entities/contact/BaseContactEntity.ts function _ts_decorate4(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } __name(_ts_decorate4, "_ts_decorate"); function _ts_metadata4(k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); } __name(_ts_metadata4, "_ts_metadata"); var BaseContactEntity = class extends import_typeorm4.BaseEntity { static { __name(this, "BaseContactEntity"); } id; createdAt; lastUpdatedAt; party; metadata; // By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change. updateUpdatedDate() { this.lastUpdatedAt = /* @__PURE__ */ new Date(); } }; _ts_decorate4([ (0, import_typeorm4.PrimaryGeneratedColumn)("uuid"), _ts_metadata4("design:type", String) ], BaseContactEntity.prototype, "id", void 0); _ts_decorate4([ (0, import_typeorm4.CreateDateColumn)({ name: "created_at", nullable: false, type: (0, import_ssi_sdk4.typeOrmDateTime)() }), _ts_metadata4("design:type", typeof Date === "undefined" ? Object : Date) ], BaseContactEntity.prototype, "createdAt", void 0); _ts_decorate4([ (0, import_typeorm4.UpdateDateColumn)({ name: "last_updated_at", nullable: false, type: (0, import_ssi_sdk4.typeOrmDateTime)() }), _ts_metadata4("design:type", typeof Date === "undefined" ? Object : Date) ], BaseContactEntity.prototype, "lastUpdatedAt", void 0); _ts_decorate4([ (0, import_typeorm4.OneToOne)(() => PartyEntity, (party) => party.contact, { onDelete: "CASCADE" }), (0, import_typeorm4.JoinColumn)({ name: "party_id" }), _ts_metadata4("design:type", typeof PartyEntity === "undefined" ? Object : PartyEntity) ], BaseContactEntity.prototype, "party", void 0); _ts_decorate4([ (0, import_typeorm4.OneToMany)(() => ContactMetadataItemEntity, (metadata) => metadata.contact, { cascade: true, onDelete: "CASCADE", eager: true, nullable: false }), (0, import_typeorm4.JoinColumn)({ name: "metadata_id" }), _ts_metadata4("design:type", typeof Array === "undefined" ? Object : Array) ], BaseContactEntity.prototype, "metadata", void 0); _ts_decorate4([ (0, import_typeorm4.BeforeInsert)(), (0, import_typeorm4.BeforeUpdate)(), _ts_metadata4("design:type", Function), _ts_metadata4("design:paramtypes", []), _ts_metadata4("design:returntype", void 0) ], BaseContactEntity.prototype, "updateUpdatedDate", null); BaseContactEntity = _ts_decorate4([ (0, import_typeorm4.Entity)("BaseContact"), (0, import_typeorm4.TableInheritance)({ column: { type: "varchar", name: "type" } }) ], BaseContactEntity); // src/entities/contact/ElectronicAddressEntity.ts var import_ssi_sdk5 = require("@sphereon/ssi-sdk.agent-config"); var import_class_validator4 = require("class-validator"); var import_typeorm5 = require("typeorm"); function _ts_decorate5(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } __name(_ts_decorate5, "_ts_decorate"); function _ts_metadata5(k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); } __name(_ts_metadata5, "_ts_metadata"); var ElectronicAddressEntity = class extends import_typeorm5.BaseEntity { static { __name(this, "ElectronicAddressEntity"); } id; type; electronicAddress; party; partyId; ownerId; tenantId; createdAt; lastUpdatedAt; // By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change. updateUpdatedDate() { this.lastUpdatedAt = /* @__PURE__ */ new Date(); } async validate() { const validation = await (0, import_class_validator4.validate)(this); if (validation.length > 0) { const constraint = getConstraint(validation[0]); if (constraint) { const message = Object.values(constraint)[0]; return Promise.reject(Error(message)); } } } }; _ts_decorate5([ (0, import_typeorm5.PrimaryGeneratedColumn)("uuid"), _ts_metadata5("design:type", String) ], ElectronicAddressEntity.prototype, "id", void 0); _ts_decorate5([ (0, import_typeorm5.Column)("varchar", { name: "type", length: 255, nullable: false }), (0, import_class_validator4.IsNotEmpty)({ message: "Blank electronic address types are not allowed" }), _ts_metadata5("design:type", typeof ElectronicAddressType === "undefined" ? Object : ElectronicAddressType) ], ElectronicAddressEntity.prototype, "type", void 0); _ts_decorate5([ (0, import_typeorm5.Column)("varchar", { name: "electronic_address", length: 255, nullable: false }), (0, import_class_validator4.IsNotEmpty)({ message: "Blank electronic addresses are not allowed" }), _ts_metadata5("design:type", String) ], ElectronicAddressEntity.prototype, "electronicAddress", void 0); _ts_decorate5([ (0, import_typeorm5.ManyToOne)(() => PartyEntity, (party) => party.electronicAddresses, { onDelete: "CASCADE" }), _ts_metadata5("design:type", typeof PartyEntity === "undefined" ? Object : PartyEntity) ], ElectronicAddressEntity.prototype, "party", void 0); _ts_decorate5([ (0, import_typeorm5.Column)("text", { name: "partyId", nullable: true }), _ts_metadata5("design:type", String) ], ElectronicAddressEntity.prototype, "partyId", void 0); _ts_decorate5([ (0, import_typeorm5.Column)("text", { name: "owner_id", nullable: true }), _ts_metadata5("design:type", String) ], ElectronicAddressEntity.prototype, "ownerId", void 0); _ts_decorate5([ (0, import_typeorm5.Column)("text", { name: "tenant_id", nullable: true }), _ts_metadata5("design:type", String) ], ElectronicAddressEntity.prototype, "tenantId", void 0); _ts_decorate5([ (0, import_typeorm5.CreateDateColumn)({ name: "created_at", nullable: false, type: (0, import_ssi_sdk5.typeOrmDateTime)() }), _ts_metadata5("design:type", typeof Date === "undefined" ? Object : Date) ], ElectronicAddressEntity.prototype, "createdAt", void 0); _ts_decorate5([ (0, import_typeorm5.UpdateDateColumn)({ name: "last_updated_at", nullable: false, type: (0, import_ssi_sdk5.typeOrmDateTime)() }), _ts_metadata5("design:type", typeof Date === "undefined" ? Object : Date) ], ElectronicAddressEntity.prototype, "lastUpdatedAt", void 0); _ts_decorate5([ (0, import_typeorm5.BeforeInsert)(), (0, import_typeorm5.BeforeUpdate)(), _ts_metadata5("design:type", Function), _ts_metadata5("design:paramtypes", []), _ts_metadata5("design:returntype", void 0) ], ElectronicAddressEntity.prototype, "updateUpdatedDate", null); _ts_decorate5([ (0, import_typeorm5.BeforeInsert)(), (0, import_typeorm5.BeforeUpdate)(), _ts_metadata5("design:type", Function), _ts_metadata5("design:paramtypes", []), _ts_metadata5("design:returntype", Promise) ], ElectronicAddressEntity.prototype, "validate", null); ElectronicAddressEntity = _ts_decorate5([ (0, import_typeorm5.Entity)("ElectronicAddress") ], ElectronicAddressEntity); // src/entities/contact/PartyRelationshipEntity.ts var import_ssi_sdk6 = require("@sphereon/ssi-sdk.agent-config"); var import_typeorm6 = require("typeorm"); function _ts_decorate6(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } __name(_ts_decorate6, "_ts_decorate"); function _ts_metadata6(k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); } __name(_ts_metadata6, "_ts_metadata"); var PartyRelationshipEntity = class { static { __name(this, "PartyRelationshipEntity"); } id; left; leftId; right; rightId; ownerId; tenantId; createdAt; lastUpdatedAt; // By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change. updateUpdatedDate() { this.lastUpdatedAt = /* @__PURE__ */ new Date(); } async checkRelationshipSides() { if ((this.left?.id ?? this.leftId) === (this.right?.id ?? this.rightId)) { return Promise.reject(Error("Cannot use the same id for both sides of the relationship")); } } }; _ts_decorate6([ (0, import_typeorm6.PrimaryGeneratedColumn)("uuid"), _ts_metadata6("design:type", String) ], PartyRelationshipEntity.prototype, "id", void 0); _ts_decorate6([ (0, import_typeorm6.ManyToOne)(() => PartyEntity, { nullable: false, onDelete: "CASCADE" }), (0, import_typeorm6.JoinColumn)({ name: "left_id" }), _ts_metadata6("design:type", typeof PartyEntity === "undefined" ? Object : PartyEntity) ], PartyRelationshipEntity.prototype, "left", void 0); _ts_decorate6([ (0, import_typeorm6.Column)("text", { name: "left_id", nullable: false }), _ts_metadata6("design:type", String) ], PartyRelationshipEntity.prototype, "leftId", void 0); _ts_decorate6([ (0, import_typeorm6.ManyToOne)(() => PartyEntity, { nullable: false, onDelete: "CASCADE" }), (0, import_typeorm6.JoinColumn)({ name: "right_id" }), _ts_metadata6("design:type", typeof PartyEntity === "undefined" ? Object : PartyEntity) ], PartyRelationshipEntity.prototype, "right", void 0); _ts_decorate6([ (0, import_typeorm6.Column)("text", { name: "right_id", nullable: false }), _ts_metadata6("design:type", String) ], PartyRelationshipEntity.prototype, "rightId", void 0); _ts_decorate6([ (0, import_typeorm6.Column)("text", { name: "owner_id", nullable: true }), _ts_metadata6("design:type", String) ], PartyRelationshipEntity.prototype, "ownerId", void 0); _ts_decorate6([ (0, import_typeorm6.Column)("text", { name: "tenant_id", nullable: true }), _ts_metadata6("design:type", String) ], PartyRelationshipEntity.prototype, "tenantId", void 0); _ts_decorate6([ (0, import_typeorm6.CreateDateColumn)({ name: "created_at", nullable: false, type: (0, import_ssi_sdk6.typeOrmDateTime)() }), _ts_metadata6("design:type", typeof Date === "undefined" ? Object : Date) ], PartyRelationshipEntity.prototype, "createdAt", void 0); _ts_decorate6([ (0, import_typeorm6.UpdateDateColumn)({ name: "last_updated_at", nullable: false, type: (0, import_ssi_sdk6.typeOrmDateTime)() }), _ts_metadata6("design:type", typeof Date === "undefined" ? Object : Date) ], PartyRelationshipEntity.prototype, "lastUpdatedAt", void 0); _ts_decorate6([ (0, import_typeorm6.BeforeInsert)(), (0, import_typeorm6.BeforeUpdate)(), _ts_metadata6("design:type", Function), _ts_metadata6("design:paramtypes", []), _ts_metadata6("design:returntype", void 0) ], PartyRelationshipEntity.prototype, "updateUpdatedDate", null); _ts_decorate6([ (0, import_typeorm6.BeforeInsert)(), (0, import_typeorm6.BeforeUpdate)(), _ts_metadata6("design:type", Function), _ts_metadata6("design:paramtypes", []), _ts_metadata6("design:returntype", Promise) ], PartyRelationshipEntity.prototype, "checkRelationshipSides", null); PartyRelationshipEntity = _ts_decorate6([ (0, import_typeorm6.Entity)("PartyRelationship"), (0, import_typeorm6.Index)("IDX_PartyRelationship_left_right", [ "left", "right" ], { unique: true }) ], PartyRelationshipEntity); // src/entities/contact/PartyTypeEntity.ts var import_ssi_sdk7 = require("@sphereon/ssi-sdk.agent-config"); var import_ssi_sdk8 = require("@sphereon/ssi-sdk.data-store-types"); var import_class_validator6 = require("class-validator"); var import_typeorm7 = require("typeorm"); // src/entities/validators/index.ts var import_class_validator5 = require("class-validator"); function _ts_decorate7(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } __name(_ts_decorate7, "_ts_decorate"); var IsNonEmptyStringConstraint = class { static { __name(this, "IsNonEmptyStringConstraint"); } validate(value, args) { return !isEmptyString(value); } defaultMessage(args) { return `${args.property} must not be an empty string.`; } }; IsNonEmptyStringConstraint = _ts_decorate7([ (0, import_class_validator5.ValidatorConstraint)({ name: "isNonEmptyString", async: false }) ], IsNonEmptyStringConstraint); var isEmptyString = /* @__PURE__ */ __name((value) => { return typeof value === "string" && value.trim().length === 0; }, "isEmptyString"); // src/entities/contact/PartyTypeEntity.ts function _ts_decorate8(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } __name(_ts_decorate8, "_ts_decorate"); function _ts_metadata7(k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); } __name(_ts_metadata7, "_ts_metadata"); var PartyTypeEntity = class { static { __name(this, "PartyTypeEntity"); } id; type; origin; name; description; tenantId; parties; createdAt; lastUpdatedAt; // By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change. updateUpdatedDate() { this.lastUpdatedAt = /* @__PURE__ */ new Date(); } async validate() { const validation = await (0, import_class_validator6.validate)(this); if (validation.length > 0) { const constraint = getConstraint(validation[0]); if (constraint) { const message = Object.values(constraint)[0]; return Promise.reject(Error(message)); } } } }; _ts_decorate8([ (0, import_typeorm7.PrimaryGeneratedColumn)("uuid"), _ts_metadata7("design:type", String) ], PartyTypeEntity.prototype, "id", void 0); _ts_decorate8([ (0, import_typeorm7.Column)("simple-enum", { name: "type", enum: import_ssi_sdk8.PartyTypeType, nullable: false }), _ts_metadata7("design:type", typeof import_ssi_sdk8.PartyTypeType === "undefined" ? Object : import_ssi_sdk8.PartyTypeType) ], PartyTypeEntity.prototype, "type", void 0); _ts_decorate8([ (0, import_typeorm7.Column)("simple-enum", { name: "origin", enum: import_ssi_sdk8.PartyOrigin, nullable: false, unique: false }), _ts_metadata7("design:type", typeof import_ssi_sdk8.PartyOrigin === "undefined" ? Object : import_ssi_sdk8.PartyOrigin) ], PartyTypeEntity.prototype, "origin", void 0); _ts_decorate8([ (0, import_typeorm7.Column)("varchar", { name: "name", length: 255, nullable: false, unique: true }), (0, import_class_validator6.IsNotEmpty)({ message: "Blank names are not allowed" }), _ts_metadata7("design:type", String) ], PartyTypeEntity.prototype, "name", void 0); _ts_decorate8([ (0, import_typeorm7.Column)("varchar", { name: "description", length: 255, nullable: true }), (0, import_class_validator6.Validate)(IsNonEmptyStringConstraint, { message: "Blank descriptions are not allowed" }), _ts_metadata7("design:type", String) ], PartyTypeEntity.prototype, "description", void 0); _ts_decorate8([ (0, import_typeorm7.Column)({ name: "tenant_id", type: "varchar", length: 255, nullable: true }), (0, import_class_validator6.IsNotEmpty)({ message: "Blank tenant id's are not allowed" }), _ts_metadata7("design:type", String) ], PartyTypeEntity.prototype, "tenantId", void 0); _ts_decorate8([ (0, import_typeorm7.OneToMany)(() => PartyEntity, (party) => party.partyType, { nullable: false }), _ts_metadata7("design:type", typeof Array === "undefined" ? Object : Array) ], PartyTypeEntity.prototype, "parties", void 0); _ts_decorate8([ (0, import_typeorm7.CreateDateColumn)({ name: "created_at", nullable: false, type: (0, import_ssi_sdk7.typeOrmDateTime)() }), _ts_metadata7("design:type", typeof Date === "undefined" ? Object : Date) ], PartyTypeEntity.prototype, "createdAt", void 0); _ts_decorate8([ (0, import_typeorm7.UpdateDateColumn)({ name: "last_updated_at", nullable: false, type: (0, import_ssi_sdk7.typeOrmDateTime)() }), _ts_metadata7("design:type", typeof Date === "undefined" ? Object : Date) ], PartyTypeEntity.prototype, "lastUpdatedAt", void 0); _ts_decorate8([ (0, import_typeorm7.BeforeInsert)(), (0, import_typeorm7.BeforeUpdate)(), _ts_metadata7("design:type", Function), _ts_metadata7("design:paramtypes", []), _ts_metadata7("design:returntype", void 0) ], PartyTypeEntity.prototype, "updateUpdatedDate", null); _ts_decorate8([ (0, import_typeorm7.BeforeInsert)(), (0, import_typeorm7.BeforeUpdate)(), _ts_metadata7("design:type", Function), _ts_metadata7("design:paramtypes", []), _ts_metadata7("design:returntype", Promise) ], PartyTypeEntity.prototype, "validate", null); PartyTypeEntity = _ts_decorate8([ (0, import_typeorm7.Entity)("PartyType"), (0, import_typeorm7.Index)("IDX_PartyType_type_tenant_id", [ "type", "tenantId" ], { unique: true }) ], PartyTypeEntity); // src/entities/contact/PhysicalAddressEntity.ts var import_ssi_sdk9 = require("@sphereon/ssi-sdk.agent-config"); var import_class_validator7 = require("class-validator"); var import_typeorm8 = require("typeorm"); function _ts_decorate9(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } __name(_ts_decorate9, "_ts_decorate"); function _ts_metadata8(k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); } __name(_ts_metadata8, "_ts_metadata"); var PhysicalAddressEntity = class extends import_typeorm8.BaseEntity { static { __name(this, "PhysicalAddressEntity"); } id; type; streetName; streetNumber; postalCode; cityName; provinceName; countryCode; buildingName; ownerId; tenantId; party; partyId; createdAt; lastUpdatedAt; // By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change. updateUpdatedDate() { this.lastUpdatedAt = /* @__PURE__ */ new Date(); } async validate() { const validation = await (0, import_class_validator7.validate)(this); if (validation.length > 0) { const constraint = getConstraint(validation[0]); if (constraint) { const message = Object.values(constraint)[0]; return Promise.reject(Error(message)); } } } }; _ts_decorate9([ (0, import_typeorm8.PrimaryGeneratedColumn)("uuid"), _ts_metadata8("design:type", String) ], PhysicalAddressEntity.prototype, "id", void 0); _ts_decorate9([ (0, import_typeorm8.Column)("varchar", { name: "type", length: 255, nullable: false }), (0, import_class_validator7.IsNotEmpty)({ message: "Blank physical address types are not allowed" }), _ts_metadata8("design:type", typeof PhysicalAddressType === "undefined" ? Object : PhysicalAddressType) ], PhysicalAddressEntity.prototype, "type", void 0); _ts_decorate9([ (0, import_typeorm8.Column)("varchar", { name: "street_name", length: 255, nullable: false }), (0, import_class_validator7.IsNotEmpty)({ message: "Blank street names are not allowed" }), _ts_metadata8("design:type", String) ], PhysicalAddressEntity.prototype, "streetName", void 0); _ts_decorate9([ (0, import_typeorm8.Column)("varchar", { name: "street_number", length: 255, nullable: false }), (0, import_class_validator7.IsNotEmpty)({ message: "Blank street numbers are not allowed" }), _ts_metadata8("design:type", String) ], PhysicalAddressEntity.prototype, "streetNumber", void 0); _ts_decorate9([ (0, import_typeorm8.Column)("varchar", { name: "postal_code", length: 255, nullable: false }), (0, import_class_validator7.IsNotEmpty)({ message: "Blank postal codes are not allowed" }), _ts_metadata8("design:type", String) ], PhysicalAddressEntity.prototype, "postalCode", void 0); _ts_decorate9([ (0, import_typeorm8.Column)("varchar", { name: "city_name", length: 255, nullable: false }), (0, import_class_validator7.IsNotEmpty)({ message: "Blank city names are not allowed" }), _ts_metadata8("design:type", String) ], PhysicalAddressEntity.prototype, "cityName", void 0); _ts_decorate9([ (0, import_typeorm8.Column)("varchar", { name: "province_name", length: 255, nullable: false }), (0, import_class_validator7.IsNotEmpty)({ message: "Blank province names are not allowed" }), _ts_metadata8("design:type", String) ], PhysicalAddressEntity.prototype, "provinceName", void 0); _ts_decorate9([ (0, import_typeorm8.Column)("varchar", { name: "country_code", length: 2, nullable: false }), (0, import_class_validator7.IsNotEmpty)({ message: "Blank country codes are not allowed" }), _ts_metadata8("design:type", String) ], PhysicalAddressEntity.prototype, "countryCode", void 0); _ts_decorate9([ (0, import_typeorm8.Column)("varchar", { name: "building_name", length: 255, nullable: true }), (0, import_class_validator7.Validate)(IsNonEmptyStringConstraint, { message: "Blank building names are not allowed" }), _ts_metadata8("design:type", String) ], PhysicalAddressEntity.prototype, "buildingName", void 0); _ts_decorate9([ (0, import_typeorm8.Column)("text", { name: "owner_id", nullable: true }), _ts_metadata8("design:type", String) ], PhysicalAddressEntity.prototype, "ownerId", void 0); _ts_decorate9([ (0, import_typeorm8.Column)("text", { name: "tenant_id", nullable: true }), _ts_metadata8("design:type", String) ], PhysicalAddressEntity.prototype, "tenantId", void 0); _ts_decorate9([ (0, import_typeorm8.ManyToOne)(() => PartyEntity, (party) => party.physicalAddresses, { onDelete: "CASCADE" }), _ts_metadata8("design:type", typeof PartyEntity === "undefined" ? Object : PartyEntity) ], PhysicalAddressEntity.prototype, "party", void 0); _ts_decorate9([ (0, import_typeorm8.Column)("text", { name: "partyId", nullable: true }), _ts_metadata8("design:type", String) ], PhysicalAddressEntity.prototype, "partyId", void 0); _ts_decorate9([ (0, import_typeorm8.CreateDateColumn)({ name: "created_at", nullable: false, type: (0, import_ssi_sdk9.typeOrmDateTime)() }), _ts_metadata8("design:type", typeof Date === "undefined" ? Object : Date) ], PhysicalAddressEntity.prototype, "createdAt", void 0); _ts_decorate9([ (0, import_typeorm8.UpdateDateColumn)({ name: "last_updated_at", nullable: false, type: (0, import_ssi_sdk9.typeOrmDateTime)() }), _ts_metadata8("design:type", typeof Date === "undefined" ? Object : Date) ], PhysicalAddressEntity.prototype, "lastUpdatedAt", void 0); _ts_decorate9([ (0, import_typeorm8.BeforeInsert)(), (0, import_typeorm8.BeforeUpdate)(), _ts_metadata8("design:type", Function), _ts_metadata8("design:paramtypes", []), _ts_metadata8("design:returntype", void 0) ], PhysicalAddressEntity.prototype, "updateUpdatedDate", null); _ts_decorate9([ (0, import_typeorm8.BeforeInsert)(), (0, import_typeorm8.BeforeUpdate)(), _ts_metadata8("design:type", Function), _ts_metadata8("design:paramtypes", []), _ts_metadata8("design:returntype", Promise) ], PhysicalAddressEntity.prototype, "validate", null); PhysicalAddressEntity = _ts_decorate9([ (0, import_typeorm8.Entity)("PhysicalAddress") ], PhysicalAddressEntity); // src/entities/contact/PartyEntity.ts function _ts_decorate10(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } __name(_ts_decorate10, "_ts_decorate"); function _ts_metadata9(k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); } __name(_ts_metadata9, "_ts_metadata"); var PartyEntity = class extends import_typeorm9.BaseEntity { static { __name(this, "PartyEntity"); } id; uri; ownerId; tenantId; identities; electronicAddresses; physicalAddresses; partyType; contact; relationships; createdAt; lastUpdatedAt; // By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change. updateUpdatedDate() { this.lastUpdatedAt = /* @__PURE__ */ new Date(); } async validate() { const validation = await (0, import_class_validator8.validate)(this); if (validation.length > 0) { const constraint = getConstraint(validation[0]); if (constraint) { const message = Object.values(constraint)[0]; return Promise.reject(Error(message)); } } } }; _ts_decorate10([ (0, import_typeorm9.PrimaryGeneratedColumn)("uuid"), _ts_metadata9("design:type", String) ], PartyEntity.prototype, "id", void 0); _ts_decorate10([ (0, import_typeorm9.Column)("varchar", { name: "uri", length: 255, nullable: true }), _ts_metadata9("design:type", String) ], PartyEntity.prototype, "uri", void 0); _ts_decorate10([ (0, import_typeorm9.Column)("text", { name: "owner_id", nullable: true }), _ts_metadata9("design:type", String) ], PartyEntity.prototype, "ownerId", void 0); _ts_decorate10([ (0, import_typeorm9.Column)("text", { name: "tenant_id", nullable: true }), _ts_metadata9("design:type", String) ], PartyEntity.prototype, "tenantId", void 0); _ts_decorate10([ (0, import_typeorm9.OneToMany)(() => IdentityEntity, (identity) => identity.party, { cascade: true, onDelete: "CASCADE", eager: true, nullable: false }), (0, import_typeorm9.JoinColumn)({ name: "identity_id" }), _ts_metadata9("design:type", typeof Array === "undefined" ? Object : Array)