@goable-io/sdk 0.4.0 → 0.5.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/src/index.ts CHANGED
@@ -12,9 +12,11 @@
12
12
  export { GoableClient } from "./client.ts"
13
13
  export type { FetchLike, GoableClientOptions } from "./client.ts"
14
14
  export {
15
+ type ApiErrorExtra,
15
16
  DriftActiveError,
16
17
  GoableApiError,
17
18
  GoableNetworkError,
19
+ type RateLimit,
18
20
  type ZodIssueLike,
19
21
  } from "./errors.ts"
20
22
  export type * from "./types.ts"
package/src/types.ts CHANGED
@@ -34,9 +34,22 @@ type OkOf<O> = O extends { responses: infer R }
34
34
  : never
35
35
  /** The query-parameter object of an operation. */
36
36
  type QueryOf<O> = O extends { parameters: { query?: infer Q } } ? NonNullable<Q> : never
37
+ /** The path-parameter object of an operation. */
38
+ type PathOf<O> = O extends { parameters: { path?: infer P } } ? NonNullable<P> : never
39
+ /** The `application/json` body for a specific response status — used when an
40
+ * operation declares several media types (e.g. JSON + text/csv) and we want
41
+ * only the JSON branch, not the `object | string` union `ResOf` would give. */
42
+ type JsonResOf<O, C extends number> = O extends { responses: infer R }
43
+ ? C extends keyof R
44
+ ? R[C] extends { content: { "application/json": infer J } }
45
+ ? J
46
+ : never
47
+ : never
48
+ : never
37
49
 
38
50
  type Get<P extends keyof paths> = paths[P] extends { get: infer O } ? O : never
39
51
  type Post<P extends keyof paths> = paths[P] extends { post: infer O } ? O : never
52
+ type Put<P extends keyof paths> = paths[P] extends { put: infer O } ? O : never
40
53
  type Patch<P extends keyof paths> = paths[P] extends { patch: infer O } ? O : never
41
54
 
42
55
  // ── shared primitives (from components) ───────────────────────────────────
@@ -87,6 +100,10 @@ export type ScoreDifficultyResponse = OkOf<Post<"/v1/score/difficulty">>
87
100
  export type ReportOutcomeRequest = ReqOf<Post<"/v1/score/{sessionId}/outcome">>
88
101
  export type ReportOutcomeResponse = OkOf<Post<"/v1/score/{sessionId}/outcome">>
89
102
 
103
+ /** Standalone activity outcome, not tied to a scored session (`POST /v1/outcomes`). */
104
+ export type SubmitOutcomeRequest = ReqOf<Post<"/v1/outcomes">>
105
+ export type SubmitOutcomeResponse = OkOf<Post<"/v1/outcomes">>
106
+
90
107
  export type EdgeCaseRequest = ReqOf<Post<"/v1/intelligence/edge-case">>
91
108
  export type EdgeCaseResponse = OkOf<Post<"/v1/intelligence/edge-case">>
92
109
 
@@ -142,6 +159,29 @@ export type PublicSignupResponse = OkOf<Post<"/v1/public/signup">>
142
159
 
143
160
  export type CatalogStatsResponse = OkOf<Get<"/v1/public/catalog-stats">>
144
161
 
162
+ /** Legal document kinds (from the OpenAPI path-param enum). */
163
+ export type LegalDocumentKind = PathOf<Get<"/v1/legal/{kind}/current">>["kind"]
164
+ export type LegalDocumentResponse = OkOf<Get<"/v1/legal/{kind}/current">>
165
+
166
+ // ── health / audit / BYOK (tenant surfaces) ───────────────────────────────
167
+ export type HealthReadyResponse = OkOf<Get<"/v1/health/ready">>
168
+
169
+ export type AuditExportQuery = QueryOf<Get<"/v1/audit/export">>
170
+ /** The JSON body of an audit export (`format=json`, the default). The `csv`
171
+ * variant is returned as a raw `string` by the client, not this type. */
172
+ export type AuditExportResponse = JsonResOf<Get<"/v1/audit/export">, 200>
173
+
174
+ export type SetLlmKeyRequest = ReqOf<Put<"/v1/tenant/llm-key">>
175
+ export type LlmKeyStatus = OkOf<Get<"/v1/tenant/llm-key">>
176
+
177
+ // ── request options ───────────────────────────────────────────────────────
178
+ /** Per-call options for endpoints that accept an `Idempotency-Key` header
179
+ * (`bindPolicy`, `reportOutcome`) — a client-generated key so a retry after a
180
+ * network timeout can't double-apply the write. */
181
+ export interface IdempotencyOptions {
182
+ idempotencyKey?: string
183
+ }
184
+
145
185
  // ── webhooks ──────────────────────────────────────────────────────────────
146
186
  /** Every webhook event the platform can deliver (from the OpenAPI enum). */
147
187
  export type WebhookEventType = components["schemas"]["WebhookEvent"]