@webda/core 1.5.2 → 1.6.0-beta.3

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 (150) hide show
  1. package/lib/application.d.ts +0 -7
  2. package/lib/application.js +33 -27
  3. package/lib/application.js.map +1 -1
  4. package/lib/application.spec.js +23 -2
  5. package/lib/application.spec.js.map +1 -1
  6. package/lib/core.d.ts +20 -2
  7. package/lib/core.js +74 -34
  8. package/lib/core.js.map +1 -1
  9. package/lib/core.spec.js +5 -5
  10. package/lib/core.spec.js.map +1 -1
  11. package/lib/index.d.ts +12 -7
  12. package/lib/index.js +12 -7
  13. package/lib/index.js.map +1 -1
  14. package/lib/models/aclmodel.d.ts +63 -5
  15. package/lib/models/aclmodel.js +115 -12
  16. package/lib/models/aclmodel.js.map +1 -1
  17. package/lib/models/aclmodel.spec.js +65 -19
  18. package/lib/models/aclmodel.spec.js.map +1 -1
  19. package/lib/models/coremodel.d.ts +22 -6
  20. package/lib/models/coremodel.js +14 -6
  21. package/lib/models/coremodel.js.map +1 -1
  22. package/lib/models/coremodel.spec.js +0 -1
  23. package/lib/models/coremodel.spec.js.map +1 -1
  24. package/lib/models/ident.d.ts +5 -0
  25. package/lib/models/ident.js +6 -0
  26. package/lib/models/ident.js.map +1 -1
  27. package/lib/models/ident.spec.js +3 -0
  28. package/lib/models/ident.spec.js.map +1 -1
  29. package/lib/models/ownermodel.js +1 -2
  30. package/lib/models/ownermodel.js.map +1 -1
  31. package/lib/models/user.d.ts +30 -0
  32. package/lib/models/user.js +34 -2
  33. package/lib/models/user.js.map +1 -1
  34. package/lib/models/user.spec.js +18 -0
  35. package/lib/models/user.spec.js.map +1 -1
  36. package/lib/queues/memoryqueue.spec.js +0 -1
  37. package/lib/queues/memoryqueue.spec.js.map +1 -1
  38. package/lib/queues/pubsubservice.d.ts +27 -0
  39. package/lib/queues/pubsubservice.js +21 -0
  40. package/lib/queues/pubsubservice.js.map +1 -0
  41. package/lib/queues/queueservice.d.ts +3 -16
  42. package/lib/queues/queueservice.js +2 -13
  43. package/lib/queues/queueservice.js.map +1 -1
  44. package/lib/router.js +1 -1
  45. package/lib/router.js.map +1 -1
  46. package/lib/router.spec.js +1 -1
  47. package/lib/router.spec.js.map +1 -1
  48. package/lib/services/authentication.d.ts +35 -1
  49. package/lib/services/authentication.js +55 -5
  50. package/lib/services/authentication.js.map +1 -1
  51. package/lib/services/authentication.spec.js +9 -0
  52. package/lib/services/authentication.spec.js.map +1 -1
  53. package/lib/services/binary.js +15 -10
  54. package/lib/services/binary.js.map +1 -1
  55. package/lib/services/binary.spec.d.ts +1 -1
  56. package/lib/services/configuration.d.ts +9 -0
  57. package/lib/services/configuration.js +27 -2
  58. package/lib/services/configuration.js.map +1 -1
  59. package/lib/services/configuration.spec.js +19 -2
  60. package/lib/services/configuration.spec.js.map +1 -1
  61. package/lib/services/cron.spec.js +2 -2
  62. package/lib/services/cron.spec.js.map +1 -1
  63. package/lib/services/debugmailer.d.ts +10 -3
  64. package/lib/services/debugmailer.js +18 -4
  65. package/lib/services/debugmailer.js.map +1 -1
  66. package/lib/services/debugmailer.spec.js +1 -0
  67. package/lib/services/debugmailer.spec.js.map +1 -1
  68. package/lib/services/filebinary.spec.js +0 -1
  69. package/lib/services/filebinary.spec.js.map +1 -1
  70. package/lib/services/fileconfiguration.d.ts +7 -1
  71. package/lib/services/fileconfiguration.js +9 -0
  72. package/lib/services/fileconfiguration.js.map +1 -1
  73. package/lib/services/fileconfiguration.spec.js +81 -2
  74. package/lib/services/fileconfiguration.spec.js.map +1 -1
  75. package/lib/services/invitationservice.d.ts +196 -0
  76. package/lib/services/invitationservice.js +441 -0
  77. package/lib/services/invitationservice.js.map +1 -0
  78. package/lib/services/invitationservice.spec.d.ts +1 -0
  79. package/lib/services/invitationservice.spec.js +516 -0
  80. package/lib/services/invitationservice.spec.js.map +1 -0
  81. package/lib/services/kubernetesconfiguration.d.ts +6 -0
  82. package/lib/services/kubernetesconfiguration.js +13 -0
  83. package/lib/services/kubernetesconfiguration.js.map +1 -1
  84. package/lib/services/kubernetesconfiguration.spec.js +31 -7
  85. package/lib/services/kubernetesconfiguration.spec.js.map +1 -1
  86. package/lib/services/mailer.d.ts +93 -3
  87. package/lib/services/mailer.js +55 -11
  88. package/lib/services/mailer.js.map +1 -1
  89. package/lib/services/mailer.spec.js +30 -1
  90. package/lib/services/mailer.spec.js.map +1 -1
  91. package/lib/services/notificationservice.d.ts +74 -0
  92. package/lib/services/notificationservice.js +89 -0
  93. package/lib/services/notificationservice.js.map +1 -0
  94. package/lib/services/notificationservice.spec.d.ts +1 -0
  95. package/lib/services/notificationservice.spec.js +104 -0
  96. package/lib/services/notificationservice.spec.js.map +1 -0
  97. package/lib/services/oauth.spec.js +7 -10
  98. package/lib/services/oauth.spec.js.map +1 -1
  99. package/lib/services/service.d.ts +20 -4
  100. package/lib/services/service.js +35 -5
  101. package/lib/services/service.js.map +1 -1
  102. package/lib/services/service.spec.js +26 -0
  103. package/lib/services/service.spec.js.map +1 -1
  104. package/lib/stores/aggregator.d.ts +43 -0
  105. package/lib/stores/aggregator.js +106 -0
  106. package/lib/stores/aggregator.js.map +1 -0
  107. package/lib/stores/file.d.ts +1 -1
  108. package/lib/stores/file.js +5 -5
  109. package/lib/stores/file.js.map +1 -1
  110. package/lib/stores/file.spec.d.ts +3 -1
  111. package/lib/stores/file.spec.js +48 -19
  112. package/lib/stores/file.spec.js.map +1 -1
  113. package/lib/stores/mapper.d.ts +151 -0
  114. package/lib/stores/mapper.js +320 -0
  115. package/lib/stores/mapper.js.map +1 -0
  116. package/lib/stores/mapper.spec.d.ts +1 -0
  117. package/lib/stores/mapper.spec.js +174 -0
  118. package/lib/stores/mapper.spec.js.map +1 -0
  119. package/lib/stores/memory.js +0 -3
  120. package/lib/stores/memory.js.map +1 -1
  121. package/lib/stores/memory.spec.d.ts +3 -1
  122. package/lib/stores/memory.spec.js +12 -0
  123. package/lib/stores/memory.spec.js.map +1 -1
  124. package/lib/stores/store.d.ts +30 -109
  125. package/lib/stores/store.js +57 -285
  126. package/lib/stores/store.js.map +1 -1
  127. package/lib/stores/store.spec.d.ts +10 -0
  128. package/lib/stores/store.spec.js +41 -14
  129. package/lib/stores/store.spec.js.map +1 -1
  130. package/lib/test.d.ts +2 -1
  131. package/lib/test.js +21 -3
  132. package/lib/test.js.map +1 -1
  133. package/lib/utils/context.d.ts +12 -1
  134. package/lib/utils/context.js +21 -5
  135. package/lib/utils/context.js.map +1 -1
  136. package/lib/utils/context.spec.js +6 -1
  137. package/lib/utils/context.spec.js.map +1 -1
  138. package/lib/utils/cookie.d.ts +12 -0
  139. package/lib/utils/cookie.js +29 -19
  140. package/lib/utils/cookie.js.map +1 -1
  141. package/lib/utils/cookie.spec.js +0 -1
  142. package/lib/utils/cookie.spec.js.map +1 -1
  143. package/package.json +9 -7
  144. package/test/config-file-no-reload.json +70 -0
  145. package/test/config-file-reload.json +7 -1
  146. package/test/config-invitation.json +63 -0
  147. package/test/config-kube-reload.json +7 -1
  148. package/test/config.json +35 -23
  149. package/test/config.old-default.json +0 -16
  150. package/test/config.old.json +0 -16
@@ -32,7 +32,13 @@ let FileConfigurationServiceTest = class FileConfigurationServiceTest extends te
32
32
  (0, fs_1.writeFileSync)(__dirname + "/../../test/my-cnf.json", JSON.stringify({
33
33
  webda: {
34
34
  services: {
35
- "Authentication.providers.email.text": "Test"
35
+ Authentication: {
36
+ providers: {
37
+ email: {
38
+ text: "Test"
39
+ }
40
+ }
41
+ }
36
42
  }
37
43
  }
38
44
  }, undefined, 2));
@@ -63,7 +69,13 @@ let FileConfigurationServiceTest = class FileConfigurationServiceTest extends te
63
69
  (0, fs_1.writeFileSync)(__dirname + "/../../test/my-cnf.json", JSON.stringify({
64
70
  webda: {
65
71
  services: {
66
- "Authentication.providers.email.text": "Plop"
72
+ Authentication: {
73
+ providers: {
74
+ email: {
75
+ text: "Plop"
76
+ }
77
+ }
78
+ }
67
79
  }
68
80
  }
69
81
  }, undefined, 2));
@@ -79,4 +91,71 @@ __decorate([
79
91
  FileConfigurationServiceTest = __decorate([
80
92
  mocha_1.suite
81
93
  ], FileConfigurationServiceTest);
94
+ let FileConfigurationNoReloadServiceTest = class FileConfigurationNoReloadServiceTest extends test_1.WebdaTest {
95
+ getTestConfiguration() {
96
+ return __dirname + "/../../test/config-file-no-reload.json";
97
+ }
98
+ before() {
99
+ const _super = Object.create(null, {
100
+ before: { get: () => super.before }
101
+ });
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ (0, fs_1.writeFileSync)(__dirname + "/../../test/my-cnf.json", JSON.stringify({
104
+ webda: {
105
+ services: {
106
+ Authentication: {
107
+ providers: {
108
+ email: {
109
+ text: "Test2"
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }, undefined, 2));
116
+ yield _super.before.call(this);
117
+ });
118
+ }
119
+ initialLoad() {
120
+ return __awaiter(this, void 0, void 0, function* () {
121
+ assert.strictEqual(this.webda.getConfiguration().services.Authentication.providers.email.text, "Test2");
122
+ assert.strictEqual(this.webda.getConfiguration().services.Authentication.providers.email.mailer, "DefinedMailer");
123
+ });
124
+ }
125
+ };
126
+ __decorate([
127
+ mocha_1.test
128
+ ], FileConfigurationNoReloadServiceTest.prototype, "initialLoad", null);
129
+ FileConfigurationNoReloadServiceTest = __decorate([
130
+ mocha_1.suite
131
+ ], FileConfigurationNoReloadServiceTest);
132
+ let FileConfigurationNoReloadMissingServiceTest = class FileConfigurationNoReloadMissingServiceTest extends test_1.WebdaTest {
133
+ getTestConfiguration() {
134
+ return __dirname + "/../../test/config-file-no-reload.json";
135
+ }
136
+ before() {
137
+ const _super = Object.create(null, {
138
+ before: { get: () => super.before }
139
+ });
140
+ return __awaiter(this, void 0, void 0, function* () {
141
+ const filename = __dirname + "/../../test/my-cnf.json";
142
+ if ((0, fs_1.existsSync)(filename)) {
143
+ (0, fs_1.unlinkSync)(filename);
144
+ }
145
+ yield _super.before.call(this);
146
+ });
147
+ }
148
+ initialLoad() {
149
+ return __awaiter(this, void 0, void 0, function* () {
150
+ assert.strictEqual(this.webda.getConfiguration().services.Authentication.providers.email.text, "Test");
151
+ assert.strictEqual(this.webda.getConfiguration().services.Authentication.providers.email.mailer, "DefinedMailer");
152
+ });
153
+ }
154
+ };
155
+ __decorate([
156
+ mocha_1.test
157
+ ], FileConfigurationNoReloadMissingServiceTest.prototype, "initialLoad", null);
158
+ FileConfigurationNoReloadMissingServiceTest = __decorate([
159
+ mocha_1.suite
160
+ ], FileConfigurationNoReloadMissingServiceTest);
82
161
  //# sourceMappingURL=fileconfiguration.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fileconfiguration.spec.js","sourceRoot":"","sources":["../../src/services/fileconfiguration.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iCAAiC;AACjC,2CAA8C;AAC9C,kCAAoC;AACpC,2BAAiD;AACjD,2DAA+D;AAG/D,IAAM,4BAA4B,GAAlC,MAAM,4BAA6B,SAAQ,gBAAS;IAClD,oBAAoB;QAClB,OAAO,SAAS,GAAG,qCAAqC,CAAC;IAC3D,CAAC;IAEK,MAAM;;;;;YACV,IAAA,kBAAa,EACX,SAAS,GAAG,yBAAyB,EACrC,IAAI,CAAC,SAAS,CACZ;gBACE,KAAK,EAAE;oBACL,QAAQ,EAAE;wBACR,qCAAqC,EAAE,MAAM;qBAC9C;iBACF;aACF,EACD,SAAS,EACT,CAAC,CACF,CACF,CAAC;YACF,MAAM,OAAM,MAAM,WAAE,CAAC;QACvB,CAAC;KAAA;IAGK,WAAW;;YACf,MAAM,CAAC,OAAO,CACZ,GAAG,EAAE,CAAC,IAAI,4CAAwB,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EACnE,4CAA4C,CAC7C,CAAC;YACF,MAAM,CAAC,OAAO,CACZ,GAAG,EAAE,CAAC,IAAI,4CAAwB,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,MAA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,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACvG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;QACpH,CAAC;KAAA;CACF,CAAA;AA7CC;IADC,YAAI;+DA6CJ;AApEG,4BAA4B;IADjC,aAAK;GACA,4BAA4B,CAqEjC"}
1
+ {"version":3,"file":"fileconfiguration.spec.js","sourceRoot":"","sources":["../../src/services/fileconfiguration.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iCAAiC;AACjC,2CAA8C;AAC9C,kCAAoC;AACpC,2BAA2D;AAC3D,2DAA+D;AAG/D,IAAM,4BAA4B,GAAlC,MAAM,4BAA6B,SAAQ,gBAAS;IAClD,oBAAoB;QAClB,OAAO,SAAS,GAAG,qCAAqC,CAAC;IAC3D,CAAC;IAEK,MAAM;;;;;YACV,IAAA,kBAAa,EACX,SAAS,GAAG,yBAAyB,EACrC,IAAI,CAAC,SAAS,CACZ;gBACE,KAAK,EAAE;oBACL,QAAQ,EAAE;wBACR,cAAc,EAAE;4BACd,SAAS,EAAE;gCACT,KAAK,EAAE;oCACL,IAAI,EAAE,MAAM;iCACb;6BACF;yBACF;qBACF;iBACF;aACF,EACD,SAAS,EACT,CAAC,CACF,CACF,CAAC;YACF,MAAM,OAAM,MAAM,WAAE,CAAC;QACvB,CAAC;KAAA;IAGK,WAAW;;YACf,MAAM,CAAC,OAAO,CACZ,GAAG,EAAE,CAAC,IAAI,4CAAwB,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EACnE,4CAA4C,CAC7C,CAAC;YACF,MAAM,CAAC,OAAO,CACZ,GAAG,EAAE,CAAC,IAAI,4CAAwB,CAAC,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AC,CAAC;QACpH,CAAC;KAAA;CACF,CAAA;AAJC;IADC,YAAI;uEAIJ;AAjCG,oCAAoC;IADzC,aAAK;GACA,oCAAoC,CAkCzC;AAGD,IAAM,2CAA2C,GAAjD,MAAM,2CAA4C,SAAQ,gBAAS;IACjE,oBAAoB;QAClB,OAAO,SAAS,GAAG,wCAAwC,CAAC;IAC9D,CAAC;IAEK,MAAM;;;;;YACV,MAAM,QAAQ,GAAG,SAAS,GAAG,yBAAyB,CAAC;YACvD,IAAI,IAAA,eAAU,EAAC,QAAQ,CAAC,EAAE;gBACxB,IAAA,eAAU,EAAC,QAAQ,CAAC,CAAC;aACtB;YACD,MAAM,OAAM,MAAM,WAAE,CAAC;QACvB,CAAC;KAAA;IAGK,WAAW;;YACf,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACvG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;QACpH,CAAC;KAAA;CACF,CAAA;AAJC;IADC,YAAI;8EAIJ;AAjBG,2CAA2C;IADhD,aAAK;GACA,2CAA2C,CAkBhD"}
@@ -0,0 +1,196 @@
1
+ import { Store, Context, EventAuthenticationRegister, Ident, EventWithContext } from "../index";
2
+ import { AclModel } from "../models/aclmodel";
3
+ import { CoreModel } from "../models/coremodel";
4
+ import { User } from "../models/user";
5
+ import { Authentication } from "./authentication";
6
+ import { NotificationService } from "./notificationservice";
7
+ import { DeepPartial, ServiceParameters, Service } from "./service";
8
+ /**
9
+ * Emitted when an invitation is sent
10
+ */
11
+ export interface EventInvitationSent extends EventWithContext {
12
+ /**
13
+ * Invited users
14
+ */
15
+ users: User[];
16
+ /**
17
+ * Invited idents if user is not registered yet
18
+ */
19
+ idents: string[];
20
+ /**
21
+ * Metadata of the invite
22
+ */
23
+ metadata: any;
24
+ /**
25
+ * Object targetted by the invite
26
+ */
27
+ model: CoreModel;
28
+ }
29
+ /**
30
+ * Emitted when an invitation is removed
31
+ */
32
+ export interface EventInvitationRemoved extends EventWithContext {
33
+ /**
34
+ * Invited users id
35
+ */
36
+ users: string[];
37
+ /**
38
+ * Invited idents if user is not registered yet
39
+ */
40
+ idents: string[];
41
+ /**
42
+ * Metadata of the invite
43
+ */
44
+ metadata: any;
45
+ /**
46
+ * Object targetted by the invite
47
+ */
48
+ model: CoreModel;
49
+ }
50
+ /**
51
+ * Emitted when an invitation is accepted
52
+ */
53
+ export interface EventInvitationAnswered extends EventWithContext {
54
+ /**
55
+ * Object targetted by the invite
56
+ */
57
+ model: CoreModel;
58
+ /**
59
+ * Metadata of the invite
60
+ */
61
+ metadata: any;
62
+ /**
63
+ * If the invitation got accepted or not
64
+ */
65
+ accept: boolean;
66
+ }
67
+ /**
68
+ *
69
+ */
70
+ export declare class InvitationParameters extends ServiceParameters {
71
+ /**
72
+ * Name of the bean to use for Authentication
73
+ *
74
+ * @default Authentication
75
+ */
76
+ authenticationService: string;
77
+ /**
78
+ * Notification service
79
+ *
80
+ * @default Mailer
81
+ */
82
+ notificationService?: string;
83
+ /**
84
+ * Store to use
85
+ */
86
+ modelStore: string;
87
+ /**
88
+ * Used to store pending invitation
89
+ */
90
+ invitationStore: string;
91
+ /**
92
+ * Fields to duplicate
93
+ */
94
+ mapFields: string[];
95
+ /**
96
+ * Attribute to use for the mapping
97
+ */
98
+ mapAttribute: string;
99
+ /**
100
+ * Attribute where to store once the invitation is accepted
101
+ *
102
+ * If attribute is __acls, the multiple will be ignored and the storage
103
+ * will be compatible with AclModel
104
+ *
105
+ * Where to store within the model User
106
+ */
107
+ attribute: string;
108
+ /**
109
+ * Attribute where to store once the invitation is created and pending
110
+ *
111
+ * Where to store within the model Ident and User
112
+ */
113
+ pendingAttribute: string;
114
+ /**
115
+ * Define if several invitation can be accepted or just one
116
+ */
117
+ multiple: boolean;
118
+ /**
119
+ * Do not require a validation by the invitee
120
+ */
121
+ autoAccept: boolean;
122
+ /**
123
+ * Email template to send to the user
124
+ */
125
+ notification?: string;
126
+ constructor(params: any);
127
+ }
128
+ /**
129
+ * Allow to use invitation on AclModel
130
+ *
131
+ * Once you add a new ACE with a user, it will invite
132
+ * and act as Mapper
133
+ */
134
+ export default class InvitationService<T extends InvitationParameters = InvitationParameters> extends Service<T> {
135
+ authenticationService: Authentication;
136
+ notificationService: NotificationService;
137
+ invitationStore: Store<CoreModel>;
138
+ modelStore: Store<AclModel | CoreModel>;
139
+ /**
140
+ * @inheritdoc
141
+ */
142
+ loadParameters(params: DeepPartial<T>): InvitationParameters;
143
+ /**
144
+ * @inheritdoc
145
+ */
146
+ resolve(): void;
147
+ /**
148
+ * @inheritdoc
149
+ */
150
+ init(): Promise<void>;
151
+ /**
152
+ * Accept or refuse for an invitation
153
+ * @param ctx
154
+ * @param model
155
+ */
156
+ answerInvitation(ctx: Context, model: CoreModel): Promise<void>;
157
+ /**
158
+ * Update Model with pending and attribute
159
+ *
160
+ * @param model
161
+ */
162
+ protected updateModel(model: any): Promise<void>;
163
+ /**
164
+ * Uninvite from previous invitations
165
+ * @param ctx
166
+ * @param model
167
+ */
168
+ uninvite(ctx: Context, model: CoreModel): Promise<void>;
169
+ /**
170
+ * Remove a model invitation from user
171
+ * @param user
172
+ */
173
+ protected removeInvitationFromUser(user: string, model: string): Promise<void>;
174
+ /**
175
+ * Handle invitations all methods
176
+ *
177
+ * @param ctx
178
+ * @returns
179
+ */
180
+ invite(ctx: Context): Promise<void>;
181
+ addInvitationToUser(model: CoreModel, user: User, inviter: User, metadata: any, notification?: any): Promise<void>;
182
+ sendNotification(user: User | Ident, replacements: any): Promise<void>;
183
+ /**
184
+ * Return which attribute would be used to store the invitation on ident invitation object
185
+ * @param uuid
186
+ * @returns
187
+ */
188
+ getInvitationAttribute(uuid: string): string;
189
+ /**
190
+ * When a user register with an invited idents, managed the whole invitation process
191
+ *
192
+ * @param evt
193
+ * @returns
194
+ */
195
+ registrationListener(evt: EventAuthenticationRegister): Promise<void>;
196
+ }