@extenshi/cli 0.18.0 → 0.20.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 +77 -0
- package/dist/cli.js +125 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +13 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +102 -26
- package/dist/config.js.map +1 -1
- package/dist/cws-policies.d.ts.map +1 -1
- package/dist/cws-policies.js +1 -0
- package/dist/cws-policies.js.map +1 -1
- package/dist/evidence-attachments.d.ts +19 -0
- package/dist/evidence-attachments.d.ts.map +1 -0
- package/dist/evidence-attachments.js +57 -0
- package/dist/evidence-attachments.js.map +1 -0
- package/dist/extension-localization.d.ts +20 -0
- package/dist/extension-localization.d.ts.map +1 -0
- package/dist/extension-localization.js +94 -0
- package/dist/extension-localization.js.map +1 -0
- package/dist/html-report.d.ts.map +1 -1
- package/dist/html-report.js +2 -1
- package/dist/html-report.js.map +1 -1
- package/dist/icon-preview.js +1 -1
- package/dist/icon-preview.js.map +1 -1
- package/dist/listing-checks.d.ts +9 -1
- package/dist/listing-checks.d.ts.map +1 -1
- package/dist/listing-checks.js +89 -1
- package/dist/listing-checks.js.map +1 -1
- package/dist/localize-init.d.ts +9 -0
- package/dist/localize-init.d.ts.map +1 -0
- package/dist/localize-init.js +166 -0
- package/dist/localize-init.js.map +1 -0
- package/dist/localize.d.ts +27 -0
- package/dist/localize.d.ts.map +1 -0
- package/dist/localize.js +292 -0
- package/dist/localize.js.map +1 -0
- package/dist/pay-contract.d.ts +214 -0
- package/dist/pay-contract.d.ts.map +1 -0
- package/dist/pay-contract.js +202 -0
- package/dist/pay-contract.js.map +1 -0
- package/dist/pay.d.ts +18 -0
- package/dist/pay.d.ts.map +1 -0
- package/dist/pay.js +125 -0
- package/dist/pay.js.map +1 -0
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +69 -8
- package/dist/project.js.map +1 -1
- package/package.json +7 -6
- package/dist/project-workspace.d.ts +0 -1976
- package/dist/project-workspace.d.ts.map +0 -1
- package/dist/project-workspace.js +0 -350
- package/dist/project-workspace.js.map +0 -1
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/** Published packages deliberately carry this small contract locally; BFF validates again. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const paySchemas: {
|
|
4
|
+
readonly listPayApps: z.ZodObject<{
|
|
5
|
+
includeArchived: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
7
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
}, "strict", z.ZodTypeAny, {
|
|
9
|
+
limit?: number | undefined;
|
|
10
|
+
includeArchived?: boolean | undefined;
|
|
11
|
+
cursor?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
limit?: number | undefined;
|
|
14
|
+
includeArchived?: boolean | undefined;
|
|
15
|
+
cursor?: string | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
readonly createPayApp: z.ZodObject<{
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
linkedProjectId: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, "strict", z.ZodTypeAny, {
|
|
21
|
+
name: string;
|
|
22
|
+
linkedProjectId?: string | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
name: string;
|
|
25
|
+
linkedProjectId?: string | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
readonly getPayApp: z.ZodObject<{
|
|
28
|
+
appId: z.ZodString;
|
|
29
|
+
}, "strict", z.ZodTypeAny, {
|
|
30
|
+
appId: string;
|
|
31
|
+
}, {
|
|
32
|
+
appId: string;
|
|
33
|
+
}>;
|
|
34
|
+
readonly getPayReadiness: z.ZodObject<{
|
|
35
|
+
appId: z.ZodString;
|
|
36
|
+
}, "strict", z.ZodTypeAny, {
|
|
37
|
+
appId: string;
|
|
38
|
+
}, {
|
|
39
|
+
appId: string;
|
|
40
|
+
}>;
|
|
41
|
+
readonly linkPayApp: z.ZodObject<{
|
|
42
|
+
appId: z.ZodString;
|
|
43
|
+
} & {
|
|
44
|
+
projectId: z.ZodString;
|
|
45
|
+
}, "strict", z.ZodTypeAny, {
|
|
46
|
+
appId: string;
|
|
47
|
+
projectId: string;
|
|
48
|
+
}, {
|
|
49
|
+
appId: string;
|
|
50
|
+
projectId: string;
|
|
51
|
+
}>;
|
|
52
|
+
readonly unlinkPayApp: z.ZodObject<{
|
|
53
|
+
appId: z.ZodString;
|
|
54
|
+
}, "strict", z.ZodTypeAny, {
|
|
55
|
+
appId: string;
|
|
56
|
+
}, {
|
|
57
|
+
appId: string;
|
|
58
|
+
}>;
|
|
59
|
+
readonly archivePayApp: z.ZodObject<{
|
|
60
|
+
appId: z.ZodString;
|
|
61
|
+
}, "strict", z.ZodTypeAny, {
|
|
62
|
+
appId: string;
|
|
63
|
+
}, {
|
|
64
|
+
appId: string;
|
|
65
|
+
}>;
|
|
66
|
+
readonly exportPayData: z.ZodObject<{
|
|
67
|
+
appId: z.ZodString;
|
|
68
|
+
} & {
|
|
69
|
+
resource: z.ZodEnum<["offers", "payments", "subscriptions", "entitlements", "customers"]>;
|
|
70
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
71
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
}, "strict", z.ZodTypeAny, {
|
|
73
|
+
appId: string;
|
|
74
|
+
resource: "offers" | "payments" | "subscriptions" | "entitlements" | "customers";
|
|
75
|
+
limit?: number | undefined;
|
|
76
|
+
cursor?: string | undefined;
|
|
77
|
+
}, {
|
|
78
|
+
appId: string;
|
|
79
|
+
resource: "offers" | "payments" | "subscriptions" | "entitlements" | "customers";
|
|
80
|
+
limit?: number | undefined;
|
|
81
|
+
cursor?: string | undefined;
|
|
82
|
+
}>;
|
|
83
|
+
readonly getPaySeller: z.ZodObject<{
|
|
84
|
+
appId: z.ZodString;
|
|
85
|
+
}, "strict", z.ZodTypeAny, {
|
|
86
|
+
appId: string;
|
|
87
|
+
}, {
|
|
88
|
+
appId: string;
|
|
89
|
+
}>;
|
|
90
|
+
readonly connectPaySeller: z.ZodObject<{
|
|
91
|
+
appId: z.ZodString;
|
|
92
|
+
} & {
|
|
93
|
+
provider: z.ZodDefault<z.ZodLiteral<"stripe">>;
|
|
94
|
+
accountKind: z.ZodDefault<z.ZodEnum<["standard", "express"]>>;
|
|
95
|
+
}, "strict", z.ZodTypeAny, {
|
|
96
|
+
appId: string;
|
|
97
|
+
provider: "stripe";
|
|
98
|
+
accountKind: "standard" | "express";
|
|
99
|
+
}, {
|
|
100
|
+
appId: string;
|
|
101
|
+
provider?: "stripe" | undefined;
|
|
102
|
+
accountKind?: "standard" | "express" | undefined;
|
|
103
|
+
}>;
|
|
104
|
+
readonly refreshPaySeller: z.ZodObject<{
|
|
105
|
+
appId: z.ZodString;
|
|
106
|
+
}, "strict", z.ZodTypeAny, {
|
|
107
|
+
appId: string;
|
|
108
|
+
}, {
|
|
109
|
+
appId: string;
|
|
110
|
+
}>;
|
|
111
|
+
readonly setPaySellerProfile: z.ZodObject<{
|
|
112
|
+
appId: z.ZodString;
|
|
113
|
+
} & {
|
|
114
|
+
profile: z.ZodObject<{
|
|
115
|
+
displayName: z.ZodString;
|
|
116
|
+
supportUrl: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodString]>;
|
|
117
|
+
termsUrl: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
|
|
118
|
+
}, "strict", z.ZodTypeAny, {
|
|
119
|
+
displayName: string;
|
|
120
|
+
supportUrl: string;
|
|
121
|
+
termsUrl: string | null;
|
|
122
|
+
}, {
|
|
123
|
+
displayName: string;
|
|
124
|
+
supportUrl: string;
|
|
125
|
+
termsUrl: string | null;
|
|
126
|
+
}>;
|
|
127
|
+
}, "strict", z.ZodTypeAny, {
|
|
128
|
+
appId: string;
|
|
129
|
+
profile: {
|
|
130
|
+
displayName: string;
|
|
131
|
+
supportUrl: string;
|
|
132
|
+
termsUrl: string | null;
|
|
133
|
+
};
|
|
134
|
+
}, {
|
|
135
|
+
appId: string;
|
|
136
|
+
profile: {
|
|
137
|
+
displayName: string;
|
|
138
|
+
supportUrl: string;
|
|
139
|
+
termsUrl: string | null;
|
|
140
|
+
};
|
|
141
|
+
}>;
|
|
142
|
+
readonly upsertPayOffer: z.ZodObject<{
|
|
143
|
+
appId: z.ZodString;
|
|
144
|
+
} & {
|
|
145
|
+
sku: z.ZodString;
|
|
146
|
+
kind: z.ZodEnum<["one_time", "subscription", "lifetime"]>;
|
|
147
|
+
interval: z.ZodDefault<z.ZodNullable<z.ZodEnum<["month", "year"]>>>;
|
|
148
|
+
amountMinor: z.ZodNumber;
|
|
149
|
+
currency: z.ZodEnum<["usd", "eur", "gbp"]>;
|
|
150
|
+
title: z.ZodString;
|
|
151
|
+
description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
152
|
+
features: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
153
|
+
sortOrder: z.ZodDefault<z.ZodNumber>;
|
|
154
|
+
}, "strict", z.ZodTypeAny, {
|
|
155
|
+
description: string | null;
|
|
156
|
+
title: string;
|
|
157
|
+
kind: "one_time" | "subscription" | "lifetime";
|
|
158
|
+
appId: string;
|
|
159
|
+
sku: string;
|
|
160
|
+
interval: "month" | "year" | null;
|
|
161
|
+
amountMinor: number;
|
|
162
|
+
currency: "usd" | "eur" | "gbp";
|
|
163
|
+
features: string[];
|
|
164
|
+
sortOrder: number;
|
|
165
|
+
}, {
|
|
166
|
+
title: string;
|
|
167
|
+
kind: "one_time" | "subscription" | "lifetime";
|
|
168
|
+
appId: string;
|
|
169
|
+
sku: string;
|
|
170
|
+
amountMinor: number;
|
|
171
|
+
currency: "usd" | "eur" | "gbp";
|
|
172
|
+
description?: string | null | undefined;
|
|
173
|
+
interval?: "month" | "year" | null | undefined;
|
|
174
|
+
features?: string[] | undefined;
|
|
175
|
+
sortOrder?: number | undefined;
|
|
176
|
+
}>;
|
|
177
|
+
readonly archivePayOffer: z.ZodObject<{
|
|
178
|
+
appId: z.ZodString;
|
|
179
|
+
} & {
|
|
180
|
+
sku: z.ZodString;
|
|
181
|
+
}, "strict", z.ZodTypeAny, {
|
|
182
|
+
appId: string;
|
|
183
|
+
sku: string;
|
|
184
|
+
}, {
|
|
185
|
+
appId: string;
|
|
186
|
+
sku: string;
|
|
187
|
+
}>;
|
|
188
|
+
readonly setPayEnabled: z.ZodObject<{
|
|
189
|
+
appId: z.ZodString;
|
|
190
|
+
} & {
|
|
191
|
+
enabled: z.ZodBoolean;
|
|
192
|
+
}, "strict", z.ZodTypeAny, {
|
|
193
|
+
appId: string;
|
|
194
|
+
enabled: boolean;
|
|
195
|
+
}, {
|
|
196
|
+
appId: string;
|
|
197
|
+
enabled: boolean;
|
|
198
|
+
}>;
|
|
199
|
+
readonly rotatePayKey: z.ZodObject<{
|
|
200
|
+
appId: z.ZodString;
|
|
201
|
+
}, "strict", z.ZodTypeAny, {
|
|
202
|
+
appId: string;
|
|
203
|
+
}, {
|
|
204
|
+
appId: string;
|
|
205
|
+
}>;
|
|
206
|
+
};
|
|
207
|
+
export type PayMethod = keyof typeof paySchemas;
|
|
208
|
+
export type PayBff = {
|
|
209
|
+
[M in PayMethod]: (input: z.infer<(typeof paySchemas)[M]>) => Promise<unknown>;
|
|
210
|
+
};
|
|
211
|
+
export declare const PAY_OPERATIONS: readonly [readonly ["listPayApps", "list_pay_apps", "list", "payApp.list", false, "List your independent Pay applications. No development project required. Follow nextCursor for more results."], readonly ["createPayApp", "create_pay_app", "create", "payApp.create", true, "Create an independent Pay application; linking a development project is optional. Creates a new application on every call: do not retry blindly after a timeout."], readonly ["getPayApp", "get_pay_app", "get", "payApp.get", false, "Read your Pay application and optional project link."], readonly ["getPayReadiness", "get_pay_readiness", "readiness", "payApp.readiness", false, "Check current checkout and launch prerequisites. A passing checkout check does not prove a live external purchase or SDK publication."], readonly ["linkPayApp", "link_pay_app", "link", "payApp.link", true, "Link your Pay application to your development project. Existing purchases remain attached to the Pay application."], readonly ["unlinkPayApp", "unlink_pay_app", "unlink", "payApp.unlink", true, "Remove the optional development-project link without deleting Pay data."], readonly ["archivePayApp", "archive_pay_app", "archive", "payApp.archive", true, "Archive your application and stop new checkout. Preserve payment records and existing entitlements."], readonly ["exportPayData", "export_pay_data", "export", "payApp.export", false, "Export one page of your application data. Follow nextCursor until null for a complete export. Customer/payment data is sensitive: save only to an author-controlled destination; never paste into public issues."], readonly ["getPaySeller", "get_pay_seller", "seller", "paySeller.get", false, "Read seller connection, public profile, offers and publishable SDK key. Agreement signing and KYC require the author in the browser."], readonly ["connectPaySeller", "connect_pay_seller", "connect", "paySeller.connect", true, "Start Stripe Connect onboarding and return a browser action URL. The author must complete KYC and legal acceptance; never do these on their behalf."], readonly ["refreshPaySeller", "refresh_pay_seller", "refresh", "paySeller.refreshStatus", true, "Refresh current payment-provider onboarding status. This does not complete KYC or accept agreements."], readonly ["setPaySellerProfile", "set_pay_seller_profile", "profile", "paySeller.setPublicProfile", true, "Save author-confirmed public seller identity, support and terms links. Never invent legal identity or terms."], readonly ["upsertPayOffer", "upsert_pay_offer", "offer-upsert", "paySeller.upsertOffer", true, "Create or update an offer by stable SKU. Price is in minor currency units. Use only the author-approved price, billing interval and features."], readonly ["archivePayOffer", "archive_pay_offer", "offer-archive", "paySeller.archiveOffer", true, "Stop offering a SKU for new checkout; preserve historical purchases."], readonly ["setPayEnabled", "set_pay_enabled", "enable", "paySeller.setEnabled", true, "Explicitly enable or disable new payments. Enabling is a live commerce change: only do so with author authorization and after checking readiness. Backend prerequisites remain enforced."], readonly ["rotatePayKey", "rotate_pay_key", "rotate-key", "paySeller.rotatePublishableKey", true, "Generate a new publishable SDK key. Prior keys remain accepted for installed extension builds; this is not secret revocation. Never retry blindly."]];
|
|
212
|
+
/** The legacy seller API uses projectId as the payment namespace. Never substitute a linked project ID. */
|
|
213
|
+
export declare function payWireInput(method: PayMethod, input: Record<string, unknown>): Record<string, unknown>;
|
|
214
|
+
//# sourceMappingURL=pay-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pay-contract.d.ts","sourceRoot":"","sources":["../src/pay-contract.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAavB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDb,CAAA;AACV,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,UAAU,CAAA;AAC/C,MAAM,MAAM,MAAM,GAAG;KAAG,CAAC,IAAI,SAAS,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC;CAAE,CAAA;AACvG,eAAO,MAAM,cAAc,61GAiIjB,CAAA;AAEV,2GAA2G;AAC3G,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIvG"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/** Published packages deliberately carry this small contract locally; BFF validates again. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
const app = z.object({ appId: z.string().uuid() }).strict();
|
|
4
|
+
const sku = z.string().regex(/^[a-z0-9][a-z0-9_-]{1,39}$/);
|
|
5
|
+
const publicUrl = z
|
|
6
|
+
.string()
|
|
7
|
+
.trim()
|
|
8
|
+
.max(2048)
|
|
9
|
+
.url()
|
|
10
|
+
.refine((value) => {
|
|
11
|
+
const url = new URL(value);
|
|
12
|
+
return url.protocol === 'https:' && !url.username && !url.password;
|
|
13
|
+
}, 'Use an HTTPS URL without credentials');
|
|
14
|
+
export const paySchemas = {
|
|
15
|
+
listPayApps: z
|
|
16
|
+
.object({
|
|
17
|
+
includeArchived: z.boolean().optional(),
|
|
18
|
+
cursor: z.string().uuid().optional(),
|
|
19
|
+
limit: z.number().int().min(1).max(100).optional(),
|
|
20
|
+
})
|
|
21
|
+
.strict(),
|
|
22
|
+
createPayApp: z
|
|
23
|
+
.object({ name: z.string().trim().min(1).max(120), linkedProjectId: z.string().uuid().optional() })
|
|
24
|
+
.strict(),
|
|
25
|
+
getPayApp: app,
|
|
26
|
+
getPayReadiness: app,
|
|
27
|
+
linkPayApp: app.extend({ projectId: z.string().uuid() }),
|
|
28
|
+
unlinkPayApp: app,
|
|
29
|
+
archivePayApp: app,
|
|
30
|
+
exportPayData: app.extend({
|
|
31
|
+
resource: z.enum(['offers', 'payments', 'subscriptions', 'entitlements', 'customers']),
|
|
32
|
+
cursor: z.string().uuid().optional(),
|
|
33
|
+
limit: z.number().int().min(1).max(500).optional(),
|
|
34
|
+
}),
|
|
35
|
+
getPaySeller: app,
|
|
36
|
+
connectPaySeller: app.extend({
|
|
37
|
+
provider: z.literal('stripe').default('stripe'),
|
|
38
|
+
accountKind: z.enum(['standard', 'express']).default('standard'),
|
|
39
|
+
}),
|
|
40
|
+
refreshPaySeller: app,
|
|
41
|
+
setPaySellerProfile: app.extend({
|
|
42
|
+
profile: z
|
|
43
|
+
.object({
|
|
44
|
+
displayName: z.string().trim().min(1).max(160),
|
|
45
|
+
supportUrl: z.union([publicUrl, z.string().trim().email().max(254)]),
|
|
46
|
+
termsUrl: publicUrl.nullable(),
|
|
47
|
+
})
|
|
48
|
+
.strict(),
|
|
49
|
+
}),
|
|
50
|
+
upsertPayOffer: app.extend({
|
|
51
|
+
sku,
|
|
52
|
+
kind: z.enum(['one_time', 'subscription', 'lifetime']),
|
|
53
|
+
interval: z.enum(['month', 'year']).nullable().default(null),
|
|
54
|
+
amountMinor: z.number().int().min(199).max(100_000_00),
|
|
55
|
+
currency: z.enum(['usd', 'eur', 'gbp']),
|
|
56
|
+
title: z.string().trim().min(1).max(80),
|
|
57
|
+
description: z.string().trim().max(500).nullable().default(null),
|
|
58
|
+
features: z.array(z.string().trim().min(1).max(60)).max(20).default([]),
|
|
59
|
+
sortOrder: z.number().int().min(0).max(1000).default(0),
|
|
60
|
+
}),
|
|
61
|
+
archivePayOffer: app.extend({ sku }),
|
|
62
|
+
setPayEnabled: app.extend({ enabled: z.boolean() }),
|
|
63
|
+
rotatePayKey: app,
|
|
64
|
+
};
|
|
65
|
+
export const PAY_OPERATIONS = [
|
|
66
|
+
[
|
|
67
|
+
'listPayApps',
|
|
68
|
+
'list_pay_apps',
|
|
69
|
+
'list',
|
|
70
|
+
'payApp.list',
|
|
71
|
+
false,
|
|
72
|
+
'List your independent Pay applications. No development project required. Follow nextCursor for more results.',
|
|
73
|
+
],
|
|
74
|
+
[
|
|
75
|
+
'createPayApp',
|
|
76
|
+
'create_pay_app',
|
|
77
|
+
'create',
|
|
78
|
+
'payApp.create',
|
|
79
|
+
true,
|
|
80
|
+
'Create an independent Pay application; linking a development project is optional. Creates a new application on every call: do not retry blindly after a timeout.',
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
'getPayApp',
|
|
84
|
+
'get_pay_app',
|
|
85
|
+
'get',
|
|
86
|
+
'payApp.get',
|
|
87
|
+
false,
|
|
88
|
+
'Read your Pay application and optional project link.',
|
|
89
|
+
],
|
|
90
|
+
[
|
|
91
|
+
'getPayReadiness',
|
|
92
|
+
'get_pay_readiness',
|
|
93
|
+
'readiness',
|
|
94
|
+
'payApp.readiness',
|
|
95
|
+
false,
|
|
96
|
+
'Check current checkout and launch prerequisites. A passing checkout check does not prove a live external purchase or SDK publication.',
|
|
97
|
+
],
|
|
98
|
+
[
|
|
99
|
+
'linkPayApp',
|
|
100
|
+
'link_pay_app',
|
|
101
|
+
'link',
|
|
102
|
+
'payApp.link',
|
|
103
|
+
true,
|
|
104
|
+
'Link your Pay application to your development project. Existing purchases remain attached to the Pay application.',
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
'unlinkPayApp',
|
|
108
|
+
'unlink_pay_app',
|
|
109
|
+
'unlink',
|
|
110
|
+
'payApp.unlink',
|
|
111
|
+
true,
|
|
112
|
+
'Remove the optional development-project link without deleting Pay data.',
|
|
113
|
+
],
|
|
114
|
+
[
|
|
115
|
+
'archivePayApp',
|
|
116
|
+
'archive_pay_app',
|
|
117
|
+
'archive',
|
|
118
|
+
'payApp.archive',
|
|
119
|
+
true,
|
|
120
|
+
'Archive your application and stop new checkout. Preserve payment records and existing entitlements.',
|
|
121
|
+
],
|
|
122
|
+
[
|
|
123
|
+
'exportPayData',
|
|
124
|
+
'export_pay_data',
|
|
125
|
+
'export',
|
|
126
|
+
'payApp.export',
|
|
127
|
+
false,
|
|
128
|
+
'Export one page of your application data. Follow nextCursor until null for a complete export. Customer/payment data is sensitive: save only to an author-controlled destination; never paste into public issues.',
|
|
129
|
+
],
|
|
130
|
+
[
|
|
131
|
+
'getPaySeller',
|
|
132
|
+
'get_pay_seller',
|
|
133
|
+
'seller',
|
|
134
|
+
'paySeller.get',
|
|
135
|
+
false,
|
|
136
|
+
'Read seller connection, public profile, offers and publishable SDK key. Agreement signing and KYC require the author in the browser.',
|
|
137
|
+
],
|
|
138
|
+
[
|
|
139
|
+
'connectPaySeller',
|
|
140
|
+
'connect_pay_seller',
|
|
141
|
+
'connect',
|
|
142
|
+
'paySeller.connect',
|
|
143
|
+
true,
|
|
144
|
+
'Start Stripe Connect onboarding and return a browser action URL. The author must complete KYC and legal acceptance; never do these on their behalf.',
|
|
145
|
+
],
|
|
146
|
+
[
|
|
147
|
+
'refreshPaySeller',
|
|
148
|
+
'refresh_pay_seller',
|
|
149
|
+
'refresh',
|
|
150
|
+
'paySeller.refreshStatus',
|
|
151
|
+
true,
|
|
152
|
+
'Refresh current payment-provider onboarding status. This does not complete KYC or accept agreements.',
|
|
153
|
+
],
|
|
154
|
+
[
|
|
155
|
+
'setPaySellerProfile',
|
|
156
|
+
'set_pay_seller_profile',
|
|
157
|
+
'profile',
|
|
158
|
+
'paySeller.setPublicProfile',
|
|
159
|
+
true,
|
|
160
|
+
'Save author-confirmed public seller identity, support and terms links. Never invent legal identity or terms.',
|
|
161
|
+
],
|
|
162
|
+
[
|
|
163
|
+
'upsertPayOffer',
|
|
164
|
+
'upsert_pay_offer',
|
|
165
|
+
'offer-upsert',
|
|
166
|
+
'paySeller.upsertOffer',
|
|
167
|
+
true,
|
|
168
|
+
'Create or update an offer by stable SKU. Price is in minor currency units. Use only the author-approved price, billing interval and features.',
|
|
169
|
+
],
|
|
170
|
+
[
|
|
171
|
+
'archivePayOffer',
|
|
172
|
+
'archive_pay_offer',
|
|
173
|
+
'offer-archive',
|
|
174
|
+
'paySeller.archiveOffer',
|
|
175
|
+
true,
|
|
176
|
+
'Stop offering a SKU for new checkout; preserve historical purchases.',
|
|
177
|
+
],
|
|
178
|
+
[
|
|
179
|
+
'setPayEnabled',
|
|
180
|
+
'set_pay_enabled',
|
|
181
|
+
'enable',
|
|
182
|
+
'paySeller.setEnabled',
|
|
183
|
+
true,
|
|
184
|
+
'Explicitly enable or disable new payments. Enabling is a live commerce change: only do so with author authorization and after checking readiness. Backend prerequisites remain enforced.',
|
|
185
|
+
],
|
|
186
|
+
[
|
|
187
|
+
'rotatePayKey',
|
|
188
|
+
'rotate_pay_key',
|
|
189
|
+
'rotate-key',
|
|
190
|
+
'paySeller.rotatePublishableKey',
|
|
191
|
+
true,
|
|
192
|
+
'Generate a new publishable SDK key. Prior keys remain accepted for installed extension builds; this is not secret revocation. Never retry blindly.',
|
|
193
|
+
],
|
|
194
|
+
];
|
|
195
|
+
/** The legacy seller API uses projectId as the payment namespace. Never substitute a linked project ID. */
|
|
196
|
+
export function payWireInput(method, input) {
|
|
197
|
+
if (!PAY_OPERATIONS.find(([key]) => key === method)?.[3].startsWith('paySeller.'))
|
|
198
|
+
return input;
|
|
199
|
+
const { appId, ...rest } = input;
|
|
200
|
+
return { ...rest, projectId: appId };
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=pay-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pay-contract.js","sourceRoot":"","sources":["../src/pay-contract.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAA;AAC3D,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAA;AAC1D,MAAM,SAAS,GAAG,CAAC;KACjB,MAAM,EAAE;KACR,IAAI,EAAE;KACN,GAAG,CAAC,IAAI,CAAC;KACT,GAAG,EAAE;KACL,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;IACjB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAA;IAC1B,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAA;AACnE,CAAC,EAAE,sCAAsC,CAAC,CAAA;AAC3C,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,WAAW,EAAE,CAAC;SACZ,MAAM,CAAC;QACP,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;QACvC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;QACpC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAA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|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { loadConfig } from './config.js';
|
|
3
|
+
import { type PayMethod } from './pay-contract.js';
|
|
4
|
+
type Config = Awaited<ReturnType<typeof loadConfig>>;
|
|
5
|
+
export declare function payRequest(config: Config, method: PayMethod, rawInput: unknown): Promise<unknown>;
|
|
6
|
+
/** Write every page without buffering the whole export or exposing it in terminal logs. */
|
|
7
|
+
export declare function exportPayFile(config: Config, input: {
|
|
8
|
+
appId: string;
|
|
9
|
+
resource: 'offers' | 'payments' | 'subscriptions' | 'entitlements' | 'customers';
|
|
10
|
+
limit?: number;
|
|
11
|
+
}, file: string): Promise<{
|
|
12
|
+
file: string;
|
|
13
|
+
rows: number;
|
|
14
|
+
pages: number;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function registerPayCommands(program: Command): void;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=pay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pay.d.ts","sourceRoot":"","sources":["../src/pay.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAkB,KAAK,SAAS,EAA4B,MAAM,mBAAmB,CAAA;AAE5F,KAAK,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAA;AACpD,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAwCvG;AAED,2FAA2F;AAC3F,wBAAsB,aAAa,CAClC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE;IACN,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,QAAQ,GAAG,UAAU,GAAG,eAAe,GAAG,cAAc,GAAG,WAAW,CAAA;IAChF,KAAK,CAAC,EAAE,MAAM,CAAA;CACd,EACD,IAAI,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAwCxD;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,QAmDnD"}
|
package/dist/pay.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/** Standalone Pay management. No local repository or development project required. */
|
|
2
|
+
import { open, readFile, rm } from 'node:fs/promises';
|
|
3
|
+
import { loadConfig } from './config.js';
|
|
4
|
+
import { PAY_OPERATIONS, paySchemas, payWireInput } from './pay-contract.js';
|
|
5
|
+
export async function payRequest(config, method, rawInput) {
|
|
6
|
+
if (!config.apiKey)
|
|
7
|
+
throw new Error('Run extenshi login and grant this key Pay permissions at https://dojo.extenshi.io/api-keys.');
|
|
8
|
+
const input = paySchemas[method].parse(rawInput);
|
|
9
|
+
const operation = PAY_OPERATIONS.find(([key]) => key === method);
|
|
10
|
+
if (!operation)
|
|
11
|
+
throw new Error('Unknown Pay operation');
|
|
12
|
+
const [, , , procedure, mutation] = operation;
|
|
13
|
+
const url = new URL(`${config.bffUrl}/api/trpc/${procedure}`);
|
|
14
|
+
const body = JSON.stringify(payWireInput(method, input));
|
|
15
|
+
if (!mutation)
|
|
16
|
+
url.searchParams.set('input', body);
|
|
17
|
+
let response;
|
|
18
|
+
try {
|
|
19
|
+
response = await fetch(url, {
|
|
20
|
+
method: mutation ? 'POST' : 'GET',
|
|
21
|
+
headers: { authorization: `Bearer ${config.apiKey}`, 'content-type': 'application/json' },
|
|
22
|
+
body: mutation ? body : undefined,
|
|
23
|
+
signal: AbortSignal.timeout(30_000),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
throw new Error('Pay API unreachable. Check current server state before retrying a mutation.');
|
|
28
|
+
}
|
|
29
|
+
const envelope = (await response.json().catch(() => null));
|
|
30
|
+
if (!response.ok || envelope?.error || !envelope?.result) {
|
|
31
|
+
const advice = response.status === 403
|
|
32
|
+
? 'Grant pay.read/pay.write explicitly at https://dojo.extenshi.io/api-keys and verify application ownership.'
|
|
33
|
+
: response.status === 412
|
|
34
|
+
? 'Check readiness; the author must complete seller agreement and Stripe onboarding in the browser.'
|
|
35
|
+
: response.status === 404
|
|
36
|
+
? 'Verify the application ID and backend support for standalone Pay.'
|
|
37
|
+
: 'Check application readiness and server status before retrying.';
|
|
38
|
+
// Do not echo arbitrary server errors, request bodies or credentials.
|
|
39
|
+
throw new Error(`Pay API failed (${response.status}). ${advice}`);
|
|
40
|
+
}
|
|
41
|
+
return envelope.result.data;
|
|
42
|
+
}
|
|
43
|
+
/** Write every page without buffering the whole export or exposing it in terminal logs. */
|
|
44
|
+
export async function exportPayFile(config, input, file) {
|
|
45
|
+
const handle = await open(file, 'wx', 0o600);
|
|
46
|
+
let complete = false;
|
|
47
|
+
try {
|
|
48
|
+
let cursor;
|
|
49
|
+
let rows = 0;
|
|
50
|
+
let pages = 0;
|
|
51
|
+
const seen = new Set();
|
|
52
|
+
do {
|
|
53
|
+
const page = (await payRequest(config, 'exportPayData', { ...input, cursor }));
|
|
54
|
+
if (page.schemaVersion !== 1 ||
|
|
55
|
+
page.appId !== input.appId ||
|
|
56
|
+
page.resource !== input.resource ||
|
|
57
|
+
!Array.isArray(page.rows) ||
|
|
58
|
+
!(page.nextCursor === null || typeof page.nextCursor === 'string'))
|
|
59
|
+
throw new Error('Invalid Pay export page; incomplete file removed.');
|
|
60
|
+
await handle.writeFile(`${JSON.stringify(page)}\n`);
|
|
61
|
+
rows += page.rows.length;
|
|
62
|
+
pages += 1;
|
|
63
|
+
cursor = page.nextCursor ?? undefined;
|
|
64
|
+
if (cursor) {
|
|
65
|
+
if (seen.has(cursor))
|
|
66
|
+
throw new Error('Pay export repeated a cursor; incomplete file removed.');
|
|
67
|
+
seen.add(cursor);
|
|
68
|
+
}
|
|
69
|
+
} while (cursor);
|
|
70
|
+
await handle.sync();
|
|
71
|
+
complete = true;
|
|
72
|
+
return { file, rows, pages };
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
await handle.close();
|
|
76
|
+
if (!complete)
|
|
77
|
+
await rm(file, { force: true });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export function registerPayCommands(program) {
|
|
81
|
+
const pay = program
|
|
82
|
+
.command('pay')
|
|
83
|
+
.description('Manage standalone Pay applications. JSON inputs; no local project binding needed.');
|
|
84
|
+
for (const [method, , command, , mutation, description] of PAY_OPERATIONS) {
|
|
85
|
+
const action = pay
|
|
86
|
+
.command(command)
|
|
87
|
+
.description(description)
|
|
88
|
+
.option('--input <json>', 'Validated JSON parameters (appId identifies the Pay application)', '{}')
|
|
89
|
+
.option('--input-file <path>', 'Read parameters from a JSON file instead of --input');
|
|
90
|
+
if (mutation)
|
|
91
|
+
action.option('--apply', 'Apply the requested mutation with author authorization');
|
|
92
|
+
if (method === 'exportPayData')
|
|
93
|
+
action.option('--output <path>', 'Export ALL pages as private JSONL; refuses to overwrite an existing file');
|
|
94
|
+
action.action(async (options) => {
|
|
95
|
+
try {
|
|
96
|
+
const raw = JSON.parse(options.inputFile ? await readFile(options.inputFile, 'utf8') : options.input);
|
|
97
|
+
const input = paySchemas[method].parse(raw);
|
|
98
|
+
if (mutation && !options.apply)
|
|
99
|
+
throw new Error('Mutation not applied. Review the parameters and use --apply with author authorization.');
|
|
100
|
+
const config = await loadConfig();
|
|
101
|
+
if (method === 'exportPayData' && options.output) {
|
|
102
|
+
const pageInput = paySchemas.exportPayData.parse(input);
|
|
103
|
+
if (pageInput.cursor)
|
|
104
|
+
throw new Error('--output exports all pages; omit cursor.');
|
|
105
|
+
console.log(JSON.stringify(await exportPayFile(config, pageInput, options.output), null, 2));
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
console.log(JSON.stringify(await payRequest(config, method, input), null, 2));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
// Schema errors may echo supplied data; only render our own transport errors.
|
|
113
|
+
console.error(error instanceof SyntaxError
|
|
114
|
+
? 'Invalid JSON input.'
|
|
115
|
+
: error instanceof Error && error.name === 'ZodError'
|
|
116
|
+
? 'Invalid Pay parameters. Check command help and the Pay API contract.'
|
|
117
|
+
: error instanceof Error
|
|
118
|
+
? error.message
|
|
119
|
+
: 'Pay command failed.');
|
|
120
|
+
process.exitCode = 1;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=pay.js.map
|
package/dist/pay.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pay.js","sourceRoot":"","sources":["../src/pay.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,cAAc,EAAkB,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAG5F,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAc,EAAE,MAAiB,EAAE,QAAiB;IACpF,IAAI,CAAC,MAAM,CAAC,MAAM;QACjB,MAAM,IAAI,KAAK,CACd,6FAA6F,CAC7F,CAAA;IACF,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IAChD,MAAM,SAAS,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,MAAM,CAAC,CAAA;IAChE,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;IACxD,MAAM,CAAC,EAAE,AAAD,EAAG,AAAD,EAAG,SAAS,EAAE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;gBAChB,8EAA8E;gBAC9E,OAAO,CAAC,KAAK,CACZ,KAAK,YAAY,WAAW;oBAC3B,CAAC,CAAC,qBAAqB;oBACvB,CAAC,CAAC,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;wBACpD,CAAC,CAAC,sEAAsE;wBACxE,CAAC,CAAC,KAAK,YAAY,KAAK;4BACvB,CAAC,CAAC,KAAK,CAAC,OAAO;4BACf,CAAC,CAAC,qBAAqB,CAC1B,CAAA;gBACD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;YACrB,CAAC;QACF,CAAC,CACD,CAAA;IACF,CAAC;AACF,CAAC"}
|
package/dist/project.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,2FAA2F;
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAgB3F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAIxC,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAE/B,qBAAa,eAAgB,SAAQ,KAAK;IAExC,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM;gBAFb,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,YAAA;CAMvB;AACD,wBAAsB,cAAc,CACnC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,EAC9C,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,OAAY,EACnB,QAAQ,UAAQ,GACd,OAAO,CAAC,IAAI,CAAC,CAyCf;AAED,eAAO,MAAM,cAAc,4BAAe,CAAA;AAK1C,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,iBAe5D;AACD,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyDhE;AA6GD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QAggBvD"}
|