@caartzee/theme-sdk 1.2.1 → 1.2.3
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/bin/caartzee-theme.js +100 -13
- package/dist/lib/index.js +98 -11
- package/dist/types/src/blocks/block-contract.d.ts +10 -10
- package/dist/types/src/cli/candy-tool-server.d.ts +1 -0
- package/dist/types/src/cli/mcp/editor-tools.d.ts +4 -1
- package/dist/types/src/cli/mcp/v2-api-catalog.d.ts +69 -0
- package/dist/types/src/cli/mcp/v2-commerce-tools.d.ts +6 -4
- package/dist/types/src/cli/sdk-client.d.ts +11 -1
- package/dist/types/src/contracts/manifest.d.ts +77 -77
- package/dist/types/src/sections/section-contract.d.ts +12 -12
- package/package.json +1 -1
- package/templates/commerce/manifest.json +1 -1
|
@@ -5,6 +5,7 @@ import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
|
5
5
|
import { execFileSync } from "node:child_process";
|
|
6
6
|
|
|
7
7
|
// src/cli/sdk-client.ts
|
|
8
|
+
import { createHash } from "node:crypto";
|
|
8
9
|
import { readFileSync as readFileSync2, readdirSync } from "node:fs";
|
|
9
10
|
import { join as join2 } from "node:path";
|
|
10
11
|
|
|
@@ -77,7 +78,12 @@ function parseSdkConnection(input) {
|
|
|
77
78
|
if (!value || typeof value !== "object" || !("format" in value) || value.format !== "caartzee-theme-sdk-v1" || !("api" in value) || typeof value.api !== "string" || !("token" in value) || typeof value.token !== "string" || !value.token.trim() || value.token.length > 8192) {
|
|
78
79
|
throw new Error("Copy a new SDK connection from Developer Portal > Theme SDK.");
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
+
const rawRefresh = "refreshToken" in value && typeof value.refreshToken === "string" ? value.refreshToken.trim() : undefined;
|
|
82
|
+
return {
|
|
83
|
+
api: sdkEndpoint(value.api),
|
|
84
|
+
token: value.token.trim(),
|
|
85
|
+
...rawRefresh ? { refreshToken: rawRefresh } : {}
|
|
86
|
+
};
|
|
81
87
|
}
|
|
82
88
|
async function sdkRequest(endpoint, token, query, variables = {}) {
|
|
83
89
|
const response = await fetch(sdkEndpoint(endpoint), {
|
|
@@ -91,7 +97,55 @@ async function sdkRequest(endpoint, token, query, variables = {}) {
|
|
|
91
97
|
throw new Error(result.errors?.map((e) => e.message).join("; ") || `SDK API returned HTTP ${response.status}`);
|
|
92
98
|
return result.data;
|
|
93
99
|
}
|
|
94
|
-
async function
|
|
100
|
+
async function refreshSdkCredentials(credentials) {
|
|
101
|
+
if (!credentials.refreshToken) {
|
|
102
|
+
throw new Error("SDK access token expired and no refresh token is stored. Reconnect via Developer Portal > Theme SDK (`caartzee-theme connect --clipboard`).");
|
|
103
|
+
}
|
|
104
|
+
const response = await fetch(sdkEndpoint(credentials.portalUrl), {
|
|
105
|
+
method: "POST",
|
|
106
|
+
headers: { "Content-Type": "application/json" },
|
|
107
|
+
body: JSON.stringify({
|
|
108
|
+
query: "mutation($refreshToken: String!) { refreshThemeSdkToken(refreshToken: $refreshToken) { token refreshToken expiresIn appId } }",
|
|
109
|
+
variables: { refreshToken: credentials.refreshToken }
|
|
110
|
+
}),
|
|
111
|
+
signal: AbortSignal.timeout(30000)
|
|
112
|
+
});
|
|
113
|
+
const result = await response.json();
|
|
114
|
+
const refreshed = result.data?.refreshThemeSdkToken;
|
|
115
|
+
if (!response.ok || result.errors?.length || !refreshed?.token) {
|
|
116
|
+
throw new Error(result.errors?.map((e) => e.message).join("; ") || `Failed to refresh SDK token (HTTP ${response.status}). Copy a new SDK connection from Developer Portal > Theme SDK.`);
|
|
117
|
+
}
|
|
118
|
+
const updated = {
|
|
119
|
+
...credentials,
|
|
120
|
+
accessToken: refreshed.token,
|
|
121
|
+
refreshToken: refreshed.refreshToken || credentials.refreshToken,
|
|
122
|
+
expiresAt: Date.now() + refreshed.expiresIn * 1000,
|
|
123
|
+
savedAt: new Date().toISOString()
|
|
124
|
+
};
|
|
125
|
+
saveDeveloperCredentials(updated);
|
|
126
|
+
return updated;
|
|
127
|
+
}
|
|
128
|
+
var REFRESH_BUFFER_MS = 5 * 60 * 1000;
|
|
129
|
+
async function sdkRequestWithAutoRefresh(credentials, query, variables = {}) {
|
|
130
|
+
let active = credentials;
|
|
131
|
+
if (typeof active.expiresAt === "number" && active.expiresAt - Date.now() <= REFRESH_BUFFER_MS && active.refreshToken) {
|
|
132
|
+
active = await refreshSdkCredentials(active);
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
const data = await sdkRequest(active.portalUrl, active.accessToken, query, variables);
|
|
136
|
+
return { data, credentials: active };
|
|
137
|
+
} catch (err) {
|
|
138
|
+
const msg = String(err?.message || "");
|
|
139
|
+
const isAuthExpired = /expired|invalid.*token|unauthorized|401/i.test(msg);
|
|
140
|
+
if (isAuthExpired && active.refreshToken) {
|
|
141
|
+
active = await refreshSdkCredentials(active);
|
|
142
|
+
const data = await sdkRequest(active.portalUrl, active.accessToken, query, variables);
|
|
143
|
+
return { data, credentials: active };
|
|
144
|
+
}
|
|
145
|
+
throw err;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async function connectSdk(endpoint, token, refreshToken) {
|
|
95
149
|
const data = await sdkRequest(endpoint, token, "query { themeSdkWorkspace { appId developerId name expiresAt } }");
|
|
96
150
|
const app = data.themeSdkWorkspace;
|
|
97
151
|
const credentials = {
|
|
@@ -100,6 +154,7 @@ async function connectSdk(endpoint, token) {
|
|
|
100
154
|
email: "",
|
|
101
155
|
name: app.name,
|
|
102
156
|
accessToken: token,
|
|
157
|
+
...refreshToken ? { refreshToken } : {},
|
|
103
158
|
expiresAt: app.expiresAt * 1000,
|
|
104
159
|
scopes: ["theme:read", "theme:write"],
|
|
105
160
|
portalUrl: sdkEndpoint(endpoint),
|
|
@@ -108,6 +163,10 @@ async function connectSdk(endpoint, token) {
|
|
|
108
163
|
saveDeveloperCredentials(credentials);
|
|
109
164
|
return credentials;
|
|
110
165
|
}
|
|
166
|
+
function computeCanonicalPackageChecksum(files) {
|
|
167
|
+
const canonical = [...files].sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
168
|
+
return createHash("sha256").update(JSON.stringify(canonical)).digest("hex");
|
|
169
|
+
}
|
|
111
170
|
function collectThemeSources(root) {
|
|
112
171
|
const files = [];
|
|
113
172
|
let total = 0;
|
|
@@ -1884,7 +1943,7 @@ async function scaffoldCommerceTheme(options) {
|
|
|
1884
1943
|
return { success: true, themeSlug: slug, themeName: name, slug, name, targetDir: target, createdFiles };
|
|
1885
1944
|
}
|
|
1886
1945
|
// src/auth/oauth-client.ts
|
|
1887
|
-
import { createHash, randomBytes } from "node:crypto";
|
|
1946
|
+
import { createHash as createHash2, randomBytes } from "node:crypto";
|
|
1888
1947
|
import { createServer } from "node:http";
|
|
1889
1948
|
var DEFAULT_PORTAL_URL = "https://partners.caartzee.com";
|
|
1890
1949
|
var DEFAULT_CLIENT_ID = "caartzee-theme-cli";
|
|
@@ -1892,7 +1951,7 @@ var DEFAULT_REDIRECT_PORT = 8484;
|
|
|
1892
1951
|
var DEFAULT_SCOPES = ["theme:read", "theme:write", "theme:publish"];
|
|
1893
1952
|
function generatePkcePair() {
|
|
1894
1953
|
const codeVerifier = randomBytes(32).toString("base64url");
|
|
1895
|
-
const codeChallenge =
|
|
1954
|
+
const codeChallenge = createHash2("sha256").update(codeVerifier).digest("base64url");
|
|
1896
1955
|
const state = randomBytes(24).toString("base64url");
|
|
1897
1956
|
return {
|
|
1898
1957
|
codeVerifier,
|
|
@@ -3812,6 +3871,7 @@ var SettingTypeSchema = z3.enum([
|
|
|
3812
3871
|
"range",
|
|
3813
3872
|
"url",
|
|
3814
3873
|
"json",
|
|
3874
|
+
"html",
|
|
3815
3875
|
"code",
|
|
3816
3876
|
"javascript",
|
|
3817
3877
|
"category_list",
|
|
@@ -3924,7 +3984,7 @@ var RAW_HTML_SECTION_MANIFEST = {
|
|
|
3924
3984
|
settings: [
|
|
3925
3985
|
{
|
|
3926
3986
|
id: "html",
|
|
3927
|
-
type: "
|
|
3987
|
+
type: "html",
|
|
3928
3988
|
label: "HTML Content",
|
|
3929
3989
|
placeholder: "<div>Custom HTML content...</div>",
|
|
3930
3990
|
required: false,
|
|
@@ -5189,6 +5249,9 @@ function buildCandyContext(options) {
|
|
|
5189
5249
|
const currencySymbol = String(anyCtx.currencyInfo?.symbol || mergedSettings.currencySymbol || "$");
|
|
5190
5250
|
const currencyCode = String(anyCtx.currencyInfo?.code || anyCtx.currencyInfo?.currency || mergedSettings.currency || "USD");
|
|
5191
5251
|
const currencyPosition = anyCtx.currencyInfo?.currencyPosition === "right" ? "right" : "left";
|
|
5252
|
+
const bootstrapPayment = anyCtx.bootstrap?.payment;
|
|
5253
|
+
const bootstrapGateways = Array.isArray(bootstrapPayment?.gateways) ? bootstrapPayment.gateways : [];
|
|
5254
|
+
const magicCheckoutEnabled = Boolean(bootstrapPayment?.magicCheckout === true || bootstrapPayment?.magic_checkout === true || bootstrapGateways.some((gw) => gw && String(gw.name || "").toLowerCase() === "razorpay" && gw.enabled !== false && Boolean(gw.magicCheckout || gw.magic_checkout || gw.config?.magicCheckout || gw.config?.magic_checkout)));
|
|
5192
5255
|
const shop = {
|
|
5193
5256
|
name: storeName,
|
|
5194
5257
|
description: String(anyCtx.siteSettings?.siteTagline || pageContext.seo?.description || ""),
|
|
@@ -5204,7 +5267,13 @@ function buildCandyContext(options) {
|
|
|
5204
5267
|
secure_url: "/",
|
|
5205
5268
|
domain: pageContext.tenantId || "localhost",
|
|
5206
5269
|
permanent_domain: pageContext.tenantId || "localhost",
|
|
5207
|
-
logo_url: anyCtx.siteSettings?.logoUrl || mergedSettings.logoUrl || null
|
|
5270
|
+
logo_url: anyCtx.siteSettings?.logoUrl || mergedSettings.logoUrl || null,
|
|
5271
|
+
magic_checkout_enabled: magicCheckoutEnabled,
|
|
5272
|
+
payment_gateways: bootstrapGateways.filter((gw) => gw && gw.enabled !== false).map((gw) => ({
|
|
5273
|
+
name: String(gw.name || ""),
|
|
5274
|
+
enabled: gw.enabled !== false,
|
|
5275
|
+
magic_checkout: Boolean(gw.magicCheckout || gw.magic_checkout || gw.config?.magicCheckout || gw.config?.magic_checkout)
|
|
5276
|
+
}))
|
|
5208
5277
|
};
|
|
5209
5278
|
const rawProducts = anyCtx.products || anyCtx.featuredProducts || anyCtx.results?.products || (anyCtx.product ? [anyCtx.product] : []);
|
|
5210
5279
|
const normalizedProducts = rawProducts.map(normalizeProductForCandy);
|
|
@@ -6917,6 +6986,9 @@ function loadCandyThemeFromSource(source, fallbackSlug = "candy-theme") {
|
|
|
6917
6986
|
});
|
|
6918
6987
|
}
|
|
6919
6988
|
}
|
|
6989
|
+
if (!sectionSchemas["raw-html"]) {
|
|
6990
|
+
sectionSchemas["raw-html"] = RAW_HTML_SECTION_MANIFEST;
|
|
6991
|
+
}
|
|
6920
6992
|
for (const entry of source.list("assets")) {
|
|
6921
6993
|
assets[entry] = source.read(`assets/${entry}`) ?? "";
|
|
6922
6994
|
}
|
|
@@ -8626,7 +8698,7 @@ function validateThemeEditorDirectory(themeDir) {
|
|
|
8626
8698
|
}
|
|
8627
8699
|
|
|
8628
8700
|
// src/cli/mcp/testing-tools.ts
|
|
8629
|
-
import { createHash as
|
|
8701
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
8630
8702
|
import { existsSync as existsSync10, readFileSync as readFileSync10 } from "node:fs";
|
|
8631
8703
|
import { join as join10, resolve as resolve8 } from "node:path";
|
|
8632
8704
|
import { z as z5 } from "zod";
|
|
@@ -8639,11 +8711,11 @@ async function runThemeReadinessAudit(themeDir) {
|
|
|
8639
8711
|
};
|
|
8640
8712
|
let slug = "unknown";
|
|
8641
8713
|
let version = "0.0.0";
|
|
8642
|
-
let packageHash =
|
|
8714
|
+
let packageHash = createHash3("sha256").update(dir).digest("hex");
|
|
8643
8715
|
try {
|
|
8644
8716
|
const files = collectThemeSources(dir);
|
|
8645
8717
|
const canonical = [...files].sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
8646
|
-
packageHash =
|
|
8718
|
+
packageHash = createHash3("sha256").update(JSON.stringify(canonical)).digest("hex");
|
|
8647
8719
|
} catch {}
|
|
8648
8720
|
const pkg = await ThemePackageValidator.validatePackage(dir);
|
|
8649
8721
|
if (pkg.manifest) {
|
|
@@ -8860,9 +8932,9 @@ async function runCli(rawArgs, io = {}) {
|
|
|
8860
8932
|
} else {
|
|
8861
8933
|
throw new Error("Use connect --clipboard on Windows or pipe the copied SDK connection to connect --stdin.");
|
|
8862
8934
|
}
|
|
8863
|
-
const { api, token } = parseSdkConnection(input);
|
|
8864
|
-
const credentials = await connectSdk(api, token);
|
|
8865
|
-
log(`Connected to ${credentials.name || "your theme app"}. SDK access expires in one hour
|
|
8935
|
+
const { api, token, refreshToken } = parseSdkConnection(input);
|
|
8936
|
+
const credentials = await connectSdk(api, token, refreshToken);
|
|
8937
|
+
log(`Connected to ${credentials.name || "your theme app"}.${refreshToken ? " Auto-refresh enabled (30-day session)." : " SDK access expires in one hour."}`);
|
|
8866
8938
|
return 0;
|
|
8867
8939
|
}
|
|
8868
8940
|
case "login":
|
|
@@ -9301,7 +9373,22 @@ async function handlePush(args, log, error) {
|
|
|
9301
9373
|
if (!creds.appId)
|
|
9302
9374
|
throw new Error("Generate app SDK access in the developer portal and login with --token-stdin.");
|
|
9303
9375
|
const files = collectThemeSources(targetDir);
|
|
9304
|
-
const
|
|
9376
|
+
const checksum = computeCanonicalPackageChecksum(files);
|
|
9377
|
+
const { data: result, credentials: freshCreds } = await sdkRequestWithAutoRefresh(creds, "mutation SubmitTheme($files: [ThemeSourceFileInput!]!) { submitDeveloperTheme(files: $files) { version status checksum } }", { files });
|
|
9378
|
+
try {
|
|
9379
|
+
const report = await runThemeReadinessAudit(targetDir);
|
|
9380
|
+
await sdkRequestWithAutoRefresh(freshCreds, "mutation($themeSlug:String!,$themeVersion:String!,$packageHash:String!,$sdkVersion:String,$runtimeVersion:String,$status:String!,$summary:JSON!,$report:JSON!){saveThemeSdkTestReport(themeSlug:$themeSlug,themeVersion:$themeVersion,packageHash:$packageHash,sdkVersion:$sdkVersion,runtimeVersion:$runtimeVersion,status:$status,summary:$summary,report:$report){id status packageHash}}", {
|
|
9381
|
+
themeSlug: report.slug,
|
|
9382
|
+
themeVersion: result.submitDeveloperTheme.version,
|
|
9383
|
+
packageHash: result.submitDeveloperTheme.checksum || checksum,
|
|
9384
|
+
sdkVersion: report.sdkVersion,
|
|
9385
|
+
runtimeVersion: report.runtimeVersion,
|
|
9386
|
+
status: report.status,
|
|
9387
|
+
summary: report.summary,
|
|
9388
|
+
report
|
|
9389
|
+
});
|
|
9390
|
+
log(`✓ Attached local readiness report to checksum ${result.submitDeveloperTheme.checksum}.`);
|
|
9391
|
+
} catch {}
|
|
9305
9392
|
log("Submitted version " + result.submitDeveloperTheme.version + ": " + result.submitDeveloperTheme.status + ". Checksum: " + result.submitDeveloperTheme.checksum);
|
|
9306
9393
|
log(`✓ Security validation passed.`);
|
|
9307
9394
|
log(`✓ Authenticated as ${creds.email} (Developer ID: ${creds.developerId})`);
|
package/dist/lib/index.js
CHANGED
|
@@ -622,6 +622,7 @@ var SettingTypeSchema = z2.enum([
|
|
|
622
622
|
"range",
|
|
623
623
|
"url",
|
|
624
624
|
"json",
|
|
625
|
+
"html",
|
|
625
626
|
"code",
|
|
626
627
|
"javascript",
|
|
627
628
|
"category_list",
|
|
@@ -734,7 +735,7 @@ var RAW_HTML_SECTION_MANIFEST = {
|
|
|
734
735
|
settings: [
|
|
735
736
|
{
|
|
736
737
|
id: "html",
|
|
737
|
-
type: "
|
|
738
|
+
type: "html",
|
|
738
739
|
label: "HTML Content",
|
|
739
740
|
placeholder: "<div>Custom HTML content...</div>",
|
|
740
741
|
required: false,
|
|
@@ -3131,6 +3132,9 @@ function buildCandyContext(options) {
|
|
|
3131
3132
|
const currencySymbol = String(anyCtx.currencyInfo?.symbol || mergedSettings.currencySymbol || "$");
|
|
3132
3133
|
const currencyCode = String(anyCtx.currencyInfo?.code || anyCtx.currencyInfo?.currency || mergedSettings.currency || "USD");
|
|
3133
3134
|
const currencyPosition = anyCtx.currencyInfo?.currencyPosition === "right" ? "right" : "left";
|
|
3135
|
+
const bootstrapPayment = anyCtx.bootstrap?.payment;
|
|
3136
|
+
const bootstrapGateways = Array.isArray(bootstrapPayment?.gateways) ? bootstrapPayment.gateways : [];
|
|
3137
|
+
const magicCheckoutEnabled = Boolean(bootstrapPayment?.magicCheckout === true || bootstrapPayment?.magic_checkout === true || bootstrapGateways.some((gw) => gw && String(gw.name || "").toLowerCase() === "razorpay" && gw.enabled !== false && Boolean(gw.magicCheckout || gw.magic_checkout || gw.config?.magicCheckout || gw.config?.magic_checkout)));
|
|
3134
3138
|
const shop = {
|
|
3135
3139
|
name: storeName,
|
|
3136
3140
|
description: String(anyCtx.siteSettings?.siteTagline || pageContext.seo?.description || ""),
|
|
@@ -3146,7 +3150,13 @@ function buildCandyContext(options) {
|
|
|
3146
3150
|
secure_url: "/",
|
|
3147
3151
|
domain: pageContext.tenantId || "localhost",
|
|
3148
3152
|
permanent_domain: pageContext.tenantId || "localhost",
|
|
3149
|
-
logo_url: anyCtx.siteSettings?.logoUrl || mergedSettings.logoUrl || null
|
|
3153
|
+
logo_url: anyCtx.siteSettings?.logoUrl || mergedSettings.logoUrl || null,
|
|
3154
|
+
magic_checkout_enabled: magicCheckoutEnabled,
|
|
3155
|
+
payment_gateways: bootstrapGateways.filter((gw) => gw && gw.enabled !== false).map((gw) => ({
|
|
3156
|
+
name: String(gw.name || ""),
|
|
3157
|
+
enabled: gw.enabled !== false,
|
|
3158
|
+
magic_checkout: Boolean(gw.magicCheckout || gw.magic_checkout || gw.config?.magicCheckout || gw.config?.magic_checkout)
|
|
3159
|
+
}))
|
|
3150
3160
|
};
|
|
3151
3161
|
const rawProducts = anyCtx.products || anyCtx.featuredProducts || anyCtx.results?.products || (anyCtx.product ? [anyCtx.product] : []);
|
|
3152
3162
|
const normalizedProducts = rawProducts.map(normalizeProductForCandy);
|
|
@@ -4866,6 +4876,9 @@ function loadCandyThemeFromSource(source, fallbackSlug = "candy-theme") {
|
|
|
4866
4876
|
});
|
|
4867
4877
|
}
|
|
4868
4878
|
}
|
|
4879
|
+
if (!sectionSchemas["raw-html"]) {
|
|
4880
|
+
sectionSchemas["raw-html"] = RAW_HTML_SECTION_MANIFEST;
|
|
4881
|
+
}
|
|
4869
4882
|
for (const entry of source.list("assets")) {
|
|
4870
4883
|
assets[entry] = source.read(`assets/${entry}`) ?? "";
|
|
4871
4884
|
}
|
|
@@ -10652,6 +10665,7 @@ import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
|
10652
10665
|
import { execFileSync } from "node:child_process";
|
|
10653
10666
|
|
|
10654
10667
|
// src/cli/sdk-client.ts
|
|
10668
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
10655
10669
|
import { readFileSync as readFileSync8, readdirSync as readdirSync5 } from "node:fs";
|
|
10656
10670
|
import { join as join8 } from "node:path";
|
|
10657
10671
|
function sdkEndpoint(value) {
|
|
@@ -10675,7 +10689,12 @@ function parseSdkConnection(input) {
|
|
|
10675
10689
|
if (!value || typeof value !== "object" || !("format" in value) || value.format !== "caartzee-theme-sdk-v1" || !("api" in value) || typeof value.api !== "string" || !("token" in value) || typeof value.token !== "string" || !value.token.trim() || value.token.length > 8192) {
|
|
10676
10690
|
throw new Error("Copy a new SDK connection from Developer Portal > Theme SDK.");
|
|
10677
10691
|
}
|
|
10678
|
-
|
|
10692
|
+
const rawRefresh = "refreshToken" in value && typeof value.refreshToken === "string" ? value.refreshToken.trim() : undefined;
|
|
10693
|
+
return {
|
|
10694
|
+
api: sdkEndpoint(value.api),
|
|
10695
|
+
token: value.token.trim(),
|
|
10696
|
+
...rawRefresh ? { refreshToken: rawRefresh } : {}
|
|
10697
|
+
};
|
|
10679
10698
|
}
|
|
10680
10699
|
async function sdkRequest(endpoint, token, query, variables = {}) {
|
|
10681
10700
|
const response = await fetch(sdkEndpoint(endpoint), {
|
|
@@ -10689,7 +10708,55 @@ async function sdkRequest(endpoint, token, query, variables = {}) {
|
|
|
10689
10708
|
throw new Error(result.errors?.map((e) => e.message).join("; ") || `SDK API returned HTTP ${response.status}`);
|
|
10690
10709
|
return result.data;
|
|
10691
10710
|
}
|
|
10692
|
-
async function
|
|
10711
|
+
async function refreshSdkCredentials(credentials) {
|
|
10712
|
+
if (!credentials.refreshToken) {
|
|
10713
|
+
throw new Error("SDK access token expired and no refresh token is stored. Reconnect via Developer Portal > Theme SDK (`caartzee-theme connect --clipboard`).");
|
|
10714
|
+
}
|
|
10715
|
+
const response = await fetch(sdkEndpoint(credentials.portalUrl), {
|
|
10716
|
+
method: "POST",
|
|
10717
|
+
headers: { "Content-Type": "application/json" },
|
|
10718
|
+
body: JSON.stringify({
|
|
10719
|
+
query: "mutation($refreshToken: String!) { refreshThemeSdkToken(refreshToken: $refreshToken) { token refreshToken expiresIn appId } }",
|
|
10720
|
+
variables: { refreshToken: credentials.refreshToken }
|
|
10721
|
+
}),
|
|
10722
|
+
signal: AbortSignal.timeout(30000)
|
|
10723
|
+
});
|
|
10724
|
+
const result = await response.json();
|
|
10725
|
+
const refreshed = result.data?.refreshThemeSdkToken;
|
|
10726
|
+
if (!response.ok || result.errors?.length || !refreshed?.token) {
|
|
10727
|
+
throw new Error(result.errors?.map((e) => e.message).join("; ") || `Failed to refresh SDK token (HTTP ${response.status}). Copy a new SDK connection from Developer Portal > Theme SDK.`);
|
|
10728
|
+
}
|
|
10729
|
+
const updated = {
|
|
10730
|
+
...credentials,
|
|
10731
|
+
accessToken: refreshed.token,
|
|
10732
|
+
refreshToken: refreshed.refreshToken || credentials.refreshToken,
|
|
10733
|
+
expiresAt: Date.now() + refreshed.expiresIn * 1000,
|
|
10734
|
+
savedAt: new Date().toISOString()
|
|
10735
|
+
};
|
|
10736
|
+
saveDeveloperCredentials(updated);
|
|
10737
|
+
return updated;
|
|
10738
|
+
}
|
|
10739
|
+
var REFRESH_BUFFER_MS = 5 * 60 * 1000;
|
|
10740
|
+
async function sdkRequestWithAutoRefresh(credentials, query, variables = {}) {
|
|
10741
|
+
let active = credentials;
|
|
10742
|
+
if (typeof active.expiresAt === "number" && active.expiresAt - Date.now() <= REFRESH_BUFFER_MS && active.refreshToken) {
|
|
10743
|
+
active = await refreshSdkCredentials(active);
|
|
10744
|
+
}
|
|
10745
|
+
try {
|
|
10746
|
+
const data = await sdkRequest(active.portalUrl, active.accessToken, query, variables);
|
|
10747
|
+
return { data, credentials: active };
|
|
10748
|
+
} catch (err) {
|
|
10749
|
+
const msg = String(err?.message || "");
|
|
10750
|
+
const isAuthExpired = /expired|invalid.*token|unauthorized|401/i.test(msg);
|
|
10751
|
+
if (isAuthExpired && active.refreshToken) {
|
|
10752
|
+
active = await refreshSdkCredentials(active);
|
|
10753
|
+
const data = await sdkRequest(active.portalUrl, active.accessToken, query, variables);
|
|
10754
|
+
return { data, credentials: active };
|
|
10755
|
+
}
|
|
10756
|
+
throw err;
|
|
10757
|
+
}
|
|
10758
|
+
}
|
|
10759
|
+
async function connectSdk(endpoint, token, refreshToken) {
|
|
10693
10760
|
const data = await sdkRequest(endpoint, token, "query { themeSdkWorkspace { appId developerId name expiresAt } }");
|
|
10694
10761
|
const app = data.themeSdkWorkspace;
|
|
10695
10762
|
const credentials = {
|
|
@@ -10698,6 +10765,7 @@ async function connectSdk(endpoint, token) {
|
|
|
10698
10765
|
email: "",
|
|
10699
10766
|
name: app.name,
|
|
10700
10767
|
accessToken: token,
|
|
10768
|
+
...refreshToken ? { refreshToken } : {},
|
|
10701
10769
|
expiresAt: app.expiresAt * 1000,
|
|
10702
10770
|
scopes: ["theme:read", "theme:write"],
|
|
10703
10771
|
portalUrl: sdkEndpoint(endpoint),
|
|
@@ -10706,6 +10774,10 @@ async function connectSdk(endpoint, token) {
|
|
|
10706
10774
|
saveDeveloperCredentials(credentials);
|
|
10707
10775
|
return credentials;
|
|
10708
10776
|
}
|
|
10777
|
+
function computeCanonicalPackageChecksum(files) {
|
|
10778
|
+
const canonical = [...files].sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
10779
|
+
return createHash2("sha256").update(JSON.stringify(canonical)).digest("hex");
|
|
10780
|
+
}
|
|
10709
10781
|
function collectThemeSources(root) {
|
|
10710
10782
|
const files = [];
|
|
10711
10783
|
let total = 0;
|
|
@@ -10839,7 +10911,7 @@ function validateThemeEditorDirectory(themeDir) {
|
|
|
10839
10911
|
}
|
|
10840
10912
|
|
|
10841
10913
|
// src/cli/mcp/testing-tools.ts
|
|
10842
|
-
import { createHash as
|
|
10914
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
10843
10915
|
import { existsSync as existsSync10, readFileSync as readFileSync10 } from "node:fs";
|
|
10844
10916
|
import { join as join10, resolve as resolve8 } from "node:path";
|
|
10845
10917
|
import { z as z7 } from "zod";
|
|
@@ -10852,11 +10924,11 @@ async function runThemeReadinessAudit(themeDir) {
|
|
|
10852
10924
|
};
|
|
10853
10925
|
let slug = "unknown";
|
|
10854
10926
|
let version = "0.0.0";
|
|
10855
|
-
let packageHash =
|
|
10927
|
+
let packageHash = createHash3("sha256").update(dir).digest("hex");
|
|
10856
10928
|
try {
|
|
10857
10929
|
const files = collectThemeSources(dir);
|
|
10858
10930
|
const canonical = [...files].sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
10859
|
-
packageHash =
|
|
10931
|
+
packageHash = createHash3("sha256").update(JSON.stringify(canonical)).digest("hex");
|
|
10860
10932
|
} catch {}
|
|
10861
10933
|
const pkg = await ThemePackageValidator.validatePackage(dir);
|
|
10862
10934
|
if (pkg.manifest) {
|
|
@@ -11073,9 +11145,9 @@ async function runCli(rawArgs, io = {}) {
|
|
|
11073
11145
|
} else {
|
|
11074
11146
|
throw new Error("Use connect --clipboard on Windows or pipe the copied SDK connection to connect --stdin.");
|
|
11075
11147
|
}
|
|
11076
|
-
const { api, token } = parseSdkConnection(input);
|
|
11077
|
-
const credentials = await connectSdk(api, token);
|
|
11078
|
-
log(`Connected to ${credentials.name || "your theme app"}. SDK access expires in one hour
|
|
11148
|
+
const { api, token, refreshToken } = parseSdkConnection(input);
|
|
11149
|
+
const credentials = await connectSdk(api, token, refreshToken);
|
|
11150
|
+
log(`Connected to ${credentials.name || "your theme app"}.${refreshToken ? " Auto-refresh enabled (30-day session)." : " SDK access expires in one hour."}`);
|
|
11079
11151
|
return 0;
|
|
11080
11152
|
}
|
|
11081
11153
|
case "login":
|
|
@@ -11514,7 +11586,22 @@ async function handlePush(args, log, error) {
|
|
|
11514
11586
|
if (!creds.appId)
|
|
11515
11587
|
throw new Error("Generate app SDK access in the developer portal and login with --token-stdin.");
|
|
11516
11588
|
const files = collectThemeSources(targetDir);
|
|
11517
|
-
const
|
|
11589
|
+
const checksum = computeCanonicalPackageChecksum(files);
|
|
11590
|
+
const { data: result, credentials: freshCreds } = await sdkRequestWithAutoRefresh(creds, "mutation SubmitTheme($files: [ThemeSourceFileInput!]!) { submitDeveloperTheme(files: $files) { version status checksum } }", { files });
|
|
11591
|
+
try {
|
|
11592
|
+
const report = await runThemeReadinessAudit(targetDir);
|
|
11593
|
+
await sdkRequestWithAutoRefresh(freshCreds, "mutation($themeSlug:String!,$themeVersion:String!,$packageHash:String!,$sdkVersion:String,$runtimeVersion:String,$status:String!,$summary:JSON!,$report:JSON!){saveThemeSdkTestReport(themeSlug:$themeSlug,themeVersion:$themeVersion,packageHash:$packageHash,sdkVersion:$sdkVersion,runtimeVersion:$runtimeVersion,status:$status,summary:$summary,report:$report){id status packageHash}}", {
|
|
11594
|
+
themeSlug: report.slug,
|
|
11595
|
+
themeVersion: result.submitDeveloperTheme.version,
|
|
11596
|
+
packageHash: result.submitDeveloperTheme.checksum || checksum,
|
|
11597
|
+
sdkVersion: report.sdkVersion,
|
|
11598
|
+
runtimeVersion: report.runtimeVersion,
|
|
11599
|
+
status: report.status,
|
|
11600
|
+
summary: report.summary,
|
|
11601
|
+
report
|
|
11602
|
+
});
|
|
11603
|
+
log(`✓ Attached local readiness report to checksum ${result.submitDeveloperTheme.checksum}.`);
|
|
11604
|
+
} catch {}
|
|
11518
11605
|
log("Submitted version " + result.submitDeveloperTheme.version + ": " + result.submitDeveloperTheme.status + ". Checksum: " + result.submitDeveloperTheme.checksum);
|
|
11519
11606
|
log(`✓ Security validation passed.`);
|
|
11520
11607
|
log(`✓ Authenticated as ${creds.email} (Developer ID: ${creds.developerId})`);
|
|
@@ -10,7 +10,7 @@ export declare const BlockContractSchema: z.ZodObject<{
|
|
|
10
10
|
allowedParentSections: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
11
11
|
settings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12
12
|
id: z.ZodString;
|
|
13
|
-
type: z.ZodEnum<["text", "textarea", "richtext", "inline_richtext", "header", "paragraph", "number", "boolean", "checkbox", "radio", "color", "image", "image_picker", "select", "range", "url", "json", "code", "javascript", "category_list", "product_picker", "collection_picker", "font", "spacing"]>;
|
|
13
|
+
type: z.ZodEnum<["text", "textarea", "richtext", "inline_richtext", "header", "paragraph", "number", "boolean", "checkbox", "radio", "color", "image", "image_picker", "select", "range", "url", "json", "html", "code", "javascript", "category_list", "product_picker", "collection_picker", "font", "spacing"]>;
|
|
14
14
|
label: z.ZodString;
|
|
15
15
|
default: z.ZodOptional<z.ZodUnknown>;
|
|
16
16
|
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -30,7 +30,7 @@ export declare const BlockContractSchema: z.ZodObject<{
|
|
|
30
30
|
placeholder: z.ZodOptional<z.ZodString>;
|
|
31
31
|
}, "strip", z.ZodTypeAny, {
|
|
32
32
|
id: string;
|
|
33
|
-
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
33
|
+
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "html" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
34
34
|
label: string;
|
|
35
35
|
options?: {
|
|
36
36
|
value: string | number | boolean;
|
|
@@ -44,7 +44,7 @@ export declare const BlockContractSchema: z.ZodObject<{
|
|
|
44
44
|
placeholder?: string | undefined;
|
|
45
45
|
}, {
|
|
46
46
|
id: string;
|
|
47
|
-
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
47
|
+
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "html" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
48
48
|
label: string;
|
|
49
49
|
options?: {
|
|
50
50
|
value: string | number | boolean;
|
|
@@ -59,7 +59,7 @@ export declare const BlockContractSchema: z.ZodObject<{
|
|
|
59
59
|
}>, "many">>;
|
|
60
60
|
settingsSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
61
61
|
id: z.ZodString;
|
|
62
|
-
type: z.ZodEnum<["text", "textarea", "richtext", "inline_richtext", "header", "paragraph", "number", "boolean", "checkbox", "radio", "color", "image", "image_picker", "select", "range", "url", "json", "code", "javascript", "category_list", "product_picker", "collection_picker", "font", "spacing"]>;
|
|
62
|
+
type: z.ZodEnum<["text", "textarea", "richtext", "inline_richtext", "header", "paragraph", "number", "boolean", "checkbox", "radio", "color", "image", "image_picker", "select", "range", "url", "json", "html", "code", "javascript", "category_list", "product_picker", "collection_picker", "font", "spacing"]>;
|
|
63
63
|
label: z.ZodString;
|
|
64
64
|
default: z.ZodOptional<z.ZodUnknown>;
|
|
65
65
|
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -79,7 +79,7 @@ export declare const BlockContractSchema: z.ZodObject<{
|
|
|
79
79
|
placeholder: z.ZodOptional<z.ZodString>;
|
|
80
80
|
}, "strip", z.ZodTypeAny, {
|
|
81
81
|
id: string;
|
|
82
|
-
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
82
|
+
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "html" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
83
83
|
label: string;
|
|
84
84
|
options?: {
|
|
85
85
|
value: string | number | boolean;
|
|
@@ -93,7 +93,7 @@ export declare const BlockContractSchema: z.ZodObject<{
|
|
|
93
93
|
placeholder?: string | undefined;
|
|
94
94
|
}, {
|
|
95
95
|
id: string;
|
|
96
|
-
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
96
|
+
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "html" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
97
97
|
label: string;
|
|
98
98
|
options?: {
|
|
99
99
|
value: string | number | boolean;
|
|
@@ -111,7 +111,7 @@ export declare const BlockContractSchema: z.ZodObject<{
|
|
|
111
111
|
type: string;
|
|
112
112
|
settings?: {
|
|
113
113
|
id: string;
|
|
114
|
-
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
114
|
+
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "html" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
115
115
|
label: string;
|
|
116
116
|
options?: {
|
|
117
117
|
value: string | number | boolean;
|
|
@@ -130,7 +130,7 @@ export declare const BlockContractSchema: z.ZodObject<{
|
|
|
130
130
|
description?: string | undefined;
|
|
131
131
|
settingsSchema?: {
|
|
132
132
|
id: string;
|
|
133
|
-
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
133
|
+
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "html" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
134
134
|
label: string;
|
|
135
135
|
options?: {
|
|
136
136
|
value: string | number | boolean;
|
|
@@ -150,7 +150,7 @@ export declare const BlockContractSchema: z.ZodObject<{
|
|
|
150
150
|
type: string;
|
|
151
151
|
settings?: {
|
|
152
152
|
id: string;
|
|
153
|
-
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
153
|
+
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "html" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
154
154
|
label: string;
|
|
155
155
|
options?: {
|
|
156
156
|
value: string | number | boolean;
|
|
@@ -169,7 +169,7 @@ export declare const BlockContractSchema: z.ZodObject<{
|
|
|
169
169
|
description?: string | undefined;
|
|
170
170
|
settingsSchema?: {
|
|
171
171
|
id: string;
|
|
172
|
-
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
172
|
+
type: "number" | "boolean" | "code" | "header" | "text" | "textarea" | "richtext" | "inline_richtext" | "paragraph" | "checkbox" | "radio" | "color" | "image" | "image_picker" | "select" | "range" | "url" | "json" | "html" | "javascript" | "category_list" | "product_picker" | "collection_picker" | "font" | "spacing";
|
|
173
173
|
label: string;
|
|
174
174
|
options?: {
|
|
175
175
|
value: string | number | boolean;
|
|
@@ -35,5 +35,6 @@ export interface CandyToolServerOperations extends TestingOperations {
|
|
|
35
35
|
}) => Promise<unknown>;
|
|
36
36
|
workspace?: () => Promise<unknown>;
|
|
37
37
|
themeVersions?: () => Promise<unknown>;
|
|
38
|
+
versionSummary?: () => Promise<unknown>;
|
|
38
39
|
}
|
|
39
40
|
export declare function candyToolServer(operations: CandyToolServerOperations): McpServer;
|
|
@@ -19,4 +19,7 @@ export declare function validateThemeEditorDirectory(themeDir: string): {
|
|
|
19
19
|
warnings: number;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export interface EditorToolsOptions {
|
|
23
|
+
saveTestReport?: ((report: any) => Promise<unknown>) | undefined;
|
|
24
|
+
}
|
|
25
|
+
export declare function registerEditorTools(server: McpServer, options?: EditorToolsOptions): void;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Complete Caartzee Developer V2 Commerce API Catalog
|
|
3
|
+
* Includes every externally exposed endpoint, required scopes, auth modes,
|
|
4
|
+
* query/path parameters, request body examples, response shapes, and @caartzee/storefront-sdk snippets.
|
|
5
|
+
*/
|
|
6
|
+
export type V2AuthMode = 'publishable_or_secret' | 'customer_required' | 'confidential_only';
|
|
7
|
+
export type V2RateTier = 'read' | 'write' | 'auth' | 'checkout';
|
|
8
|
+
export interface V2EndpointCatalogEntry {
|
|
9
|
+
id: string;
|
|
10
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
11
|
+
/** Relative to /api/developer/v2 */
|
|
12
|
+
path: string;
|
|
13
|
+
fullPath: string;
|
|
14
|
+
tag: string;
|
|
15
|
+
summary: string;
|
|
16
|
+
requiredScope: string;
|
|
17
|
+
authMode: V2AuthMode;
|
|
18
|
+
rateTier: V2RateTier;
|
|
19
|
+
idempotent?: boolean;
|
|
20
|
+
sdkMethod?: string;
|
|
21
|
+
headers: Array<{
|
|
22
|
+
name: string;
|
|
23
|
+
required: boolean;
|
|
24
|
+
description: string;
|
|
25
|
+
}>;
|
|
26
|
+
pathParams?: Array<{
|
|
27
|
+
name: string;
|
|
28
|
+
type: string;
|
|
29
|
+
description: string;
|
|
30
|
+
}>;
|
|
31
|
+
queryParams?: Array<{
|
|
32
|
+
name: string;
|
|
33
|
+
type: string;
|
|
34
|
+
required?: boolean;
|
|
35
|
+
description: string;
|
|
36
|
+
}>;
|
|
37
|
+
requestBody?: Record<string, unknown>;
|
|
38
|
+
responseExample?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
export declare const CAARTZEE_V2_API_CATALOG: V2EndpointCatalogEntry[];
|
|
41
|
+
export declare const CAARTZEE_V2_SCOPES: {
|
|
42
|
+
storefront: string[];
|
|
43
|
+
merchantConfidentialOnly: string[];
|
|
44
|
+
testing: string[];
|
|
45
|
+
};
|
|
46
|
+
export declare const CAARTZEE_V2_RATE_LIMITS: {
|
|
47
|
+
read: {
|
|
48
|
+
windowSeconds: number;
|
|
49
|
+
maxRequests: number;
|
|
50
|
+
};
|
|
51
|
+
write: {
|
|
52
|
+
windowSeconds: number;
|
|
53
|
+
maxRequests: number;
|
|
54
|
+
};
|
|
55
|
+
auth: {
|
|
56
|
+
windowSeconds: number;
|
|
57
|
+
maxRequests: number;
|
|
58
|
+
};
|
|
59
|
+
checkout: {
|
|
60
|
+
windowSeconds: number;
|
|
61
|
+
maxRequests: number;
|
|
62
|
+
};
|
|
63
|
+
headers: string[];
|
|
64
|
+
};
|
|
65
|
+
export declare const CAARTZEE_V2_ERRORS: {
|
|
66
|
+
status: number;
|
|
67
|
+
code: string;
|
|
68
|
+
message: string;
|
|
69
|
+
}[];
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
/**
|
|
3
3
|
* Caartzee Developer V2 Commerce MCP Tools & Reusable Prompts
|
|
4
|
-
* Enables AI agents to discover V2 REST APIs,
|
|
5
|
-
* @caartzee/storefront-sdk, mobile
|
|
4
|
+
* Enables AI agents to discover all 78+ V2 REST APIs, full request/response schemas,
|
|
5
|
+
* scopes, rate limits, webhooks, @caartzee/storefront-sdk, and mobile/Next.js headless guides.
|
|
6
6
|
*/
|
|
7
7
|
export declare const V2_COMMERCE_ENDPOINTS_SUMMARY: {
|
|
8
8
|
id: string;
|
|
9
|
-
method:
|
|
9
|
+
method: "POST" | "GET" | "PATCH" | "PUT" | "DELETE";
|
|
10
10
|
path: string;
|
|
11
11
|
tag: string;
|
|
12
|
+
summary: string;
|
|
12
13
|
scope: string;
|
|
13
14
|
auth: string;
|
|
14
|
-
rateTier:
|
|
15
|
+
rateTier: import("./v2-api-catalog").V2RateTier;
|
|
16
|
+
sdkMethod: string | undefined;
|
|
15
17
|
}[];
|
|
16
18
|
export declare function registerV2CommerceMcpTools(server: McpServer): void;
|