@01.software/cli 0.19.5 → 0.20.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/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,
@@ -50,7 +51,9 @@ var COMMERCE_ENDPOINT_OPERATIONS = {
50
51
  ),
51
52
  stockCheck: operation("products", "post", "/stock-check"),
52
53
  stockSnapshot: operation("products", "get", "/stock"),
53
- upsert: operation("products", "post", "/upsert")
54
+ upsert: operation("products", "post", "/upsert"),
55
+ graphRevision: operation("products", "get", "/:id/graph-revision"),
56
+ variantsPatch: operation("products", "patch", "/:id/variants")
54
57
  },
55
58
  orders: {
56
59
  create: operation("orders", "post", "/create"),
@@ -176,23 +179,69 @@ var portOneStandardActionCapabilityOperations = /* @__PURE__ */ new Set([
176
179
  ]);
177
180
  var MEMBERSHIP_ENDPOINT_OPERATIONS = {
178
181
  subscribe: operation(null, "post", "/memberships/subscribe"),
182
+ billingCustody: operation(null, "post", "/memberships/billing-custody"),
179
183
  cancel: operation(null, "post", "/memberships/:id/cancel"),
180
184
  me: operation(null, "get", "/memberships/me"),
181
185
  chargeResult: operation(null, "post", "/memberships/:id/charge-result"),
182
186
  refundResult: operation(null, "post", "/memberships/:id/refund-result"),
183
187
  revoke: operation(null, "post", "/memberships/:id/revoke")
184
188
  };
189
+ var EXTERNAL_EFFECT_CLAIM_ENDPOINT_OPERATIONS = {
190
+ claim: operation(null, "post", "/external-effect-claims/claim"),
191
+ get: operation(null, "post", "/external-effect-claims/get"),
192
+ arm: operation(null, "post", "/external-effect-claims/arm"),
193
+ release: operation(null, "post", "/external-effect-claims/release"),
194
+ report: operation(null, "post", "/external-effect-claims/report"),
195
+ recovery: operation(null, "post", "/external-effect-claims/recovery")
196
+ };
197
+ var INSTALLATION_CREDENTIAL_ENDPOINT_OPERATIONS = {
198
+ create: operation(null, "post", "/installation-credentials/create"),
199
+ get: operation(null, "post", "/installation-credentials/get"),
200
+ replace: operation(null, "post", "/installation-credentials/replace"),
201
+ dispose: operation(null, "post", "/installation-credentials/dispose")
202
+ };
203
+ var EXTERNAL_CUSTOMER_LINK_ENDPOINT_OPERATIONS = {
204
+ connect: operation("customers", "post", "/external-links/connect"),
205
+ get: operation("customers", "post", "/external-links/get"),
206
+ list: operation("customers", "post", "/external-links/list"),
207
+ unlink: operation("customers", "post", "/external-links/unlink"),
208
+ capturePreviousState: operation(
209
+ "customers",
210
+ "post",
211
+ "/external-links/capture-previous-state"
212
+ ),
213
+ clearPreviousState: operation(
214
+ "customers",
215
+ "post",
216
+ "/external-links/clear-previous-state"
217
+ )
218
+ };
185
219
  var CUSTOMER_GROUP_ENDPOINT_OPERATIONS = {
186
220
  members: operation("customer-groups", "get", "/:id/members"),
187
221
  grant: operation("customer-groups", "post", "/:id/members/grant"),
188
222
  revoke: operation("customer-groups", "post", "/:id/members/revoke")
189
223
  };
224
+ var CUSTOMER_AUTH_ENDPOINT_OPERATIONS = {
225
+ register: operation("customers", "post", "/register"),
226
+ login: operation("customers", "post", "/login"),
227
+ refresh: operation("customers", "post", "/refresh"),
228
+ me: operation("customers", "get", "/me"),
229
+ updateProfile: operation("customers", "patch", "/me"),
230
+ forgotPassword: operation("customers", "post", "/forgot-password"),
231
+ resetPassword: operation("customers", "post", "/reset-password"),
232
+ changePassword: operation("customers", "post", "/change-password"),
233
+ revokeRefresh: operation("customers", "post", "/revoke-refresh"),
234
+ withdraw: operation("customers", "post", "/withdraw")
235
+ };
190
236
  var EMBEDDED_ADMIN_ENDPOINT_OPERATIONS = {
191
237
  show: operation("tenants", "get", "/embedded-admin-app"),
192
238
  configure: operation("tenants", "patch", "/embedded-admin-app"),
193
239
  disable: operation("tenants", "delete", "/embedded-admin-app")
194
240
  };
195
241
  var EVENTS_ENDPOINT_OPERATIONS = {
242
+ registrations: {
243
+ listMine: operation("event-registrations", "get", "/my")
244
+ },
196
245
  events: {
197
246
  convertSchedule: operation("events", "post", "/:id/schedule")
198
247
  },
@@ -210,6 +259,14 @@ var COMMUNITY_ENDPOINT_OPERATIONS = {
210
259
  detail: operation("posts", "get", "/detail")
211
260
  }
212
261
  };
262
+ var GALLERY_ENDPOINT_OPERATIONS = {
263
+ items: {
264
+ storefront: operation("gallery-items", "get", "/storefront")
265
+ }
266
+ };
267
+ var VIDEO_ENDPOINT_OPERATIONS = {
268
+ playback: operation("videos", "post", "/:id/playback")
269
+ };
213
270
  function resolveOperationTemplate(descriptor) {
214
271
  return descriptor.collection ? `/api/${descriptor.collection}${descriptor.path}` : `/api${descriptor.path}`;
215
272
  }
@@ -959,6 +1016,7 @@ function withDoctorActionTranslations(translations) {
959
1016
  return translations;
960
1017
  }
961
1018
  var CLI_I18N_KO = withDoctorActionTranslations({
1019
+ 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.",
962
1020
  // CLI-surface microcopy
963
1021
  AuthenticationRequired: "\uC778\uC99D\uC774 \uD544\uC694\uD569\uB2C8\uB2E4",
964
1022
  RunLoginToAuthenticate: "`01 login` \uBA85\uB839\uC73C\uB85C \uBE0C\uB77C\uC6B0\uC800 \uC778\uC99D\uC744 \uC9C4\uD589\uD558\uAC70\uB098,",
@@ -1012,6 +1070,7 @@ var CLI_I18N_KO = withDoctorActionTranslations({
1012
1070
  unknown: "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"
1013
1071
  });
1014
1072
  var CLI_I18N_EN = {
1073
+ 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.",
1015
1074
  AuthenticationRequired: "Authentication required",
1016
1075
  RunLoginToAuthenticate: "Run `01 login` to authenticate via browser, or",
1017
1076
  PassApiKey: "pass `--api-key <token>`, or",
@@ -1266,6 +1325,31 @@ function resolveClient(apiKeyFlag) {
1266
1325
  }
1267
1326
  }
1268
1327
 
1328
+ // src/lib/credential-rotation-warning.ts
1329
+ var installed = /* @__PURE__ */ new WeakSet();
1330
+ function installCredentialRotationWarning() {
1331
+ const original = globalThis.fetch;
1332
+ if (installed.has(original)) return;
1333
+ const warned = /* @__PURE__ */ new Set();
1334
+ const observing = async (...args) => {
1335
+ const response = await original(...args);
1336
+ const deadline = response.headers.get(CREDENTIAL_ROTATION_DEADLINE_HEADER);
1337
+ if (response.ok && deadline && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(deadline)) {
1338
+ const instant = Date.parse(deadline);
1339
+ if (Number.isFinite(instant) && new Date(instant).toISOString() === deadline && !warned.has(deadline)) {
1340
+ warned.add(deadline);
1341
+ process.stderr.write(
1342
+ `${t("CredentialRotationDeadline", { deadline })}
1343
+ `
1344
+ );
1345
+ }
1346
+ }
1347
+ return response;
1348
+ };
1349
+ installed.add(observing);
1350
+ globalThis.fetch = observing;
1351
+ }
1352
+
1269
1353
  // src/commands/crud.ts
1270
1354
  import { readFileSync as readFileSync2 } from "fs";
1271
1355
  import { basename } from "path";
@@ -2288,6 +2372,18 @@ var updateCartAttributesBodySchema = z4.object({
2288
2372
  var updateCartAttributesParamsSchema = updateCartAttributesBodySchema.extend({
2289
2373
  idempotencyKey: commerceIdempotencyKeySchema
2290
2374
  });
2375
+ var serverAddItemBodySchema = addItemBodySchema.extend({
2376
+ customerToken: commerceCustomerTokenSchema.optional()
2377
+ });
2378
+ var serverAddItemParamsSchema = serverAddItemBodySchema.extend({
2379
+ idempotencyKey: commerceIdempotencyKeySchema
2380
+ });
2381
+ var serverUpdateItemBodySchema = updateItemBodySchema.extend({
2382
+ customerToken: commerceCustomerTokenSchema.optional()
2383
+ });
2384
+ var serverUpdateItemParamsSchema = serverUpdateItemBodySchema.extend({
2385
+ idempotencyKey: commerceIdempotencyKeySchema
2386
+ });
2291
2387
 
2292
2388
  // ../../internal/contracts/src/ecommerce/checkout.ts
2293
2389
  import { z as z6 } from "zod";
@@ -2383,6 +2479,14 @@ function providerDiscriminatedUnion(schemas) {
2383
2479
  var createPaymentSessionBodySchema = providerDiscriminatedUnion(
2384
2480
  createPaymentSessionBodySchemasByProvider
2385
2481
  );
2482
+ var createServerPaymentSessionBodySchema = providerDiscriminatedUnion({
2483
+ toss: createTossPaymentSessionBodySchema.extend({
2484
+ customerToken: commerceCustomerTokenSchema.optional()
2485
+ }),
2486
+ portone: createPortOnePaymentSessionBodySchema.extend({
2487
+ customerToken: commerceCustomerTokenSchema.optional()
2488
+ })
2489
+ });
2386
2490
  var createPaymentSessionParamsSchemasByProvider = {
2387
2491
  toss: createTossPaymentSessionBodySchema.extend({
2388
2492
  idempotencyKey: commerceIdempotencyKeySchema
@@ -2394,6 +2498,16 @@ var createPaymentSessionParamsSchemasByProvider = {
2394
2498
  var createPaymentSessionParamsSchema = providerDiscriminatedUnion(
2395
2499
  createPaymentSessionParamsSchemasByProvider
2396
2500
  );
2501
+ var createServerPaymentSessionParamsSchema = providerDiscriminatedUnion({
2502
+ toss: createTossPaymentSessionBodySchema.extend({
2503
+ customerToken: commerceCustomerTokenSchema.optional(),
2504
+ idempotencyKey: commerceIdempotencyKeySchema
2505
+ }),
2506
+ portone: createPortOnePaymentSessionBodySchema.extend({
2507
+ customerToken: commerceCustomerTokenSchema.optional(),
2508
+ idempotencyKey: commerceIdempotencyKeySchema
2509
+ })
2510
+ });
2397
2511
  var retrieveBrowserPaymentSessionParamsSchema = z5.object({
2398
2512
  paymentSessionId: commerceResourceIdSchema,
2399
2513
  checkoutToken: commerceCapabilitySchema
@@ -2457,7 +2571,8 @@ var customPaymentIdentitySchema = z5.string().trim().min(1);
2457
2571
  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());
2458
2572
  var createCustomPaymentSessionBodySchema = z5.object({
2459
2573
  provider: customPaymentProviderSchema,
2460
- checkoutToken: commerceCapabilitySchema
2574
+ checkoutToken: commerceCapabilitySchema,
2575
+ customerToken: commerceCustomerTokenSchema.optional()
2461
2576
  }).strict();
2462
2577
  var createCustomPaymentSessionParamsSchema = createCustomPaymentSessionBodySchema.extend({
2463
2578
  idempotencyKey: commerceIdempotencyKeySchema
@@ -2989,6 +3104,7 @@ var createCheckoutParamsSchema = createCheckoutBodySchema.extend({
2989
3104
  idempotencyKey: commerceIdempotencyKeySchema
2990
3105
  });
2991
3106
  var createServerCheckoutBodySchema = createCheckoutBodySchema.safeExtend({
3107
+ customerToken: commerceCustomerTokenSchema.optional(),
2992
3108
  clientReferenceId: commerceResourceIdSchema.optional(),
2993
3109
  integrationMetadata: integrationMetadataSchema.optional()
2994
3110
  }).strict();
@@ -6187,6 +6303,7 @@ function createCliProgram() {
6187
6303
  program.hook("preAction", () => {
6188
6304
  const lang = program.opts().lang;
6189
6305
  if (lang === "ko" || lang === "en") setLocale(lang);
6306
+ installCredentialRotationWarning();
6190
6307
  const format = program.opts().format;
6191
6308
  if (format) process.env.OUTPUT_FORMAT = format;
6192
6309
  });