@tinycloud/sdk-services 3.3.0-beta.11 → 3.3.0-beta.39

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 (39) hide show
  1. package/dist/{BaseService-Cc6Ueicm.d.cts → BaseService-BhfKzKke.d.cts} +5 -1
  2. package/dist/{BaseService-DOdXd7sr.d.ts → BaseService-x4AFZiEa.d.ts} +5 -1
  3. package/dist/encryption/index.cjs +18 -5
  4. package/dist/encryption/index.cjs.map +1 -1
  5. package/dist/encryption/index.d.cts +2 -2
  6. package/dist/encryption/index.d.ts +2 -2
  7. package/dist/encryption/index.js +18 -5
  8. package/dist/encryption/index.js.map +1 -1
  9. package/dist/index.cjs +660 -651
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +17 -10
  12. package/dist/index.d.ts +17 -10
  13. package/dist/index.js +660 -651
  14. package/dist/index.js.map +1 -1
  15. package/dist/internal/decrypt-transport-response-error.d.cts +1 -1
  16. package/dist/internal/decrypt-transport-response-error.d.ts +1 -1
  17. package/dist/kv/index.cjs +72 -80
  18. package/dist/kv/index.cjs.map +1 -1
  19. package/dist/kv/index.d.cts +4 -5
  20. package/dist/kv/index.d.ts +4 -5
  21. package/dist/kv/index.js +72 -80
  22. package/dist/kv/index.js.map +1 -1
  23. package/dist/kv/replication/index.cjs +6 -5
  24. package/dist/kv/replication/index.cjs.map +1 -1
  25. package/dist/kv/replication/index.d.cts +3 -3
  26. package/dist/kv/replication/index.d.ts +3 -3
  27. package/dist/kv/replication/index.js +6 -5
  28. package/dist/kv/replication/index.js.map +1 -1
  29. package/dist/{scope-B-m6cKH-.d.ts → scope-BHTkk5Yk.d.ts} +13 -2
  30. package/dist/{scope-B7oeKdLM.d.cts → scope-DMhalRFn.d.cts} +13 -2
  31. package/dist/sql/index.cjs +30 -16
  32. package/dist/sql/index.cjs.map +1 -1
  33. package/dist/sql/index.d.cts +2 -2
  34. package/dist/sql/index.d.ts +2 -2
  35. package/dist/sql/index.js +30 -16
  36. package/dist/sql/index.js.map +1 -1
  37. package/dist/{types-BjH0ZtGy.d.cts → types-eVS1Whuf.d.cts} +24 -4
  38. package/dist/{types-BjH0ZtGy.d.ts → types-eVS1Whuf.d.ts} +24 -4
  39. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
- import { B as BaseService } from '../BaseService-Cc6Ueicm.cjs';
2
- import { P as PermissionHint, I as IService, R as Result } from '../types-BjH0ZtGy.cjs';
1
+ import { B as BaseService } from '../BaseService-BhfKzKke.cjs';
2
+ import { P as PermissionHint, I as IService, R as Result } from '../types-eVS1Whuf.cjs';
3
3
  export { DecryptTransportResponseError } from '@tinycloud/sdk-services/internal/decrypt-transport-response-error';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { B as BaseService } from '../BaseService-DOdXd7sr.js';
2
- import { P as PermissionHint, I as IService, R as Result } from '../types-BjH0ZtGy.js';
1
+ import { B as BaseService } from '../BaseService-x4AFZiEa.js';
2
+ import { P as PermissionHint, I as IService, R as Result } from '../types-eVS1Whuf.js';
3
3
  export { DecryptTransportResponseError } from '@tinycloud/sdk-services/internal/decrypt-transport-response-error';
4
4
 
5
5
  /**
@@ -16,7 +16,7 @@ var ErrorCodes = {
16
16
  PERMISSION_DENIED: "PERMISSION_DENIED",
17
17
  // Node retry signals (tinycloud-node #347). `meta.retryable` says whether a
18
18
  // retry is safe; `meta.retryAfterMs` carries the node's Retry-After.
19
- /** HTTP 503 `sql_busy:<stage>` / `unavailable_retryable`: nothing was applied; retry after `meta.retryAfterMs`. */
19
+ /** HTTP 503 `sql_busy:<stage>` / `unavailable_retryable`/`read_audit_busy`: nothing was applied; retry after `meta.retryAfterMs`. */
20
20
  NODE_BUSY: "NODE_BUSY",
21
21
  /** HTTP 503 `request_timeout`: the node's deadline passed before any write began; nothing was applied. */
22
22
  REQUEST_TIMEOUT: "REQUEST_TIMEOUT",
@@ -57,11 +57,12 @@ var ErrorCodes = {
57
57
  DUCKDB_READONLY_VIOLATION: "DUCKDB_READONLY_VIOLATION"
58
58
  };
59
59
  var defaultRetryPolicy = {
60
- maxAttempts: 3,
60
+ maxAttempts: 4,
61
61
  backoff: "exponential",
62
- baseDelayMs: 1e3,
63
- maxDelayMs: 1e4,
64
- retryableErrors: [ErrorCodes.NETWORK_ERROR, ErrorCodes.TIMEOUT]
62
+ baseDelayMs: 250,
63
+ maxDelayMs: 4e3,
64
+ retryableErrors: [ErrorCodes.NODE_BUSY, ErrorCodes.REQUEST_TIMEOUT],
65
+ maxTotalMs: 12e3
65
66
  };
66
67
  var TelemetryEvents = {
67
68
  SPAN: "telemetry.span",
@@ -433,6 +434,18 @@ var BaseService = class {
433
434
  }
434
435
  return controller.signal;
435
436
  }
437
+ /** POST a signed invocation with retry; `mint` re-signs per attempt, `init.headers` add to the signed ones. */
438
+ invokeWithRetry(url, mint, { headers: extra, ...init } = {}) {
439
+ const build = () => {
440
+ const signed = mint();
441
+ return {
442
+ method: "POST",
443
+ ...init,
444
+ headers: Array.isArray(signed) ? [...signed, ...Object.entries(extra ?? {})] : { ...signed, ...extra }
445
+ };
446
+ };
447
+ return this.context.invokeWithRetry ? this.context.invokeWithRetry(url, build) : this.context.fetch(url, build());
448
+ }
436
449
  /**
437
450
  * Create the abort signal for one request, bounded by the request timeout.
438
451
  *