sinfactura-types 1.10.345 → 1.10.347
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account.d.ts +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/socket.js +18 -6
- package/dist/cjs/survey.js +63 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inventory.d.ts +41 -1
- package/dist/socket.js +18 -6
- package/dist/supplier.d.ts +13 -0
- package/dist/survey.d.ts +82 -0
- package/dist/survey.js +60 -0
- package/dist/user.d.ts +16 -0
- package/dist/userActivity.d.ts +19 -1
- package/package.json +1 -1
package/dist/account.d.ts
CHANGED
|
@@ -154,7 +154,7 @@ declare global {
|
|
|
154
154
|
* bucket — rows that carried no `currency` of their own — which the
|
|
155
155
|
* reader resolves against `store.config.displayCurrency`.
|
|
156
156
|
*
|
|
157
|
-
* This map, not a scalar, is what
|
|
157
|
+
* This map, not a scalar, is what every checkpoint writer persists. The scalar
|
|
158
158
|
* {@link Account.balance} is the legacy shape the tolerant reader still
|
|
159
159
|
* accepts on rows written before the map existed.
|
|
160
160
|
*/
|
package/dist/cjs/index.js
CHANGED
|
@@ -82,6 +82,7 @@ __exportStar(require("./storefrontEvent.js"), exports);
|
|
|
82
82
|
__exportStar(require("./subscription.js"), exports);
|
|
83
83
|
__exportStar(require("./support.js"), exports);
|
|
84
84
|
__exportStar(require("./supplier.js"), exports);
|
|
85
|
+
__exportStar(require("./survey.js"), exports);
|
|
85
86
|
__exportStar(require("./user.js"), exports);
|
|
86
87
|
__exportStar(require("./userActivity.js"), exports);
|
|
87
88
|
__exportStar(require("./valuation.js"), exports);
|
package/dist/cjs/socket.js
CHANGED
|
@@ -214,12 +214,17 @@ exports.SOCKET_ACTIONS = [
|
|
|
214
214
|
* writes up to one per leg; a client that needs it reads
|
|
215
215
|
* `GET /inventory?mode=movements`.
|
|
216
216
|
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
* `stacks/lambdas/inventory
|
|
220
|
-
* adjustment, write-off, transfer,
|
|
221
|
-
*
|
|
222
|
-
*
|
|
217
|
+
* `postInventoryLevelFrames` (`stacks/lambdas/inventory/_shared.ts`) is the
|
|
218
|
+
* one function that emits this frame, but it has TWO call sites, not one:
|
|
219
|
+
* `POST /inventory`'s `commitMovement` chokepoint (`stacks/lambdas/inventory/`,
|
|
220
|
+
* covering every write mode — receipt, adjustment, write-off, transfer,
|
|
221
|
+
* reserve and release) AND `POST /transfers`' dispatch and per-line-arrival
|
|
222
|
+
* handlers (`stacks/lambdas/transfers/_dispatch.ts`, `_receive.ts`), which
|
|
223
|
+
* call it directly to restate the same two locations' balances a transfer
|
|
224
|
+
* moved stock between. See `'stockTransfers'` below for that domain's own
|
|
225
|
+
* frame. The GET modes emit nothing, and `dynamoUpdate` is not involved at
|
|
226
|
+
* all — these rows live on the inventory satellite table, which no generic
|
|
227
|
+
* row writer touches.
|
|
223
228
|
*/
|
|
224
229
|
'inventory',
|
|
225
230
|
'invoices',
|
|
@@ -522,6 +527,13 @@ exports.SOCKET_ACTIONS = [
|
|
|
522
527
|
* close short arrivals, and the difference is a loss that needs its own
|
|
523
528
|
* adjustment. A client must read the line quantities rather than inferring
|
|
524
529
|
* completeness from the status.
|
|
530
|
+
*
|
|
531
|
+
* ⚠️ **This is not the only frame a transfer write emits.** Dispatch and a
|
|
532
|
+
* per-line arrival also call `postInventoryLevelFrames` directly
|
|
533
|
+
* (`stacks/lambdas/transfers/_dispatch.ts`, `_receive.ts`) to restate the
|
|
534
|
+
* per-location `'inventory'` balance at both ends of the move — see
|
|
535
|
+
* `'inventory'` above. A client reconciling socket traffic against its
|
|
536
|
+
* `POST /transfers` request log should expect both actions.
|
|
525
537
|
*/
|
|
526
538
|
'stockTransfers',
|
|
527
539
|
];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* A shopper's post-order satisfaction survey, as its OWN entity.
|
|
4
|
+
*
|
|
5
|
+
* ## Why an entity and not just the three fields on the order
|
|
6
|
+
*
|
|
7
|
+
* The survey used to live entirely on the order row — `rating`, `comment`,
|
|
8
|
+
* `surveyDate` — which makes "show me this store's survey results" a walk of
|
|
9
|
+
* every order the store has ever taken, filtered on an attribute most of them do
|
|
10
|
+
* not carry. A survey is a small, rarely-written row and an order is a large,
|
|
11
|
+
* constantly-rewritten one; keeping the answers in their own partition makes the
|
|
12
|
+
* operator read a single bounded query.
|
|
13
|
+
*
|
|
14
|
+
* The three order fields STAY, deliberately, as a denormalised read convenience
|
|
15
|
+
* for everything that already renders an order: they are written in the SAME
|
|
16
|
+
* transaction as the survey row, so the two can never disagree.
|
|
17
|
+
*
|
|
18
|
+
* ## The subject reference
|
|
19
|
+
*
|
|
20
|
+
* `subjectType` + `subjectId` are what makes this a SURVEY entity rather than an
|
|
21
|
+
* order-survey entity. Today exactly one writer exists and it writes
|
|
22
|
+
* `subjectType: 'order'`; nothing else is minted, and a consumer must not assume
|
|
23
|
+
* a second type is reachable until a writer for one exists.
|
|
24
|
+
*
|
|
25
|
+
* ## Retention — Ley 25.326
|
|
26
|
+
*
|
|
27
|
+
* {@link Survey.comment} is unstructured free text a shopper typed, so it is
|
|
28
|
+
* personal data: it can name people, carry a phone number, or describe a
|
|
29
|
+
* household. It is therefore NOT kept indefinitely. Every survey row is written
|
|
30
|
+
* with a storage-only `ttl` of {@link SURVEY_RETENTION_MONTHS} months from
|
|
31
|
+
* submission (⚠️ NOT declared on this shape — it is DynamoDB housekeeping, is
|
|
32
|
+
* stripped on the way out, and a published `ttl` is refused by
|
|
33
|
+
* `tests/unit/publishedContractSurface.test.ts`) and is
|
|
34
|
+
* reaped by DynamoDB's own TTL — that reaping IS the erasure path, so no
|
|
35
|
+
* operator action and no job is needed for the ordinary case, and an erasure
|
|
36
|
+
* request ahead of it is served by deleting the row (and the order's
|
|
37
|
+
* denormalised copy) directly.
|
|
38
|
+
*
|
|
39
|
+
* ⚠️ **The comment is never logged, never emitted as an analytics event, and
|
|
40
|
+
* never put in a Sentry tag.** The storefront-events stream deliberately carries
|
|
41
|
+
* the rating without it (`SurveySubmittedEvent`), and an error path that echoes
|
|
42
|
+
* a request body would defeat that — see `docs/VALIDATION.md`.
|
|
43
|
+
*
|
|
44
|
+
* ## Forward-only
|
|
45
|
+
*
|
|
46
|
+
* Surveys submitted before this entity existed live ONLY on their order row and
|
|
47
|
+
* are not migrated. The operator read answers from the `SURVEY#` partition
|
|
48
|
+
* alone, so its results begin at this change.
|
|
49
|
+
*/
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.SURVEY_PAGE_MAX = exports.SURVEY_RETENTION_MONTHS = void 0;
|
|
52
|
+
/**
|
|
53
|
+
* Months a survey row survives before DynamoDB's TTL reaps it.
|
|
54
|
+
*
|
|
55
|
+
* 24 months: long enough that a store can compare this year's satisfaction
|
|
56
|
+
* against last year's — the only reason to keep a survey at all — and short
|
|
57
|
+
* enough that free text a shopper typed is not held for the lifetime of the
|
|
58
|
+
* tenant. A longer window would need a purpose to justify it under Ley 25.326;
|
|
59
|
+
* there isn't one.
|
|
60
|
+
*/
|
|
61
|
+
exports.SURVEY_RETENTION_MONTHS = 24;
|
|
62
|
+
/** Largest page an operator survey read will answer with. */
|
|
63
|
+
exports.SURVEY_PAGE_MAX = 100;
|
package/dist/index.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export * from './storefrontEvent.ts';
|
|
|
58
58
|
export * from './subscription.ts';
|
|
59
59
|
export * from './support.ts';
|
|
60
60
|
export * from './supplier.ts';
|
|
61
|
+
export * from './survey.ts';
|
|
61
62
|
export * from './user.ts';
|
|
62
63
|
export * from './userActivity.ts';
|
|
63
64
|
export * from './valuation.ts';
|
package/dist/index.js
CHANGED
|
@@ -66,6 +66,7 @@ export * from "./storefrontEvent.js";
|
|
|
66
66
|
export * from "./subscription.js";
|
|
67
67
|
export * from "./support.js";
|
|
68
68
|
export * from "./supplier.js";
|
|
69
|
+
export * from "./survey.js";
|
|
69
70
|
export * from "./user.js";
|
|
70
71
|
export * from "./userActivity.js";
|
|
71
72
|
export * from "./valuation.js";
|
package/dist/inventory.d.ts
CHANGED
|
@@ -783,7 +783,16 @@ declare global {
|
|
|
783
783
|
receivedAt?: number;
|
|
784
784
|
/** Operator note. ⚠️ Never personal data — this row is not scrubbed and has no TTL. */
|
|
785
785
|
notes?: string;
|
|
786
|
-
/**
|
|
786
|
+
/**
|
|
787
|
+
* Lowercase '#'-joined write-side index. Internal; not part of the read
|
|
788
|
+
* contract.
|
|
789
|
+
*
|
|
790
|
+
* ⚠️ **Never present on a transfer that reached a client**, on either the
|
|
791
|
+
* REST body or the socket frame: every read path strips it, exactly as the
|
|
792
|
+
* keys and the open-index attributes are stripped. It is declared here only
|
|
793
|
+
* because it is part of the STORED shape a writer builds. A consumer that
|
|
794
|
+
* reads it is reading a field that is contractually absent.
|
|
795
|
+
*/
|
|
787
796
|
search?: string;
|
|
788
797
|
/** Soft delete. ⚠️ Movements written by the transfer survive it — they are real moves. */
|
|
789
798
|
disabled?: boolean;
|
|
@@ -865,6 +874,37 @@ declare global {
|
|
|
865
874
|
/** True when the ledger half was already there and only the projection moved. */
|
|
866
875
|
replayed: boolean;
|
|
867
876
|
}
|
|
877
|
+
/**
|
|
878
|
+
* ONE row of "what is still in flight" — the unaltered wire shape of the
|
|
879
|
+
* transfers list in its `open` mode.
|
|
880
|
+
*
|
|
881
|
+
* ⚠️ **A PROJECTION, not a `StockTransfer`.** It is served from the sparse
|
|
882
|
+
* `openTransferKey-openTransferRef` index, whose projection deliberately
|
|
883
|
+
* omits `items`: the lines are the bulk of the document and projecting a list
|
|
884
|
+
* attribute would put the whole thing into the index that exists to stay
|
|
885
|
+
* small. A consumer that needs the lines reads the transfer by id — it must
|
|
886
|
+
* NOT read an absent `items` as "a transfer with no lines", which is the
|
|
887
|
+
* failure typing this as a `StockTransfer` would produce.
|
|
888
|
+
*
|
|
889
|
+
* ⚠️ Every member here is `status`-open by construction
|
|
890
|
+
* (`draft | in_transit | partially_received`); a terminal transfer leaves the
|
|
891
|
+
* index in the same write that closes it, so this shape never carries one.
|
|
892
|
+
*
|
|
893
|
+
* ⚠️ `disabled` is NOT projected and therefore not declared: the open list
|
|
894
|
+
* cannot be filtered by it, and a consumer must not infer that an entry is
|
|
895
|
+
* live.
|
|
896
|
+
*/
|
|
897
|
+
interface OpenStockTransferSummary {
|
|
898
|
+
storeId: string;
|
|
899
|
+
transferId: string;
|
|
900
|
+
status: StockTransferStatus;
|
|
901
|
+
fromWarehouseId: string;
|
|
902
|
+
toWarehouseId: string;
|
|
903
|
+
userId: string;
|
|
904
|
+
createdAt: number;
|
|
905
|
+
updatedAt: number;
|
|
906
|
+
shippedAt?: number;
|
|
907
|
+
}
|
|
868
908
|
/**
|
|
869
909
|
* How a multi-location store chooses which warehouse fills a line.
|
|
870
910
|
*
|
package/dist/socket.js
CHANGED
|
@@ -211,12 +211,17 @@ export const SOCKET_ACTIONS = [
|
|
|
211
211
|
* writes up to one per leg; a client that needs it reads
|
|
212
212
|
* `GET /inventory?mode=movements`.
|
|
213
213
|
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* `stacks/lambdas/inventory
|
|
217
|
-
* adjustment, write-off, transfer,
|
|
218
|
-
*
|
|
219
|
-
*
|
|
214
|
+
* `postInventoryLevelFrames` (`stacks/lambdas/inventory/_shared.ts`) is the
|
|
215
|
+
* one function that emits this frame, but it has TWO call sites, not one:
|
|
216
|
+
* `POST /inventory`'s `commitMovement` chokepoint (`stacks/lambdas/inventory/`,
|
|
217
|
+
* covering every write mode — receipt, adjustment, write-off, transfer,
|
|
218
|
+
* reserve and release) AND `POST /transfers`' dispatch and per-line-arrival
|
|
219
|
+
* handlers (`stacks/lambdas/transfers/_dispatch.ts`, `_receive.ts`), which
|
|
220
|
+
* call it directly to restate the same two locations' balances a transfer
|
|
221
|
+
* moved stock between. See `'stockTransfers'` below for that domain's own
|
|
222
|
+
* frame. The GET modes emit nothing, and `dynamoUpdate` is not involved at
|
|
223
|
+
* all — these rows live on the inventory satellite table, which no generic
|
|
224
|
+
* row writer touches.
|
|
220
225
|
*/
|
|
221
226
|
'inventory',
|
|
222
227
|
'invoices',
|
|
@@ -519,6 +524,13 @@ export const SOCKET_ACTIONS = [
|
|
|
519
524
|
* close short arrivals, and the difference is a loss that needs its own
|
|
520
525
|
* adjustment. A client must read the line quantities rather than inferring
|
|
521
526
|
* completeness from the status.
|
|
527
|
+
*
|
|
528
|
+
* ⚠️ **This is not the only frame a transfer write emits.** Dispatch and a
|
|
529
|
+
* per-line arrival also call `postInventoryLevelFrames` directly
|
|
530
|
+
* (`stacks/lambdas/transfers/_dispatch.ts`, `_receive.ts`) to restate the
|
|
531
|
+
* per-location `'inventory'` balance at both ends of the move — see
|
|
532
|
+
* `'inventory'` above. A client reconciling socket traffic against its
|
|
533
|
+
* `POST /transfers` request log should expect both actions.
|
|
522
534
|
*/
|
|
523
535
|
'stockTransfers',
|
|
524
536
|
];
|
package/dist/supplier.d.ts
CHANGED
|
@@ -21,6 +21,12 @@ declare global {
|
|
|
21
21
|
currencyId: string;
|
|
22
22
|
service: boolean;
|
|
23
23
|
disabled: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Net payment terms in DAYS, 0–365 (0 = payable on receipt). Optional and
|
|
26
|
+
* never defaulted: forward-only, so a row written before the field existed
|
|
27
|
+
* simply has none and readers must not read absence as `0`.
|
|
28
|
+
*/
|
|
29
|
+
paymentTermsDays?: number;
|
|
24
30
|
}
|
|
25
31
|
interface SupplierInvoice {
|
|
26
32
|
storeId: string;
|
|
@@ -31,6 +37,13 @@ declare global {
|
|
|
31
37
|
* without it (normal persisted attribute, NOT key-derived).
|
|
32
38
|
*/
|
|
33
39
|
supplierId?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Denormalized supplier name. Server-authored whenever `supplierId` names a
|
|
42
|
+
* catalogue row (the row's `company` wins over the body); otherwise it is
|
|
43
|
+
* the free name the body sent, for the one-off-vendor case. Optional and
|
|
44
|
+
* forward-only — rows written before it existed carry none.
|
|
45
|
+
*/
|
|
46
|
+
supplierName?: string;
|
|
34
47
|
createdAt: number;
|
|
35
48
|
type: 'FAC' | 'ND' | 'NC';
|
|
36
49
|
dated: number;
|
package/dist/survey.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A shopper's post-order satisfaction survey, as its OWN entity.
|
|
3
|
+
*
|
|
4
|
+
* ## Why an entity and not just the three fields on the order
|
|
5
|
+
*
|
|
6
|
+
* The survey used to live entirely on the order row — `rating`, `comment`,
|
|
7
|
+
* `surveyDate` — which makes "show me this store's survey results" a walk of
|
|
8
|
+
* every order the store has ever taken, filtered on an attribute most of them do
|
|
9
|
+
* not carry. A survey is a small, rarely-written row and an order is a large,
|
|
10
|
+
* constantly-rewritten one; keeping the answers in their own partition makes the
|
|
11
|
+
* operator read a single bounded query.
|
|
12
|
+
*
|
|
13
|
+
* The three order fields STAY, deliberately, as a denormalised read convenience
|
|
14
|
+
* for everything that already renders an order: they are written in the SAME
|
|
15
|
+
* transaction as the survey row, so the two can never disagree.
|
|
16
|
+
*
|
|
17
|
+
* ## The subject reference
|
|
18
|
+
*
|
|
19
|
+
* `subjectType` + `subjectId` are what makes this a SURVEY entity rather than an
|
|
20
|
+
* order-survey entity. Today exactly one writer exists and it writes
|
|
21
|
+
* `subjectType: 'order'`; nothing else is minted, and a consumer must not assume
|
|
22
|
+
* a second type is reachable until a writer for one exists.
|
|
23
|
+
*
|
|
24
|
+
* ## Retention — Ley 25.326
|
|
25
|
+
*
|
|
26
|
+
* {@link Survey.comment} is unstructured free text a shopper typed, so it is
|
|
27
|
+
* personal data: it can name people, carry a phone number, or describe a
|
|
28
|
+
* household. It is therefore NOT kept indefinitely. Every survey row is written
|
|
29
|
+
* with a storage-only `ttl` of {@link SURVEY_RETENTION_MONTHS} months from
|
|
30
|
+
* submission (⚠️ NOT declared on this shape — it is DynamoDB housekeeping, is
|
|
31
|
+
* stripped on the way out, and a published `ttl` is refused by
|
|
32
|
+
* `tests/unit/publishedContractSurface.test.ts`) and is
|
|
33
|
+
* reaped by DynamoDB's own TTL — that reaping IS the erasure path, so no
|
|
34
|
+
* operator action and no job is needed for the ordinary case, and an erasure
|
|
35
|
+
* request ahead of it is served by deleting the row (and the order's
|
|
36
|
+
* denormalised copy) directly.
|
|
37
|
+
*
|
|
38
|
+
* ⚠️ **The comment is never logged, never emitted as an analytics event, and
|
|
39
|
+
* never put in a Sentry tag.** The storefront-events stream deliberately carries
|
|
40
|
+
* the rating without it (`SurveySubmittedEvent`), and an error path that echoes
|
|
41
|
+
* a request body would defeat that — see `docs/VALIDATION.md`.
|
|
42
|
+
*
|
|
43
|
+
* ## Forward-only
|
|
44
|
+
*
|
|
45
|
+
* Surveys submitted before this entity existed live ONLY on their order row and
|
|
46
|
+
* are not migrated. The operator read answers from the `SURVEY#` partition
|
|
47
|
+
* alone, so its results begin at this change.
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* Months a survey row survives before DynamoDB's TTL reaps it.
|
|
51
|
+
*
|
|
52
|
+
* 24 months: long enough that a store can compare this year's satisfaction
|
|
53
|
+
* against last year's — the only reason to keep a survey at all — and short
|
|
54
|
+
* enough that free text a shopper typed is not held for the lifetime of the
|
|
55
|
+
* tenant. A longer window would need a purpose to justify it under Ley 25.326;
|
|
56
|
+
* there isn't one.
|
|
57
|
+
*/
|
|
58
|
+
export declare const SURVEY_RETENTION_MONTHS = 24;
|
|
59
|
+
/** Largest page an operator survey read will answer with. */
|
|
60
|
+
export declare const SURVEY_PAGE_MAX = 100;
|
|
61
|
+
declare global {
|
|
62
|
+
/** What a survey is ABOUT. Only `'order'` is minted today — see the module docblock. */
|
|
63
|
+
type SurveySubjectType = 'order';
|
|
64
|
+
interface Survey {
|
|
65
|
+
/** `SVY` + a zero-padded store-scoped counter. */
|
|
66
|
+
surveyId: string;
|
|
67
|
+
storeId: string;
|
|
68
|
+
/** What this survey rates. */
|
|
69
|
+
subjectType: SurveySubjectType;
|
|
70
|
+
/** The rated thing's own id — an `ORD…` for `subjectType: 'order'`. */
|
|
71
|
+
subjectId: string;
|
|
72
|
+
/** The customer who answered. */
|
|
73
|
+
customerId: string;
|
|
74
|
+
/** 1 (Malo) to 4 (Excelente). */
|
|
75
|
+
rating: number;
|
|
76
|
+
/** Free text the shopper typed, `''` when they left it blank. ⚠️ Personal data — never logged. */
|
|
77
|
+
comment: string;
|
|
78
|
+
/** Unix ms the survey was submitted. */
|
|
79
|
+
surveyDate: number;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export {};
|
package/dist/survey.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A shopper's post-order satisfaction survey, as its OWN entity.
|
|
3
|
+
*
|
|
4
|
+
* ## Why an entity and not just the three fields on the order
|
|
5
|
+
*
|
|
6
|
+
* The survey used to live entirely on the order row — `rating`, `comment`,
|
|
7
|
+
* `surveyDate` — which makes "show me this store's survey results" a walk of
|
|
8
|
+
* every order the store has ever taken, filtered on an attribute most of them do
|
|
9
|
+
* not carry. A survey is a small, rarely-written row and an order is a large,
|
|
10
|
+
* constantly-rewritten one; keeping the answers in their own partition makes the
|
|
11
|
+
* operator read a single bounded query.
|
|
12
|
+
*
|
|
13
|
+
* The three order fields STAY, deliberately, as a denormalised read convenience
|
|
14
|
+
* for everything that already renders an order: they are written in the SAME
|
|
15
|
+
* transaction as the survey row, so the two can never disagree.
|
|
16
|
+
*
|
|
17
|
+
* ## The subject reference
|
|
18
|
+
*
|
|
19
|
+
* `subjectType` + `subjectId` are what makes this a SURVEY entity rather than an
|
|
20
|
+
* order-survey entity. Today exactly one writer exists and it writes
|
|
21
|
+
* `subjectType: 'order'`; nothing else is minted, and a consumer must not assume
|
|
22
|
+
* a second type is reachable until a writer for one exists.
|
|
23
|
+
*
|
|
24
|
+
* ## Retention — Ley 25.326
|
|
25
|
+
*
|
|
26
|
+
* {@link Survey.comment} is unstructured free text a shopper typed, so it is
|
|
27
|
+
* personal data: it can name people, carry a phone number, or describe a
|
|
28
|
+
* household. It is therefore NOT kept indefinitely. Every survey row is written
|
|
29
|
+
* with a storage-only `ttl` of {@link SURVEY_RETENTION_MONTHS} months from
|
|
30
|
+
* submission (⚠️ NOT declared on this shape — it is DynamoDB housekeeping, is
|
|
31
|
+
* stripped on the way out, and a published `ttl` is refused by
|
|
32
|
+
* `tests/unit/publishedContractSurface.test.ts`) and is
|
|
33
|
+
* reaped by DynamoDB's own TTL — that reaping IS the erasure path, so no
|
|
34
|
+
* operator action and no job is needed for the ordinary case, and an erasure
|
|
35
|
+
* request ahead of it is served by deleting the row (and the order's
|
|
36
|
+
* denormalised copy) directly.
|
|
37
|
+
*
|
|
38
|
+
* ⚠️ **The comment is never logged, never emitted as an analytics event, and
|
|
39
|
+
* never put in a Sentry tag.** The storefront-events stream deliberately carries
|
|
40
|
+
* the rating without it (`SurveySubmittedEvent`), and an error path that echoes
|
|
41
|
+
* a request body would defeat that — see `docs/VALIDATION.md`.
|
|
42
|
+
*
|
|
43
|
+
* ## Forward-only
|
|
44
|
+
*
|
|
45
|
+
* Surveys submitted before this entity existed live ONLY on their order row and
|
|
46
|
+
* are not migrated. The operator read answers from the `SURVEY#` partition
|
|
47
|
+
* alone, so its results begin at this change.
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* Months a survey row survives before DynamoDB's TTL reaps it.
|
|
51
|
+
*
|
|
52
|
+
* 24 months: long enough that a store can compare this year's satisfaction
|
|
53
|
+
* against last year's — the only reason to keep a survey at all — and short
|
|
54
|
+
* enough that free text a shopper typed is not held for the lifetime of the
|
|
55
|
+
* tenant. A longer window would need a purpose to justify it under Ley 25.326;
|
|
56
|
+
* there isn't one.
|
|
57
|
+
*/
|
|
58
|
+
export const SURVEY_RETENTION_MONTHS = 24;
|
|
59
|
+
/** Largest page an operator survey read will answer with. */
|
|
60
|
+
export const SURVEY_PAGE_MAX = 100;
|
package/dist/user.d.ts
CHANGED
|
@@ -46,6 +46,22 @@ declare global {
|
|
|
46
46
|
/** @deprecated Request-only control, never persisted or returned — use `UserUpsertInput.removePhotoURL`. */
|
|
47
47
|
removePhotoURL?: string;
|
|
48
48
|
disabled: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Set once, when the user was REMOVED by `DELETE /users/{userId}`, which
|
|
51
|
+
* anonymises the row in place instead of deleting it so every order,
|
|
52
|
+
* invoice and audit entry that names this user keeps resolving.
|
|
53
|
+
*
|
|
54
|
+
* ⚠️ Present means `fullName`, `email`, `phone` and `photoURL` are ABSENT
|
|
55
|
+
* from the stored row despite being declared above, and the credential and
|
|
56
|
+
* 2FA material are gone — the row is a tombstone that exists only to give
|
|
57
|
+
* history something real to point at. Read it as a terminal state, not a
|
|
58
|
+
* flag: `disabled: true` is always set alongside it and is never lifted
|
|
59
|
+
* again, and no write path re-populates the erased fields.
|
|
60
|
+
*
|
|
61
|
+
* Forward-only: rows disabled before this shipped carry no `anonymizedAt`
|
|
62
|
+
* and are NOT swept.
|
|
63
|
+
*/
|
|
64
|
+
anonymizedAt?: number;
|
|
49
65
|
/**
|
|
50
66
|
* @deprecated Lowercase WRITE-SIDE index for backend filtering. Internal —
|
|
51
67
|
* not part of the read contract, even where legacy responses still include
|
package/dist/userActivity.d.ts
CHANGED
|
@@ -967,6 +967,24 @@ declare global {
|
|
|
967
967
|
target_user_id: string;
|
|
968
968
|
revoked_count: number;
|
|
969
969
|
}
|
|
970
|
+
/**
|
|
971
|
+
* A staff user was REMOVED by anonymising their row in place
|
|
972
|
+
* (`DELETE /users/{userId}`). `target_user_id` is the removed user;
|
|
973
|
+
* `user_id`/`actor_*` on the base remain the operator who removed them.
|
|
974
|
+
*
|
|
975
|
+
* ⚠️ Carries NO personal data of the removed user — no name, no address, no
|
|
976
|
+
* phone. That absence is the point of the event, not an omission to fill in
|
|
977
|
+
* later: the endpoint exists to erase exactly those fields (Ley 25.326), and
|
|
978
|
+
* a durable activity row echoing them back would undo it. The two counts say
|
|
979
|
+
* how much access the removal actually killed, so an incomplete sweep is
|
|
980
|
+
* visible in the trail rather than only in an ERROR row.
|
|
981
|
+
*/
|
|
982
|
+
interface UserAnonymizedEvent extends UserActivityEventBase {
|
|
983
|
+
event: 'User Anonymized';
|
|
984
|
+
target_user_id: string;
|
|
985
|
+
sessions_revoked: number;
|
|
986
|
+
trusted_devices_revoked: number;
|
|
987
|
+
}
|
|
970
988
|
interface UserPasswordResetInitiatedByOperatorEvent extends UserActivityEventBase {
|
|
971
989
|
event: 'User Password Reset Initiated by Operator';
|
|
972
990
|
target_user_id: string;
|
|
@@ -1003,7 +1021,7 @@ declare global {
|
|
|
1003
1021
|
carrier?: string;
|
|
1004
1022
|
tracking_set: boolean;
|
|
1005
1023
|
}
|
|
1006
|
-
type UserActivityEvent = CustomerConsentImportedEvent | CustomerConsentImportCompletedEvent | UserLoggedInEvent | UserLoggedOutEvent | UserPasswordChangedEvent | UserSuspendedEvent | TwoFactorEnrolledEvent | TwoFactorDisabledEvent | TwoFactorResetEvent | TwoFactorRecoveryCodesGeneratedEvent | StoreSettingsUpdatedEvent | PlanChangedEvent | InvoiceCreatedEvent | OrderCreatedEvent | OrderCancelledEvent | OrderEditedEvent | OrderReturnedEvent | ProductPriceChangedEvent | CustomerCreatedEvent | CustomerEditedEvent | CustomerRecordServedEvent | CashDrawerOpenedEvent | CashDrawerClosedEvent | TenantImpersonatedEvent | SecretRotatedEvent | UserCreatedEvent | UserUpdatedEvent | ProductCreatedEvent | ProductUpdatedEvent | StockIncomeCreatedEvent | StockAdjustedEvent | CategoryCreatedEvent | CategoryUpdatedEvent | BrandCreatedEvent | BrandUpdatedEvent | SupplierCreatedEvent | SupplierUpdatedEvent | SupplierInvoiceCreatedEvent | SupplierAccountCreatedEvent | SupplierAccountUpdatedEvent | AccountCreatedEvent | AccountDeletedEvent | BasketUpdatedEvent | BasketDiscountGrantedEvent | BasketDeletedEvent | CashDrawerMovementEvent | PaymentCreatedEvent | PaymentLinkedEvent | PaymentUnlinkedEvent | PaymentLinkageUpdatedEvent | CreditLimitOverriddenEvent | NotificationReadEvent | LogDeletedEvent | PlanCreatedEvent | StoreMaintenanceToggledEvent | PlatformMaintenanceToggledEvent | MaintenanceBroadcastSentEvent | TenantCreatedEvent | LiteralUpdatedEvent | SupportTicketCreatedEvent | SupportTicketUpdatedEvent | AuditTrailViewedEvent | ReportViewedEvent | CustomerPiiViewedEvent | CashDrawerUiOpenedEvent | CashDrawerUiClosedEvent | ExportInitiatedEvent | ImpersonationUiStartedEvent | ImpersonationUiEndedEvent | PaymentViewedEvent | InvoiceViewedEvent | CustomerDetailViewedEvent | SupplierAccountViewedEvent | SearchPerformedEvent | ActionDeniedEvent | TwoFactorChallengeShownEvent | TwoFactorCodeValidationFailedEvent | TwoFactorEnrollmentStartedEvent | TwoFactorRecoveryCodesRevealedEvent | TwoFactorResetInitiatedEvent | IntegrationTokenRefreshedEvent | WaitlistConvertedEvent | PlatformConfigUpdatedEvent | MlChannelStatusChangedEvent | PrintRuleCreatedEvent | PrintRuleEditedEvent | PrintRuleDeletedEvent | WebhookCreatedEvent | WebhookUpdatedEvent | WebhookDeletedEvent | PrinterActiveToggledEvent | PrinterRawFormatsUpdatedEvent | PlanTemplateUpdatedEvent | SupplierAccountDeletedEvent | CustomerPasswordResetInitiatedEvent | UserSessionsRevokedEvent | UserPasswordResetInitiatedByOperatorEvent | AgentCommandDispatchedEvent | RmaRequestedEvent | RmaTransitionedEvent | RmaTrackingUpdatedEvent | ClockedInEvent | ClockedOutEvent | AttendanceCorrectedEvent;
|
|
1024
|
+
type UserActivityEvent = CustomerConsentImportedEvent | CustomerConsentImportCompletedEvent | UserLoggedInEvent | UserLoggedOutEvent | UserPasswordChangedEvent | UserSuspendedEvent | TwoFactorEnrolledEvent | TwoFactorDisabledEvent | TwoFactorResetEvent | TwoFactorRecoveryCodesGeneratedEvent | StoreSettingsUpdatedEvent | PlanChangedEvent | InvoiceCreatedEvent | OrderCreatedEvent | OrderCancelledEvent | OrderEditedEvent | OrderReturnedEvent | ProductPriceChangedEvent | CustomerCreatedEvent | CustomerEditedEvent | CustomerRecordServedEvent | CashDrawerOpenedEvent | CashDrawerClosedEvent | TenantImpersonatedEvent | SecretRotatedEvent | UserCreatedEvent | UserUpdatedEvent | ProductCreatedEvent | ProductUpdatedEvent | StockIncomeCreatedEvent | StockAdjustedEvent | CategoryCreatedEvent | CategoryUpdatedEvent | BrandCreatedEvent | BrandUpdatedEvent | SupplierCreatedEvent | SupplierUpdatedEvent | SupplierInvoiceCreatedEvent | SupplierAccountCreatedEvent | SupplierAccountUpdatedEvent | AccountCreatedEvent | AccountDeletedEvent | BasketUpdatedEvent | BasketDiscountGrantedEvent | BasketDeletedEvent | CashDrawerMovementEvent | PaymentCreatedEvent | PaymentLinkedEvent | PaymentUnlinkedEvent | PaymentLinkageUpdatedEvent | CreditLimitOverriddenEvent | NotificationReadEvent | LogDeletedEvent | PlanCreatedEvent | StoreMaintenanceToggledEvent | PlatformMaintenanceToggledEvent | MaintenanceBroadcastSentEvent | TenantCreatedEvent | LiteralUpdatedEvent | SupportTicketCreatedEvent | SupportTicketUpdatedEvent | AuditTrailViewedEvent | ReportViewedEvent | CustomerPiiViewedEvent | CashDrawerUiOpenedEvent | CashDrawerUiClosedEvent | ExportInitiatedEvent | ImpersonationUiStartedEvent | ImpersonationUiEndedEvent | PaymentViewedEvent | InvoiceViewedEvent | CustomerDetailViewedEvent | SupplierAccountViewedEvent | SearchPerformedEvent | ActionDeniedEvent | TwoFactorChallengeShownEvent | TwoFactorCodeValidationFailedEvent | TwoFactorEnrollmentStartedEvent | TwoFactorRecoveryCodesRevealedEvent | TwoFactorResetInitiatedEvent | IntegrationTokenRefreshedEvent | WaitlistConvertedEvent | PlatformConfigUpdatedEvent | MlChannelStatusChangedEvent | PrintRuleCreatedEvent | PrintRuleEditedEvent | PrintRuleDeletedEvent | WebhookCreatedEvent | WebhookUpdatedEvent | WebhookDeletedEvent | PrinterActiveToggledEvent | PrinterRawFormatsUpdatedEvent | PlanTemplateUpdatedEvent | SupplierAccountDeletedEvent | CustomerPasswordResetInitiatedEvent | UserSessionsRevokedEvent | UserAnonymizedEvent | UserPasswordResetInitiatedByOperatorEvent | AgentCommandDispatchedEvent | RmaRequestedEvent | RmaTransitionedEvent | RmaTrackingUpdatedEvent | ClockedInEvent | ClockedOutEvent | AttendanceCorrectedEvent;
|
|
1007
1025
|
}
|
|
1008
1026
|
/**
|
|
1009
1027
|
* Canonical whitelist of UI-only `UserActivityEvent` variant names. Imported by
|