@drawbridge/drawbridge-utils 0.0.176 → 0.0.177
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-B9ZaLvan.d.cts +697 -0
- package/dist/admin-C3HtEM6h.d.ts +697 -0
- package/dist/billing-Bc4yo9XG.d.cts +175 -0
- package/dist/billing-mNsKflmQ.d.ts +175 -0
- package/dist/billing.d.cts +1 -1
- package/dist/billing.d.ts +1 -1
- package/dist/connections/index.cjs +3077 -228
- package/dist/connections/index.d.cts +13 -4
- package/dist/connections/index.d.ts +13 -4
- package/dist/connections/index.js +3107 -255
- package/dist/features.cjs +2940 -226
- package/dist/features.d.cts +13 -4
- package/dist/features.d.ts +13 -4
- package/dist/features.js +2980 -260
- package/dist/http.cjs +10 -1
- package/dist/http.d.cts +10 -1
- package/dist/http.d.ts +10 -1
- package/dist/http.js +10 -1
- package/dist/{index-B8JhYfvU.d.ts → index-B546oDNo.d.ts} +2837 -956
- package/dist/{index-qY18QITf.d.cts → index-C59xHago.d.cts} +2837 -956
- package/dist/oauth/index.d.cts +1 -1
- package/dist/oauth/index.d.ts +1 -1
- package/dist/oauth-BJDh0sdM.d.cts +527 -0
- package/dist/oauth-DveZMLHx.d.ts +527 -0
- package/dist/partner-BOZltuh2.d.ts +94 -0
- package/dist/partner-ed2OfW1J.d.cts +94 -0
- package/dist/plans.cjs +2939 -225
- package/dist/plans.d.cts +13 -4
- package/dist/plans.d.ts +13 -4
- package/dist/plans.js +2980 -260
- package/dist/pricing.cjs +2972 -258
- package/dist/pricing.d.cts +13 -4
- package/dist/pricing.d.ts +13 -4
- package/dist/pricing.js +2977 -257
- package/dist/providers.cjs +2942 -247
- package/dist/providers.d.cts +12 -3
- package/dist/providers.d.ts +12 -3
- package/dist/providers.js +2946 -245
- package/dist/sendgrid.cjs +10 -1
- package/dist/sendgrid.js +10 -1
- package/dist/shopify/admin.cjs +562 -0
- package/dist/shopify/admin.d.cts +3 -0
- package/dist/shopify/admin.d.ts +3 -0
- package/dist/shopify/admin.js +528 -0
- package/dist/shopify/billing.cjs +166 -0
- package/dist/shopify/billing.d.cts +3 -0
- package/dist/shopify/billing.d.ts +3 -0
- package/dist/shopify/billing.js +140 -0
- package/dist/shopify/constants.cjs +63 -0
- package/dist/shopify/constants.d.cts +58 -0
- package/dist/shopify/constants.d.ts +58 -0
- package/dist/shopify/constants.js +32 -0
- package/dist/shopify/oauth.cjs +509 -0
- package/dist/shopify/oauth.d.cts +7 -0
- package/dist/shopify/oauth.d.ts +7 -0
- package/dist/shopify/oauth.js +466 -0
- package/dist/shopify/partner.cjs +156 -0
- package/dist/shopify/partner.d.cts +3 -0
- package/dist/shopify/partner.d.ts +3 -0
- package/dist/shopify/partner.js +130 -0
- package/dist/shopify/storefront.cjs +611 -0
- package/dist/shopify/storefront.d.cts +3 -0
- package/dist/shopify/storefront.d.ts +3 -0
- package/dist/shopify/storefront.js +576 -0
- package/dist/storefront-C8FKOGeD.d.cts +659 -0
- package/dist/storefront-DJFGLqPl.d.ts +659 -0
- package/dist/twilio.cjs +10 -1
- package/dist/twilio.js +10 -1
- package/package.json +98 -68
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// lib/http.js
|
|
2
|
+
var DEFAULT_TIMEOUT_MS = 15e3;
|
|
3
|
+
var request = async ({
|
|
4
|
+
body,
|
|
5
|
+
// THE TRANSPORT, injectable and defaulted to the real one.
|
|
6
|
+
//
|
|
7
|
+
// Every other vendor client in this package takes a `fetcher` — it is how
|
|
8
|
+
// klaviyo, mailchimp and attentive are tested without a network, and it is a
|
|
9
|
+
// declared HOOK_OPTION. The Shopify client had no seam at all, so the only way
|
|
10
|
+
// to test a hook that used it was to inject the whole SDK namespace; that
|
|
11
|
+
// injection existed to work around an import cycle, and when the cycle went
|
|
12
|
+
// the tests lost their only hold. This is the seam they should have had.
|
|
13
|
+
fetcher = fetch,
|
|
14
|
+
headers = {},
|
|
15
|
+
method = "GET",
|
|
16
|
+
query,
|
|
17
|
+
timeout = DEFAULT_TIMEOUT_MS,
|
|
18
|
+
type = "json",
|
|
19
|
+
url
|
|
20
|
+
}) => {
|
|
21
|
+
const fullUrl = new URL(url);
|
|
22
|
+
if (query) {
|
|
23
|
+
Object.entries(query).forEach(([k, v]) => fullUrl.searchParams.set(k, v));
|
|
24
|
+
}
|
|
25
|
+
;
|
|
26
|
+
const isForm = type === "form";
|
|
27
|
+
const response = await fetcher(fullUrl.toString(), {
|
|
28
|
+
method,
|
|
29
|
+
headers: {
|
|
30
|
+
"Content-Type": isForm ? "application/x-www-form-urlencoded" : "application/json",
|
|
31
|
+
...headers
|
|
32
|
+
},
|
|
33
|
+
signal: AbortSignal.timeout(timeout),
|
|
34
|
+
...body !== void 0 && {
|
|
35
|
+
body: isForm ? new URLSearchParams(body).toString() : JSON.stringify(body)
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
if (!response.ok) {
|
|
39
|
+
const text2 = await response.text().catch(() => "");
|
|
40
|
+
const error = new Error(text2 || response.statusText);
|
|
41
|
+
error.status = response.status;
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
;
|
|
45
|
+
const text = await response.text();
|
|
46
|
+
try {
|
|
47
|
+
return text ? JSON.parse(text) : null;
|
|
48
|
+
} catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// lib/shopify/constants.js
|
|
54
|
+
var SHOPIFY_APP_API_VERSION = "unstable";
|
|
55
|
+
var REFRESH_TOKEN_LIFETIME_MS = 90 * 24 * 60 * 60 * 1e3;
|
|
56
|
+
var ACCESS_TOKEN_REFRESH_BUFFER_MS = 5 * 60 * 1e3;
|
|
57
|
+
var PARTNER_API_VERSION = process.env.SHOPIFY_PARTNER_API_VERSION || "2026-07";
|
|
58
|
+
|
|
59
|
+
// lib/shopify/billing.js
|
|
60
|
+
var APP_API = "https://api.shopify.com";
|
|
61
|
+
var APP_API_VERSION = process.env.SHOPIFY_APP_API_VERSION || SHOPIFY_APP_API_VERSION;
|
|
62
|
+
var cachedTokens = {};
|
|
63
|
+
var fetchAppToken = async ({ clientId, clientSecret, fetcher }) => {
|
|
64
|
+
const data = await request({
|
|
65
|
+
fetcher,
|
|
66
|
+
method: "POST",
|
|
67
|
+
url: APP_API + "/auth/access_token",
|
|
68
|
+
body: {
|
|
69
|
+
client_id: clientId,
|
|
70
|
+
client_secret: clientSecret,
|
|
71
|
+
grant_type: "client_credentials"
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
if (!(data == null ? void 0 : data.access_token)) {
|
|
75
|
+
throw new Error("Shopify app token request failed: no access token returned");
|
|
76
|
+
}
|
|
77
|
+
;
|
|
78
|
+
const ttl = data.expires_in ? data.expires_in * 1e3 : 60 * 60 * 1e3;
|
|
79
|
+
cachedTokens[clientId] = {
|
|
80
|
+
expiresAt: Date.now() + ttl - 60 * 1e3,
|
|
81
|
+
token: data.access_token
|
|
82
|
+
};
|
|
83
|
+
return data.access_token;
|
|
84
|
+
};
|
|
85
|
+
var getAppToken = async ({ clientId, clientSecret, fetcher }) => {
|
|
86
|
+
const cached = cachedTokens[clientId];
|
|
87
|
+
if (cached && cached.expiresAt > Date.now()) {
|
|
88
|
+
return cached.token;
|
|
89
|
+
}
|
|
90
|
+
;
|
|
91
|
+
return fetchAppToken({ clientId, clientSecret, fetcher });
|
|
92
|
+
};
|
|
93
|
+
var toShopGid = (shopId) => String(shopId).startsWith("gid://") ? String(shopId) : "gid://shopify/Shop/" + shopId;
|
|
94
|
+
var sendAppEvent = async ({ fetcher, clientId, clientSecret, eventHandle, idempotencyKey, reference, revision, shopId, timestamp, value }) => {
|
|
95
|
+
if (!shopId || !eventHandle || !(Number(value) > 0)) {
|
|
96
|
+
throw new Error("sendAppEvent requires shopId, eventHandle, and a positive value");
|
|
97
|
+
}
|
|
98
|
+
;
|
|
99
|
+
if (!clientId || !clientSecret) {
|
|
100
|
+
throw new Error("sendAppEvent requires clientId and clientSecret");
|
|
101
|
+
}
|
|
102
|
+
;
|
|
103
|
+
const suffix = revision ? ".r" + revision : "";
|
|
104
|
+
const key = idempotencyKey && String(idempotencyKey).slice(0, Math.max(0, 64 - suffix.length)) + suffix;
|
|
105
|
+
const body = {
|
|
106
|
+
attributes: {
|
|
107
|
+
value: Number(value),
|
|
108
|
+
...reference && {
|
|
109
|
+
reference: String(reference).slice(0, 128)
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
event_handle: eventHandle,
|
|
113
|
+
shop_id: toShopGid(shopId),
|
|
114
|
+
timestamp: timestamp || (/* @__PURE__ */ new Date()).toISOString(),
|
|
115
|
+
...key && {
|
|
116
|
+
idempotency_key: key
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const send = async (token) => request({
|
|
120
|
+
method: "POST",
|
|
121
|
+
url: APP_API + "/app/" + APP_API_VERSION + "/events",
|
|
122
|
+
headers: {
|
|
123
|
+
"Authorization": "Bearer " + token
|
|
124
|
+
},
|
|
125
|
+
body
|
|
126
|
+
});
|
|
127
|
+
try {
|
|
128
|
+
return await send(await getAppToken({ clientId, clientSecret, fetcher }));
|
|
129
|
+
} catch (error) {
|
|
130
|
+
if ((error == null ? void 0 : error.status) === 401) {
|
|
131
|
+
delete cachedTokens[clientId];
|
|
132
|
+
return send(await fetchAppToken({ clientId, clientSecret, fetcher }));
|
|
133
|
+
}
|
|
134
|
+
;
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
export {
|
|
139
|
+
sendAppEvent
|
|
140
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// lib/shopify/constants.js
|
|
20
|
+
var constants_exports = {};
|
|
21
|
+
__export(constants_exports, {
|
|
22
|
+
ACCESS_TOKEN_REFRESH_BUFFER_MS: () => ACCESS_TOKEN_REFRESH_BUFFER_MS,
|
|
23
|
+
PARTNER_API_VERSION: () => PARTNER_API_VERSION,
|
|
24
|
+
REFRESH_TOKEN_LIFETIME_MS: () => REFRESH_TOKEN_LIFETIME_MS,
|
|
25
|
+
SHOPIFY_ADMIN_API_VERSION: () => SHOPIFY_ADMIN_API_VERSION,
|
|
26
|
+
SHOPIFY_APP_API_VERSION: () => SHOPIFY_APP_API_VERSION,
|
|
27
|
+
SHOPIFY_REQUIRED_SCOPES: () => SHOPIFY_REQUIRED_SCOPES,
|
|
28
|
+
SHOPIFY_STOREFRONT_API_VERSION: () => SHOPIFY_STOREFRONT_API_VERSION,
|
|
29
|
+
SHOPIFY_USAGE_ORDERS_EVENT_HANDLE: () => SHOPIFY_USAGE_ORDERS_EVENT_HANDLE
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(constants_exports);
|
|
32
|
+
var SHOPIFY_STOREFRONT_API_VERSION = "2025-01";
|
|
33
|
+
var SHOPIFY_ADMIN_API_VERSION = "2026-04";
|
|
34
|
+
var SHOPIFY_APP_API_VERSION = "unstable";
|
|
35
|
+
var SHOPIFY_USAGE_ORDERS_EVENT_HANDLE = "drawbridge-orders";
|
|
36
|
+
var SHOPIFY_REQUIRED_SCOPES = [
|
|
37
|
+
"read_customers",
|
|
38
|
+
"write_customers",
|
|
39
|
+
"read_discounts",
|
|
40
|
+
"write_discounts",
|
|
41
|
+
"read_orders",
|
|
42
|
+
"read_products",
|
|
43
|
+
"read_publications",
|
|
44
|
+
"write_resource_feedbacks",
|
|
45
|
+
"unauthenticated_read_checkouts",
|
|
46
|
+
"unauthenticated_read_product_inventory",
|
|
47
|
+
"unauthenticated_read_product_listings",
|
|
48
|
+
"unauthenticated_write_checkouts"
|
|
49
|
+
];
|
|
50
|
+
var REFRESH_TOKEN_LIFETIME_MS = 90 * 24 * 60 * 60 * 1e3;
|
|
51
|
+
var ACCESS_TOKEN_REFRESH_BUFFER_MS = 5 * 60 * 1e3;
|
|
52
|
+
var PARTNER_API_VERSION = process.env.SHOPIFY_PARTNER_API_VERSION || "2026-07";
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
ACCESS_TOKEN_REFRESH_BUFFER_MS,
|
|
56
|
+
PARTNER_API_VERSION,
|
|
57
|
+
REFRESH_TOKEN_LIFETIME_MS,
|
|
58
|
+
SHOPIFY_ADMIN_API_VERSION,
|
|
59
|
+
SHOPIFY_APP_API_VERSION,
|
|
60
|
+
SHOPIFY_REQUIRED_SCOPES,
|
|
61
|
+
SHOPIFY_STOREFRONT_API_VERSION,
|
|
62
|
+
SHOPIFY_USAGE_ORDERS_EVENT_HANDLE
|
|
63
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Shopify API versions — both endpoints follow the same versioning
|
|
2
|
+
// calendar. Bumping these is the single touch-point when migrating to a
|
|
3
|
+
// new quarterly release.
|
|
4
|
+
const SHOPIFY_STOREFRONT_API_VERSION = '2025-01';
|
|
5
|
+
// Admin pinned to 2026-04: the GraphQL webhook + discount + storefront-token
|
|
6
|
+
// operations were schema-validated against this version (and the app config's
|
|
7
|
+
// webhooks api_version matches it).
|
|
8
|
+
const SHOPIFY_ADMIN_API_VERSION = '2026-04';
|
|
9
|
+
|
|
10
|
+
// App Events API (api.shopify.com) — app-level billing/usage events for
|
|
11
|
+
// Shopify App Pricing. Versioned separately from the shop-scoped APIs above.
|
|
12
|
+
//
|
|
13
|
+
// MUST STAY 'unstable' — DO NOT pin to a dated version. Meter billing is not GA
|
|
14
|
+
// (Darren, 2026-08-25): the stable App Events versions do not carry it, and
|
|
15
|
+
// Shopify's generic "never use unstable in production" advice does not apply
|
|
16
|
+
// here. Pinning silently kills usage billing with a failure mode that is
|
|
17
|
+
// indistinguishable from a missing meter — events still 202, still log as plain
|
|
18
|
+
// APP_EVENT, and nothing accrues. Revisit only when Shopify announces meter
|
|
19
|
+
// billing GA. Env-overridable (SHOPIFY_APP_API_VERSION) for that day.
|
|
20
|
+
const SHOPIFY_APP_API_VERSION = 'unstable';
|
|
21
|
+
|
|
22
|
+
// The App Pricing usage meter handle the order-conversion commission is billed
|
|
23
|
+
// against. Fixed app identity (not env-specific) — the Partner Dashboard usage
|
|
24
|
+
// meter must be created with this exact handle to turn these events into usage
|
|
25
|
+
// charges.
|
|
26
|
+
const SHOPIFY_USAGE_ORDERS_EVENT_HANDLE = 'drawbridge-orders';
|
|
27
|
+
|
|
28
|
+
// The canonical scope list every install must have granted. CONTRACT: keep in
|
|
29
|
+
// lockstep with [access_scopes] in drawbridge-shopify-app's shopify.app.*.toml
|
|
30
|
+
// (both files) — a scope added there but not here silently escapes the
|
|
31
|
+
// permissions-outdated check (oauth.js missingScopes). Shopify normalizes
|
|
32
|
+
// grants (write_foo implies read_foo, which then never appears in the granted
|
|
33
|
+
// string); the diff helper accounts for that, so list scopes here exactly as
|
|
34
|
+
// the toml requests them.
|
|
35
|
+
const SHOPIFY_REQUIRED_SCOPES = [
|
|
36
|
+
'read_customers',
|
|
37
|
+
'write_customers',
|
|
38
|
+
'read_discounts',
|
|
39
|
+
'write_discounts',
|
|
40
|
+
'read_orders',
|
|
41
|
+
'read_products',
|
|
42
|
+
'read_publications',
|
|
43
|
+
'write_resource_feedbacks',
|
|
44
|
+
'unauthenticated_read_checkouts',
|
|
45
|
+
'unauthenticated_read_product_inventory',
|
|
46
|
+
'unauthenticated_read_product_listings',
|
|
47
|
+
'unauthenticated_write_checkouts'
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
// Token lifecycle constants used by oauth.js.
|
|
51
|
+
const REFRESH_TOKEN_LIFETIME_MS = 90 * 24 * 60 * 60 * 1000;
|
|
52
|
+
const ACCESS_TOKEN_REFRESH_BUFFER_MS = 5 * 60 * 1000;
|
|
53
|
+
|
|
54
|
+
// The Partner API version the usage-charge accrual reader speaks.
|
|
55
|
+
// Env-overridable for the same reason as the App Events version.
|
|
56
|
+
const PARTNER_API_VERSION = process.env.SHOPIFY_PARTNER_API_VERSION || '2026-07';
|
|
57
|
+
|
|
58
|
+
export { ACCESS_TOKEN_REFRESH_BUFFER_MS, PARTNER_API_VERSION, REFRESH_TOKEN_LIFETIME_MS, SHOPIFY_ADMIN_API_VERSION, SHOPIFY_APP_API_VERSION, SHOPIFY_REQUIRED_SCOPES, SHOPIFY_STOREFRONT_API_VERSION, SHOPIFY_USAGE_ORDERS_EVENT_HANDLE };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Shopify API versions — both endpoints follow the same versioning
|
|
2
|
+
// calendar. Bumping these is the single touch-point when migrating to a
|
|
3
|
+
// new quarterly release.
|
|
4
|
+
const SHOPIFY_STOREFRONT_API_VERSION = '2025-01';
|
|
5
|
+
// Admin pinned to 2026-04: the GraphQL webhook + discount + storefront-token
|
|
6
|
+
// operations were schema-validated against this version (and the app config's
|
|
7
|
+
// webhooks api_version matches it).
|
|
8
|
+
const SHOPIFY_ADMIN_API_VERSION = '2026-04';
|
|
9
|
+
|
|
10
|
+
// App Events API (api.shopify.com) — app-level billing/usage events for
|
|
11
|
+
// Shopify App Pricing. Versioned separately from the shop-scoped APIs above.
|
|
12
|
+
//
|
|
13
|
+
// MUST STAY 'unstable' — DO NOT pin to a dated version. Meter billing is not GA
|
|
14
|
+
// (Darren, 2026-08-25): the stable App Events versions do not carry it, and
|
|
15
|
+
// Shopify's generic "never use unstable in production" advice does not apply
|
|
16
|
+
// here. Pinning silently kills usage billing with a failure mode that is
|
|
17
|
+
// indistinguishable from a missing meter — events still 202, still log as plain
|
|
18
|
+
// APP_EVENT, and nothing accrues. Revisit only when Shopify announces meter
|
|
19
|
+
// billing GA. Env-overridable (SHOPIFY_APP_API_VERSION) for that day.
|
|
20
|
+
const SHOPIFY_APP_API_VERSION = 'unstable';
|
|
21
|
+
|
|
22
|
+
// The App Pricing usage meter handle the order-conversion commission is billed
|
|
23
|
+
// against. Fixed app identity (not env-specific) — the Partner Dashboard usage
|
|
24
|
+
// meter must be created with this exact handle to turn these events into usage
|
|
25
|
+
// charges.
|
|
26
|
+
const SHOPIFY_USAGE_ORDERS_EVENT_HANDLE = 'drawbridge-orders';
|
|
27
|
+
|
|
28
|
+
// The canonical scope list every install must have granted. CONTRACT: keep in
|
|
29
|
+
// lockstep with [access_scopes] in drawbridge-shopify-app's shopify.app.*.toml
|
|
30
|
+
// (both files) — a scope added there but not here silently escapes the
|
|
31
|
+
// permissions-outdated check (oauth.js missingScopes). Shopify normalizes
|
|
32
|
+
// grants (write_foo implies read_foo, which then never appears in the granted
|
|
33
|
+
// string); the diff helper accounts for that, so list scopes here exactly as
|
|
34
|
+
// the toml requests them.
|
|
35
|
+
const SHOPIFY_REQUIRED_SCOPES = [
|
|
36
|
+
'read_customers',
|
|
37
|
+
'write_customers',
|
|
38
|
+
'read_discounts',
|
|
39
|
+
'write_discounts',
|
|
40
|
+
'read_orders',
|
|
41
|
+
'read_products',
|
|
42
|
+
'read_publications',
|
|
43
|
+
'write_resource_feedbacks',
|
|
44
|
+
'unauthenticated_read_checkouts',
|
|
45
|
+
'unauthenticated_read_product_inventory',
|
|
46
|
+
'unauthenticated_read_product_listings',
|
|
47
|
+
'unauthenticated_write_checkouts'
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
// Token lifecycle constants used by oauth.js.
|
|
51
|
+
const REFRESH_TOKEN_LIFETIME_MS = 90 * 24 * 60 * 60 * 1000;
|
|
52
|
+
const ACCESS_TOKEN_REFRESH_BUFFER_MS = 5 * 60 * 1000;
|
|
53
|
+
|
|
54
|
+
// The Partner API version the usage-charge accrual reader speaks.
|
|
55
|
+
// Env-overridable for the same reason as the App Events version.
|
|
56
|
+
const PARTNER_API_VERSION = process.env.SHOPIFY_PARTNER_API_VERSION || '2026-07';
|
|
57
|
+
|
|
58
|
+
export { ACCESS_TOKEN_REFRESH_BUFFER_MS, PARTNER_API_VERSION, REFRESH_TOKEN_LIFETIME_MS, SHOPIFY_ADMIN_API_VERSION, SHOPIFY_APP_API_VERSION, SHOPIFY_REQUIRED_SCOPES, SHOPIFY_STOREFRONT_API_VERSION, SHOPIFY_USAGE_ORDERS_EVENT_HANDLE };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// lib/shopify/constants.js
|
|
2
|
+
var SHOPIFY_STOREFRONT_API_VERSION = "2025-01";
|
|
3
|
+
var SHOPIFY_ADMIN_API_VERSION = "2026-04";
|
|
4
|
+
var SHOPIFY_APP_API_VERSION = "unstable";
|
|
5
|
+
var SHOPIFY_USAGE_ORDERS_EVENT_HANDLE = "drawbridge-orders";
|
|
6
|
+
var SHOPIFY_REQUIRED_SCOPES = [
|
|
7
|
+
"read_customers",
|
|
8
|
+
"write_customers",
|
|
9
|
+
"read_discounts",
|
|
10
|
+
"write_discounts",
|
|
11
|
+
"read_orders",
|
|
12
|
+
"read_products",
|
|
13
|
+
"read_publications",
|
|
14
|
+
"write_resource_feedbacks",
|
|
15
|
+
"unauthenticated_read_checkouts",
|
|
16
|
+
"unauthenticated_read_product_inventory",
|
|
17
|
+
"unauthenticated_read_product_listings",
|
|
18
|
+
"unauthenticated_write_checkouts"
|
|
19
|
+
];
|
|
20
|
+
var REFRESH_TOKEN_LIFETIME_MS = 90 * 24 * 60 * 60 * 1e3;
|
|
21
|
+
var ACCESS_TOKEN_REFRESH_BUFFER_MS = 5 * 60 * 1e3;
|
|
22
|
+
var PARTNER_API_VERSION = process.env.SHOPIFY_PARTNER_API_VERSION || "2026-07";
|
|
23
|
+
export {
|
|
24
|
+
ACCESS_TOKEN_REFRESH_BUFFER_MS,
|
|
25
|
+
PARTNER_API_VERSION,
|
|
26
|
+
REFRESH_TOKEN_LIFETIME_MS,
|
|
27
|
+
SHOPIFY_ADMIN_API_VERSION,
|
|
28
|
+
SHOPIFY_APP_API_VERSION,
|
|
29
|
+
SHOPIFY_REQUIRED_SCOPES,
|
|
30
|
+
SHOPIFY_STOREFRONT_API_VERSION,
|
|
31
|
+
SHOPIFY_USAGE_ORDERS_EVENT_HANDLE
|
|
32
|
+
};
|