@sphereon/ssi-sdk.data-store 0.11.1-unstable.151 → 0.11.1-unstable.153

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.
Files changed (149) hide show
  1. package/dist/contact/AbstractContactStore.d.ts +14 -0
  2. package/dist/contact/AbstractContactStore.d.ts.map +1 -0
  3. package/dist/contact/AbstractContactStore.js +7 -0
  4. package/dist/contact/AbstractContactStore.js.map +1 -0
  5. package/dist/contact/ContactStore.d.ts +29 -0
  6. package/dist/contact/ContactStore.d.ts.map +1 -0
  7. package/dist/contact/ContactStore.js +281 -0
  8. package/dist/contact/ContactStore.js.map +1 -0
  9. package/dist/entities/contact/BaseConfigEntity.d.ts +5 -0
  10. package/dist/entities/contact/BaseConfigEntity.d.ts.map +1 -0
  11. package/dist/entities/contact/BaseConfigEntity.js +26 -0
  12. package/dist/entities/contact/BaseConfigEntity.js.map +1 -0
  13. package/dist/entities/contact/ConnectionEntity.d.ts +12 -0
  14. package/dist/entities/contact/ConnectionEntity.d.ts.map +1 -0
  15. package/dist/entities/contact/ConnectionEntity.js +66 -0
  16. package/dist/entities/contact/ConnectionEntity.js.map +1 -0
  17. package/dist/entities/contact/ContactEntity.d.ts +16 -0
  18. package/dist/entities/contact/ContactEntity.d.ts.map +1 -0
  19. package/dist/entities/contact/ContactEntity.js +105 -0
  20. package/dist/entities/contact/ContactEntity.js.map +1 -0
  21. package/dist/entities/contact/CorrelationIdentifierEntity.d.ts +12 -0
  22. package/dist/entities/contact/CorrelationIdentifierEntity.d.ts.map +1 -0
  23. package/dist/entities/contact/CorrelationIdentifierEntity.js +75 -0
  24. package/dist/entities/contact/CorrelationIdentifierEntity.js.map +1 -0
  25. package/dist/entities/contact/DidAuthConfigEntity.d.ts +11 -0
  26. package/dist/entities/contact/DidAuthConfigEntity.d.ts.map +1 -0
  27. package/dist/entities/contact/DidAuthConfigEntity.js +49 -0
  28. package/dist/entities/contact/DidAuthConfigEntity.js.map +1 -0
  29. package/dist/entities/contact/IdentityEntity.d.ts +22 -0
  30. package/dist/entities/contact/IdentityEntity.d.ts.map +1 -0
  31. package/dist/entities/contact/IdentityEntity.js +134 -0
  32. package/dist/entities/contact/IdentityEntity.js.map +1 -0
  33. package/dist/entities/contact/IdentityMetadataItemEntity.d.ts +12 -0
  34. package/dist/entities/contact/IdentityMetadataItemEntity.d.ts.map +1 -0
  35. package/dist/entities/contact/IdentityMetadataItemEntity.js +72 -0
  36. package/dist/entities/contact/IdentityMetadataItemEntity.js.map +1 -0
  37. package/dist/entities/contact/OpenIdConfigEntity.d.ts +15 -0
  38. package/dist/entities/contact/OpenIdConfigEntity.d.ts.map +1 -0
  39. package/dist/entities/contact/OpenIdConfigEntity.js +70 -0
  40. package/dist/entities/contact/OpenIdConfigEntity.js.map +1 -0
  41. package/dist/entities/issuanceBranding/BackgroundAttributesEntity.d.ts +11 -0
  42. package/dist/entities/issuanceBranding/BackgroundAttributesEntity.d.ts.map +1 -0
  43. package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js +74 -0
  44. package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js.map +1 -0
  45. package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.d.ts +18 -0
  46. package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.d.ts.map +1 -0
  47. package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.js +120 -0
  48. package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.js.map +1 -0
  49. package/dist/entities/issuanceBranding/CredentialBrandingEntity.d.ts +15 -0
  50. package/dist/entities/issuanceBranding/CredentialBrandingEntity.d.ts.map +1 -0
  51. package/dist/entities/issuanceBranding/CredentialBrandingEntity.js +102 -0
  52. package/dist/entities/issuanceBranding/CredentialBrandingEntity.js.map +1 -0
  53. package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.d.ts +9 -0
  54. package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.d.ts.map +1 -0
  55. package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js +49 -0
  56. package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js.map +1 -0
  57. package/dist/entities/issuanceBranding/ImageAttributesEntity.d.ts +14 -0
  58. package/dist/entities/issuanceBranding/ImageAttributesEntity.d.ts.map +1 -0
  59. package/dist/entities/issuanceBranding/ImageAttributesEntity.js +92 -0
  60. package/dist/entities/issuanceBranding/ImageAttributesEntity.js.map +1 -0
  61. package/dist/entities/issuanceBranding/ImageDimensionsEntity.d.ts +9 -0
  62. package/dist/entities/issuanceBranding/ImageDimensionsEntity.d.ts.map +1 -0
  63. package/dist/entities/issuanceBranding/ImageDimensionsEntity.js +39 -0
  64. package/dist/entities/issuanceBranding/ImageDimensionsEntity.js.map +1 -0
  65. package/dist/entities/issuanceBranding/IssuerBrandingEntity.d.ts +14 -0
  66. package/dist/entities/issuanceBranding/IssuerBrandingEntity.d.ts.map +1 -0
  67. package/dist/entities/issuanceBranding/IssuerBrandingEntity.js +95 -0
  68. package/dist/entities/issuanceBranding/IssuerBrandingEntity.js.map +1 -0
  69. package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.d.ts +9 -0
  70. package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.d.ts.map +1 -0
  71. package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js +49 -0
  72. package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js.map +1 -0
  73. package/dist/entities/issuanceBranding/TextAttributesEntity.d.ts +9 -0
  74. package/dist/entities/issuanceBranding/TextAttributesEntity.d.ts.map +1 -0
  75. package/dist/entities/issuanceBranding/TextAttributesEntity.js +62 -0
  76. package/dist/entities/issuanceBranding/TextAttributesEntity.js.map +1 -0
  77. package/dist/entities/validators/index.d.ts +7 -0
  78. package/dist/entities/validators/index.d.ts.map +1 -0
  79. package/dist/entities/validators/index.js +27 -0
  80. package/dist/entities/validators/index.js.map +1 -0
  81. package/dist/index.d.ts +27 -0
  82. package/dist/index.d.ts.map +1 -0
  83. package/dist/index.js +99 -0
  84. package/dist/index.js.map +1 -0
  85. package/dist/issuanceBranding/AbstractIssuanceBrandingStore.d.ts +20 -0
  86. package/dist/issuanceBranding/AbstractIssuanceBrandingStore.d.ts.map +1 -0
  87. package/dist/issuanceBranding/AbstractIssuanceBrandingStore.js +7 -0
  88. package/dist/issuanceBranding/AbstractIssuanceBrandingStore.js.map +1 -0
  89. package/dist/issuanceBranding/IssuanceBrandingStore.d.ts +31 -0
  90. package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -0
  91. package/dist/issuanceBranding/IssuanceBrandingStore.js +375 -0
  92. package/dist/issuanceBranding/IssuanceBrandingStore.js.map +1 -0
  93. package/dist/migrations/generic/1-CreateContacts.d.ts +7 -0
  94. package/dist/migrations/generic/1-CreateContacts.d.ts.map +1 -0
  95. package/dist/migrations/generic/1-CreateContacts.js +72 -0
  96. package/dist/migrations/generic/1-CreateContacts.js.map +1 -0
  97. package/dist/migrations/generic/1-CreateIssuanceBranding.d.ts +7 -0
  98. package/dist/migrations/generic/1-CreateIssuanceBranding.d.ts.map +1 -0
  99. package/dist/migrations/generic/1-CreateIssuanceBranding.js +72 -0
  100. package/dist/migrations/generic/1-CreateIssuanceBranding.js.map +1 -0
  101. package/dist/migrations/generic/index.d.ts +10 -0
  102. package/dist/migrations/generic/index.d.ts.map +1 -0
  103. package/dist/migrations/generic/index.js +14 -0
  104. package/dist/migrations/generic/index.js.map +1 -0
  105. package/dist/migrations/index.d.ts +2 -0
  106. package/dist/migrations/index.d.ts.map +1 -0
  107. package/dist/migrations/index.js +6 -0
  108. package/dist/migrations/index.js.map +1 -0
  109. package/dist/migrations/internal-migrations-ormconfig.d.ts +6 -0
  110. package/dist/migrations/internal-migrations-ormconfig.d.ts.map +1 -0
  111. package/dist/migrations/internal-migrations-ormconfig.js +29 -0
  112. package/dist/migrations/internal-migrations-ormconfig.js.map +1 -0
  113. package/dist/migrations/postgres/1659463079428-CreateContacts.d.ts +7 -0
  114. package/dist/migrations/postgres/1659463079428-CreateContacts.d.ts.map +1 -0
  115. package/dist/migrations/postgres/1659463079428-CreateContacts.js +55 -0
  116. package/dist/migrations/postgres/1659463079428-CreateContacts.js.map +1 -0
  117. package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.d.ts +7 -0
  118. package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.d.ts.map +1 -0
  119. package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js +67 -0
  120. package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js.map +1 -0
  121. package/dist/migrations/sqlite/1659463069549-CreateContacts.d.ts +7 -0
  122. package/dist/migrations/sqlite/1659463069549-CreateContacts.d.ts.map +1 -0
  123. package/dist/migrations/sqlite/1659463069549-CreateContacts.js +79 -0
  124. package/dist/migrations/sqlite/1659463069549-CreateContacts.js.map +1 -0
  125. package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.d.ts +7 -0
  126. package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.d.ts.map +1 -0
  127. package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js +89 -0
  128. package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js.map +1 -0
  129. package/dist/types/contact/IAbstractContactStore.d.ts +41 -0
  130. package/dist/types/contact/IAbstractContactStore.d.ts.map +1 -0
  131. package/dist/types/contact/IAbstractContactStore.js +3 -0
  132. package/dist/types/contact/IAbstractContactStore.js.map +1 -0
  133. package/dist/types/contact/contact.d.ts +91 -0
  134. package/dist/types/contact/contact.d.ts.map +1 -0
  135. package/dist/types/contact/contact.js +21 -0
  136. package/dist/types/contact/contact.js.map +1 -0
  137. package/dist/types/index.d.ts +5 -0
  138. package/dist/types/index.d.ts.map +1 -0
  139. package/dist/types/index.js +21 -0
  140. package/dist/types/index.js.map +1 -0
  141. package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.d.ts +59 -0
  142. package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.d.ts.map +1 -0
  143. package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.js +3 -0
  144. package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.js.map +1 -0
  145. package/dist/types/issuanceBranding/issuanceBranding.d.ts +115 -0
  146. package/dist/types/issuanceBranding/issuanceBranding.d.ts.map +1 -0
  147. package/dist/types/issuanceBranding/issuanceBranding.js +3 -0
  148. package/dist/types/issuanceBranding/issuanceBranding.js.map +1 -0
  149. package/package.json +3 -3
@@ -0,0 +1,14 @@
1
+ import { IContact, IIdentity, IAddIdentityArgs, IGetIdentityArgs, IGetIdentitiesArgs, IGetContactArgs, IRemoveIdentityArgs, IUpdateIdentityArgs, IAddContactArgs, IGetContactsArgs, IRemoveContactArgs, IUpdateContactArgs } from '../types';
2
+ export declare abstract class AbstractContactStore {
3
+ abstract getContact(args: IGetContactArgs): Promise<IContact>;
4
+ abstract getContacts(args?: IGetContactsArgs): Promise<Array<IContact>>;
5
+ abstract addContact(args: IAddContactArgs): Promise<IContact>;
6
+ abstract updateContact(args: IUpdateContactArgs): Promise<IContact>;
7
+ abstract removeContact(args: IRemoveContactArgs): Promise<void>;
8
+ abstract getIdentity(args: IGetIdentityArgs): Promise<IIdentity>;
9
+ abstract getIdentities(args: IGetIdentitiesArgs): Promise<Array<IIdentity>>;
10
+ abstract addIdentity(args: IAddIdentityArgs): Promise<IIdentity>;
11
+ abstract updateIdentity(args: IUpdateIdentityArgs): Promise<IIdentity>;
12
+ abstract removeIdentity(args: IRemoveIdentityArgs): Promise<void>;
13
+ }
14
+ //# sourceMappingURL=AbstractContactStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbstractContactStore.d.ts","sourceRoot":"","sources":["../../src/contact/AbstractContactStore.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,UAAU,CAAA;AAEjB,8BAAsB,oBAAoB;IACxC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;IAC7D,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvE,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;IAC7D,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,QAAQ,CAAC;IACnE,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAC/D,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAChE,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC3E,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAChE,QAAQ,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC;IACtE,QAAQ,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;CAClE"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbstractContactStore = void 0;
4
+ class AbstractContactStore {
5
+ }
6
+ exports.AbstractContactStore = AbstractContactStore;
7
+ //# sourceMappingURL=AbstractContactStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbstractContactStore.js","sourceRoot":"","sources":["../../src/contact/AbstractContactStore.ts"],"names":[],"mappings":";;;AAeA,MAAsB,oBAAoB;CAWzC;AAXD,oDAWC"}
@@ -0,0 +1,29 @@
1
+ import { OrPromise } from '@sphereon/ssi-types';
2
+ import { AbstractContactStore } from './AbstractContactStore';
3
+ import { IAddIdentityArgs, IGetIdentityArgs, IGetIdentitiesArgs, IGetContactArgs, IRemoveIdentityArgs, IUpdateIdentityArgs, IGetContactsArgs, IAddContactArgs, IUpdateContactArgs, IRemoveContactArgs, IContact, IIdentity } from '../types';
4
+ import { DataSource } from 'typeorm';
5
+ export declare class ContactStore extends AbstractContactStore {
6
+ private readonly dbConnection;
7
+ constructor(dbConnection: OrPromise<DataSource>);
8
+ getContact: ({ contactId }: IGetContactArgs) => Promise<IContact>;
9
+ getContacts: (args?: IGetContactsArgs) => Promise<Array<IContact>>;
10
+ addContact: (args: IAddContactArgs) => Promise<IContact>;
11
+ updateContact: ({ contact }: IUpdateContactArgs) => Promise<IContact>;
12
+ removeContact: ({ contactId }: IRemoveContactArgs) => Promise<void>;
13
+ private deleteIdentities;
14
+ getIdentity: ({ identityId }: IGetIdentityArgs) => Promise<IIdentity>;
15
+ getIdentities: (args?: IGetIdentitiesArgs) => Promise<Array<IIdentity>>;
16
+ addIdentity: ({ identity, contactId }: IAddIdentityArgs) => Promise<IIdentity>;
17
+ updateIdentity: ({ identity }: IUpdateIdentityArgs) => Promise<IIdentity>;
18
+ removeIdentity: ({ identityId }: IRemoveIdentityArgs) => Promise<void>;
19
+ private contactFrom;
20
+ private identityFrom;
21
+ private correlationIdentifierFrom;
22
+ private metadataItemFrom;
23
+ private connectionFrom;
24
+ private configFrom;
25
+ private hasCorrectConfig;
26
+ private isOpenIdConfig;
27
+ private isDidAuthConfig;
28
+ }
29
+ //# sourceMappingURL=ContactStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContactStore.d.ts","sourceRoot":"","sources":["../../src/contact/ContactStore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,qB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c,CAMrB;IAED,OAAO,CAAC,UAAU,CAwBjB;IAED,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,cAAc,CACqD;IAE3E,OAAO,CAAC,eAAe,CACqD;CAC7E"}
@@ -0,0 +1,281 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ContactStore = void 0;
16
+ const debug_1 = __importDefault(require("debug"));
17
+ const AbstractContactStore_1 = require("./AbstractContactStore");
18
+ const types_1 = require("../types");
19
+ const ContactEntity_1 = require("../entities/contact/ContactEntity");
20
+ const IdentityEntity_1 = require("../entities/contact/IdentityEntity");
21
+ const IdentityMetadataItemEntity_1 = require("../entities/contact/IdentityMetadataItemEntity");
22
+ const CorrelationIdentifierEntity_1 = require("../entities/contact/CorrelationIdentifierEntity");
23
+ const ConnectionEntity_1 = require("../entities/contact/ConnectionEntity");
24
+ const BaseConfigEntity_1 = require("../entities/contact/BaseConfigEntity");
25
+ const typeorm_1 = require("typeorm");
26
+ const debug = (0, debug_1.default)('sphereon:ssi-sdk:contact-store');
27
+ class ContactStore extends AbstractContactStore_1.AbstractContactStore {
28
+ constructor(dbConnection) {
29
+ super();
30
+ this.getContact = ({ contactId }) => __awaiter(this, void 0, void 0, function* () {
31
+ const result = yield (yield this.dbConnection).getRepository(ContactEntity_1.ContactEntity).findOne({
32
+ where: { id: contactId },
33
+ });
34
+ if (!result) {
35
+ return Promise.reject(Error(`No contact found for id: ${contactId}`));
36
+ }
37
+ return this.contactFrom(result);
38
+ });
39
+ this.getContacts = (args) => __awaiter(this, void 0, void 0, function* () {
40
+ const initialResult = yield (yield this.dbConnection).getRepository(ContactEntity_1.ContactEntity).find(Object.assign({}, ((args === null || args === void 0 ? void 0 : args.filter) && { where: args === null || args === void 0 ? void 0 : args.filter })));
41
+ const result = yield (yield this.dbConnection).getRepository(ContactEntity_1.ContactEntity).find({
42
+ where: {
43
+ id: (0, typeorm_1.In)(initialResult.map((contact) => contact.id)),
44
+ },
45
+ });
46
+ return result.map((contact) => this.contactFrom(contact));
47
+ });
48
+ this.addContact = (args) => __awaiter(this, void 0, void 0, function* () {
49
+ const { name, alias, uri, identities } = args;
50
+ const result = yield (yield this.dbConnection).getRepository(ContactEntity_1.ContactEntity).findOne({
51
+ where: [{ name }, { alias }],
52
+ });
53
+ if (result) {
54
+ return Promise.reject(Error(`Duplicate names or aliases are not allowed. Name: ${name}, Alias: ${alias}`));
55
+ }
56
+ for (const identity of identities !== null && identities !== void 0 ? identities : []) {
57
+ if (identity.identifier.type === types_1.CorrelationIdentifierEnum.URL) {
58
+ if (!identity.connection) {
59
+ return Promise.reject(Error(`Identity with correlation type ${types_1.CorrelationIdentifierEnum.URL} should contain a connection`));
60
+ }
61
+ if (!this.hasCorrectConfig(identity.connection.type, identity.connection.config)) {
62
+ return Promise.reject(Error(`Connection type ${identity.connection.type}, does not match for provided config`));
63
+ }
64
+ }
65
+ }
66
+ const contactEntity = (0, ContactEntity_1.contactEntityFrom)({ name, alias, uri, identities });
67
+ debug('Adding contact', name);
68
+ const createdResult = yield (yield this.dbConnection).getRepository(ContactEntity_1.ContactEntity).save(contactEntity);
69
+ return this.contactFrom(createdResult);
70
+ });
71
+ this.updateContact = ({ contact }) => __awaiter(this, void 0, void 0, function* () {
72
+ const result = yield (yield this.dbConnection).getRepository(ContactEntity_1.ContactEntity).findOne({
73
+ where: { id: contact.id },
74
+ });
75
+ if (!result) {
76
+ return Promise.reject(Error(`No contact found for id: ${contact.id}`));
77
+ }
78
+ const updatedContact = Object.assign(Object.assign({}, contact), { identities: result.identities });
79
+ debug('Updating contact', contact);
80
+ const updatedResult = yield (yield this.dbConnection).getRepository(ContactEntity_1.ContactEntity).save(updatedContact, { transaction: true });
81
+ return this.contactFrom(updatedResult);
82
+ });
83
+ this.removeContact = ({ contactId }) => __awaiter(this, void 0, void 0, function* () {
84
+ debug('Removing contact', contactId);
85
+ (yield this.dbConnection)
86
+ .getRepository(ContactEntity_1.ContactEntity)
87
+ .findOneById(contactId)
88
+ .then((contact) => __awaiter(this, void 0, void 0, function* () {
89
+ if (!contact) {
90
+ yield Promise.reject(Error(`Unable to find the contact with id to remove: ${contactId}`));
91
+ }
92
+ else {
93
+ yield this.deleteIdentities(contact.identities);
94
+ yield (yield this.dbConnection)
95
+ .getRepository(ContactEntity_1.ContactEntity)
96
+ .delete({ id: contactId })
97
+ .catch((error) => Promise.reject(Error(`Unable to remove contact with id: ${contactId}. ${error}`)));
98
+ }
99
+ }))
100
+ .catch((error) => Promise.reject(Error(`Unable to remove contact with id: ${contactId}. ${error}`)));
101
+ });
102
+ this.getIdentity = ({ identityId }) => __awaiter(this, void 0, void 0, function* () {
103
+ const result = yield (yield this.dbConnection).getRepository(IdentityEntity_1.IdentityEntity).findOne({
104
+ where: { id: identityId },
105
+ });
106
+ if (!result) {
107
+ return Promise.reject(Error(`No identity found for id: ${identityId}`));
108
+ }
109
+ return this.identityFrom(result);
110
+ });
111
+ this.getIdentities = (args) => __awaiter(this, void 0, void 0, function* () {
112
+ const initialResult = yield (yield this.dbConnection).getRepository(IdentityEntity_1.IdentityEntity).find(Object.assign({}, ((args === null || args === void 0 ? void 0 : args.filter) && { where: args === null || args === void 0 ? void 0 : args.filter })));
113
+ const result = yield (yield this.dbConnection).getRepository(IdentityEntity_1.IdentityEntity).find({
114
+ where: {
115
+ id: (0, typeorm_1.In)(initialResult.map((identity) => identity.id)),
116
+ },
117
+ });
118
+ return result.map((identity) => this.identityFrom(identity));
119
+ });
120
+ this.addIdentity = ({ identity, contactId }) => __awaiter(this, void 0, void 0, function* () {
121
+ const contact = yield (yield this.dbConnection).getRepository(ContactEntity_1.ContactEntity).findOne({
122
+ where: { id: contactId },
123
+ });
124
+ if (!contact) {
125
+ return Promise.reject(Error(`No contact found for id: ${contactId}`));
126
+ }
127
+ if (identity.identifier.type === types_1.CorrelationIdentifierEnum.URL) {
128
+ if (!identity.connection) {
129
+ return Promise.reject(Error(`Identity with correlation type ${types_1.CorrelationIdentifierEnum.URL} should contain a connection`));
130
+ }
131
+ if (!this.hasCorrectConfig(identity.connection.type, identity.connection.config)) {
132
+ return Promise.reject(Error(`Connection type ${identity.connection.type}, does not match for provided config`));
133
+ }
134
+ }
135
+ const identityEntity = (0, IdentityEntity_1.identityEntityFrom)(identity);
136
+ identityEntity.contact = contact;
137
+ debug('Adding identity', identity);
138
+ const result = yield (yield this.dbConnection).getRepository(IdentityEntity_1.IdentityEntity).save(identityEntity, {
139
+ transaction: true,
140
+ });
141
+ return this.identityFrom(result);
142
+ });
143
+ this.updateIdentity = ({ identity }) => __awaiter(this, void 0, void 0, function* () {
144
+ const result = yield (yield this.dbConnection).getRepository(IdentityEntity_1.IdentityEntity).findOne({
145
+ where: { id: identity.id },
146
+ });
147
+ if (!result) {
148
+ return Promise.reject(Error(`No identity found for id: ${identity.id}`));
149
+ }
150
+ if (identity.identifier.type === types_1.CorrelationIdentifierEnum.URL) {
151
+ if (!identity.connection) {
152
+ return Promise.reject(Error(`Identity with correlation type ${types_1.CorrelationIdentifierEnum.URL} should contain a connection`));
153
+ }
154
+ if (!this.hasCorrectConfig(identity.connection.type, identity.connection.config)) {
155
+ return Promise.reject(Error(`Connection type ${identity.connection.type}, does not match for provided config`));
156
+ }
157
+ }
158
+ debug('Updating identity', identity);
159
+ const updatedResult = yield (yield this.dbConnection).getRepository(IdentityEntity_1.IdentityEntity).save(identity, { transaction: true });
160
+ return this.identityFrom(updatedResult);
161
+ });
162
+ this.removeIdentity = ({ identityId }) => __awaiter(this, void 0, void 0, function* () {
163
+ const identity = yield (yield this.dbConnection).getRepository(IdentityEntity_1.IdentityEntity).findOne({
164
+ where: { id: identityId },
165
+ });
166
+ if (!identity) {
167
+ return Promise.reject(Error(`No identity found for id: ${identityId}`));
168
+ }
169
+ debug('Removing identity', identityId);
170
+ yield this.deleteIdentities([identity]);
171
+ });
172
+ this.contactFrom = (contact) => {
173
+ var _a, _b;
174
+ return {
175
+ id: contact.id,
176
+ name: contact.name,
177
+ alias: contact.alias,
178
+ uri: contact.uri,
179
+ roles: (_b = [...new Set((_a = contact.identities) === null || _a === void 0 ? void 0 : _a.flatMap((identity) => identity.roles))]) !== null && _b !== void 0 ? _b : [],
180
+ identities: contact.identities ? contact.identities.map((identity) => this.identityFrom(identity)) : [],
181
+ createdAt: contact.createdAt,
182
+ lastUpdatedAt: contact.lastUpdatedAt,
183
+ };
184
+ };
185
+ this.identityFrom = (identity) => {
186
+ return Object.assign(Object.assign({ id: identity.id, alias: identity.alias, roles: identity.roles, identifier: this.correlationIdentifierFrom(identity.identifier) }, (identity.connection && { connection: this.connectionFrom(identity.connection) })), { metadata: identity.metadata ? identity.metadata.map((item) => this.metadataItemFrom(item)) : [], createdAt: identity.createdAt, lastUpdatedAt: identity.createdAt });
187
+ };
188
+ this.correlationIdentifierFrom = (identifier) => {
189
+ return {
190
+ id: identifier.id,
191
+ type: identifier.type,
192
+ correlationId: identifier.correlationId,
193
+ };
194
+ };
195
+ this.metadataItemFrom = (item) => {
196
+ return {
197
+ id: item.id,
198
+ label: item.label,
199
+ value: item.value,
200
+ };
201
+ };
202
+ this.connectionFrom = (connection) => {
203
+ return {
204
+ id: connection.id,
205
+ type: connection.type,
206
+ config: this.configFrom(connection.type, connection.config),
207
+ };
208
+ };
209
+ this.configFrom = (type, config) => {
210
+ switch (type) {
211
+ case types_1.ConnectionTypeEnum.OPENID_CONNECT:
212
+ return {
213
+ id: config.id,
214
+ clientId: config.clientId,
215
+ clientSecret: config.clientSecret,
216
+ scopes: config.scopes,
217
+ issuer: config.issuer,
218
+ redirectUrl: config.redirectUrl,
219
+ dangerouslyAllowInsecureHttpRequests: config.dangerouslyAllowInsecureHttpRequests,
220
+ clientAuthMethod: config.clientAuthMethod,
221
+ };
222
+ case types_1.ConnectionTypeEnum.SIOPv2:
223
+ return {
224
+ id: config.id,
225
+ identifier: { did: config.identifier, provider: '', keys: [], services: [] },
226
+ stateId: '',
227
+ redirectUrl: config.redirectUrl,
228
+ sessionId: config.sessionId,
229
+ };
230
+ default:
231
+ throw new Error('Connection type not supported');
232
+ }
233
+ };
234
+ this.isOpenIdConfig = (config) => 'clientSecret' in config && 'issuer' in config && 'redirectUrl' in config;
235
+ this.isDidAuthConfig = (config) => 'identifier' in config && 'redirectUrl' in config && 'sessionId' in config;
236
+ this.dbConnection = dbConnection;
237
+ }
238
+ deleteIdentities(identities) {
239
+ return __awaiter(this, void 0, void 0, function* () {
240
+ debug('Removing identities', identities);
241
+ identities.map((identity) => __awaiter(this, void 0, void 0, function* () {
242
+ yield (yield this.dbConnection)
243
+ .getRepository(CorrelationIdentifierEntity_1.CorrelationIdentifierEntity)
244
+ .delete(identity.identifier.id)
245
+ .catch((error) => Promise.reject(Error(`Unable to remove identity.identifier with id: ${identity.identifier.id}. ${error}`)));
246
+ if (identity.connection) {
247
+ yield (yield this.dbConnection).getRepository(BaseConfigEntity_1.BaseConfigEntity).delete(identity.connection.config.id);
248
+ yield (yield this.dbConnection)
249
+ .getRepository(ConnectionEntity_1.ConnectionEntity)
250
+ .delete(identity.connection.id)
251
+ .catch((error) => Promise.reject(Error(`Unable to remove identity.connection with id. ${error}`)));
252
+ }
253
+ if (identity.metadata) {
254
+ identity.metadata.map((metadataItem) => __awaiter(this, void 0, void 0, function* () {
255
+ yield (yield this.dbConnection)
256
+ .getRepository(IdentityMetadataItemEntity_1.IdentityMetadataItemEntity)
257
+ .delete(metadataItem.id)
258
+ .catch((error) => Promise.reject(Error(`Unable to remove metadataItem.id with id ${metadataItem.id}. ${error}`)));
259
+ }));
260
+ }
261
+ ;
262
+ (yield this.dbConnection)
263
+ .getRepository(IdentityEntity_1.IdentityEntity)
264
+ .delete(identity.id)
265
+ .catch((error) => Promise.reject(Error(`Unable to remove metadataItem.id with id ${identity.id}. ${error}`)));
266
+ }));
267
+ });
268
+ }
269
+ hasCorrectConfig(type, config) {
270
+ switch (type) {
271
+ case types_1.ConnectionTypeEnum.OPENID_CONNECT:
272
+ return this.isOpenIdConfig(config);
273
+ case types_1.ConnectionTypeEnum.SIOPv2:
274
+ return this.isDidAuthConfig(config);
275
+ default:
276
+ throw new Error('Connection type not supported');
277
+ }
278
+ }
279
+ }
280
+ exports.ContactStore = ContactStore;
281
+ //# sourceMappingURL=ContactStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContactStore.js","sourceRoot":"","sources":["../../src/contact/ContactStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAyB;AAEzB,iEAA6D;AAC7D,oCAsBiB;AACjB,qEAAoF;AACpF,uEAAuF;AACvF,+FAA2F;AAC3F,iGAA6F;AAC7F,2EAAuE;AACvE,2EAAuE;AAGvE,qCAAwC;AAExC,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,gCAAgC,CAAC,CAAA;AAErD,MAAa,YAAa,SAAQ,2CAAoB;IAGpD,YAAY,YAAmC;QAC7C,KAAK,EAAE,CAAA;QAIT,eAAU,GAAG,CAAO,EAAE,SAAS,EAAmB,EAAqB,EAAE;YACvE,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,CAAC,aAAa,CAAC,6BAAa,CAAC,CAAC,OAAO,CAAC;gBAClF,KAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE;aACzB,CAAC,CAAA;YAEF,IAAI,CAAC,MAAM,EAAE;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G,CAAC,CAAO,YAAwC,EAAE,EAAE;wBACvE,MAAM,CACJ,MAAM,IAAI,CAAC,YAAY,CACxB;6BACE,aAAa,CAAC,uDAA0B,CAAC;6BACzC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;6BACvB,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,4CAA4C,YAAY,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;oBACrH,CAAC,CAAA,CAAC,CAAA;iBACH;gBAED,CAAC;gBAAA,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC;qBACvB,aAAa,CAAC,+BAAc,CAAC;qBAC7B,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;qBACnB,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,4CAA4C,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;YACjH,CAAC,CAAA,CAAC,CAAA;QACJ,CAAC;KAAA;IA4KO,gBAAgB,CAAC,IAAwB,EAAE,MAA6B;QAC9E,QAAQ,IAAI,EAAE;YACZ,KAAK,0BAAkB,CAAC,cAAc;gBACpC,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;YACpC,KAAK,0BAAkB,CAAC,MAAM;gBAC5B,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;YACrC;gBACE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;SACnD;IACH,CAAC;CAOF;AA5UD,oCA4UC"}
@@ -0,0 +1,5 @@
1
+ import { BaseEntity } from 'typeorm';
2
+ export declare abstract class BaseConfigEntity extends BaseEntity {
3
+ id: string;
4
+ }
5
+ //# sourceMappingURL=BaseConfigEntity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseConfigEntity.d.ts","sourceRoot":"","sources":["../../../src/entities/contact/BaseConfigEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoD,MAAM,SAAS,CAAA;AAEtF,8BAEsB,gBAAiB,SAAQ,UAAU;IAEvD,EAAE,EAAG,MAAM,CAAA;CACZ"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.BaseConfigEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ let BaseConfigEntity = class BaseConfigEntity extends typeorm_1.BaseEntity {
15
+ };
16
+ __decorate([
17
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
18
+ __metadata("design:type", String)
19
+ ], BaseConfigEntity.prototype, "id", void 0);
20
+ BaseConfigEntity = __decorate([
21
+ (0, typeorm_1.Entity)('BaseConfigEntity') // FIXME rename it to 'BaseConfig'
22
+ ,
23
+ (0, typeorm_1.TableInheritance)({ column: { type: 'varchar', name: 'type' } })
24
+ ], BaseConfigEntity);
25
+ exports.BaseConfigEntity = BaseConfigEntity;
26
+ //# sourceMappingURL=BaseConfigEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseConfigEntity.js","sourceRoot":"","sources":["../../../src/entities/contact/BaseConfigEntity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAsF;AAI/E,IAAe,gBAAgB,GAA/B,MAAe,gBAAiB,SAAQ,oBAAU;CAGxD,CAAA;AAFC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;4CACpB;AAFS,gBAAgB;IAFrC,IAAA,gBAAM,EAAC,kBAAkB,CAAC,CAAC,kCAAkC;;IAC7D,IAAA,0BAAgB,EAAC,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;GAC1C,gBAAgB,CAGrC;AAHqB,4CAAgB"}
@@ -0,0 +1,12 @@
1
+ import { BaseEntity } from 'typeorm';
2
+ import { BaseConfigEntity } from './BaseConfigEntity';
3
+ import { ConnectionTypeEnum, IBasicConnection } from '../../types';
4
+ import { IdentityEntity } from './IdentityEntity';
5
+ export declare class ConnectionEntity extends BaseEntity {
6
+ id: string;
7
+ type: ConnectionTypeEnum;
8
+ config: BaseConfigEntity;
9
+ identity: IdentityEntity;
10
+ }
11
+ export declare const connectionEntityFrom: (connection: IBasicConnection) => ConnectionEntity;
12
+ //# sourceMappingURL=ConnectionEntity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectionEntity.d.ts","sourceRoot":"","sources":["../../../src/entities/contact/ConnectionEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgE,UAAU,EAAE,MAAM,SAAS,CAAA;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAyB,kBAAkB,EAAE,gBAAgB,EAAiC,MAAM,aAAa,CAAA;AACxH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAIjD,qBACa,gBAAiB,SAAQ,UAAU;IAE9C,EAAE,EAAG,MAAM,CAAA;IAGX,IAAI,EAAG,kBAAkB,CAAA;IAQzB,MAAM,EAAG,gBAAgB,CAAA;IAMzB,QAAQ,EAAG,cAAc,CAAA;CAC1B;AAED,eAAO,MAAM,oBAAoB,eAAgB,gBAAgB,KAAG,gBAMnE,CAAA"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.connectionEntityFrom = exports.ConnectionEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseConfigEntity_1 = require("./BaseConfigEntity");
15
+ const types_1 = require("../../types");
16
+ const IdentityEntity_1 = require("./IdentityEntity");
17
+ const OpenIdConfigEntity_1 = require("./OpenIdConfigEntity");
18
+ const DidAuthConfigEntity_1 = require("./DidAuthConfigEntity");
19
+ let ConnectionEntity = class ConnectionEntity extends typeorm_1.BaseEntity {
20
+ };
21
+ __decorate([
22
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
23
+ __metadata("design:type", String)
24
+ ], ConnectionEntity.prototype, "id", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.Column)('simple-enum', { name: 'type', enum: types_1.ConnectionTypeEnum, nullable: false }),
27
+ __metadata("design:type", String)
28
+ ], ConnectionEntity.prototype, "type", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.OneToOne)(() => BaseConfigEntity_1.BaseConfigEntity, (config) => config.connection, {
31
+ cascade: true,
32
+ onDelete: 'CASCADE',
33
+ eager: true,
34
+ nullable: false,
35
+ }),
36
+ __metadata("design:type", BaseConfigEntity_1.BaseConfigEntity)
37
+ ], ConnectionEntity.prototype, "config", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.OneToOne)(() => IdentityEntity_1.IdentityEntity, (identity) => identity.connection, {
40
+ onDelete: 'CASCADE',
41
+ }),
42
+ (0, typeorm_1.JoinColumn)({ name: 'identityId' }),
43
+ __metadata("design:type", IdentityEntity_1.IdentityEntity)
44
+ ], ConnectionEntity.prototype, "identity", void 0);
45
+ ConnectionEntity = __decorate([
46
+ (0, typeorm_1.Entity)('Connection')
47
+ ], ConnectionEntity);
48
+ exports.ConnectionEntity = ConnectionEntity;
49
+ const connectionEntityFrom = (connection) => {
50
+ const connectionEntity = new ConnectionEntity();
51
+ connectionEntity.type = connection.type;
52
+ connectionEntity.config = configEntityFrom(connection.type, connection.config);
53
+ return connectionEntity;
54
+ };
55
+ exports.connectionEntityFrom = connectionEntityFrom;
56
+ const configEntityFrom = (type, config) => {
57
+ switch (type) {
58
+ case types_1.ConnectionTypeEnum.OPENID_CONNECT:
59
+ return (0, OpenIdConfigEntity_1.openIdConfigEntityFrom)(config);
60
+ case types_1.ConnectionTypeEnum.SIOPv2:
61
+ return (0, DidAuthConfigEntity_1.didAuthConfigEntityFrom)(config);
62
+ default:
63
+ throw new Error('Connection type not supported');
64
+ }
65
+ };
66
+ //# sourceMappingURL=ConnectionEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectionEntity.js","sourceRoot":"","sources":["../../../src/entities/contact/ConnectionEntity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAkG;AAClG,yDAAqD;AACrD,uCAAwH;AACxH,qDAAiD;AACjD,6DAAiF;AACjF,+DAAoF;AAG7E,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,oBAAU;CAoB/C,CAAA;AAnBC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;4CACpB;AAEX;IAAC,IAAA,gBAAM,EAAC,aAAa,EAAE,EAAE,IAA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AAA,6CAAuB,EAAC,MAAwB,CAAC,CAAA;QAC1D;YACE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;KACnD;AACH,CAAC,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { BaseEntity } from 'typeorm';
2
+ import { IBasicContact } from '../../types';
3
+ import { IdentityEntity } from './IdentityEntity';
4
+ export declare class ContactEntity extends BaseEntity {
5
+ id: string;
6
+ name: string;
7
+ alias: string;
8
+ uri?: string;
9
+ identities: Array<IdentityEntity>;
10
+ createdAt: Date;
11
+ lastUpdatedAt: Date;
12
+ updateUpdatedDate(): void;
13
+ validate(): Promise<undefined>;
14
+ }
15
+ export declare const contactEntityFrom: (args: IBasicContact) => ContactEntity;
16
+ //# sourceMappingURL=ContactEntity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContactEntity.d.ts","sourceRoot":"","sources":["../../../src/entities/contact/ContactEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAUX,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,aAAa,EAAkB,MAAM,aAAa,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAsB,MAAM,kBAAkB,CAAA;AAGrE,qBACa,aAAc,SAAQ,UAAU;IAE3C,EAAE,EAAG,MAAM,CAAA;IAIX,IAAI,EAAG,MAAM,CAAA;IAIb,KAAK,EAAG,MAAM,CAAA;IAGd,GAAG,CAAC,EAAE,MAAM,CAAA;IASZ,UAAU,EAAG,KAAK,CAAC,cAAc,CAAC,CAAA;IAGlC,SAAS,EAAG,IAAI,CAAA;IAGhB,aAAa,EAAG,IAAI,CAAA;IAKpB,iBAAiB;IAMX,QAAQ;CAOf;AAED,eAAO,MAAM,iBAAiB,SAAU,aAAa,KAAG,aAQvD,CAAA"}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.contactEntityFrom = exports.ContactEntity = void 0;
22
+ const typeorm_1 = require("typeorm");
23
+ const IdentityEntity_1 = require("./IdentityEntity");
24
+ const class_validator_1 = require("class-validator");
25
+ let ContactEntity = class ContactEntity extends typeorm_1.BaseEntity {
26
+ // By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
27
+ updateUpdatedDate() {
28
+ this.lastUpdatedAt = new Date();
29
+ }
30
+ validate() {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ const validation = yield (0, class_validator_1.validate)(this);
33
+ if (validation.length > 0) {
34
+ return Promise.reject(Error(Object.values(validation[0].constraints)[0]));
35
+ }
36
+ return;
37
+ });
38
+ }
39
+ };
40
+ __decorate([
41
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
42
+ __metadata("design:type", String)
43
+ ], ContactEntity.prototype, "id", void 0);
44
+ __decorate([
45
+ (0, typeorm_1.Column)({ name: 'name', length: 255, nullable: false, unique: true }),
46
+ (0, class_validator_1.IsNotEmpty)({ message: 'Blank names are not allowed' }),
47
+ __metadata("design:type", String)
48
+ ], ContactEntity.prototype, "name", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.Column)({ name: 'alias', length: 255, nullable: false, unique: true }),
51
+ (0, class_validator_1.IsNotEmpty)({ message: 'Blank aliases are not allowed' }),
52
+ __metadata("design:type", String)
53
+ ], ContactEntity.prototype, "alias", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.Column)({ name: 'uri', length: 255 }),
56
+ __metadata("design:type", String)
57
+ ], ContactEntity.prototype, "uri", void 0);
58
+ __decorate([
59
+ (0, typeorm_1.OneToMany)(() => IdentityEntity_1.IdentityEntity, (identity) => identity.contact, {
60
+ cascade: true,
61
+ onDelete: 'CASCADE',
62
+ eager: true,
63
+ nullable: false,
64
+ }),
65
+ (0, typeorm_1.JoinColumn)({ name: 'identityId' }),
66
+ __metadata("design:type", Array)
67
+ ], ContactEntity.prototype, "identities", void 0);
68
+ __decorate([
69
+ (0, typeorm_1.CreateDateColumn)({ name: 'created_at', nullable: false }),
70
+ __metadata("design:type", Date)
71
+ ], ContactEntity.prototype, "createdAt", void 0);
72
+ __decorate([
73
+ (0, typeorm_1.UpdateDateColumn)({ name: 'last_updated_at', nullable: false }),
74
+ __metadata("design:type", Date
75
+ // By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
76
+ )
77
+ ], ContactEntity.prototype, "lastUpdatedAt", void 0);
78
+ __decorate([
79
+ (0, typeorm_1.BeforeInsert)(),
80
+ (0, typeorm_1.BeforeUpdate)(),
81
+ __metadata("design:type", Function),
82
+ __metadata("design:paramtypes", []),
83
+ __metadata("design:returntype", void 0)
84
+ ], ContactEntity.prototype, "updateUpdatedDate", null);
85
+ __decorate([
86
+ (0, typeorm_1.BeforeInsert)(),
87
+ (0, typeorm_1.BeforeUpdate)(),
88
+ __metadata("design:type", Function),
89
+ __metadata("design:paramtypes", []),
90
+ __metadata("design:returntype", Promise)
91
+ ], ContactEntity.prototype, "validate", null);
92
+ ContactEntity = __decorate([
93
+ (0, typeorm_1.Entity)('Contact')
94
+ ], ContactEntity);
95
+ exports.ContactEntity = ContactEntity;
96
+ const contactEntityFrom = (args) => {
97
+ const contactEntity = new ContactEntity();
98
+ contactEntity.name = args.name;
99
+ contactEntity.alias = args.alias;
100
+ contactEntity.uri = args.uri;
101
+ contactEntity.identities = args.identities ? args.identities.map((identity) => (0, IdentityEntity_1.identityEntityFrom)(identity)) : [];
102
+ return contactEntity;
103
+ };
104
+ exports.contactEntityFrom = contactEntityFrom;
105
+ //# sourceMappingURL=ContactEntity.js.map