@futdevpro/nts-dynamo 1.15.315 → 1.15.320

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 (51) hide show
  1. package/build/_collections/database-unavailable.util.d.ts +27 -0
  2. package/build/_collections/database-unavailable.util.d.ts.map +1 -0
  3. package/build/_collections/database-unavailable.util.js +55 -0
  4. package/build/_collections/database-unavailable.util.js.map +1 -0
  5. package/build/_modules/mcp/_models/control-models/mcp-tool-params.control-model.d.ts +8 -1
  6. package/build/_modules/mcp/_models/control-models/mcp-tool-params.control-model.d.ts.map +1 -1
  7. package/build/_modules/mcp/_models/control-models/mcp-tool-params.control-model.js +8 -1
  8. package/build/_modules/mcp/_models/control-models/mcp-tool-params.control-model.js.map +1 -1
  9. package/build/_modules/mcp/_services/dynts-mcp.adapter.d.ts.map +1 -1
  10. package/build/_modules/mcp/_services/dynts-mcp.adapter.js +13 -0
  11. package/build/_modules/mcp/_services/dynts-mcp.adapter.js.map +1 -1
  12. package/build/_modules/privacy-lifecycle/index.d.ts +2 -0
  13. package/build/_modules/privacy-lifecycle/index.d.ts.map +1 -1
  14. package/build/_modules/privacy-lifecycle/index.js +5 -1
  15. package/build/_modules/privacy-lifecycle/index.js.map +1 -1
  16. package/build/_modules/privacy-lifecycle/privacy-ledger.mongo-store.d.ts +92 -0
  17. package/build/_modules/privacy-lifecycle/privacy-ledger.mongo-store.d.ts.map +1 -0
  18. package/build/_modules/privacy-lifecycle/privacy-ledger.mongo-store.js +295 -0
  19. package/build/_modules/privacy-lifecycle/privacy-ledger.mongo-store.js.map +1 -0
  20. package/build/_modules/privacy-lifecycle/privacy-lifecycle.mongo-store.d.ts +136 -0
  21. package/build/_modules/privacy-lifecycle/privacy-lifecycle.mongo-store.d.ts.map +1 -0
  22. package/build/_modules/privacy-lifecycle/privacy-lifecycle.mongo-store.js +316 -0
  23. package/build/_modules/privacy-lifecycle/privacy-lifecycle.mongo-store.js.map +1 -0
  24. package/build/_modules/usage/index.d.ts +2 -0
  25. package/build/_modules/usage/index.d.ts.map +1 -1
  26. package/build/_modules/usage/index.js +2 -0
  27. package/build/_modules/usage/index.js.map +1 -1
  28. package/build/_modules/usage/usage-session-account-query.interface.d.ts +13 -0
  29. package/build/_modules/usage/usage-session-account-query.interface.d.ts.map +1 -0
  30. package/build/_modules/usage/usage-session-account-query.interface.js +3 -0
  31. package/build/_modules/usage/usage-session-account-query.interface.js.map +1 -0
  32. package/build/_modules/usage/usage-session-owner.interface.d.ts +15 -0
  33. package/build/_modules/usage/usage-session-owner.interface.d.ts.map +1 -0
  34. package/build/_modules/usage/usage-session-owner.interface.js +3 -0
  35. package/build/_modules/usage/usage-session-owner.interface.js.map +1 -0
  36. package/build/_modules/usage/usage.controller.d.ts +16 -0
  37. package/build/_modules/usage/usage.controller.d.ts.map +1 -1
  38. package/build/_modules/usage/usage.controller.js +42 -9
  39. package/build/_modules/usage/usage.controller.js.map +1 -1
  40. package/build/_modules/usage/usage.data-service.d.ts +41 -1
  41. package/build/_modules/usage/usage.data-service.d.ts.map +1 -1
  42. package/build/_modules/usage/usage.data-service.js +112 -0
  43. package/build/_modules/usage/usage.data-service.js.map +1 -1
  44. package/build/_services/base/db.service.d.ts.map +1 -1
  45. package/build/_services/base/db.service.js +7 -2
  46. package/build/_services/base/db.service.js.map +1 -1
  47. package/build/index.d.ts +1 -0
  48. package/build/index.d.ts.map +1 -1
  49. package/build/index.js +1 -0
  50. package/build/index.js.map +1 -1
  51. package/package.json +2 -2
@@ -0,0 +1,316 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DyNTS_PrivacyLifecycle_MongoStore = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const mongoose_1 = tslib_1.__importStar(require("mongoose"));
6
+ const DyNTS_privacyRequestModelName = 'DyNTSPrivacyRequest';
7
+ const DyNTS_privacyRequestPlanModelName = 'DyNTSPrivacyRequestPlan';
8
+ const DyNTS_privacyRequestOutcomeModelName = 'DyNTSPrivacyRequestOutcome';
9
+ /**
10
+ * Mongo persistence for the privacy lifecycle — the production `DyNTS_PrivacyLifecycleAdapter_Interface`.
11
+ *
12
+ * @description BFR-FUTDEVPRO-010 / BFR-ADVENTOR-025. Before this store the module shipped the contract only,
13
+ * so `DyNTS_PrivacyLifecycle_ControlService` (which REQUIRES an adapter) could not be started, and three
14
+ * products carried their own copies (company-toolmaker, futdevpro, adventor). This is the futdevpro copy,
15
+ * lifted verbatim in behaviour; the collection and model names are unchanged, so existing data stays readable.
16
+ *
17
+ * Atomicity does NOT need a transaction here — every guarantee is a single-document operation:
18
+ * - replay idempotency: the UNIQUE `idempotencyHash` index (the loser of a race reads the winner);
19
+ * - optimistic concurrency: `replaceRequest` puts `revision` INTO the filter, so a stale writer matches
20
+ * nothing and gets `false` (the caller turns that into a 409);
21
+ * - plan/outcome writes: an upsert on the UNIQUE `(requestId, contributorId)` pair.
22
+ *
23
+ * ⚠️ A broken revision check here is not "a bug": it is a lost or doubly executed erasure request —
24
+ * exactly the operation whose provability is the legal requirement (GDPR Art. 17).
25
+ *
26
+ * ⚠️ Consumers that carried a product-side copy must DELETE it in the same change-set that switches to this
27
+ * store: both register the same model names, and `resolveModel` silently returns whichever registered first.
28
+ */
29
+ class DyNTS_PrivacyLifecycle_MongoStore {
30
+ injected;
31
+ readiness;
32
+ /** Accepts isolated models for integration tests; production resolves the singletons lazily. */
33
+ constructor(set = {}) {
34
+ this.injected = set;
35
+ }
36
+ /**
37
+ * Creates the indexes BEFORE the first read or write.
38
+ *
39
+ * @description Not a convenience step: idempotency and optimistic concurrency both rest on the UNIQUE
40
+ * indexes. Without them a duplicate would not fail — it would silently become a second record.
41
+ */
42
+ async ensureReady() {
43
+ this.readiness ??= Promise.all([
44
+ this.getRequestModel().createIndexes(),
45
+ this.getPlanModel().createIndexes(),
46
+ this.getOutcomeModel().createIndexes(),
47
+ ])
48
+ .then(() => undefined)
49
+ .catch((error) => {
50
+ this.readiness = undefined;
51
+ throw error;
52
+ });
53
+ await this.readiness;
54
+ }
55
+ /**
56
+ * Creates one request, or returns the EXACT same request on an idempotent replay.
57
+ *
58
+ * @description The decision is not a racy "does it exist?" read (two parallel callers would both see
59
+ * "no"), but the UNIQUE index: the second writer gets a duplicate-key error and reads the winner.
60
+ */
61
+ async createOrGetRequest(request) {
62
+ try {
63
+ const created = await this.getRequestModel().create([request]);
64
+ const value = created[0]?.toObject();
65
+ if (!value) {
66
+ throw new Error('DYNTS|PRIVACY_LIFECYCLE|CREATE_EMPTY');
67
+ }
68
+ return { request: this.toRequestRecord(value), created: true };
69
+ }
70
+ catch (error) {
71
+ if (!this.isDuplicateKey(error)) {
72
+ throw error;
73
+ }
74
+ const existing = await this.getRequestModel()
75
+ .findOne({ idempotencyHash: request.idempotencyHash })
76
+ .lean().exec();
77
+ if (!existing) {
78
+ throw error;
79
+ }
80
+ return { request: this.toRequestRecord(existing), created: false };
81
+ }
82
+ }
83
+ /** Loads one request by id. Does not throw when missing — interpreting absence is the caller's job. */
84
+ async findRequestById(requestId) {
85
+ const found = await this.getRequestModel()
86
+ .findOne({ requestId: requestId })
87
+ .lean().exec();
88
+ return found ? this.toRequestRecord(found) : null;
89
+ }
90
+ /**
91
+ * One bounded, deterministic, newest-first page of the subject's own requests.
92
+ *
93
+ * @description Sorted by TWO keys (`createdAt`, then `requestId`): with a single key two requests created in
94
+ * the same millisecond would order non-deterministically and paging could skip or repeat a row
95
+ * (`createdAt` is ISO-8601 UTC text, so string order is time order). The cursor is opaque and carries no
96
+ * personal data — a timestamp and a machine id only.
97
+ */
98
+ async listRequests(query) {
99
+ const filter = {
100
+ subjectId: query.subjectId,
101
+ organizationId: query.organizationId,
102
+ };
103
+ const cursor = this.decodeCursor(query.cursor);
104
+ if (cursor) {
105
+ filter.$or = [
106
+ { createdAt: { $lt: cursor.createdAt } },
107
+ { createdAt: cursor.createdAt, requestId: { $lt: cursor.requestId } },
108
+ ];
109
+ }
110
+ // One MORE than the page size: "is there a next page?" is answered without a separate
111
+ // (and non-consistent) countDocuments call.
112
+ const found = await this.getRequestModel().find(filter)
113
+ .sort({ createdAt: -1, requestId: -1 })
114
+ .limit(query.limit + 1)
115
+ .lean().exec();
116
+ const page = found.slice(0, query.limit)
117
+ .map((row) => this.toRequestRecord(row));
118
+ const last = page[page.length - 1];
119
+ return {
120
+ requests: page,
121
+ nextCursor: found.length > query.limit && last ? this.encodeCursor(last) : '',
122
+ };
123
+ }
124
+ /**
125
+ * State transition with OPTIMISTIC CONCURRENCY.
126
+ *
127
+ * @description `revision` is part of the filter: if someone else rewrote the record meanwhile, the filter
128
+ * matches nothing and `false` is returned. That `false` is not an error — it is the correct answer to a
129
+ * race, and the caller turns it into a 409.
130
+ */
131
+ async replaceRequest(request, expectedRevision) {
132
+ const result = await this.getRequestModel().replaceOne({ requestId: request.requestId, revision: expectedRevision }, this.toRequestRecord(request)).exec();
133
+ return result.matchedCount === 1;
134
+ }
135
+ /**
136
+ * Stores one contributor plan.
137
+ *
138
+ * @description Overwrites, does not insert: a resumed run may deliver the same plan again. The upsert on the
139
+ * `(requestId, contributorId)` pair keeps it idempotent — never two plans for one contributor.
140
+ */
141
+ async saveContributorPlan(requestId, plan) {
142
+ await this.getPlanModel().updateOne({ requestId: requestId, contributorId: plan.contributorId }, { $set: { ...plan, requestId: requestId } }, { upsert: true }).exec();
143
+ }
144
+ /** All contributor plans of one request, in a stable order. */
145
+ async listContributorPlans(requestId) {
146
+ const rows = await this.getPlanModel().find({ requestId: requestId })
147
+ .sort({ contributorId: 1 }).lean().exec();
148
+ return rows.map((row) => ({
149
+ contributorId: row.contributorId,
150
+ action: row.action,
151
+ retentionBasisCode: row.retentionBasisCode,
152
+ }));
153
+ }
154
+ /**
155
+ * Stores one contributor outcome.
156
+ *
157
+ * @description The overwrite is not only for resumed runs: on a failed verification the lifecycle
158
+ * DELIBERATELY replaces an earlier (successful) outcome with a failed one — an insert-only store would make
159
+ * the request look falsely successful.
160
+ */
161
+ async saveContributorOutcome(requestId, outcome) {
162
+ await this.getOutcomeModel().updateOne({ requestId: requestId, contributorId: outcome.contributorId }, { $set: { ...outcome, requestId: requestId } }, { upsert: true }).exec();
163
+ }
164
+ /** All contributor outcomes of one request, in a stable order. */
165
+ async listContributorOutcomes(requestId) {
166
+ const rows = await this.getOutcomeModel().find({ requestId: requestId })
167
+ .sort({ contributorId: 1 }).lean().exec();
168
+ return rows.map((row) => ({
169
+ contributorId: row.contributorId,
170
+ action: row.action,
171
+ outcome: row.outcome,
172
+ retentionBasisCode: row.retentionBasisCode,
173
+ artifactChecksum: row.artifactChecksum,
174
+ processedRecordCount: row.processedRecordCount,
175
+ errorCode: row.errorCode,
176
+ completedAt: row.completedAt,
177
+ }));
178
+ }
179
+ /**
180
+ * The request-record schema.
181
+ *
182
+ * @description Date fields are `String`, not `Date`: the contract uses an EMPTY string for "has not happened
183
+ * yet" (`identityVerifiedAt: ''`), which a `Date` field cannot represent. `strict: 'throw'` is deliberate —
184
+ * an unknown field must not slip in silently.
185
+ */
186
+ static createRequestSchema() {
187
+ const schema = new mongoose_1.Schema({
188
+ requestId: { type: String, required: true, immutable: true, maxlength: 128 },
189
+ subjectId: { type: String, required: true, immutable: true, maxlength: 128 },
190
+ organizationId: { type: String, required: true, immutable: true, maxlength: 128 },
191
+ type: { type: String, required: true, immutable: true, maxlength: 64 },
192
+ state: { type: String, required: true, maxlength: 64 },
193
+ idempotencyHash: { type: String, required: true, immutable: true, match: /^[a-f0-9]{64}$/u },
194
+ revision: { type: Number, required: true, min: 0, validate: Number.isSafeInteger },
195
+ createdAt: { type: String, required: true, immutable: true, maxlength: 64 },
196
+ deadlineAt: { type: String, required: true, maxlength: 64 },
197
+ identityVerifiedAt: { type: String, default: '', maxlength: 64 },
198
+ scopedAt: { type: String, default: '', maxlength: 64 },
199
+ plannedAt: { type: String, default: '', maxlength: 64 },
200
+ executionStartedAt: { type: String, default: '', maxlength: 64 },
201
+ verifyingStartedAt: { type: String, default: '', maxlength: 64 },
202
+ completedAt: { type: String, default: '', maxlength: 64 },
203
+ cancelledAt: { type: String, default: '', maxlength: 64 },
204
+ }, {
205
+ collection: 'dynts_privacy_requests',
206
+ strict: 'throw',
207
+ versionKey: false,
208
+ });
209
+ schema.index({ idempotencyHash: 1 }, { unique: true, name: 'uq_dynts_privacy_request_idempotency' });
210
+ schema.index({ requestId: 1 }, { unique: true, name: 'uq_dynts_privacy_request_id' });
211
+ schema.index({ subjectId: 1, organizationId: 1, createdAt: -1, requestId: -1 }, { name: 'ix_dynts_privacy_request_subject_page' });
212
+ return schema;
213
+ }
214
+ /** The contributor-plan schema. */
215
+ static createPlanSchema() {
216
+ const schema = new mongoose_1.Schema({
217
+ requestId: { type: String, required: true, immutable: true, maxlength: 128 },
218
+ contributorId: { type: String, required: true, immutable: true, maxlength: 128 },
219
+ action: { type: String, required: true, maxlength: 64 },
220
+ retentionBasisCode: { type: String, default: '', maxlength: 128 },
221
+ }, {
222
+ collection: 'dynts_privacy_request_plans',
223
+ strict: 'throw',
224
+ versionKey: false,
225
+ });
226
+ schema.index({ requestId: 1, contributorId: 1 }, { unique: true, name: 'uq_dynts_privacy_plan_scope' });
227
+ return schema;
228
+ }
229
+ /** The contributor-outcome schema. */
230
+ static createOutcomeSchema() {
231
+ const schema = new mongoose_1.Schema({
232
+ requestId: { type: String, required: true, immutable: true, maxlength: 128 },
233
+ contributorId: { type: String, required: true, immutable: true, maxlength: 128 },
234
+ action: { type: String, required: true, maxlength: 64 },
235
+ outcome: { type: String, required: true, maxlength: 64 },
236
+ retentionBasisCode: { type: String, default: '', maxlength: 128 },
237
+ artifactChecksum: { type: String, default: '', maxlength: 128 },
238
+ processedRecordCount: { type: Number, required: true, min: 0, validate: Number.isSafeInteger },
239
+ errorCode: { type: String, default: '', maxlength: 128 },
240
+ completedAt: { type: String, required: true, maxlength: 64 },
241
+ }, {
242
+ collection: 'dynts_privacy_request_outcomes',
243
+ strict: 'throw',
244
+ versionKey: false,
245
+ });
246
+ schema.index({ requestId: 1, contributorId: 1 }, { unique: true, name: 'uq_dynts_privacy_outcome_scope' });
247
+ return schema;
248
+ }
249
+ /**
250
+ * The contract shape from a stored row — an ALLOW-list.
251
+ *
252
+ * @description `.lean()` also returns the persistence's own fields (`_id`). Passing them on, the lifecycle's
253
+ * `{ ...request }` spread would write them back — the filtering keeps the domain object clean.
254
+ */
255
+ toRequestRecord(row) {
256
+ return {
257
+ requestId: row.requestId,
258
+ subjectId: row.subjectId,
259
+ organizationId: row.organizationId,
260
+ type: row.type,
261
+ state: row.state,
262
+ idempotencyHash: row.idempotencyHash,
263
+ revision: row.revision,
264
+ createdAt: row.createdAt,
265
+ deadlineAt: row.deadlineAt,
266
+ identityVerifiedAt: row.identityVerifiedAt ?? '',
267
+ scopedAt: row.scopedAt ?? '',
268
+ plannedAt: row.plannedAt ?? '',
269
+ executionStartedAt: row.executionStartedAt ?? '',
270
+ verifyingStartedAt: row.verifyingStartedAt ?? '',
271
+ completedAt: row.completedAt ?? '',
272
+ cancelledAt: row.cancelledAt ?? '',
273
+ };
274
+ }
275
+ /** Opaque, but NOT encrypted, paging cursor — it holds no personal data. */
276
+ encodeCursor(record) {
277
+ return Buffer.from(`${record.createdAt}|${record.requestId}`, 'utf8').toString('base64url');
278
+ }
279
+ /**
280
+ * Decodes the cursor — FAIL-SAFE: a damaged or forged cursor restarts paging on the FIRST page.
281
+ *
282
+ * @description Not a security hole: the `subjectId` + `organizationId` filter is independent of the cursor,
283
+ * so the subject still sees only their own requests.
284
+ */
285
+ decodeCursor(cursor) {
286
+ if (!cursor) {
287
+ return undefined;
288
+ }
289
+ const parts = Buffer.from(cursor, 'base64url').toString('utf8').split('|');
290
+ return parts.length === 2 && parts[0] && parts[1]
291
+ ? { createdAt: parts[0], requestId: parts[1] }
292
+ : undefined;
293
+ }
294
+ getRequestModel() {
295
+ return this.injected.requestModel ?? this.resolveModel(DyNTS_privacyRequestModelName, DyNTS_PrivacyLifecycle_MongoStore.createRequestSchema());
296
+ }
297
+ getPlanModel() {
298
+ return this.injected.planModel ?? this.resolveModel(DyNTS_privacyRequestPlanModelName, DyNTS_PrivacyLifecycle_MongoStore.createPlanSchema());
299
+ }
300
+ getOutcomeModel() {
301
+ return this.injected.outcomeModel ?? this.resolveModel(DyNTS_privacyRequestOutcomeModelName, DyNTS_PrivacyLifecycle_MongoStore.createOutcomeSchema());
302
+ }
303
+ /** Lazy one-time model resolution — a second `mongoose.model(name, schema)` for one name would throw. */
304
+ resolveModel(name, schema) {
305
+ return mongoose_1.default.modelNames().includes(name)
306
+ ? mongoose_1.default.model(name)
307
+ : mongoose_1.default.model(name, schema);
308
+ }
309
+ /** Mongo duplicate-key error — the signal that carries the "idempotent replay" branch. */
310
+ isDuplicateKey(error) {
311
+ return typeof error === 'object' && error !== null && 'code' in error
312
+ && Object.getOwnPropertyDescriptor(error, 'code')?.value === 11000;
313
+ }
314
+ }
315
+ exports.DyNTS_PrivacyLifecycle_MongoStore = DyNTS_PrivacyLifecycle_MongoStore;
316
+ //# sourceMappingURL=privacy-lifecycle.mongo-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy-lifecycle.mongo-store.js","sourceRoot":"","sources":["../../../src/_modules/privacy-lifecycle/privacy-lifecycle.mongo-store.ts"],"names":[],"mappings":";;;;AAAA,6DAAqE;AAcrE,MAAM,6BAA6B,GAA0B,qBAAqB,CAAC;AACnF,MAAM,iCAAiC,GAA8B,yBAAyB,CAAC;AAC/F,MAAM,oCAAoC,GAAiC,4BAA4B,CAAC;AAexG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,iCAAiC;IAC3B,QAAQ,CAA4C;IAC7D,SAAS,CAAiB;IAElC,gGAAgG;IAChG,YAAY,MAAiD,EAAE;QAC7D,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,WAAW;QACtB,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,GAAG,CAAC;YAC7B,IAAI,CAAC,eAA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AAC,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE;YAC9C,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;IAEO,eAAe;QACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CACpD,6BAA6B,EAAE,iCAAiC,CAAC,mBAAmB,EAAE,CACvF,CAAC;IACJ,CAAC;IAEO,YAAY;QAClB,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,IAAI,IAAI,CAAC,YAAY,CACjD,iCAAiC,EAAE,iCAAiC,CAAC,gBAAgB,EAAE,CACxF,CAAC;IACJ,CAAC;IAEO,eAAe;QACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CACpD,oCAAoC,EAAE,iCAAiC,CAAC,mBAAmB,EAAE,CAC9F,CAAC;IACJ,CAAC;IAED,yGAAyG;IACjG,YAAY,CAAI,IAAY,EAAE,MAAiB;QACrD,OAAO,kBAAQ,CAAC,UAAU,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;YACzC,CAAC,CAAC,kBAAQ,CAAC,KAAK,CAAI,IAAI,CAAC;YACzB,CAAC,CAAC,kBAAQ,CAAC,KAAK,CAAI,IAAI,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;IAED,0FAA0F;IAClF,cAAc,CAAC,KAAc;QACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK;eAChE,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,KAAK,KAAK,KAAK,CAAC;IACvE,CAAC;CACF;AAtWD,8EAsWC"}
@@ -1,4 +1,6 @@
1
1
  export * from './usage.controller';
2
+ export * from './usage-session-owner.interface';
3
+ export * from './usage-session-account-query.interface';
2
4
  export * from './usage.data-service';
3
5
  export * from './get-usage-routing-module.util';
4
6
  export * from '@futdevpro/fsm-dynamo/usage';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/_modules/usage/index.ts"],"names":[],"mappings":"AAUA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/_modules/usage/index.ts"],"names":[],"mappings":"AAUA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC"}
@@ -8,6 +8,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
8
8
  const tslib_1 = require("tslib");
9
9
  // USAGE MODULE
10
10
  tslib_1.__exportStar(require("./usage.controller"), exports);
11
+ tslib_1.__exportStar(require("./usage-session-owner.interface"), exports);
12
+ tslib_1.__exportStar(require("./usage-session-account-query.interface"), exports);
11
13
  tslib_1.__exportStar(require("./usage.data-service"), exports);
12
14
  tslib_1.__exportStar(require("./get-usage-routing-module.util"), exports);
13
15
  tslib_1.__exportStar(require("@futdevpro/fsm-dynamo/usage"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/_modules/usage/index.ts"],"names":[],"mappings":";AAEA,EAAE;AACF,eAAe;AACf,EAAE;AACF,qEAAqE;AACrE,EAAE;;;AAGF,eAAe;AACf,6DAAmC;AACnC,+DAAqC;AACrC,0EAAgD;AAChD,sEAA4C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/_modules/usage/index.ts"],"names":[],"mappings":";AAEA,EAAE;AACF,eAAe;AACf,EAAE;AACF,qEAAqE;AACrE,EAAE;;;AAGF,eAAe;AACf,6DAAmC;AACnC,0EAAgD;AAChD,kFAAwD;AACxD,+DAAqC;AACrC,0EAAgD;AAChD,sEAA4C"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Identifies the sessions of one account (BFR-FUTDEVPRO-015).
3
+ */
4
+ export interface DyNTS_UsageSession_AccountQuery {
5
+ /** Account id — sessions since nts-dynamo 1.15.320 store it in `issuer` */
6
+ accountId: string;
7
+ /**
8
+ * Usernames the account has used. Sessions written BEFORE 1.15.320 stored the username in `issuer`
9
+ * (and nothing in `loggedInAs`), so without these the legacy sessions are NOT found.
10
+ */
11
+ legacyUsernames?: string[];
12
+ }
13
+ //# sourceMappingURL=usage-session-account-query.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage-session-account-query.interface.d.ts","sourceRoot":"","sources":["../../../src/_modules/usage/usage-session-account-query.interface.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,2EAA2E;IAC3E,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=usage-session-account-query.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage-session-account-query.interface.js","sourceRoot":"","sources":["../../../src/_modules/usage/usage-session-account-query.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The owner of a usage session, as resolved from the incoming request (BFR-FUTDEVPRO-015).
3
+ *
4
+ * - `accountId` is what goes into the session's `issuer` (`fdp-issuer-is-account-id`); `'unknown'` when
5
+ * the request carries no resolvable account (anonymous visitor, or optional-auth mode).
6
+ * - `username` goes into `loggedInAs`, and ONLY when an account was resolved — it exists so that legacy
7
+ * sessions (written before 1.15.320 with `issuer: <username>`) can still be linked to their account.
8
+ */
9
+ export interface DyNTS_UsageSessionOwner {
10
+ /** Account id of the session owner, or `'unknown'` */
11
+ accountId: string;
12
+ /** Username of the session owner; `undefined` for anonymous sessions */
13
+ username?: string;
14
+ }
15
+ //# sourceMappingURL=usage-session-owner.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage-session-owner.interface.d.ts","sourceRoot":"","sources":["../../../src/_modules/usage/usage-session-owner.interface.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAuB;IACtC,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=usage-session-owner.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage-session-owner.interface.js","sourceRoot":"","sources":["../../../src/_modules/usage/usage-session-owner.interface.ts"],"names":[],"mappings":""}
@@ -1,7 +1,23 @@
1
+ import { Request } from 'express';
1
2
  import { DyNTS_Controller } from '../../_services/route/controller.service';
3
+ import { DyNTS_UsageSessionOwner } from './usage-session-owner.interface';
2
4
  export declare class DyNTS_Usage_Controller extends DyNTS_Controller {
3
5
  static getInstance(): DyNTS_Usage_Controller;
4
6
  private authService;
5
7
  setupEndpoints(): void;
8
+ /**
9
+ * Resolves the owner of a new usage session (BFR-FUTDEVPRO-015).
10
+ *
11
+ * The `issuer` of a session is ALWAYS the account id (`fdp-issuer-is-account-id`) — before this fix it was
12
+ * the username, so account erasure could not find the sessions (which carry the visitor's IP address).
13
+ * The username is kept in `loggedInAs` only for logged-in sessions, as a bridge to legacy records.
14
+ *
15
+ * Never throws: the endpoint is public, so an absent/invalid token or a missing auth service
16
+ * (optional-auth mode, BFR-FDPPAL-001) yields an anonymous `'unknown'` owner.
17
+ *
18
+ * @param req the incoming request
19
+ * @returns the resolved owner
20
+ */
21
+ getSessionOwnerFromRequest(req: Request): DyNTS_UsageSessionOwner;
6
22
  }
7
23
  //# sourceMappingURL=usage.controller.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"usage.controller.d.ts","sourceRoot":"","sources":["../../../src/_modules/usage/usage.controller.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAG5E,qBAAa,sBAAuB,SAAQ,gBAAgB;IAE1D,MAAM,CAAC,WAAW,IAAI,sBAAsB;IAK5C,OAAO,CAAC,WAAW,CAAoB;IAEvC,cAAc,IAAI,IAAI;CAiHvB"}
1
+ {"version":3,"file":"usage.controller.d.ts","sourceRoot":"","sources":["../../../src/_modules/usage/usage.controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAY,MAAM,SAAS,CAAC;AAY5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAG1E,qBAAa,sBAAuB,SAAQ,gBAAgB;IAE1D,MAAM,CAAC,WAAW,IAAI,sBAAsB;IAK5C,OAAO,CAAC,WAAW,CAAoB;IAEvC,cAAc,IAAI,IAAI;IA8GtB;;;;;;;;;;;;OAYG;IACH,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,uBAAuB;CA4BlE"}
@@ -22,18 +22,14 @@ class DyNTS_Usage_Controller extends controller_service_1.DyNTS_Controller {
22
22
  endpoint: usage_1.DyFM_usageModule_settings.endPoints.newSession,
23
23
  tasks: [
24
24
  async (req, res, issuer) => {
25
- let username;
26
- try {
27
- // BFR-FDPPAL-001: optional-auth módban nincs auth service — a session issuer ilyenkor 'unknown'
28
- username = this.authService?.getUsernameFromRequest(req) ?? 'unknown';
29
- }
30
- catch {
31
- username = 'unknown';
32
- }
25
+ // BFR-FUTDEVPRO-015 / `fdp-issuer-is-account-id`: the session owner is the ACCOUNT ID —
26
+ // the session stores the IP address, so account erasure must be able to find it by accountId.
27
+ const owner = this.getSessionOwnerFromRequest(req);
33
28
  const usageService = new usage_data_service_1.DyNTS_Usage_DataService({
34
29
  usageSession: new usage_1.DyFM_UsageSession({
35
30
  sessionStart: new Date(),
36
- issuer: username,
31
+ issuer: owner.accountId,
32
+ loggedInAs: owner.username,
37
33
  }),
38
34
  issuer,
39
35
  });
@@ -101,6 +97,43 @@ class DyNTS_Usage_Controller extends controller_service_1.DyNTS_Controller {
101
97
  'the protected "getUsageData" endpoint is SKIPPED; session endpoints remain available.');
102
98
  }
103
99
  }
100
+ /**
101
+ * Resolves the owner of a new usage session (BFR-FUTDEVPRO-015).
102
+ *
103
+ * The `issuer` of a session is ALWAYS the account id (`fdp-issuer-is-account-id`) — before this fix it was
104
+ * the username, so account erasure could not find the sessions (which carry the visitor's IP address).
105
+ * The username is kept in `loggedInAs` only for logged-in sessions, as a bridge to legacy records.
106
+ *
107
+ * Never throws: the endpoint is public, so an absent/invalid token or a missing auth service
108
+ * (optional-auth mode, BFR-FDPPAL-001) yields an anonymous `'unknown'` owner.
109
+ *
110
+ * @param req the incoming request
111
+ * @returns the resolved owner
112
+ */
113
+ getSessionOwnerFromRequest(req) {
114
+ let accountId;
115
+ try {
116
+ accountId = this.authService?.getIssuerFromRequest(req);
117
+ }
118
+ catch {
119
+ accountId = undefined;
120
+ }
121
+ if (!accountId) {
122
+ return { accountId: 'unknown' };
123
+ }
124
+ let username;
125
+ try {
126
+ username = this.authService?.getUsernameFromRequest(req);
127
+ }
128
+ catch {
129
+ username = undefined;
130
+ }
131
+ // the default auth service answers 'anonymous' when there is no username — that is not a username
132
+ if (!username || username === 'anonymous' || username === 'unknown') {
133
+ username = undefined;
134
+ }
135
+ return { accountId: accountId, username: username };
136
+ }
104
137
  }
105
138
  exports.DyNTS_Usage_Controller = DyNTS_Usage_Controller;
106
139
  //# sourceMappingURL=usage.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usage.controller.js","sourceRoot":"","sources":["../../../src/_modules/usage/usage.controller.ts"],"names":[],"mappings":";;;AAGA,sDAAuF;AACvF,uDAEqC;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CAAC;aAAM,CAAC;YACN,qBAAQ,CAAC,IAAI,CACX,iEAAiE;gBACjE,uFAAuF,CACxF,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,0BAA0B,CAAC,GAAY;QACrC,IAAI,SAA6B,CAAC;QAElC,IAAI,CAAC;YACH,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC;QAC1D,CAAC;QAAC,MAAM,CAAC;YACP,SAAS,GAAG,SAAS,CAAC;QACxB,CAAC;QAED,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;QAClC,CAAC;QAED,IAAI,QAA4B,CAAC;QAEjC,IAAI,CAAC;YACH,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,sBAAsB,CAAC,GAAG,CAAC,CAAC;QAC3D,CAAC;QAAC,MAAM,CAAC;YACP,QAAQ,GAAG,SAAS,CAAC;QACvB,CAAC;QAED,kGAAkG;QAClG,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,WAAW,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YACpE,QAAQ,GAAG,SAAS,CAAC;QACvB,CAAC;QAED,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACtD,CAAC;CACF;AAhKD,wDAgKC"}
@@ -1,7 +1,8 @@
1
1
  import { Request } from 'express';
2
- import { DyFM_RelativeDate } from '@futdevpro/fsm-dynamo';
2
+ import { DyFM_DBFilter, DyFM_RelativeDate } from '@futdevpro/fsm-dynamo';
3
3
  import { DyFM_DailyUsageData, DyFM_UsageData, DyFM_UsageSession } from '@futdevpro/fsm-dynamo/usage';
4
4
  import { DyNTS_DataService } from '../../_services/base/data.service';
5
+ import { DyNTS_UsageSession_AccountQuery } from './usage-session-account-query.interface';
5
6
  export declare class DyNTS_Usage_DataService extends DyNTS_DataService<DyFM_UsageSession> {
6
7
  usageData: DyFM_UsageData[];
7
8
  simplifiedDailyUsage: DyFM_DailyUsageData[];
@@ -11,6 +12,45 @@ export declare class DyNTS_Usage_DataService extends DyNTS_DataService<DyFM_Usag
11
12
  issuer: string;
12
13
  });
13
14
  getLocationDataFromRequest(req: Request): void;
15
+ /**
16
+ * Builds the filter that matches every session of one account (BFR-FUTDEVPRO-015, `L-24`):
17
+ * - `issuer === accountId` — sessions since 1.15.320;
18
+ * - `issuer === <username>` — legacy sessions (before 1.15.320 the username was the issuer);
19
+ * - `loggedInAs === <username>` — sessions carrying the username as bridge.
20
+ *
21
+ * FAIL-CLOSED: throws on a missing / placeholder `accountId`, and silently drops placeholder usernames —
22
+ * `'unknown'` / `'anonymous'` is shared by all anonymous sessions and must never become a match key.
23
+ *
24
+ * @param set the account and its known usernames
25
+ * @returns a DB filter (`$or`)
26
+ */
27
+ static getAccountSessionFilter(set: DyNTS_UsageSession_AccountQuery): DyFM_DBFilter<DyFM_UsageSession>;
28
+ /**
29
+ * Lists every session of one account — including soft-deleted ones (data-subject access / export).
30
+ *
31
+ * @param set the account and its known usernames
32
+ * @returns the sessions (they contain the IP address and location)
33
+ */
34
+ findSessionsOfAccount(set: DyNTS_UsageSession_AccountQuery): Promise<DyFM_UsageSession[]>;
35
+ /**
36
+ * HARD-deletes every session of one account (account erasure, `L-24`) — the sessions hold the IP
37
+ * address, so a soft delete is not enough.
38
+ *
39
+ * @param set the account and its known usernames
40
+ * @returns the number of deleted sessions
41
+ */
42
+ deleteSessionsOfAccount(set: DyNTS_UsageSession_AccountQuery): Promise<number>;
43
+ /**
44
+ * One-off migration of legacy sessions (before 1.15.320) to the account id: every session whose `issuer`
45
+ * is the given username gets `issuer: accountId` and `loggedInAs: username`. Idempotent.
46
+ * Run it per account, from a source that maps username → accountId (e.g. the user collection).
47
+ *
48
+ * @param set the account id and the username it used to be recorded under
49
+ */
50
+ relinkLegacySessions(set: {
51
+ accountId: string;
52
+ username: string;
53
+ }): Promise<void>;
14
54
  getUsage(range?: DyFM_RelativeDate): Promise<void>;
15
55
  updateUsageData(req: Request): Promise<void>;
16
56
  closeSession(req: Request): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"usage.data-service.d.ts","sourceRoot":"","sources":["../../../src/_modules/usage/usage.data-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,EAAc,iBAAiB,EAAa,MAAM,uBAAuB,CAAC;AACjF,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAGtE,qBAAa,uBAAwB,SAAQ,iBAAiB,CAAC,iBAAiB,CAAC;IAC/E,SAAS,EAAE,cAAc,EAAE,CAAM;IACjC,oBAAoB,EAAE,mBAAmB,EAAE,CAAM;gBAG/C,GAAG,EAAE;QACH,YAAY,CAAC,EAAE,iBAAiB,CAAC;QACjC,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;QAC7B,MAAM,EAAE,MAAM,CAAC;KAChB;IAUH,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAgBxC,QAAQ,CAAC,KAAK,GAAE,iBAA8C,GAAG,OAAO,CAAC,IAAI,CAAC;IA4D9E,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAuC5C,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAqChD"}
1
+ {"version":3,"file":"usage.data-service.d.ts","sourceRoot":"","sources":["../../../src/_modules/usage/usage.data-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,EAAE,aAAa,EAAc,iBAAiB,EAAa,MAAM,uBAAuB,CAAC;AAChG,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACl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