@endora-commerce/contracts 0.104.0 → 0.106.0
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/admin-contributions.d.ts +26 -0
- package/dist/admin-contributions.d.ts.map +1 -1
- package/dist/admin-contributions.js +28 -0
- package/dist/admin-contributions.js.map +1 -1
- package/dist/admin-users.d.ts +87 -1
- package/dist/admin-users.d.ts.map +1 -1
- package/dist/admin.d.ts +55 -1
- package/dist/admin.d.ts.map +1 -1
- package/dist/admin.js +42 -2
- package/dist/admin.js.map +1 -1
- package/dist/auth.d.ts +52 -3
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +15 -0
- package/dist/auth.js.map +1 -1
- package/dist/catalog.d.ts +58 -0
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +73 -0
- package/dist/catalog.js.map +1 -1
- package/dist/credit-limits.d.ts +27 -0
- package/dist/credit-limits.d.ts.map +1 -1
- package/dist/credit-limits.js +41 -0
- package/dist/credit-limits.js.map +1 -1
- package/dist/crm.d.ts +31 -0
- package/dist/crm.d.ts.map +1 -1
- package/dist/crm.js +25 -0
- package/dist/crm.js.map +1 -1
- package/dist/custom-fields.d.ts +42 -1
- package/dist/custom-fields.d.ts.map +1 -1
- package/dist/custom-fields.js +30 -6
- package/dist/custom-fields.js.map +1 -1
- package/dist/customer-accounts.d.ts +12 -1
- package/dist/customer-accounts.d.ts.map +1 -1
- package/dist/email.d.ts +19 -2
- package/dist/email.d.ts.map +1 -1
- package/dist/email.js +9 -2
- package/dist/email.js.map +1 -1
- package/dist/errors.d.ts +26 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +28 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/invoices.d.ts +6 -2
- package/dist/invoices.d.ts.map +1 -1
- package/dist/invoices.js +4 -2
- package/dist/invoices.js.map +1 -1
- package/dist/modules.d.ts +1 -0
- package/dist/modules.d.ts.map +1 -1
- package/dist/orders.d.ts +155 -2
- package/dist/orders.d.ts.map +1 -1
- package/dist/orders.js +71 -2
- package/dist/orders.js.map +1 -1
- package/dist/payment-methods.d.ts +8 -0
- package/dist/payment-methods.d.ts.map +1 -1
- package/dist/payment-methods.js +7 -0
- package/dist/payment-methods.js.map +1 -1
- package/dist/platform-info.d.ts +19 -0
- package/dist/platform-info.d.ts.map +1 -0
- package/dist/platform-info.js +18 -0
- package/dist/platform-info.js.map +1 -0
- package/dist/pwa.d.ts +10 -0
- package/dist/pwa.d.ts.map +1 -1
- package/dist/pwa.js +12 -0
- package/dist/pwa.js.map +1 -1
- package/dist/quote-requests.d.ts +46 -4
- package/dist/quote-requests.d.ts.map +1 -1
- package/dist/quote-requests.js +64 -3
- package/dist/quote-requests.js.map +1 -1
- package/dist/sales-channels.d.ts +18 -0
- package/dist/sales-channels.d.ts.map +1 -1
- package/dist/sales-channels.js +17 -0
- package/dist/sales-channels.js.map +1 -1
- package/dist/seo.d.ts +322 -0
- package/dist/seo.d.ts.map +1 -1
- package/dist/seo.js +292 -0
- package/dist/seo.js.map +1 -1
- package/dist/settings.d.ts +19 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +18 -0
- package/dist/settings.js.map +1 -1
- package/dist/shipping-methods.d.ts +105 -0
- package/dist/shipping-methods.d.ts.map +1 -1
- package/dist/shipping-methods.js +59 -0
- package/dist/shipping-methods.js.map +1 -1
- package/dist/transactional-emails.d.ts +12 -2
- package/dist/transactional-emails.d.ts.map +1 -1
- package/dist/webhooks.d.ts +31 -0
- package/dist/webhooks.d.ts.map +1 -1
- package/dist/webhooks.js +32 -0
- package/dist/webhooks.js.map +1 -1
- package/package.json +1 -1
|
@@ -117,6 +117,7 @@ export declare const AdminZoneNameSchema: z.ZodEnum<{
|
|
|
117
117
|
"order.entry.tabs": "order.entry.tabs";
|
|
118
118
|
"ledger.section.tabs": "ledger.section.tabs";
|
|
119
119
|
"category.content.editor": "category.content.editor";
|
|
120
|
+
"settings.setting.after": "settings.setting.after";
|
|
120
121
|
}>;
|
|
121
122
|
export type AdminZoneName = z.infer<typeof AdminZoneNameSchema>;
|
|
122
123
|
/** A zone mounted once per product editor. */
|
|
@@ -307,6 +308,29 @@ export interface OrderEntryTabsZoneProps {
|
|
|
307
308
|
*/
|
|
308
309
|
export interface LedgerSectionTabsZoneProps {
|
|
309
310
|
}
|
|
311
|
+
/**
|
|
312
|
+
* A zone mounted below one setting's field on the Settings screen.
|
|
313
|
+
*
|
|
314
|
+
* `settingCode` and `ownerModule` are props **because they are matched on**:
|
|
315
|
+
* `match` compares by string value and a key the props do not carry never
|
|
316
|
+
* agrees.
|
|
317
|
+
*
|
|
318
|
+
* `draftText` is what is in the field **now**, saved or not, and `dirty` says
|
|
319
|
+
* which — so a contribution can follow the operator's typing and must say, in
|
|
320
|
+
* words, when what it shows is not yet in force.
|
|
321
|
+
*/
|
|
322
|
+
export interface SettingsSettingAfterZoneProps {
|
|
323
|
+
/** The row's setting code, e.g. `seo.robots_txt_custom`. Matchable. */
|
|
324
|
+
readonly settingCode: string;
|
|
325
|
+
/** The module that declared the setting. Matchable. */
|
|
326
|
+
readonly ownerModule: string;
|
|
327
|
+
/** The sales channel being edited, or `null` for the all-channels value. */
|
|
328
|
+
readonly channelCode: string | null;
|
|
329
|
+
/** The field's current text, saved or not, for a string-typed setting; `null` otherwise. */
|
|
330
|
+
readonly draftText: string | null;
|
|
331
|
+
/** Whether `draftText` differs from what is stored. */
|
|
332
|
+
readonly dirty: boolean;
|
|
333
|
+
}
|
|
310
334
|
/** A zone mounted beside one field of the product editor. */
|
|
311
335
|
export interface ProductEditorFieldZoneProps {
|
|
312
336
|
readonly productId: string;
|
|
@@ -368,6 +392,7 @@ export interface AdminZonePropsMap extends Record<AdminZoneName, object> {
|
|
|
368
392
|
'order.entry.tabs': OrderEntryTabsZoneProps;
|
|
369
393
|
'ledger.section.tabs': LedgerSectionTabsZoneProps;
|
|
370
394
|
'category.content.editor': CategoryContentEditorZoneProps;
|
|
395
|
+
'settings.setting.after': SettingsSettingAfterZoneProps;
|
|
371
396
|
}
|
|
372
397
|
/** The props of one zone, by name. */
|
|
373
398
|
export type AdminZoneProps<Z extends AdminZoneName> = AdminZonePropsMap[Z];
|
|
@@ -505,6 +530,7 @@ export declare const AdminZoneContributionSchema: z.ZodObject<{
|
|
|
505
530
|
"order.entry.tabs": "order.entry.tabs";
|
|
506
531
|
"ledger.section.tabs": "ledger.section.tabs";
|
|
507
532
|
"category.content.editor": "category.content.editor";
|
|
533
|
+
"settings.setting.after": "settings.setting.after";
|
|
508
534
|
}>;
|
|
509
535
|
weight: z.ZodNumber;
|
|
510
536
|
requiredPermission: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-contributions.d.ts","sourceRoot":"","sources":["../src/admin-contributions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA+B5D;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,6DAGtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAMhF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;EAiBpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAM5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,mBAAmB
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AAC,KAAK,CAAC,OAAO,2BAA2B,CAAC;IACxF;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,EAAE,qBAAqB,CAAC;CAC3C;AAED,qCAAqC;AACrC,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,iFAAiF;AACjF,MAAM,WAAW,qBAAsB,SAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC;IACxF,QAAQ,CAAC,SAAS,EAAE,qBAAqB,CAAC;CAC3C;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,sBAAuB,SAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC;IAC1F,QAAQ,CAAC,SAAS,EAAE,qBAAqB,CAAC;CAC3C;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACnD,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC9C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;CACrD"}
|
|
@@ -468,6 +468,34 @@ export const AdminZoneNameSchema = z.enum([
|
|
|
468
468
|
* stored stays stored and keeps rendering.
|
|
469
469
|
*/
|
|
470
470
|
'category.content.editor',
|
|
471
|
+
/**
|
|
472
|
+
* Below the field of one setting on the Settings screen.
|
|
473
|
+
*
|
|
474
|
+
* Mounted **once per setting row** by `settings`' row editor
|
|
475
|
+
* (`SettingRowEditor.tsx`), each mount carrying that row's own
|
|
476
|
+
* {@link SettingsSettingAfterZoneProps} — one host, one place, many mounts
|
|
477
|
+
* (Z13), so a contributor narrows itself with
|
|
478
|
+
* `match: { settingCode: '…' }` and its chunk is fetched only on a screen
|
|
479
|
+
* that shows that setting.
|
|
480
|
+
*
|
|
481
|
+
* It exists so that the module that **declared** a setting can show what the
|
|
482
|
+
* value in the field amounts to — a preview, a consequence, a warning —
|
|
483
|
+
* without the `settings` module learning what any setting means. The first
|
|
484
|
+
* contributor is `seo`'s preview of the `robots.txt` a sales channel serves;
|
|
485
|
+
* `settings` names no contributor and gains no edge.
|
|
486
|
+
*
|
|
487
|
+
* **Read-only by construction.** The props carry the draft out and nothing
|
|
488
|
+
* back: a contribution cannot change the field, and cannot delay or prevent
|
|
489
|
+
* the row's save. A contribution that needs to write has a route of its own.
|
|
490
|
+
*
|
|
491
|
+
* **Not mounted for a `secret` setting.** A contribution must never be
|
|
492
|
+
* handed a secret's draft, and a secret's stored value never reaches the
|
|
493
|
+
* browser at all — so there is nothing for one to show.
|
|
494
|
+
*
|
|
495
|
+
* A row whose owning module is switched off is read-only and shows no
|
|
496
|
+
* contribution of that module, through the renderer's own presence filter.
|
|
497
|
+
*/
|
|
498
|
+
'settings.setting.after',
|
|
471
499
|
]);
|
|
472
500
|
// ---------------------------------------------------------------------------
|
|
473
501
|
// Declarations
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-contributions.js","sourceRoot":"","sources":["../src/admin-contributions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIvC,8EAA8E;AAC9E,uBAAuB;AACvB,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAEhD;;;;;;;;;GASG;AACH,MAAM,gBAAgB,GAAG,6CAA6C,CAAC;AAEvE,8EAA8E;AAC9E,yBAAyB;AACzB,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,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,CAAC,CAAC,MAAM,CAAC;IAClD,IAAI,EAAE,mBAAmB;IACzB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACxB,kBAAkB,EAAE,2BAA2B,CAAC,QAAQ,EAAE;IAC1D;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,EAAE,CAAC;SACL,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;SACzE,QAAQ,EAAE;CACd,CAAC,CAAC;AAEH;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,KAAK,CAAC,WAAW,EAAE,iEAAiE,CAAC;IACxF,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC,CAAC"}
|
package/dist/admin-users.d.ts
CHANGED
|
@@ -99,7 +99,93 @@ export interface AdminUserPreferencePort {
|
|
|
99
99
|
* `nonDeactivatable` never enters one.
|
|
100
100
|
*/
|
|
101
101
|
export interface AdminPasswordVerificationPort {
|
|
102
|
-
|
|
102
|
+
/**
|
|
103
|
+
* `context` says where the request came from, when the caller knows. The
|
|
104
|
+
* comparison goes through {@link AdminAuthenticationThrottlePort}, so
|
|
105
|
+
* repeated wrong passwords here are throttled together with the ones typed
|
|
106
|
+
* at sign-in, and the call rejects with 429
|
|
107
|
+
* `ADMIN_AUTHENTICATION_THROTTLED` while a delay is running.
|
|
108
|
+
*/
|
|
109
|
+
verifyPassword(adminUserId: string, password: string, context?: AdminAuthenticationOrigin): Promise<boolean>;
|
|
110
|
+
}
|
|
111
|
+
/** Where an attempt came from, as far as the caller knows. */
|
|
112
|
+
export interface AdminAuthenticationOrigin {
|
|
113
|
+
/** The address the request came from. Absent, only the account is counted. */
|
|
114
|
+
readonly ip?: string;
|
|
115
|
+
/**
|
|
116
|
+
* The **verified** value of the `ADMIN_KNOWN_DEVICE_COOKIE_NAME` cookie —
|
|
117
|
+
* what `request.unsignCookie(...)` returned as valid — or absent. Never the
|
|
118
|
+
* raw cookie: the signature is the only thing that stops a stranger writing
|
|
119
|
+
* one. An attempt from a device the account has completed a sign-in on is
|
|
120
|
+
* counted against that device's own budget and is not refused by the
|
|
121
|
+
* account-wide one.
|
|
122
|
+
*/
|
|
123
|
+
readonly knownDevice?: string;
|
|
124
|
+
}
|
|
125
|
+
/** Which credential of an administrator account an attempt presents. */
|
|
126
|
+
export type AdminAuthenticationFactor = 'password' | 'second_factor';
|
|
127
|
+
/** One attempt to prove a credential of an administrator account. */
|
|
128
|
+
export interface AdminAuthenticationAttempt extends AdminAuthenticationOrigin {
|
|
129
|
+
readonly factor: AdminAuthenticationFactor;
|
|
130
|
+
/**
|
|
131
|
+
* What identifies the account on this route, the same string every time: the
|
|
132
|
+
* normalised e-mail address for a password — which at sign-in may belong to
|
|
133
|
+
* no account at all — and the administrator id for a second factor.
|
|
134
|
+
*/
|
|
135
|
+
readonly account: string;
|
|
136
|
+
}
|
|
137
|
+
/** What the credential check found. */
|
|
138
|
+
export interface AdminAuthenticationCheckResult {
|
|
139
|
+
readonly ok: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* The administrator the attempt was made against, when there is one. It is
|
|
142
|
+
* what a throttle activation is audited under; an attempt against an address
|
|
143
|
+
* that belongs to nobody leaves it out.
|
|
144
|
+
*/
|
|
145
|
+
readonly adminUserId?: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The throttle on repeated wrong administrator credentials.
|
|
149
|
+
*
|
|
150
|
+
* Container name: `adminAuthenticationThrottlePort`. Owner: `admin_users`.
|
|
151
|
+
*
|
|
152
|
+
* One method, wrapped around the comparison itself, so a route adopts it with
|
|
153
|
+
* one call:
|
|
154
|
+
*
|
|
155
|
+
* ```ts
|
|
156
|
+
* const ok = await throttle.verify(
|
|
157
|
+
* { factor: 'password', account: admin.email, ip: request.ip, knownDevice },
|
|
158
|
+
* async () => ({ ok: await verifyPassword(admin.passwordHash, typed), adminUserId: admin.id }),
|
|
159
|
+
* );
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* `verify` takes the attempt **before** it runs `check`. While a delay is
|
|
163
|
+
* running, or while every slot is held by an attempt still being verified, it
|
|
164
|
+
* rejects with an `HttpError` — 429 `ADMIN_AUTHENTICATION_THROTTLED`, a
|
|
165
|
+
* `Retry-After` header and `details.retryAfterSeconds` — and does not run
|
|
166
|
+
* `check` at all, so a correct credential and a wrong one are answered
|
|
167
|
+
* identically. Otherwise it resolves to `check`'s `ok`: `true` forgets the
|
|
168
|
+
* failures counted so far, `false` counts one more. A `check` that throws is
|
|
169
|
+
* withdrawn and counted as neither. When the counters cannot be reached it
|
|
170
|
+
* rejects with 503 `ADMIN_AUTHENTICATION_UNAVAILABLE`.
|
|
171
|
+
*
|
|
172
|
+
* `issueKnownDevice` mints the value of the known-device cookie. Call it only
|
|
173
|
+
* after a **completed** sign-in — the password and, where one is asked for,
|
|
174
|
+
* the second factor — and set what it returns as
|
|
175
|
+
* `ADMIN_KNOWN_DEVICE_COOKIE_NAME`, signed and `httpOnly`. `null` means the
|
|
176
|
+
* account is not one a device can be known to (it is gone or inactive); set
|
|
177
|
+
* nothing then. The value stops being honoured when the account's password
|
|
178
|
+
* changes or the account is deactivated.
|
|
179
|
+
*
|
|
180
|
+
* `check` reports "no such account" as `{ ok: false }` rather than by throwing,
|
|
181
|
+
* which is what makes an unknown address throttle exactly like a real one.
|
|
182
|
+
*
|
|
183
|
+
* **Owner off:** the seam fails closed — resolving this port throws
|
|
184
|
+
* `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`.
|
|
185
|
+
*/
|
|
186
|
+
export interface AdminAuthenticationThrottlePort {
|
|
187
|
+
verify(attempt: AdminAuthenticationAttempt, check: () => Promise<AdminAuthenticationCheckResult>): Promise<boolean>;
|
|
188
|
+
issueKnownDevice(adminUserId: string): Promise<string | null>;
|
|
103
189
|
}
|
|
104
190
|
export interface ImpersonationStartInput {
|
|
105
191
|
adminUserId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-users.d.ts","sourceRoot":"","sources":["../src/admin-users.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC9B,kFAAkF;IAClF,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,4EAA4E;IAC5E,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB;AAED,6CAA6C;AAC7C,MAAM,WAAW,sBAAsB;IACrC,yEAAyE;IACzE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IACxF,SAAS,CACP,GAAG,EAAE,SAAS,MAAM,EAAE,EACtB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,eAAe,EAAE,CAA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AwB;IACvC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,wBAAwB,EAAE,MAAM,CAAC;IACjC,sBAAsB,EAAE,IAAI,CAAC;IAC7B,6BAA6B,EAAE,MAAM,CAAC;IACtC,2BAA2B,EAAE,4BAA4B,CAAC;CAC3D;AAED,MAAM,WAAW,qBAAqB;IACpC,+BAA+B,EAAE,MAAM,CAAC;IACxC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,uBAAuB,EAAE,MAAM,CAAC;IAChC,qBAAqB,EAAE,IAAI,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACzE,GAAG,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACpE"}
|
package/dist/admin.d.ts
CHANGED
|
@@ -33,6 +33,48 @@ export declare const adminRoleSchema: z.ZodObject<{
|
|
|
33
33
|
updatedAt: z.ZodString;
|
|
34
34
|
}, z.core.$strip>;
|
|
35
35
|
export type AdminRole = z.infer<typeof adminRoleSchema>;
|
|
36
|
+
/**
|
|
37
|
+
* `GET /api/v1/admin/me` — the signed-in administrator, as the Admin UI's auth
|
|
38
|
+
* gate reads it. Gated on a session and on no permission code, so everything
|
|
39
|
+
* here is something every administrator is entitled to know about themselves.
|
|
40
|
+
*
|
|
41
|
+
* `idleLogoutMinutes` is the operator's `admin.idle_logout_minutes` setting.
|
|
42
|
+
* It travels here rather than through the settings admin API because that API
|
|
43
|
+
* requires `settings:read`, and an inactivity policy binds an administrator
|
|
44
|
+
* whether or not their role may open the settings screen. `null` means the
|
|
45
|
+
* backend could not resolve a usable value (the setting is not registered, or
|
|
46
|
+
* holds something that is not a positive number); a backend older than this
|
|
47
|
+
* field omits it. In both cases the Admin UI applies its built-in default.
|
|
48
|
+
*/
|
|
49
|
+
export declare const adminMeResponseSchema: z.ZodObject<{
|
|
50
|
+
adminUser: z.ZodObject<{
|
|
51
|
+
id: z.ZodString;
|
|
52
|
+
email: z.ZodString;
|
|
53
|
+
firstName: z.ZodString;
|
|
54
|
+
lastName: z.ZodString;
|
|
55
|
+
adminRoleId: z.ZodNullable<z.ZodString>;
|
|
56
|
+
twoFactorEnabled: z.ZodBoolean;
|
|
57
|
+
status: z.ZodEnum<{
|
|
58
|
+
active: "active";
|
|
59
|
+
inactive: "inactive";
|
|
60
|
+
}>;
|
|
61
|
+
lastLoginAt: z.ZodNullable<z.ZodString>;
|
|
62
|
+
createdAt: z.ZodString;
|
|
63
|
+
updatedAt: z.ZodString;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
role: z.ZodNullable<z.ZodObject<{
|
|
66
|
+
id: z.ZodString;
|
|
67
|
+
code: z.ZodString;
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
70
|
+
requiresTwoFactor: z.ZodBoolean;
|
|
71
|
+
createdAt: z.ZodString;
|
|
72
|
+
updatedAt: z.ZodString;
|
|
73
|
+
}, z.core.$strip>>;
|
|
74
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
75
|
+
idleLogoutMinutes: z.ZodNullable<z.ZodNumber>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export type AdminMeResponse = z.infer<typeof adminMeResponseSchema>;
|
|
36
78
|
export declare const adminLoginRequestSchema: z.ZodObject<{
|
|
37
79
|
email: z.ZodString;
|
|
38
80
|
password: z.ZodString;
|
|
@@ -78,12 +120,24 @@ export type UpdateAdminUserRequest = z.infer<typeof updateAdminUserRequestSchema
|
|
|
78
120
|
* Self-update payload — every authenticated admin can edit their own
|
|
79
121
|
* first/last name and rotate their password without needing the
|
|
80
122
|
* `admin_users:manage` permission. Role and status are intentionally
|
|
81
|
-
* NOT exposed here.
|
|
123
|
+
* NOT exposed here, and neither is the e-mail address.
|
|
124
|
+
*
|
|
125
|
+
* `password` is the new password, and it is a credential change: a payload
|
|
126
|
+
* that carries it MUST carry `currentPassword` as well, which the route
|
|
127
|
+
* verifies before it changes anything. A session alone does not prove the
|
|
128
|
+
* caller knows the password — an unattended browser holds one too. A payload
|
|
129
|
+
* without `password` needs no `currentPassword`, and one sent anyway is
|
|
130
|
+
* ignored.
|
|
131
|
+
*
|
|
132
|
+
* `currentPassword` is bounded but otherwise unconstrained: it is compared, not
|
|
133
|
+
* stored, and the password policy it was created under is not this schema's to
|
|
134
|
+
* restate.
|
|
82
135
|
*/
|
|
83
136
|
export declare const updateAdminUserSelfRequestSchema: z.ZodObject<{
|
|
84
137
|
firstName: z.ZodOptional<z.ZodString>;
|
|
85
138
|
lastName: z.ZodOptional<z.ZodString>;
|
|
86
139
|
password: z.ZodOptional<z.ZodString>;
|
|
140
|
+
currentPassword: z.ZodOptional<z.ZodString>;
|
|
87
141
|
}, z.core.$strict>;
|
|
88
142
|
export type UpdateAdminUserSelfRequest = z.infer<typeof updateAdminUserSelfRequestSchema>;
|
|
89
143
|
/**
|
package/dist/admin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;GAOG;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;iBAW1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,eAAe;;;;;;;;iBAQ1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAA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;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,EACzB,SAAS,EAAE,SAAS,wBAAwB,EAAE,GAC7C,MAAM,EAAE,CAaV;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BvB,CAAC;AAIX,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;iBAa9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
package/dist/admin.js
CHANGED
|
@@ -29,6 +29,25 @@ export const adminRoleSchema = z.object({
|
|
|
29
29
|
createdAt: isoDateTimeSchema,
|
|
30
30
|
updatedAt: isoDateTimeSchema,
|
|
31
31
|
});
|
|
32
|
+
/**
|
|
33
|
+
* `GET /api/v1/admin/me` — the signed-in administrator, as the Admin UI's auth
|
|
34
|
+
* gate reads it. Gated on a session and on no permission code, so everything
|
|
35
|
+
* here is something every administrator is entitled to know about themselves.
|
|
36
|
+
*
|
|
37
|
+
* `idleLogoutMinutes` is the operator's `admin.idle_logout_minutes` setting.
|
|
38
|
+
* It travels here rather than through the settings admin API because that API
|
|
39
|
+
* requires `settings:read`, and an inactivity policy binds an administrator
|
|
40
|
+
* whether or not their role may open the settings screen. `null` means the
|
|
41
|
+
* backend could not resolve a usable value (the setting is not registered, or
|
|
42
|
+
* holds something that is not a positive number); a backend older than this
|
|
43
|
+
* field omits it. In both cases the Admin UI applies its built-in default.
|
|
44
|
+
*/
|
|
45
|
+
export const adminMeResponseSchema = z.object({
|
|
46
|
+
adminUser: adminUserSchema,
|
|
47
|
+
role: adminRoleSchema.nullable(),
|
|
48
|
+
permissions: z.array(z.string()),
|
|
49
|
+
idleLogoutMinutes: z.number().positive().nullable(),
|
|
50
|
+
});
|
|
32
51
|
export const adminLoginRequestSchema = z.object({
|
|
33
52
|
email: z.string().email(),
|
|
34
53
|
password: z.string(),
|
|
@@ -67,15 +86,36 @@ export const updateAdminUserRequestSchema = z
|
|
|
67
86
|
* Self-update payload — every authenticated admin can edit their own
|
|
68
87
|
* first/last name and rotate their password without needing the
|
|
69
88
|
* `admin_users:manage` permission. Role and status are intentionally
|
|
70
|
-
* NOT exposed here.
|
|
89
|
+
* NOT exposed here, and neither is the e-mail address.
|
|
90
|
+
*
|
|
91
|
+
* `password` is the new password, and it is a credential change: a payload
|
|
92
|
+
* that carries it MUST carry `currentPassword` as well, which the route
|
|
93
|
+
* verifies before it changes anything. A session alone does not prove the
|
|
94
|
+
* caller knows the password — an unattended browser holds one too. A payload
|
|
95
|
+
* without `password` needs no `currentPassword`, and one sent anyway is
|
|
96
|
+
* ignored.
|
|
97
|
+
*
|
|
98
|
+
* `currentPassword` is bounded but otherwise unconstrained: it is compared, not
|
|
99
|
+
* stored, and the password policy it was created under is not this schema's to
|
|
100
|
+
* restate.
|
|
71
101
|
*/
|
|
72
102
|
export const updateAdminUserSelfRequestSchema = z
|
|
73
103
|
.object({
|
|
74
104
|
firstName: z.string().min(1).max(120).optional(),
|
|
75
105
|
lastName: z.string().min(1).max(120).optional(),
|
|
76
106
|
password: z.string().min(12).max(120).optional(),
|
|
107
|
+
currentPassword: z.string().min(1).max(256).optional(),
|
|
77
108
|
})
|
|
78
|
-
.strict()
|
|
109
|
+
.strict()
|
|
110
|
+
.superRefine((body, ctx) => {
|
|
111
|
+
if (body.password !== undefined && body.currentPassword === undefined) {
|
|
112
|
+
ctx.addIssue({
|
|
113
|
+
code: 'custom',
|
|
114
|
+
path: ['currentPassword'],
|
|
115
|
+
message: 'The current password is required to set a new one.',
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
});
|
|
79
119
|
/**
|
|
80
120
|
* Peer password reset (issue #252) — one operator sets another operator's
|
|
81
121
|
* password. Deliberately its own payload rather than a `password` field on
|
package/dist/admin.js.map
CHANGED
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MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC"}
|
package/dist/auth.d.ts
CHANGED
|
@@ -23,6 +23,21 @@
|
|
|
23
23
|
export declare const SESSION_COOKIE_NAME = "b2b_session";
|
|
24
24
|
/** The admin session cookie. Same reasoning as {@link SESSION_COOKIE_NAME}. */
|
|
25
25
|
export declare const ADMIN_SESSION_COOKIE_NAME = "b2b_admin_session";
|
|
26
|
+
/**
|
|
27
|
+
* The cookie a completed administrator sign-in leaves on the device, so that
|
|
28
|
+
* the device is recognised as one the account has been used from.
|
|
29
|
+
*
|
|
30
|
+
* It is **not a session** and grants nothing on its own: its only effect is
|
|
31
|
+
* that an attempt carrying it is counted against that device's own budget in
|
|
32
|
+
* the administrator authentication throttle, and not against the account-wide
|
|
33
|
+
* one a stranger can fill. The value comes from
|
|
34
|
+
* `AdminAuthenticationThrottlePort.issueKnownDevice` and the cookie is always
|
|
35
|
+
* set **signed** with the server's cookie secret and `httpOnly`; a reader
|
|
36
|
+
* accepts it only when the signature verifies.
|
|
37
|
+
*/
|
|
38
|
+
export declare const ADMIN_KNOWN_DEVICE_COOKIE_NAME = "b2b_admin_device";
|
|
39
|
+
/** How long a device stays known after its last completed sign-in: 90 days. */
|
|
40
|
+
export declare const ADMIN_KNOWN_DEVICE_MAX_AGE_SECONDS: number;
|
|
26
41
|
export type AuthSessionKind = 'customer' | 'admin' | 'impersonation';
|
|
27
42
|
/**
|
|
28
43
|
* A session row as it crosses the module boundary — a plain shape, never the
|
|
@@ -71,18 +86,44 @@ export interface AuthResolvedSession {
|
|
|
71
86
|
* Whether `auth` has an off state at all is its manifest's `activation` to
|
|
72
87
|
* say, not this line's: a module declaring `nonDeactivatable` never enters one.
|
|
73
88
|
*/
|
|
89
|
+
/** What `AuthSessionPort.destroyAllForAdmin` may be asked to leave in place. */
|
|
90
|
+
export interface AuthDestroyAllForAdminOptions {
|
|
91
|
+
/** The one session to keep — the caller's own. */
|
|
92
|
+
exceptSessionId?: string;
|
|
93
|
+
}
|
|
94
|
+
/** What `AuthSessionPort.destroyAllForCustomer` may be asked to leave in place. */
|
|
95
|
+
export interface AuthDestroyAllForCustomerOptions {
|
|
96
|
+
/** The one session to keep — the caller's own. */
|
|
97
|
+
exceptSessionId?: string;
|
|
98
|
+
}
|
|
74
99
|
export interface AuthSessionPort {
|
|
75
100
|
createSession(input: AuthCreateSessionInput): Promise<AuthSessionCookiePayload>;
|
|
76
101
|
loadSession(cookieValue: string): Promise<AuthResolvedSession | null>;
|
|
77
102
|
destroySession(sessionId: string): Promise<void>;
|
|
78
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Revoke every session held for a customer account — called when the account
|
|
105
|
+
* is blocked or deleted, when its password is changed or reset, and when its
|
|
106
|
+
* second factor is removed.
|
|
107
|
+
*
|
|
108
|
+
* `exceptSessionId` spares one session, the one a self-service change was
|
|
109
|
+
* made from. As with `destroyAllForAdmin`, it spares nothing unless it names
|
|
110
|
+
* a session this call would otherwise have revoked.
|
|
111
|
+
*/
|
|
112
|
+
destroyAllForCustomer(customerAccountId: string, options?: AuthDestroyAllForCustomerOptions): Promise<void>;
|
|
79
113
|
/**
|
|
80
114
|
* Revoke every session an admin user holds — the ones they signed in with
|
|
81
115
|
* and the impersonations they started. Called when their password is set by
|
|
82
116
|
* somebody other than the current session, so a credential the reset was
|
|
83
|
-
* meant to withdraw cannot outlive it (issue #252)
|
|
117
|
+
* meant to withdraw cannot outlive it (issue #252), and when the account is
|
|
118
|
+
* deactivated or deleted.
|
|
119
|
+
*
|
|
120
|
+
* `exceptSessionId` spares one session: the one an administrator changed
|
|
121
|
+
* their own password from, so the change does not sign them out of the
|
|
122
|
+
* screen they made it on. It spares nothing unless it names a session this
|
|
123
|
+
* call would otherwise have revoked, so an id belonging to somebody else is
|
|
124
|
+
* simply ignored.
|
|
84
125
|
*/
|
|
85
|
-
destroyAllForAdmin(adminUserId: string): Promise<void>;
|
|
126
|
+
destroyAllForAdmin(adminUserId: string, options?: AuthDestroyAllForAdminOptions): Promise<void>;
|
|
86
127
|
touchLastSeen(sessionId: string): Promise<void>;
|
|
87
128
|
/** Customer-account ids seen inside the window. Feature 040's "online" view. */
|
|
88
129
|
listRecentlyActiveCustomers(windowMinutes: number): Promise<string[]>;
|
|
@@ -186,5 +227,13 @@ export type MfaLoginDecision = {
|
|
|
186
227
|
*/
|
|
187
228
|
export interface MfaLoginPort {
|
|
188
229
|
beginLogin(subject: MfaSubjectRef, ctx: MfaLoginContext): Promise<MfaLoginDecision>;
|
|
230
|
+
/**
|
|
231
|
+
* Withdraw every pending login challenge and setup ticket `beginLogin` has
|
|
232
|
+
* issued for the subject. Both are issued on the strength of a password that
|
|
233
|
+
* verified, so the module that owns the account calls this when that
|
|
234
|
+
* password is replaced or the account is withdrawn — otherwise a login begun
|
|
235
|
+
* with the old password could still be completed with it.
|
|
236
|
+
*/
|
|
237
|
+
invalidatePending(subject: MfaSubjectRef): Promise<void>;
|
|
189
238
|
}
|
|
190
239
|
//# sourceMappingURL=auth.d.ts.map
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AAEjD,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AAEjD,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB,sBAAsB,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,8BAA8B,qBAAq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B,KAAK,EAAE,IAAI,GACV,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;CACjC;AASD,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,UAAU,GAAG,OAAO,CAAC;IAClC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,6EAA6E;IAC7E,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACpF;;;;;;OAMG;IACH,iBAAiB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1D"}
|
package/dist/auth.js
CHANGED
|
@@ -24,4 +24,19 @@
|
|
|
24
24
|
export const SESSION_COOKIE_NAME = 'b2b_session';
|
|
25
25
|
/** The admin session cookie. Same reasoning as {@link SESSION_COOKIE_NAME}. */
|
|
26
26
|
export const ADMIN_SESSION_COOKIE_NAME = 'b2b_admin_session';
|
|
27
|
+
/**
|
|
28
|
+
* The cookie a completed administrator sign-in leaves on the device, so that
|
|
29
|
+
* the device is recognised as one the account has been used from.
|
|
30
|
+
*
|
|
31
|
+
* It is **not a session** and grants nothing on its own: its only effect is
|
|
32
|
+
* that an attempt carrying it is counted against that device's own budget in
|
|
33
|
+
* the administrator authentication throttle, and not against the account-wide
|
|
34
|
+
* one a stranger can fill. The value comes from
|
|
35
|
+
* `AdminAuthenticationThrottlePort.issueKnownDevice` and the cookie is always
|
|
36
|
+
* set **signed** with the server's cookie secret and `httpOnly`; a reader
|
|
37
|
+
* accepts it only when the signature verifies.
|
|
38
|
+
*/
|
|
39
|
+
export const ADMIN_KNOWN_DEVICE_COOKIE_NAME = 'b2b_admin_device';
|
|
40
|
+
/** How long a device stays known after its last completed sign-in: 90 days. */
|
|
41
|
+
export const ADMIN_KNOWN_DEVICE_MAX_AGE_SECONDS = 90 * 24 * 60 * 60;
|
|
27
42
|
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAEjD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,yBAAyB,GAAG,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAEjD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,yBAAyB,GAAG,mBAAmB,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,kBAAkB,CAAC;AAEjE,+EAA+E;AAC/E,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC"}
|
package/dist/catalog.d.ts
CHANGED
|
@@ -2913,4 +2913,62 @@ export interface CatalogProductFilterPort {
|
|
|
2913
2913
|
listSellable(query: CatalogSellableProductQuery): Promise<CatalogProductRecord[]>;
|
|
2914
2914
|
countSellable(query: Omit<CatalogSellableProductQuery, 'afterId' | 'limit'>): Promise<number>;
|
|
2915
2915
|
}
|
|
2916
|
+
/** The fixed names of the catalogue events offered to outbound webhooks. */
|
|
2917
|
+
export declare const CATALOG_WEBHOOK_EVENTS: {
|
|
2918
|
+
readonly PRODUCT_CREATED: "product.created.v1";
|
|
2919
|
+
readonly PRODUCT_UPDATED: "product.updated.v1";
|
|
2920
|
+
readonly PRODUCT_ARCHIVED: "product.archived.v1";
|
|
2921
|
+
};
|
|
2922
|
+
/** Payload of `product.created.v1` — a product row was created (also by duplication). */
|
|
2923
|
+
export declare const ProductCreatedEventV1Schema: z.ZodObject<{
|
|
2924
|
+
productId: z.ZodString;
|
|
2925
|
+
sku: z.ZodString;
|
|
2926
|
+
eventId: z.ZodString;
|
|
2927
|
+
occurredAt: z.ZodString;
|
|
2928
|
+
}, z.core.$strict>;
|
|
2929
|
+
export type ProductCreatedEventV1 = z.infer<typeof ProductCreatedEventV1Schema>;
|
|
2930
|
+
/**
|
|
2931
|
+
* Payload of `product.updated.v1` — one per product write, also when a variant
|
|
2932
|
+
* of the product was created, changed or deleted (`changedFields` is then
|
|
2933
|
+
* `['variants']`).
|
|
2934
|
+
*/
|
|
2935
|
+
export declare const ProductUpdatedEventV1Schema: z.ZodObject<{
|
|
2936
|
+
productId: z.ZodString;
|
|
2937
|
+
changedFields: z.ZodArray<z.ZodString>;
|
|
2938
|
+
eventId: z.ZodString;
|
|
2939
|
+
occurredAt: z.ZodString;
|
|
2940
|
+
}, z.core.$strict>;
|
|
2941
|
+
export type ProductUpdatedEventV1 = z.infer<typeof ProductUpdatedEventV1Schema>;
|
|
2942
|
+
/**
|
|
2943
|
+
* Payload of `product.archived.v1` — a product's status moved to `inactive`.
|
|
2944
|
+
* Emitted beside the `product.updated.v1` of the same write, after it.
|
|
2945
|
+
*/
|
|
2946
|
+
export declare const ProductArchivedEventV1Schema: z.ZodObject<{
|
|
2947
|
+
productId: z.ZodString;
|
|
2948
|
+
eventId: z.ZodString;
|
|
2949
|
+
occurredAt: z.ZodString;
|
|
2950
|
+
}, z.core.$strict>;
|
|
2951
|
+
export type ProductArchivedEventV1 = z.infer<typeof ProductArchivedEventV1Schema>;
|
|
2952
|
+
/** The event types `catalog` offers to outbound webhooks, in the order they are offered. */
|
|
2953
|
+
export declare const CATALOG_WEBHOOK_EVENT_TYPES: readonly ["product.created.v1", "product.updated.v1", "product.archived.v1"];
|
|
2954
|
+
/** The strict schema of each offered event's payload, by event type. */
|
|
2955
|
+
export declare const CATALOG_WEBHOOK_EVENT_SCHEMAS: {
|
|
2956
|
+
readonly "product.created.v1": z.ZodObject<{
|
|
2957
|
+
productId: z.ZodString;
|
|
2958
|
+
sku: z.ZodString;
|
|
2959
|
+
eventId: z.ZodString;
|
|
2960
|
+
occurredAt: z.ZodString;
|
|
2961
|
+
}, z.core.$strict>;
|
|
2962
|
+
readonly "product.updated.v1": z.ZodObject<{
|
|
2963
|
+
productId: z.ZodString;
|
|
2964
|
+
changedFields: z.ZodArray<z.ZodString>;
|
|
2965
|
+
eventId: z.ZodString;
|
|
2966
|
+
occurredAt: z.ZodString;
|
|
2967
|
+
}, z.core.$strict>;
|
|
2968
|
+
readonly "product.archived.v1": z.ZodObject<{
|
|
2969
|
+
productId: z.ZodString;
|
|
2970
|
+
eventId: z.ZodString;
|
|
2971
|
+
occurredAt: z.ZodString;
|
|
2972
|
+
}, z.core.$strict>;
|
|
2973
|
+
};
|
|
2916
2974
|
//# sourceMappingURL=catalog.d.ts.map
|