@sixtyninecommerce/client 0.25.0 → 0.27.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/README.md +21 -5
- package/dist/admin/http.d.ts.map +1 -1
- package/dist/admin/http.js +51 -69
- package/dist/admin/http.js.map +1 -1
- package/dist/commerce/quotes.d.ts.map +1 -1
- package/dist/commerce/quotes.js +14 -1
- package/dist/commerce/quotes.js.map +1 -1
- package/dist/content/forms.d.ts.map +1 -1
- package/dist/content/forms.js +13 -5
- package/dist/content/forms.js.map +1 -1
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/context.js +91 -34
- package/dist/core/context.js.map +1 -1
- package/dist/core/http.d.ts +11 -0
- package/dist/core/http.d.ts.map +1 -1
- package/dist/core/http.js +139 -363
- package/dist/core/http.js.map +1 -1
- package/dist/errors.d.ts +85 -24
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +93 -31
- package/dist/errors.js.map +1 -1
- package/dist/events/envelope.d.ts +4 -56
- package/dist/events/envelope.d.ts.map +1 -1
- package/dist/events/envelope.js +6 -12
- package/dist/events/envelope.js.map +1 -1
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/payloads.d.ts +11 -172
- package/dist/events/payloads.d.ts.map +1 -1
- package/dist/events/payloads.js +10 -12
- package/dist/events/payloads.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -1
- package/dist/core/headers.d.ts +0 -5
- package/dist/core/headers.d.ts.map +0 -1
- package/dist/core/headers.js +0 -29
- package/dist/core/headers.js.map +0 -1
package/dist/errors.d.ts
CHANGED
|
@@ -1,24 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The storefront SDK's errors, on the platform's one hierarchy.
|
|
3
|
+
*
|
|
4
|
+
* `StorefrontError` is a {@link PlatformError} (`@sixtyninecommerce/core`), so
|
|
5
|
+
* a consumer holding several SDKs branches on one set of classes and on one
|
|
6
|
+
* `code`. The names this package shipped with — `statusCode`, `errorCode` —
|
|
7
|
+
* stay as accessors over the base's `status` and `code`, so nothing that reads
|
|
8
|
+
* them breaks.
|
|
9
|
+
*/
|
|
10
|
+
import { type ErrorDetail, PlatformError, type ProblemDetails, type ServiceName } from '@sixtyninecommerce/core';
|
|
1
11
|
import type { PlacementRejection, PlacementRejectionCode, PlacementRejectionLine } from './types.js';
|
|
2
|
-
export type
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
12
|
+
export type { ErrorDetail, ProblemDetails, ServiceName };
|
|
13
|
+
/**
|
|
14
|
+
* Field-level validation error returned by the CMS (e.g. form submit).
|
|
15
|
+
*
|
|
16
|
+
* @deprecated Use {@link ErrorDetail} from `@sixtyninecommerce/core`, which is
|
|
17
|
+
* what `StorefrontError.details` carries. This alias only differs in naming.
|
|
18
|
+
*/
|
|
19
|
+
export type FieldError = ErrorDetail;
|
|
20
|
+
/**
|
|
21
|
+
* The `code` a `StorefrontError` carries when nothing on the wire named one —
|
|
22
|
+
* a configuration refusal raised by the SDK itself, or a transport failure the
|
|
23
|
+
* mapper did not classify. `errorCode` stays `undefined` for these, which is
|
|
24
|
+
* what it has always been.
|
|
25
|
+
*/
|
|
26
|
+
export declare const STOREFRONT_ERROR_CODE = "STOREFRONT_ERROR";
|
|
27
|
+
/**
|
|
28
|
+
* The members of a platform error that have no positional slot on
|
|
29
|
+
* {@link StorefrontError}'s constructor. Appended as one optional argument so
|
|
30
|
+
* the six-argument signature this package shipped with keeps working.
|
|
31
|
+
*/
|
|
32
|
+
export interface StorefrontErrorContext {
|
|
33
|
+
/** W3C trace id of the request, from the `traceparent` the transport minted. */
|
|
34
|
+
traceId?: string;
|
|
35
|
+
/** The RFC 9457 body, when the service sent one. */
|
|
36
|
+
problem?: ProblemDetails;
|
|
37
|
+
/**
|
|
38
|
+
* Whether asking again could help. Defaults to `false` — the class default
|
|
39
|
+
* this inherits — so a converted `UpstreamError` must pass the original's
|
|
40
|
+
* value or a 503 would report itself as terminal.
|
|
41
|
+
*/
|
|
42
|
+
retryable?: boolean;
|
|
43
|
+
cause?: unknown;
|
|
8
44
|
}
|
|
9
|
-
export declare class StorefrontError extends
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
readonly errorCode?: string | undefined;
|
|
13
|
-
/** Field-level details parsed from a structured error response. */
|
|
14
|
-
readonly details?: FieldError[] | undefined;
|
|
15
|
-
/** Seconds to wait before retrying, parsed from a 429 response. */
|
|
16
|
-
readonly retryAfterSeconds?: number | undefined;
|
|
17
|
-
constructor(message: string, service: ServiceName, statusCode?: number | undefined, errorCode?: string | undefined,
|
|
45
|
+
export declare class StorefrontError extends PlatformError {
|
|
46
|
+
#private;
|
|
47
|
+
constructor(message: string, service: ServiceName, statusCode?: number, errorCode?: string,
|
|
18
48
|
/** Field-level details parsed from a structured error response. */
|
|
19
|
-
details?:
|
|
49
|
+
details?: ErrorDetail[],
|
|
20
50
|
/** Seconds to wait before retrying, parsed from a 429 response. */
|
|
21
|
-
retryAfterSeconds?: number
|
|
51
|
+
retryAfterSeconds?: number, context?: StorefrontErrorContext);
|
|
52
|
+
/** The HTTP status, or `undefined` when the refusal carried none. */
|
|
53
|
+
get statusCode(): number | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* The wire error code — a Vendure `ErrorResult` type or a service's machine
|
|
56
|
+
* code — or `undefined` when the failure named none. `code` (from
|
|
57
|
+
* `PlatformError`) is the same value with {@link STOREFRONT_ERROR_CODE}
|
|
58
|
+
* standing in for the `undefined` case.
|
|
59
|
+
*/
|
|
60
|
+
get errorCode(): string | undefined;
|
|
22
61
|
}
|
|
23
62
|
/** The structured half of a refusal, hoisted out of the GraphQL ErrorResult. */
|
|
24
63
|
export interface MutationErrorPlacementInfo {
|
|
@@ -27,6 +66,7 @@ export interface MutationErrorPlacementInfo {
|
|
|
27
66
|
lines?: PlacementRejectionLine[];
|
|
28
67
|
}
|
|
29
68
|
export declare class MutationError extends StorefrontError {
|
|
69
|
+
#private;
|
|
30
70
|
readonly fields?: Record<string, unknown> | undefined;
|
|
31
71
|
/**
|
|
32
72
|
* WHY the order/payment was refused, as a stable value to branch on.
|
|
@@ -36,14 +76,17 @@ export declare class MutationError extends StorefrontError {
|
|
|
36
76
|
* same for every reason a placement can fail. `code` is the reason itself
|
|
37
77
|
* (`ORDER_MINIMUM_AMOUNT_NOT_MET`, `PAYMENT_TERMS_UNAVAILABLE`, …).
|
|
38
78
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
79
|
+
* When the refusal carries no structured detail — a core state-machine
|
|
80
|
+
* error, or an engine older than the placement-rejection schema — this falls
|
|
81
|
+
* back to the ErrorResult code rather than being absent, because every
|
|
82
|
+
* platform error carries a `code`. `error.placement !== undefined` tells you
|
|
83
|
+
* a structured reason was there; `error.code !== error.errorCode` tells you
|
|
84
|
+
* the reason is more specific than the result type. Always give a `switch` a
|
|
85
|
+
* `default:`: codes are append-only and an unrecognised one is passed
|
|
86
|
+
* through as-is — which is why the type is widened past the union rather
|
|
87
|
+
* than pretending an exhaustive `switch` can cover it.
|
|
45
88
|
*/
|
|
46
|
-
readonly code
|
|
89
|
+
readonly code: PlacementRejectionCode | (string & {});
|
|
47
90
|
/**
|
|
48
91
|
* The full structured payload: `customerMessage`, the affected `lines`, and
|
|
49
92
|
* the per-code metadata (`requiredAmount`, `requiredQuantity`, `salesUnit`,
|
|
@@ -72,5 +115,23 @@ export declare class MutationError extends StorefrontError {
|
|
|
72
115
|
* `fields.paymentErrorMessage`.
|
|
73
116
|
*/
|
|
74
117
|
message: string, fields?: Record<string, unknown> | undefined, structured?: MutationErrorPlacementInfo);
|
|
118
|
+
/** The Vendure `ErrorResult` type this refusal arrived as. Always present. */
|
|
119
|
+
get errorCode(): string;
|
|
75
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Re-label a `core` error as a `StorefrontError` without losing anything.
|
|
123
|
+
*
|
|
124
|
+
* Every module of this SDK, and every consumer written against it, catches
|
|
125
|
+
* `StorefrontError`. `core`'s transport throws the class its status maps to
|
|
126
|
+
* (`NotFoundError`, `UpstreamError`, …), so the boundary between the two
|
|
127
|
+
* converts rather than leaks: the result is `instanceof StorefrontError` AND
|
|
128
|
+
* `instanceof PlatformError`, carries the same `code`/`status`/`details`/
|
|
129
|
+
* `traceId`/`problem`, and keeps the original on `cause` for anyone who wants
|
|
130
|
+
* the narrower class. NOTHING may be dropped here — this is the only path an
|
|
131
|
+
* error takes out of the SDK, so a member left behind is a member no consumer
|
|
132
|
+
* can ever read.
|
|
133
|
+
*
|
|
134
|
+
* A `StorefrontError` (including a `MutationError`) passes through untouched.
|
|
135
|
+
*/
|
|
136
|
+
export declare function toStorefrontError(error: unknown, service: ServiceName): StorefrontError;
|
|
76
137
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAEpB,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,KAAK,WAAW,EAChB,aAAa,EACb,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC;AAErC;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,qBAAa,eAAgB,SAAQ,aAAa;;gBAK9C,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,WAAW,EACpB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM;IAClB,mEAAmE;IACnE,OAAO,CAAC,EAAE,WAAW,EAAE;IACvB,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,MAAM,EAC1B,OAAO,CAAC,EAAE,sBAAsB;IAuBlC,qEAAqE;IACrE,IAAI,UAAU,IAAI,MAAM,GAAG,SAAS,CAEnC;IAED;;;;;OAKG;IACH,IAAI,SAAS,IAAI,MAAM,GAAG,SAAS,CAElC;CACF;AAED,gFAAgF;AAChF,MAAM,WAAW,0BAA0B;IACzC,IAAI,CAAC,EAAE,sBAAsB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAC9C,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,KAAK,CAAC,EAAE,sBAAsB,EAAE,CAAC;CAClC;AAED,qBAAa,aAAc,SAAQ,eAAe;;aAsD9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IArDlD;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAiB,IAAI,EAAE,sBAAsB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAE9D;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAExC;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,sBAAsB,EAAE,CAAC;gBAKxC,SAAS,EAAE,MAAM;IACjB;;;;;;;OAOG;IACH,OAAO,EAAE,MAAM,EACC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA,EAChD,UAAU,CAAC,EAAE,0BAA0B;IAsBzC,8EAA8E;IAC9E,IAAa,SAAS,IAAI,MAAM,CAE/B;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,GAAG,eAAe,CAyBvF"}
|
package/dist/errors.js
CHANGED
|
@@ -1,41 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The storefront SDK's errors, on the platform's one hierarchy.
|
|
3
|
+
*
|
|
4
|
+
* `StorefrontError` is a {@link PlatformError} (`@sixtyninecommerce/core`), so
|
|
5
|
+
* a consumer holding several SDKs branches on one set of classes and on one
|
|
6
|
+
* `code`. The names this package shipped with — `statusCode`, `errorCode` —
|
|
7
|
+
* stay as accessors over the base's `status` and `code`, so nothing that reads
|
|
8
|
+
* them breaks.
|
|
9
|
+
*/
|
|
10
|
+
import { PlatformError, } from '@sixtyninecommerce/core';
|
|
11
|
+
/**
|
|
12
|
+
* The `code` a `StorefrontError` carries when nothing on the wire named one —
|
|
13
|
+
* a configuration refusal raised by the SDK itself, or a transport failure the
|
|
14
|
+
* mapper did not classify. `errorCode` stays `undefined` for these, which is
|
|
15
|
+
* what it has always been.
|
|
16
|
+
*/
|
|
17
|
+
export const STOREFRONT_ERROR_CODE = 'STOREFRONT_ERROR';
|
|
18
|
+
export class StorefrontError extends PlatformError {
|
|
19
|
+
#statusCode;
|
|
20
|
+
#errorCode;
|
|
7
21
|
constructor(message, service, statusCode, errorCode,
|
|
8
22
|
/** Field-level details parsed from a structured error response. */
|
|
9
23
|
details,
|
|
10
24
|
/** Seconds to wait before retrying, parsed from a 429 response. */
|
|
11
|
-
retryAfterSeconds) {
|
|
12
|
-
super(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
retryAfterSeconds, context) {
|
|
26
|
+
super({
|
|
27
|
+
code: errorCode ?? STOREFRONT_ERROR_CODE,
|
|
28
|
+
message,
|
|
29
|
+
// A refusal with no HTTP status of its own — an abort, a Vendure
|
|
30
|
+
// ErrorResult delivered at 200 — is status 0, which is what `core` uses
|
|
31
|
+
// for "never produced a response". `statusCode` keeps reporting
|
|
32
|
+
// `undefined` for those, so nothing reading it sees a status invented here.
|
|
33
|
+
status: statusCode ?? 0,
|
|
34
|
+
service,
|
|
35
|
+
details,
|
|
36
|
+
retryAfterSeconds,
|
|
37
|
+
traceId: context?.traceId,
|
|
38
|
+
problem: context?.problem,
|
|
39
|
+
retryable: context?.retryable,
|
|
40
|
+
cause: context?.cause,
|
|
41
|
+
});
|
|
18
42
|
this.name = 'StorefrontError';
|
|
43
|
+
this.#statusCode = statusCode;
|
|
44
|
+
this.#errorCode = errorCode;
|
|
45
|
+
}
|
|
46
|
+
/** The HTTP status, or `undefined` when the refusal carried none. */
|
|
47
|
+
get statusCode() {
|
|
48
|
+
return this.#statusCode;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The wire error code — a Vendure `ErrorResult` type or a service's machine
|
|
52
|
+
* code — or `undefined` when the failure named none. `code` (from
|
|
53
|
+
* `PlatformError`) is the same value with {@link STOREFRONT_ERROR_CODE}
|
|
54
|
+
* standing in for the `undefined` case.
|
|
55
|
+
*/
|
|
56
|
+
get errorCode() {
|
|
57
|
+
return this.#errorCode;
|
|
19
58
|
}
|
|
20
59
|
}
|
|
21
60
|
export class MutationError extends StorefrontError {
|
|
22
61
|
fields;
|
|
23
|
-
/**
|
|
24
|
-
* WHY the order/payment was refused, as a stable value to branch on.
|
|
25
|
-
*
|
|
26
|
-
* This is NOT `errorCode` — that names the GraphQL ErrorResult type
|
|
27
|
-
* (`ORDER_STATE_TRANSITION_ERROR`, `PAYMENT_DECLINED_ERROR`), which is the
|
|
28
|
-
* same for every reason a placement can fail. `code` is the reason itself
|
|
29
|
-
* (`ORDER_MINIMUM_AMOUNT_NOT_MET`, `PAYMENT_TERMS_UNAVAILABLE`, …).
|
|
30
|
-
*
|
|
31
|
-
* `undefined` when the refusal carries no structured detail — a core
|
|
32
|
-
* state-machine error, or an engine older than the placement-rejection
|
|
33
|
-
* schema. Fall back to `message`, and always give a `switch` a `default:`:
|
|
34
|
-
* codes are append-only and an unrecognised one is passed through as-is —
|
|
35
|
-
* which is why the type is widened past the union rather than pretending an
|
|
36
|
-
* exhaustive `switch` can cover it.
|
|
37
|
-
*/
|
|
38
|
-
code;
|
|
39
62
|
/**
|
|
40
63
|
* The full structured payload: `customerMessage`, the affected `lines`, and
|
|
41
64
|
* the per-code metadata (`requiredAmount`, `requiredQuantity`, `salesUnit`,
|
|
@@ -54,6 +77,7 @@ export class MutationError extends StorefrontError {
|
|
|
54
77
|
* is what marks every row the shopper has to fix.
|
|
55
78
|
*/
|
|
56
79
|
lines;
|
|
80
|
+
#errorResultCode;
|
|
57
81
|
constructor(errorCode,
|
|
58
82
|
/**
|
|
59
83
|
* Already resolved to the best available prose: the shopper-safe
|
|
@@ -67,12 +91,50 @@ export class MutationError extends StorefrontError {
|
|
|
67
91
|
// A rate-limited result (email change, magic link) carries its wait hint
|
|
68
92
|
// as `retryAfterSeconds`; surface it where a 429 puts it.
|
|
69
93
|
const retryAfterSeconds = typeof fields?.retryAfterSeconds === 'number' ? fields.retryAfterSeconds : undefined;
|
|
70
|
-
|
|
94
|
+
// The structured reason becomes the platform `code`; `errorCode` keeps the
|
|
95
|
+
// ErrorResult type, which is what this class has always reported there.
|
|
96
|
+
super(message, 'vendure', undefined, structured?.code ?? errorCode, undefined, retryAfterSeconds);
|
|
71
97
|
this.fields = fields;
|
|
72
98
|
this.name = 'MutationError';
|
|
73
|
-
this
|
|
99
|
+
this.#errorResultCode = errorCode;
|
|
74
100
|
this.placement = structured?.placement;
|
|
75
101
|
this.lines = structured?.lines;
|
|
76
102
|
}
|
|
103
|
+
/** The Vendure `ErrorResult` type this refusal arrived as. Always present. */
|
|
104
|
+
get errorCode() {
|
|
105
|
+
return this.#errorResultCode;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Re-label a `core` error as a `StorefrontError` without losing anything.
|
|
110
|
+
*
|
|
111
|
+
* Every module of this SDK, and every consumer written against it, catches
|
|
112
|
+
* `StorefrontError`. `core`'s transport throws the class its status maps to
|
|
113
|
+
* (`NotFoundError`, `UpstreamError`, …), so the boundary between the two
|
|
114
|
+
* converts rather than leaks: the result is `instanceof StorefrontError` AND
|
|
115
|
+
* `instanceof PlatformError`, carries the same `code`/`status`/`details`/
|
|
116
|
+
* `traceId`/`problem`, and keeps the original on `cause` for anyone who wants
|
|
117
|
+
* the narrower class. NOTHING may be dropped here — this is the only path an
|
|
118
|
+
* error takes out of the SDK, so a member left behind is a member no consumer
|
|
119
|
+
* can ever read.
|
|
120
|
+
*
|
|
121
|
+
* A `StorefrontError` (including a `MutationError`) passes through untouched.
|
|
122
|
+
*/
|
|
123
|
+
export function toStorefrontError(error, service) {
|
|
124
|
+
if (error instanceof StorefrontError)
|
|
125
|
+
return error;
|
|
126
|
+
if (error instanceof PlatformError) {
|
|
127
|
+
return new StorefrontError(error.message, error.service,
|
|
128
|
+
// `status: 0` is core's "no HTTP status" — an abort, a timeout, a DNS
|
|
129
|
+
// failure. Reporting it as `statusCode: 0` would make `statusCode >= 500`
|
|
130
|
+
// and `!statusCode` disagree about the same error.
|
|
131
|
+
error.status === 0 ? undefined : error.status, error.code === STOREFRONT_ERROR_CODE ? undefined : error.code, error.details.length > 0 ? error.details : undefined, error.retryAfterSeconds, {
|
|
132
|
+
traceId: error.traceId,
|
|
133
|
+
problem: error.problem,
|
|
134
|
+
retryable: error.retryable,
|
|
135
|
+
cause: error,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return new StorefrontError(`${service} request failed: ${error instanceof Error ? error.message : String(error)}`, service);
|
|
77
139
|
}
|
|
78
140
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,60 +1,8 @@
|
|
|
1
|
-
/** What the event is about. `id` is the aggregate's id in its own service. */
|
|
2
|
-
export interface EventAggregateRef {
|
|
3
|
-
readonly type: string;
|
|
4
|
-
readonly id: string | null;
|
|
5
|
-
}
|
|
6
1
|
/**
|
|
7
|
-
* The
|
|
2
|
+
* The platform event envelope, re-exported from `@sixtyninecommerce/core`.
|
|
8
3
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* - `occurred_at` — when the event HAPPENED. Immutable.
|
|
12
|
-
* - `delivered_at` — when THIS delivery attempt was signed. Restamped on every attempt, and
|
|
13
|
-
* ABSENT on the pull feed. Check a replay window against this and only this; a pull
|
|
14
|
-
* response has none, because it can serve up to 90 days of history and the authenticated
|
|
15
|
-
* request is the freshness proof instead.
|
|
16
|
-
*
|
|
17
|
-
* Dedupe on `id`, which is stable across every attempt of one event, and NOT on
|
|
18
|
-
* `channel_code` for tenancy — closing a store renames its code.
|
|
19
|
-
*
|
|
20
|
-
* You will receive `schema_version`s your build does not know: the contract is append-only
|
|
21
|
-
* within a version and a new version is a new number, so skip what you cannot read and keep
|
|
22
|
-
* going. Skipping still advances your cursor.
|
|
4
|
+
* See `events/payloads.ts` for why the contracts live there and why the names
|
|
5
|
+
* are listed rather than star-exported.
|
|
23
6
|
*/
|
|
24
|
-
export
|
|
25
|
-
/** Stable per event, identical across every delivery attempt. Your idempotency key. */
|
|
26
|
-
readonly id: string;
|
|
27
|
-
readonly type: string;
|
|
28
|
-
/** Payload contract version for `type`. */
|
|
29
|
-
readonly schema_version: number;
|
|
30
|
-
readonly channel_code: string;
|
|
31
|
-
/** ISO-8601 UTC. When it happened. NEVER restamped. */
|
|
32
|
-
readonly occurred_at: string;
|
|
33
|
-
/** ISO-8601 UTC. When this attempt was signed. Absent on the pull feed. */
|
|
34
|
-
readonly delivered_at?: string;
|
|
35
|
-
/** Monotonic within `(channel, aggregate)`. Lets you detect gaps and reorder. */
|
|
36
|
-
readonly sequence: number;
|
|
37
|
-
readonly aggregate: EventAggregateRef;
|
|
38
|
-
/** W3C trace id tying this event to the action that caused it. */
|
|
39
|
-
readonly trace_id: string | null;
|
|
40
|
-
readonly data: TData;
|
|
41
|
-
}
|
|
42
|
-
/** One page of the pull feed. */
|
|
43
|
-
export interface PlatformEventPage<TData = Record<string, unknown>> {
|
|
44
|
-
readonly items: PlatformEventEnvelope<TData>[];
|
|
45
|
-
/**
|
|
46
|
-
* Where to resume. Always usable — it is never null, even when you are caught up, so
|
|
47
|
-
* store it after every poll. Storing nothing would restart you from the beginning.
|
|
48
|
-
*/
|
|
49
|
-
readonly next_cursor: string;
|
|
50
|
-
/** More RIGHT NOW. `false` does not mean end of stream; a tail feed has no end. */
|
|
51
|
-
readonly has_next: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* `false` means events above your position were destroyed by retention before you read
|
|
54
|
-
* them, or that you started from the beginning of what survives rather than from a cursor.
|
|
55
|
-
*/
|
|
56
|
-
readonly complete: boolean;
|
|
57
|
-
/** What your `types` filter resolved to. A family wildcard widens as the catalog grows. */
|
|
58
|
-
readonly types: readonly string[];
|
|
59
|
-
}
|
|
7
|
+
export type { EventActorRef, EventAggregateRef, PlatformEventEnvelope, PlatformEventPage, } from '@sixtyninecommerce/core';
|
|
60
8
|
//# sourceMappingURL=envelope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/events/envelope.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/events/envelope.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC"}
|
package/dist/events/envelope.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// external `npm i`. packages/shared's shim-drift spec fails when a copy diverges; edit the
|
|
8
|
-
// canonical file, then re-copy.
|
|
9
|
-
//
|
|
10
|
-
// TYPES ONLY. The catalog's event-type union is deliberately NOT shipped: reproducing it
|
|
11
|
-
// means reproducing the @ts-expect-error guard that fails the build when the union collapses
|
|
12
|
-
// to `string`, and a copy that re-exports the type instead disarms that guard silently.
|
|
1
|
+
/**
|
|
2
|
+
* The platform event envelope, re-exported from `@sixtyninecommerce/core`.
|
|
3
|
+
*
|
|
4
|
+
* See `events/payloads.ts` for why the contracts live there and why the names
|
|
5
|
+
* are listed rather than star-exported.
|
|
6
|
+
*/
|
|
13
7
|
export {};
|
|
14
8
|
//# sourceMappingURL=envelope.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../src/events/envelope.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../src/events/envelope.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/dist/events/index.d.ts
CHANGED
|
@@ -19,6 +19,6 @@ export { verifyEventDelivery } from '../revalidation/event-verify.js';
|
|
|
19
19
|
export type { ChannelUrlRuleSet, UrlContext, UrlContextSource, } from '../revalidation/url-context.js';
|
|
20
20
|
export { urlContextFromChannelSettings, urlContextFromClient, } from '../revalidation/url-context.js';
|
|
21
21
|
export { verifyWebhookSignature } from '../revalidation/verify.js';
|
|
22
|
-
export type { EventAggregateRef, PlatformEventEnvelope, PlatformEventPage, } from './envelope.js';
|
|
22
|
+
export type { EventActorRef, EventAggregateRef, PlatformEventEnvelope, PlatformEventPage, } from './envelope.js';
|
|
23
23
|
export type * from './payloads.js';
|
|
24
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzF,YAAY,EACV,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACpF,YAAY,EACV,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,YAAY,EACV,iBAAiB,EACjB,UAAU,EACV,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,mBAAmB,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzF,YAAY,EACV,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACpF,YAAY,EACV,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,YAAY,EACV,iBAAiB,EACjB,UAAU,EACV,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,mBAAmB,eAAe,CAAC"}
|
|
@@ -1,173 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
export type ContentItemBaseV1 = {
|
|
13
|
-
item_id: string | null;
|
|
14
|
-
collection_id: string | null;
|
|
15
|
-
collection_slug: string;
|
|
16
|
-
status: ContentItemStatusV1;
|
|
17
|
-
is_published: boolean;
|
|
18
|
-
/** Names the `paths` entry every locale WITHOUT its own entry falls back to. */
|
|
19
|
-
default_language_code: string;
|
|
20
|
-
/** Default-language entry always present and first; one entry per translated locale. */
|
|
21
|
-
paths: ContentPathV1[];
|
|
22
|
-
/** True when locale entries were dropped: revalidate more broadly. */
|
|
23
|
-
paths_truncated: boolean;
|
|
24
|
-
};
|
|
25
|
-
export type ContentPublishedV1 = ContentItemBaseV1;
|
|
26
|
-
export type ContentUnpublishedV1 = ContentItemBaseV1;
|
|
27
|
-
export type ContentUpdatedV1 = ContentItemBaseV1 & {
|
|
28
|
-
/** Which keys the mutation INPUT carried — a hint, never a diff. */
|
|
29
|
-
changed: ContentChangeClass[];
|
|
30
|
-
};
|
|
31
|
-
export type ContentCollectionChangeClass = 'name' | 'slug' | 'description' | 'singleton' | 'hierarchical' | 'title_field' | 'page_values' | 'fields';
|
|
32
|
-
export type ContentCollectionBaseV1 = {
|
|
33
|
-
collection_id: string | null;
|
|
34
|
-
collection_slug: string;
|
|
35
|
-
/** The index page's path, channel-relative and locale-unprefixed; `null`: no index page. */
|
|
36
|
-
base_path: string | null;
|
|
37
|
-
/** The base path before this change when it moved — every item path moved with it. */
|
|
38
|
-
previous_base_path: string | null;
|
|
39
|
-
};
|
|
40
|
-
export type ContentCollectionCreatedV1 = ContentCollectionBaseV1;
|
|
41
|
-
export type ContentCollectionRemovedV1 = ContentCollectionBaseV1;
|
|
42
|
-
export type ContentCollectionUpdatedV1 = ContentCollectionBaseV1 & {
|
|
43
|
-
changed: ContentCollectionChangeClass[];
|
|
44
|
-
};
|
|
45
|
-
export type SiteContentKindV1 = 'content_strings' | 'menu' | 'form_definition' | 'asset' | 'other';
|
|
46
|
-
export type SiteContentResourceScopeV1 = 'named' | 'unnamed';
|
|
47
|
-
export type SiteContentChangedV1 = {
|
|
48
|
-
channel_id: string | null;
|
|
49
|
-
kind: SiteContentKindV1;
|
|
50
|
-
resource_scope: SiteContentResourceScopeV1;
|
|
51
|
-
resource_ids: string[];
|
|
52
|
-
resource_ids_truncated: boolean;
|
|
53
|
-
};
|
|
54
|
-
export type CollectionChangeClass = 'translations' | 'parent' | 'is_private' | 'filters' | 'inherit_filters' | 'assets' | 'featured_asset' | 'custom_fields';
|
|
55
|
-
export type CollectionStateV1 = {
|
|
56
|
-
is_private: boolean;
|
|
57
|
-
is_root: boolean;
|
|
58
|
-
is_routable: boolean;
|
|
59
|
-
is_canonical: boolean;
|
|
60
|
-
};
|
|
61
|
-
export type CollectionEntityChangeBaseV1 = CollectionStateV1 & {
|
|
62
|
-
collection_id: string | null;
|
|
63
|
-
/** `null` means the event carried no input (core's `move()`) — never the quieter case. */
|
|
64
|
-
changed: CollectionChangeClass[] | null;
|
|
65
|
-
translation_language_codes: string[];
|
|
66
|
-
translation_language_codes_truncated: boolean;
|
|
67
|
-
};
|
|
68
|
-
export type CollectionCreatedV1 = CollectionEntityChangeBaseV1;
|
|
69
|
-
export type CollectionUpdatedV1 = CollectionEntityChangeBaseV1;
|
|
70
|
-
export type CollectionDeletedV1 = CollectionStateV1 & {
|
|
71
|
-
collection_id: string | null;
|
|
72
|
-
};
|
|
73
|
-
export type CollectionAffectedScopeV1 = 'changed' | 'membership';
|
|
74
|
-
export type CollectionMembershipChangedV1 = {
|
|
75
|
-
collection_id: string | null;
|
|
76
|
-
affected_scope: CollectionAffectedScopeV1;
|
|
77
|
-
/** VARIANT ids, capped; a sample, never an enumeration. */
|
|
78
|
-
affected_variant_ids: string[];
|
|
79
|
-
affected_variant_ids_truncated: boolean;
|
|
80
|
-
is_private: boolean;
|
|
81
|
-
is_root: boolean;
|
|
82
|
-
};
|
|
83
|
-
export type UrlLocaleStrategyV1 = 'path-prefix' | 'subdomain' | 'none';
|
|
84
|
-
export type ChannelUrlSettingClass = 'storefront_url' | 'url_locale_strategy' | 'url_locale_prefix_default' | 'commerce_path_prefix' | 'commerce_path_prefix_translations' | 'product_path_segment' | 'default_language' | 'available_languages';
|
|
85
|
-
export type ChannelPathPrefixV1 = {
|
|
86
|
-
language_code: string;
|
|
87
|
-
/** `''` means "no prefix in this language"; an absent entry falls back to the default. */
|
|
88
|
-
path_prefix: string;
|
|
89
|
-
};
|
|
90
|
-
/** The channel's complete URL rule set AFTER the change. */
|
|
91
|
-
export type ChannelUrlSettingsChangedV1 = {
|
|
92
|
-
channel_id: string | null;
|
|
93
|
-
changed: ChannelUrlSettingClass[];
|
|
94
|
-
/** Trailing slashes removed; `null` when unset. */
|
|
95
|
-
storefront_url: string | null;
|
|
96
|
-
url_locale_strategy: UrlLocaleStrategyV1;
|
|
97
|
-
url_locale_prefix_default: boolean;
|
|
98
|
-
commerce_path_prefix: string | null;
|
|
99
|
-
commerce_path_prefix_overrides: ChannelPathPrefixV1[];
|
|
100
|
-
commerce_path_prefix_overrides_truncated: boolean;
|
|
101
|
-
product_path_segment: string;
|
|
102
|
-
default_language_code: string;
|
|
103
|
-
available_language_codes: string[];
|
|
104
|
-
available_language_codes_truncated: boolean;
|
|
105
|
-
};
|
|
106
|
-
export type SeoPathEntityTypeV1 = 'cms' | 'collection' | 'product';
|
|
107
|
-
export type SeoPathDiffTriggerV1 = 'event' | 'sweep' | 'manual';
|
|
108
|
-
export type SeoPathChangeV1 = {
|
|
109
|
-
entity_type: SeoPathEntityTypeV1;
|
|
110
|
-
entity_id: string;
|
|
111
|
-
language_code: string;
|
|
112
|
-
/** Channel-relative, locale-unprefixed; the commerce prefix is ALREADY applied. */
|
|
113
|
-
path: string;
|
|
114
|
-
};
|
|
115
|
-
export type SeoPathsChangedV1 = {
|
|
116
|
-
channel_id: string | null;
|
|
117
|
-
run_id: string | null;
|
|
118
|
-
trigger: SeoPathDiffTriggerV1;
|
|
119
|
-
added: SeoPathChangeV1[];
|
|
120
|
-
added_count: number;
|
|
121
|
-
added_truncated: boolean;
|
|
122
|
-
removed: SeoPathChangeV1[];
|
|
123
|
-
removed_count: number;
|
|
124
|
-
removed_truncated: boolean;
|
|
125
|
-
};
|
|
126
|
-
export type CatalogueChangeClass = 'translations' | 'enabled' | 'assets' | 'facets' | 'options' | 'price' | 'stock' | 'sku' | 'tax' | 'custom_fields';
|
|
127
|
-
export type ProductChangeBaseV1 = {
|
|
128
|
-
product_id: string | null;
|
|
129
|
-
changed: CatalogueChangeClass[];
|
|
130
|
-
translation_language_codes: string[];
|
|
131
|
-
translation_language_codes_truncated: boolean;
|
|
132
|
-
};
|
|
133
|
-
export type ProductCreatedV1 = ProductChangeBaseV1;
|
|
134
|
-
export type ProductUpdatedV1 = ProductChangeBaseV1;
|
|
135
|
-
export type ProductDeletedV1 = {
|
|
136
|
-
product_id: string | null;
|
|
137
|
-
variant_ids: string[];
|
|
138
|
-
variant_ids_truncated: boolean;
|
|
139
|
-
};
|
|
140
|
-
export type ProductVariantPriceChangedV1 = {
|
|
141
|
-
variant_id: string | null;
|
|
142
|
-
product_id: string | null;
|
|
143
|
-
sku: string;
|
|
144
|
-
currency_code: string;
|
|
145
|
-
/** Minor units, net of tax. */
|
|
146
|
-
price: number;
|
|
147
|
-
/** Minor units, gross. */
|
|
148
|
-
price_with_tax: number;
|
|
149
|
-
changed_currency_codes: string[];
|
|
150
|
-
changed_currency_codes_truncated: boolean;
|
|
151
|
-
};
|
|
152
|
-
/** Payload per event type, version 1, for every type `createEventRevalidateHandler` acts on. */
|
|
153
|
-
export interface RevalidationPayloadByTypeV1 {
|
|
154
|
-
'content.published': ContentPublishedV1;
|
|
155
|
-
'content.updated': ContentUpdatedV1;
|
|
156
|
-
'content.unpublished': ContentUnpublishedV1;
|
|
157
|
-
'content.collection.created': ContentCollectionCreatedV1;
|
|
158
|
-
'content.collection.updated': ContentCollectionUpdatedV1;
|
|
159
|
-
'content.collection.removed': ContentCollectionRemovedV1;
|
|
160
|
-
'content.site_content_changed': SiteContentChangedV1;
|
|
161
|
-
'collection.created': CollectionCreatedV1;
|
|
162
|
-
'collection.updated': CollectionUpdatedV1;
|
|
163
|
-
'collection.deleted': CollectionDeletedV1;
|
|
164
|
-
'collection.membership_changed': CollectionMembershipChangedV1;
|
|
165
|
-
'channel.url_settings_changed': ChannelUrlSettingsChangedV1;
|
|
166
|
-
'seo.paths_changed': SeoPathsChangedV1;
|
|
167
|
-
'product.created': ProductCreatedV1;
|
|
168
|
-
'product.updated': ProductUpdatedV1;
|
|
169
|
-
'product.deleted': ProductDeletedV1;
|
|
170
|
-
'product_variant.price_changed': ProductVariantPriceChangedV1;
|
|
171
|
-
}
|
|
172
|
-
export type RevalidationEventTypeV1 = keyof RevalidationPayloadByTypeV1;
|
|
1
|
+
/**
|
|
2
|
+
* Revalidation payload contracts, re-exported from `@sixtyninecommerce/core`.
|
|
3
|
+
*
|
|
4
|
+
* The byte-identical copy of `packages/shared/src/events/shims/` lives in
|
|
5
|
+
* `core` now — one published home for the wire contracts, so the admin SDK and
|
|
6
|
+
* this one cannot disagree about an envelope. The names are listed rather than
|
|
7
|
+
* star-exported on purpose: a contract removed from `core` fails the build
|
|
8
|
+
* HERE, at the entry point consumers import, instead of vanishing from
|
|
9
|
+
* `@sixtyninecommerce/client/events` unnoticed.
|
|
10
|
+
*/
|
|
11
|
+
export type { CatalogueChangeClass, ChannelPathPrefixV1, ChannelUrlSettingClass, ChannelUrlSettingsChangedV1, CollectionAffectedScopeV1, CollectionChangeClass, CollectionCreatedV1, CollectionDeletedV1, CollectionEntityChangeBaseV1, CollectionMembershipChangedV1, CollectionStateV1, CollectionUpdatedV1, ContentChangeClass, ContentCollectionBaseV1, ContentCollectionChangeClass, ContentCollectionCreatedV1, ContentCollectionRemovedV1, ContentCollectionUpdatedV1, ContentItemBaseV1, ContentItemStatusV1, ContentPathV1, ContentPublishedV1, ContentUnpublishedV1, ContentUpdatedV1, ProductChangeBaseV1, ProductCreatedV1, ProductDeletedV1, ProductUpdatedV1, ProductVariantPriceChangedV1, RevalidationEventTypeV1, RevalidationPayloadByTypeV1, SeoPathChangeV1, SeoPathDiffTriggerV1, SeoPathEntityTypeV1, SeoPathsChangedV1, SiteContentChangedV1, SiteContentKindV1, SiteContentResourceScopeV1, UrlLocaleStrategyV1, } from '@sixtyninecommerce/core';
|
|
173
12
|
//# sourceMappingURL=payloads.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payloads.d.ts","sourceRoot":"","sources":["../../src/events/payloads.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"payloads.d.ts","sourceRoot":"","sources":["../../src/events/payloads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,EAC3B,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,4BAA4B,EAC5B,6BAA6B,EAC7B,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,EAC1B,0BAA0B,EAC1B,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,4BAA4B,EAC5B,uBAAuB,EACvB,2BAA2B,EAC3B,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,yBAAyB,CAAC"}
|