@s2-dev/streamstore 0.2.7 → 0.2.10

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 (173) hide show
  1. package/README.md +5 -1
  2. package/docs/sdks/account/README.md +9 -7
  3. package/docs/sdks/basin/README.md +9 -7
  4. package/docs/sdks/stream/README.md +12 -4
  5. package/funcs/accountCreateBasin.d.ts +1 -2
  6. package/funcs/accountCreateBasin.d.ts.map +1 -1
  7. package/funcs/accountCreateBasin.js +3 -2
  8. package/funcs/accountCreateBasin.js.map +1 -1
  9. package/funcs/accountDeleteBasin.d.ts +1 -1
  10. package/funcs/accountDeleteBasin.d.ts.map +1 -1
  11. package/funcs/accountDeleteBasin.js +1 -2
  12. package/funcs/accountDeleteBasin.js.map +1 -1
  13. package/funcs/accountGetBasinConfig.d.ts +1 -2
  14. package/funcs/accountGetBasinConfig.d.ts.map +1 -1
  15. package/funcs/accountGetBasinConfig.js +3 -2
  16. package/funcs/accountGetBasinConfig.js.map +1 -1
  17. package/funcs/accountListBasins.d.ts.map +1 -1
  18. package/funcs/accountListBasins.js +3 -1
  19. package/funcs/accountListBasins.js.map +1 -1
  20. package/funcs/accountReconfigureBasin.d.ts +1 -2
  21. package/funcs/accountReconfigureBasin.d.ts.map +1 -1
  22. package/funcs/accountReconfigureBasin.js +3 -2
  23. package/funcs/accountReconfigureBasin.js.map +1 -1
  24. package/funcs/basinCreateStream.d.ts +1 -2
  25. package/funcs/basinCreateStream.d.ts.map +1 -1
  26. package/funcs/basinCreateStream.js +3 -2
  27. package/funcs/basinCreateStream.js.map +1 -1
  28. package/funcs/basinDeleteStream.d.ts +1 -1
  29. package/funcs/basinDeleteStream.d.ts.map +1 -1
  30. package/funcs/basinDeleteStream.js +1 -2
  31. package/funcs/basinDeleteStream.js.map +1 -1
  32. package/funcs/basinGetStreamConfig.d.ts +1 -2
  33. package/funcs/basinGetStreamConfig.d.ts.map +1 -1
  34. package/funcs/basinGetStreamConfig.js +3 -2
  35. package/funcs/basinGetStreamConfig.js.map +1 -1
  36. package/funcs/basinListStreams.js +2 -2
  37. package/funcs/basinListStreams.js.map +1 -1
  38. package/funcs/basinReconfigureStream.d.ts +1 -2
  39. package/funcs/basinReconfigureStream.d.ts.map +1 -1
  40. package/funcs/basinReconfigureStream.js +3 -2
  41. package/funcs/basinReconfigureStream.js.map +1 -1
  42. package/funcs/streamAppend.d.ts +1 -2
  43. package/funcs/streamAppend.d.ts.map +1 -1
  44. package/funcs/streamAppend.js +3 -2
  45. package/funcs/streamAppend.js.map +1 -1
  46. package/funcs/streamCheckTail.d.ts +1 -2
  47. package/funcs/streamCheckTail.d.ts.map +1 -1
  48. package/funcs/streamCheckTail.js +3 -2
  49. package/funcs/streamCheckTail.js.map +1 -1
  50. package/funcs/streamRead.js +1 -1
  51. package/funcs/streamRead.js.map +1 -1
  52. package/jsr.json +1 -1
  53. package/lib/config.d.ts +3 -3
  54. package/lib/config.d.ts.map +1 -1
  55. package/lib/config.js +3 -3
  56. package/lib/config.js.map +1 -1
  57. package/lib/matchers.d.ts +1 -1
  58. package/lib/matchers.d.ts.map +1 -1
  59. package/lib/matchers.js +10 -11
  60. package/lib/matchers.js.map +1 -1
  61. package/models/components/formatoption.d.ts +28 -0
  62. package/models/components/formatoption.d.ts.map +1 -0
  63. package/models/components/formatoption.js +60 -0
  64. package/models/components/formatoption.js.map +1 -0
  65. package/models/components/httpmetadata.d.ts +37 -0
  66. package/models/components/httpmetadata.d.ts.map +1 -0
  67. package/models/components/httpmetadata.js +86 -0
  68. package/models/components/httpmetadata.js.map +1 -0
  69. package/models/components/index.d.ts +2 -0
  70. package/models/components/index.d.ts.map +1 -1
  71. package/models/components/index.js +2 -0
  72. package/models/components/index.js.map +1 -1
  73. package/models/errors/apierror.d.ts +8 -5
  74. package/models/errors/apierror.d.ts.map +1 -1
  75. package/models/errors/apierror.js +3 -9
  76. package/models/errors/apierror.js.map +1 -1
  77. package/models/operations/append.d.ts +31 -30
  78. package/models/operations/append.d.ts.map +1 -1
  79. package/models/operations/append.js +44 -25
  80. package/models/operations/append.js.map +1 -1
  81. package/models/operations/checktail.d.ts +28 -0
  82. package/models/operations/checktail.d.ts.map +1 -1
  83. package/models/operations/checktail.js +42 -1
  84. package/models/operations/checktail.js.map +1 -1
  85. package/models/operations/createbasin.d.ts +27 -0
  86. package/models/operations/createbasin.d.ts.map +1 -1
  87. package/models/operations/createbasin.js +40 -1
  88. package/models/operations/createbasin.js.map +1 -1
  89. package/models/operations/createstream.d.ts +27 -0
  90. package/models/operations/createstream.d.ts.map +1 -1
  91. package/models/operations/createstream.js +40 -1
  92. package/models/operations/createstream.js.map +1 -1
  93. package/models/operations/deletebasin.d.ts +26 -0
  94. package/models/operations/deletebasin.d.ts.map +1 -1
  95. package/models/operations/deletebasin.js +38 -1
  96. package/models/operations/deletebasin.js.map +1 -1
  97. package/models/operations/deletestream.d.ts +26 -0
  98. package/models/operations/deletestream.d.ts.map +1 -1
  99. package/models/operations/deletestream.js +38 -1
  100. package/models/operations/deletestream.js.map +1 -1
  101. package/models/operations/getbasinconfig.d.ts +28 -0
  102. package/models/operations/getbasinconfig.d.ts.map +1 -1
  103. package/models/operations/getbasinconfig.js +42 -1
  104. package/models/operations/getbasinconfig.js.map +1 -1
  105. package/models/operations/getstreamconfig.d.ts +28 -0
  106. package/models/operations/getstreamconfig.d.ts.map +1 -1
  107. package/models/operations/getstreamconfig.js +42 -1
  108. package/models/operations/getstreamconfig.js.map +1 -1
  109. package/models/operations/listbasins.d.ts +4 -2
  110. package/models/operations/listbasins.d.ts.map +1 -1
  111. package/models/operations/listbasins.js +8 -4
  112. package/models/operations/listbasins.js.map +1 -1
  113. package/models/operations/liststreams.d.ts +4 -2
  114. package/models/operations/liststreams.d.ts.map +1 -1
  115. package/models/operations/liststreams.js +8 -4
  116. package/models/operations/liststreams.js.map +1 -1
  117. package/models/operations/read.d.ts +14 -32
  118. package/models/operations/read.d.ts.map +1 -1
  119. package/models/operations/read.js +28 -30
  120. package/models/operations/read.js.map +1 -1
  121. package/models/operations/reconfigurebasin.d.ts +27 -0
  122. package/models/operations/reconfigurebasin.d.ts.map +1 -1
  123. package/models/operations/reconfigurebasin.js +40 -1
  124. package/models/operations/reconfigurebasin.js.map +1 -1
  125. package/models/operations/reconfigurestream.d.ts +27 -0
  126. package/models/operations/reconfigurestream.d.ts.map +1 -1
  127. package/models/operations/reconfigurestream.js +40 -1
  128. package/models/operations/reconfigurestream.js.map +1 -1
  129. package/package.json +1 -1
  130. package/sdk/account.d.ts +4 -5
  131. package/sdk/account.d.ts.map +1 -1
  132. package/sdk/account.js.map +1 -1
  133. package/sdk/basin.d.ts +4 -5
  134. package/sdk/basin.d.ts.map +1 -1
  135. package/sdk/basin.js.map +1 -1
  136. package/sdk/stream.d.ts +2 -3
  137. package/sdk/stream.d.ts.map +1 -1
  138. package/sdk/stream.js.map +1 -1
  139. package/src/funcs/accountCreateBasin.ts +6 -5
  140. package/src/funcs/accountDeleteBasin.ts +4 -5
  141. package/src/funcs/accountGetBasinConfig.ts +6 -5
  142. package/src/funcs/accountListBasins.ts +4 -2
  143. package/src/funcs/accountReconfigureBasin.ts +6 -5
  144. package/src/funcs/basinCreateStream.ts +6 -5
  145. package/src/funcs/basinDeleteStream.ts +4 -5
  146. package/src/funcs/basinGetStreamConfig.ts +6 -5
  147. package/src/funcs/basinListStreams.ts +2 -2
  148. package/src/funcs/basinReconfigureStream.ts +6 -5
  149. package/src/funcs/streamAppend.ts +6 -5
  150. package/src/funcs/streamCheckTail.ts +6 -5
  151. package/src/funcs/streamRead.ts +3 -3
  152. package/src/lib/config.ts +4 -3
  153. package/src/lib/matchers.ts +10 -16
  154. package/src/models/components/formatoption.ts +31 -0
  155. package/src/models/components/httpmetadata.ts +87 -0
  156. package/src/models/components/index.ts +2 -0
  157. package/src/models/errors/apierror.ts +7 -13
  158. package/src/models/operations/append.ts +73 -31
  159. package/src/models/operations/checktail.ts +74 -0
  160. package/src/models/operations/createbasin.ts +72 -0
  161. package/src/models/operations/createstream.ts +72 -0
  162. package/src/models/operations/deletebasin.ts +68 -0
  163. package/src/models/operations/deletestream.ts +68 -0
  164. package/src/models/operations/getbasinconfig.ts +74 -0
  165. package/src/models/operations/getstreamconfig.ts +74 -0
  166. package/src/models/operations/listbasins.ts +12 -6
  167. package/src/models/operations/liststreams.ts +12 -6
  168. package/src/models/operations/read.ts +39 -41
  169. package/src/models/operations/reconfigurebasin.ts +72 -0
  170. package/src/models/operations/reconfigurestream.ts +72 -0
  171. package/src/sdk/account.ts +4 -5
  172. package/src/sdk/basin.ts +4 -5
  173. package/src/sdk/stream.ts +2 -3
@@ -10,7 +10,6 @@ import { safeParse } from "../lib/schemas.js";
10
10
  import { RequestOptions } from "../lib/sdks.js";
11
11
  import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
12
  import { pathToFunc } from "../lib/url.js";
13
- import * as components from "../models/components/index.js";
14
13
  import { APIError } from "../models/errors/apierror.js";
15
14
  import {
16
15
  ConnectionError,
@@ -37,7 +36,7 @@ export async function streamAppend(
37
36
  options?: RequestOptions,
38
37
  ): Promise<
39
38
  Result<
40
- components.AppendOutput,
39
+ operations.AppendResponse,
41
40
  | errors.ErrorResponse
42
41
  | errors.ErrorResponse
43
42
  | APIError
@@ -130,7 +129,7 @@ export async function streamAppend(
130
129
  };
131
130
 
132
131
  const [result] = await M.match<
133
- components.AppendOutput,
132
+ operations.AppendResponse,
134
133
  | errors.ErrorResponse
135
134
  | errors.ErrorResponse
136
135
  | APIError
@@ -141,12 +140,14 @@ export async function streamAppend(
141
140
  | RequestTimeoutError
142
141
  | ConnectionError
143
142
  >(
144
- M.json(200, components.AppendOutput$inboundSchema),
143
+ M.json(200, operations.AppendResponse$inboundSchema, {
144
+ key: "AppendOutput",
145
+ }),
145
146
  M.jsonErr([400, 401, 404], errors.ErrorResponse$inboundSchema),
146
147
  M.jsonErr(500, errors.ErrorResponse$inboundSchema),
147
148
  M.fail("4XX"),
148
149
  M.fail("5XX"),
149
- )(response, { extraFields: responseFields });
150
+ )(response, req, { extraFields: responseFields });
150
151
  if (!result.ok) {
151
152
  return result;
152
153
  }
@@ -10,7 +10,6 @@ import { safeParse } from "../lib/schemas.js";
10
10
  import { RequestOptions } from "../lib/sdks.js";
11
11
  import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
12
  import { pathToFunc } from "../lib/url.js";
13
- import * as components from "../models/components/index.js";
14
13
  import { APIError } from "../models/errors/apierror.js";
15
14
  import {
16
15
  ConnectionError,
@@ -37,7 +36,7 @@ export async function streamCheckTail(
37
36
  options?: RequestOptions,
38
37
  ): Promise<
39
38
  Result<
40
- components.CheckTailResponse,
39
+ operations.CheckTailResponse,
41
40
  | errors.ErrorResponse
42
41
  | errors.ErrorResponse
43
42
  | APIError
@@ -125,7 +124,7 @@ export async function streamCheckTail(
125
124
  };
126
125
 
127
126
  const [result] = await M.match<
128
- components.CheckTailResponse,
127
+ operations.CheckTailResponse,
129
128
  | errors.ErrorResponse
130
129
  | errors.ErrorResponse
131
130
  | APIError
@@ -136,12 +135,14 @@ export async function streamCheckTail(
136
135
  | RequestTimeoutError
137
136
  | ConnectionError
138
137
  >(
139
- M.json(200, components.CheckTailResponse$inboundSchema),
138
+ M.json(200, operations.CheckTailResponse$inboundSchema, {
139
+ key: "CheckTailResponse",
140
+ }),
140
141
  M.jsonErr([400, 401, 404], errors.ErrorResponse$inboundSchema),
141
142
  M.jsonErr(500, errors.ErrorResponse$inboundSchema),
142
143
  M.fail("4XX"),
143
144
  M.fail("5XX"),
144
- )(response, { extraFields: responseFields });
145
+ )(response, req, { extraFields: responseFields });
145
146
  if (!result.ok) {
146
147
  return result;
147
148
  }
@@ -151,13 +151,13 @@ export async function streamRead(
151
151
  | RequestTimeoutError
152
152
  | ConnectionError
153
153
  >(
154
- M.json(200, operations.ReadResponse$inboundSchema),
155
- M.sse(200, operations.ReadResponse$inboundSchema),
154
+ M.json(200, operations.ReadResponse$inboundSchema, { key: "Output" }),
155
+ M.sse(200, operations.ReadResponse$inboundSchema, { key: "ReadResponse" }),
156
156
  M.jsonErr([400, 401, 404], errors.ErrorResponse$inboundSchema),
157
157
  M.jsonErr(500, errors.ErrorResponse$inboundSchema),
158
158
  M.fail("4XX"),
159
159
  M.fail("5XX"),
160
- )(response, { extraFields: responseFields });
160
+ )(response, req, { extraFields: responseFields });
161
161
  if (!result.ok) {
162
162
  return result;
163
163
  }
package/src/lib/config.ts CHANGED
@@ -54,7 +54,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
54
54
  export const SDK_METADATA = {
55
55
  language: "typescript",
56
56
  openapiDocVersion: "1.0.0",
57
- sdkVersion: "0.2.7",
58
- genVersion: "2.503.0",
59
- userAgent: "speakeasy-sdk/typescript 0.2.7 2.503.0 1.0.0 @s2-dev/streamstore",
57
+ sdkVersion: "0.2.10",
58
+ genVersion: "2.503.2",
59
+ userAgent:
60
+ "speakeasy-sdk/typescript 0.2.10 2.503.2 1.0.0 @s2-dev/streamstore",
60
61
  } as const;
@@ -160,6 +160,7 @@ export type MatchedError<Matchers> = Matchers extends Matcher<any, infer E>[]
160
160
  : never;
161
161
  export type MatchFunc<T, E> = (
162
162
  response: Response,
163
+ request: Request,
163
164
  options?: { resultKey?: string; extraFields?: Record<string, unknown> },
164
165
  ) => Promise<[result: Result<T, E>, raw: unknown]>;
165
166
 
@@ -168,6 +169,7 @@ export function match<T, E>(
168
169
  ): MatchFunc<T, E | APIError | SDKValidationError> {
169
170
  return async function matchFunc(
170
171
  response: Response,
172
+ request: Request,
171
173
  options?: { resultKey?: string; extraFields?: Record<string, unknown> },
172
174
  ): Promise<
173
175
  [result: Result<T, E | APIError | SDKValidationError>, raw: unknown]
@@ -189,15 +191,14 @@ export function match<T, E>(
189
191
  }
190
192
 
191
193
  if (!matcher) {
192
- const responseBody = await response.text();
194
+ await discardResponseBody(response);
193
195
  return [{
194
196
  ok: false,
195
- error: new APIError(
196
- "Unexpected API response status or content-type",
197
+ error: new APIError("Unexpected API response status or content-type", {
197
198
  response,
198
- responseBody,
199
- ),
200
- }, responseBody];
199
+ request,
200
+ }),
201
+ }, raw];
201
202
  }
202
203
 
203
204
  const encoding = matcher.enc;
@@ -223,7 +224,7 @@ export function match<T, E>(
223
224
  raw = await discardResponseBody(response);
224
225
  break;
225
226
  case "fail":
226
- raw = await response.text();
227
+ raw = await discardResponseBody(response);
227
228
  break;
228
229
  default:
229
230
  encoding satisfies never;
@@ -233,11 +234,7 @@ export function match<T, E>(
233
234
  if (matcher.enc === "fail") {
234
235
  return [{
235
236
  ok: false,
236
- error: new APIError(
237
- "API error occurred",
238
- response,
239
- typeof raw === "string" ? raw : "",
240
- ),
237
+ error: new APIError("API error occurred", { response, request }),
241
238
  }, raw];
242
239
  }
243
240
 
@@ -256,14 +253,11 @@ export function match<T, E>(
256
253
  ...(matcher.hdrs ? { Headers: unpackHeaders(response.headers) } : null),
257
254
  [resultKey]: raw,
258
255
  };
259
- } else if (matcher.hdrs) {
256
+ } else {
260
257
  data = {
261
258
  ...options?.extraFields,
262
259
  ...(matcher.hdrs ? { Headers: unpackHeaders(response.headers) } : null),
263
- ...(isPlainObject(raw) ? raw : null),
264
260
  };
265
- } else {
266
- data = raw;
267
261
  }
268
262
 
269
263
  if ("err" in matcher) {
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { ClosedEnum } from "../../types/enums.js";
7
+
8
+ export const FormatOption = {
9
+ Json: "json",
10
+ JsonBinsafe: "json-binsafe",
11
+ } as const;
12
+ export type FormatOption = ClosedEnum<typeof FormatOption>;
13
+
14
+ /** @internal */
15
+ export const FormatOption$inboundSchema: z.ZodNativeEnum<typeof FormatOption> =
16
+ z.nativeEnum(FormatOption);
17
+
18
+ /** @internal */
19
+ export const FormatOption$outboundSchema: z.ZodNativeEnum<typeof FormatOption> =
20
+ FormatOption$inboundSchema;
21
+
22
+ /**
23
+ * @internal
24
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
25
+ */
26
+ export namespace FormatOption$ {
27
+ /** @deprecated use `FormatOption$inboundSchema` instead. */
28
+ export const inboundSchema = FormatOption$inboundSchema;
29
+ /** @deprecated use `FormatOption$outboundSchema` instead. */
30
+ export const outboundSchema = FormatOption$outboundSchema;
31
+ }
@@ -0,0 +1,87 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ export type HTTPMetadata = {
12
+ /**
13
+ * Raw HTTP response; suitable for custom response parsing
14
+ */
15
+ response: Response;
16
+ /**
17
+ * Raw HTTP request; suitable for debugging
18
+ */
19
+ request: Request;
20
+ };
21
+
22
+ /** @internal */
23
+ export const HTTPMetadata$inboundSchema: z.ZodType<
24
+ HTTPMetadata,
25
+ z.ZodTypeDef,
26
+ unknown
27
+ > = z.object({
28
+ Response: z.instanceof(Response),
29
+ Request: z.instanceof(Request),
30
+ }).transform((v) => {
31
+ return remap$(v, {
32
+ "Response": "response",
33
+ "Request": "request",
34
+ });
35
+ });
36
+
37
+ /** @internal */
38
+ export type HTTPMetadata$Outbound = {
39
+ Response: never;
40
+ Request: never;
41
+ };
42
+
43
+ /** @internal */
44
+ export const HTTPMetadata$outboundSchema: z.ZodType<
45
+ HTTPMetadata$Outbound,
46
+ z.ZodTypeDef,
47
+ HTTPMetadata
48
+ > = z.object({
49
+ response: z.instanceof(Response).transform(() => {
50
+ throw new Error("Response cannot be serialized");
51
+ }),
52
+ request: z.instanceof(Request).transform(() => {
53
+ throw new Error("Response cannot be serialized");
54
+ }),
55
+ }).transform((v) => {
56
+ return remap$(v, {
57
+ response: "Response",
58
+ request: "Request",
59
+ });
60
+ });
61
+
62
+ /**
63
+ * @internal
64
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
65
+ */
66
+ export namespace HTTPMetadata$ {
67
+ /** @deprecated use `HTTPMetadata$inboundSchema` instead. */
68
+ export const inboundSchema = HTTPMetadata$inboundSchema;
69
+ /** @deprecated use `HTTPMetadata$outboundSchema` instead. */
70
+ export const outboundSchema = HTTPMetadata$outboundSchema;
71
+ /** @deprecated use `HTTPMetadata$Outbound` instead. */
72
+ export type Outbound = HTTPMetadata$Outbound;
73
+ }
74
+
75
+ export function httpMetadataToJSON(httpMetadata: HTTPMetadata): string {
76
+ return JSON.stringify(HTTPMetadata$outboundSchema.parse(httpMetadata));
77
+ }
78
+
79
+ export function httpMetadataFromJSON(
80
+ jsonString: string,
81
+ ): SafeParseResult<HTTPMetadata, SDKValidationError> {
82
+ return safeParse(
83
+ jsonString,
84
+ (x) => HTTPMetadata$inboundSchema.parse(JSON.parse(x)),
85
+ `Failed to parse 'HTTPMetadata' from JSON`,
86
+ );
87
+ }
@@ -12,7 +12,9 @@ export * from "./basinstate.js";
12
12
  export * from "./checktailresponse.js";
13
13
  export * from "./createbasinrequest.js";
14
14
  export * from "./createstreamrequest.js";
15
+ export * from "./formatoption.js";
15
16
  export * from "./header.js";
17
+ export * from "./httpmetadata.js";
16
18
  export * from "./listbasinsresponse.js";
17
19
  export * from "./liststreamsresponse.js";
18
20
  export * from "./output.js";
@@ -3,25 +3,19 @@
3
3
  */
4
4
 
5
5
  export class APIError extends Error {
6
- public readonly statusCode: number;
7
- public readonly contentType: string;
8
-
9
6
  constructor(
10
7
  message: string,
11
- public readonly rawResponse: Response,
12
- public readonly body: string = "",
8
+ public readonly httpMeta: {
9
+ response: Response;
10
+ request: Request;
11
+ },
13
12
  ) {
14
- const statusCode = rawResponse.status;
15
- const contentType = rawResponse.headers.get("content-type") || "";
16
- const bodyString = body.length > 0 ? `\n${body}` : "";
17
-
18
13
  super(
19
- `${message}: Status ${statusCode} Content-Type ${contentType} Body ${bodyString}`,
14
+ `${message}: Status ${httpMeta.response.status} Content-Type ${
15
+ httpMeta.response.headers.get("content-type") || ""
16
+ }`,
20
17
  );
21
18
 
22
- this.statusCode = statusCode;
23
- this.contentType = contentType;
24
-
25
19
  this.name = "APIError";
26
20
  }
27
21
  }
@@ -5,7 +5,6 @@
5
5
  import * as z from "zod";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
- import { ClosedEnum } from "../../types/enums.js";
9
8
  import { Result as SafeParseResult } from "../../types/fp.js";
10
9
  import * as components from "../components/index.js";
11
10
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
@@ -17,19 +16,13 @@ export const AppendServerList = [
17
16
  "https://{basin}.b.aws.s2.dev/v1alpha",
18
17
  ] as const;
19
18
 
20
- export const Header1 = {
21
- Json: "json",
22
- JsonBinsafe: "json-binsafe",
23
- } as const;
24
- export type Header1 = ClosedEnum<typeof Header1>;
25
-
26
19
  /**
27
20
  * json: utf-8 plaintext data.
28
21
  *
29
22
  * @remarks
30
23
  * json-binsafe: base64 encoded binary data.
31
24
  */
32
- export type HeaderS2Format = Header1;
25
+ export type HeaderS2Format = components.FormatOption;
33
26
 
34
27
  export type AppendRequest = {
35
28
  /**
@@ -38,7 +31,7 @@ export type AppendRequest = {
38
31
  * @remarks
39
32
  * json-binsafe: base64 encoded binary data.
40
33
  */
41
- s2Format?: Header1 | undefined;
34
+ s2Format?: components.FormatOption | undefined;
42
35
  /**
43
36
  * Name of the stream.
44
37
  */
@@ -46,31 +39,17 @@ export type AppendRequest = {
46
39
  appendInput: components.AppendInput;
47
40
  };
48
41
 
49
- /** @internal */
50
- export const Header1$inboundSchema: z.ZodNativeEnum<typeof Header1> = z
51
- .nativeEnum(Header1);
52
-
53
- /** @internal */
54
- export const Header1$outboundSchema: z.ZodNativeEnum<typeof Header1> =
55
- Header1$inboundSchema;
56
-
57
- /**
58
- * @internal
59
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
60
- */
61
- export namespace Header1$ {
62
- /** @deprecated use `Header1$inboundSchema` instead. */
63
- export const inboundSchema = Header1$inboundSchema;
64
- /** @deprecated use `Header1$outboundSchema` instead. */
65
- export const outboundSchema = Header1$outboundSchema;
66
- }
42
+ export type AppendResponse = {
43
+ httpMeta: components.HTTPMetadata;
44
+ appendOutput?: components.AppendOutput | undefined;
45
+ };
67
46
 
68
47
  /** @internal */
69
48
  export const HeaderS2Format$inboundSchema: z.ZodType<
70
49
  HeaderS2Format,
71
50
  z.ZodTypeDef,
72
51
  unknown
73
- > = Header1$inboundSchema;
52
+ > = components.FormatOption$inboundSchema;
74
53
 
75
54
  /** @internal */
76
55
  export type HeaderS2Format$Outbound = string;
@@ -80,7 +59,7 @@ export const HeaderS2Format$outboundSchema: z.ZodType<
80
59
  HeaderS2Format$Outbound,
81
60
  z.ZodTypeDef,
82
61
  HeaderS2Format
83
- > = Header1$outboundSchema;
62
+ > = components.FormatOption$outboundSchema;
84
63
 
85
64
  /**
86
65
  * @internal
@@ -115,7 +94,7 @@ export const AppendRequest$inboundSchema: z.ZodType<
115
94
  z.ZodTypeDef,
116
95
  unknown
117
96
  > = z.object({
118
- "s2-format": Header1$inboundSchema.optional(),
97
+ "s2-format": components.FormatOption$inboundSchema.optional(),
119
98
  stream: z.string(),
120
99
  AppendInput: components.AppendInput$inboundSchema,
121
100
  }).transform((v) => {
@@ -138,7 +117,7 @@ export const AppendRequest$outboundSchema: z.ZodType<
138
117
  z.ZodTypeDef,
139
118
  AppendRequest
140
119
  > = z.object({
141
- s2Format: Header1$outboundSchema.optional(),
120
+ s2Format: components.FormatOption$outboundSchema.optional(),
142
121
  stream: z.string(),
143
122
  appendInput: components.AppendInput$outboundSchema,
144
123
  }).transform((v) => {
@@ -174,3 +153,66 @@ export function appendRequestFromJSON(
174
153
  `Failed to parse 'AppendRequest' from JSON`,
175
154
  );
176
155
  }
156
+
157
+ /** @internal */
158
+ export const AppendResponse$inboundSchema: z.ZodType<
159
+ AppendResponse,
160
+ z.ZodTypeDef,
161
+ unknown
162
+ > = z.object({
163
+ HttpMeta: components.HTTPMetadata$inboundSchema,
164
+ AppendOutput: components.AppendOutput$inboundSchema.optional(),
165
+ }).transform((v) => {
166
+ return remap$(v, {
167
+ "HttpMeta": "httpMeta",
168
+ "AppendOutput": "appendOutput",
169
+ });
170
+ });
171
+
172
+ /** @internal */
173
+ export type AppendResponse$Outbound = {
174
+ HttpMeta: components.HTTPMetadata$Outbound;
175
+ AppendOutput?: components.AppendOutput$Outbound | undefined;
176
+ };
177
+
178
+ /** @internal */
179
+ export const AppendResponse$outboundSchema: z.ZodType<
180
+ AppendResponse$Outbound,
181
+ z.ZodTypeDef,
182
+ AppendResponse
183
+ > = z.object({
184
+ httpMeta: components.HTTPMetadata$outboundSchema,
185
+ appendOutput: components.AppendOutput$outboundSchema.optional(),
186
+ }).transform((v) => {
187
+ return remap$(v, {
188
+ httpMeta: "HttpMeta",
189
+ appendOutput: "AppendOutput",
190
+ });
191
+ });
192
+
193
+ /**
194
+ * @internal
195
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
196
+ */
197
+ export namespace AppendResponse$ {
198
+ /** @deprecated use `AppendResponse$inboundSchema` instead. */
199
+ export const inboundSchema = AppendResponse$inboundSchema;
200
+ /** @deprecated use `AppendResponse$outboundSchema` instead. */
201
+ export const outboundSchema = AppendResponse$outboundSchema;
202
+ /** @deprecated use `AppendResponse$Outbound` instead. */
203
+ export type Outbound = AppendResponse$Outbound;
204
+ }
205
+
206
+ export function appendResponseToJSON(appendResponse: AppendResponse): string {
207
+ return JSON.stringify(AppendResponse$outboundSchema.parse(appendResponse));
208
+ }
209
+
210
+ export function appendResponseFromJSON(
211
+ jsonString: string,
212
+ ): SafeParseResult<AppendResponse, SDKValidationError> {
213
+ return safeParse(
214
+ jsonString,
215
+ (x) => AppendResponse$inboundSchema.parse(JSON.parse(x)),
216
+ `Failed to parse 'AppendResponse' from JSON`,
217
+ );
218
+ }
@@ -3,8 +3,10 @@
3
3
  */
4
4
 
5
5
  import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
6
7
  import { safeParse } from "../../lib/schemas.js";
7
8
  import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as components from "../components/index.js";
8
10
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
11
 
10
12
  export const CheckTailServerList = [
@@ -21,6 +23,11 @@ export type CheckTailRequest = {
21
23
  stream: string;
22
24
  };
23
25
 
26
+ export type CheckTailResponse = {
27
+ httpMeta: components.HTTPMetadata;
28
+ checkTailResponse?: components.CheckTailResponse | undefined;
29
+ };
30
+
24
31
  /** @internal */
25
32
  export const CheckTailRequest$inboundSchema: z.ZodType<
26
33
  CheckTailRequest,
@@ -74,3 +81,70 @@ export function checkTailRequestFromJSON(
74
81
  `Failed to parse 'CheckTailRequest' from JSON`,
75
82
  );
76
83
  }
84
+
85
+ /** @internal */
86
+ export const CheckTailResponse$inboundSchema: z.ZodType<
87
+ CheckTailResponse,
88
+ z.ZodTypeDef,
89
+ unknown
90
+ > = z.object({
91
+ HttpMeta: components.HTTPMetadata$inboundSchema,
92
+ CheckTailResponse: components.CheckTailResponse$inboundSchema.optional(),
93
+ }).transform((v) => {
94
+ return remap$(v, {
95
+ "HttpMeta": "httpMeta",
96
+ "CheckTailResponse": "checkTailResponse",
97
+ });
98
+ });
99
+
100
+ /** @internal */
101
+ export type CheckTailResponse$Outbound = {
102
+ HttpMeta: components.HTTPMetadata$Outbound;
103
+ CheckTailResponse?: components.CheckTailResponse$Outbound | undefined;
104
+ };
105
+
106
+ /** @internal */
107
+ export const CheckTailResponse$outboundSchema: z.ZodType<
108
+ CheckTailResponse$Outbound,
109
+ z.ZodTypeDef,
110
+ CheckTailResponse
111
+ > = z.object({
112
+ httpMeta: components.HTTPMetadata$outboundSchema,
113
+ checkTailResponse: components.CheckTailResponse$outboundSchema.optional(),
114
+ }).transform((v) => {
115
+ return remap$(v, {
116
+ httpMeta: "HttpMeta",
117
+ checkTailResponse: "CheckTailResponse",
118
+ });
119
+ });
120
+
121
+ /**
122
+ * @internal
123
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
124
+ */
125
+ export namespace CheckTailResponse$ {
126
+ /** @deprecated use `CheckTailResponse$inboundSchema` instead. */
127
+ export const inboundSchema = CheckTailResponse$inboundSchema;
128
+ /** @deprecated use `CheckTailResponse$outboundSchema` instead. */
129
+ export const outboundSchema = CheckTailResponse$outboundSchema;
130
+ /** @deprecated use `CheckTailResponse$Outbound` instead. */
131
+ export type Outbound = CheckTailResponse$Outbound;
132
+ }
133
+
134
+ export function checkTailResponseToJSON(
135
+ checkTailResponse: CheckTailResponse,
136
+ ): string {
137
+ return JSON.stringify(
138
+ CheckTailResponse$outboundSchema.parse(checkTailResponse),
139
+ );
140
+ }
141
+
142
+ export function checkTailResponseFromJSON(
143
+ jsonString: string,
144
+ ): SafeParseResult<CheckTailResponse, SDKValidationError> {
145
+ return safeParse(
146
+ jsonString,
147
+ (x) => CheckTailResponse$inboundSchema.parse(JSON.parse(x)),
148
+ `Failed to parse 'CheckTailResponse' from JSON`,
149
+ );
150
+ }