@cardanowall/sdk-ts 0.3.0 → 0.4.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.
Files changed (49) hide show
  1. package/dist/client/index.cjs +1140 -363
  2. package/dist/client/index.cjs.map +1 -1
  3. package/dist/client/index.d.cts +42 -5
  4. package/dist/client/index.d.ts +42 -5
  5. package/dist/client/index.js +1138 -365
  6. package/dist/client/index.js.map +1 -1
  7. package/dist/conformance/cli.cjs +4400 -2121
  8. package/dist/conformance/cli.cjs.map +1 -1
  9. package/dist/conformance/cli.js +4401 -2122
  10. package/dist/conformance/cli.js.map +1 -1
  11. package/dist/fetch/index.cjs +33 -14
  12. package/dist/fetch/index.cjs.map +1 -1
  13. package/dist/fetch/index.d.cts +2 -2
  14. package/dist/fetch/index.d.ts +2 -2
  15. package/dist/fetch/index.js +32 -15
  16. package/dist/fetch/index.js.map +1 -1
  17. package/dist/{fetch-outbound-BT5-NiYN.d.cts → fetch-outbound-dOK3ZxYa.d.cts} +7 -3
  18. package/dist/{fetch-outbound-BT5-NiYN.d.ts → fetch-outbound-dOK3ZxYa.d.ts} +7 -3
  19. package/dist/hash/index.cjs +1 -1
  20. package/dist/hash/index.cjs.map +1 -1
  21. package/dist/hash/index.js +1 -1
  22. package/dist/hash/index.js.map +1 -1
  23. package/dist/identity/index.cjs +356 -230
  24. package/dist/identity/index.cjs.map +1 -1
  25. package/dist/identity/index.d.cts +3 -2
  26. package/dist/identity/index.d.ts +3 -2
  27. package/dist/identity/index.js +356 -230
  28. package/dist/identity/index.js.map +1 -1
  29. package/dist/index.cjs +5474 -2518
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +7 -7
  32. package/dist/index.d.ts +7 -7
  33. package/dist/index.js +5454 -2514
  34. package/dist/index.js.map +1 -1
  35. package/dist/merkle/index.cjs +1 -1
  36. package/dist/merkle/index.js +1 -1
  37. package/dist/types-Cexm4VH9.d.cts +119 -0
  38. package/dist/types-CgoBub9J.d.ts +119 -0
  39. package/dist/{types-DGsZTMuZ.d.cts → types-Dp4wUSFI.d.cts} +220 -1
  40. package/dist/{types-DGsZTMuZ.d.ts → types-Dp4wUSFI.d.ts} +220 -1
  41. package/dist/verifier/index.cjs +4419 -2147
  42. package/dist/verifier/index.cjs.map +1 -1
  43. package/dist/verifier/index.d.cts +159 -111
  44. package/dist/verifier/index.d.ts +159 -111
  45. package/dist/verifier/index.js +4407 -2143
  46. package/dist/verifier/index.js.map +1 -1
  47. package/package.json +3 -3
  48. package/dist/types-B8Q3gW54.d.ts +0 -123
  49. package/dist/types-CLXdbjqr.d.cts +0 -123
@@ -1,8 +1,8 @@
1
1
  import { PoeRecord, SigEntry } from '@cardanowall/poe-standard';
2
- import { F as FetchImpl, A as AccountBalance, Q as QuoteInput, q as QuoteResponse, B as UploadsInput, D as UploadsResponse, k as PublishInput, o as PublishResponse, f as PublishBatchInput, g as PublishBatchResponse, j as PublishContentInput, n as PublishPrehashedInput, p as PublishSealedInput, l as PublishMerkleInput, m as PublishMerkleResponse, u as RecordsListInput, v as RecordsListResponse, R as RecordResource, b as PoeVerifyInput, L as Label309ClientConfig, y as UploadFailureEntry } from '../types-DGsZTMuZ.cjs';
3
- export { C as ConformanceProfile, P as PoeItemResponse, a as PoeStatus, c as PublishBatchEntry, d as PublishBatchFailureEntry, e as PublishBatchFailureError, h as PublishBatchResultEntry, i as PublishBatchSuccessEntry, r as RecordScheme, s as RecordSignature, t as RecordStatus, S as Signer, w as StorageTarget, x as SupportedHashAlg, U as UploadEntry, z as UploadSuccessEntry } from '../types-DGsZTMuZ.cjs';
4
- import { g as VerifyReport } from '../types-CLXdbjqr.cjs';
5
- import '../fetch-outbound-BT5-NiYN.cjs';
2
+ import { F as FetchImpl, A as AccountBalance, Q as QuoteInput, q as QuoteResponse, a0 as UploadsInput, a1 as UploadsResponse, K as UploadResumableInput, M as UploadResumableResult, k as PublishInput, o as PublishResponse, f as PublishBatchInput, g as PublishBatchResponse, j as PublishContentInput, n as PublishPrehashedInput, p as PublishSealedInput, l as PublishMerkleInput, m as PublishMerkleResponse, u as RecordsListInput, v as RecordsListResponse, R as RecordResource, b as PoeVerifyInput, L as Label309ClientConfig, J as UploadFailureEntry } from '../types-Dp4wUSFI.cjs';
3
+ export { C as ConformanceProfile, P as PoeItemResponse, a as PoeStatus, c as PublishBatchEntry, d as PublishBatchFailureEntry, e as PublishBatchFailureError, h as PublishBatchResultEntry, i as PublishBatchSuccessEntry, r as RecordScheme, s as RecordSignature, t as RecordStatus, w as ResumableSource, x as ResumableSourceInput, S as Signer, y as StorageTarget, z as SupportedHashAlg, U as UploadAttemptCommitted, B as UploadAttemptReleaseReason, D as UploadAttemptReleased, E as UploadAttemptReserved, G as UploadAttemptState, H as UploadAttemptStatus, I as UploadEntry, N as UploadSessionAcceptedResponse, O as UploadSessionChunkResponse, T as UploadSessionCompleteResponse, V as UploadSessionCompletedResponse, W as UploadSessionCreateRequest, X as UploadSessionCreateResponse, Y as UploadSessionDeduplicatedResponse, Z as UploadSessionState, _ as UploadSessionStatus, $ as UploadSuccessEntry, a2 as toResumableSource } from '../types-Dp4wUSFI.cjs';
4
+ import { g as VerifyReport } from '../types-Cexm4VH9.cjs';
5
+ import '../fetch-outbound-dOK3ZxYa.cjs';
6
6
 
7
7
  type OffHostSignErrorCode = 'INVALID_PUBKEY_LENGTH' | 'INVALID_SIGNATURE_LENGTH';
8
8
  declare class OffHostSignError extends Error {
@@ -98,6 +98,36 @@ declare class PoeNamespace {
98
98
  * file as a `PartialUploadError`.
99
99
  */
100
100
  uploads(input: UploadsInput): Promise<UploadsResponse>;
101
+ /**
102
+ * Upload a single file of any size, choosing the ingress path by size.
103
+ *
104
+ * A file at or below `threshold` (default ~48 MiB) is sent with the unchanged
105
+ * single-shot `uploads()` multipart call. A larger file is uploaded as a
106
+ * resumable, content-addressed session: the helper streams the whole-file
107
+ * SHA-256 once (never buffering a multi-GB file), creates a session, PUTs each
108
+ * chunk (several in parallel, retrying a failed chunk), then completes —
109
+ * polling the shared attempt endpoint when completion is accepted
110
+ * asynchronously. Both paths converge on one `ar://` URI.
111
+ *
112
+ * The chunk size is the server's authoritative `chunk_bytes` from the create
113
+ * response, clamped to its `max_chunk_bytes` ceiling; the client's `chunkBytes`
114
+ * is only a request. A create-time dedup hit returns the existing URI without
115
+ * uploading; a `402` funding error is surfaced as a typed error.
116
+ *
117
+ * The `source` works in both runtimes: a `Blob`/`File` in the browser, a
118
+ * `Uint8Array`, a filesystem path string, or a pre-adapted `ResumableSource`
119
+ * on the server. To resume an interrupted upload, pass the prior `sessionId`;
120
+ * the helper GETs its status and uploads only the missing chunks.
121
+ */
122
+ uploadResumable(input: UploadResumableInput): Promise<UploadResumableResult>;
123
+ /**
124
+ * Upload exactly one blob via the single-shot multipart route and resolve its
125
+ * `ar://` URI. Backs the small-file branch of `uploadResumable`; it shares the
126
+ * `uploads()` wire shape but takes one blob and an optional abort signal, and
127
+ * surfaces a per-file failure as a `PartialUploadError` (the resumable helper
128
+ * promises a single resolved URI, unlike the raw `uploads()` passthrough).
129
+ */
130
+ private readonly singleShotUpload;
101
131
  /**
102
132
  * Submit a single finalised canonical-CBOR record to Cardano. Caller is
103
133
  * responsible for constructing the record bytes (use `publishContent` /
@@ -226,6 +256,13 @@ declare class PartialUploadError extends Error {
226
256
  get failedIndices(): ReadonlyArray<number>;
227
257
  }
228
258
 
259
+ declare const DEFAULT_RESUMABLE_THRESHOLD_BYTES = 50331648;
260
+ declare const DEFAULT_RESUMABLE_CHUNK_BYTES = 50331648;
261
+ declare class ResumableUploadError extends Error {
262
+ readonly code: 'SHA256_MISMATCH' | 'SESSION_FAILED' | 'ATTEMPT_FAILED' | 'ATTEMPT_POLL_TIMEOUT' | 'CHUNK_UPLOAD_FAILED' | 'ABORTED';
263
+ constructor(code: ResumableUploadError['code'], message: string);
264
+ }
265
+
229
266
  /** RFC 7807 per-field error entry. */
230
267
  interface ProblemErrorEntry {
231
268
  /** Dotted JSON path of the offending field; empty for body-level errors. */
@@ -394,4 +431,4 @@ interface ParseHttpErrorArgs {
394
431
  }
395
432
  declare function parseHttpError(args: ParseHttpErrorArgs): Label309HttpError;
396
433
 
397
- export { AccountBalance, AccountNamespace, type AssembleCoseSign1Args, type AssembleCoseSign1Result, BatchEmptyError, BatchTooLargeError, FetchImpl, ForbiddenError, IdempotencyConflictError, InsufficientFundsError, InsufficientScopeError, InternalServerError, InvalidBodyError, InvalidClientConfigError, Label309Client, Label309ClientConfig, Label309HttpError, type Label309HttpErrorInit, MalformedCborError, NotFoundError, OffHostSignError, type OffHostSignErrorCode, PartialUploadError, PoeNamespace, PoeVerifyInput, type PrepareSigStructureArgs, type PrepareSigStructureHashedResult, type PrepareSigStructureResult, type ProblemDetails, type ProblemErrorEntry, PublishBatchInput, PublishBatchResponse, PublishContentInput, PublishError, PublishInput, PublishMerkleInput, PublishMerkleResponse, PublishPrehashedInput, PublishResponse, PublishSealedInput, QuoteAlreadyConsumedError, QuoteExpiredError, QuoteInput, QuoteNotFoundError, QuoteResponse, RateLimitedError, RecordNotFoundError, RecordResource, RecordsListInput, RecordsListResponse, RecordsNamespace, ServiceUnavailableError, UnauthorizedError, UploadFailureEntry, UploadsInput, UploadsResponse, ValidationFailedError, assembleCoseSign1, assembleCoseSign1Hashed, buildToSign, parseHttpError, prepareSigStructure, prepareSigStructureHashed };
434
+ export { AccountBalance, AccountNamespace, type AssembleCoseSign1Args, type AssembleCoseSign1Result, BatchEmptyError, BatchTooLargeError, DEFAULT_RESUMABLE_CHUNK_BYTES, DEFAULT_RESUMABLE_THRESHOLD_BYTES, FetchImpl, ForbiddenError, IdempotencyConflictError, InsufficientFundsError, InsufficientScopeError, InternalServerError, InvalidBodyError, InvalidClientConfigError, Label309Client, Label309ClientConfig, Label309HttpError, type Label309HttpErrorInit, MalformedCborError, NotFoundError, OffHostSignError, type OffHostSignErrorCode, PartialUploadError, PoeNamespace, PoeVerifyInput, type PrepareSigStructureArgs, type PrepareSigStructureHashedResult, type PrepareSigStructureResult, type ProblemDetails, type ProblemErrorEntry, PublishBatchInput, PublishBatchResponse, PublishContentInput, PublishError, PublishInput, PublishMerkleInput, PublishMerkleResponse, PublishPrehashedInput, PublishResponse, PublishSealedInput, QuoteAlreadyConsumedError, QuoteExpiredError, QuoteInput, QuoteNotFoundError, QuoteResponse, RateLimitedError, RecordNotFoundError, RecordResource, RecordsListInput, RecordsListResponse, RecordsNamespace, ResumableUploadError, ServiceUnavailableError, UnauthorizedError, UploadFailureEntry, UploadResumableInput, UploadResumableResult, UploadsInput, UploadsResponse, ValidationFailedError, assembleCoseSign1, assembleCoseSign1Hashed, buildToSign, parseHttpError, prepareSigStructure, prepareSigStructureHashed };
@@ -1,8 +1,8 @@
1
1
  import { PoeRecord, SigEntry } from '@cardanowall/poe-standard';
2
- import { F as FetchImpl, A as AccountBalance, Q as QuoteInput, q as QuoteResponse, B as UploadsInput, D as UploadsResponse, k as PublishInput, o as PublishResponse, f as PublishBatchInput, g as PublishBatchResponse, j as PublishContentInput, n as PublishPrehashedInput, p as PublishSealedInput, l as PublishMerkleInput, m as PublishMerkleResponse, u as RecordsListInput, v as RecordsListResponse, R as RecordResource, b as PoeVerifyInput, L as Label309ClientConfig, y as UploadFailureEntry } from '../types-DGsZTMuZ.js';
3
- export { C as ConformanceProfile, P as PoeItemResponse, a as PoeStatus, c as PublishBatchEntry, d as PublishBatchFailureEntry, e as PublishBatchFailureError, h as PublishBatchResultEntry, i as PublishBatchSuccessEntry, r as RecordScheme, s as RecordSignature, t as RecordStatus, S as Signer, w as StorageTarget, x as SupportedHashAlg, U as UploadEntry, z as UploadSuccessEntry } from '../types-DGsZTMuZ.js';
4
- import { g as VerifyReport } from '../types-B8Q3gW54.js';
5
- import '../fetch-outbound-BT5-NiYN.js';
2
+ import { F as FetchImpl, A as AccountBalance, Q as QuoteInput, q as QuoteResponse, a0 as UploadsInput, a1 as UploadsResponse, K as UploadResumableInput, M as UploadResumableResult, k as PublishInput, o as PublishResponse, f as PublishBatchInput, g as PublishBatchResponse, j as PublishContentInput, n as PublishPrehashedInput, p as PublishSealedInput, l as PublishMerkleInput, m as PublishMerkleResponse, u as RecordsListInput, v as RecordsListResponse, R as RecordResource, b as PoeVerifyInput, L as Label309ClientConfig, J as UploadFailureEntry } from '../types-Dp4wUSFI.js';
3
+ export { C as ConformanceProfile, P as PoeItemResponse, a as PoeStatus, c as PublishBatchEntry, d as PublishBatchFailureEntry, e as PublishBatchFailureError, h as PublishBatchResultEntry, i as PublishBatchSuccessEntry, r as RecordScheme, s as RecordSignature, t as RecordStatus, w as ResumableSource, x as ResumableSourceInput, S as Signer, y as StorageTarget, z as SupportedHashAlg, U as UploadAttemptCommitted, B as UploadAttemptReleaseReason, D as UploadAttemptReleased, E as UploadAttemptReserved, G as UploadAttemptState, H as UploadAttemptStatus, I as UploadEntry, N as UploadSessionAcceptedResponse, O as UploadSessionChunkResponse, T as UploadSessionCompleteResponse, V as UploadSessionCompletedResponse, W as UploadSessionCreateRequest, X as UploadSessionCreateResponse, Y as UploadSessionDeduplicatedResponse, Z as UploadSessionState, _ as UploadSessionStatus, $ as UploadSuccessEntry, a2 as toResumableSource } from '../types-Dp4wUSFI.js';
4
+ import { g as VerifyReport } from '../types-CgoBub9J.js';
5
+ import '../fetch-outbound-dOK3ZxYa.js';
6
6
 
7
7
  type OffHostSignErrorCode = 'INVALID_PUBKEY_LENGTH' | 'INVALID_SIGNATURE_LENGTH';
8
8
  declare class OffHostSignError extends Error {
@@ -98,6 +98,36 @@ declare class PoeNamespace {
98
98
  * file as a `PartialUploadError`.
99
99
  */
100
100
  uploads(input: UploadsInput): Promise<UploadsResponse>;
101
+ /**
102
+ * Upload a single file of any size, choosing the ingress path by size.
103
+ *
104
+ * A file at or below `threshold` (default ~48 MiB) is sent with the unchanged
105
+ * single-shot `uploads()` multipart call. A larger file is uploaded as a
106
+ * resumable, content-addressed session: the helper streams the whole-file
107
+ * SHA-256 once (never buffering a multi-GB file), creates a session, PUTs each
108
+ * chunk (several in parallel, retrying a failed chunk), then completes —
109
+ * polling the shared attempt endpoint when completion is accepted
110
+ * asynchronously. Both paths converge on one `ar://` URI.
111
+ *
112
+ * The chunk size is the server's authoritative `chunk_bytes` from the create
113
+ * response, clamped to its `max_chunk_bytes` ceiling; the client's `chunkBytes`
114
+ * is only a request. A create-time dedup hit returns the existing URI without
115
+ * uploading; a `402` funding error is surfaced as a typed error.
116
+ *
117
+ * The `source` works in both runtimes: a `Blob`/`File` in the browser, a
118
+ * `Uint8Array`, a filesystem path string, or a pre-adapted `ResumableSource`
119
+ * on the server. To resume an interrupted upload, pass the prior `sessionId`;
120
+ * the helper GETs its status and uploads only the missing chunks.
121
+ */
122
+ uploadResumable(input: UploadResumableInput): Promise<UploadResumableResult>;
123
+ /**
124
+ * Upload exactly one blob via the single-shot multipart route and resolve its
125
+ * `ar://` URI. Backs the small-file branch of `uploadResumable`; it shares the
126
+ * `uploads()` wire shape but takes one blob and an optional abort signal, and
127
+ * surfaces a per-file failure as a `PartialUploadError` (the resumable helper
128
+ * promises a single resolved URI, unlike the raw `uploads()` passthrough).
129
+ */
130
+ private readonly singleShotUpload;
101
131
  /**
102
132
  * Submit a single finalised canonical-CBOR record to Cardano. Caller is
103
133
  * responsible for constructing the record bytes (use `publishContent` /
@@ -226,6 +256,13 @@ declare class PartialUploadError extends Error {
226
256
  get failedIndices(): ReadonlyArray<number>;
227
257
  }
228
258
 
259
+ declare const DEFAULT_RESUMABLE_THRESHOLD_BYTES = 50331648;
260
+ declare const DEFAULT_RESUMABLE_CHUNK_BYTES = 50331648;
261
+ declare class ResumableUploadError extends Error {
262
+ readonly code: 'SHA256_MISMATCH' | 'SESSION_FAILED' | 'ATTEMPT_FAILED' | 'ATTEMPT_POLL_TIMEOUT' | 'CHUNK_UPLOAD_FAILED' | 'ABORTED';
263
+ constructor(code: ResumableUploadError['code'], message: string);
264
+ }
265
+
229
266
  /** RFC 7807 per-field error entry. */
230
267
  interface ProblemErrorEntry {
231
268
  /** Dotted JSON path of the offending field; empty for body-level errors. */
@@ -394,4 +431,4 @@ interface ParseHttpErrorArgs {
394
431
  }
395
432
  declare function parseHttpError(args: ParseHttpErrorArgs): Label309HttpError;
396
433
 
397
- export { AccountBalance, AccountNamespace, type AssembleCoseSign1Args, type AssembleCoseSign1Result, BatchEmptyError, BatchTooLargeError, FetchImpl, ForbiddenError, IdempotencyConflictError, InsufficientFundsError, InsufficientScopeError, InternalServerError, InvalidBodyError, InvalidClientConfigError, Label309Client, Label309ClientConfig, Label309HttpError, type Label309HttpErrorInit, MalformedCborError, NotFoundError, OffHostSignError, type OffHostSignErrorCode, PartialUploadError, PoeNamespace, PoeVerifyInput, type PrepareSigStructureArgs, type PrepareSigStructureHashedResult, type PrepareSigStructureResult, type ProblemDetails, type ProblemErrorEntry, PublishBatchInput, PublishBatchResponse, PublishContentInput, PublishError, PublishInput, PublishMerkleInput, PublishMerkleResponse, PublishPrehashedInput, PublishResponse, PublishSealedInput, QuoteAlreadyConsumedError, QuoteExpiredError, QuoteInput, QuoteNotFoundError, QuoteResponse, RateLimitedError, RecordNotFoundError, RecordResource, RecordsListInput, RecordsListResponse, RecordsNamespace, ServiceUnavailableError, UnauthorizedError, UploadFailureEntry, UploadsInput, UploadsResponse, ValidationFailedError, assembleCoseSign1, assembleCoseSign1Hashed, buildToSign, parseHttpError, prepareSigStructure, prepareSigStructureHashed };
434
+ export { AccountBalance, AccountNamespace, type AssembleCoseSign1Args, type AssembleCoseSign1Result, BatchEmptyError, BatchTooLargeError, DEFAULT_RESUMABLE_CHUNK_BYTES, DEFAULT_RESUMABLE_THRESHOLD_BYTES, FetchImpl, ForbiddenError, IdempotencyConflictError, InsufficientFundsError, InsufficientScopeError, InternalServerError, InvalidBodyError, InvalidClientConfigError, Label309Client, Label309ClientConfig, Label309HttpError, type Label309HttpErrorInit, MalformedCborError, NotFoundError, OffHostSignError, type OffHostSignErrorCode, PartialUploadError, PoeNamespace, PoeVerifyInput, type PrepareSigStructureArgs, type PrepareSigStructureHashedResult, type PrepareSigStructureResult, type ProblemDetails, type ProblemErrorEntry, PublishBatchInput, PublishBatchResponse, PublishContentInput, PublishError, PublishInput, PublishMerkleInput, PublishMerkleResponse, PublishPrehashedInput, PublishResponse, PublishSealedInput, QuoteAlreadyConsumedError, QuoteExpiredError, QuoteInput, QuoteNotFoundError, QuoteResponse, RateLimitedError, RecordNotFoundError, RecordResource, RecordsListInput, RecordsListResponse, RecordsNamespace, ResumableUploadError, ServiceUnavailableError, UnauthorizedError, UploadFailureEntry, UploadResumableInput, UploadResumableResult, UploadsInput, UploadsResponse, ValidationFailedError, assembleCoseSign1, assembleCoseSign1Hashed, buildToSign, parseHttpError, prepareSigStructure, prepareSigStructureHashed };