@01.software/cli 0.18.0 → 0.20.1
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/index.js +162 -33
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
|
|
16
16
|
// ../../internal/http-contracts/src/index.ts
|
|
17
17
|
var operationBrand = /* @__PURE__ */ Symbol("sdk-http-operation");
|
|
18
|
+
var CREDENTIAL_ROTATION_DEADLINE_HEADER = "X-01-Credential-Rotation-Deadline";
|
|
18
19
|
var operation = (collection, method, path2, errorFamily) => Object.freeze({
|
|
19
20
|
[operationBrand]: true,
|
|
20
21
|
collection,
|
|
@@ -72,6 +73,11 @@ var COMMERCE_ENDPOINT_OPERATIONS = {
|
|
|
72
73
|
detail: strictCommerceOperation("checkouts", "post", "/detail"),
|
|
73
74
|
query: strictCommerceOperation("checkouts", "post", "/query")
|
|
74
75
|
},
|
|
76
|
+
draftOrders: {
|
|
77
|
+
calculate: operation("draft-orders", "post", "/:id/calculate"),
|
|
78
|
+
complete: operation("draft-orders", "post", "/:id/complete"),
|
|
79
|
+
finalize: operation("draft-orders", "post", "/:id/finalize")
|
|
80
|
+
},
|
|
75
81
|
transactions: {
|
|
76
82
|
update: operation("transactions", "post", "/update")
|
|
77
83
|
},
|
|
@@ -171,8 +177,51 @@ var portOneStandardActionCapabilityOperations = /* @__PURE__ */ new Set([
|
|
|
171
177
|
]);
|
|
172
178
|
var MEMBERSHIP_ENDPOINT_OPERATIONS = {
|
|
173
179
|
subscribe: operation(null, "post", "/memberships/subscribe"),
|
|
180
|
+
billingCustody: operation(null, "post", "/memberships/billing-custody"),
|
|
174
181
|
cancel: operation(null, "post", "/memberships/:id/cancel"),
|
|
175
|
-
me: operation(null, "get", "/memberships/me")
|
|
182
|
+
me: operation(null, "get", "/memberships/me"),
|
|
183
|
+
chargeResult: operation(null, "post", "/memberships/:id/charge-result"),
|
|
184
|
+
refundResult: operation(null, "post", "/memberships/:id/refund-result"),
|
|
185
|
+
revoke: operation(null, "post", "/memberships/:id/revoke")
|
|
186
|
+
};
|
|
187
|
+
var EXTERNAL_EFFECT_CLAIM_ENDPOINT_OPERATIONS = {
|
|
188
|
+
claim: operation(null, "post", "/external-effect-claims/claim"),
|
|
189
|
+
get: operation(null, "post", "/external-effect-claims/get"),
|
|
190
|
+
arm: operation(null, "post", "/external-effect-claims/arm"),
|
|
191
|
+
release: operation(null, "post", "/external-effect-claims/release"),
|
|
192
|
+
report: operation(null, "post", "/external-effect-claims/report"),
|
|
193
|
+
recovery: operation(null, "post", "/external-effect-claims/recovery")
|
|
194
|
+
};
|
|
195
|
+
var INSTALLATION_CREDENTIAL_ENDPOINT_OPERATIONS = {
|
|
196
|
+
create: operation(null, "post", "/installation-credentials/create"),
|
|
197
|
+
get: operation(null, "post", "/installation-credentials/get"),
|
|
198
|
+
replace: operation(null, "post", "/installation-credentials/replace"),
|
|
199
|
+
dispose: operation(null, "post", "/installation-credentials/dispose")
|
|
200
|
+
};
|
|
201
|
+
var EXTERNAL_CUSTOMER_LINK_ENDPOINT_OPERATIONS = {
|
|
202
|
+
connect: operation("customers", "post", "/external-links/connect"),
|
|
203
|
+
get: operation("customers", "post", "/external-links/get"),
|
|
204
|
+
list: operation("customers", "post", "/external-links/list"),
|
|
205
|
+
unlink: operation("customers", "post", "/external-links/unlink"),
|
|
206
|
+
capturePreviousState: operation(
|
|
207
|
+
"customers",
|
|
208
|
+
"post",
|
|
209
|
+
"/external-links/capture-previous-state"
|
|
210
|
+
),
|
|
211
|
+
clearPreviousState: operation(
|
|
212
|
+
"customers",
|
|
213
|
+
"post",
|
|
214
|
+
"/external-links/clear-previous-state"
|
|
215
|
+
)
|
|
216
|
+
};
|
|
217
|
+
var CUSTOMER_GROUP_ENDPOINT_OPERATIONS = {
|
|
218
|
+
members: operation("customer-groups", "get", "/:id/members"),
|
|
219
|
+
grant: operation("customer-groups", "post", "/:id/members/grant"),
|
|
220
|
+
revoke: operation("customer-groups", "post", "/:id/members/revoke")
|
|
221
|
+
};
|
|
222
|
+
var CUSTOMER_AUTH_ENDPOINT_OPERATIONS = {
|
|
223
|
+
revokeRefresh: operation("customers", "post", "/revoke-refresh"),
|
|
224
|
+
withdraw: operation("customers", "post", "/withdraw")
|
|
176
225
|
};
|
|
177
226
|
var EMBEDDED_ADMIN_ENDPOINT_OPERATIONS = {
|
|
178
227
|
show: operation("tenants", "get", "/embedded-admin-app"),
|
|
@@ -197,6 +246,14 @@ var COMMUNITY_ENDPOINT_OPERATIONS = {
|
|
|
197
246
|
detail: operation("posts", "get", "/detail")
|
|
198
247
|
}
|
|
199
248
|
};
|
|
249
|
+
var GALLERY_ENDPOINT_OPERATIONS = {
|
|
250
|
+
items: {
|
|
251
|
+
storefront: operation("gallery-items", "get", "/storefront")
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
var VIDEO_ENDPOINT_OPERATIONS = {
|
|
255
|
+
playback: operation("videos", "post", "/:id/playback")
|
|
256
|
+
};
|
|
200
257
|
function resolveOperationTemplate(descriptor) {
|
|
201
258
|
return descriptor.collection ? `/api/${descriptor.collection}${descriptor.path}` : `/api${descriptor.path}`;
|
|
202
259
|
}
|
|
@@ -946,6 +1003,7 @@ function withDoctorActionTranslations(translations) {
|
|
|
946
1003
|
return translations;
|
|
947
1004
|
}
|
|
948
1005
|
var CLI_I18N_KO = withDoctorActionTranslations({
|
|
1006
|
+
CredentialRotationDeadline: "\uACBD\uACE0: \uC774 \uC790\uACA9 \uC99D\uBA85\uC740 {{deadline}} \uC804\uC5D0 \uD68C\uC804\uD574\uC57C \uD569\uB2C8\uB2E4. `01 login`\uC73C\uB85C MFA \uC778\uC99D \uD6C4 \uB2E4\uC2DC \uBC1C\uAE09\uD558\uC138\uC694. \uC6B4\uC601 \uC2A4\uD06C\uB9BD\uD2B8\xB7CI\xB7MCP\uC5D0 \uC800\uC7A5\uB41C \uC790\uACA9 \uC99D\uBA85\uC740 \uAD00\uB9AC\uC790\uC640 \uD568\uAED8 \uAD50\uCCB4\uD558\uC138\uC694.",
|
|
949
1007
|
// CLI-surface microcopy
|
|
950
1008
|
AuthenticationRequired: "\uC778\uC99D\uC774 \uD544\uC694\uD569\uB2C8\uB2E4",
|
|
951
1009
|
RunLoginToAuthenticate: "`01 login` \uBA85\uB839\uC73C\uB85C \uBE0C\uB77C\uC6B0\uC800 \uC778\uC99D\uC744 \uC9C4\uD589\uD558\uAC70\uB098,",
|
|
@@ -989,7 +1047,7 @@ var CLI_I18N_KO = withDoctorActionTranslations({
|
|
|
989
1047
|
publishable_key_mismatch: "\uACF5\uAC1C \uD0A4\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4",
|
|
990
1048
|
scope_denied: "\uBC94\uC704 \uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
991
1049
|
redis_unavailable: "\uCE90\uC2DC\uAC00 \uC77C\uC2DC\uC801\uC73C\uB85C \uC0AC\uC6A9 \uBD88\uAC00\uD569\uB2C8\uB2E4",
|
|
992
|
-
provider_unavailable: "\uC678\uBD80 \uACF5\
|
|
1050
|
+
provider_unavailable: "\uC678\uBD80 \uC81C\uACF5\uC790\uAC00 \uC751\uB2F5\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4",
|
|
993
1051
|
rate_limited: "\uC694\uCCAD\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4 \u2014 \uC7A0\uC2DC \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694",
|
|
994
1052
|
upstream_timeout: "\uC751\uB2F5 \uC2DC\uAC04\uC774 \uCD08\uACFC\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
|
|
995
1053
|
upstream_5xx: "\uC678\uBD80 \uC11C\uBE44\uC2A4 \uC624\uB958",
|
|
@@ -999,6 +1057,7 @@ var CLI_I18N_KO = withDoctorActionTranslations({
|
|
|
999
1057
|
unknown: "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"
|
|
1000
1058
|
});
|
|
1001
1059
|
var CLI_I18N_EN = {
|
|
1060
|
+
CredentialRotationDeadline: "Warning: rotate this credential before {{deadline}}. Run `01 login` and complete MFA to obtain a replacement. Coordinate with an administrator to replace credentials stored in scripts, CI and MCP clients.",
|
|
1002
1061
|
AuthenticationRequired: "Authentication required",
|
|
1003
1062
|
RunLoginToAuthenticate: "Run `01 login` to authenticate via browser, or",
|
|
1004
1063
|
PassApiKey: "pass `--api-key <token>`, or",
|
|
@@ -1253,6 +1312,31 @@ function resolveClient(apiKeyFlag) {
|
|
|
1253
1312
|
}
|
|
1254
1313
|
}
|
|
1255
1314
|
|
|
1315
|
+
// src/lib/credential-rotation-warning.ts
|
|
1316
|
+
var installed = /* @__PURE__ */ new WeakSet();
|
|
1317
|
+
function installCredentialRotationWarning() {
|
|
1318
|
+
const original = globalThis.fetch;
|
|
1319
|
+
if (installed.has(original)) return;
|
|
1320
|
+
const warned = /* @__PURE__ */ new Set();
|
|
1321
|
+
const observing = async (...args) => {
|
|
1322
|
+
const response = await original(...args);
|
|
1323
|
+
const deadline = response.headers.get(CREDENTIAL_ROTATION_DEADLINE_HEADER);
|
|
1324
|
+
if (response.ok && deadline && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(deadline)) {
|
|
1325
|
+
const instant = Date.parse(deadline);
|
|
1326
|
+
if (Number.isFinite(instant) && new Date(instant).toISOString() === deadline && !warned.has(deadline)) {
|
|
1327
|
+
warned.add(deadline);
|
|
1328
|
+
process.stderr.write(
|
|
1329
|
+
`${t("CredentialRotationDeadline", { deadline })}
|
|
1330
|
+
`
|
|
1331
|
+
);
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
return response;
|
|
1335
|
+
};
|
|
1336
|
+
installed.add(observing);
|
|
1337
|
+
globalThis.fetch = observing;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1256
1340
|
// src/commands/crud.ts
|
|
1257
1341
|
import { readFileSync as readFileSync2 } from "fs";
|
|
1258
1342
|
import { basename } from "path";
|
|
@@ -2275,10 +2359,25 @@ var updateCartAttributesBodySchema = z4.object({
|
|
|
2275
2359
|
var updateCartAttributesParamsSchema = updateCartAttributesBodySchema.extend({
|
|
2276
2360
|
idempotencyKey: commerceIdempotencyKeySchema
|
|
2277
2361
|
});
|
|
2362
|
+
var serverAddItemBodySchema = addItemBodySchema.extend({
|
|
2363
|
+
customerToken: commerceCustomerTokenSchema.optional()
|
|
2364
|
+
});
|
|
2365
|
+
var serverAddItemParamsSchema = serverAddItemBodySchema.extend({
|
|
2366
|
+
idempotencyKey: commerceIdempotencyKeySchema
|
|
2367
|
+
});
|
|
2368
|
+
var serverUpdateItemBodySchema = updateItemBodySchema.extend({
|
|
2369
|
+
customerToken: commerceCustomerTokenSchema.optional()
|
|
2370
|
+
});
|
|
2371
|
+
var serverUpdateItemParamsSchema = serverUpdateItemBodySchema.extend({
|
|
2372
|
+
idempotencyKey: commerceIdempotencyKeySchema
|
|
2373
|
+
});
|
|
2278
2374
|
|
|
2279
2375
|
// ../../internal/contracts/src/ecommerce/checkout.ts
|
|
2280
2376
|
import { z as z6 } from "zod";
|
|
2281
2377
|
|
|
2378
|
+
// ../../internal/contracts/src/ecommerce/managed-payment-provider.ts
|
|
2379
|
+
var CHECKOUT_PAYMENT_SESSION_PROVIDERS = ["toss", "portone"];
|
|
2380
|
+
|
|
2282
2381
|
// ../../internal/contracts/src/ecommerce/payment-session.ts
|
|
2283
2382
|
import { z as z5 } from "zod";
|
|
2284
2383
|
var tossProviderOrderIdSchema = z5.string().min(6).max(64).regex(
|
|
@@ -2354,21 +2453,48 @@ var createPortOnePaymentSessionBodySchema = z5.object({
|
|
|
2354
2453
|
portOneStandardProviderOptionsSchema
|
|
2355
2454
|
])
|
|
2356
2455
|
}).strict();
|
|
2357
|
-
var
|
|
2358
|
-
createTossPaymentSessionBodySchema,
|
|
2359
|
-
createPortOnePaymentSessionBodySchema
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
})
|
|
2370
|
-
]
|
|
2456
|
+
var createPaymentSessionBodySchemasByProvider = {
|
|
2457
|
+
toss: createTossPaymentSessionBodySchema,
|
|
2458
|
+
portone: createPortOnePaymentSessionBodySchema
|
|
2459
|
+
};
|
|
2460
|
+
function providerDiscriminatedUnion(schemas) {
|
|
2461
|
+
const variants = CHECKOUT_PAYMENT_SESSION_PROVIDERS.map(
|
|
2462
|
+
(provider) => schemas[provider]
|
|
2463
|
+
);
|
|
2464
|
+
return z5.discriminatedUnion("provider", variants);
|
|
2465
|
+
}
|
|
2466
|
+
var createPaymentSessionBodySchema = providerDiscriminatedUnion(
|
|
2467
|
+
createPaymentSessionBodySchemasByProvider
|
|
2371
2468
|
);
|
|
2469
|
+
var createServerPaymentSessionBodySchema = providerDiscriminatedUnion({
|
|
2470
|
+
toss: createTossPaymentSessionBodySchema.extend({
|
|
2471
|
+
customerToken: commerceCustomerTokenSchema.optional()
|
|
2472
|
+
}),
|
|
2473
|
+
portone: createPortOnePaymentSessionBodySchema.extend({
|
|
2474
|
+
customerToken: commerceCustomerTokenSchema.optional()
|
|
2475
|
+
})
|
|
2476
|
+
});
|
|
2477
|
+
var createPaymentSessionParamsSchemasByProvider = {
|
|
2478
|
+
toss: createTossPaymentSessionBodySchema.extend({
|
|
2479
|
+
idempotencyKey: commerceIdempotencyKeySchema
|
|
2480
|
+
}),
|
|
2481
|
+
portone: createPortOnePaymentSessionBodySchema.extend({
|
|
2482
|
+
idempotencyKey: commerceIdempotencyKeySchema
|
|
2483
|
+
})
|
|
2484
|
+
};
|
|
2485
|
+
var createPaymentSessionParamsSchema = providerDiscriminatedUnion(
|
|
2486
|
+
createPaymentSessionParamsSchemasByProvider
|
|
2487
|
+
);
|
|
2488
|
+
var createServerPaymentSessionParamsSchema = providerDiscriminatedUnion({
|
|
2489
|
+
toss: createTossPaymentSessionBodySchema.extend({
|
|
2490
|
+
customerToken: commerceCustomerTokenSchema.optional(),
|
|
2491
|
+
idempotencyKey: commerceIdempotencyKeySchema
|
|
2492
|
+
}),
|
|
2493
|
+
portone: createPortOnePaymentSessionBodySchema.extend({
|
|
2494
|
+
customerToken: commerceCustomerTokenSchema.optional(),
|
|
2495
|
+
idempotencyKey: commerceIdempotencyKeySchema
|
|
2496
|
+
})
|
|
2497
|
+
});
|
|
2372
2498
|
var retrieveBrowserPaymentSessionParamsSchema = z5.object({
|
|
2373
2499
|
paymentSessionId: commerceResourceIdSchema,
|
|
2374
2500
|
checkoutToken: commerceCapabilitySchema
|
|
@@ -2432,7 +2558,8 @@ var customPaymentIdentitySchema = z5.string().trim().min(1);
|
|
|
2432
2558
|
var customPaymentCurrencyInputSchema = z5.string().trim().min(1).regex(/^[A-Za-z]{3}$/, "currency must be a three-letter ISO 4217 code").transform((currency) => currency.toUpperCase());
|
|
2433
2559
|
var createCustomPaymentSessionBodySchema = z5.object({
|
|
2434
2560
|
provider: customPaymentProviderSchema,
|
|
2435
|
-
checkoutToken: commerceCapabilitySchema
|
|
2561
|
+
checkoutToken: commerceCapabilitySchema,
|
|
2562
|
+
customerToken: commerceCustomerTokenSchema.optional()
|
|
2436
2563
|
}).strict();
|
|
2437
2564
|
var createCustomPaymentSessionParamsSchema = createCustomPaymentSessionBodySchema.extend({
|
|
2438
2565
|
idempotencyKey: commerceIdempotencyKeySchema
|
|
@@ -2750,16 +2877,19 @@ function providerSessionSchemas(provider, action) {
|
|
|
2750
2877
|
}).strict()
|
|
2751
2878
|
);
|
|
2752
2879
|
}
|
|
2753
|
-
var
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2880
|
+
var paymentNextActionSchemasByProvider = {
|
|
2881
|
+
toss: tossPaymentNextActionSchema,
|
|
2882
|
+
portone: z5.union([
|
|
2883
|
+
portOnePaymentNextActionSchema,
|
|
2884
|
+
portOneSdkPaymentNextActionSchema
|
|
2885
|
+
])
|
|
2886
|
+
};
|
|
2887
|
+
var publicPaymentSessionVariants = CHECKOUT_PAYMENT_SESSION_PROVIDERS.flatMap(
|
|
2888
|
+
(provider) => providerSessionSchemas(
|
|
2889
|
+
provider,
|
|
2890
|
+
paymentNextActionSchemasByProvider[provider]
|
|
2761
2891
|
)
|
|
2762
|
-
|
|
2892
|
+
);
|
|
2763
2893
|
var publicPaymentSessionSchema = z5.union(publicPaymentSessionVariants);
|
|
2764
2894
|
var portOneReconciliationSummarySchema = z5.union([
|
|
2765
2895
|
noReconciliationSchema,
|
|
@@ -2854,7 +2984,6 @@ var checkoutAmountsSchema = z6.object({
|
|
|
2854
2984
|
});
|
|
2855
2985
|
}
|
|
2856
2986
|
});
|
|
2857
|
-
var CHECKOUT_PAYMENT_SESSION_PROVIDERS = ["toss", "portone"];
|
|
2858
2987
|
var checkoutPaymentSessionRefSchema = z6.object({
|
|
2859
2988
|
id: z6.string().min(1),
|
|
2860
2989
|
provider: z6.enum(CHECKOUT_PAYMENT_SESSION_PROVIDERS),
|
|
@@ -2962,6 +3091,7 @@ var createCheckoutParamsSchema = createCheckoutBodySchema.extend({
|
|
|
2962
3091
|
idempotencyKey: commerceIdempotencyKeySchema
|
|
2963
3092
|
});
|
|
2964
3093
|
var createServerCheckoutBodySchema = createCheckoutBodySchema.safeExtend({
|
|
3094
|
+
customerToken: commerceCustomerTokenSchema.optional(),
|
|
2965
3095
|
clientReferenceId: commerceResourceIdSchema.optional(),
|
|
2966
3096
|
integrationMetadata: integrationMetadataSchema.optional()
|
|
2967
3097
|
}).strict();
|
|
@@ -3859,10 +3989,9 @@ function registerCommerceSessionCommands(program, getClient, getFormat) {
|
|
|
3859
3989
|
exitWithError(error);
|
|
3860
3990
|
}
|
|
3861
3991
|
});
|
|
3862
|
-
sessions.command("retrieve <paymentSessionId>").description("Retrieve a PaymentSession").
|
|
3992
|
+
sessions.command("retrieve <paymentSessionId>").description("Retrieve a PaymentSession").requiredOption(
|
|
3863
3993
|
"--provider <provider>",
|
|
3864
|
-
"Payment provider (toss or portone)"
|
|
3865
|
-
"toss"
|
|
3994
|
+
"Payment provider (toss or portone)"
|
|
3866
3995
|
).action(async (paymentSessionId, opts) => {
|
|
3867
3996
|
try {
|
|
3868
3997
|
const provider = paymentProvider(opts.provider);
|
|
@@ -3878,10 +4007,9 @@ function registerCommerceSessionCommands(program, getClient, getFormat) {
|
|
|
3878
4007
|
sessions.command("cancel").description("Cancel a PaymentSession and release its payment slot").option("--data-stdin", "Read session ID and idempotency key from stdin").option(
|
|
3879
4008
|
"--data-file <path>",
|
|
3880
4009
|
"Read session ID and idempotency key from file"
|
|
3881
|
-
).
|
|
4010
|
+
).requiredOption(
|
|
3882
4011
|
"--provider <provider>",
|
|
3883
|
-
"Payment provider (toss or portone)"
|
|
3884
|
-
"toss"
|
|
4012
|
+
"Payment provider (toss or portone)"
|
|
3885
4013
|
).option("--dry-run", "Validate inputs without executing").action(async (opts) => {
|
|
3886
4014
|
try {
|
|
3887
4015
|
const data = parseWithSchema(
|
|
@@ -6162,6 +6290,7 @@ function createCliProgram() {
|
|
|
6162
6290
|
program.hook("preAction", () => {
|
|
6163
6291
|
const lang = program.opts().lang;
|
|
6164
6292
|
if (lang === "ko" || lang === "en") setLocale(lang);
|
|
6293
|
+
installCredentialRotationWarning();
|
|
6165
6294
|
const format = program.opts().format;
|
|
6166
6295
|
if (format) process.env.OUTPUT_FORMAT = format;
|
|
6167
6296
|
});
|