@c1m-public/channel-client 0.23.0 → 0.24.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/{chunk-SRHMGRCV.js → chunk-3K45GH6B.js} +1 -1
- package/dist/{chunk-LSVDR73B.js → chunk-6VQ4ZTZI.js} +2 -2
- package/dist/{chunk-HNTW6N5F.js → chunk-LG43JMFW.js} +28 -26
- package/dist/{chunk-WZXLYXDN.js → chunk-P3HX34X7.js} +4 -17
- package/dist/dash-next.js +4 -4
- package/dist/dash.js +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/next.js +3 -3
- package/dist/webhooks.js +1 -1
- package/package.json +4 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isChannelAPIError, createChannelClient } from './chunk-
|
|
2
|
-
import { parseChannelWebhookEvent, isChannelWebhookVerificationError, isChannelWebhookEventType, ChannelConfigurationError } from './chunk-
|
|
1
|
+
import { isChannelAPIError, createChannelClient } from './chunk-LG43JMFW.js';
|
|
2
|
+
import { parseChannelWebhookEvent, isChannelWebhookVerificationError, isChannelWebhookEventType, ChannelConfigurationError } from './chunk-P3HX34X7.js';
|
|
3
3
|
import 'server-only';
|
|
4
4
|
|
|
5
5
|
var MAX_AGE_SECONDS = 60 * 60 * 24 * 30;
|
|
@@ -1,32 +1,8 @@
|
|
|
1
|
-
import { ChannelConfigurationError } from './chunk-
|
|
1
|
+
import { ChannelConfigurationError } from './chunk-P3HX34X7.js';
|
|
2
2
|
import 'server-only';
|
|
3
3
|
|
|
4
|
-
// ../
|
|
4
|
+
// ../resilience/src/index.ts
|
|
5
5
|
var RETRYABLE_STATUSES = /* @__PURE__ */ new Set([429, 502, 503, 504]);
|
|
6
|
-
var TransportError = class extends Error {
|
|
7
|
-
constructor(failure) {
|
|
8
|
-
super(failure.message || failure.outcome);
|
|
9
|
-
this.failure = failure;
|
|
10
|
-
this.name = "TransportError";
|
|
11
|
-
}
|
|
12
|
-
failure;
|
|
13
|
-
};
|
|
14
|
-
function isTransportError(error) {
|
|
15
|
-
return error instanceof TransportError || typeof error === "object" && error !== null && error.name === "TransportError";
|
|
16
|
-
}
|
|
17
|
-
function positiveNumber(value, label, fail) {
|
|
18
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) throw fail(`${label} must be a positive finite number`);
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
function nonNegativeInteger(value, label, fail) {
|
|
22
|
-
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) throw fail(`${label} must be a non-negative safe integer`);
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
function requiredString(value, label, fail) {
|
|
26
|
-
const normalized = typeof value === "string" ? value.trim() : "";
|
|
27
|
-
if (!normalized) throw fail(`${label} is required`);
|
|
28
|
-
return normalized;
|
|
29
|
-
}
|
|
30
6
|
function backoffDelay(attempt, maxDelayMs) {
|
|
31
7
|
const base = Math.min(250 * 2 ** Math.max(attempt, 0), maxDelayMs);
|
|
32
8
|
return Math.floor(Math.random() * base);
|
|
@@ -52,6 +28,32 @@ function isRetryableRequest(method, headers, retry) {
|
|
|
52
28
|
if (method === "GET") return true;
|
|
53
29
|
return retry.idempotentWrites === true && headers.has("Idempotency-Key");
|
|
54
30
|
}
|
|
31
|
+
|
|
32
|
+
// ../transport/src/index.ts
|
|
33
|
+
var TransportError = class extends Error {
|
|
34
|
+
constructor(failure) {
|
|
35
|
+
super(failure.message || failure.outcome);
|
|
36
|
+
this.failure = failure;
|
|
37
|
+
this.name = "TransportError";
|
|
38
|
+
}
|
|
39
|
+
failure;
|
|
40
|
+
};
|
|
41
|
+
function isTransportError(error) {
|
|
42
|
+
return error instanceof TransportError || typeof error === "object" && error !== null && error.name === "TransportError";
|
|
43
|
+
}
|
|
44
|
+
function positiveNumber(value, label, fail) {
|
|
45
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) throw fail(`${label} must be a positive finite number`);
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
function nonNegativeInteger(value, label, fail) {
|
|
49
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) throw fail(`${label} must be a non-negative safe integer`);
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
function requiredString(value, label, fail) {
|
|
53
|
+
const normalized = typeof value === "string" ? value.trim() : "";
|
|
54
|
+
if (!normalized) throw fail(`${label} is required`);
|
|
55
|
+
return normalized;
|
|
56
|
+
}
|
|
55
57
|
async function performRequest(transport, url, init, observe, decode) {
|
|
56
58
|
const method = (init.method ?? "GET").toUpperCase();
|
|
57
59
|
const headers = new Headers(init.headers);
|
|
@@ -9,24 +9,11 @@ function isChannelConfigurationError(error) {
|
|
|
9
9
|
return error instanceof ChannelConfigurationError || typeof error === "object" && error !== null && error.name === "ChannelConfigurationError";
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
// src/generated/webhook-events.ts
|
|
13
|
+
var GENERATED_CHANNEL_WEBHOOK_EVENT_TYPES = ["order.created", "order.paid", "order.updated", "order.cancelled", "order.refunded", "lead.created", "review.submitted", "review.published", "page.published", "page.updated", "page.deleted", "menu.updated", "product.created", "product.updated", "product.deleted"];
|
|
14
|
+
|
|
12
15
|
// src/webhooks.ts
|
|
13
|
-
var CHANNEL_WEBHOOK_EVENT_TYPES =
|
|
14
|
-
"order.created",
|
|
15
|
-
"order.paid",
|
|
16
|
-
"order.updated",
|
|
17
|
-
"order.cancelled",
|
|
18
|
-
"order.refunded",
|
|
19
|
-
"lead.created",
|
|
20
|
-
"review.submitted",
|
|
21
|
-
"review.published",
|
|
22
|
-
"page.published",
|
|
23
|
-
"page.updated",
|
|
24
|
-
"page.deleted",
|
|
25
|
-
"menu.updated",
|
|
26
|
-
"product.created",
|
|
27
|
-
"product.updated",
|
|
28
|
-
"product.deleted"
|
|
29
|
-
];
|
|
16
|
+
var CHANNEL_WEBHOOK_EVENT_TYPES = GENERATED_CHANNEL_WEBHOOK_EVENT_TYPES;
|
|
30
17
|
function isChannelWebhookEventType(value) {
|
|
31
18
|
return CHANNEL_WEBHOOK_EVENT_TYPES.includes(value);
|
|
32
19
|
}
|
package/dist/dash-next.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createNextChannelClient } from './chunk-
|
|
2
|
-
import { narrow } from './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
1
|
+
import { createNextChannelClient } from './chunk-6VQ4ZTZI.js';
|
|
2
|
+
import { narrow } from './chunk-3K45GH6B.js';
|
|
3
|
+
import './chunk-LG43JMFW.js';
|
|
4
|
+
import './chunk-P3HX34X7.js';
|
|
5
5
|
import 'server-only';
|
|
6
6
|
|
|
7
7
|
function createNextDashChannelClient(options) {
|
package/dist/dash.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createDashChannelClient, narrow as narrowToDash } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { createDashChannelClient, narrow as narrowToDash } from './chunk-3K45GH6B.js';
|
|
2
|
+
import './chunk-LG43JMFW.js';
|
|
3
|
+
import './chunk-P3HX34X7.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -59,8 +59,8 @@ interface LightInitResponse {
|
|
|
59
59
|
logo_dark_url?: string;
|
|
60
60
|
logo_square_url?: string;
|
|
61
61
|
enabled_features: string[];
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
settings?: {
|
|
63
|
+
currency_code?: string;
|
|
64
64
|
locale?: string;
|
|
65
65
|
timezone?: string;
|
|
66
66
|
};
|
|
@@ -118,7 +118,7 @@ interface DashInitResponse {
|
|
|
118
118
|
}
|
|
119
119
|
interface DashPublicPage {
|
|
120
120
|
profile: DashPublicProfileInfo & {
|
|
121
|
-
|
|
121
|
+
dash_id: string;
|
|
122
122
|
status: string;
|
|
123
123
|
display_name?: string;
|
|
124
124
|
is_private: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ChannelAPIError, DEFAULT_CHANNEL_API_URL, createChannelClient, isChannelAPIError } from './chunk-
|
|
2
|
-
export { CHANNEL_WEBHOOK_EVENT_ID_HEADER, CHANNEL_WEBHOOK_EVENT_TYPES, CHANNEL_WEBHOOK_SIGNATURE_HEADER, CHANNEL_WEBHOOK_TIMESTAMP_HEADER, ChannelConfigurationError, ChannelWebhookVerificationError, DEFAULT_TOLERANCE_SECONDS, isChannelConfigurationError, isChannelWebhookEventType, isChannelWebhookVerificationError, isKnownChannelWebhookEvent, parseChannelWebhookEvent, verifyChannelWebhookSignature } from './chunk-
|
|
1
|
+
export { ChannelAPIError, DEFAULT_CHANNEL_API_URL, createChannelClient, isChannelAPIError } from './chunk-LG43JMFW.js';
|
|
2
|
+
export { CHANNEL_WEBHOOK_EVENT_ID_HEADER, CHANNEL_WEBHOOK_EVENT_TYPES, CHANNEL_WEBHOOK_SIGNATURE_HEADER, CHANNEL_WEBHOOK_TIMESTAMP_HEADER, ChannelConfigurationError, ChannelWebhookVerificationError, DEFAULT_TOLERANCE_SECONDS, isChannelConfigurationError, isChannelWebhookEventType, isChannelWebhookVerificationError, isKnownChannelWebhookEvent, parseChannelWebhookEvent, verifyChannelWebhookSignature } from './chunk-P3HX34X7.js';
|
package/dist/next.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CHANNEL_CATALOG_CACHE_TAG, CHANNEL_SITE_CACHE_TAG, cartCookie, createCart, createChannelWebhookRoute, createCustomerSession, createNextChannelClient, defaultChannelCacheTags, safePublishedPath, sessionCookie } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { CHANNEL_CATALOG_CACHE_TAG, CHANNEL_SITE_CACHE_TAG, cartCookie, createCart, createChannelWebhookRoute, createCustomerSession, createNextChannelClient, defaultChannelCacheTags, safePublishedPath, sessionCookie } from './chunk-6VQ4ZTZI.js';
|
|
2
|
+
import './chunk-LG43JMFW.js';
|
|
3
|
+
import './chunk-P3HX34X7.js';
|
package/dist/webhooks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { CHANNEL_WEBHOOK_EVENT_ID_HEADER, CHANNEL_WEBHOOK_EVENT_TYPES, CHANNEL_WEBHOOK_SIGNATURE_HEADER, CHANNEL_WEBHOOK_TIMESTAMP_HEADER, ChannelWebhookVerificationError, DEFAULT_TOLERANCE_SECONDS, isChannelWebhookEventType, isChannelWebhookVerificationError, isKnownChannelWebhookEvent, parseChannelWebhookEvent, verifyChannelWebhookSignature } from './chunk-
|
|
1
|
+
export { CHANNEL_WEBHOOK_EVENT_ID_HEADER, CHANNEL_WEBHOOK_EVENT_TYPES, CHANNEL_WEBHOOK_SIGNATURE_HEADER, CHANNEL_WEBHOOK_TIMESTAMP_HEADER, ChannelWebhookVerificationError, DEFAULT_TOLERANCE_SECONDS, isChannelWebhookEventType, isChannelWebhookVerificationError, isKnownChannelWebhookEvent, parseChannelWebhookEvent, verifyChannelWebhookSignature } from './chunk-P3HX34X7.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c1m-public/channel-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Typed server-side client for the MML headless Channel API",
|
|
@@ -67,10 +67,11 @@
|
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
+
"tsup": "^8.5.1",
|
|
70
71
|
"typescript": "5.9.3",
|
|
71
|
-
"zod": "^4.3.6",
|
|
72
72
|
"vitest": "^4.1.4",
|
|
73
|
-
"
|
|
73
|
+
"zod": "^4.3.6",
|
|
74
|
+
"@c1m-public/resilience": "0.1.0",
|
|
74
75
|
"@c1m-public/transport": "0.0.0"
|
|
75
76
|
},
|
|
76
77
|
"scripts": {
|