@assinafy/cli 2.5.0 → 2.5.2

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/cli.cjs CHANGED
@@ -21093,6 +21093,8 @@ var ApiError = class _ApiError extends AssinafyError {
21093
21093
  wwwAuthenticate;
21094
21094
  /** Server retry delay (seconds or HTTP date), when provided. */
21095
21095
  retryAfter;
21096
+ /** Rate-limit window reported by the API, when the headers are present. */
21097
+ rateLimit;
21096
21098
  constructor(message, statusCode, responseData = null, options) {
21097
21099
  super(message, { statusCode, responseData }, options);
21098
21100
  this.name = "ApiError";
@@ -21100,6 +21102,7 @@ var ApiError = class _ApiError extends AssinafyError {
21100
21102
  this.responseData = responseData;
21101
21103
  this.wwwAuthenticate = options?.wwwAuthenticate;
21102
21104
  this.retryAfter = options?.retryAfter;
21105
+ this.rateLimit = options?.rateLimit;
21103
21106
  }
21104
21107
  static fromResponse(statusCode, responseData, headers = {}) {
21105
21108
  if (Buffer.isBuffer(responseData) || responseData instanceof ArrayBuffer) {
@@ -21113,13 +21116,23 @@ var ApiError = class _ApiError extends AssinafyError {
21113
21116
  const data = responseData ?? {};
21114
21117
  const rawMessage = data.message;
21115
21118
  const rawError = data.error;
21116
- const message = typeof rawMessage === "string" && rawMessage.length > 0 ? rawMessage : typeof rawError === "string" ? rawError : "API request failed";
21119
+ const description = data.error_description;
21120
+ const message = typeof rawMessage === "string" && rawMessage.length > 0 ? rawMessage : typeof rawError === "string" ? typeof description === "string" && description.length > 0 ? `${rawError}: ${description}` : rawError : "API request failed";
21117
21121
  return new _ApiError(message, statusCode, responseData, {
21118
21122
  wwwAuthenticate: typeof headers["www-authenticate"] === "string" ? headers["www-authenticate"] : void 0,
21119
- retryAfter: typeof headers["retry-after"] === "string" ? headers["retry-after"] : void 0
21123
+ retryAfter: typeof headers["retry-after"] === "string" ? headers["retry-after"] : void 0,
21124
+ rateLimit: parseRateLimit(headers)
21120
21125
  });
21121
21126
  }
21122
21127
  };
21128
+ function parseRateLimit(headers) {
21129
+ const info = {};
21130
+ for (const key of ["limit", "remaining", "reset"]) {
21131
+ const value = Number.parseInt(String(headers[`x-rate-limit-${key}`]), 10);
21132
+ if (Number.isFinite(value)) info[key] = value;
21133
+ }
21134
+ return Object.keys(info).length > 0 ? info : void 0;
21135
+ }
21123
21136
  var ValidationError = class extends AssinafyError {
21124
21137
  errors;
21125
21138
  constructor(message = "Validation failed", errors = {}) {
@@ -21272,6 +21285,16 @@ function validateSignerOptions(input) {
21272
21285
  `notification_methods must contain only: ${NOTIFICATION_METHODS.join(", ")}`
21273
21286
  );
21274
21287
  }
21288
+ const notifications = input.notification_methods ?? [];
21289
+ if (notifications.length > 1) {
21290
+ throw new ValidationError("notification_methods accepts exactly one method per signer");
21291
+ }
21292
+ const [notification] = notifications;
21293
+ if (notification !== void 0 && (input.verification_method === "Email" || input.verification_method === "Whatsapp") && notification !== input.verification_method) {
21294
+ throw new ValidationError(
21295
+ `${input.verification_method} verification requires the ${input.verification_method} notification method`
21296
+ );
21297
+ }
21275
21298
  if (input.step !== void 0 && !Number.isInteger(input.step)) {
21276
21299
  throw new ValidationError("step must be an integer");
21277
21300
  }
@@ -22008,7 +22031,7 @@ var DocumentResource = class extends BaseResource {
22008
22031
  async createFromTemplate(templateId, signers, options = {}, accountId) {
22009
22032
  const tmplId = this.requireId(templateId, "Template ID");
22010
22033
  const accId = this.accountId(accountId);
22011
- validateTemplateSigners(signers, { requireId: true, singleNotification: true });
22034
+ validateTemplateSigners(signers, { requireId: true });
22012
22035
  if (options.expires_at !== void 0) requireIso8601(options.expires_at, "expires_at");
22013
22036
  if (options.editor_fields !== void 0 && (!Array.isArray(options.editor_fields) || options.editor_fields.some((field) => !field?.field_id || typeof field.value !== "string"))) {
22014
22037
  throw new ValidationError("editor_fields must contain field_id and value");
@@ -22027,7 +22050,7 @@ var DocumentResource = class extends BaseResource {
22027
22050
  async estimateCostFromTemplate(templateId, signers, accountId) {
22028
22051
  const tmplId = this.requireId(templateId, "Template ID");
22029
22052
  const accId = this.accountId(accountId);
22030
- validateTemplateSigners(signers, { requireId: false, singleNotification: false });
22053
+ validateTemplateSigners(signers, { requireId: false });
22031
22054
  return this.call(
22032
22055
  "Failed to estimate cost from template",
22033
22056
  () => this.http.post(`/accounts/${accId}/templates/${tmplId}/documents/estimate-cost`, { signers })
@@ -22067,33 +22090,21 @@ var DocumentResource = class extends BaseResource {
22067
22090
  );
22068
22091
  }
22069
22092
  /**
22070
- * `PUT /public/documents/{document_id}/send-token` — send the 6-digit
22071
- * verification token to the signer's email / WhatsApp. Pass `{ email }` for
22072
- * the published OpenAPI body or a string plus channel for the live legacy body.
22093
+ * `PUT /public/documents/{document_id}/send-token` — email a one-time access
22094
+ * token to a signer who has not signed a pending document yet. The API sends
22095
+ * `{ channel: 'email', recipient }`; only the `email` channel is accepted.
22096
+ * The `{ email }` form is kept for existing callers and sends the same body.
22073
22097
  */
22074
22098
  async sendToken(documentId, recipient, channel = "email") {
22075
22099
  const id = this.requireId(documentId, "Document ID");
22076
- if (typeof recipient === "object") {
22077
- requireEmail(recipient?.email);
22078
- return this.call(
22079
- "Failed to send signing token",
22080
- () => this.http.put(
22081
- `/public/documents/${id}/send-token`,
22082
- { email: recipient.email },
22083
- publicRequestConfig()
22084
- )
22085
- );
22086
- }
22087
- if (!recipient) throw new ValidationError("recipient is required");
22088
- if (channel !== "email" && channel !== "whatsapp") {
22089
- throw new ValidationError("channel must be email or whatsapp");
22090
- }
22091
- if (channel === "email") requireEmail(recipient);
22100
+ const email = typeof recipient === "object" ? recipient?.email : recipient;
22101
+ if (channel !== "email") throw new ValidationError("channel must be email");
22102
+ requireEmail(email);
22092
22103
  return this.call(
22093
22104
  "Failed to send signing token",
22094
22105
  () => this.http.put(
22095
22106
  `/public/documents/${id}/send-token`,
22096
- { recipient, channel },
22107
+ { channel, recipient: email },
22097
22108
  publicRequestConfig()
22098
22109
  )
22099
22110
  );
@@ -22136,9 +22147,6 @@ function validateTemplateSigners(signers, options) {
22136
22147
  if (options.requireId && signer.step !== void 0 && Number(signer.step) < 1) {
22137
22148
  throw new ValidationError("template signer step must be a positive integer");
22138
22149
  }
22139
- if (options.singleNotification && Array.isArray(signer.notification_methods) && signer.notification_methods.length > 1) {
22140
- throw new ValidationError("template signers accept at most one notification method");
22141
- }
22142
22150
  }
22143
22151
  if (options.requireId) {
22144
22152
  validateSigningSteps(signers);
@@ -22423,7 +22431,7 @@ var OAuthResource = class extends BaseResource {
22423
22431
  });
22424
22432
  }
22425
22433
  /**
22426
- * `POST /oauth/token` — code exchange or refresh; returns the flat OAuth JSON body.
22434
+ * `POST /oauth/token` — code exchange, refresh, or RFC 8693 token exchange; returns the flat OAuth JSON body.
22427
22435
  * A refresh must return a new `refresh_token`; otherwise this throws `ValidationError`.
22428
22436
  */
22429
22437
  async token(payload) {
@@ -22440,8 +22448,20 @@ var OAuthResource = class extends BaseResource {
22440
22448
  }
22441
22449
  } else if (payload.grant_type === "refresh_token") {
22442
22450
  required(payload.refresh_token, "refresh_token");
22451
+ } else if (payload.grant_type === TOKEN_EXCHANGE) {
22452
+ required(payload.client_secret, "client_secret");
22453
+ httpsUrl(required(payload.resource, "resource"), "resource");
22454
+ required(payload.subject_token, "subject_token");
22455
+ for (const field of ["subject_token_type", "requested_token_type"]) {
22456
+ const value = payload[field];
22457
+ if ((value !== void 0 || field === "subject_token_type") && value !== ACCESS_TOKEN_TYPE) {
22458
+ throw new ValidationError(`${field} must be ${ACCESS_TOKEN_TYPE}`);
22459
+ }
22460
+ }
22443
22461
  } else {
22444
- throw new ValidationError("grant_type must be authorization_code or refresh_token");
22462
+ throw new ValidationError(
22463
+ `grant_type must be authorization_code, refresh_token or ${TOKEN_EXCHANGE}`
22464
+ );
22445
22465
  }
22446
22466
  const tokens = await this.call(
22447
22467
  "OAuth token request failed",
@@ -22474,6 +22494,8 @@ var OAuthResource = class extends BaseResource {
22474
22494
  return this.call("Failed to fetch OAuth userinfo", () => this.http.get("/oauth/userinfo"));
22475
22495
  }
22476
22496
  };
22497
+ var TOKEN_EXCHANGE = "urn:ietf:params:oauth:grant-type:token-exchange";
22498
+ var ACCESS_TOKEN_TYPE = "urn:ietf:params:oauth:token-type:access_token";
22477
22499
  function required(value, name) {
22478
22500
  if (typeof value !== "string" || !value.trim()) throw new ValidationError(`${name} is required`);
22479
22501
  return value;
@@ -22502,27 +22524,32 @@ var SignerDocumentsResource = class extends BaseResource {
22502
22524
  () => this.http.get(`/signers/${sid}/document`, signerAccessConfig(code))
22503
22525
  );
22504
22526
  }
22505
- /** `GET /signers/{signer_id}/documents?signer-access-code=…` */
22527
+ /**
22528
+ * `GET /signers/{signer_id}/documents` — with a signer access code, or with
22529
+ * the client's owner credentials when the code is omitted (the signer must
22530
+ * belong to that workspace).
22531
+ */
22506
22532
  async list(signerId, signerAccessCode, params = {}) {
22507
22533
  const sid = this.requireId(signerId, "Signer ID");
22508
- const code = this.requireId(signerAccessCode, "signer-access-code");
22534
+ const config = this.signerOrOwnerConfig(signerAccessCode, { ...params });
22509
22535
  return this.callList(
22510
22536
  "Failed to list signer documents",
22511
- () => this.http.get(
22512
- `/signers/${sid}/documents`,
22513
- signerAccessConfig(code, params)
22514
- )
22537
+ () => this.http.get(`/signers/${sid}/documents`, config)
22515
22538
  );
22516
22539
  }
22517
- /** `GET /signers/{signer_id}/documents/search?signer-access-code=…&search=…` */
22540
+ /** `GET /signers/{signer_id}/documents/search?search=…` — access code or owner credentials. */
22518
22541
  async search(signerId, search, signerAccessCode) {
22519
22542
  const sid = this.requireId(signerId, "Signer ID");
22520
- const code = this.requireId(signerAccessCode, "signer-access-code");
22543
+ const config = this.signerOrOwnerConfig(signerAccessCode, { search });
22521
22544
  return this.callList(
22522
22545
  "Failed to search signer documents",
22523
- () => this.http.get(`/signers/${sid}/documents/search`, signerAccessConfig(code, { search }))
22546
+ () => this.http.get(`/signers/${sid}/documents/search`, config)
22524
22547
  );
22525
22548
  }
22549
+ signerOrOwnerConfig(signerAccessCode, params) {
22550
+ if (signerAccessCode === void 0) return { params: cleanParams(params) };
22551
+ return signerAccessConfig(this.requireId(signerAccessCode, "signer-access-code"), params);
22552
+ }
22526
22553
  /**
22527
22554
  * Public `GET /signers/{signer_id}/documents/{document_id}/download/{artifact}`.
22528
22555
  * When an access code is supplied, the SDK first verifies that it belongs to
@@ -23674,7 +23701,8 @@ function normalizeError(err) {
23674
23701
  statusCode: err.statusCode,
23675
23702
  details: err.responseData ?? void 0,
23676
23703
  ...err.wwwAuthenticate ? { wwwAuthenticate: err.wwwAuthenticate } : {},
23677
- ...err.retryAfter ? { retryAfter: err.retryAfter } : {}
23704
+ ...err.retryAfter ? { retryAfter: err.retryAfter } : {},
23705
+ ...err.rateLimit ? { rateLimit: err.rateLimit } : {}
23678
23706
  };
23679
23707
  }
23680
23708
  if (err instanceof PartialWorkflowError) {
@@ -23687,6 +23715,7 @@ function normalizeError(err) {
23687
23715
  if (cause.statusCode !== void 0) normalized.statusCode = cause.statusCode;
23688
23716
  if (cause.wwwAuthenticate !== void 0) normalized.wwwAuthenticate = cause.wwwAuthenticate;
23689
23717
  if (cause.retryAfter !== void 0) normalized.retryAfter = cause.retryAfter;
23718
+ if (cause.rateLimit !== void 0) normalized.rateLimit = cause.rateLimit;
23690
23719
  return normalized;
23691
23720
  }
23692
23721
  if (err instanceof ValidationError) {
@@ -23883,6 +23912,14 @@ function printError(err, config) {
23883
23912
  if (normalized.statusCode) {
23884
23913
  writeErr(import_picocolors.default.dim(` (HTTP ${normalized.statusCode})`));
23885
23914
  }
23915
+ if (normalized.statusCode === 429) {
23916
+ const wait = normalized.retryAfter ?? normalized.rateLimit?.reset;
23917
+ writeErr(
23918
+ import_picocolors.default.dim(
23919
+ ` (rate limit reached${wait === void 0 ? "" : `; retry after ${sanitizeTerminalText(String(wait))} s`})`
23920
+ )
23921
+ );
23922
+ }
23886
23923
  const challenge = normalized.wwwAuthenticate ?? "";
23887
23924
  const scope = challenge.includes("insufficient_scope") && /\bscope="([^"]+)"/.exec(challenge)?.[1];
23888
23925
  if (scope) {
@@ -26284,32 +26321,27 @@ var publicCommand = new Command("public").description("Public (unauthenticated)
26284
26321
  printData(info, config, (d) => renderKeyValue(d));
26285
26322
  });
26286
26323
  });
26287
- var sendTokenCommand = new Command("send-token").description("Send a 6-digit verification token to a signer").argument("<id>", "Document ID").addOption(
26288
- new Option(
26289
- "--email <email>",
26290
- "Email address (compatibility overload for older deployments)"
26291
- ).conflicts(["recipient", "channel"])
26292
- ).addOption(
26293
- new Option(
26294
- "--recipient <value>",
26295
- "Email address or phone number (production payload)"
26296
- ).conflicts("email")
26297
- ).addOption(
26298
- new Option("--channel <channel>", "email or whatsapp").default("email").conflicts("email")
26324
+ var sendTokenCommand = new Command("send-token").description("Email a one-time access token to a signer of a pending document").argument("<id>", "Document ID").addOption(
26325
+ new Option("--recipient <email>", "Email of a signer who has not signed yet").conflicts(
26326
+ "email"
26327
+ )
26328
+ ).addOption(new Option("--email <email>", "Alias of --recipient").conflicts("recipient")).addOption(
26329
+ new Option("--channel <channel>", "Delivery channel").choices(["email"]).default("email")
26299
26330
  ).action(async (id, opts, command) => {
26300
26331
  await runWithPublicClient(command, async ({ client, config }) => {
26301
- if (!opts.email && !opts.recipient) {
26302
- throw new CliError("Pass --email <email> or --recipient <value>.");
26303
- }
26304
- const recipient = opts.email ? { email: opts.email } : opts.recipient;
26305
- const channel = parseSendTokenChannel(opts.channel);
26332
+ const recipient = opts.recipient ?? opts.email;
26333
+ if (!recipient) throw new CliError("Pass --recipient <email>.");
26306
26334
  const result = await withSpinner(
26307
26335
  "Sending token",
26308
26336
  config,
26309
- () => client.documents.sendToken(id, recipient, channel)
26337
+ () => client.documents.sendToken(id, recipient)
26338
+ );
26339
+ printSuccess(`Token sent to ${recipient}`, config);
26340
+ printData(
26341
+ result,
26342
+ config,
26343
+ (r2) => renderKeyValue({ document: r2.document.id, channel: r2.channel, recipient: r2.recipient })
26310
26344
  );
26311
- printSuccess(`Token sent to ${opts.email ?? opts.recipient}`, config);
26312
- printData(result, config);
26313
26345
  });
26314
26346
  });
26315
26347
  var progressCommand = new Command("progress").description("Show signing progress for a document").argument("<id>", "Document ID").action(async (id, _opts, command) => {
@@ -26344,10 +26376,6 @@ var waitCommand = new Command("wait").description("Poll a document until it is r
26344
26376
  printData(doc, config, (d) => renderKeyValue({ id: d.id, status: d.status }));
26345
26377
  });
26346
26378
  });
26347
- function parseSendTokenChannel(value) {
26348
- if (value === "email" || value === "whatsapp") return value;
26349
- throw new CliError("--channel must be email or whatsapp");
26350
- }
26351
26379
  var documentsCommand = new Command("documents").description("Upload, list, download, and manage documents").addCommand(uploadCommand).addCommand(listCommand3).addCommand(searchCommand).addCommand(getCommand2).addCommand(renameCommand).addCommand(downloadCommand).addCommand(thumbnailCommand).addCommand(downloadPageCommand).addCommand(activitiesCommand).addCommand(deleteCommand).addCommand(tagsCommand).addCommand(tagsSetCommand).addCommand(tagsAddCommand).addCommand(tagsRemoveCommand).addCommand(createFromTemplateCommand).addCommand(estimateTemplateCostCommand).addCommand(verifyCommand).addCommand(statusesCommand).addCommand(publicCommand).addCommand(sendTokenCommand).addCommand(progressCommand).addCommand(waitCommand);
26352
26380
 
26353
26381
  // src/commands/fields.ts
@@ -26741,6 +26769,10 @@ var sendCommand = new Command("send").description("Upload a PDF, create signers,
26741
26769
 
26742
26770
  // src/commands/signer.ts
26743
26771
  var accessCodeOption = () => new Option("--access-code <code>", "Signer access code").env("ASSINAFY_SIGNER_ACCESS_CODE").makeOptionMandatory();
26772
+ var optionalAccessCodeOption = () => new Option("--access-code <code>", "Signer access code (omit to use your API key or token)").env(
26773
+ "ASSINAFY_SIGNER_ACCESS_CODE"
26774
+ );
26775
+ var runSignerOrOwner = (accessCode) => accessCode === void 0 ? runWithClient : runWithPublicClient;
26744
26776
  var documentCommand = new Command("document").description("Fetch the signer's current document").argument("<signerId>", "Signer ID").addOption(accessCodeOption()).action(async (signerId, opts, command) => {
26745
26777
  await runWithPublicClient(command, async ({ client, config }) => {
26746
26778
  const doc = await withSpinner(
@@ -26752,9 +26784,9 @@ var documentCommand = new Command("document").description("Fetch the signer's cu
26752
26784
  });
26753
26785
  });
26754
26786
  var documentsCommand2 = addListOptions(
26755
- new Command("documents").description("List the signer's documents").argument("<signerId>", "Signer ID").addOption(accessCodeOption())
26787
+ new Command("documents").description("List the signer's documents").argument("<signerId>", "Signer ID").addOption(optionalAccessCodeOption())
26756
26788
  ).action(async (signerId, opts, command) => {
26757
- await runWithPublicClient(command, async ({ client, config }) => {
26789
+ await runSignerOrOwner(opts.accessCode)(command, async ({ client, config }) => {
26758
26790
  const result = await withSpinner(
26759
26791
  "Fetching documents",
26760
26792
  config,
@@ -26771,8 +26803,8 @@ var documentsCommand2 = addListOptions(
26771
26803
  );
26772
26804
  });
26773
26805
  });
26774
- var searchCommand2 = new Command("search").description("Search the signer's documents").argument("<signerId>", "Signer ID").argument("<query>", "Search text").addOption(accessCodeOption()).action(async (signerId, query, opts, command) => {
26775
- await runWithPublicClient(command, async ({ client, config }) => {
26806
+ var searchCommand2 = new Command("search").description("Search the signer's documents").argument("<signerId>", "Signer ID").argument("<query>", "Search text").addOption(optionalAccessCodeOption()).action(async (signerId, query, opts, command) => {
26807
+ await runSignerOrOwner(opts.accessCode)(command, async ({ client, config }) => {
26776
26808
  const result = await withSpinner(
26777
26809
  "Searching documents",
26778
26810
  config,
@@ -27529,8 +27561,33 @@ var endpointsRotateSecretCommand = new Command("rotate-secret").description("Rep
27529
27561
  printData(result, config, (r2) => r2.secret);
27530
27562
  });
27531
27563
  });
27564
+ var verifyCommand2 = new Command("verify").description(
27565
+ "Verify a signed delivery (Standard Webhooks) against ASSINAFY_WEBHOOK_SECRET or the profile secret"
27566
+ ).argument("<bodyFile>", "Raw request body exactly as received").requiredOption("--id <value>", "webhook-id header").requiredOption("--timestamp <seconds>", "webhook-timestamp header").requiredOption("--signature <value>", "webhook-signature header").option("--tolerance <seconds>", "Accepted clock difference in seconds", "300").action(async (bodyFile, opts, command) => {
27567
+ await runAction(command, async ({ config }) => {
27568
+ if (!config.webhookSecret) {
27569
+ throw new CliError(
27570
+ "No webhook secret found. Set ASSINAFY_WEBHOOK_SECRET or `assinafy config set --webhook-secret`."
27571
+ );
27572
+ }
27573
+ const valid = new WebhookVerifier(config.webhookSecret).verifyDelivery(
27574
+ readBinary(bodyFile),
27575
+ {
27576
+ "webhook-id": opts.id,
27577
+ "webhook-timestamp": opts.timestamp,
27578
+ "webhook-signature": opts.signature
27579
+ },
27580
+ { toleranceSeconds: parseInteger(opts.tolerance, "--tolerance", { min: 0 }) }
27581
+ );
27582
+ if (!valid) {
27583
+ throw new CliError("Invalid webhook signature or timestamp outside the tolerance window.");
27584
+ }
27585
+ printSuccess("Webhook signature is valid", config);
27586
+ printData({ valid, id: opts.id }, config, () => "valid");
27587
+ });
27588
+ });
27532
27589
  var endpointsCommand = new Command("endpoints").description("Manage webhook endpoints and their signing secrets").addCommand(endpointsListCommand).addCommand(endpointsCreateCommand).addCommand(endpointsGetCommand).addCommand(endpointsUpdateCommand).addCommand(endpointsDeleteCommand).addCommand(endpointsSecretCommand).addCommand(endpointsRotateSecretCommand);
27533
- var webhooksCommand = new Command("webhooks").description("Manage webhook endpoints, the primary subscription, and delivery history").addCommand(endpointsCommand).addCommand(registerCommand).addCommand(getCommand6).addCommand(inactivateCommand).addCommand(eventTypesCommand).addCommand(dispatchesCommand).addCommand(retryCommand);
27590
+ var webhooksCommand = new Command("webhooks").description("Manage webhook endpoints, the primary subscription, and delivery history").addCommand(endpointsCommand).addCommand(registerCommand).addCommand(getCommand6).addCommand(inactivateCommand).addCommand(eventTypesCommand).addCommand(dispatchesCommand).addCommand(retryCommand).addCommand(verifyCommand2);
27534
27591
 
27535
27592
  // src/commands/whoami.ts
27536
27593
  var whoamiCommand = new Command("whoami").description("Verify credentials and list the workspaces they can access").action(async (_opts, command) => {
@@ -27753,7 +27810,7 @@ function handleStreamError(err, fallback, exit = process.exit) {
27753
27810
  // package.json
27754
27811
  var package_default = {
27755
27812
  name: "@assinafy/cli",
27756
- version: "2.5.0",
27813
+ version: "2.5.2",
27757
27814
  description: "The official command-line interface for the Assinafy digital-signature API",
27758
27815
  license: "MIT",
27759
27816
  type: "module",
@@ -27807,7 +27864,7 @@ var package_default = {
27807
27864
  bugs: {
27808
27865
  url: "https://github.com/assinafy/assinafy-cli/issues"
27809
27866
  },
27810
- homepage: "https://github.com/assinafy/assinafy-cli#readme",
27867
+ homepage: "https://www.assinafy.com.br",
27811
27868
  scripts: {
27812
27869
  dev: "tsx src/cli.ts",
27813
27870
  "dev:watch": "tsx --watch src/cli.ts",
@@ -5,6 +5,12 @@ export declare class AssinafyError extends Error {
5
5
  cause?: unknown;
6
6
  });
7
7
  }
8
+ /** `X-Rate-Limit-*` values reported with a response (window size, requests left, seconds to reset). */
9
+ export interface RateLimitInfo {
10
+ limit?: number;
11
+ remaining?: number;
12
+ reset?: number;
13
+ }
8
14
  /** Thrown when the API returns a non-success HTTP status. */
9
15
  export declare class ApiError extends AssinafyError {
10
16
  readonly statusCode: number;
@@ -13,10 +19,13 @@ export declare class ApiError extends AssinafyError {
13
19
  readonly wwwAuthenticate: string | undefined;
14
20
  /** Server retry delay (seconds or HTTP date), when provided. */
15
21
  readonly retryAfter: string | undefined;
22
+ /** Rate-limit window reported by the API, when the headers are present. */
23
+ readonly rateLimit: RateLimitInfo | undefined;
16
24
  constructor(message: string, statusCode: number, responseData?: unknown, options?: {
17
25
  cause?: unknown;
18
26
  wwwAuthenticate?: string;
19
27
  retryAfter?: string;
28
+ rateLimit?: RateLimitInfo;
20
29
  });
21
30
  static fromResponse(statusCode: number, responseData: unknown, headers?: Record<string, unknown>): ApiError;
22
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/api/errors.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,qBAAa,aAAc,SAAQ,KAAK;IACvC,SAAgB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,C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5B,OAAO,CAAC,EAAE;QACT,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,aAAa,CAAC;KAC1B,EASD;IAED,MAAM,CAAC,YAAY,CAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,OAAO,EACrB,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACnC,QAAQ,CA6BV;CACD;AAWD,2EAA2E;AAC3E,qBAAa,eAAgB,SAAQ,aAAa;IACjD,SAAgB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEhD,YAAY,OAAO,SAAsB,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EAI9E;CACD;AAED,wEAAwE;AACxE,qBAAa,YAAa,SAAQ,aAAa;IAC9C,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAGzD;CACD;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;IACtD,iEAAiE;IACjE,SAAgB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/C,kEAAkE;IAClE,SAAgB,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpC,YACC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,EACtD,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAO7B;CACD"}
@@ -109,9 +109,10 @@ export declare class DocumentResource extends BaseResource {
109
109
  */
110
110
  getPublic(documentId: string): Promise<IPublicDocumentInfo>;
111
111
  /**
112
- * `PUT /public/documents/{document_id}/send-token` — send the 6-digit
113
- * verification token to the signer's email / WhatsApp. Pass `{ email }` for
114
- * the published OpenAPI body or a string plus channel for the live legacy body.
112
+ * `PUT /public/documents/{document_id}/send-token` — email a one-time access
113
+ * token to a signer who has not signed a pending document yet. The API sends
114
+ * `{ channel: 'email', recipient }`; only the `email` channel is accepted.
115
+ * The `{ email }` form is kept for existing callers and sends the same body.
115
116
  */
116
117
  sendToken(documentId: string, recipient: string | {
117
118
  email: string;
@@ -1 +1 @@
1
- {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../../../src/api/resources/documents.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,oBAAoB,EAEpB,kCAAkC,EAClC,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EAExB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,IAAI,EACJ,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,MAAM,aAAa,CAAC;AAYrB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAmBzC,qFAAqF;AACrF,MAAM,MAAM,oBAAoB,GAC7B;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAExC,MAAM,WAAW,sBAAsB;IACtC,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,gBAAiB,SAAQ,YAAY;IACjD;;;;;;;;OAQG;IACG,MAAM,CACX,MAAM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,mBAAmB,CAAC,CAKhE;IAED;;;;OAIG;IACG,SAAS,CACd,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,EACrC,OAAO,GAAE,gBAA0B,GACjC,OAAO,CAAC,kBAAkB,CAAC,CAwB7B;IAED,gEAAgE;IAC1D,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQxD;IAED,iDAAiD;IAC3C,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAQtE;CACD"}
1
+ {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../../../src/api/resources/documents.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,oBAAoB,EAEpB,kCAAkC,EAClC,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EAExB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,IAAI,EACJ,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,MAAM,aAAa,CAAC;AAYrB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAmBzC,qFAAqF;AACrF,MAAM,MAAM,oBAAoB,GAC7B;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAExC,MAAM,WAAW,sBAAsB;IACtC,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,gEAAgE;IAChE,SAAS,CA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O,CAAC,mBAAmB,EAAE,CAAC,CAI/C;IAED;;;;OAIG;IACG,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAKhE;IAED;;;;;OAKG;IACG,SAAS,CACd,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,EACrC,OAAO,GAAE,gBAA0B,GACjC,OAAO,CAAC,kBAAkB,CAAC,CAY7B;IAED,gEAAgE;IAC1D,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQxD;IAED,iDAAiD;IAC3C,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAQtE;CACD"}
@@ -11,7 +11,7 @@ export declare class OAuthResource extends BaseResource {
11
11
  /** Validate callback URI, state, and issuer before exchanging its one-time code. */
12
12
  exchangeCode(callbackUrl: string, request: IOAuthAuthorizationRequest, clientSecret?: string): Promise<IOAuthTokenResponse>;
13
13
  /**
14
- * `POST /oauth/token` — code exchange or refresh; returns the flat OAuth JSON body.
14
+ * `POST /oauth/token` — code exchange, refresh, or RFC 8693 token exchange; returns the flat OAuth JSON body.
15
15
  * A refresh must return a new `refresh_token`; otherwise this throws `ValidationError`.
16
16
  */
17
17
  token(payload: IOAuthTokenPayload): Promise<IOAuthTokenResponse>;
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../src/api/resources/oauth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AASzC,2FAA2F;AAC3F,qBAAa,aAAc,SAAQ,YAAY;IAC9C,oF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AAoF;IAC9E,YAAY,CACjB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,0BAA0B,EACnC,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,mBAAmB,CAAC,CAiD9B;IAED;;;OAGG;IACG,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAmDrE;IAED,2FAA2F;IACrF,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAaxD;IAED,uFAAuF;IACjF,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC,CAExC;CACD"}
@@ -8,10 +8,15 @@ import { BaseResource } from './base.js';
8
8
  export declare class SignerDocumentsResource extends BaseResource {
9
9
  /** `GET /signers/{signer_id}/document?signer-access-code=…` */
10
10
  getCurrent(signerId: string, signerAccessCode: string): Promise<IDocumentDetailsResponse>;
11
- /** `GET /signers/{signer_id}/documents?signer-access-code=…` */
12
- list(signerId: string, signerAccessCode: string, params?: ISignerDocumentListParams): Promise<IDocumentListResponse>;
13
- /** `GET /signers/{signer_id}/documents/search?signer-access-code=…&search=…` */
14
- search(signerId: string, search: string, signerAccessCode: string): Promise<IDocumentListResponse>;
11
+ /**
12
+ * `GET /signers/{signer_id}/documents` — with a signer access code, or with
13
+ * the client's owner credentials when the code is omitted (the signer must
14
+ * belong to that workspace).
15
+ */
16
+ list(signerId: string, signerAccessCode?: string, params?: ISignerDocumentListParams): Promise<IDocumentListResponse>;
17
+ /** `GET /signers/{signer_id}/documents/search?search=…` — access code or owner credentials. */
18
+ search(signerId: string, search: string, signerAccessCode?: string): Promise<IDocumentListResponse>;
19
+ private signerOrOwnerConfig;
15
20
  /**
16
21
  * Public `GET /signers/{signer_id}/documents/{document_id}/download/{artifact}`.
17
22
  * When an access code is supplied, the SDK first verifies that it belongs to
@@ -1 +1 @@
1
- {"version":3,"file":"signer-documents.d.ts","sourceRoot":"","sources":["../../../../src/api/resources/signer-documents.ts"],"names":[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AAG,SAAuB,GAC9C,OAAO,CAAC,MAAM,CAAC,CASjB;IAED,qFAAqF;IAC/E,aAAa,CAClB,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,CAAC,EAAE,OAAO,GACxB,OAAO,CAAC,wBAAwB,CAAC,CAKnC;IAED;;;OAGG;IACG,IAAI,CACT,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,eAAe,EAAE,GACxB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAclC;IAED;;;OAGG;IACG,OAAO,CACZ,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,MAAM,EACxB,aAAa,EAAE,MAAM,GACnB,OAAO,CAAC,OAAO,EAAE,CAAC,CAapB;YAEa,qBAAqB;CAcnC"}
1
+ {"version":3,"file":"signer-documents.d.ts","sourceRoot":"","sources":["../../../../src/api/resources/signer-documents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,oBAAoB,EACpB,4BAA4B,EAC5B,yBAAyB,EACzB,wBAAwB,EAExB,qBAAqB,EACrB,YAAY,EACZ,OAAO,EACP,yBAAyB,EACzB,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,wBAAwB,EACxB,MAAM,aAAa,CAAC;AAQrB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,YAAY;IACxD,+DAA+D;IACzD,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAM9F;IAED;;;;OAIG;IACG,IAAI,CACT,QAAQ,EAAE,MAAM,EAChB,gBAAgB,CAAC,EAAE,MAAM,EACzB,MAAM,GAAE,yBAA8B,GACpC,OAAO,CAAC,qBAAqB,CAAC,CAMhC;IAED,+FAA+F;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 -824,26 +824,21 @@ export interface IPublicDocumentInfo {
824
824
  page_count?: string | number;
825
825
  created_by?: string;
826
826
  }
827
- /** Channel accepted by the `send-token` endpoint. */
828
- export type SendTokenChannel = 'email' | 'whatsapp' | (string & {});
829
- /**
830
- * Response from `PUT /public/documents/{id}/send-token`.
831
- *
832
- * The published body is `{ email }`; the live legacy form may echo the
833
- * alternate `recipient` + `channel` fields that the SDK also supports.
834
- */
827
+ /** Channel accepted by the `send-token` endpoint. Only `email` is supported. */
828
+ export type SendTokenChannel = 'email';
829
+ /** `data` of `PUT /public/documents/{id}/send-token`. */
835
830
  export interface ISendTokenResponse {
836
- /** Present for the published `{ email }` request form. */
837
- status?: number;
838
- /** Present for the published `{ email }` request form. */
839
- message?: string;
840
- /** Present for the live-compatible `{ recipient, channel }` request form. */
841
- document?: IPublicDocumentInfo;
842
- /** Present for the live-compatible `{ recipient, channel }` request form. */
843
- channel?: SendTokenChannel;
844
- /** Present for the live-compatible `{ recipient, channel }` request form. */
845
- recipient?: string;
846
- [key: string]: unknown;
831
+ /** Compact document; sandbox returns `page_count` as a numeric string. */
832
+ document: {
833
+ resource: 'document';
834
+ id: string;
835
+ name: string;
836
+ page_count: number | string;
837
+ created_by: string;
838
+ };
839
+ channel: SendTokenChannel;
840
+ /** The signer email the token was sent to. */
841
+ recipient: string;
847
842
  }
848
843
  /** Authentication: login response (also returned by social login). */
849
844
  export interface IAuthUser {
@@ -954,7 +949,8 @@ export interface IFieldDefinition {
954
949
  export interface ICreateFieldPayload {
955
950
  type: string;
956
951
  name: string;
957
- regex?: string;
952
+ /** Validation regex; `null` or omitted for none. */
953
+ regex?: string | null;
958
954
  is_required?: boolean;
959
955
  /** Compatibility extension; not present in the published create schema. */
960
956
  is_active?: boolean;
@@ -1099,6 +1095,15 @@ export type IOAuthTokenPayload = {
1099
1095
  } | {
1100
1096
  grant_type: 'refresh_token';
1101
1097
  refresh_token: string;
1098
+ } | {
1099
+ /** RFC 8693; Assinafy internal-service confidential clients only (others get `invalid_client`). */
1100
+ grant_type: 'urn:ietf:params:oauth:grant-type:token-exchange';
1101
+ client_secret: string;
1102
+ /** Required for this grant: this API's own resource identifier. */
1103
+ resource: string;
1104
+ subject_token: string;
1105
+ subject_token_type: 'urn:ietf:params:oauth:token-type:access_token';
1106
+ requested_token_type?: 'urn:ietf:params:oauth:token-type:access_token';
1102
1107
  });
1103
1108
  /** Flat OAuth response. Persist rotated tokens atomically before making further requests. */
1104
1109
  export interface IOAuthTokenResponse {