@relyio/sdk 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.
Files changed (36) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +5 -310
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/{chunk-7W4MJXQ4.cjs → chunk-54WP2PWG.cjs} +215 -96
  5. package/dist/chunk-BBUB7C2Z.js +81 -0
  6. package/dist/{chunk-FJK7ZWKK.cjs → chunk-HMVGXUGR.cjs} +156 -221
  7. package/dist/chunk-LSRPMNPT.cjs +89 -0
  8. package/dist/{chunk-2QUK2ZGD.js → chunk-LYRYCIX5.js} +157 -219
  9. package/dist/{chunk-RJBIJ2ZK.js → chunk-QIZOBT5F.js} +215 -96
  10. package/dist/client/index.cjs +4 -3
  11. package/dist/client/index.d.cts +4 -3
  12. package/dist/client/index.d.ts +4 -3
  13. package/dist/client/index.js +2 -1
  14. package/dist/define-content-type-CBfnTWSS.d.cts +716 -0
  15. package/dist/define-content-type-CBfnTWSS.d.ts +716 -0
  16. package/dist/{define-schema-DHvUCKwj.d.cts → define-schema-BD6HSPnG.d.ts} +55 -722
  17. package/dist/{define-schema-DHvUCKwj.d.ts → define-schema-BfXeR6K8.d.cts} +55 -722
  18. package/dist/dev-handshake/index.cjs +37 -0
  19. package/dist/dev-handshake/index.d.cts +144 -0
  20. package/dist/dev-handshake/index.d.ts +144 -0
  21. package/dist/dev-handshake/index.js +4 -0
  22. package/dist/{index-DGWaawHt.d.cts → index-BDpar3FO.d.cts} +22 -6
  23. package/dist/{index-BsUqCAu8.d.cts → index-DuEhsGdE.d.ts} +516 -2155
  24. package/dist/{index-B-KiFHbx.d.ts → index-Dx01iwaf.d.ts} +22 -6
  25. package/dist/{index-BsUqCAu8.d.ts → index-ulOrcfPa.d.cts} +516 -2155
  26. package/dist/index.cjs +67 -70
  27. package/dist/index.d.cts +28 -13
  28. package/dist/index.d.ts +28 -13
  29. package/dist/index.js +3 -2
  30. package/dist/schema/index.cjs +35 -47
  31. package/dist/schema/index.d.cts +3 -2
  32. package/dist/schema/index.d.ts +3 -2
  33. package/dist/schema/index.js +1 -1
  34. package/dist/types/index.d.cts +2 -1
  35. package/dist/types/index.d.ts +2 -1
  36. package/package.json +15 -17
@@ -1,5 +1,6 @@
1
- import { M as MergedRelyIOConfig, A as ApiPath, a as ApiMethod, G as PathParamsOf, r as ApiResponse, W as Wire, q as RequestConfig, B as BaseContent, c as WhereClause, e as SortOptions, f as ContentQueryResult, Q as QueryOptions, C as CreateInput, U as UpdateInput, S as SDKError, v as BaseValidationError, u as ValidationViolation, H as components, R as RelyIOConfig } from './index-BsUqCAu8.js';
2
- import { x as SchemaDefinition, y as SchemaContentTypeNames, a6 as InferContentType, K as SchemaAssetTypeNames, at as InferAssetType, z as SchemaSingletonNames, ac as InferSingleton, J as SchemaSettingsGroupNames, an as InferSettingsGroup, G as SchemaQueryNames, H as SchemaLocaleCodes } from './define-schema-DHvUCKwj.js';
1
+ import { M as MergedRelyIOConfig, A as ApiPath, a as ApiMethod, G as PathParamsOf, r as ApiResponse, W as Wire, q as RequestConfig, B as BaseContent, c as WhereClause, e as SortOptions, f as ContentQueryResult, Q as QueryOptions, C as CreateInput, U as UpdateInput, S as SDKError, v as BaseValidationError, u as ValidationViolation, H as components, R as RelyIOConfig } from './index-DuEhsGdE.js';
2
+ import { a as SchemaDefinition, b as SchemaContentTypeNames, h as SchemaAssetTypeNames, M as InferAssetType, c as SchemaSingletonNames, t as InferSingleton, g as SchemaSettingsGroupNames, E as InferSettingsGroup, e as SchemaQueryNames, f as SchemaLocaleCodes } from './define-schema-BD6HSPnG.js';
3
+ import { J as InferContentType } from './define-content-type-CBfnTWSS.js';
3
4
 
4
5
  /**
5
6
  * What a call site supplies beside the route it named.
@@ -38,7 +39,7 @@ declare class HttpClient {
38
39
  private baseUrl;
39
40
  private defaultHeaders;
40
41
  private timeout;
41
- private retryConfig;
42
+ private retryPolicy;
42
43
  private debug;
43
44
  private logger?;
44
45
  private config;
@@ -56,7 +57,16 @@ declare class HttpClient {
56
57
  data: unknown;
57
58
  } ? Wire<P, M, T>['data'] : never>;
58
59
  /**
59
- * Make an HTTP request with retry logic
60
+ * Make an HTTP request, retrying only where a retry is safe.
61
+ *
62
+ * The headers are merged **once**, before the first attempt, and every attempt
63
+ * sends that same object. That is what makes a minted `Idempotency-Key` stable
64
+ * across the retries of one logical write: the service sees one key and
65
+ * answers the replay from the original outcome instead of applying it twice.
66
+ *
67
+ * The loop always makes one attempt. The incumbent's `while (attempt <
68
+ * maxAttempts)` made none at `retryAttempts: 0` — a value the config validator
69
+ * accepts — and then dereferenced an unassigned `lastError`.
60
70
  */
61
71
  request<T = unknown>(config: RequestConfig): Promise<ApiResponse<T>>;
62
72
  /**
@@ -113,7 +123,6 @@ declare class HttpClient {
113
123
  private mergeRequestConfig;
114
124
  private buildQueryString;
115
125
  private headersToObject;
116
- private calculateRetryDelay;
117
126
  private sleep;
118
127
  private log;
119
128
  }
@@ -427,13 +436,20 @@ declare class ContentByIdBuilder<T extends BaseContent = BaseContent> {
427
436
  */
428
437
  interface RetryableWriteOptions {
429
438
  /**
430
- * A caller-chosen key that makes a retry of **this** write safe.
439
+ * A key that makes a retry of **this** write safe.
431
440
  *
432
441
  * A replay inside the service's window returns the original outcome rather
433
442
  * than applying twice. The service derives that response from committed state
434
443
  * pinned to the recorded version — it does not store bytes — so a replay after
435
444
  * the version has been pruned is refused `RESOURCE_EXPIRED` rather than
436
445
  * answered from a stale copy.
446
+ *
447
+ * **The SDK mints one when you do not.** It used to be caller-supplied and
448
+ * nothing else, which meant the default write carried no key while the retry
449
+ * loop replayed it anyway — the one mechanism that makes a replay safe was
450
+ * optional on the one path that needed it. Supply your own to make a key
451
+ * outlive the process: a job that may be restarted wants a key derived from
452
+ * the work, not one minted per call.
437
453
  */
438
454
  idempotencyKey?: string;
439
455
  }