@endora-commerce/contracts 0.104.0 → 0.105.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-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 +21 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +21 -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/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/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
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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AClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,wBAAwB;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,S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CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;;;;;;;;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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,EAAE,EAAE,UAAU;IACd,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;IACzB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,WAAW,EAAE,UAAU,CAAC,QAAQ,EAAE;IAClC,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE;IAC7B,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACtC,WAAW,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IACzC,SAAS,EAAE,iBAAiB;IAC5B,SAAS,EAAE,iBAAiB;CAC7B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAChC,iBAAiB,EAAE,CAAC,CAAC,OAAO,EAAE;IAC9B,SAAS,EAAE,iBAAiB;IAC5B,SAAS,EAAE,iBAAiB;CAC7B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,KAAK,EAA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,EAAE,CAAC,QAAQ,EAAE;IAChC,SAAS,EAAE,CAAC,CAAC,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;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G;IACH,mBAAmB,CACjB,YAAY,EAAE,SAAS,MAAM,EAAE,EAC/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
|