@pacspace-io/sdk 0.1.0 → 0.2.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 (40) hide show
  1. package/README.md +65 -9
  2. package/dist/client.d.ts +33 -2
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +294 -19
  5. package/dist/client.js.map +1 -1
  6. package/dist/errors/index.d.ts +24 -1
  7. package/dist/errors/index.d.ts.map +1 -1
  8. package/dist/errors/index.js +44 -4
  9. package/dist/errors/index.js.map +1 -1
  10. package/dist/index.d.ts +49 -11
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +106 -7
  13. package/dist/index.js.map +1 -1
  14. package/dist/resources/balance.d.ts +207 -13
  15. package/dist/resources/balance.d.ts.map +1 -1
  16. package/dist/resources/balance.js +356 -16
  17. package/dist/resources/balance.js.map +1 -1
  18. package/dist/resources/submission.d.ts +79 -0
  19. package/dist/resources/submission.d.ts.map +1 -0
  20. package/dist/resources/submission.js +398 -0
  21. package/dist/resources/submission.js.map +1 -0
  22. package/dist/types/balance.d.ts +489 -19
  23. package/dist/types/balance.d.ts.map +1 -1
  24. package/dist/types/config.d.ts +51 -1
  25. package/dist/types/config.d.ts.map +1 -1
  26. package/dist/types/submission.d.ts +125 -0
  27. package/dist/types/submission.d.ts.map +1 -0
  28. package/dist/types/submission.js +3 -0
  29. package/dist/types/submission.js.map +1 -0
  30. package/dist/webhooks/index.d.ts +1 -1
  31. package/dist/webhooks/index.d.ts.map +1 -1
  32. package/dist/webhooks/types.d.ts +27 -31
  33. package/dist/webhooks/types.d.ts.map +1 -1
  34. package/dist/webhooks/types.js +0 -3
  35. package/dist/webhooks/types.js.map +1 -1
  36. package/dist/webhooks/verify.d.ts +5 -0
  37. package/dist/webhooks/verify.d.ts.map +1 -1
  38. package/dist/webhooks/verify.js +19 -4
  39. package/dist/webhooks/verify.js.map +1 -1
  40. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebhookVerificationError = exports.TimeoutError = exports.ValidationError = exports.RateLimitError = exports.ContractNotDeployedError = exports.NotFoundError = exports.InsufficientCreditsError = exports.InvalidApiKeyError = exports.PacSpaceError = void 0;
3
+ exports.WebhookVerificationError = exports.TimeoutError = exports.ValidationError = exports.ServiceUnavailableError = exports.CadenceLimitError = exports.RateLimitError = exports.ContractNotDeployedError = exports.NotFoundError = exports.InsufficientCreditsError = exports.InvalidApiKeyError = exports.PacSpaceError = void 0;
4
4
  exports.mapApiError = mapApiError;
5
5
  /**
6
6
  * Base error class for all PacSpace SDK errors.
@@ -69,6 +69,33 @@ class RateLimitError extends PacSpaceError {
69
69
  }
70
70
  }
71
71
  exports.RateLimitError = RateLimitError;
72
+ /**
73
+ * Thrown when a customer's submission cadence window has not elapsed (HTTP 429).
74
+ * This error is terminal for the current request and should not be auto-retried.
75
+ */
76
+ class CadenceLimitError extends PacSpaceError {
77
+ constructor(message = 'Submission cadence limit reached', retryAfterSeconds = null, customerId = null, requestPath) {
78
+ super(message, 429, 'CADENCE_LIMIT', requestPath);
79
+ this.name = 'CadenceLimitError';
80
+ this.retryAfterMs =
81
+ retryAfterSeconds && Number.isFinite(retryAfterSeconds)
82
+ ? Math.max(0, Math.floor(retryAfterSeconds * 1000))
83
+ : null;
84
+ this.customerId = customerId;
85
+ }
86
+ }
87
+ exports.CadenceLimitError = CadenceLimitError;
88
+ /**
89
+ * Thrown when the API is temporarily unavailable (HTTP 503).
90
+ */
91
+ class ServiceUnavailableError extends PacSpaceError {
92
+ constructor(message = 'Service temporarily unavailable', retryAfter = null, requestPath) {
93
+ super(message, 503, 'SERVICE_UNAVAILABLE', requestPath);
94
+ this.name = 'ServiceUnavailableError';
95
+ this.retryAfter = retryAfter;
96
+ }
97
+ }
98
+ exports.ServiceUnavailableError = ServiceUnavailableError;
72
99
  /**
73
100
  * Thrown when the API returns a validation error (HTTP 400).
74
101
  */
@@ -103,7 +130,15 @@ exports.WebhookVerificationError = WebhookVerificationError;
103
130
  * Map an HTTP status code + API response to the appropriate typed error.
104
131
  * @internal
105
132
  */
106
- function mapApiError(statusCode, message, requestPath, headers) {
133
+ function mapApiError(statusCode, message, requestPath, headers, apiError) {
134
+ const headerRetryAfter = headers?.get('retry-after');
135
+ const parsedHeaderRetryAfter = headerRetryAfter
136
+ ? Number.parseInt(headerRetryAfter, 10)
137
+ : null;
138
+ const retryAfterSeconds = apiError?.retryAfterSeconds ??
139
+ (Number.isFinite(parsedHeaderRetryAfter)
140
+ ? parsedHeaderRetryAfter
141
+ : null);
107
142
  switch (statusCode) {
108
143
  case 400:
109
144
  return new ValidationError(message, requestPath);
@@ -116,8 +151,13 @@ function mapApiError(statusCode, message, requestPath, headers) {
116
151
  case 412:
117
152
  return new ContractNotDeployedError(message, requestPath);
118
153
  case 429: {
119
- const retryAfter = headers?.get('retry-after');
120
- return new RateLimitError(message, retryAfter ? parseInt(retryAfter, 10) : null, requestPath);
154
+ if (apiError?.code === 'CADENCE_LIMIT') {
155
+ return new CadenceLimitError(message, retryAfterSeconds, apiError.customerId ?? null, requestPath);
156
+ }
157
+ return new RateLimitError(message, retryAfterSeconds, requestPath);
158
+ }
159
+ case 503: {
160
+ return new ServiceUnavailableError(message, retryAfterSeconds, requestPath);
121
161
  }
122
162
  default:
123
163
  return new PacSpaceError(message, statusCode, 'API_ERROR', requestPath);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";;;AAkIA,kCA4BC;AA9JD;;;GAGG;AACH,MAAa,aAAc,SAAQ,KAAK;IAQtC,YACE,OAAe,EACf,UAAkB,EAClB,IAAY,EACZ,WAAoB;QAEpB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,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AI,IAAI,EAC3B,WAAW,CACZ,CAAC;YACJ,CAAC;YACD,OAAO,IAAI,cAAc,CACvB,OAAO,EACP,iBAAiB,EACjB,WAAW,CACZ,CAAC;QACJ,CAAC;QACD,KAAK,GAAG,CAAC,CAAC,CAAC;YACT,OAAO,IAAI,uBAAuB,CAChC,OAAO,EACP,iBAAiB,EACjB,WAAW,CACZ,CAAC;QACJ,CAAC;QACD;YACE,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { BalanceResource } from './resources/balance';
2
2
  import { Webhooks } from './webhooks/verify';
3
3
  import type { PacSpaceConfig } from './types/config';
4
+ import type { VerifyResponse } from './types/balance';
4
5
  /**
5
6
  * PacSpace SDK — the official TypeScript client for the PacSpace Balance API.
6
7
  *
@@ -22,15 +23,24 @@ import type { PacSpaceConfig } from './types/config';
22
23
  * theirs: 98000,
23
24
  * });
24
25
  *
25
- * // Period-end checkpoint
26
- * const checkpoint = await pac.balance.checkpoint('cust_123', {
27
- * period: '2026-02',
28
- * });
26
+ * // Period-end receipt (shareable verification proof)
27
+ * const receipt = await pac.balance.receipt('cust_123', { period: '2026-02' });
28
+ *
29
+ * // Verify a proof root (public, no auth)
30
+ * const verification = await pac.verify(receipt.proofRoot);
29
31
  * ```
30
32
  */
31
33
  export declare class PacSpace {
34
+ /**
35
+ * Preferred SDK initializer for Phase 3 surface.
36
+ */
37
+ static init(apiKey: string, options?: Omit<PacSpaceConfig, 'apiKey'>): PacSpace;
32
38
  /** @internal */
33
39
  private readonly client;
40
+ /** Base URL for API (used by verify, which requires no auth). */
41
+ private readonly baseUrl;
42
+ private readonly fetchFn;
43
+ private readonly timeoutMs;
34
44
  /**
35
45
  * Balance API resource — emit deltas, derive balances, compare, receipt, checkpoint.
36
46
  */
@@ -45,20 +55,48 @@ export declare class PacSpace {
45
55
  *
46
56
  * @param config - SDK configuration.
47
57
  * @param config.apiKey - Your PacSpace API key (required).
48
- * @param config.baseUrl - API base URL (optional, defaults to production).
58
+ * @param config.baseUrl - API base URL (optional, overrides auto-routing).
59
+ * @param config.sandboxUrl - Custom sandbox URL (optional, used for `pk_test_*` keys).
60
+ * @param config.productionUrl - Custom production URL (optional, used for `pk_live_*` keys).
49
61
  * @param config.chainId - Default chain ID (optional, auto-detected from key prefix).
50
62
  * @param config.maxRetries - Max retries on transient errors (default: 2).
51
63
  * @param config.timeout - Request timeout in ms (default: 30000).
52
64
  */
53
- constructor(config: PacSpaceConfig & {
54
- webhookSecret?: string;
55
- });
65
+ constructor(config: PacSpaceConfig);
66
+ /**
67
+ * Close the SDK client and reject buffered write requests.
68
+ */
69
+ close(reason?: string): void;
70
+ /**
71
+ * Graceful shutdown: flush summary queue and close the client.
72
+ */
73
+ shutdown(reason?: string): Promise<void>;
74
+ /**
75
+ * Verify a proof root via the public verification endpoint.
76
+ *
77
+ * No API key required — the proof root itself serves as the access key.
78
+ * Anyone with a proof root can verify it independently.
79
+ *
80
+ * @param proofRoot - The proof root from a receipt (hex string).
81
+ * @returns Verification result with records and metadata.
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * const result = await pac.verify('0x7f3a9b2c1d4e5f6a...');
86
+ * if (result.verified) {
87
+ * console.log(result.verification?.publicLedgerUrl);
88
+ * console.log(result.summary?.recordCount);
89
+ * }
90
+ * ```
91
+ */
92
+ verify(proofRoot: string): Promise<VerifyResponse>;
56
93
  }
57
94
  export type { PacSpaceConfig, RequestOptions } from './types/config';
58
95
  export type { AnchorStatus, CheckpointType } from './types/common';
59
- export type { EmitOptions, EmitAndWaitOptions, EmitResponse, DeriveOptions, DeriveResponse, VerifiedDelta, WindowSummary, CompareOptions, CompareBalances, CompareResponse, DiscrepancyReport, ReceiptResponse, CheckpointOptions, CheckpointResponse, } from './types/balance';
60
- export { PacSpaceError, InvalidApiKeyError, InsufficientCreditsError, NotFoundError, ContractNotDeployedError, RateLimitError, ValidationError, TimeoutError, WebhookVerificationError, } from './errors';
96
+ export type { EmitOptions, EmitAndWaitOptions, EmitResponse, DeriveOptions, DeriveResponse, VerifiedDelta, WindowSummary, CompareOptions, CompareBalances, CompareResponse, DiscrepancyReport, ReceiptResponse, CheckpointOptions, CheckpointResponse, DeltaStatusResponse, WaitForAnchoredOptions, UsageResponse, SequenceGapsOptions, SequenceGapRange, SequenceGapsResponse, BulkDelta, BulkEmitOptions, BulkEmitResponse, BulkDeltaResult, ListWebhookDeliveriesOptions, ListWebhookDeliveriesResponse, CustomerLedgerSummary, CustomerLedgerDetail, CustomerLedgerActivity, ListCustomersOptions, ListCustomersResponse, GetCustomerOptions, InvoiceProofOptions, InvoiceProofResponse, InvoiceProofDelta, InvoiceProofWindowSummary, InvoiceProofVerification, VerifyResponse, VerifySummary, VerifyRecord, VerifyVerification, } from './types/balance';
97
+ export type { SubmissionProfile, SubmissionAutomationOptions, CustomerUsageSummary, QueuedUsageSummary, FlushSummariesOptions, SummaryFlushFailure, SummaryFlushResult, SubmissionQueueState, } from './types/submission';
98
+ export { PacSpaceError, InvalidApiKeyError, InsufficientCreditsError, NotFoundError, ContractNotDeployedError, CadenceLimitError, RateLimitError, ServiceUnavailableError, ValidationError, TimeoutError, WebhookVerificationError, } from './errors';
61
99
  export { Webhooks } from './webhooks/verify';
62
100
  export type { VerifyOptions, } from './webhooks/verify';
63
- export type { WebhookEventType, WebhookEvent, WebhookEventMap, WebhookHeaders, DeltaVerifiedPayload, DeltaStoredPayload, CheckpointVerifiedPayload, FactVerifiedPayload, RecordTransferredPayload, } from './webhooks/types';
101
+ export type { KnownWebhookEventType, WebhookEventType, WebhookEvent, WebhookEventMap, WebhookHeaders, DeltaVerifiedPayload, DeltaFailedPayload, } from './webhooks/types';
64
102
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAC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AgB,CAAC;AAGnE,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,4BAA4B,EAC5B,6BAA6B,EAC7B,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACxB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,iBAAiB,EACjB,2BAA2B,EAC3B,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,wBAAwB,EACxB,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,eAAe,EACf,YAAY,EACZ,wBAAwB,GACzB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,YAAY,EACV,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Webhooks = exports.WebhookVerificationError = exports.TimeoutError = exports.ValidationError = exports.RateLimitError = exports.ContractNotDeployedError = exports.NotFoundError = exports.InsufficientCreditsError = exports.InvalidApiKeyError = exports.PacSpaceError = exports.PacSpace = void 0;
3
+ exports.Webhooks = exports.WebhookVerificationError = exports.TimeoutError = exports.ValidationError = exports.ServiceUnavailableError = exports.RateLimitError = exports.CadenceLimitError = exports.ContractNotDeployedError = exports.NotFoundError = exports.InsufficientCreditsError = exports.InvalidApiKeyError = exports.PacSpaceError = exports.PacSpace = void 0;
4
4
  const client_1 = require("./client");
5
5
  const balance_1 = require("./resources/balance");
6
6
  const verify_1 = require("./webhooks/verify");
7
+ /** Default sandbox API base URL. */
8
+ const DEFAULT_SANDBOX_URL = 'https://api-sandbox-wnizuypena-uw.a.run.app';
9
+ /** Default production API base URL. */
10
+ const DEFAULT_PRODUCTION_URL = 'https://api.pacspace.io';
7
11
  /**
8
12
  * PacSpace SDK — the official TypeScript client for the PacSpace Balance API.
9
13
  *
@@ -25,30 +29,123 @@ const verify_1 = require("./webhooks/verify");
25
29
  * theirs: 98000,
26
30
  * });
27
31
  *
28
- * // Period-end checkpoint
29
- * const checkpoint = await pac.balance.checkpoint('cust_123', {
30
- * period: '2026-02',
31
- * });
32
+ * // Period-end receipt (shareable verification proof)
33
+ * const receipt = await pac.balance.receipt('cust_123', { period: '2026-02' });
34
+ *
35
+ * // Verify a proof root (public, no auth)
36
+ * const verification = await pac.verify(receipt.proofRoot);
32
37
  * ```
33
38
  */
34
39
  class PacSpace {
40
+ /**
41
+ * Preferred SDK initializer for Phase 3 surface.
42
+ */
43
+ static init(apiKey, options = {}) {
44
+ return new PacSpace({ apiKey, ...options });
45
+ }
35
46
  /**
36
47
  * Create a new PacSpace SDK instance.
37
48
  *
38
49
  * @param config - SDK configuration.
39
50
  * @param config.apiKey - Your PacSpace API key (required).
40
- * @param config.baseUrl - API base URL (optional, defaults to production).
51
+ * @param config.baseUrl - API base URL (optional, overrides auto-routing).
52
+ * @param config.sandboxUrl - Custom sandbox URL (optional, used for `pk_test_*` keys).
53
+ * @param config.productionUrl - Custom production URL (optional, used for `pk_live_*` keys).
41
54
  * @param config.chainId - Default chain ID (optional, auto-detected from key prefix).
42
55
  * @param config.maxRetries - Max retries on transient errors (default: 2).
43
56
  * @param config.timeout - Request timeout in ms (default: 30000).
44
57
  */
45
58
  constructor(config) {
59
+ // HttpClient handles base URL auto-routing internally
46
60
  this.client = new client_1.HttpClient(config);
47
- this.balance = new balance_1.BalanceResource(this.client);
61
+ this.fetchFn = config.fetch || globalThis.fetch;
62
+ this.timeoutMs = config.timeout ?? 30000;
63
+ // For verify() method, we need to determine base URL ourselves
64
+ // Use explicit baseUrl if provided, otherwise auto-route
65
+ if (config.baseUrl) {
66
+ this.baseUrl = config.baseUrl.replace(/\/+$/, '');
67
+ }
68
+ else {
69
+ const apiKey = config.apiKey;
70
+ if (apiKey.startsWith('pk_test_')) {
71
+ this.baseUrl = (config.sandboxUrl || DEFAULT_SANDBOX_URL).replace(/\/+$/, '');
72
+ }
73
+ else if (apiKey.startsWith('pk_live_')) {
74
+ this.baseUrl = (config.productionUrl || DEFAULT_PRODUCTION_URL).replace(/\/+$/, '');
75
+ }
76
+ else {
77
+ // Fallback to production
78
+ this.baseUrl = (config.productionUrl || DEFAULT_PRODUCTION_URL).replace(/\/+$/, '');
79
+ }
80
+ }
81
+ this.balance = new balance_1.BalanceResource(this.client, config.submission);
48
82
  if (config.webhookSecret) {
49
83
  this.webhooks = new verify_1.Webhooks(config.webhookSecret);
50
84
  }
51
85
  }
86
+ /**
87
+ * Close the SDK client and reject buffered write requests.
88
+ */
89
+ close(reason) {
90
+ this.balance.stopSummaryScheduler();
91
+ this.client.close(reason);
92
+ }
93
+ /**
94
+ * Graceful shutdown: flush summary queue and close the client.
95
+ */
96
+ async shutdown(reason = 'SDK shutdown') {
97
+ await this.balance.shutdownSummaryScheduler();
98
+ this.client.close(reason);
99
+ }
100
+ /**
101
+ * Verify a proof root via the public verification endpoint.
102
+ *
103
+ * No API key required — the proof root itself serves as the access key.
104
+ * Anyone with a proof root can verify it independently.
105
+ *
106
+ * @param proofRoot - The proof root from a receipt (hex string).
107
+ * @returns Verification result with records and metadata.
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * const result = await pac.verify('0x7f3a9b2c1d4e5f6a...');
112
+ * if (result.verified) {
113
+ * console.log(result.verification?.publicLedgerUrl);
114
+ * console.log(result.summary?.recordCount);
115
+ * }
116
+ * ```
117
+ */
118
+ async verify(proofRoot) {
119
+ const url = `${this.baseUrl}/api/v1/verify/${encodeURIComponent(proofRoot)}`;
120
+ const controller = new AbortController();
121
+ const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs);
122
+ let response;
123
+ try {
124
+ response = await this.fetchFn(url, {
125
+ method: 'GET',
126
+ signal: controller.signal,
127
+ });
128
+ }
129
+ catch (error) {
130
+ if (error instanceof Error && error.name === 'AbortError') {
131
+ throw new Error(`Verification request timed out after ${this.timeoutMs}ms`);
132
+ }
133
+ throw error;
134
+ }
135
+ finally {
136
+ clearTimeout(timeoutId);
137
+ }
138
+ if (!response.ok) {
139
+ const body = (await response.json().catch(() => ({})));
140
+ const msg = body.error ?? body.message ?? response.statusText;
141
+ throw new Error(`Verification failed: ${msg}`);
142
+ }
143
+ const raw = (await response.json());
144
+ if (raw.success && raw.data !== undefined) {
145
+ return raw.data;
146
+ }
147
+ throw new Error('Verification failed: unexpected response format');
148
+ }
52
149
  }
53
150
  exports.PacSpace = PacSpace;
54
151
  // Errors
@@ -58,7 +155,9 @@ Object.defineProperty(exports, "InvalidApiKeyError", { enumerable: true, get: fu
58
155
  Object.defineProperty(exports, "InsufficientCreditsError", { enumerable: true, get: function () { return errors_1.InsufficientCreditsError; } });
59
156
  Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return errors_1.NotFoundError; } });
60
157
  Object.defineProperty(exports, "ContractNotDeployedError", { enumerable: true, get: function () { return errors_1.ContractNotDeployedError; } });
158
+ Object.defineProperty(exports, "CadenceLimitError", { enumerable: true, get: function () { return errors_1.CadenceLimitError; } });
61
159
  Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return errors_1.RateLimitError; } });
160
+ Object.defineProperty(exports, "ServiceUnavailableError", { enumerable: true, get: function () { return errors_1.ServiceUnavailableError; } });
62
161
  Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return errors_1.ValidationError; } });
63
162
  Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return errors_1.TimeoutError; } });
64
163
  Object.defineProperty(exports, "WebhookVerificationError", { enumerable: true, get: function () { return errors_1.WebhookVerificationError; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAAsC;AACtC,iDAAsD;AACtD,8CAA6C;AAG7C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,QAAQ;IAenB;;;;;;;;;OASG;IACH,YAAY,MAAmD;QAC7D,IAAI,CAAC,MAAM,GAAG,IAAI,mBAAU,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEhD,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;YACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;CACF;AAjCD,4BAiCC;AA4BD,SAAS;AACT,mCAUkB;AAThB,uGAAA,aAAa,OAAA;AACb,4GAAA,kBAAkB,OAAA;AAClB,kHAAA,wBAAwB,OAAA;AACxB,uGAAA,aAAa,OAAA;AACb,kHAAA,wBAAwB,OAAA;AACxB,wGAAA,cAAc,OAAA;AACd,yGAAA,eAAe,OAAA;AACf,sGAAA,YAAY,OAAA;AACZ,kHAAA,wBAAwB,OAAA;AAG1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OAAA;AAClB,kHAAA,wBAAwB,OAAA;AACxB,uGAAA,aAAa,OAAA;AACb,kHAAA,wBAAwB,OAAA;AACxB,2GAAA,iBAAiB,OAAA;AACjB,wGAAA,cAAc,OAAA;AACd,iHAAA,uBAAuB,OAAA;AACvB,yGAAA,eAAe,OAAA;AACf,sGAAA,YAAY,OAAA;AACZ,kHAAA,wBAAwB,OAAA;AAG1B,WAAW;AACX,4CAA6C;AAApC,kGAAA,QAAQ,OAAA"}
@@ -1,6 +1,8 @@
1
1
  import type { HttpClient } from '../client';
2
- import type { EmitOptions, EmitAndWaitOptions, EmitResponse, DeriveOptions, DeriveResponse, CompareOptions, CompareBalances, CompareResponse, ReceiptResponse, CheckpointOptions, CheckpointResponse } from '../types/balance';
2
+ import type { EmitOptions, EmitAndWaitOptions, EmitResponse, DeriveOptions, DeriveResponse, CompareOptions, CompareBalances, CompareResponse, ReceiptResponse, CheckpointOptions, CheckpointResponse, ListCheckpointsOptions, ListCheckpointsResponse, DeltaStatusResponse, WaitForAnchoredOptions, UsageResponse, SequenceGapsOptions, SequenceGapsResponse, BulkDelta, BulkEmitOptions, BulkEmitResponse, ListWebhookDeliveriesOptions, ListWebhookDeliveriesResponse, ListCustomersOptions, ListCustomersResponse, GetCustomerOptions, CustomerLedgerDetail, InvoiceProofOptions, InvoiceProofResponse } from '../types/balance';
3
3
  import type { RequestOptions } from '../types/config';
4
+ import type { CustomerUsageSummary, FlushSummariesOptions, QueuedUsageSummary, SubmissionAutomationOptions, SubmissionQueueState, SummaryFlushResult } from '../types/submission';
5
+ import { SubmissionCoordinator } from './submission';
4
6
  /**
5
7
  * PacSpace Balance API resource.
6
8
  *
@@ -14,8 +16,12 @@ import type { RequestOptions } from '../types/config';
14
16
  */
15
17
  export declare class BalanceResource {
16
18
  private readonly client;
19
+ /**
20
+ * Submission automation coordinator for tenant-produced summaries.
21
+ */
22
+ readonly submission: SubmissionCoordinator;
17
23
  /** @internal */
18
- constructor(client: HttpClient);
24
+ constructor(client: HttpClient, submissionOptions?: SubmissionAutomationOptions);
19
25
  /**
20
26
  * Record a credit or debit delta for a customer.
21
27
  *
@@ -59,6 +65,88 @@ export declare class BalanceResource {
59
65
  * ```
60
66
  */
61
67
  emitAndWait(customerId: string, delta: number, reason: string, options?: EmitAndWaitOptions): Promise<EmitResponse>;
68
+ /**
69
+ * Check the status of a previously emitted delta.
70
+ *
71
+ * @param anchorId - The anchor ID returned from emit.
72
+ * @param options - Request overrides.
73
+ * @returns Delta status with receipt and transaction details.
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * const status = await pac.balance.deltaStatus('anc_abc123');
78
+ * console.log(status.status); // 'QUEUED', 'ANCHORED', etc.
79
+ * ```
80
+ */
81
+ deltaStatus(anchorId: string, options?: RequestOptions): Promise<DeltaStatusResponse>;
82
+ /**
83
+ * Alias for `deltaStatus()` with lifecycle-oriented naming.
84
+ */
85
+ getAnchorStatus(anchorId: string, options?: RequestOptions): Promise<DeltaStatusResponse>;
86
+ /**
87
+ * Poll anchor lifecycle until it reaches a terminal status.
88
+ *
89
+ * Terminal statuses are `ANCHORED`, `VERIFIED`, and `FAILED`.
90
+ */
91
+ waitForAnchored(anchorId: string, options?: WaitForAnchoredOptions): Promise<DeltaStatusResponse>;
92
+ /**
93
+ * Retrieve tenant usage counters and remaining allotment.
94
+ */
95
+ usage(options?: RequestOptions): Promise<UsageResponse>;
96
+ /**
97
+ * Detect missing per-customer sequence ranges.
98
+ *
99
+ * Use this to identify gaps and re-emit missing deltas safely.
100
+ */
101
+ gaps(customerId: string, options?: SequenceGapsOptions): Promise<SequenceGapsResponse>;
102
+ /**
103
+ * Record multiple deltas in a single batch request.
104
+ *
105
+ * Ideal for end-of-day reconciliation or importing historical data.
106
+ * Up to 100 deltas per batch.
107
+ *
108
+ * @param deltas - Array of deltas to record.
109
+ * @param options - Request overrides.
110
+ * @returns Per-delta results with totals.
111
+ *
112
+ * @example
113
+ * ```typescript
114
+ * const result = await pac.balance.emitBatch([
115
+ * { customerId: 'cust_123', delta: -100, reason: 'usage' },
116
+ * { customerId: 'cust_456', delta: -200, reason: 'usage' },
117
+ * ]);
118
+ * console.log(result.totalQueued); // 2
119
+ * ```
120
+ */
121
+ emitBatch(deltas: BulkDelta[], options?: BulkEmitOptions): Promise<BulkEmitResponse>;
122
+ /**
123
+ * Queue one tenant-produced summary for SDK-managed submission.
124
+ */
125
+ queueSummary(summary: CustomerUsageSummary): QueuedUsageSummary;
126
+ /**
127
+ * Queue multiple tenant-produced summaries.
128
+ */
129
+ queueSummaries(summaries: CustomerUsageSummary[]): QueuedUsageSummary[];
130
+ /**
131
+ * Flush queued summaries immediately.
132
+ */
133
+ flushSummaries(options?: FlushSummariesOptions): Promise<SummaryFlushResult>;
134
+ /**
135
+ * Start periodic summary submission scheduling.
136
+ */
137
+ startSummaryScheduler(): void;
138
+ /**
139
+ * Stop periodic summary submission scheduling.
140
+ */
141
+ stopSummaryScheduler(): void;
142
+ /**
143
+ * Get queue/scheduler state for summary submission automation.
144
+ */
145
+ getSummaryQueueState(): SubmissionQueueState;
146
+ /**
147
+ * Stop scheduler and flush queued summaries (best for graceful shutdown).
148
+ */
149
+ shutdownSummaryScheduler(): Promise<void>;
62
150
  /**
63
151
  * Derive a customer's balance from all verified deltas.
64
152
  *
@@ -109,27 +197,38 @@ export declare class BalanceResource {
109
197
  /**
110
198
  * Generate a verifiable receipt for a customer.
111
199
  *
112
- * Returns a human-readable receipt containing all verified deltas
113
- * and cryptographic proof data that any party can independently verify.
200
+ * When `options.period` is provided, returns a period-specific receipt (proof root,
201
+ * verifyUrl, verificationReference) suitable for sharing on invoices. When
202
+ * omitted, returns the full ledger receipt with all verified deltas.
114
203
  *
115
204
  * @param customerId - The customer account to generate a receipt for.
116
- * @param options - Request overrides.
117
- * @returns Receipt with verification data.
205
+ * @param options - Optional period (YYYY-MM) and request overrides.
206
+ * @returns Receipt with verification data; shape depends on whether period is set.
118
207
  *
119
208
  * @example
120
209
  * ```typescript
121
- * const receipt = await pac.balance.receipt('cust_123');
122
- * console.log(receipt.finalBalance);
123
- * console.log(receipt.verification.itemHashes);
210
+ * // Period-specific receipt (shareable proof for invoices)
211
+ * const receipt = await pac.balance.receipt('cust_123', { period: '2026-02' });
212
+ * console.log(receipt.proofRoot); // Include on invoice
213
+ * console.log(receipt.verifyUrl); // Share with counterparty
214
+ *
215
+ * // Full ledger receipt
216
+ * const full = await pac.balance.receipt('cust_123');
217
+ * console.log(full.finalBalance);
124
218
  * ```
125
219
  */
126
- receipt(customerId: string, options?: RequestOptions): Promise<ReceiptResponse>;
220
+ receipt(customerId: string, options?: InvoiceProofOptions & RequestOptions): Promise<ReceiptResponse | InvoiceProofResponse>;
221
+ /**
222
+ * @internal
223
+ * Generate a period-specific receipt (proof root, verifyUrl). Used by receipt().
224
+ */
225
+ private receiptForPeriod;
127
226
  /**
128
227
  * Commit a period-end checkpoint.
129
228
  *
130
- * Computes a Merkle root over all verified deltas in the billing window
131
- * and anchors it on-chain. The checkpoint hash can be included in invoices
132
- * for instant counterparty verification.
229
+ * Computes a proof root over all verified deltas in the billing window
230
+ * and records it on the public verification layer. The proof root can be
231
+ * included in invoices for instant counterparty verification.
133
232
  *
134
233
  * @param customerId - Customer to checkpoint (omit for all customers).
135
234
  * @param options - Period (YYYY-MM) and request overrides.
@@ -144,5 +243,100 @@ export declare class BalanceResource {
144
243
  * ```
145
244
  */
146
245
  checkpoint(customerId?: string, options?: CheckpointOptions): Promise<CheckpointResponse>;
246
+ /**
247
+ * List committed checkpoints for your tenant.
248
+ *
249
+ * Returns a paginated list of checkpoints, optionally filtered by
250
+ * customer ID and/or billing period.
251
+ *
252
+ * @param options - Filter and pagination options.
253
+ * @returns Paginated list of checkpoints.
254
+ *
255
+ * @example
256
+ * ```typescript
257
+ * const { checkpoints } = await pac.balance.listCheckpoints({
258
+ * period: '2026-02',
259
+ * limit: 10,
260
+ * });
261
+ * ```
262
+ */
263
+ listCheckpoints(options?: ListCheckpointsOptions): Promise<ListCheckpointsResponse>;
264
+ /**
265
+ * List webhook delivery history.
266
+ *
267
+ * @param options - Filter and pagination options.
268
+ * @returns Paginated list of webhook deliveries.
269
+ *
270
+ * @example
271
+ * ```typescript
272
+ * const { deliveries } = await pac.balance.listWebhookDeliveries({
273
+ * status: 'failed',
274
+ * limit: 10,
275
+ * });
276
+ * ```
277
+ */
278
+ listWebhookDeliveries(options?: ListWebhookDeliveriesOptions): Promise<ListWebhookDeliveriesResponse>;
279
+ /**
280
+ * Retry a failed webhook delivery.
281
+ *
282
+ * @param eventId - The event ID of the failed delivery.
283
+ * @param options - Request overrides.
284
+ *
285
+ * @example
286
+ * ```typescript
287
+ * await pac.balance.retryWebhook('evt_abc123');
288
+ * ```
289
+ */
290
+ retryWebhook(eventId: string, options?: RequestOptions): Promise<{
291
+ eventId: string;
292
+ status: string;
293
+ message: string;
294
+ }>;
295
+ /**
296
+ * List all customer ledgers for your account.
297
+ *
298
+ * Each unique customerId passed to emit() automatically creates an
299
+ * isolated ledger. This method returns a paginated list of all ledgers.
300
+ *
301
+ * @param options - Search, pagination, and request overrides.
302
+ * @returns Paginated list of customer ledgers.
303
+ *
304
+ * @example
305
+ * ```typescript
306
+ * const { customers } = await pac.balance.customers();
307
+ * for (const c of customers) {
308
+ * console.log(c.customerId, c.totalDeltas);
309
+ * }
310
+ * ```
311
+ */
312
+ customers(options?: ListCustomersOptions): Promise<ListCustomersResponse>;
313
+ /**
314
+ * Get the full ledger detail for a specific customer.
315
+ *
316
+ * Returns the derived ledger identifier, computed balance, delta count,
317
+ * and latest checkpoint. The ledger identifier is deterministic --
318
+ * the same customerId always produces the same identifier.
319
+ *
320
+ * @param customerId - The customer to look up.
321
+ * @param options - Activity pagination and request overrides.
322
+ * @returns Customer ledger detail including balance and identifiers.
323
+ *
324
+ * @example
325
+ * ```typescript
326
+ * const ledger = await pac.balance.customer('cust_001');
327
+ * console.log(ledger.ledgerIdentifier); // 0xA1b2...Ef34
328
+ * console.log(ledger.computedBalance); // 4500.00
329
+ * ```
330
+ */
331
+ customer(customerId: string, options?: GetCustomerOptions): Promise<CustomerLedgerDetail>;
332
+ /**
333
+ * Generate an invoice-ready receipt for a customer's billing period.
334
+ *
335
+ * @deprecated Use `receipt(customerId, { period })` instead.
336
+ * @param customerId - The customer to generate the receipt for.
337
+ * @param options - Period selection and request overrides.
338
+ * @returns Receipt with proof root, verifyUrl, and verification data.
339
+ */
340
+ invoiceProof(customerId: string, options?: InvoiceProofOptions): Promise<InvoiceProofResponse>;
147
341
  }
148
342
  //# sourceMappingURL=balance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../src/resources/balance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGtD;;;;;;;;;;GAUG;AACH,qBAAa,eAAe;IAEd,OAAO,CAAC,QAAQ,CAAC,MAAM;IADnC,gBAAgB;gBACa,MAAM,EAAE,UAAU;IAM/C;;;;;;;;;;;;;;;;;;OAkBG;IACG,IAAI,CACR,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,YAAY,CAAC;IAmBxB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,WAAW,CACf,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,YAAY,CAAC;IAiCxB;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,MAAM,CACV,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,cAAc,CAAC;IA8B1B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,OAAO,CACX,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,eAAe,EACzB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,eAAe,CAAC;IAiC3B;;;;;;;;;;;;;;;;OAgBG;IACG,OAAO,CACX,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,eAAe,CAAC;IAW3B;;;;;;;;;;;;;;;;;;OAkBG;IACG,UAAU,CACd,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,kBAAkB,CAAC;CAa/B"}
1
+ {"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../src/resources/balance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,4BAA4B,EAC5B,6BAA6B,EAC7B,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,2BAA2B,EAC3B,oBAAoB,EACpB,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