platform-types 1.10.726 → 1.10.727
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/appointment.js +2 -1
- package/dist/cjs/appointment.js +2 -1
- package/dist/cjs/store.js +4 -1
- package/dist/store.d.ts +78 -3
- package/dist/store.js +4 -1
- package/package.json +1 -1
package/dist/appointment.js
CHANGED
|
@@ -141,7 +141,8 @@ export const APPOINTMENT_ERROR_CODES = [
|
|
|
141
141
|
'ROLE_FORBIDDEN',
|
|
142
142
|
'APPOINTMENT_FEED_SECRET_NOT_CONFIGURED',
|
|
143
143
|
'APPOINTMENT_FEED_IDENTITY_INVALID',
|
|
144
|
-
// The storefront's self-booking surface, while the store has `modules.appointments` off
|
|
144
|
+
// The storefront's self-booking surface, while the store has `modules.appointments` off;
|
|
145
|
+
// its `data` is `StoreModuleDisabledData` (`StoreModuleRefusalBody` types the whole body).
|
|
145
146
|
'STORE_MODULE_DISABLED',
|
|
146
147
|
];
|
|
147
148
|
/**
|
package/dist/cjs/appointment.js
CHANGED
|
@@ -144,7 +144,8 @@ exports.APPOINTMENT_ERROR_CODES = [
|
|
|
144
144
|
'ROLE_FORBIDDEN',
|
|
145
145
|
'APPOINTMENT_FEED_SECRET_NOT_CONFIGURED',
|
|
146
146
|
'APPOINTMENT_FEED_IDENTITY_INVALID',
|
|
147
|
-
// The storefront's self-booking surface, while the store has `modules.appointments` off
|
|
147
|
+
// The storefront's self-booking surface, while the store has `modules.appointments` off;
|
|
148
|
+
// its `data` is `StoreModuleDisabledData` (`StoreModuleRefusalBody` types the whole body).
|
|
148
149
|
'STORE_MODULE_DISABLED',
|
|
149
150
|
];
|
|
150
151
|
/**
|
package/dist/cjs/store.js
CHANGED
|
@@ -60,7 +60,10 @@ exports.isStoreModuleOn = isStoreModuleOn;
|
|
|
60
60
|
* `STORE_MODULE_KEYS`; `data.module` carries it.
|
|
61
61
|
* - `STORE_MODULE_NOT_BOOLEAN` (400) — a module's value was not `true`/`false`.
|
|
62
62
|
* - `STORE_MODULE_WAREHOUSES_ACTIVE` (409) — `multiWarehouse` off while more
|
|
63
|
-
* than one depósito is active
|
|
63
|
+
* than one depósito is active, or the depósito read stopped before it could
|
|
64
|
+
* count them all; `data.activeWarehouses` carries the count, and
|
|
65
|
+
* `data.truncated: true` marks it as a floor (see
|
|
66
|
+
* {@link StoreModuleWarehousesActiveData}).
|
|
64
67
|
* - `STORE_MODULE_TRANSFER_IN_FLIGHT` (409) — `multiWarehouse` off while a stock
|
|
65
68
|
* transfer is in transit or partially received; `data.transferId` names one.
|
|
66
69
|
* - `STORE_MODULE_CUSTOMER_BALANCES` (409) — `customerAccounts` off while a
|
package/dist/store.d.ts
CHANGED
|
@@ -907,8 +907,10 @@ declare global {
|
|
|
907
907
|
* `400 STORE_MODULE_NOT_BOOLEAN`.
|
|
908
908
|
*
|
|
909
909
|
* Turning a module OFF is refused while it still carries state:
|
|
910
|
-
* `multiWarehouse` while more than one depósito is active
|
|
911
|
-
*
|
|
910
|
+
* `multiWarehouse` while more than one depósito is active, or the
|
|
911
|
+
* depósito read could not finish counting
|
|
912
|
+
* (`409 STORE_MODULE_WAREHOUSES_ACTIVE`, `data.truncated: true` on the
|
|
913
|
+
* latter — `StoreModuleWarehousesActiveData`) or a transfer is in transit or
|
|
912
914
|
* partially received (`409 STORE_MODULE_TRANSFER_IN_FLIGHT`);
|
|
913
915
|
* `customerAccounts` while any customer carries a non-zero balance
|
|
914
916
|
* (`409 STORE_MODULE_CUSTOMER_BALANCES`, or
|
|
@@ -2025,7 +2027,10 @@ export declare const isStoreModuleOn: (modules: StoreModules | null | undefined,
|
|
|
2025
2027
|
* `STORE_MODULE_KEYS`; `data.module` carries it.
|
|
2026
2028
|
* - `STORE_MODULE_NOT_BOOLEAN` (400) — a module's value was not `true`/`false`.
|
|
2027
2029
|
* - `STORE_MODULE_WAREHOUSES_ACTIVE` (409) — `multiWarehouse` off while more
|
|
2028
|
-
* than one depósito is active
|
|
2030
|
+
* than one depósito is active, or the depósito read stopped before it could
|
|
2031
|
+
* count them all; `data.activeWarehouses` carries the count, and
|
|
2032
|
+
* `data.truncated: true` marks it as a floor (see
|
|
2033
|
+
* {@link StoreModuleWarehousesActiveData}).
|
|
2029
2034
|
* - `STORE_MODULE_TRANSFER_IN_FLIGHT` (409) — `multiWarehouse` off while a stock
|
|
2030
2035
|
* transfer is in transit or partially received; `data.transferId` names one.
|
|
2031
2036
|
* - `STORE_MODULE_CUSTOMER_BALANCES` (409) — `customerAccounts` off while a
|
|
@@ -2038,3 +2043,73 @@ export declare const isStoreModuleOn: (modules: StoreModules | null | undefined,
|
|
|
2038
2043
|
*/
|
|
2039
2044
|
export declare const STORE_MODULE_ERROR_CODES: readonly ["STORE_MODULE_UNKNOWN", "STORE_MODULE_NOT_BOOLEAN", "STORE_MODULE_WAREHOUSES_ACTIVE", "STORE_MODULE_TRANSFER_IN_FLIGHT", "STORE_MODULE_CUSTOMER_BALANCES", "STORE_MODULE_BALANCE_CHECK_INCOMPLETE", "STORE_MODULE_DISABLED"];
|
|
2040
2045
|
export type StoreModuleErrorCode = (typeof STORE_MODULE_ERROR_CODES)[number];
|
|
2046
|
+
/** `data` of `400 STORE_MODULE_UNKNOWN` — the unknown key, cut to its first 64 UTF-16 code units. */
|
|
2047
|
+
export interface StoreModuleUnknownData {
|
|
2048
|
+
module: string;
|
|
2049
|
+
}
|
|
2050
|
+
/** `data` of `400 STORE_MODULE_NOT_BOOLEAN` — the module whose value was not a boolean. */
|
|
2051
|
+
export interface StoreModuleNotBooleanData {
|
|
2052
|
+
module: StoreModuleKey;
|
|
2053
|
+
}
|
|
2054
|
+
/**
|
|
2055
|
+
* `data` of `409 STORE_MODULE_WAREHOUSES_ACTIVE`.
|
|
2056
|
+
*
|
|
2057
|
+
* `activeWarehouses` is the number of active depósitos the read SAW.
|
|
2058
|
+
* `truncated: true` marks the read as stopped early, so that number is a FLOOR:
|
|
2059
|
+
* at `2` or more the store still has extra depósitos to deactivate (the true
|
|
2060
|
+
* count is at least that); at `0` or `1` the refusal means only "could not
|
|
2061
|
+
* finish counting", and deactivating depósitos is not the remedy. `truncated`
|
|
2062
|
+
* is present only on a stopped read; its absence means the count is exact (and
|
|
2063
|
+
* therefore above one).
|
|
2064
|
+
*/
|
|
2065
|
+
export interface StoreModuleWarehousesActiveData {
|
|
2066
|
+
module: 'multiWarehouse';
|
|
2067
|
+
activeWarehouses: number;
|
|
2068
|
+
truncated?: true;
|
|
2069
|
+
}
|
|
2070
|
+
/** `data` of `409 STORE_MODULE_TRANSFER_IN_FLIGHT` — one in-flight transfer, the bare `TRF…` id. */
|
|
2071
|
+
export interface StoreModuleTransferInFlightData {
|
|
2072
|
+
module: 'multiWarehouse';
|
|
2073
|
+
transferId: string;
|
|
2074
|
+
}
|
|
2075
|
+
/** `data` of `409 STORE_MODULE_CUSTOMER_BALANCES` — one customer with a balance, the bare `CUST…` id. */
|
|
2076
|
+
export interface StoreModuleCustomerBalancesData {
|
|
2077
|
+
module: 'customerAccounts';
|
|
2078
|
+
customerId: string;
|
|
2079
|
+
}
|
|
2080
|
+
/** `data` of `409 STORE_MODULE_BALANCE_CHECK_INCOMPLETE`. */
|
|
2081
|
+
export interface StoreModuleBalanceCheckIncompleteData {
|
|
2082
|
+
module: 'customerAccounts';
|
|
2083
|
+
}
|
|
2084
|
+
/** `data` of `403 STORE_MODULE_DISABLED` — the switched-off module the request needed. */
|
|
2085
|
+
export interface StoreModuleDisabledData {
|
|
2086
|
+
module: StoreModuleKey;
|
|
2087
|
+
}
|
|
2088
|
+
/**
|
|
2089
|
+
* Each `STORE_MODULE_*` code and the `data` it carries — the union below is
|
|
2090
|
+
* derived from it. Keyed by exactly `StoreModuleErrorCode`, both ways: a code
|
|
2091
|
+
* missing here fails the union's index, and a key no code names fails
|
|
2092
|
+
* `tests/unit/storeModules.test.ts`'s type-level check.
|
|
2093
|
+
*/
|
|
2094
|
+
export interface StoreModuleRefusalDataByCode {
|
|
2095
|
+
STORE_MODULE_UNKNOWN: StoreModuleUnknownData;
|
|
2096
|
+
STORE_MODULE_NOT_BOOLEAN: StoreModuleNotBooleanData;
|
|
2097
|
+
STORE_MODULE_WAREHOUSES_ACTIVE: StoreModuleWarehousesActiveData;
|
|
2098
|
+
STORE_MODULE_TRANSFER_IN_FLIGHT: StoreModuleTransferInFlightData;
|
|
2099
|
+
STORE_MODULE_CUSTOMER_BALANCES: StoreModuleCustomerBalancesData;
|
|
2100
|
+
STORE_MODULE_BALANCE_CHECK_INCOMPLETE: StoreModuleBalanceCheckIncompleteData;
|
|
2101
|
+
STORE_MODULE_DISABLED: StoreModuleDisabledData;
|
|
2102
|
+
}
|
|
2103
|
+
/**
|
|
2104
|
+
* The wire body of any store-module refusal, discriminated on `error` —
|
|
2105
|
+
* narrowing on the code types `data`. Every emitter checks its whole body
|
|
2106
|
+
* against it with `satisfies`, so a code cannot travel with another code's
|
|
2107
|
+
* `data`.
|
|
2108
|
+
*/
|
|
2109
|
+
export type StoreModuleRefusalBody = {
|
|
2110
|
+
[Code in StoreModuleErrorCode]: {
|
|
2111
|
+
error: Code;
|
|
2112
|
+
message: string;
|
|
2113
|
+
data: StoreModuleRefusalDataByCode[Code];
|
|
2114
|
+
};
|
|
2115
|
+
}[StoreModuleErrorCode];
|
package/dist/store.js
CHANGED
|
@@ -55,7 +55,10 @@ export const isStoreModuleOn = (modules, module) => modules?.[module] !== false;
|
|
|
55
55
|
* `STORE_MODULE_KEYS`; `data.module` carries it.
|
|
56
56
|
* - `STORE_MODULE_NOT_BOOLEAN` (400) — a module's value was not `true`/`false`.
|
|
57
57
|
* - `STORE_MODULE_WAREHOUSES_ACTIVE` (409) — `multiWarehouse` off while more
|
|
58
|
-
* than one depósito is active
|
|
58
|
+
* than one depósito is active, or the depósito read stopped before it could
|
|
59
|
+
* count them all; `data.activeWarehouses` carries the count, and
|
|
60
|
+
* `data.truncated: true` marks it as a floor (see
|
|
61
|
+
* {@link StoreModuleWarehousesActiveData}).
|
|
59
62
|
* - `STORE_MODULE_TRANSFER_IN_FLIGHT` (409) — `multiWarehouse` off while a stock
|
|
60
63
|
* transfer is in transit or partially received; `data.transferId` names one.
|
|
61
64
|
* - `STORE_MODULE_CUSTOMER_BALANCES` (409) — `customerAccounts` off while a
|