sinfactura-types 1.10.322 → 1.10.324
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/auth.d.ts +142 -0
- package/dist/store.d.ts +17 -0
- package/package.json +1 -1
package/dist/auth.d.ts
CHANGED
|
@@ -33,6 +33,146 @@ declare global {
|
|
|
33
33
|
/** Remember this device — same semantics as `Login.trustDevice`. */
|
|
34
34
|
trustDevice?: boolean;
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* `POST /auth { mode: 'register' }` on the OPERATOR host — the TENANT
|
|
38
|
+
* self-registration body, field for field what `registerSchema`
|
|
39
|
+
* (`stacks/lambdas/auth/_register.ts`) accepts as INPUT. The tie is
|
|
40
|
+
* compile-time: `AssertTenantRegisterInputMatchesSchema`, declared beside that
|
|
41
|
+
* schema, fails `yarn typecheck` on any divergence in key set, type or
|
|
42
|
+
* optionality.
|
|
43
|
+
*
|
|
44
|
+
* ⚠️ NOT interchangeable with {@link CustomerRegisterInput}. The two
|
|
45
|
+
* registration endpoints differ in five places — `name`, `waitlist` and
|
|
46
|
+
* `acquisition` exist only here, `fullName` is OPTIONAL here and REQUIRED
|
|
47
|
+
* there, and the address/`afip` block exists only there.
|
|
48
|
+
*
|
|
49
|
+
* ⚠️ Bounds are stated per field below and are what the server ENFORCES;
|
|
50
|
+
* a violation is `400` and creates nothing at all, not a partial tenant.
|
|
51
|
+
*
|
|
52
|
+
* ⚠️ The schema is `.loose()`, so the endpoint TOLERATES unknown top-level
|
|
53
|
+
* keys and ignores them. This type deliberately does not declare an index
|
|
54
|
+
* signature: an unknown key buys a client nothing and losing the
|
|
55
|
+
* excess-property check is how a misspelled `fullname` ships silently. The
|
|
56
|
+
* nested `acquisition` object is the opposite — `.strict()`, so an unknown key
|
|
57
|
+
* inside it refuses the WHOLE registration.
|
|
58
|
+
*/
|
|
59
|
+
interface TenantRegisterInput {
|
|
60
|
+
/** Store name. Trimmed, then 4–40 characters. Required — tenants are never created nameless. */
|
|
61
|
+
name: string;
|
|
62
|
+
/** Must parse as an email address, and at least 8 characters. Lower-cased server-side. */
|
|
63
|
+
email: string;
|
|
64
|
+
/** At least 8 characters — the one creation-time floor every password-accepting surface shares. */
|
|
65
|
+
password: string;
|
|
66
|
+
/**
|
|
67
|
+
* EXACTLY 10 characters, and REQUIRED here.
|
|
68
|
+
*
|
|
69
|
+
* ⚠️ The deprecated {@link Register} declares `phone?` optional, which has
|
|
70
|
+
* never been true of this endpoint: an omitted `phone` is a `400`.
|
|
71
|
+
*/
|
|
72
|
+
phone: string;
|
|
73
|
+
/** EXACTLY 11 characters. Normalised to digits-only server-side; no check-digit test on this leg. */
|
|
74
|
+
cuit: string;
|
|
75
|
+
/**
|
|
76
|
+
* Operator's razón social. OPTIONAL here — trimmed, then 1–160 characters.
|
|
77
|
+
* ⚠️ REQUIRED (min 6, untrimmed) on the customer leg; see {@link CustomerRegisterInput}.
|
|
78
|
+
*/
|
|
79
|
+
fullName?: string;
|
|
80
|
+
/** Consent to register past the shared-CUIT gate, i.e. to retry a `409 CUIT_SHARED`. */
|
|
81
|
+
acknowledgedSharedCuit?: boolean;
|
|
82
|
+
/** Waitlist registration — the tenant is created and a session is minted, but the welcome path differs. */
|
|
83
|
+
waitlist?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* First-touch acquisition captured by the registration client; the api
|
|
86
|
+
* server-stamps `capturedAt`.
|
|
87
|
+
*
|
|
88
|
+
* ⚠️ A STRICT allow-list, not a tracking bag. An unknown key (`gclid`,
|
|
89
|
+
* `utm_term`, a raw referrer, a client-sent `capturedAt`) refuses the WHOLE
|
|
90
|
+
* registration. Send all three required keys or omit the object entirely.
|
|
91
|
+
*/
|
|
92
|
+
acquisition?: StoreAcquisitionInput;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* One `afip` entry as the CUSTOMER registration ACCEPTS it — {@link CustomerAfip}
|
|
96
|
+
* with one widening.
|
|
97
|
+
*
|
|
98
|
+
* ⚠️ `cuit` also accepts a `number` and is normalised to a `string` before it
|
|
99
|
+
* is stored, so the PERSISTED entry is a plain `CustomerAfip`. The widening is
|
|
100
|
+
* a compatibility layer for a population of stored entries whose `cuit` is a
|
|
101
|
+
* DynamoDB Number; it is representation-only and changes no value. A client
|
|
102
|
+
* should send the string.
|
|
103
|
+
*/
|
|
104
|
+
interface CustomerRegisterAfipInput extends Omit<CustomerAfip, 'cuit'> {
|
|
105
|
+
/** Digits of the receptor CUIT. Send a `string`; a `number` is accepted and coerced. */
|
|
106
|
+
cuit: string | number;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* `POST /auth { mode: 'register' }` on the STOREFRONT host — the CUSTOMER
|
|
110
|
+
* registration body, field for field what `registerSchema`
|
|
111
|
+
* (`stacks/web/lambdas/auth/register.ts`) accepts as INPUT. The tie is
|
|
112
|
+
* compile-time: `AssertCustomerRegisterInputMatchesSchema`, declared beside
|
|
113
|
+
* that schema.
|
|
114
|
+
*
|
|
115
|
+
* ⚠️ NOT interchangeable with {@link TenantRegisterInput} — see that type for
|
|
116
|
+
* the five differences. In particular there is no `acquisition` here: campaign
|
|
117
|
+
* attribution is a TENANT property, and a value sent on this leg is dropped.
|
|
118
|
+
*
|
|
119
|
+
* ⚠️ Unlike the tenant schema this object is NOT `.loose()`, so an unknown
|
|
120
|
+
* top-level key is STRIPPED rather than accepted — it does not refuse the
|
|
121
|
+
* request and it does not reach the row, which is the failure mode a typo'd
|
|
122
|
+
* field name produces here.
|
|
123
|
+
*/
|
|
124
|
+
interface CustomerRegisterInput {
|
|
125
|
+
/** Must parse as an email address, and at least 5 characters. Lower-cased server-side. */
|
|
126
|
+
email: string;
|
|
127
|
+
/** At least 8 characters — the same creation-time floor as the tenant leg. */
|
|
128
|
+
password: string;
|
|
129
|
+
/**
|
|
130
|
+
* At least 6 characters and REQUIRED, and ⚠️ NOT trimmed — `' '`
|
|
131
|
+
* satisfies it. Optional and trimmed 1–160 on the tenant leg.
|
|
132
|
+
*/
|
|
133
|
+
fullName: string;
|
|
134
|
+
/**
|
|
135
|
+
* 11 digits AND a correct mod-11 check digit — a stricter rule than the
|
|
136
|
+
* tenant leg's bare length check, because this value is the `cuit-PK` GSI
|
|
137
|
+
* partition key and a typo'd identity is invoiced against. There is no
|
|
138
|
+
* empty-string escape hatch: registration REQUIRES a fiscal identity.
|
|
139
|
+
*/
|
|
140
|
+
cuit: string;
|
|
141
|
+
/** EXACTLY 10 characters. */
|
|
142
|
+
phone: string;
|
|
143
|
+
/** Free-form; no bound. Typically filled from the AFIP padrón lookup. */
|
|
144
|
+
address?: string;
|
|
145
|
+
/** Free-form; no bound. */
|
|
146
|
+
city?: string;
|
|
147
|
+
/** Free-form; no bound. */
|
|
148
|
+
postalCode?: string;
|
|
149
|
+
/** Free-form; no bound. */
|
|
150
|
+
province?: string;
|
|
151
|
+
/** Receptor identities. Every field of each entry is REQUIRED — there is no partial entry. */
|
|
152
|
+
afip?: CustomerRegisterAfipInput[];
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Registration request body.
|
|
156
|
+
*
|
|
157
|
+
* @deprecated Use {@link TenantRegisterInput} for tenant self-registration or
|
|
158
|
+
* {@link CustomerRegisterInput} for storefront CUSTOMER registration. Each of
|
|
159
|
+
* those mirrors its endpoint's validator exactly and is tied to it at compile
|
|
160
|
+
* time; this one mirrors neither and never did.
|
|
161
|
+
*
|
|
162
|
+
* ⚠️ ONE type serves TWO endpoints whose schemas differ: tenant self-registration
|
|
163
|
+
* (`POST /auth`, mode `register`) and the storefront CUSTOMER registration. It
|
|
164
|
+
* mirrors neither exactly — the tenant schema also takes `name` and `waitlist` and
|
|
165
|
+
* makes `fullName` optional and `phone` required; the customer schema has no
|
|
166
|
+
* `name`, requires `fullName` and takes an address. Both front ends reach it
|
|
167
|
+
* through a cast, so tightening it towards either schema breaks the other's
|
|
168
|
+
* compile. `acquisition` is tenant-only; the customer registration ignores it.
|
|
169
|
+
*
|
|
170
|
+
* ⚠️ Its SHAPE IS FROZEN, deliberately, and must not be narrowed on the way
|
|
171
|
+
* out. Both consumers reach it through a cast (`as Register`,
|
|
172
|
+
* `as unknown as Register`), so a removed or tightened field is a compile
|
|
173
|
+
* break in a front end that has not yet taken the types bump. Deletion waits
|
|
174
|
+
* on both of them adopting the two types above.
|
|
175
|
+
*/
|
|
36
176
|
interface Register {
|
|
37
177
|
email: string;
|
|
38
178
|
password: string;
|
|
@@ -40,6 +180,8 @@ declare global {
|
|
|
40
180
|
fullName: string;
|
|
41
181
|
phone?: string;
|
|
42
182
|
acknowledgedSharedCuit?: boolean;
|
|
183
|
+
/** First-touch acquisition captured by the registration client; the api server-stamps `capturedAt`. */
|
|
184
|
+
acquisition?: StoreAcquisitionInput;
|
|
43
185
|
}
|
|
44
186
|
interface Recover {
|
|
45
187
|
email: string;
|
package/dist/store.d.ts
CHANGED
|
@@ -234,6 +234,21 @@ declare global {
|
|
|
234
234
|
*/
|
|
235
235
|
tolerancePercent?: number;
|
|
236
236
|
}
|
|
237
|
+
/** First-touch acquisition metadata captured when this tenant self-registers. */
|
|
238
|
+
interface StoreAcquisition {
|
|
239
|
+
source: string;
|
|
240
|
+
medium: string;
|
|
241
|
+
campaign: string;
|
|
242
|
+
content?: string;
|
|
243
|
+
/** Unix ms, stamped by the api from the registration timestamp. */
|
|
244
|
+
capturedAt: number;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* The REQUEST leaf: everything a registration client may send, i.e.
|
|
248
|
+
* `StoreAcquisition` minus the server-owned stamp. The api refuses a body
|
|
249
|
+
* carrying `capturedAt`, and refuses any key this type does not name.
|
|
250
|
+
*/
|
|
251
|
+
type StoreAcquisitionInput = Omit<StoreAcquisition, 'capturedAt'>;
|
|
237
252
|
interface Store {
|
|
238
253
|
/**
|
|
239
254
|
* Cmd-K palette overrides. Absent means "all built-in verbs, default order".
|
|
@@ -305,6 +320,8 @@ declare global {
|
|
|
305
320
|
/** Payment CBU contact leaf (22 digits), shown to customers. */
|
|
306
321
|
cbu?: string;
|
|
307
322
|
acknowledgedSharedCuit?: boolean;
|
|
323
|
+
/** First-touch acquisition; absent for non-campaign/legacy registrations and never client-updated after creation. */
|
|
324
|
+
acquisition?: StoreAcquisition;
|
|
308
325
|
/**
|
|
309
326
|
* Response-time join, not a persisted Store attribute — and TWO different
|
|
310
327
|
* shapes depending on the endpoint: `GET /tenants` (SUPERVISOR) attaches the
|