@signature-kit/clicksign 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0
4
+
5
+ - Clicksign now owns its document/signature-request props, attributes, state
6
+ schema, schema names, and retained no-op diff instead of using core
7
+ remote-signature contracts.
8
+ - Cancel Clicksign documents with `PATCH /api/v1/documents/{key}/cancel`, matching
9
+ the provider API that rejected the previous `POST`.
10
+ - Stop fabricating signed-document download URLs; absent signed-file URLs now stay
11
+ absent and download attempts fail as typed `unsupportedOperation` errors.
12
+ - Enable sequential signing only when at least one signer has `routingOrder`, so
13
+ unordered multi-signer requests remain parallel.
14
+ - Redact `access_token` from token-bearing signed-document diagnostic URLs, so
15
+ typed error reasons never leak provider download secrets.
16
+ - Limit create rollback deletion to unambiguous pre-effect 4xx failures (except
17
+ 408, 409, and 429); response-shape errors, 5xxs, and timeouts no longer delete
18
+ possibly live documents.
19
+ - Add offline local-HTTP-server coverage for Clicksign provider behavior in the
20
+ default test suite.
21
+
22
+ Breaking: request props now use `ClicksignSignatureRequestProps` with
23
+ `contentBase64` documents, and `getClicksignSignatureRequest` /
24
+ `listClicksignSignatureRequests` return `ClicksignSignatureRequestAttributes`
25
+ instead of core `RemoteSignature*` types.
26
+
3
27
  ## 0.2.0
4
28
 
5
29
  - Authenticate same-host signed-document downloads (previously the fallback URL was requested
@@ -13,4 +37,4 @@
13
37
 
14
38
  - Initial npm-ready release for `@signature-kit/clicksign`.
15
39
  - Published package metadata, MIT license, README, and package-local changelog.
16
- - Ships alchemy v2 remote-signature provider for Clicksign document creation, lookup, cancellation, deletion, and signed-document download.
40
+ - Ships an Alchemy v2 remote-signature provider for Clicksign document creation, lookup, cancellation, deletion, and signed-document download.
package/README.md CHANGED
@@ -1,24 +1,83 @@
1
1
  # @signature-kit/clicksign
2
2
 
3
- Alchemy v2 remote-signature provider for Clicksign document creation, lookup, cancellation, deletion, and signed-document download.
3
+ Alchemy v2 remote-signature provider for Clicksign document creation, lookup, listing, cancellation, deletion, and signed-file download.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```sh
8
- bun add @signature-kit/clicksign effect alchemy
8
+ bun add @signature-kit/clicksign @signature-kit/http effect alchemy
9
9
  ```
10
10
 
11
- ## Exports
11
+ `effect` and `alchemy` are direct runtime dependencies. Provide `signatureHttpClientLive` at the stack boundary; `providers(options)` supplies only Clicksign credentials and resource providers.
12
12
 
13
- - `@signature-kit/clicksign`
13
+ ## Public surface
14
14
 
15
- ## Runtime model
15
+ - `@signature-kit/clicksign` — Clicksign request/document/signer schemas, `ClicksignSignatureRequest`, `ClicksignProviders`, `providers`, `getClicksignSignatureRequest`, `listClicksignSignatureRequests`, `cancelClicksignSignatureRequest`, `deleteClicksignSignatureRequest`, and `downloadClicksignSignedDocument`.
16
16
 
17
- SignatureKit packages are Effect-native. Public APIs return typed `Effect.Effect` values; recoverable faults stay in the typed error channel; callers provide required services and layers explicitly at the application boundary.
17
+ Capability matrix:
18
18
 
19
- ## Version
19
+ | Capability | Supported |
20
+ | ------------------------------- | -------------------------------------------------- |
21
+ | Create retained Alchemy request | Yes |
22
+ | Get request | Yes |
23
+ | List requests | Yes |
24
+ | Cancel request | Yes, via `PATCH /documents/{key}/cancel` |
25
+ | Delete request | Yes |
26
+ | Download signed document | Yes, only when Clicksign exposes a signed-file URL |
20
27
 
21
- Current npm release line: `0.1.0`.
28
+ Retained-resource semantics: Alchemy `reconcile` creates once and returns cached output on subsequent plans; provider `list` returns `[]`; `nuke` is skipped. Multi-step create rollback deletes remote state only after unambiguous pre-effect 4xx failures, excluding 408, 409, 429, 5xx, timeouts, and response-shape failures.
29
+
30
+ ## Example
31
+
32
+ ```ts
33
+ import * as Alchemy from "alchemy";
34
+ import {
35
+ ClicksignSignatureRequest,
36
+ cancelClicksignSignatureRequest,
37
+ providers as clicksignProviders,
38
+ type ClicksignProviderOptions,
39
+ } from "@signature-kit/clicksign";
40
+ import { signatureHttpClientLive } from "@signature-kit/http";
41
+ import { Effect, Layer, Redacted } from "effect";
42
+
43
+ declare const pdfBase64: string;
44
+ declare const accessToken: string;
45
+
46
+ const options: ClicksignProviderOptions = {
47
+ accessToken: Redacted.make(accessToken),
48
+ environment: "sandbox",
49
+ locale: "pt-BR",
50
+ autoClose: true,
51
+ };
52
+
53
+ export default class Contracts extends Alchemy.Stack<Contracts>()(
54
+ "Contracts",
55
+ {
56
+ providers: Layer.merge(clicksignProviders(options), signatureHttpClientLive),
57
+ state: Alchemy.inMemoryState(),
58
+ },
59
+ Effect.gen(function* () {
60
+ return yield* ClicksignSignatureRequest("service-agreement", {
61
+ title: "Service agreement",
62
+ message: "Review and sign this document.",
63
+ documents: [
64
+ { fileName: "contract.pdf", mimeType: "application/pdf", contentBase64: pdfBase64 },
65
+ ],
66
+ recipients: [{ name: "Ada Lovelace", email: "ada@example.com", role: "signer" }],
67
+ send: true,
68
+ });
69
+ }),
70
+ ) {}
71
+
72
+ export const cancelRequest = (id: string) =>
73
+ cancelClicksignSignatureRequest(options, id).pipe(Effect.provide(signatureHttpClientLive));
74
+ ```
75
+
76
+ ## Errors and i18n
77
+
78
+ Invalid inputs, remote HTTP failures, unsupported operations, and invalid response shapes fail as `SignatureKitError` from `@signature-kit/signatures`. Applications can render localized copy through `errorMessage` from `@signature-kit/i18n` with the `signatureKitErrorMessages` catalog from `@signature-kit/signatures`.
79
+
80
+ Docs: <https://signaturekit.dev/en-US/docs/providers/clicksign>.
22
81
 
23
82
  ## License
24
83
 
package/dist/index.d.ts CHANGED
@@ -1,9 +1,80 @@
1
- import { SignatureKitError } from "@signature-kit/core/config";
2
- import type { RemoteSignatureRequest, RemoteSignatureRequestProps } from "@signature-kit/core/config";
3
- import { SignatureHttpClient } from "@signature-kit/core/http";
1
+ import { SignatureKitError } from "@signature-kit/signatures";
2
+ import { SignatureHttpClient } from "@signature-kit/http";
4
3
  import { Resource } from "alchemy";
5
4
  import * as Provider from "alchemy/Provider";
6
5
  import { Context, Effect, Layer, Redacted, Schema } from "effect";
6
+ export declare const ClicksignProviderId = "clicksign";
7
+ export declare const ClicksignSignatureRequestStateSchema: Schema.Literals<readonly ["draft", "sent", "completed", "cancelled", "deleted", "declined", "expired"]>;
8
+ export type ClicksignSignatureRequestState = (typeof ClicksignSignatureRequestStateSchema)["Type"];
9
+ export declare const ClicksignDocumentInputSchema: Schema.Struct<{
10
+ readonly fileName: Schema.NonEmptyString;
11
+ readonly mimeType: Schema.NonEmptyString;
12
+ readonly content: Schema.Uint8Array;
13
+ }>;
14
+ export type ClicksignDocumentInput = (typeof ClicksignDocumentInputSchema)["Type"];
15
+ export declare const ClicksignDocumentPropsSchema: Schema.Struct<{
16
+ readonly fileName: Schema.NonEmptyString;
17
+ readonly mimeType: Schema.NonEmptyString;
18
+ readonly contentBase64: Schema.ConstraintDecoder<string, never>;
19
+ }>;
20
+ export type ClicksignDocumentProps = (typeof ClicksignDocumentPropsSchema)["Type"];
21
+ export declare const ClicksignSignerRoleSchema: Schema.Literals<readonly ["approver", "signer"]>;
22
+ export type ClicksignSignerRole = (typeof ClicksignSignerRoleSchema)["Type"];
23
+ export declare const ClicksignSignerSchema: Schema.Struct<{
24
+ readonly name: Schema.NonEmptyString;
25
+ readonly email: Schema.NonEmptyString;
26
+ readonly role: Schema.optional<Schema.Literals<readonly ["approver", "signer"]>>;
27
+ readonly routingOrder: Schema.optional<Schema.Number>;
28
+ }>;
29
+ export type ClicksignSigner = (typeof ClicksignSignerSchema)["Type"];
30
+ export declare const ClicksignSignatureRequestInputSchema: Schema.Struct<{
31
+ readonly title: Schema.NonEmptyString;
32
+ readonly message: Schema.optional<Schema.NonEmptyString>;
33
+ readonly documents: Schema.Tuple<readonly [Schema.Struct<{
34
+ readonly fileName: Schema.NonEmptyString;
35
+ readonly mimeType: Schema.NonEmptyString;
36
+ readonly content: Schema.Uint8Array;
37
+ }>]>;
38
+ readonly recipients: Schema.NonEmptyArray<Schema.Struct<{
39
+ readonly name: Schema.NonEmptyString;
40
+ readonly email: Schema.NonEmptyString;
41
+ readonly role: Schema.optional<Schema.Literals<readonly ["approver", "signer"]>>;
42
+ readonly routingOrder: Schema.optional<Schema.Number>;
43
+ }>>;
44
+ readonly send: Schema.optional<Schema.Boolean>;
45
+ readonly expiresAt: Schema.optional<Schema.Date>;
46
+ readonly redirectUrl: Schema.optional<Schema.NonEmptyString>;
47
+ }>;
48
+ export type ClicksignSignatureRequestInput = (typeof ClicksignSignatureRequestInputSchema)["Type"];
49
+ export declare const ClicksignSignatureRequestPropsSchema: Schema.Struct<{
50
+ readonly title: Schema.NonEmptyString;
51
+ readonly message: Schema.optional<Schema.NonEmptyString>;
52
+ readonly documents: Schema.Tuple<readonly [Schema.Struct<{
53
+ readonly fileName: Schema.NonEmptyString;
54
+ readonly mimeType: Schema.NonEmptyString;
55
+ readonly contentBase64: Schema.ConstraintDecoder<string, never>;
56
+ }>]>;
57
+ readonly recipients: Schema.NonEmptyArray<Schema.Struct<{
58
+ readonly name: Schema.NonEmptyString;
59
+ readonly email: Schema.NonEmptyString;
60
+ readonly role: Schema.optional<Schema.Literals<readonly ["approver", "signer"]>>;
61
+ readonly routingOrder: Schema.optional<Schema.Number>;
62
+ }>>;
63
+ readonly send: Schema.optional<Schema.Boolean>;
64
+ readonly expiresAt: Schema.optional<Schema.Date>;
65
+ readonly redirectUrl: Schema.optional<Schema.NonEmptyString>;
66
+ }>;
67
+ export type ClicksignSignatureRequestProps = (typeof ClicksignSignatureRequestPropsSchema)["Type"];
68
+ export declare const ClicksignSignatureRequestAttributesSchema: Schema.Struct<{
69
+ readonly provider: Schema.Literal<"clicksign">;
70
+ readonly id: Schema.NonEmptyString;
71
+ readonly state: Schema.Literals<readonly ["draft", "sent", "completed", "cancelled", "deleted", "declined", "expired"]>;
72
+ readonly providerStatus: Schema.optional<Schema.String>;
73
+ readonly signingUrl: Schema.optional<Schema.String>;
74
+ readonly detailsUrl: Schema.optional<Schema.String>;
75
+ readonly downloadUrl: Schema.optional<Schema.String>;
76
+ }>;
77
+ export type ClicksignSignatureRequestAttributes = (typeof ClicksignSignatureRequestAttributesSchema)["Type"];
7
78
  declare const ClicksignEnvironmentSchema: Schema.Literals<readonly ["production", "sandbox"]>;
8
79
  export type ClicksignEnvironment = (typeof ClicksignEnvironmentSchema)["Type"];
9
80
  declare const ClicksignLocaleSchema: Schema.Literals<readonly ["en-US", "pt-BR"]>;
@@ -16,7 +87,7 @@ export declare const ClicksignProviderOptionsSchema: Schema.Struct<{
16
87
  readonly autoClose: Schema.optional<Schema.Boolean>;
17
88
  }>;
18
89
  export type ClicksignProviderOptions = (typeof ClicksignProviderOptionsSchema)["Type"];
19
- export type ClicksignSignatureRequest = Resource<"SignatureKit.ClicksignSignatureRequest", RemoteSignatureRequestProps, RemoteSignatureRequest>;
90
+ export type ClicksignSignatureRequest = Resource<"SignatureKit.ClicksignSignatureRequest", ClicksignSignatureRequestProps, ClicksignSignatureRequestAttributes>;
20
91
  export declare const ClicksignSignatureRequest: import("alchemy").ResourceClass<ClicksignSignatureRequest>;
21
92
  declare const ClicksignCredentials_base: Context.ServiceClass<ClicksignCredentials, "@signature-kit/clicksign/Credentials", {
22
93
  readonly accessToken: Redacted.Redacted<string>;
@@ -33,8 +104,8 @@ declare const ClicksignProviders_base: Provider.ProviderCollection<ClicksignProv
33
104
  export declare class ClicksignProviders extends ClicksignProviders_base {
34
105
  }
35
106
  export declare const providers: (options: ClicksignProviderOptions) => Layer.Layer<ClicksignProviders, SignatureKitError, SignatureHttpClient>;
36
- export declare const getClicksignSignatureRequest: (options: ClicksignProviderOptions, id: string) => Effect.Effect<RemoteSignatureRequest, SignatureKitError, SignatureHttpClient>;
37
- export declare const listClicksignSignatureRequests: (options: ClicksignProviderOptions) => Effect.Effect<readonly RemoteSignatureRequest[], SignatureKitError, SignatureHttpClient>;
107
+ export declare const getClicksignSignatureRequest: (options: ClicksignProviderOptions, id: string) => Effect.Effect<ClicksignSignatureRequestAttributes, SignatureKitError, SignatureHttpClient>;
108
+ export declare const listClicksignSignatureRequests: (options: ClicksignProviderOptions) => Effect.Effect<readonly ClicksignSignatureRequestAttributes[], SignatureKitError, SignatureHttpClient>;
38
109
  export declare const cancelClicksignSignatureRequest: (options: ClicksignProviderOptions, id: string) => Effect.Effect<void, SignatureKitError, SignatureHttpClient>;
39
110
  export declare const deleteClicksignSignatureRequest: (options: ClicksignProviderOptions, id: string) => Effect.Effect<void, SignatureKitError, SignatureHttpClient>;
40
111
  export declare const downloadClicksignSignedDocument: (options: ClicksignProviderOptions, id: string) => Effect.Effect<Uint8Array, SignatureKitError, SignatureHttpClient>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EAMlB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAIV,sBAAsB,EAEtB,2BAA2B,EAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAqB,MAAM,0BAA0B,CAAC;AAElF,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAOlE,QAAA,MAAM,0BAA0B,qDAA6C,CAAC;AAC9E,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E,QAAA,MAAM,qBAAqB,8CAAsC,CAAC;AAClE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,eAAO,MAAM,8BAA8B;;;;;;EAMzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,8BAA8B,CA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,MAAM,CAAC,MAAM,CACd,SAAS,mCAAmC,EAAE,EAC9C,iBAAiB,EACjB,mBAAmB,CAkBjB,CAAC;AAEL,eAAO,MAAM,+BAA+B,GAC1C,SAAS,wBAAwB,EACjC,IAAI,MAAM,KACT,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,mBAAmB,CAiBzD,CAAC;AAEL,eAAO,MAAM,+BAA+B,GAC1C,SAAS,wBAAwB,EACjC,IAAI,MAAM,KACT,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,mBAAmB,CAiBzD,CAAC;AAEL,eAAO,MAAM,+BAA+B,GAC1C,SAAS,wBAAwB,EACjC,IAAI,MAAM,KACT,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,iBAAiB,EAAE,mBAAmB,CAiB/D,CAAC"}
package/dist/index.js CHANGED
@@ -1,10 +1,104 @@
1
1
  import { bytesToBase64 } from "@signature-kit/crypto/base64";
2
- import { SignatureKitError, SignatureKitErrorCodeValue, SignatureKitOperationValue, SignatureKitSchemaNameValue, redactedStringSchema, remoteSignatureInputFromResourceProps, } from "@signature-kit/core/config";
3
- import { SignatureHttpClient, normalizedBaseUrl } from "@signature-kit/core/http";
2
+ import { SignatureKitError, SignatureKitErrorCodeValue, SignatureKitOperationValue, redactedStringSchema, } from "@signature-kit/signatures";
3
+ import { SignatureHttpClient, normalizedBaseUrl } from "@signature-kit/http";
4
4
  import { Resource } from "alchemy";
5
5
  import * as Provider from "alchemy/Provider";
6
- import { Context, Effect, Layer, Redacted, Schema } from "effect";
7
- const PROVIDER = "clicksign";
6
+ import { Context, Effect, Layer, Match, Option, Redacted, Schema, Stream } from "effect";
7
+ const ClicksignSchemaName = {
8
+ providerOptions: "ClicksignProviderOptions",
9
+ signatureRequestProps: "ClicksignSignatureRequestProps",
10
+ documentResult: "ClicksignDocumentResult",
11
+ signerResult: "ClicksignSignerResult",
12
+ listResult: "ClicksignListResult",
13
+ documentsResult: "ClicksignDocumentsResult",
14
+ };
15
+ const ClicksignOperation = {
16
+ download: "clicksign.download",
17
+ };
18
+ const base64String = Schema.String.check(Schema.isBase64());
19
+ export const ClicksignProviderId = "clicksign";
20
+ const PROVIDER = ClicksignProviderId;
21
+ export const ClicksignSignatureRequestStateSchema = Schema.Literals([
22
+ "draft",
23
+ "sent",
24
+ "completed",
25
+ "cancelled",
26
+ "deleted",
27
+ "declined",
28
+ "expired",
29
+ ]);
30
+ export const ClicksignDocumentInputSchema = Schema.Struct({
31
+ fileName: Schema.NonEmptyString,
32
+ mimeType: Schema.NonEmptyString,
33
+ content: Schema.Uint8Array,
34
+ });
35
+ export const ClicksignDocumentPropsSchema = Schema.Struct({
36
+ fileName: Schema.NonEmptyString,
37
+ mimeType: Schema.NonEmptyString,
38
+ contentBase64: base64String,
39
+ });
40
+ export const ClicksignSignerRoleSchema = Schema.Literals(["approver", "signer"]);
41
+ export const ClicksignSignerSchema = Schema.Struct({
42
+ name: Schema.NonEmptyString,
43
+ email: Schema.NonEmptyString,
44
+ role: Schema.optional(ClicksignSignerRoleSchema),
45
+ routingOrder: Schema.optional(Schema.Number),
46
+ });
47
+ export const ClicksignSignatureRequestInputSchema = Schema.Struct({
48
+ title: Schema.NonEmptyString,
49
+ message: Schema.optional(Schema.NonEmptyString),
50
+ documents: Schema.Tuple([ClicksignDocumentInputSchema]),
51
+ recipients: Schema.NonEmptyArray(ClicksignSignerSchema),
52
+ send: Schema.optional(Schema.Boolean),
53
+ expiresAt: Schema.optional(Schema.Date),
54
+ redirectUrl: Schema.optional(Schema.NonEmptyString),
55
+ });
56
+ export const ClicksignSignatureRequestPropsSchema = Schema.Struct({
57
+ title: Schema.NonEmptyString,
58
+ message: Schema.optional(Schema.NonEmptyString),
59
+ documents: Schema.Tuple([ClicksignDocumentPropsSchema]),
60
+ recipients: Schema.NonEmptyArray(ClicksignSignerSchema),
61
+ send: Schema.optional(Schema.Boolean),
62
+ expiresAt: Schema.optional(Schema.Date),
63
+ redirectUrl: Schema.optional(Schema.NonEmptyString),
64
+ });
65
+ export const ClicksignSignatureRequestAttributesSchema = Schema.Struct({
66
+ provider: Schema.Literal(PROVIDER),
67
+ id: Schema.NonEmptyString,
68
+ state: ClicksignSignatureRequestStateSchema,
69
+ providerStatus: Schema.optional(Schema.String),
70
+ signingUrl: Schema.optional(Schema.String),
71
+ detailsUrl: Schema.optional(Schema.String),
72
+ downloadUrl: Schema.optional(Schema.String),
73
+ });
74
+ const clicksignSignatureRequestNoopDiff = { action: "noop" };
75
+ const clicksignSignatureRequestDiff = ({ olds, }) => Effect.succeed(olds === undefined ? undefined : clicksignSignatureRequestNoopDiff);
76
+ const clicksignSignatureRequestInputFromProps = (props) => {
77
+ const [document] = props.documents;
78
+ return {
79
+ title: props.title,
80
+ documents: [
81
+ {
82
+ fileName: document.fileName,
83
+ mimeType: document.mimeType,
84
+ content: Uint8Array.fromBase64(document.contentBase64),
85
+ },
86
+ ],
87
+ recipients: props.recipients,
88
+ ...(props.message === undefined ? {} : { message: props.message }),
89
+ ...(props.send === undefined ? {} : { send: props.send }),
90
+ ...(props.expiresAt === undefined ? {} : { expiresAt: props.expiresAt }),
91
+ ...(props.redirectUrl === undefined ? {} : { redirectUrl: props.redirectUrl }),
92
+ };
93
+ };
94
+ const clicksignSignatureRequestInputFromResourceProps = (props) => Schema.decodeUnknownEffect(ClicksignSignatureRequestPropsSchema)(props).pipe(Effect.mapError((issue) => new SignatureKitError({
95
+ code: SignatureKitErrorCodeValue.invalidInput,
96
+ retryable: false,
97
+ provider: PROVIDER,
98
+ operation: SignatureKitOperationValue.schemaDecode,
99
+ schemaName: ClicksignSchemaName.signatureRequestProps,
100
+ issueMessage: String(issue),
101
+ })), Effect.map(clicksignSignatureRequestInputFromProps));
8
102
  const CLICKSIGN_PROVIDER_COLLECTION_ID = "@signature-kit/clicksign/Providers";
9
103
  const SANDBOX_BASE_URL = "https://sandbox.clicksign.com/api/v1";
10
104
  const PRODUCTION_BASE_URL = "https://app.clicksign.com/api/v1";
@@ -36,9 +130,6 @@ const ClicksignSignerResultSchema = Schema.Struct({
36
130
  const ClicksignListResultSchema = Schema.Struct({
37
131
  list: Schema.Struct({ request_signature_key: Schema.NonEmptyString }),
38
132
  });
39
- const ClicksignGetDocumentResponseSchema = Schema.Struct({
40
- document: ClicksignDocumentSchema,
41
- });
42
133
  const ClicksignPageInfosSchema = Schema.Struct({
43
134
  total_pages: Schema.optional(Schema.Union([Schema.Number, Schema.String])),
44
135
  current_page: Schema.optional(Schema.Union([Schema.Number, Schema.String])),
@@ -51,29 +142,25 @@ const ClicksignDocumentsResultSchema = Schema.Struct({
51
142
  });
52
143
  const clicksignPathId = (id) => encodeURIComponent(id);
53
144
  const clicksignDocumentPath = (id) => `/documents/${clicksignPathId(id)}`;
54
- const clicksignDocumentDownloadPath = (id) => `${clicksignDocumentPath(id)}/download`;
55
- const toRemoteSignatureRequestState = (status) => {
145
+ const ClicksignStatusSchema = Schema.Literals([
146
+ "draft",
147
+ "completed",
148
+ "signed",
149
+ "closed",
150
+ "cancelled",
151
+ "canceled",
152
+ "deleted",
153
+ "declined",
154
+ "expired",
155
+ ]);
156
+ const isClicksignStatus = Schema.is(ClicksignStatusSchema);
157
+ const toClicksignSignatureRequestAttributesState = (status) => {
56
158
  if (status === undefined)
57
159
  return "sent";
58
- switch (status.toLowerCase()) {
59
- case "draft":
60
- return "draft";
61
- case "completed":
62
- case "signed":
63
- case "closed":
64
- return "completed";
65
- case "cancelled":
66
- case "canceled":
67
- return "cancelled";
68
- case "deleted":
69
- return "deleted";
70
- case "declined":
71
- return "declined";
72
- case "expired":
73
- return "expired";
74
- default:
75
- return "sent";
76
- }
160
+ const normalized = status.toLowerCase();
161
+ if (!isClicksignStatus(normalized))
162
+ return "sent";
163
+ return Match.value(normalized).pipe(Match.when("draft", () => "draft"), Match.whenOr("completed", "signed", "closed", () => "completed"), Match.whenOr("cancelled", "canceled", () => "cancelled"), Match.when("deleted", () => "deleted"), Match.when("declined", () => "declined"), Match.when("expired", () => "expired"), Match.orElse(() => "sent"));
77
164
  };
78
165
  const resolveClicksignSignedDocumentUrl = (document) => {
79
166
  const signedFile = document.downloads?.signed_file_url;
@@ -104,15 +191,17 @@ const clicksignListNextPage = (pageInfos, currentPage) => {
104
191
  const totalPages = parseClicksignPageNumber(pageInfos.total_pages);
105
192
  return totalPages === undefined || totalPages <= currentPage ? undefined : currentPage + 1;
106
193
  };
107
- const toRemoteSignatureRequest = (baseUrl, document) => {
194
+ const toClicksignSignatureRequestAttributes = (baseUrl, document) => {
108
195
  const downloadUrl = resolveClicksignSignedDocumentUrl(document);
109
196
  return {
110
197
  provider: PROVIDER,
111
198
  id: document.key,
112
- state: toRemoteSignatureRequestState(document.status),
113
- providerStatus: document.status,
199
+ state: toClicksignSignatureRequestAttributesState(document.status),
200
+ ...(document.status === undefined ? {} : { providerStatus: document.status }),
114
201
  detailsUrl: `${baseUrl}${clicksignDocumentPath(document.key)}`,
115
- downloadUrl: downloadUrl ?? `${baseUrl}${clicksignDocumentDownloadPath(document.key)}`,
202
+ // Clicksign v1 has no /documents/{key}/download endpoint — signed files are
203
+ // only exposed through document.downloads.*_url, so absent means absent.
204
+ ...(downloadUrl === undefined ? {} : { downloadUrl }),
116
205
  };
117
206
  };
118
207
  const getClicksignSignatureRequestInternal = (http, options, baseUrl, id) => http
@@ -121,30 +210,28 @@ const getClicksignSignatureRequestInternal = (http, options, baseUrl, id) => htt
121
210
  method: "GET",
122
211
  ...withAccessToken(baseUrl, clicksignDocumentPath(id), options.accessToken),
123
212
  headers: { "Content-Type": "application/json" },
124
- }, ClicksignGetDocumentResponseSchema, SignatureKitSchemaNameValue.clicksignDocumentResult)
125
- .pipe(Effect.map((result) => toRemoteSignatureRequest(baseUrl, result.document)));
126
- const listClicksignSignatureRequestsInternal = (http, options, baseUrl) => {
127
- const fetchPage = (page) => {
128
- const pagePath = `/documents?page=${String(page)}`;
129
- return http
130
- .requestJson({
131
- provider: PROVIDER,
132
- method: "GET",
133
- ...withAccessToken(baseUrl, pagePath, options.accessToken),
134
- }, ClicksignDocumentsResultSchema, SignatureKitSchemaNameValue.clicksignDocumentsResult)
135
- .pipe(Effect.flatMap((result) => {
136
- const documents = result.documents.map((document) => toRemoteSignatureRequest(baseUrl, document));
137
- const nextPage = clicksignListNextPage(result.page_infos, page);
138
- if (nextPage === undefined)
139
- return Effect.succeed(documents);
140
- return fetchPage(nextPage).pipe(Effect.map((nextDocuments) => [...documents, ...nextDocuments]));
141
- }));
142
- };
143
- return fetchPage(1);
144
- };
213
+ }, ClicksignDocumentResultSchema, ClicksignSchemaName.documentResult)
214
+ .pipe(Effect.map((result) => toClicksignSignatureRequestAttributes(baseUrl, result.document)));
215
+ const listClicksignSignatureRequestsInternal = (http, options, baseUrl) => Stream.paginate(1, (page) => {
216
+ const pagePath = `/documents?page=${String(page)}`;
217
+ return http
218
+ .requestJson({
219
+ provider: PROVIDER,
220
+ method: "GET",
221
+ ...withAccessToken(baseUrl, pagePath, options.accessToken),
222
+ }, ClicksignDocumentsResultSchema, ClicksignSchemaName.documentsResult)
223
+ .pipe(Effect.map((result) => {
224
+ const nextPage = clicksignListNextPage(result.page_infos, page);
225
+ return [
226
+ result.documents.map((document) => toClicksignSignatureRequestAttributes(baseUrl, document)),
227
+ nextPage === undefined ? Option.none() : Option.some(nextPage),
228
+ ];
229
+ }));
230
+ }).pipe(Stream.runCollect);
145
231
  const cancelClicksignSignatureRequestInternal = (http, options, baseUrl, id) => http.requestVoid({
146
232
  provider: PROVIDER,
147
- method: "POST",
233
+ // Clicksign v1 cancels via PATCH /api/v1/documents/{key}/cancel.
234
+ method: "PATCH",
148
235
  ...withAccessToken(baseUrl, `${clicksignDocumentPath(id)}/cancel`, options.accessToken),
149
236
  });
150
237
  const deleteClicksignSignatureRequestInternal = (http, options, baseUrl, id) => http
@@ -154,6 +241,13 @@ const deleteClicksignSignatureRequestInternal = (http, options, baseUrl, id) =>
154
241
  ...withAccessToken(baseUrl, clicksignDocumentPath(id), options.accessToken),
155
242
  })
156
243
  .pipe(Effect.catchIf((error) => error.code === SignatureKitErrorCodeValue.http && error.status === 404, () => Effect.void));
244
+ const shouldRollbackClicksignCreate = (error) => error.code === SignatureKitErrorCodeValue.http &&
245
+ error.status !== undefined &&
246
+ error.status >= 400 &&
247
+ error.status < 500 &&
248
+ error.status !== 408 &&
249
+ error.status !== 409 &&
250
+ error.status !== 429;
157
251
  const isAbsoluteHttpUrl = (value) => value.startsWith("http://") || value.startsWith("https://");
158
252
  const clicksignDownloadPath = (path) => (path.startsWith("/") ? path : `/${path}`);
159
253
  const isClicksignDownloadHost = (baseUrl, downloadUrl) => {
@@ -168,8 +262,11 @@ const clicksignDownloadTarget = (baseUrl, downloadUrl, accessToken) => {
168
262
  if (!isClicksignDownloadHost(baseUrl, downloadUrl))
169
263
  return { url: downloadUrl };
170
264
  const parsed = new URL(downloadUrl);
171
- if (parsed.searchParams.has("access_token"))
172
- return { url: downloadUrl, diagnosticUrl: downloadUrl };
265
+ if (parsed.searchParams.has("access_token")) {
266
+ const diagnosticUrl = new URL(downloadUrl);
267
+ diagnosticUrl.searchParams.set("access_token", "<redacted>");
268
+ return { url: downloadUrl, diagnosticUrl: diagnosticUrl.toString() };
269
+ }
173
270
  const targetUrl = new URL(downloadUrl);
174
271
  const diagnosticUrl = new URL(downloadUrl);
175
272
  targetUrl.searchParams.set("access_token", Redacted.value(accessToken));
@@ -185,11 +282,15 @@ const downloadClicksignSignedDocumentInternal = (http, options, baseUrl, id) =>
185
282
  ...clicksignDownloadTarget(baseUrl, signedDocumentUrl, options.accessToken),
186
283
  });
187
284
  }
188
- return http.requestBytes({
285
+ // No downloads.*_url on the document yet — Clicksign only exposes the
286
+ // signed file once signing finishes; there is no generic download route.
287
+ return Effect.fail(new SignatureKitError({
288
+ code: SignatureKitErrorCodeValue.unsupportedOperation,
289
+ retryable: false,
189
290
  provider: PROVIDER,
190
- method: "GET",
191
- ...withAccessToken(baseUrl, clicksignDocumentDownloadPath(id), options.accessToken),
192
- });
291
+ operation: ClicksignOperation.download,
292
+ reason: `Clicksign document ${id} has no signed file to download yet (status: ${request.providerStatus ?? "unknown"}).`,
293
+ }));
193
294
  }));
194
295
  export const ClicksignSignatureRequest = Resource("SignatureKit.ClicksignSignatureRequest", { defaultRemovalPolicy: "retain" });
195
296
  export class ClicksignCredentials extends Context.Service()("@signature-kit/clicksign/Credentials") {
@@ -199,7 +300,7 @@ export const clicksignCredentialsLayer = (options) => Layer.effect(ClicksignCred
199
300
  retryable: false,
200
301
  provider: PROVIDER,
201
302
  operation: SignatureKitOperationValue.schemaDecode,
202
- schemaName: SignatureKitSchemaNameValue.clicksignProviderOptions,
303
+ schemaName: ClicksignSchemaName.providerOptions,
203
304
  issueMessage: String(issue),
204
305
  }))));
205
306
  const clicksignBaseUrl = (options) => {
@@ -232,11 +333,13 @@ const createDocument = (http, options, baseUrl, input, document) => http
232
333
  deadline_at: input.expiresAt?.toISOString(),
233
334
  auto_close: options.autoClose ?? true,
234
335
  locale: options.locale ?? "pt-BR",
235
- sequence_enabled: input.recipients.length > 1 ||
236
- input.recipients.some((recipient) => recipient.routingOrder !== undefined),
336
+ // Only serialize signing when the caller asked for an order —
337
+ // multiple recipients without routingOrder sign in parallel, like
338
+ // every other provider.
339
+ sequence_enabled: input.recipients.some((recipient) => recipient.routingOrder !== undefined),
237
340
  },
238
341
  }),
239
- }, ClicksignDocumentResultSchema, SignatureKitSchemaNameValue.clicksignDocumentResult)
342
+ }, ClicksignDocumentResultSchema, ClicksignSchemaName.documentResult)
240
343
  .pipe(Effect.map((result) => result.document.key));
241
344
  const createSigner = (http, options, baseUrl, recipient) => http
242
345
  .requestJson({
@@ -252,7 +355,7 @@ const createSigner = (http, options, baseUrl, recipient) => http
252
355
  has_documentation: false,
253
356
  },
254
357
  }),
255
- }, ClicksignSignerResultSchema, SignatureKitSchemaNameValue.clicksignSignerResult)
358
+ }, ClicksignSignerResultSchema, ClicksignSchemaName.signerResult)
256
359
  .pipe(Effect.map((result) => result.signer.key));
257
360
  const linkRecipient = (http, options, baseUrl, documentKey, signerKey, recipient, index, message) => http
258
361
  .requestJson({
@@ -269,7 +372,7 @@ const linkRecipient = (http, options, baseUrl, documentKey, signerKey, recipient
269
372
  message,
270
373
  },
271
374
  }),
272
- }, ClicksignListResultSchema, SignatureKitSchemaNameValue.clicksignListResult)
375
+ }, ClicksignListResultSchema, ClicksignSchemaName.listResult)
273
376
  .pipe(Effect.map((result) => result.list.request_signature_key));
274
377
  const notifyRecipient = (http, options, baseUrl, requestSignatureKey, input) => http.requestVoid({
275
378
  provider: PROVIDER,
@@ -282,31 +385,13 @@ const notifyRecipient = (http, options, baseUrl, requestSignatureKey, input) =>
282
385
  url: input.redirectUrl,
283
386
  }),
284
387
  });
285
- const createRemoteRequest = (http, options, baseUrl, input) => {
286
- const document = input.documents[0];
287
- if (input.documents.length !== 1 || document === undefined) {
288
- return Effect.fail(new SignatureKitError({
289
- code: SignatureKitErrorCodeValue.unsupportedOperation,
290
- retryable: false,
291
- provider: PROVIDER,
292
- operation: SignatureKitOperationValue.remoteCreate,
293
- reason: "Clicksign API v1 supports one uploaded document per signature request.",
294
- }));
295
- }
296
- return createDocument(http, options, baseUrl, input, document).pipe(Effect.flatMap((documentKey) => Effect.forEach(input.recipients, (recipient, index) => createSigner(http, options, baseUrl, recipient).pipe(Effect.flatMap((signerKey) => linkRecipient(http, options, baseUrl, documentKey, signerKey, recipient, index, input.message)))).pipe(Effect.flatMap((requestSignatureKeys) => input.send === false
388
+ const createClicksignSignatureRequest = (http, options, baseUrl, input) => {
389
+ const [document] = input.documents;
390
+ return createDocument(http, options, baseUrl, input, document).pipe(Effect.flatMap((documentKey) => Effect.forEach(input.recipients, (recipient, index) => createSigner(http, options, baseUrl, recipient).pipe(Effect.flatMap((signerKey) => linkRecipient(http, options, baseUrl, documentKey, signerKey, recipient, index, input.message))), { concurrency: 4 }).pipe(Effect.catch((error) => shouldRollbackClicksignCreate(error)
391
+ ? deleteClicksignSignatureRequestInternal(http, options, baseUrl, documentKey).pipe(Effect.catch(() => Effect.void), Effect.flatMap(() => Effect.fail(error)))
392
+ : Effect.fail(error)), Effect.flatMap((requestSignatureKeys) => input.send === false
297
393
  ? Effect.succeed({ documentKey })
298
- : Effect.forEach(requestSignatureKeys, (requestSignatureKey) => notifyRecipient(http, options, baseUrl, requestSignatureKey, input), { discard: true }).pipe(Effect.as({ documentKey }))), Effect.catch((error) => deleteClicksignSignatureRequestInternal(http, options, baseUrl, documentKey).pipe(Effect.catch(() => Effect.void), Effect.flatMap(() => Effect.fail(error)))), Effect.mapError((error) => new SignatureKitError({
299
- code: error.code,
300
- retryable: error.retryable,
301
- provider: error.provider ?? PROVIDER,
302
- operation: SignatureKitOperationValue.remoteCreate,
303
- status: error.status,
304
- schemaName: error.schemaName,
305
- issueMessage: error.issueMessage,
306
- reason: error.reason === undefined
307
- ? `Clicksign create for document ${documentKey} failed after document creation.`
308
- : `Clicksign create for document ${documentKey} failed after document creation: ${error.reason}`,
309
- })))), Effect.map(({ documentKey }) => ({
394
+ : Effect.forEach(requestSignatureKeys, (requestSignatureKey) => notifyRecipient(http, options, baseUrl, requestSignatureKey, input), { concurrency: 4, discard: true }).pipe(Effect.as({ documentKey }))))), Effect.map(({ documentKey }) => ({
310
395
  provider: PROVIDER,
311
396
  id: documentKey,
312
397
  state: input.send === false ? "draft" : "sent",
@@ -317,16 +402,19 @@ export const ClicksignSignatureRequestProvider = () => Provider.effect(Clicksign
317
402
  const http = yield* SignatureHttpClient;
318
403
  const baseUrl = clicksignBaseUrl(options);
319
404
  return ClicksignSignatureRequest.Provider.of({
320
- diff: ({ olds }) => Effect.succeed(olds === undefined ? undefined : { action: "noop" }),
321
- list: () => listClicksignSignatureRequestsInternal(http, options, baseUrl),
405
+ nuke: { skip: true },
406
+ diff: clicksignSignatureRequestDiff,
407
+ list: () =>
408
+ // Retained resources must not feed account-wide nuke enumeration.
409
+ Effect.succeed([]),
322
410
  read: ({ output }) => output === undefined
323
411
  ? Effect.succeed(undefined)
324
412
  : getClicksignSignatureRequestInternal(http, options, baseUrl, output.id).pipe(Effect.catchIf((error) => error.code === SignatureKitErrorCodeValue.http && error.status === 404, () => Effect.succeed(undefined))),
325
413
  reconcile: Effect.fn(function* ({ news, output }) {
326
414
  if (output !== undefined)
327
415
  return output;
328
- const input = yield* remoteSignatureInputFromResourceProps(PROVIDER, news);
329
- return yield* createRemoteRequest(http, options, baseUrl, input);
416
+ const input = yield* clicksignSignatureRequestInputFromResourceProps(news);
417
+ return yield* createClicksignSignatureRequest(http, options, baseUrl, input);
330
418
  }),
331
419
  delete: ({ output }) => deleteClicksignSignatureRequestInternal(http, options, baseUrl, output.id),
332
420
  });
@@ -340,7 +428,7 @@ export const getClicksignSignatureRequest = (options, id) => Effect.gen(function
340
428
  retryable: false,
341
429
  provider: PROVIDER,
342
430
  operation: SignatureKitOperationValue.schemaDecode,
343
- schemaName: SignatureKitSchemaNameValue.clicksignProviderOptions,
431
+ schemaName: ClicksignSchemaName.providerOptions,
344
432
  issueMessage: String(issue),
345
433
  })));
346
434
  const http = yield* SignatureHttpClient;
@@ -352,7 +440,7 @@ export const listClicksignSignatureRequests = (options) => Effect.gen(function*
352
440
  retryable: false,
353
441
  provider: PROVIDER,
354
442
  operation: SignatureKitOperationValue.schemaDecode,
355
- schemaName: SignatureKitSchemaNameValue.clicksignProviderOptions,
443
+ schemaName: ClicksignSchemaName.providerOptions,
356
444
  issueMessage: String(issue),
357
445
  })));
358
446
  const http = yield* SignatureHttpClient;
@@ -364,7 +452,7 @@ export const cancelClicksignSignatureRequest = (options, id) => Effect.gen(funct
364
452
  retryable: false,
365
453
  provider: PROVIDER,
366
454
  operation: SignatureKitOperationValue.schemaDecode,
367
- schemaName: SignatureKitSchemaNameValue.clicksignProviderOptions,
455
+ schemaName: ClicksignSchemaName.providerOptions,
368
456
  issueMessage: String(issue),
369
457
  })));
370
458
  const http = yield* SignatureHttpClient;
@@ -376,7 +464,7 @@ export const deleteClicksignSignatureRequest = (options, id) => Effect.gen(funct
376
464
  retryable: false,
377
465
  provider: PROVIDER,
378
466
  operation: SignatureKitOperationValue.schemaDecode,
379
- schemaName: SignatureKitSchemaNameValue.clicksignProviderOptions,
467
+ schemaName: ClicksignSchemaName.providerOptions,
380
468
  issueMessage: String(issue),
381
469
  })));
382
470
  const http = yield* SignatureHttpClient;
@@ -388,7 +476,7 @@ export const downloadClicksignSignedDocument = (options, id) => Effect.gen(funct
388
476
  retryable: false,
389
477
  provider: PROVIDER,
390
478
  operation: SignatureKitOperationValue.schemaDecode,
391
- schemaName: SignatureKitSchemaNameValue.clicksignProviderOptions,
479
+ schemaName: ClicksignSchemaName.providerOptions,
392
480
  issueMessage: String(issue),
393
481
  })));
394
482
  const http = yield* SignatureHttpClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signature-kit/clicksign",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist",
@@ -27,8 +27,9 @@
27
27
  "test": "vitest run"
28
28
  },
29
29
  "dependencies": {
30
- "@signature-kit/core": "^0.2.0",
31
- "@signature-kit/crypto": "^0.2.0",
30
+ "@signature-kit/crypto": "^0.2.1",
31
+ "@signature-kit/http": "^0.1.0",
32
+ "@signature-kit/signatures": "^0.1.0",
32
33
  "alchemy": "2.0.0-beta.57",
33
34
  "effect": "4.0.0-beta.86"
34
35
  },