@assinafy/cli 2.6.1 → 2.7.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/CONTRIBUTING.md +1 -1
- package/README.en.md +50 -20
- package/README.md +38 -10
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/api.cjs +214 -33
- package/dist/api.cjs.map +1 -1
- package/dist/api.js +213 -33
- package/dist/api.js.map +1 -1
- package/dist/cli.cjs +344 -67
- package/dist/types/api/client.d.ts +2 -0
- package/dist/types/api/client.d.ts.map +1 -1
- package/dist/types/api/contract-types.d.ts +110 -0
- package/dist/types/api/contract-types.d.ts.map +1 -0
- package/dist/types/api/index.d.ts +2 -0
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/resources/assignments.d.ts +2 -2
- package/dist/types/api/resources/assignments.d.ts.map +1 -1
- package/dist/types/api/resources/authentication.d.ts +3 -3
- package/dist/types/api/resources/authentication.d.ts.map +1 -1
- package/dist/types/api/resources/contracts.d.ts +19 -0
- package/dist/types/api/resources/contracts.d.ts.map +1 -0
- package/dist/types/api/resources/documents.d.ts +3 -3
- package/dist/types/api/resources/documents.d.ts.map +1 -1
- package/dist/types/api/resources/webhooks.d.ts +4 -3
- package/dist/types/api/resources/webhooks.d.ts.map +1 -1
- package/dist/types/api/types.d.ts +69 -18
- package/dist/types/api/types.d.ts.map +1 -1
- package/dist/types/api/utils.d.ts +3 -1
- package/dist/types/api/utils.d.ts.map +1 -1
- package/docs/README.md +2 -1
- package/docs/api-operations.json +49 -1
- package/docs/api-reference.md +1446 -295
- package/docs/contracts.md +128 -0
- package/docs/documents.md +7 -4
- package/docs/oauth-guide.md +5 -5
- package/docs/sdk-reference.md +154 -13
- package/package.json +2 -2
package/dist/cli.cjs
CHANGED
|
@@ -11747,8 +11747,14 @@ var require_follow_redirects = __commonJS({
|
|
|
11747
11747
|
RedirectableRequest.prototype._sanitizeOptions = function(options) {
|
|
11748
11748
|
if (!options.headers) {
|
|
11749
11749
|
options.headers = {};
|
|
11750
|
+
} else if (Array.isArray(options.headers)) {
|
|
11751
|
+
var headerList = options.headers;
|
|
11752
|
+
options.headers = {};
|
|
11753
|
+
for (var i2 = 0; i2 < headerList.length; i2 += 2) {
|
|
11754
|
+
options.headers[headerList[i2]] = headerList[i2 + 1];
|
|
11755
|
+
}
|
|
11750
11756
|
}
|
|
11751
|
-
if (!
|
|
11757
|
+
if (!Array.isArray(options.sensitiveHeaders)) {
|
|
11752
11758
|
options.sensitiveHeaders = [];
|
|
11753
11759
|
}
|
|
11754
11760
|
if (options.host) {
|
|
@@ -12005,9 +12011,6 @@ var require_follow_redirects = __commonJS({
|
|
|
12005
12011
|
var dot = subdomain.length - domain.length - 1;
|
|
12006
12012
|
return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
|
|
12007
12013
|
}
|
|
12008
|
-
function isArray2(value) {
|
|
12009
|
-
return value instanceof Array;
|
|
12010
|
-
}
|
|
12011
12014
|
function isString2(value) {
|
|
12012
12015
|
return typeof value === "string" || value instanceof String;
|
|
12013
12016
|
}
|
|
@@ -12021,7 +12024,7 @@ var require_follow_redirects = __commonJS({
|
|
|
12021
12024
|
return URL2 && value instanceof URL2;
|
|
12022
12025
|
}
|
|
12023
12026
|
function escapeRegex(regex) {
|
|
12024
|
-
return regex.replace(/[\]\\/()
|
|
12027
|
+
return regex.replace(/[[\]\\/()*+?.^$|]/g, "\\$&");
|
|
12025
12028
|
}
|
|
12026
12029
|
module2.exports = wrap({ http: http3, https: https2 });
|
|
12027
12030
|
module2.exports.wrap = wrap;
|
|
@@ -21267,6 +21270,11 @@ function requireIso8601(value, name = "timestamp") {
|
|
|
21267
21270
|
}
|
|
21268
21271
|
return value;
|
|
21269
21272
|
}
|
|
21273
|
+
function requireExpiration(value, name = "expires_at") {
|
|
21274
|
+
const timestamp = /^\d{4}-\d{2}-\d{2}$/.test(value) ? `${value}T23:59:00Z` : /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?$/.test(value) ? `${value}Z` : value;
|
|
21275
|
+
requireIso8601(timestamp, name);
|
|
21276
|
+
return value;
|
|
21277
|
+
}
|
|
21270
21278
|
function requireEmail(value) {
|
|
21271
21279
|
if (!value || !EMAIL_RE.test(value)) {
|
|
21272
21280
|
throw new ValidationError("Invalid email address", { email: value });
|
|
@@ -21496,7 +21504,7 @@ function buildAssignmentPayload(payload, options = {}) {
|
|
|
21496
21504
|
method,
|
|
21497
21505
|
signers: normalisedSigners,
|
|
21498
21506
|
message: payload.message,
|
|
21499
|
-
expires_at: payload.expires_at === void 0 ? void 0 :
|
|
21507
|
+
expires_at: payload.expires_at === void 0 ? void 0 : requireExpiration(payload.expires_at),
|
|
21500
21508
|
copy_receivers: payload.copy_receivers,
|
|
21501
21509
|
entries: payload.entries
|
|
21502
21510
|
});
|
|
@@ -21634,13 +21642,13 @@ var AssignmentResource = class extends BaseResource {
|
|
|
21634
21642
|
}
|
|
21635
21643
|
/**
|
|
21636
21644
|
* Update the expiration date of an existing assignment.
|
|
21637
|
-
*
|
|
21638
|
-
*
|
|
21645
|
+
* Accepts an ISO 8601 timestamp, a UTC date/time without an offset, a date
|
|
21646
|
+
* (23:59 UTC), or `null` to clear the expiration.
|
|
21639
21647
|
*/
|
|
21640
21648
|
async resetExpiration(documentId, assignmentId, expiresAt) {
|
|
21641
21649
|
const docId = this.requireId(documentId, "Document ID");
|
|
21642
21650
|
const asgId = this.requireId(assignmentId, "Assignment ID");
|
|
21643
|
-
if (expiresAt !== null)
|
|
21651
|
+
if (expiresAt !== null) requireExpiration(expiresAt, "expiresAt");
|
|
21644
21652
|
return this.call(
|
|
21645
21653
|
"Failed to update assignment expiration",
|
|
21646
21654
|
() => this.http.put(`/documents/${docId}/assignments/${asgId}/reset-expiration`, {
|
|
@@ -21692,7 +21700,7 @@ function requireReauth(payload) {
|
|
|
21692
21700
|
return payload;
|
|
21693
21701
|
}
|
|
21694
21702
|
var AuthenticationResource = class extends BaseResource {
|
|
21695
|
-
/** `POST /login` —
|
|
21703
|
+
/** `POST /login` — return an authenticated session or a two-factor challenge. */
|
|
21696
21704
|
async login(email, password2) {
|
|
21697
21705
|
if (!email) throw new ValidationError("email is required");
|
|
21698
21706
|
if (!password2) throw new ValidationError("password is required");
|
|
@@ -21835,6 +21843,156 @@ var AuthenticationResource = class extends BaseResource {
|
|
|
21835
21843
|
}
|
|
21836
21844
|
};
|
|
21837
21845
|
|
|
21846
|
+
// src/api/resources/contracts.ts
|
|
21847
|
+
var statuses = ["draft", "active", "expired", "terminated"];
|
|
21848
|
+
var ContractResource = class extends BaseResource {
|
|
21849
|
+
/** List terms, optionally embedding documents; supports pagination and comma-separated statuses. */
|
|
21850
|
+
async list(params = {}, accountId) {
|
|
21851
|
+
const id = this.accountId(accountId);
|
|
21852
|
+
const status = Array.isArray(params.status) ? params.status.join(",") : params.status;
|
|
21853
|
+
if (status !== void 0 && (typeof status !== "string" || status.split(",").some((s) => !statuses.includes(s)))) {
|
|
21854
|
+
throw new ValidationError("status must contain draft, active, expired or terminated");
|
|
21855
|
+
}
|
|
21856
|
+
for (const field of ["end_date_from", "end_date_to"]) {
|
|
21857
|
+
if (params[field] !== void 0) requireDate(params[field], field, 0);
|
|
21858
|
+
}
|
|
21859
|
+
if (params.ending_within_days !== void 0)
|
|
21860
|
+
requireInteger(params.ending_within_days, "ending_within_days", 0, 3650);
|
|
21861
|
+
requireSort(params.sort, ["end_date", "-end_date", "updated_at", "-updated_at"]);
|
|
21862
|
+
if (params.expand !== void 0 && params.expand !== "document")
|
|
21863
|
+
throw new ValidationError("expand must be document");
|
|
21864
|
+
return this.callList(
|
|
21865
|
+
"Failed to list contracts",
|
|
21866
|
+
() => this.http.get(`/accounts/${id}/contracts`, { params: cleanParams({ ...params, status }) })
|
|
21867
|
+
);
|
|
21868
|
+
}
|
|
21869
|
+
/** Read a document's own terms or its amendment link. Missing terms return ApiError 404. */
|
|
21870
|
+
async get(documentId, accountId) {
|
|
21871
|
+
const id = this.accountId(accountId);
|
|
21872
|
+
const did = this.requireId(documentId, "Document ID");
|
|
21873
|
+
return this.call(
|
|
21874
|
+
"Failed to get contract",
|
|
21875
|
+
() => this.http.get(`/accounts/${id}/documents/${did}/contract`)
|
|
21876
|
+
);
|
|
21877
|
+
}
|
|
21878
|
+
/** Set only supplied terms, or link/update/unlink a pending amendment. Preserve null clearing. */
|
|
21879
|
+
async set(documentId, payload, accountId) {
|
|
21880
|
+
const id = this.accountId(accountId);
|
|
21881
|
+
const did = this.requireId(documentId, "Document ID");
|
|
21882
|
+
requireBody(payload, true);
|
|
21883
|
+
validateTerms(payload);
|
|
21884
|
+
return this.call(
|
|
21885
|
+
"Failed to set contract terms",
|
|
21886
|
+
() => this.http.put(`/accounts/${id}/documents/${did}/contract`, payload)
|
|
21887
|
+
);
|
|
21888
|
+
}
|
|
21889
|
+
/** Read the root contract and its amendments from any document in that family. */
|
|
21890
|
+
async related(documentId, accountId) {
|
|
21891
|
+
const id = this.accountId(accountId);
|
|
21892
|
+
const did = this.requireId(documentId, "Document ID");
|
|
21893
|
+
return this.call(
|
|
21894
|
+
"Failed to get related contracts",
|
|
21895
|
+
() => this.http.get(`/accounts/${id}/documents/${did}/contract/related`)
|
|
21896
|
+
);
|
|
21897
|
+
}
|
|
21898
|
+
/** Advance from the supplied current term or to a later end date. No automatic retry. */
|
|
21899
|
+
async renew(documentId, payload, accountId) {
|
|
21900
|
+
const id = this.accountId(accountId);
|
|
21901
|
+
const did = this.requireId(documentId, "Document ID");
|
|
21902
|
+
requireBody(payload, true);
|
|
21903
|
+
if (payload.term === void 0 && !payload.end_date)
|
|
21904
|
+
throw new ValidationError("Renewal requires term or end_date");
|
|
21905
|
+
if (payload.term !== void 0)
|
|
21906
|
+
requireInteger(payload.term, "term", 1, Number.MAX_SAFE_INTEGER);
|
|
21907
|
+
validateTerms({ ...payload, end_date: payload.end_date === "" ? null : payload.end_date });
|
|
21908
|
+
return this.call(
|
|
21909
|
+
"Failed to renew contract",
|
|
21910
|
+
() => this.http.post(`/accounts/${id}/documents/${did}/contract/renew`, payload)
|
|
21911
|
+
);
|
|
21912
|
+
}
|
|
21913
|
+
/** Terminate existing terms; an optional reason is recorded in document activities. */
|
|
21914
|
+
async terminate(documentId, payload = {}, accountId) {
|
|
21915
|
+
const id = this.accountId(accountId);
|
|
21916
|
+
const did = this.requireId(documentId, "Document ID");
|
|
21917
|
+
requireBody(payload);
|
|
21918
|
+
if (payload.reason != null && (typeof payload.reason !== "string" || [...payload.reason].length > 500))
|
|
21919
|
+
throw new ValidationError("reason must be text of at most 500 characters");
|
|
21920
|
+
if (payload.updated_at != null) requireIso8601(payload.updated_at, "updated_at");
|
|
21921
|
+
return this.call(
|
|
21922
|
+
"Failed to terminate contract",
|
|
21923
|
+
() => this.http.post(`/accounts/${id}/documents/${did}/contract/terminate`, payload)
|
|
21924
|
+
);
|
|
21925
|
+
}
|
|
21926
|
+
};
|
|
21927
|
+
function requireBody(value, nonempty = false) {
|
|
21928
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) {
|
|
21929
|
+
throw new ValidationError("Contract body must be a JSON object");
|
|
21930
|
+
}
|
|
21931
|
+
if (nonempty && !Object.values(value).some((v) => v !== void 0))
|
|
21932
|
+
throw new ValidationError("At least one contract attribute is required");
|
|
21933
|
+
}
|
|
21934
|
+
function requireDate(value, field, minYear = 1e3) {
|
|
21935
|
+
if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}$/.test(value) || Number(value.slice(0, 4)) < minYear)
|
|
21936
|
+
throw new ValidationError(`${field} must be a YYYY-MM-DD date from year ${minYear}`);
|
|
21937
|
+
requireIso8601(`${value}T00:00:00Z`, field);
|
|
21938
|
+
}
|
|
21939
|
+
function requireInteger(value, field, min, max) {
|
|
21940
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < min || value > max)
|
|
21941
|
+
throw new ValidationError(`${field} must be an integer from ${min} to ${max}`);
|
|
21942
|
+
}
|
|
21943
|
+
function validateTerms(payload) {
|
|
21944
|
+
for (const field of ["start_date", "end_date"])
|
|
21945
|
+
if (payload[field] != null) requireDate(payload[field], field);
|
|
21946
|
+
if (payload.start_date && payload.end_date && payload.end_date < payload.start_date)
|
|
21947
|
+
throw new ValidationError("end_date must not precede start_date");
|
|
21948
|
+
if (payload.updated_at != null) requireIso8601(payload.updated_at, "updated_at");
|
|
21949
|
+
if (payload.status !== void 0 && !statuses.includes(payload.status))
|
|
21950
|
+
throw new ValidationError("Invalid contract status");
|
|
21951
|
+
if (payload.relation_type !== void 0 && !["amendment", "renewal", "termination"].includes(payload.relation_type))
|
|
21952
|
+
throw new ValidationError("Invalid relation_type");
|
|
21953
|
+
if (payload.auto_renew != null && typeof payload.auto_renew !== "boolean")
|
|
21954
|
+
throw new ValidationError("auto_renew must be boolean or null");
|
|
21955
|
+
if (payload.renewal_term_months != null)
|
|
21956
|
+
requireInteger(payload.renewal_term_months, "renewal_term_months", 1, 600);
|
|
21957
|
+
if (payload.notice_period_days != null)
|
|
21958
|
+
requireInteger(payload.notice_period_days, "notice_period_days", 0, 3650);
|
|
21959
|
+
if (payload.value != null && (typeof payload.value !== "number" || !Number.isFinite(payload.value) || payload.value < 0 || payload.value > 999999999999999e-2 || Number(payload.value.toFixed(2)) !== payload.value))
|
|
21960
|
+
throw new ValidationError(
|
|
21961
|
+
"value must be from 0 to 9999999999999.99 with at most two decimal places"
|
|
21962
|
+
);
|
|
21963
|
+
for (const [field, max] of [
|
|
21964
|
+
["counterparty_name", 255],
|
|
21965
|
+
["counterparty_taxpayer_id", 20],
|
|
21966
|
+
["owner_id", Infinity],
|
|
21967
|
+
["parent_document_id", Infinity]
|
|
21968
|
+
]) {
|
|
21969
|
+
const value = payload[field];
|
|
21970
|
+
if (value != null && (typeof value !== "string" || [...value].length > max))
|
|
21971
|
+
throw new ValidationError(`${field} must be text of at most ${max} characters`);
|
|
21972
|
+
}
|
|
21973
|
+
if (payload.currency != null && (typeof payload.currency !== "string" || !/^[a-z]{3}$/i.test(payload.currency)))
|
|
21974
|
+
throw new ValidationError("currency must be a three-letter code");
|
|
21975
|
+
if (payload.metadata != null) {
|
|
21976
|
+
requireBody(payload.metadata);
|
|
21977
|
+
const entries = Object.entries(payload.metadata);
|
|
21978
|
+
if (entries.length > 50 || entries.some(
|
|
21979
|
+
([key, value]) => !/^[a-z\d_.-]{1,40}$/i.test(key) || typeof value !== "string" || [...value].length > 500
|
|
21980
|
+
))
|
|
21981
|
+
throw new ValidationError(
|
|
21982
|
+
"metadata requires at most 50 valid keys with text values of at most 500 characters"
|
|
21983
|
+
);
|
|
21984
|
+
}
|
|
21985
|
+
if (payload.external_references != null) {
|
|
21986
|
+
if (!Array.isArray(payload.external_references) || payload.external_references.length > 20)
|
|
21987
|
+
throw new ValidationError("external_references must be a list of at most 20 items");
|
|
21988
|
+
for (const reference of payload.external_references) {
|
|
21989
|
+
requireBody(reference);
|
|
21990
|
+
if (typeof reference.system !== "string" || !/^[a-z\d_.-]{1,64}$/i.test(reference.system) || typeof reference.id !== "string" || !reference.id || [...reference.id].length > 255 || /[\u{10000}-\u{10ffff}]/u.test(reference.id))
|
|
21991
|
+
throw new ValidationError("Each external reference requires a valid system and id");
|
|
21992
|
+
}
|
|
21993
|
+
}
|
|
21994
|
+
}
|
|
21995
|
+
|
|
21838
21996
|
// src/api/resources/documents.ts
|
|
21839
21997
|
var import_node_fs2 = require("fs");
|
|
21840
21998
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
@@ -21930,7 +22088,7 @@ var DocumentResource = class extends BaseResource {
|
|
|
21930
22088
|
if (!name?.trim()) throw new ValidationError("name is required");
|
|
21931
22089
|
return this.call(
|
|
21932
22090
|
"Failed to rename document",
|
|
21933
|
-
() => this.http.patch(`/documents/${id}`, { name })
|
|
22091
|
+
() => this.http.patch(`/documents/${id}`, { name }, { params: { expand: "assignment" } })
|
|
21934
22092
|
);
|
|
21935
22093
|
}
|
|
21936
22094
|
/** Alias for {@link details}. */
|
|
@@ -22018,12 +22176,13 @@ var DocumentResource = class extends BaseResource {
|
|
|
22018
22176
|
})
|
|
22019
22177
|
);
|
|
22020
22178
|
}
|
|
22021
|
-
/** Fetch the document activity log. */
|
|
22022
|
-
async activities(documentId) {
|
|
22179
|
+
/** Fetch one page of the document activity log (20 entries by default). */
|
|
22180
|
+
async activities(documentId, params = {}) {
|
|
22023
22181
|
const id = this.requireId(documentId, "Document ID");
|
|
22182
|
+
requireSort(params.sort, ["id", "-id"]);
|
|
22024
22183
|
const result = await this.call(
|
|
22025
22184
|
"Failed to fetch document activities",
|
|
22026
|
-
() => this.http.get(`/documents/${id}/activities
|
|
22185
|
+
() => this.http.get(`/documents/${id}/activities`, { params: cleanParams({ ...params }) })
|
|
22027
22186
|
);
|
|
22028
22187
|
return result ?? [];
|
|
22029
22188
|
}
|
|
@@ -22089,8 +22248,8 @@ var DocumentResource = class extends BaseResource {
|
|
|
22089
22248
|
async createFromTemplate(templateId, signers, options = {}, accountId) {
|
|
22090
22249
|
const tmplId = this.requireId(templateId, "Template ID");
|
|
22091
22250
|
const accId = this.accountId(accountId);
|
|
22092
|
-
validateTemplateSigners(signers, {
|
|
22093
|
-
if (options.expires_at !== void 0)
|
|
22251
|
+
validateTemplateSigners(signers, { requireIdentity: true });
|
|
22252
|
+
if (options.expires_at !== void 0) requireExpiration(options.expires_at);
|
|
22094
22253
|
if (options.editor_fields !== void 0 && (!Array.isArray(options.editor_fields) || options.editor_fields.some((field) => !field?.field_id || typeof field.value !== "string"))) {
|
|
22095
22254
|
throw new ValidationError("editor_fields must contain field_id and value");
|
|
22096
22255
|
}
|
|
@@ -22109,7 +22268,7 @@ var DocumentResource = class extends BaseResource {
|
|
|
22109
22268
|
async estimateCostFromTemplate(templateId, signers, accountId) {
|
|
22110
22269
|
const tmplId = this.requireId(templateId, "Template ID");
|
|
22111
22270
|
const accId = this.accountId(accountId);
|
|
22112
|
-
validateTemplateSigners(signers, {
|
|
22271
|
+
validateTemplateSigners(signers, { requireIdentity: false });
|
|
22113
22272
|
await this.validateCertificateTemplateMethod(tmplId, accId, signers);
|
|
22114
22273
|
return this.call(
|
|
22115
22274
|
"Failed to estimate cost from template",
|
|
@@ -22195,8 +22354,18 @@ var DocumentResource = class extends BaseResource {
|
|
|
22195
22354
|
"Failed to fetch template",
|
|
22196
22355
|
() => this.http.get(`/accounts/${accountId}/templates/${templateId}`)
|
|
22197
22356
|
);
|
|
22198
|
-
const
|
|
22199
|
-
|
|
22357
|
+
const nonSignerRoles = new Set(
|
|
22358
|
+
template.roles?.filter(
|
|
22359
|
+
(role) => role.assignment_type === "Editor" || role.assignment_type === "CopyReceiver"
|
|
22360
|
+
).map((role) => role.id)
|
|
22361
|
+
);
|
|
22362
|
+
const method = template.pages?.some(
|
|
22363
|
+
(page) => page.fields.some((field) => !nonSignerRoles.has(field.role_id))
|
|
22364
|
+
) ? "collect" : "virtual";
|
|
22365
|
+
validateDigitalCertificateMethod(
|
|
22366
|
+
method,
|
|
22367
|
+
signers.filter((signer) => !nonSignerRoles.has(signer.role_id))
|
|
22368
|
+
);
|
|
22200
22369
|
}
|
|
22201
22370
|
};
|
|
22202
22371
|
function validateTemplateSigners(signers, options) {
|
|
@@ -22209,17 +22378,20 @@ function validateTemplateSigners(signers, options) {
|
|
|
22209
22378
|
if (typeof signer.role_id !== "string" || !signer.role_id) {
|
|
22210
22379
|
throw new ValidationError("each template signer requires role_id");
|
|
22211
22380
|
}
|
|
22212
|
-
if (
|
|
22213
|
-
|
|
22214
|
-
|
|
22215
|
-
|
|
22216
|
-
if (options.
|
|
22217
|
-
|
|
22381
|
+
if (signer.id !== void 0) {
|
|
22382
|
+
if (typeof signer.id !== "string" || !signer.id) {
|
|
22383
|
+
throw new ValidationError("each template signer requires a valid id");
|
|
22384
|
+
}
|
|
22385
|
+
} else if (options.requireIdentity) {
|
|
22386
|
+
if (typeof signer.email !== "string") {
|
|
22387
|
+
throw new ValidationError("each template signer requires an id or email");
|
|
22388
|
+
}
|
|
22389
|
+
requireEmail(signer.email);
|
|
22390
|
+
if (signer.name !== void 0 && (typeof signer.name !== "string" || !signer.name.trim())) {
|
|
22391
|
+
throw new ValidationError("template signer name cannot be blank");
|
|
22392
|
+
}
|
|
22218
22393
|
}
|
|
22219
22394
|
}
|
|
22220
|
-
if (options.requireId) {
|
|
22221
|
-
validateSigningSteps(signers);
|
|
22222
|
-
}
|
|
22223
22395
|
}
|
|
22224
22396
|
async function loadSource(source) {
|
|
22225
22397
|
if ("buffer" in source) {
|
|
@@ -23140,7 +23312,11 @@ var NOTIFICATION_PREFERENCE_CODES = [
|
|
|
23140
23312
|
"DocumentExpirationReset",
|
|
23141
23313
|
"DocumentProcessingFailed",
|
|
23142
23314
|
"TemplateProcessingFailed",
|
|
23143
|
-
"SignerWhatsappFailed"
|
|
23315
|
+
"SignerWhatsappFailed",
|
|
23316
|
+
"ContractRenewalNotice",
|
|
23317
|
+
"ContractExpiring",
|
|
23318
|
+
"ContractExpired",
|
|
23319
|
+
"ContractRenewed"
|
|
23144
23320
|
];
|
|
23145
23321
|
|
|
23146
23322
|
// src/api/resources/users.ts
|
|
@@ -23302,6 +23478,7 @@ var WebhookResource = class extends BaseResource {
|
|
|
23302
23478
|
* `PUT /accounts/{accountId}/webhooks/endpoints/{endpointId}` — update only
|
|
23303
23479
|
* the fields sent. Enabling signing creates a secret when none exists;
|
|
23304
23480
|
* disabling it discards the secret.
|
|
23481
|
+
* Enabling signing returns the new secret once, including to OAuth applications.
|
|
23305
23482
|
*/
|
|
23306
23483
|
async updateEndpoint(endpointId, payload, accountId) {
|
|
23307
23484
|
const id = this.accountId(accountId);
|
|
@@ -23348,7 +23525,7 @@ var WebhookResource = class extends BaseResource {
|
|
|
23348
23525
|
}
|
|
23349
23526
|
/**
|
|
23350
23527
|
* `POST …/endpoints/{endpointId}/secret/rotate` — replace the signing secret.
|
|
23351
|
-
* The old secret stops working immediately.
|
|
23528
|
+
* The old secret stops working immediately. Requires `webhooks:write` for OAuth.
|
|
23352
23529
|
*/
|
|
23353
23530
|
async rotateEndpointSecret(endpointId, accountId) {
|
|
23354
23531
|
const id = this.accountId(accountId);
|
|
@@ -23600,6 +23777,7 @@ var AssinafyClient = class _AssinafyClient {
|
|
|
23600
23777
|
logger;
|
|
23601
23778
|
webhookSecret;
|
|
23602
23779
|
documents;
|
|
23780
|
+
contracts;
|
|
23603
23781
|
signers;
|
|
23604
23782
|
workspaces;
|
|
23605
23783
|
assignments;
|
|
@@ -23666,6 +23844,7 @@ var AssinafyClient = class _AssinafyClient {
|
|
|
23666
23844
|
maxRedirects: 0
|
|
23667
23845
|
});
|
|
23668
23846
|
this.documents = new DocumentResource(this.axiosInstance, this.defaultAccountId, this.logger);
|
|
23847
|
+
this.contracts = new ContractResource(this.axiosInstance, this.defaultAccountId, this.logger);
|
|
23669
23848
|
this.signers = new SignerResource(this.axiosInstance, this.defaultAccountId, this.logger);
|
|
23670
23849
|
this.workspaces = new WorkspaceResource(this.axiosInstance, void 0, this.logger);
|
|
23671
23850
|
this.assignments = new AssignmentResource(
|
|
@@ -23723,12 +23902,11 @@ var AssinafyClient = class _AssinafyClient {
|
|
|
23723
23902
|
if (!Array.isArray(options.signers) || options.signers.length === 0) {
|
|
23724
23903
|
throw new ValidationError("At least one signer is required");
|
|
23725
23904
|
}
|
|
23726
|
-
if (options.expiresAt !== void 0)
|
|
23905
|
+
if (options.expiresAt !== void 0) requireExpiration(options.expiresAt, "expiresAt");
|
|
23727
23906
|
const preparedSigners = options.signers.map((signer) => {
|
|
23728
23907
|
if (!signer || typeof signer !== "object") {
|
|
23729
23908
|
throw new ValidationError("Each signer must be an object");
|
|
23730
23909
|
}
|
|
23731
|
-
validateSignerOptions(signer);
|
|
23732
23910
|
const payload = { full_name: signer.name };
|
|
23733
23911
|
if (signer.email !== void 0) payload.email = signer.email;
|
|
23734
23912
|
const phone = signer.whatsapp_phone_number ?? signer.phone;
|
|
@@ -23737,7 +23915,14 @@ var AssinafyClient = class _AssinafyClient {
|
|
|
23737
23915
|
if (signer.government_id !== void 0) payload.government_id = signer.government_id;
|
|
23738
23916
|
if (signer.metadata !== void 0) payload.metadata = signer.metadata;
|
|
23739
23917
|
validateCreateSignerPayload(payload);
|
|
23740
|
-
|
|
23918
|
+
const useWhatsapp = phone !== void 0 && signer.email === void 0;
|
|
23919
|
+
const reference = {
|
|
23920
|
+
verification_method: signer.verification_method ?? (useWhatsapp ? "Whatsapp" : void 0),
|
|
23921
|
+
notification_methods: signer.notification_methods ?? (useWhatsapp ? ["Whatsapp"] : void 0),
|
|
23922
|
+
step: signer.step
|
|
23923
|
+
};
|
|
23924
|
+
validateSignerOptions(reference);
|
|
23925
|
+
return { reference, payload };
|
|
23741
23926
|
});
|
|
23742
23927
|
validateSigningSteps(options.signers);
|
|
23743
23928
|
this.logger.info("Starting upload + signature workflow", {
|
|
@@ -23753,15 +23938,12 @@ var AssinafyClient = class _AssinafyClient {
|
|
|
23753
23938
|
await this.documents.waitUntilReady(document2.id);
|
|
23754
23939
|
}
|
|
23755
23940
|
const assignmentSigners = [];
|
|
23756
|
-
for (const {
|
|
23941
|
+
for (const { reference, payload } of preparedSigners) {
|
|
23757
23942
|
const created = await this.signers.create(payload, options.accountId);
|
|
23758
23943
|
signerIds.push(created.id);
|
|
23759
|
-
const useWhatsapp = phone !== void 0 && signer.email === void 0;
|
|
23760
23944
|
assignmentSigners.push({
|
|
23761
23945
|
id: created.id,
|
|
23762
|
-
|
|
23763
|
-
notification_methods: signer.notification_methods ?? (useWhatsapp ? ["Whatsapp"] : void 0),
|
|
23764
|
-
step: signer.step
|
|
23946
|
+
...reference
|
|
23765
23947
|
});
|
|
23766
23948
|
}
|
|
23767
23949
|
const assignmentPayload = {
|
|
@@ -24983,7 +25165,18 @@ function readBinary(inputPath) {
|
|
|
24983
25165
|
function writeBinary(outputPath, data, options = {}) {
|
|
24984
25166
|
const resolved = import_node_path4.default.resolve(outputPath);
|
|
24985
25167
|
try {
|
|
24986
|
-
(0, import_node_fs4.
|
|
25168
|
+
const descriptor = (0, import_node_fs4.openSync)(
|
|
25169
|
+
resolved,
|
|
25170
|
+
options.force ? import_node_fs4.constants.O_WRONLY | import_node_fs4.constants.O_CREAT : "wx",
|
|
25171
|
+
384
|
|
25172
|
+
);
|
|
25173
|
+
try {
|
|
25174
|
+
if (process.platform !== "win32") (0, import_node_fs4.fchmodSync)(descriptor, 384);
|
|
25175
|
+
if (options.force) (0, import_node_fs4.ftruncateSync)(descriptor, 0);
|
|
25176
|
+
(0, import_node_fs4.writeFileSync)(descriptor, data);
|
|
25177
|
+
} finally {
|
|
25178
|
+
(0, import_node_fs4.closeSync)(descriptor);
|
|
25179
|
+
}
|
|
24987
25180
|
} catch (err) {
|
|
24988
25181
|
if (err && typeof err === "object" && "code" in err && err.code === "EEXIST") {
|
|
24989
25182
|
throw new CliError(`File "${resolved}" already exists. Pass --force to overwrite it.`);
|
|
@@ -25625,6 +25818,7 @@ var loginCommand = new Command("login").description(
|
|
|
25625
25818
|
() => client.auth.verifyMfa({ mfa_token: mfaToken, code })
|
|
25626
25819
|
);
|
|
25627
25820
|
}
|
|
25821
|
+
if (!result.access_token) throw new CliError("Login did not return an access token.");
|
|
25628
25822
|
printSession(result, config);
|
|
25629
25823
|
});
|
|
25630
25824
|
});
|
|
@@ -25990,6 +26184,86 @@ var pathCommand = new Command("path").description("Print the config file path").
|
|
|
25990
26184
|
});
|
|
25991
26185
|
var configCommand = new Command("config").description("Manage credentials, profiles, and settings").addCommand(setCommand).addCommand(getCommand).addCommand(listCommand2).addCommand(useCommand).addCommand(removeCommand).addCommand(pathCommand);
|
|
25992
26186
|
|
|
26187
|
+
// src/commands/contracts.ts
|
|
26188
|
+
var listCommand3 = addListOptions(
|
|
26189
|
+
new Command("list").description("List workspace contract terms"),
|
|
26190
|
+
"end_date or updated_at; prefix with - for descending"
|
|
26191
|
+
).option("--status <csv>", "draft, active, expired, terminated (comma-separated)").option("--counterparty <query>", "Counterparty name or exact CPF/CNPJ").option("--end-date-from <date>", "Earliest end date (YYYY-MM-DD)").option("--end-date-to <date>", "Latest end date (YYYY-MM-DD)").option("--ending-within-days <n>", "Ends within 0\u20133650 days; 0 includes today in Bras\xEDlia").option("--external-system <system>", "External reference system").option("--external-id <id>", "External reference ID").option("--expand <relation>", "Embed document").action(async (opts, command) => {
|
|
26192
|
+
await runWithClient(command, async ({ client, config }) => {
|
|
26193
|
+
const params = {
|
|
26194
|
+
...listParams(opts),
|
|
26195
|
+
status: opts.status,
|
|
26196
|
+
counterparty: opts.counterparty,
|
|
26197
|
+
end_date_from: opts.endDateFrom,
|
|
26198
|
+
end_date_to: opts.endDateTo,
|
|
26199
|
+
ending_within_days: parseInteger(opts.endingWithinDays, "--ending-within-days", { min: 0 }),
|
|
26200
|
+
external_system: opts.externalSystem,
|
|
26201
|
+
external_id: opts.externalId,
|
|
26202
|
+
expand: opts.expand
|
|
26203
|
+
};
|
|
26204
|
+
const result = await withSpinner(
|
|
26205
|
+
"Fetching contracts",
|
|
26206
|
+
config,
|
|
26207
|
+
() => client.contracts.list(params, requireAccountId(config))
|
|
26208
|
+
);
|
|
26209
|
+
printData(
|
|
26210
|
+
result,
|
|
26211
|
+
config,
|
|
26212
|
+
(page) => tableWithFooter(
|
|
26213
|
+
renderTable(page.data, [
|
|
26214
|
+
{ header: "DOCUMENT", value: (r2) => r2.document_id },
|
|
26215
|
+
{ header: "STATUS", value: (r2) => r2.status },
|
|
26216
|
+
{ header: "COUNTERPARTY", value: (r2) => r2.counterparty_name },
|
|
26217
|
+
{ header: "END DATE", value: (r2) => r2.end_date },
|
|
26218
|
+
{ header: "TERM", value: (r2) => r2.term }
|
|
26219
|
+
]),
|
|
26220
|
+
page
|
|
26221
|
+
)
|
|
26222
|
+
);
|
|
26223
|
+
});
|
|
26224
|
+
});
|
|
26225
|
+
var getCommand2 = new Command("get").description("Read a document\u2019s contract terms or amendment link").argument("<documentId>", "Document ID").action(async (documentId, _opts, command) => {
|
|
26226
|
+
await runWithClient(command, async ({ client, config }) => {
|
|
26227
|
+
printData(await client.contracts.get(documentId, requireAccountId(config)), config);
|
|
26228
|
+
});
|
|
26229
|
+
});
|
|
26230
|
+
var setCommand2 = new Command("set").description("Set terms or link an amendment; null clears, omitted fields stay unchanged").argument("<documentId>", "Document ID").requiredOption(
|
|
26231
|
+
"--data <json>",
|
|
26232
|
+
"JSON terms or amendment link; include updated_at for conflict detection"
|
|
26233
|
+
).action(async (documentId, opts, command) => {
|
|
26234
|
+
await runWithClient(command, async ({ client, config }) => {
|
|
26235
|
+
const payload = parseJsonObject(opts.data, "--data");
|
|
26236
|
+
printData(await client.contracts.set(documentId, payload, requireAccountId(config)), config);
|
|
26237
|
+
});
|
|
26238
|
+
});
|
|
26239
|
+
var relatedCommand = new Command("related").description("Read the root contract and every linked instrument").argument("<documentId>", "Contract or amendment document ID").action(async (documentId, _opts, command) => {
|
|
26240
|
+
await runWithClient(command, async ({ client, config }) => {
|
|
26241
|
+
printData(await client.contracts.related(documentId, requireAccountId(config)), config);
|
|
26242
|
+
});
|
|
26243
|
+
});
|
|
26244
|
+
var renewCommand = new Command("renew").description("Start the next term using the current term or a later end_date").argument("<documentId>", "Document ID").requiredOption("--data <json>", "JSON with term or end_date, optional value and updated_at").option("-y, --yes", "Skip confirmation").action(async (documentId, opts, command) => {
|
|
26245
|
+
await runWithClient(command, async ({ client, config }) => {
|
|
26246
|
+
const payload = parseJsonObject(opts.data, "--data");
|
|
26247
|
+
if (!await confirmDestructive(`Renew contract ${documentId}?`, Boolean(opts.yes))) return;
|
|
26248
|
+
printData(
|
|
26249
|
+
await client.contracts.renew(documentId, payload, requireAccountId(config)),
|
|
26250
|
+
config
|
|
26251
|
+
);
|
|
26252
|
+
});
|
|
26253
|
+
});
|
|
26254
|
+
var terminateCommand = new Command("terminate").description("Terminate tracked terms and stop lifecycle alerts").argument("<documentId>", "Document ID").option("--data <json>", "JSON with optional reason and updated_at").option("-y, --yes", "Skip confirmation").action(async (documentId, opts, command) => {
|
|
26255
|
+
await runWithClient(command, async ({ client, config }) => {
|
|
26256
|
+
const payload = parseJsonObject(opts.data, "--data") ?? {};
|
|
26257
|
+
if (!await confirmDestructive(`Terminate contract ${documentId}?`, Boolean(opts.yes)))
|
|
26258
|
+
return;
|
|
26259
|
+
printData(
|
|
26260
|
+
await client.contracts.terminate(documentId, payload, requireAccountId(config)),
|
|
26261
|
+
config
|
|
26262
|
+
);
|
|
26263
|
+
});
|
|
26264
|
+
});
|
|
26265
|
+
var contractsCommand = new Command("contracts").description("Track contract terms, amendments, renewals and terminations (CLM)").addCommand(listCommand3).addCommand(getCommand2).addCommand(setCommand2).addCommand(relatedCommand).addCommand(renewCommand).addCommand(terminateCommand);
|
|
26266
|
+
|
|
25993
26267
|
// src/lib/oauth-browser.ts
|
|
25994
26268
|
var import_node_child_process2 = require("child_process");
|
|
25995
26269
|
var import_node_crypto4 = require("crypto");
|
|
@@ -26216,7 +26490,7 @@ function renderDocumentListTable(result) {
|
|
|
26216
26490
|
]);
|
|
26217
26491
|
return tableWithFooter(table, result);
|
|
26218
26492
|
}
|
|
26219
|
-
var
|
|
26493
|
+
var listCommand4 = addListOptions(
|
|
26220
26494
|
new Command("list").description("List workspace documents").option("--status <status>", "Filter by document status").addOption(
|
|
26221
26495
|
new Option("--method <method>", "Filter by signature method (virtual or collect)").choices([
|
|
26222
26496
|
"virtual",
|
|
@@ -26254,7 +26528,7 @@ var searchCommand = addListOptions(
|
|
|
26254
26528
|
printPaginatedData(result, config, () => renderDocumentListTable(result));
|
|
26255
26529
|
});
|
|
26256
26530
|
});
|
|
26257
|
-
var
|
|
26531
|
+
var getCommand3 = new Command("get").description("Show details for a document").argument("<id>", "Document ID").action(async (id, _opts, command) => {
|
|
26258
26532
|
await runWithClient(command, async ({ client, config }) => {
|
|
26259
26533
|
const doc = await withSpinner(
|
|
26260
26534
|
"Fetching document",
|
|
@@ -26332,12 +26606,15 @@ var downloadPageCommand = addDownloadOptions(
|
|
|
26332
26606
|
});
|
|
26333
26607
|
});
|
|
26334
26608
|
});
|
|
26335
|
-
var activitiesCommand =
|
|
26609
|
+
var activitiesCommand = addSortableListOptions(
|
|
26610
|
+
new Command("activities").description("Show one page of the activity log for a document").argument("<id>", "Document ID"),
|
|
26611
|
+
"Sort by id or -id (default: -id, newest first)"
|
|
26612
|
+
).action(async (id, opts, command) => {
|
|
26336
26613
|
await runWithClient(command, async ({ client, config }) => {
|
|
26337
26614
|
const activities = await withSpinner(
|
|
26338
26615
|
"Fetching activities",
|
|
26339
26616
|
config,
|
|
26340
|
-
() => client.documents.activities(id)
|
|
26617
|
+
() => client.documents.activities(id, listParams(opts))
|
|
26341
26618
|
);
|
|
26342
26619
|
printData(
|
|
26343
26620
|
activities,
|
|
@@ -26462,13 +26739,13 @@ var verifyCommand = new Command("verify").description("Verify a document by its
|
|
|
26462
26739
|
});
|
|
26463
26740
|
var statusesCommand = new Command("statuses").description("List every possible document status").action(async (_opts, command) => {
|
|
26464
26741
|
await runWithClient(command, async ({ client, config }) => {
|
|
26465
|
-
const
|
|
26742
|
+
const statuses2 = await withSpinner(
|
|
26466
26743
|
"Fetching statuses",
|
|
26467
26744
|
config,
|
|
26468
26745
|
() => client.documents.statuses()
|
|
26469
26746
|
);
|
|
26470
26747
|
printData(
|
|
26471
|
-
|
|
26748
|
+
statuses2,
|
|
26472
26749
|
config,
|
|
26473
26750
|
(rows) => renderTable(rows, [
|
|
26474
26751
|
{ header: "CODE", value: (r2) => r2.code },
|
|
@@ -26542,7 +26819,7 @@ var waitCommand = new Command("wait").description("Poll a document until it is r
|
|
|
26542
26819
|
printData(doc, config, (d) => renderKeyValue({ id: d.id, status: d.status }));
|
|
26543
26820
|
});
|
|
26544
26821
|
});
|
|
26545
|
-
var documentsCommand = new Command("documents").description("Upload, list, download, and manage documents").addCommand(uploadCommand).addCommand(
|
|
26822
|
+
var documentsCommand = new Command("documents").description("Upload, list, download, and manage documents").addCommand(uploadCommand).addCommand(listCommand4).addCommand(searchCommand).addCommand(getCommand3).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);
|
|
26546
26823
|
|
|
26547
26824
|
// src/commands/fields.ts
|
|
26548
26825
|
var fieldColumns = [
|
|
@@ -26571,7 +26848,7 @@ var createCommand2 = new Command("create").description("Create a custom field de
|
|
|
26571
26848
|
printData(field, config, (f) => renderKeyValue({ id: f.id, name: f.name, type: f.type }));
|
|
26572
26849
|
});
|
|
26573
26850
|
});
|
|
26574
|
-
var
|
|
26851
|
+
var listCommand5 = new Command("list").description("List field definitions").option("--include-inactive", "Include inactive fields").option("--include-standard", "Include standard fields (signature, initial, \u2026)").action(async (opts, command) => {
|
|
26575
26852
|
await runWithClient(command, async ({ client, config }) => {
|
|
26576
26853
|
const accountId = requireAccountId(config);
|
|
26577
26854
|
const fields = await withSpinner(
|
|
@@ -26585,7 +26862,7 @@ var listCommand4 = new Command("list").description("List field definitions").opt
|
|
|
26585
26862
|
printData(fields, config, (rows) => renderTable(rows, fieldColumns));
|
|
26586
26863
|
});
|
|
26587
26864
|
});
|
|
26588
|
-
var
|
|
26865
|
+
var getCommand4 = new Command("get").description("Show a field definition by ID").argument("<id>", "Field ID").action(async (id, _opts, command) => {
|
|
26589
26866
|
await runWithClient(command, async ({ client, config }) => {
|
|
26590
26867
|
const accountId = requireAccountId(config);
|
|
26591
26868
|
const field = await withSpinner(
|
|
@@ -26683,7 +26960,7 @@ var typesCommand = new Command("types").description("List the platform's support
|
|
|
26683
26960
|
);
|
|
26684
26961
|
});
|
|
26685
26962
|
});
|
|
26686
|
-
var fieldsCommand = new Command("fields").description("Manage custom field definitions used by collect assignments").addCommand(createCommand2).addCommand(
|
|
26963
|
+
var fieldsCommand = new Command("fields").description("Manage custom field definitions used by collect assignments").addCommand(createCommand2).addCommand(listCommand5).addCommand(getCommand4).addCommand(updateCommand).addCommand(deleteCommand2).addCommand(validateCommand).addCommand(validateMultipleCommand).addCommand(typesCommand);
|
|
26687
26964
|
|
|
26688
26965
|
// src/commands/login.ts
|
|
26689
26966
|
var loginCommand2 = new Command("login").description(
|
|
@@ -26691,10 +26968,10 @@ var loginCommand2 = new Command("login").description(
|
|
|
26691
26968
|
).action(async (_opts, command) => {
|
|
26692
26969
|
await runAction(command, async ({ config }) => {
|
|
26693
26970
|
const merged = command.optsWithGlobals();
|
|
26694
|
-
const
|
|
26971
|
+
const profileName = activeProfileName(getGlobals(command), readConfigFile({ strict: true }));
|
|
26695
26972
|
const apiKey = merged.apiKey ?? await promptSecret("Enter your Assinafy API key");
|
|
26696
26973
|
const accountId = merged.accountId ?? await promptText("Default account/workspace ID (optional)");
|
|
26697
|
-
const
|
|
26974
|
+
const file = readConfigFile({ strict: true });
|
|
26698
26975
|
const profiles = file.profiles ?? /* @__PURE__ */ Object.create(null);
|
|
26699
26976
|
const profile = { ...profiles[profileName], api_key: apiKey };
|
|
26700
26977
|
if (accountId) profile.account_id = accountId;
|
|
@@ -27236,7 +27513,7 @@ var createCommand3 = new Command("create").description("Create a signer (reuses
|
|
|
27236
27513
|
);
|
|
27237
27514
|
});
|
|
27238
27515
|
});
|
|
27239
|
-
var
|
|
27516
|
+
var listCommand6 = addListOptions(
|
|
27240
27517
|
new Command("list").description("List signers in the workspace"),
|
|
27241
27518
|
"Sort by full_name (prefix with - for descending)"
|
|
27242
27519
|
).action(async (opts, command) => {
|
|
@@ -27253,7 +27530,7 @@ var listCommand5 = addListOptions(
|
|
|
27253
27530
|
});
|
|
27254
27531
|
});
|
|
27255
27532
|
});
|
|
27256
|
-
var
|
|
27533
|
+
var getCommand5 = new Command("get").description("Show a signer by ID").argument("<id>", "Signer ID").action(async (id, _opts, command) => {
|
|
27257
27534
|
await runWithClient(command, async ({ client, config }) => {
|
|
27258
27535
|
const accountId = requireAccountId(config);
|
|
27259
27536
|
const signer = await withSpinner(
|
|
@@ -27316,7 +27593,7 @@ var findCommand = new Command("find-by-email").description("Find a signer by ema
|
|
|
27316
27593
|
);
|
|
27317
27594
|
});
|
|
27318
27595
|
});
|
|
27319
|
-
var signersCommand = new Command("signers").description("Create, list, and manage signers").addCommand(createCommand3).addCommand(
|
|
27596
|
+
var signersCommand = new Command("signers").description("Create, list, and manage signers").addCommand(createCommand3).addCommand(listCommand6).addCommand(getCommand5).addCommand(updateCommand2).addCommand(deleteCommand3).addCommand(findCommand);
|
|
27320
27597
|
|
|
27321
27598
|
// src/commands/tags.ts
|
|
27322
27599
|
var tagColumns = [
|
|
@@ -27324,7 +27601,7 @@ var tagColumns = [
|
|
|
27324
27601
|
{ header: "NAME", value: (r2) => r2.name },
|
|
27325
27602
|
{ header: "COLOR", value: (r2) => r2.color }
|
|
27326
27603
|
];
|
|
27327
|
-
var
|
|
27604
|
+
var listCommand7 = new Command("list").description("List workspace tags (alphabetical)").option("--search <query>", "Case-insensitive name filter").action(async (opts, command) => {
|
|
27328
27605
|
await runWithClient(command, async ({ client, config }) => {
|
|
27329
27606
|
const accountId = requireAccountId(config);
|
|
27330
27607
|
const params = opts.search ? { search: opts.search } : {};
|
|
@@ -27377,10 +27654,10 @@ var deleteCommand4 = new Command("delete").alias("rm").description("Delete a tag
|
|
|
27377
27654
|
printData(result, config);
|
|
27378
27655
|
});
|
|
27379
27656
|
});
|
|
27380
|
-
var tagsCommand2 = new Command("tags").description("Manage workspace tags").addCommand(
|
|
27657
|
+
var tagsCommand2 = new Command("tags").description("Manage workspace tags").addCommand(listCommand7).addCommand(createCommand4).addCommand(updateCommand3).addCommand(deleteCommand4);
|
|
27381
27658
|
|
|
27382
27659
|
// src/commands/templates.ts
|
|
27383
|
-
var
|
|
27660
|
+
var listCommand8 = addListOptions(
|
|
27384
27661
|
new Command("list").description("List templates in the workspace"),
|
|
27385
27662
|
"Sort by name (prefix with - for descending)"
|
|
27386
27663
|
).action(async (opts, command) => {
|
|
@@ -27402,7 +27679,7 @@ var listCommand7 = addListOptions(
|
|
|
27402
27679
|
});
|
|
27403
27680
|
});
|
|
27404
27681
|
});
|
|
27405
|
-
var
|
|
27682
|
+
var getCommand6 = new Command("get").description("Show a template by ID").argument("<id>", "Template ID").action(async (id, _opts, command) => {
|
|
27406
27683
|
await runWithClient(command, async ({ client, config }) => {
|
|
27407
27684
|
const accountId = requireAccountId(config);
|
|
27408
27685
|
const template = await withSpinner(
|
|
@@ -27436,7 +27713,7 @@ var downloadPageCommand2 = addDownloadOptions(
|
|
|
27436
27713
|
});
|
|
27437
27714
|
});
|
|
27438
27715
|
});
|
|
27439
|
-
var templatesCommand = new Command("templates").description("List and inspect document templates").addCommand(
|
|
27716
|
+
var templatesCommand = new Command("templates").description("List and inspect document templates").addCommand(listCommand8).addCommand(getCommand6).addCommand(downloadPageCommand2);
|
|
27440
27717
|
|
|
27441
27718
|
// src/commands/users.ts
|
|
27442
27719
|
var selfCommand2 = new Command("self").description("Show the authenticated user's profile and accounts").action(async (_opts, command) => {
|
|
@@ -27517,7 +27794,7 @@ var registerCommand = new Command("register").description("Register (or replace)
|
|
|
27517
27794
|
);
|
|
27518
27795
|
});
|
|
27519
27796
|
});
|
|
27520
|
-
var
|
|
27797
|
+
var getCommand7 = new Command("get").description("Show the account's oldest webhook endpoint").action(async (_opts, command) => {
|
|
27521
27798
|
await runWithClient(command, async ({ client, config }) => {
|
|
27522
27799
|
const accountId = requireAccountId(config);
|
|
27523
27800
|
const sub = await withSpinner(
|
|
@@ -27795,7 +28072,7 @@ var verifyCommand2 = new Command("verify").description(
|
|
|
27795
28072
|
});
|
|
27796
28073
|
});
|
|
27797
28074
|
var endpointsCommand = new Command("endpoints").description("Manage webhook endpoints and their signing secrets").addCommand(endpointsListCommand).addCommand(endpointsCreateCommand).addCommand(endpointsGetCommand).addCommand(endpointsUpdateCommand).addCommand(endpointsDeleteCommand).addCommand(endpointsDeleteByUrlCommand).addCommand(endpointsSecretCommand).addCommand(endpointsRotateSecretCommand);
|
|
27798
|
-
var webhooksCommand = new Command("webhooks").description("Manage webhook endpoints, the primary subscription, and delivery history").addCommand(endpointsCommand).addCommand(registerCommand).addCommand(
|
|
28075
|
+
var webhooksCommand = new Command("webhooks").description("Manage webhook endpoints, the primary subscription, and delivery history").addCommand(endpointsCommand).addCommand(registerCommand).addCommand(getCommand7).addCommand(inactivateCommand).addCommand(eventTypesCommand).addCommand(dispatchesCommand).addCommand(retryCommand).addCommand(verifyCommand2);
|
|
27799
28076
|
|
|
27800
28077
|
// src/commands/whoami.ts
|
|
27801
28078
|
var whoamiCommand = new Command("whoami").description("Verify credentials and list the workspaces they can access").action(async (_opts, command) => {
|
|
@@ -27841,7 +28118,7 @@ var createCommand5 = new Command("create").description("Create a workspace (acco
|
|
|
27841
28118
|
printData(workspace, config, (w) => renderKeyValue({ id: w.id, name: w.name }));
|
|
27842
28119
|
});
|
|
27843
28120
|
});
|
|
27844
|
-
var
|
|
28121
|
+
var listCommand9 = new Command("list").description("List workspaces you can access").action(async (_opts, command) => {
|
|
27845
28122
|
await runWithClient(command, async ({ client, config }) => {
|
|
27846
28123
|
const result = await withSpinner(
|
|
27847
28124
|
"Fetching workspaces",
|
|
@@ -27860,7 +28137,7 @@ var listCommand8 = new Command("list").description("List workspaces you can acce
|
|
|
27860
28137
|
);
|
|
27861
28138
|
});
|
|
27862
28139
|
});
|
|
27863
|
-
var
|
|
28140
|
+
var getCommand8 = new Command("get").description("Show a workspace by ID").argument("<id>", "Account/workspace ID").action(async (id, _opts, command) => {
|
|
27864
28141
|
await runWithClient(command, async ({ client, config }) => {
|
|
27865
28142
|
const workspace = await withSpinner(
|
|
27866
28143
|
"Fetching workspace",
|
|
@@ -27971,7 +28248,7 @@ var deleteCommand5 = new Command("delete").alias("rm").description("Delete a wor
|
|
|
27971
28248
|
printData({ deleted: id }, config);
|
|
27972
28249
|
});
|
|
27973
28250
|
});
|
|
27974
|
-
var workspacesCommand = new Command("workspaces").alias("accounts").description("Manage workspaces (accounts)").addCommand(createCommand5).addCommand(
|
|
28251
|
+
var workspacesCommand = new Command("workspaces").alias("accounts").description("Manage workspaces (accounts)").addCommand(createCommand5).addCommand(listCommand9).addCommand(getCommand8).addCommand(themeCommand).addCommand(statsCommand2).addCommand(logoCommand).addCommand(updateCommand4).addCommand(deleteCommand5);
|
|
27975
28252
|
function logoContentType(file) {
|
|
27976
28253
|
return {
|
|
27977
28254
|
".gif": "image/gif",
|
|
@@ -28018,7 +28295,7 @@ function handleStreamError(err, fallback, exit = process.exit) {
|
|
|
28018
28295
|
// package.json
|
|
28019
28296
|
var package_default = {
|
|
28020
28297
|
name: "@assinafy/cli",
|
|
28021
|
-
version: "2.
|
|
28298
|
+
version: "2.7.0",
|
|
28022
28299
|
description: "The official command-line interface for the Assinafy digital-signature API",
|
|
28023
28300
|
license: "MIT",
|
|
28024
28301
|
type: "module",
|
|
@@ -28104,7 +28381,7 @@ var package_default = {
|
|
|
28104
28381
|
tsup: "^8.3.5",
|
|
28105
28382
|
tsx: "^4.23.12",
|
|
28106
28383
|
typescript: "^7.0.2",
|
|
28107
|
-
vitest: "^4.1.
|
|
28384
|
+
vitest: "^4.1.12"
|
|
28108
28385
|
},
|
|
28109
28386
|
overrides: {
|
|
28110
28387
|
esbuild: "^0.28.2"
|
|
@@ -28134,7 +28411,7 @@ ${import_picocolors7.default.gray("Examples:")}
|
|
|
28134
28411
|
|
|
28135
28412
|
${import_picocolors7.default.gray("Sandbox:")} target it with ${import_picocolors7.default.blue("--base-url https://sandbox.assinafy.com.br/v1")}
|
|
28136
28413
|
`
|
|
28137
|
-
).addCommand(sendCommand).addCommand(documentsCommand).addCommand(signersCommand).addCommand(assignmentsCommand).addCommand(templatesCommand).addCommand(tagsCommand2).addCommand(fieldsCommand).addCommand(webhooksCommand).addCommand(workspacesCommand).addCommand(usersCommand).addCommand(signerCommand).addCommand(authCommand).addCommand(oauthCommand).addCommand(loginCommand2).addCommand(logoutCommand).addCommand(whoamiCommand).addCommand(configCommand).addCommand(docsCommand);
|
|
28414
|
+
).addCommand(sendCommand).addCommand(documentsCommand).addCommand(contractsCommand).addCommand(signersCommand).addCommand(assignmentsCommand).addCommand(templatesCommand).addCommand(tagsCommand2).addCommand(fieldsCommand).addCommand(webhooksCommand).addCommand(workspacesCommand).addCommand(usersCommand).addCommand(signerCommand).addCommand(authCommand).addCommand(oauthCommand).addCommand(loginCommand2).addCommand(logoutCommand).addCommand(whoamiCommand).addCommand(configCommand).addCommand(docsCommand);
|
|
28138
28415
|
program2.parseAsync().catch((err) => {
|
|
28139
28416
|
process.stderr.write(
|
|
28140
28417
|
`${import_picocolors7.default.red("error:")} ${sanitizeTerminalText(err instanceof Error ? err.message : String(err))}
|