@livestore/sync-s2 0.4.0-dev.9 → 0.5.0-dev.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/dist/.tsbuildinfo +1 -1
- package/dist/api-schema.d.ts +19 -19
- package/dist/api-schema.d.ts.map +1 -1
- package/dist/api-schema.js +4 -4
- package/dist/api-schema.js.map +1 -1
- package/dist/api-schema.test.js +15 -10
- package/dist/api-schema.test.js.map +1 -1
- package/dist/decode.d.ts +1 -1
- package/dist/decode.d.ts.map +1 -1
- package/dist/decode.js +3 -3
- package/dist/decode.js.map +1 -1
- package/dist/http-client-generated.d.ts +337 -1051
- package/dist/http-client-generated.d.ts.map +1 -1
- package/dist/http-client-generated.js +276 -231
- package/dist/http-client-generated.js.map +1 -1
- package/dist/limits.d.ts +39 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +89 -0
- package/dist/limits.js.map +1 -0
- package/dist/limits.test.d.ts +2 -0
- package/dist/limits.test.d.ts.map +1 -0
- package/dist/limits.test.js +30 -0
- package/dist/limits.test.js.map +1 -0
- package/dist/make-s2-url.d.ts.map +1 -1
- package/dist/make-s2-url.js +4 -4
- package/dist/make-s2-url.js.map +1 -1
- package/dist/mod.d.ts +1 -0
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js +1 -0
- package/dist/mod.js.map +1 -1
- package/dist/s2-proxy-helpers.d.ts +26 -22
- package/dist/s2-proxy-helpers.d.ts.map +1 -1
- package/dist/s2-proxy-helpers.js +35 -33
- package/dist/s2-proxy-helpers.js.map +1 -1
- package/dist/sync-provider.d.ts +7 -7
- package/dist/sync-provider.d.ts.map +1 -1
- package/dist/sync-provider.js +55 -22
- package/dist/sync-provider.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +57 -13
- package/src/api-schema.test.ts +16 -10
- package/src/api-schema.ts +5 -4
- package/src/decode.ts +5 -4
- package/src/http-client-generated.ts +187 -258
- package/src/limits.test.ts +43 -0
- package/src/limits.ts +133 -0
- package/src/make-s2-url.ts +5 -4
- package/src/mod.ts +1 -0
- package/src/s2-proxy-helpers.ts +57 -47
- package/src/sync-provider.ts +88 -40
- package/src/types.ts +1 -1
|
@@ -10,20 +10,16 @@ import {
|
|
|
10
10
|
HttpClientError,
|
|
11
11
|
HttpClientRequest,
|
|
12
12
|
HttpClientResponse,
|
|
13
|
-
type ParseResult,
|
|
14
13
|
Schema as S,
|
|
15
14
|
} from '@livestore/utils/effect'
|
|
16
15
|
|
|
17
|
-
export class ListAccessTokensParams extends S.
|
|
18
|
-
prefix: S.
|
|
19
|
-
start_after: S.
|
|
20
|
-
limit: S.
|
|
21
|
-
nullable: true,
|
|
22
|
-
default: () => 1000 as const,
|
|
23
|
-
}),
|
|
16
|
+
export class ListAccessTokensParams extends S.Class<ListAccessTokensParams>('ListAccessTokensParams')({
|
|
17
|
+
prefix: S.String.pipe(S.optional, S.withDecodingDefault(Effect.succeed(''))),
|
|
18
|
+
start_after: S.String.pipe(S.optional, S.withDecodingDefault(Effect.succeed(''))),
|
|
19
|
+
limit: S.Int.check(S.isGreaterThanOrEqualTo(0), S.isLessThanOrEqualTo(1000)).pipe(S.optional, S.withDecodingDefault(Effect.succeed(1000))),
|
|
24
20
|
}) {}
|
|
25
21
|
|
|
26
|
-
export
|
|
22
|
+
export const ResourceSet = S.Union([
|
|
27
23
|
/**
|
|
28
24
|
* Match only the resource with this exact name.
|
|
29
25
|
* Use an empty string to match no resources.
|
|
@@ -46,26 +42,26 @@ export class ResourceSet extends S.Union(
|
|
|
46
42
|
*/
|
|
47
43
|
prefix: S.String,
|
|
48
44
|
}),
|
|
49
|
-
)
|
|
45
|
+
])
|
|
50
46
|
|
|
51
47
|
export class ReadWritePermissions extends S.Class<ReadWritePermissions>('ReadWritePermissions')({
|
|
52
48
|
/**
|
|
53
49
|
* Read permission.
|
|
54
50
|
*/
|
|
55
|
-
read: S.
|
|
51
|
+
read: S.Boolean.pipe(S.optional, S.withDecodingDefault(Effect.succeed(false))),
|
|
56
52
|
/**
|
|
57
53
|
* Write permission.
|
|
58
54
|
*/
|
|
59
|
-
write: S.
|
|
55
|
+
write: S.Boolean.pipe(S.optional, S.withDecodingDefault(Effect.succeed(false))),
|
|
60
56
|
}) {}
|
|
61
57
|
|
|
62
58
|
export class PermittedOperationGroups extends S.Class<PermittedOperationGroups>('PermittedOperationGroups')({
|
|
63
|
-
account: S.
|
|
64
|
-
basin: S.
|
|
65
|
-
stream: S.
|
|
59
|
+
account: S.optional(S.NullOr(ReadWritePermissions)),
|
|
60
|
+
basin: S.optional(S.NullOr(ReadWritePermissions)),
|
|
61
|
+
stream: S.optional(S.NullOr(ReadWritePermissions)),
|
|
66
62
|
}) {}
|
|
67
63
|
|
|
68
|
-
export
|
|
64
|
+
export const Operation = S.Literals([
|
|
69
65
|
'list-basins',
|
|
70
66
|
'create-basin',
|
|
71
67
|
'delete-basin',
|
|
@@ -87,18 +83,18 @@ export class Operation extends S.Literal(
|
|
|
87
83
|
'account-metrics',
|
|
88
84
|
'basin-metrics',
|
|
89
85
|
'stream-metrics',
|
|
90
|
-
)
|
|
86
|
+
])
|
|
91
87
|
|
|
92
88
|
export class AccessTokenScope extends S.Class<AccessTokenScope>('AccessTokenScope')({
|
|
93
|
-
access_tokens: S.
|
|
94
|
-
basins: S.
|
|
95
|
-
op_groups: S.
|
|
89
|
+
access_tokens: S.optional(S.NullOr(ResourceSet)),
|
|
90
|
+
basins: S.optional(S.NullOr(ResourceSet)),
|
|
91
|
+
op_groups: S.optional(S.NullOr(PermittedOperationGroups)),
|
|
96
92
|
/**
|
|
97
93
|
* Operations allowed for the token.
|
|
98
94
|
* A union of allowed operations and groups is used as an effective set of allowed operations.
|
|
99
95
|
*/
|
|
100
|
-
ops: S.
|
|
101
|
-
streams: S.
|
|
96
|
+
ops: S.optional(S.NullOr(S.Array(Operation))),
|
|
97
|
+
streams: S.optional(S.NullOr(ResourceSet)),
|
|
102
98
|
}) {}
|
|
103
99
|
|
|
104
100
|
export class AccessTokenInfo extends S.Class<AccessTokenInfo>('AccessTokenInfo')({
|
|
@@ -106,12 +102,12 @@ export class AccessTokenInfo extends S.Class<AccessTokenInfo>('AccessTokenInfo')
|
|
|
106
102
|
* Namespace streams based on the configured stream-level scope, which must be a prefix.
|
|
107
103
|
* Stream name arguments will be automatically prefixed, and the prefix will be stripped when listing streams.
|
|
108
104
|
*/
|
|
109
|
-
auto_prefix_streams: S.
|
|
105
|
+
auto_prefix_streams: S.Boolean.pipe(S.optional, S.withDecodingDefault(Effect.succeed(false))),
|
|
110
106
|
/**
|
|
111
107
|
* Expiration time in ISO 8601 format.
|
|
112
108
|
* If not set, the expiration will be set to that of the requestor's token.
|
|
113
109
|
*/
|
|
114
|
-
expires_at: S.
|
|
110
|
+
expires_at: S.optional(S.NullOr(S.String)),
|
|
115
111
|
/**
|
|
116
112
|
* Access token ID.
|
|
117
113
|
* It must be unique to the account and between 1 and 96 bytes in length.
|
|
@@ -127,7 +123,7 @@ export class ListAccessTokensResponse extends S.Class<ListAccessTokensResponse>(
|
|
|
127
123
|
/**
|
|
128
124
|
* Matching access tokens.
|
|
129
125
|
*/
|
|
130
|
-
access_tokens: S.Array(AccessTokenInfo).
|
|
126
|
+
access_tokens: S.Array(AccessTokenInfo).check(S.isMaxLength(1000)),
|
|
131
127
|
/**
|
|
132
128
|
* Indicates that there are more access tokens that match the criteria.
|
|
133
129
|
*/
|
|
@@ -135,7 +131,7 @@ export class ListAccessTokensResponse extends S.Class<ListAccessTokensResponse>(
|
|
|
135
131
|
}) {}
|
|
136
132
|
|
|
137
133
|
export class ErrorResponse extends S.Class<ErrorResponse>('ErrorResponse')({
|
|
138
|
-
code: S.
|
|
134
|
+
code: S.optional(S.NullOr(S.String)),
|
|
139
135
|
message: S.String,
|
|
140
136
|
}) {}
|
|
141
137
|
|
|
@@ -146,18 +142,15 @@ export class IssueAccessTokenResponse extends S.Class<IssueAccessTokenResponse>(
|
|
|
146
142
|
access_token: S.String,
|
|
147
143
|
}) {}
|
|
148
144
|
|
|
149
|
-
export class ListBasinsParams extends S.
|
|
150
|
-
prefix: S.
|
|
151
|
-
start_after: S.
|
|
152
|
-
limit: S.
|
|
153
|
-
nullable: true,
|
|
154
|
-
default: () => 1000 as const,
|
|
155
|
-
}),
|
|
145
|
+
export class ListBasinsParams extends S.Class<ListBasinsParams>('ListBasinsParams')({
|
|
146
|
+
prefix: S.String.pipe(S.optional, S.withDecodingDefault(Effect.succeed(''))),
|
|
147
|
+
start_after: S.String.pipe(S.optional, S.withDecodingDefault(Effect.succeed(''))),
|
|
148
|
+
limit: S.Int.check(S.isGreaterThanOrEqualTo(0), S.isLessThanOrEqualTo(1000)).pipe(S.optional, S.withDecodingDefault(Effect.succeed(1000))),
|
|
156
149
|
}) {}
|
|
157
150
|
|
|
158
|
-
export
|
|
151
|
+
export const BasinScope = S.Literal('aws:us-east-1')
|
|
159
152
|
|
|
160
|
-
export
|
|
153
|
+
export const BasinState = S.Literals(['active', 'creating', 'deleting'])
|
|
161
154
|
|
|
162
155
|
export class BasinInfo extends S.Class<BasinInfo>('BasinInfo')({
|
|
163
156
|
/**
|
|
@@ -178,7 +171,7 @@ export class ListBasinsResponse extends S.Class<ListBasinsResponse>('ListBasinsR
|
|
|
178
171
|
/**
|
|
179
172
|
* Matching basins.
|
|
180
173
|
*/
|
|
181
|
-
basins: S.Array(BasinInfo).
|
|
174
|
+
basins: S.Array(BasinInfo).check(S.isMaxLength(1000)),
|
|
182
175
|
/**
|
|
183
176
|
* Indicates that there are more basins that match the criteria.
|
|
184
177
|
*/
|
|
@@ -190,12 +183,12 @@ export class DeleteOnEmptyConfig extends S.Class<DeleteOnEmptyConfig>('DeleteOnE
|
|
|
190
183
|
* Minimum age in seconds before an empty stream can be deleted.
|
|
191
184
|
* Set to 0 (default) to disable delete-on-empty (don't delete automatically).
|
|
192
185
|
*/
|
|
193
|
-
min_age_secs: S.
|
|
186
|
+
min_age_secs: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
194
187
|
}) {}
|
|
195
188
|
|
|
196
|
-
export
|
|
189
|
+
export const InfiniteRetention = S.Record(S.String, S.Unknown)
|
|
197
190
|
|
|
198
|
-
export
|
|
191
|
+
export const RetentionPolicy = S.Union([
|
|
199
192
|
/**
|
|
200
193
|
* Age in seconds for automatic trimming of records older than this threshold.
|
|
201
194
|
* This must be set to a value greater than 0 seconds.
|
|
@@ -207,7 +200,7 @@ export class RetentionPolicy extends S.Union(
|
|
|
207
200
|
* This must be set to a value greater than 0 seconds.
|
|
208
201
|
* (While S2 is in public preview, this is capped at 28 days. Let us know if you'd like the cap removed.)
|
|
209
202
|
*/
|
|
210
|
-
age: S.Int.
|
|
203
|
+
age: S.Int.check(S.isGreaterThanOrEqualTo(0)),
|
|
211
204
|
}),
|
|
212
205
|
/**
|
|
213
206
|
* Retain records unless explicitly trimmed.
|
|
@@ -218,38 +211,38 @@ export class RetentionPolicy extends S.Union(
|
|
|
218
211
|
*/
|
|
219
212
|
infinite: InfiniteRetention,
|
|
220
213
|
}),
|
|
221
|
-
)
|
|
214
|
+
])
|
|
222
215
|
|
|
223
|
-
export
|
|
216
|
+
export const StorageClass = S.Literals(['standard', 'express'])
|
|
224
217
|
|
|
225
|
-
export
|
|
218
|
+
export const TimestampingMode = S.Literals(['client-prefer', 'client-require', 'arrival'])
|
|
226
219
|
|
|
227
220
|
export class TimestampingConfig extends S.Class<TimestampingConfig>('TimestampingConfig')({
|
|
228
|
-
mode: S.
|
|
221
|
+
mode: S.optional(S.NullOr(TimestampingMode)),
|
|
229
222
|
/**
|
|
230
223
|
* Allow client-specified timestamps to exceed the arrival time.
|
|
231
224
|
* If this is `false` or not set, client timestamps will be capped at the arrival time.
|
|
232
225
|
*/
|
|
233
|
-
uncapped: S.
|
|
226
|
+
uncapped: S.optional(S.NullOr(S.Boolean)),
|
|
234
227
|
}) {}
|
|
235
228
|
|
|
236
229
|
export class StreamConfig extends S.Class<StreamConfig>('StreamConfig')({
|
|
237
|
-
delete_on_empty: S.
|
|
238
|
-
retention_policy: S.
|
|
239
|
-
storage_class: S.
|
|
240
|
-
timestamping: S.
|
|
230
|
+
delete_on_empty: S.optional(S.NullOr(DeleteOnEmptyConfig)),
|
|
231
|
+
retention_policy: S.optional(S.NullOr(RetentionPolicy)),
|
|
232
|
+
storage_class: S.optional(S.NullOr(StorageClass)),
|
|
233
|
+
timestamping: S.optional(S.NullOr(TimestampingConfig)),
|
|
241
234
|
}) {}
|
|
242
235
|
|
|
243
236
|
export class BasinConfig extends S.Class<BasinConfig>('BasinConfig')({
|
|
244
237
|
/**
|
|
245
238
|
* Create stream on append if it doesn't exist, using the default stream configuration.
|
|
246
239
|
*/
|
|
247
|
-
create_stream_on_append: S.
|
|
240
|
+
create_stream_on_append: S.optional(S.NullOr(S.Boolean)),
|
|
248
241
|
/**
|
|
249
242
|
* Create stream on read if it doesn't exist, using the default stream configuration.
|
|
250
243
|
*/
|
|
251
|
-
create_stream_on_read: S.
|
|
252
|
-
default_stream_config: S.
|
|
244
|
+
create_stream_on_read: S.optional(S.NullOr(S.Boolean)),
|
|
245
|
+
default_stream_config: S.optional(S.NullOr(StreamConfig)),
|
|
253
246
|
}) {}
|
|
254
247
|
|
|
255
248
|
export class CreateBasinRequest extends S.Class<CreateBasinRequest>('CreateBasinRequest')({
|
|
@@ -259,18 +252,18 @@ export class CreateBasinRequest extends S.Class<CreateBasinRequest>('CreateBasin
|
|
|
259
252
|
* It cannot begin or end with a hyphen.
|
|
260
253
|
*/
|
|
261
254
|
basin: S.String,
|
|
262
|
-
config: S.
|
|
255
|
+
config: S.optional(S.NullOr(BasinConfig)),
|
|
263
256
|
/**
|
|
264
257
|
* Basin scope.
|
|
265
258
|
*/
|
|
266
|
-
scope: S.
|
|
259
|
+
scope: BasinScope.pipe(S.optional, S.withDecodingDefault(Effect.succeed('aws:us-east-1'))),
|
|
267
260
|
}) {}
|
|
268
261
|
|
|
269
|
-
export class CreateOrReconfigureBasinParams extends S.
|
|
270
|
-
's2-request-token': S.
|
|
262
|
+
export class CreateOrReconfigureBasinParams extends S.Class<CreateOrReconfigureBasinParams>('CreateOrReconfigureBasinParams')({
|
|
263
|
+
's2-request-token': S.optional(S.NullOr(S.String)),
|
|
271
264
|
}) {}
|
|
272
265
|
|
|
273
|
-
export
|
|
266
|
+
export const CreateOrReconfigureBasinRequest = S.Union([S.Null])
|
|
274
267
|
// export class CreateOrReconfigureBasinRequest extends S.Union(S.Null, CreateOrReconfigureBasinRequest) {}
|
|
275
268
|
|
|
276
269
|
export class DeleteOnEmptyReconfiguration extends S.Class<DeleteOnEmptyReconfiguration>('DeleteOnEmptyReconfiguration')(
|
|
@@ -279,49 +272,49 @@ export class DeleteOnEmptyReconfiguration extends S.Class<DeleteOnEmptyReconfigu
|
|
|
279
272
|
* Minimum age in seconds before an empty stream can be deleted.
|
|
280
273
|
* Set to 0 to disable delete-on-empty (don't delete automatically).
|
|
281
274
|
*/
|
|
282
|
-
min_age_secs: S.
|
|
275
|
+
min_age_secs: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
283
276
|
},
|
|
284
277
|
) {}
|
|
285
278
|
|
|
286
279
|
export class TimestampingReconfiguration extends S.Class<TimestampingReconfiguration>('TimestampingReconfiguration')({
|
|
287
|
-
mode: S.
|
|
280
|
+
mode: S.optional(S.NullOr(TimestampingMode)),
|
|
288
281
|
/**
|
|
289
282
|
* Allow client-specified timestamps to exceed the arrival time.
|
|
290
283
|
*/
|
|
291
|
-
uncapped: S.
|
|
284
|
+
uncapped: S.optional(S.NullOr(S.Boolean)),
|
|
292
285
|
}) {}
|
|
293
286
|
|
|
294
287
|
export class StreamReconfiguration extends S.Class<StreamReconfiguration>('StreamReconfiguration')({
|
|
295
|
-
delete_on_empty: S.
|
|
296
|
-
retention_policy: S.
|
|
297
|
-
storage_class: S.
|
|
298
|
-
timestamping: S.
|
|
288
|
+
delete_on_empty: S.optional(S.NullOr(DeleteOnEmptyReconfiguration)),
|
|
289
|
+
retention_policy: S.optional(S.NullOr(RetentionPolicy)),
|
|
290
|
+
storage_class: S.optional(S.NullOr(StorageClass)),
|
|
291
|
+
timestamping: S.optional(S.NullOr(TimestampingReconfiguration)),
|
|
299
292
|
}) {}
|
|
300
293
|
|
|
301
294
|
export class BasinReconfiguration extends S.Class<BasinReconfiguration>('BasinReconfiguration')({
|
|
302
295
|
/**
|
|
303
296
|
* Create a stream on append.
|
|
304
297
|
*/
|
|
305
|
-
create_stream_on_append: S.
|
|
298
|
+
create_stream_on_append: S.optional(S.NullOr(S.Boolean)),
|
|
306
299
|
/**
|
|
307
300
|
* Create a stream on read.
|
|
308
301
|
*/
|
|
309
|
-
create_stream_on_read: S.
|
|
310
|
-
default_stream_config: S.
|
|
302
|
+
create_stream_on_read: S.optional(S.NullOr(S.Boolean)),
|
|
303
|
+
default_stream_config: S.optional(S.NullOr(StreamReconfiguration)),
|
|
311
304
|
}) {}
|
|
312
305
|
|
|
313
|
-
export
|
|
306
|
+
export const AccountMetricSet = S.Literals(['active-basins', 'account-ops'])
|
|
314
307
|
|
|
315
|
-
export
|
|
308
|
+
export const TimeseriesInterval = S.Literals(['minute', 'hour', 'day'])
|
|
316
309
|
|
|
317
|
-
export class AccountMetricsParams extends S.
|
|
310
|
+
export class AccountMetricsParams extends S.Class<AccountMetricsParams>('AccountMetricsParams')({
|
|
318
311
|
set: AccountMetricSet,
|
|
319
|
-
start: S.
|
|
320
|
-
end: S.
|
|
321
|
-
interval: S.
|
|
312
|
+
start: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
313
|
+
end: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
314
|
+
interval: S.optional(S.NullOr(TimeseriesInterval)),
|
|
322
315
|
}) {}
|
|
323
316
|
|
|
324
|
-
export
|
|
317
|
+
export const MetricUnit = S.Literals(['bytes', 'operations'])
|
|
325
318
|
|
|
326
319
|
export class Scalar extends S.Class<Scalar>('Scalar')({
|
|
327
320
|
/**
|
|
@@ -375,7 +368,7 @@ export class Label extends S.Class<Label>('Label')({
|
|
|
375
368
|
values: S.Array(S.String),
|
|
376
369
|
}) {}
|
|
377
370
|
|
|
378
|
-
export
|
|
371
|
+
export const Metric = S.Union([
|
|
379
372
|
/**
|
|
380
373
|
* Single named value.
|
|
381
374
|
*/
|
|
@@ -414,7 +407,7 @@ export class Metric extends S.Union(
|
|
|
414
407
|
*/
|
|
415
408
|
label: Label,
|
|
416
409
|
}),
|
|
417
|
-
)
|
|
410
|
+
])
|
|
418
411
|
|
|
419
412
|
export class MetricSetResponse extends S.Class<MetricSetResponse>('MetricSetResponse')({
|
|
420
413
|
/**
|
|
@@ -423,38 +416,35 @@ export class MetricSetResponse extends S.Class<MetricSetResponse>('MetricSetResp
|
|
|
423
416
|
values: S.Array(Metric),
|
|
424
417
|
}) {}
|
|
425
418
|
|
|
426
|
-
export
|
|
419
|
+
export const BasinMetricSet = S.Literals([
|
|
427
420
|
'storage',
|
|
428
421
|
'append-ops',
|
|
429
422
|
'read-ops',
|
|
430
423
|
'read-throughput',
|
|
431
424
|
'append-throughput',
|
|
432
425
|
'basin-ops',
|
|
433
|
-
)
|
|
426
|
+
])
|
|
434
427
|
|
|
435
|
-
export class BasinMetricsParams extends S.
|
|
428
|
+
export class BasinMetricsParams extends S.Class<BasinMetricsParams>('BasinMetricsParams')({
|
|
436
429
|
set: BasinMetricSet,
|
|
437
|
-
start: S.
|
|
438
|
-
end: S.
|
|
439
|
-
interval: S.
|
|
430
|
+
start: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
431
|
+
end: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
432
|
+
interval: S.optional(S.NullOr(TimeseriesInterval)),
|
|
440
433
|
}) {}
|
|
441
434
|
|
|
442
|
-
export
|
|
435
|
+
export const StreamMetricSet = S.Literal('storage')
|
|
443
436
|
|
|
444
|
-
export class StreamMetricsParams extends S.
|
|
437
|
+
export class StreamMetricsParams extends S.Class<StreamMetricsParams>('StreamMetricsParams')({
|
|
445
438
|
set: StreamMetricSet,
|
|
446
|
-
start: S.
|
|
447
|
-
end: S.
|
|
448
|
-
interval: S.
|
|
439
|
+
start: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
440
|
+
end: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
441
|
+
interval: S.optional(S.NullOr(TimeseriesInterval)),
|
|
449
442
|
}) {}
|
|
450
443
|
|
|
451
|
-
export class ListStreamsParams extends S.
|
|
452
|
-
prefix: S.
|
|
453
|
-
start_after: S.
|
|
454
|
-
limit: S.
|
|
455
|
-
nullable: true,
|
|
456
|
-
default: () => 1000 as const,
|
|
457
|
-
}),
|
|
444
|
+
export class ListStreamsParams extends S.Class<ListStreamsParams>('ListStreamsParams')({
|
|
445
|
+
prefix: S.String.pipe(S.optional, S.withDecodingDefault(Effect.succeed(''))),
|
|
446
|
+
start_after: S.String.pipe(S.optional, S.withDecodingDefault(Effect.succeed(''))),
|
|
447
|
+
limit: S.Int.check(S.isGreaterThanOrEqualTo(0), S.isLessThanOrEqualTo(1000)).pipe(S.optional, S.withDecodingDefault(Effect.succeed(1000))),
|
|
458
448
|
}) {}
|
|
459
449
|
|
|
460
450
|
export class StreamInfo extends S.Class<StreamInfo>('StreamInfo')({
|
|
@@ -465,7 +455,7 @@ export class StreamInfo extends S.Class<StreamInfo>('StreamInfo')({
|
|
|
465
455
|
/**
|
|
466
456
|
* Deletion time in ISO 8601 format, if the stream is being deleted.
|
|
467
457
|
*/
|
|
468
|
-
deleted_at: S.
|
|
458
|
+
deleted_at: S.optional(S.NullOr(S.String)),
|
|
469
459
|
/**
|
|
470
460
|
* Stream name.
|
|
471
461
|
*/
|
|
@@ -480,11 +470,11 @@ export class ListStreamsResponse extends S.Class<ListStreamsResponse>('ListStrea
|
|
|
480
470
|
/**
|
|
481
471
|
* Matching streams.
|
|
482
472
|
*/
|
|
483
|
-
streams: S.Array(StreamInfo).
|
|
473
|
+
streams: S.Array(StreamInfo).check(S.isMaxLength(1000)),
|
|
484
474
|
}) {}
|
|
485
475
|
|
|
486
476
|
export class CreateStreamRequest extends S.Class<CreateStreamRequest>('CreateStreamRequest')({
|
|
487
|
-
config: S.
|
|
477
|
+
config: S.optional(S.NullOr(StreamConfig)),
|
|
488
478
|
/**
|
|
489
479
|
* Stream name that is unique to the basin.
|
|
490
480
|
* It can be between 1 and 512 bytes in length.
|
|
@@ -492,25 +482,25 @@ export class CreateStreamRequest extends S.Class<CreateStreamRequest>('CreateStr
|
|
|
492
482
|
stream: S.String,
|
|
493
483
|
}) {}
|
|
494
484
|
|
|
495
|
-
export class CreateOrReconfigureStreamParams extends S.
|
|
496
|
-
's2-request-token': S.
|
|
485
|
+
export class CreateOrReconfigureStreamParams extends S.Class<CreateOrReconfigureStreamParams>('CreateOrReconfigureStreamParams')({
|
|
486
|
+
's2-request-token': S.optional(S.NullOr(S.String)),
|
|
497
487
|
}) {}
|
|
498
488
|
|
|
499
|
-
export
|
|
489
|
+
export const CreateOrReconfigureStreamRequest = S.Union([S.Null, StreamConfig])
|
|
500
490
|
|
|
501
|
-
export
|
|
491
|
+
export const S2Format = S.Literals(['raw', 'base64'])
|
|
502
492
|
|
|
503
|
-
export
|
|
493
|
+
export const U64 = S.Int.check(S.isGreaterThanOrEqualTo(0))
|
|
504
494
|
|
|
505
|
-
export class ReadParams extends S.
|
|
506
|
-
's2-format': S.
|
|
507
|
-
seq_num: S.
|
|
508
|
-
timestamp: S.
|
|
509
|
-
tail_offset: S.
|
|
510
|
-
count: S.
|
|
511
|
-
bytes: S.
|
|
512
|
-
until: S.
|
|
513
|
-
clamp: S.
|
|
495
|
+
export class ReadParams extends S.Class<ReadParams>('ReadParams')({
|
|
496
|
+
's2-format': S.optional(S.NullOr(S2Format)),
|
|
497
|
+
seq_num: S.optional(S.NullOr(U64)),
|
|
498
|
+
timestamp: S.optional(S.NullOr(U64)),
|
|
499
|
+
tail_offset: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
500
|
+
count: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
501
|
+
bytes: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
502
|
+
until: S.optional(S.NullOr(U64)),
|
|
503
|
+
clamp: S.optional(S.NullOr(S.Boolean)),
|
|
514
504
|
}) {}
|
|
515
505
|
|
|
516
506
|
/**
|
|
@@ -518,7 +508,7 @@ export class ReadParams extends S.Struct({
|
|
|
518
508
|
*
|
|
519
509
|
* The name cannot be empty, with the exception of an S2 command record.
|
|
520
510
|
*/
|
|
521
|
-
export
|
|
511
|
+
export const Header = S.NonEmptyArray(S.String).check(S.isMinLength(2), S.isMaxLength(2))
|
|
522
512
|
|
|
523
513
|
/**
|
|
524
514
|
* Record that is durably sequenced on a stream.
|
|
@@ -527,11 +517,11 @@ export class SequencedRecord extends S.Class<SequencedRecord>('SequencedRecord')
|
|
|
527
517
|
/**
|
|
528
518
|
* Body of the record.
|
|
529
519
|
*/
|
|
530
|
-
body: S.
|
|
520
|
+
body: S.optional(S.NullOr(S.String)),
|
|
531
521
|
/**
|
|
532
522
|
* Series of name-value pairs for this record.
|
|
533
523
|
*/
|
|
534
|
-
headers: S.
|
|
524
|
+
headers: S.optional(S.NullOr(S.Array(Header))),
|
|
535
525
|
/**
|
|
536
526
|
* Sequence number assigned by the service.
|
|
537
527
|
*/
|
|
@@ -549,12 +539,12 @@ export class StreamPosition extends S.Class<StreamPosition>('StreamPosition')({
|
|
|
549
539
|
/**
|
|
550
540
|
* Sequence number assigned by the service.
|
|
551
541
|
*/
|
|
552
|
-
seq_num: S.Int.
|
|
542
|
+
seq_num: S.Int.check(S.isGreaterThanOrEqualTo(0)),
|
|
553
543
|
/**
|
|
554
544
|
* Timestamp, which may be client-specified or assigned by the service.
|
|
555
545
|
* If it is assigned by the service, it will represent milliseconds since Unix epoch.
|
|
556
546
|
*/
|
|
557
|
-
timestamp: S.Int.
|
|
547
|
+
timestamp: S.Int.check(S.isGreaterThanOrEqualTo(0)),
|
|
558
548
|
}) {}
|
|
559
549
|
|
|
560
550
|
export class ReadBatch extends S.Class<ReadBatch>('ReadBatch')({
|
|
@@ -563,7 +553,7 @@ export class ReadBatch extends S.Class<ReadBatch>('ReadBatch')({
|
|
|
563
553
|
* This can only be empty in response to a regular (non-SSE) read, if the request cannot be satisfied without violating an explicit limit.
|
|
564
554
|
*/
|
|
565
555
|
records: S.Array(SequencedRecord),
|
|
566
|
-
tail: S.
|
|
556
|
+
tail: S.optional(S.NullOr(StreamPosition)),
|
|
567
557
|
}) {}
|
|
568
558
|
|
|
569
559
|
export class TailResponse extends S.Class<TailResponse>('TailResponse')({
|
|
@@ -573,8 +563,8 @@ export class TailResponse extends S.Class<TailResponse>('TailResponse')({
|
|
|
573
563
|
tail: StreamPosition,
|
|
574
564
|
}) {}
|
|
575
565
|
|
|
576
|
-
export class AppendParams extends S.
|
|
577
|
-
's2-format': S.
|
|
566
|
+
export class AppendParams extends S.Class<AppendParams>('AppendParams')({
|
|
567
|
+
's2-format': S.optional(S.NullOr(S2Format)),
|
|
578
568
|
}) {}
|
|
579
569
|
|
|
580
570
|
/**
|
|
@@ -584,12 +574,12 @@ export class AppendRecord extends S.Class<AppendRecord>('AppendRecord')({
|
|
|
584
574
|
/**
|
|
585
575
|
* Body of the record.
|
|
586
576
|
*/
|
|
587
|
-
body: S.
|
|
577
|
+
body: S.optional(S.NullOr(S.String)),
|
|
588
578
|
/**
|
|
589
579
|
* Series of name-value pairs for this record.
|
|
590
580
|
*/
|
|
591
|
-
headers: S.
|
|
592
|
-
timestamp: S.
|
|
581
|
+
headers: S.optional(S.NullOr(S.Array(Header))),
|
|
582
|
+
timestamp: S.optional(S.NullOr(U64)),
|
|
593
583
|
}) {}
|
|
594
584
|
|
|
595
585
|
/**
|
|
@@ -599,8 +589,8 @@ export class AppendInput extends S.Class<AppendInput>('AppendInput')({
|
|
|
599
589
|
/**
|
|
600
590
|
* Enforce a fencing token, which starts out as an empty string that can be overridden by a `fence` command record.
|
|
601
591
|
*/
|
|
602
|
-
fencing_token: S.
|
|
603
|
-
match_seq_num: S.
|
|
592
|
+
fencing_token: S.optional(S.NullOr(S.String)),
|
|
593
|
+
match_seq_num: S.optional(S.NullOr(U64)),
|
|
604
594
|
/**
|
|
605
595
|
* Batch of records to append atomically, which must contain at least one record, and no more than 1000.
|
|
606
596
|
* The total size of a batch of records may not exceed 1 MiB of metered bytes.
|
|
@@ -631,7 +621,7 @@ export class AppendAck extends S.Class<AppendAck>('AppendAck')({
|
|
|
631
621
|
/**
|
|
632
622
|
* Aborted due to a failed condition.
|
|
633
623
|
*/
|
|
634
|
-
export
|
|
624
|
+
export const AppendConditionFailed = S.Union([
|
|
635
625
|
/**
|
|
636
626
|
* Fencing token did not match.
|
|
637
627
|
* The expected fencing token is returned.
|
|
@@ -652,9 +642,9 @@ export class AppendConditionFailed extends S.Union(
|
|
|
652
642
|
* Sequence number did not match the tail of the stream.
|
|
653
643
|
* The expected next sequence number is returned.
|
|
654
644
|
*/
|
|
655
|
-
seq_num_mismatch: S.Int.
|
|
645
|
+
seq_num_mismatch: S.Int.check(S.isGreaterThanOrEqualTo(0)),
|
|
656
646
|
}),
|
|
657
|
-
)
|
|
647
|
+
])
|
|
658
648
|
|
|
659
649
|
export const make = (
|
|
660
650
|
httpClient: HttpClient.HttpClient,
|
|
@@ -667,29 +657,29 @@ export const make = (
|
|
|
667
657
|
Effect.orElseSucceed(response.json, () => 'Unexpected status code'),
|
|
668
658
|
(description) =>
|
|
669
659
|
Effect.fail(
|
|
670
|
-
new HttpClientError.
|
|
660
|
+
new HttpClientError.StatusCodeError({
|
|
671
661
|
request: response.request,
|
|
672
662
|
response,
|
|
673
|
-
reason: 'StatusCode',
|
|
674
663
|
description: typeof description === 'string' ? description : JSON.stringify(description),
|
|
675
664
|
}),
|
|
676
665
|
),
|
|
677
666
|
)
|
|
678
667
|
const withResponse: <A, E>(
|
|
679
668
|
f: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<A, E>,
|
|
680
|
-
) => (request: HttpClientRequest.HttpClientRequest) => Effect.Effect<any, any> =
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
Effect.flatMap(
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
669
|
+
) => (request: HttpClientRequest.HttpClientRequest) => Effect.Effect<any, any> =
|
|
670
|
+
options.transformClient !== undefined
|
|
671
|
+
? (f) => (request) =>
|
|
672
|
+
Effect.flatMap(
|
|
673
|
+
Effect.flatMap(options.transformClient!(httpClient), (client) => client.execute(request)),
|
|
674
|
+
f,
|
|
675
|
+
)
|
|
676
|
+
: (f) => (request) => Effect.flatMap(httpClient.execute(request), f)
|
|
687
677
|
const decodeSuccess =
|
|
688
|
-
<A, I, R>(schema: S.
|
|
678
|
+
<A, I, R>(schema: S.Codec<A, I, R>) =>
|
|
689
679
|
(response: HttpClientResponse.HttpClientResponse) =>
|
|
690
680
|
HttpClientResponse.schemaBodyJson(schema)(response)
|
|
691
681
|
const decodeError =
|
|
692
|
-
<const Tag extends string, A, I, R>(tag: Tag, schema: S.
|
|
682
|
+
<const Tag extends string, A, I, R>(tag: Tag, schema: S.Codec<A, I, R>) =>
|
|
693
683
|
(response: HttpClientResponse.HttpClientResponse) =>
|
|
694
684
|
Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)(response), (cause) =>
|
|
695
685
|
Effect.fail(ClientError(tag, cause, response)),
|
|
@@ -697,6 +687,7 @@ export const make = (
|
|
|
697
687
|
return {
|
|
698
688
|
httpClient,
|
|
699
689
|
listAccessTokens: (options) =>
|
|
690
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
700
691
|
HttpClientRequest.get(`/access-tokens`).pipe(
|
|
701
692
|
HttpClientRequest.setUrlParams({
|
|
702
693
|
prefix: options?.prefix as any,
|
|
@@ -713,8 +704,9 @@ export const make = (
|
|
|
713
704
|
),
|
|
714
705
|
),
|
|
715
706
|
issueAccessToken: (options) =>
|
|
707
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
716
708
|
HttpClientRequest.post(`/access-tokens`).pipe(
|
|
717
|
-
HttpClientRequest.
|
|
709
|
+
HttpClientRequest.bodyJsonUnsafe(options),
|
|
718
710
|
withResponse(
|
|
719
711
|
HttpClientResponse.matchStatus({
|
|
720
712
|
'2xx': decodeSuccess(IssueAccessTokenResponse),
|
|
@@ -726,7 +718,8 @@ export const make = (
|
|
|
726
718
|
),
|
|
727
719
|
),
|
|
728
720
|
revokeAccessToken: (id) =>
|
|
729
|
-
|
|
721
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
722
|
+
HttpClientRequest.delete(`/access-tokens/${id}`).pipe(
|
|
730
723
|
withResponse(
|
|
731
724
|
HttpClientResponse.matchStatus({
|
|
732
725
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
@@ -737,6 +730,7 @@ export const make = (
|
|
|
737
730
|
),
|
|
738
731
|
),
|
|
739
732
|
listBasins: (options) =>
|
|
733
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
740
734
|
HttpClientRequest.get(`/basins`).pipe(
|
|
741
735
|
HttpClientRequest.setUrlParams({
|
|
742
736
|
prefix: options?.prefix as any,
|
|
@@ -753,8 +747,9 @@ export const make = (
|
|
|
753
747
|
),
|
|
754
748
|
),
|
|
755
749
|
createBasin: (options) =>
|
|
750
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
756
751
|
HttpClientRequest.post(`/basins`).pipe(
|
|
757
|
-
HttpClientRequest.
|
|
752
|
+
HttpClientRequest.bodyJsonUnsafe(options),
|
|
758
753
|
withResponse(
|
|
759
754
|
HttpClientResponse.matchStatus({
|
|
760
755
|
'200': decodeSuccess(BasinInfo),
|
|
@@ -768,6 +763,7 @@ export const make = (
|
|
|
768
763
|
),
|
|
769
764
|
),
|
|
770
765
|
getBasinConfig: (basin) =>
|
|
766
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
771
767
|
HttpClientRequest.get(`/basins/${basin}`).pipe(
|
|
772
768
|
withResponse(
|
|
773
769
|
HttpClientResponse.matchStatus({
|
|
@@ -780,9 +776,10 @@ export const make = (
|
|
|
780
776
|
),
|
|
781
777
|
),
|
|
782
778
|
createOrReconfigureBasin: (basin, options) =>
|
|
779
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
783
780
|
HttpClientRequest.put(`/basins/${basin}`).pipe(
|
|
784
781
|
HttpClientRequest.setHeaders({ 's2-request-token': options.params?.['s2-request-token'] ?? undefined }),
|
|
785
|
-
HttpClientRequest.
|
|
782
|
+
HttpClientRequest.bodyJsonUnsafe(options.payload),
|
|
786
783
|
withResponse(
|
|
787
784
|
HttpClientResponse.matchStatus({
|
|
788
785
|
'200': decodeSuccess(BasinInfo),
|
|
@@ -794,7 +791,8 @@ export const make = (
|
|
|
794
791
|
),
|
|
795
792
|
),
|
|
796
793
|
deleteBasin: (basin) =>
|
|
797
|
-
|
|
794
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
795
|
+
HttpClientRequest.delete(`/basins/${basin}`).pipe(
|
|
798
796
|
withResponse(
|
|
799
797
|
HttpClientResponse.matchStatus({
|
|
800
798
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
@@ -807,8 +805,9 @@ export const make = (
|
|
|
807
805
|
),
|
|
808
806
|
),
|
|
809
807
|
reconfigureBasin: (basin, options) =>
|
|
808
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
810
809
|
HttpClientRequest.patch(`/basins/${basin}`).pipe(
|
|
811
|
-
HttpClientRequest.
|
|
810
|
+
HttpClientRequest.bodyJsonUnsafe(options),
|
|
812
811
|
withResponse(
|
|
813
812
|
HttpClientResponse.matchStatus({
|
|
814
813
|
'2xx': decodeSuccess(BasinConfig),
|
|
@@ -820,6 +819,7 @@ export const make = (
|
|
|
820
819
|
),
|
|
821
820
|
),
|
|
822
821
|
accountMetrics: (options) =>
|
|
822
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
823
823
|
HttpClientRequest.get(`/metrics`).pipe(
|
|
824
824
|
HttpClientRequest.setUrlParams({
|
|
825
825
|
set: options?.set as any,
|
|
@@ -837,6 +837,7 @@ export const make = (
|
|
|
837
837
|
),
|
|
838
838
|
),
|
|
839
839
|
basinMetrics: (basin, options) =>
|
|
840
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
840
841
|
HttpClientRequest.get(`/metrics/${basin}`).pipe(
|
|
841
842
|
HttpClientRequest.setUrlParams({
|
|
842
843
|
set: options?.set as any,
|
|
@@ -854,6 +855,7 @@ export const make = (
|
|
|
854
855
|
),
|
|
855
856
|
),
|
|
856
857
|
streamMetrics: (basin, stream, options) =>
|
|
858
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
857
859
|
HttpClientRequest.get(`/metrics/${basin}/${stream}`).pipe(
|
|
858
860
|
HttpClientRequest.setUrlParams({
|
|
859
861
|
set: options?.set as any,
|
|
@@ -871,6 +873,7 @@ export const make = (
|
|
|
871
873
|
),
|
|
872
874
|
),
|
|
873
875
|
listStreams: (options) =>
|
|
876
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
874
877
|
HttpClientRequest.get(`/streams`).pipe(
|
|
875
878
|
HttpClientRequest.setUrlParams({
|
|
876
879
|
prefix: options?.prefix as any,
|
|
@@ -888,8 +891,9 @@ export const make = (
|
|
|
888
891
|
),
|
|
889
892
|
),
|
|
890
893
|
createStream: (options) =>
|
|
894
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
891
895
|
HttpClientRequest.post(`/streams`).pipe(
|
|
892
|
-
HttpClientRequest.
|
|
896
|
+
HttpClientRequest.bodyJsonUnsafe(options),
|
|
893
897
|
withResponse(
|
|
894
898
|
HttpClientResponse.matchStatus({
|
|
895
899
|
'2xx': decodeSuccess(StreamInfo),
|
|
@@ -902,6 +906,7 @@ export const make = (
|
|
|
902
906
|
),
|
|
903
907
|
),
|
|
904
908
|
getStreamConfig: (stream) =>
|
|
909
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
905
910
|
HttpClientRequest.get(`/streams/${stream}`).pipe(
|
|
906
911
|
withResponse(
|
|
907
912
|
HttpClientResponse.matchStatus({
|
|
@@ -915,9 +920,10 @@ export const make = (
|
|
|
915
920
|
),
|
|
916
921
|
),
|
|
917
922
|
createOrReconfigureStream: (stream, options) =>
|
|
923
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
918
924
|
HttpClientRequest.put(`/streams/${stream}`).pipe(
|
|
919
925
|
HttpClientRequest.setHeaders({ 's2-request-token': options.params?.['s2-request-token'] ?? undefined }),
|
|
920
|
-
HttpClientRequest.
|
|
926
|
+
HttpClientRequest.bodyJsonUnsafe(options.payload),
|
|
921
927
|
withResponse(
|
|
922
928
|
HttpClientResponse.matchStatus({
|
|
923
929
|
'2xx': decodeSuccess(StreamInfo),
|
|
@@ -931,7 +937,8 @@ export const make = (
|
|
|
931
937
|
),
|
|
932
938
|
),
|
|
933
939
|
deleteStream: (stream) =>
|
|
934
|
-
|
|
940
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
941
|
+
HttpClientRequest.delete(`/streams/${stream}`).pipe(
|
|
935
942
|
withResponse(
|
|
936
943
|
HttpClientResponse.matchStatus({
|
|
937
944
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
@@ -943,8 +950,9 @@ export const make = (
|
|
|
943
950
|
),
|
|
944
951
|
),
|
|
945
952
|
reconfigureStream: (stream, options) =>
|
|
953
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
946
954
|
HttpClientRequest.patch(`/streams/${stream}`).pipe(
|
|
947
|
-
HttpClientRequest.
|
|
955
|
+
HttpClientRequest.bodyJsonUnsafe(options),
|
|
948
956
|
withResponse(
|
|
949
957
|
HttpClientResponse.matchStatus({
|
|
950
958
|
'2xx': decodeSuccess(StreamConfig),
|
|
@@ -957,6 +965,7 @@ export const make = (
|
|
|
957
965
|
),
|
|
958
966
|
),
|
|
959
967
|
read: (stream, options) =>
|
|
968
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
960
969
|
HttpClientRequest.get(`/streams/${stream}/records`).pipe(
|
|
961
970
|
HttpClientRequest.setUrlParams({
|
|
962
971
|
seq_num: options?.seq_num as any,
|
|
@@ -982,9 +991,10 @@ export const make = (
|
|
|
982
991
|
),
|
|
983
992
|
),
|
|
984
993
|
append: (stream, options) =>
|
|
994
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
985
995
|
HttpClientRequest.post(`/streams/${stream}/records`).pipe(
|
|
986
996
|
HttpClientRequest.setHeaders({ 's2-format': options.params?.['s2-format'] ?? undefined }),
|
|
987
|
-
HttpClientRequest.
|
|
997
|
+
HttpClientRequest.bodyJsonUnsafe(options.payload),
|
|
988
998
|
withResponse(
|
|
989
999
|
HttpClientResponse.matchStatus({
|
|
990
1000
|
'2xx': decodeSuccess(AppendAck),
|
|
@@ -999,6 +1009,7 @@ export const make = (
|
|
|
999
1009
|
),
|
|
1000
1010
|
),
|
|
1001
1011
|
checkTail: (stream) =>
|
|
1012
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
1002
1013
|
HttpClientRequest.get(`/streams/${stream}/records/tail`).pipe(
|
|
1003
1014
|
withResponse(
|
|
1004
1015
|
HttpClientResponse.matchStatus({
|
|
@@ -1021,13 +1032,10 @@ export interface Client {
|
|
|
1021
1032
|
* List access tokens.
|
|
1022
1033
|
*/
|
|
1023
1034
|
readonly listAccessTokens: (
|
|
1024
|
-
options?: typeof ListAccessTokensParams.Encoded
|
|
1035
|
+
options?: typeof ListAccessTokensParams.Encoded,
|
|
1025
1036
|
) => Effect.Effect<
|
|
1026
1037
|
typeof ListAccessTokensResponse.Type,
|
|
1027
|
-
|
|
|
1028
|
-
| ParseResult.ParseError
|
|
1029
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1030
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1038
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1031
1039
|
>
|
|
1032
1040
|
/**
|
|
1033
1041
|
* Issue a new access token.
|
|
@@ -1036,11 +1044,7 @@ export interface Client {
|
|
|
1036
1044
|
options: typeof AccessTokenInfo.Encoded,
|
|
1037
1045
|
) => Effect.Effect<
|
|
1038
1046
|
typeof IssueAccessTokenResponse.Type,
|
|
1039
|
-
|
|
|
1040
|
-
| ParseResult.ParseError
|
|
1041
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1042
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1043
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1047
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1044
1048
|
>
|
|
1045
1049
|
/**
|
|
1046
1050
|
* Revoke an access token.
|
|
@@ -1049,22 +1053,16 @@ export interface Client {
|
|
|
1049
1053
|
id: string,
|
|
1050
1054
|
) => Effect.Effect<
|
|
1051
1055
|
void,
|
|
1052
|
-
|
|
|
1053
|
-
| ParseResult.ParseError
|
|
1054
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1055
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1056
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1056
1057
|
>
|
|
1057
1058
|
/**
|
|
1058
1059
|
* List basins.
|
|
1059
1060
|
*/
|
|
1060
1061
|
readonly listBasins: (
|
|
1061
|
-
options?: typeof ListBasinsParams.Encoded
|
|
1062
|
+
options?: typeof ListBasinsParams.Encoded,
|
|
1062
1063
|
) => Effect.Effect<
|
|
1063
1064
|
typeof ListBasinsResponse.Type,
|
|
1064
|
-
|
|
|
1065
|
-
| ParseResult.ParseError
|
|
1066
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1067
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1065
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1068
1066
|
>
|
|
1069
1067
|
/**
|
|
1070
1068
|
* Create a basin.
|
|
@@ -1072,13 +1070,8 @@ export interface Client {
|
|
|
1072
1070
|
readonly createBasin: (
|
|
1073
1071
|
options: typeof CreateBasinRequest.Encoded,
|
|
1074
1072
|
) => Effect.Effect<
|
|
1075
|
-
typeof BasinInfo.Type
|
|
1076
|
-
|
|
|
1077
|
-
| ParseResult.ParseError
|
|
1078
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1079
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1080
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1081
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1073
|
+
typeof BasinInfo.Type,
|
|
1074
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1082
1075
|
>
|
|
1083
1076
|
/**
|
|
1084
1077
|
* Get basin configuration.
|
|
@@ -1087,11 +1080,7 @@ export interface Client {
|
|
|
1087
1080
|
basin: string,
|
|
1088
1081
|
) => Effect.Effect<
|
|
1089
1082
|
typeof BasinConfig.Type,
|
|
1090
|
-
|
|
|
1091
|
-
| ParseResult.ParseError
|
|
1092
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1093
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1094
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1083
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1095
1084
|
>
|
|
1096
1085
|
/**
|
|
1097
1086
|
* Create or reconfigure a basin.
|
|
@@ -1103,8 +1092,8 @@ export interface Client {
|
|
|
1103
1092
|
readonly payload: typeof CreateOrReconfigureBasinRequest.Encoded
|
|
1104
1093
|
},
|
|
1105
1094
|
) => Effect.Effect<
|
|
1106
|
-
typeof BasinInfo.Type
|
|
1107
|
-
HttpClientError.HttpClientError |
|
|
1095
|
+
typeof BasinInfo.Type,
|
|
1096
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1108
1097
|
>
|
|
1109
1098
|
/**
|
|
1110
1099
|
* Delete a basin.
|
|
@@ -1113,12 +1102,7 @@ export interface Client {
|
|
|
1113
1102
|
basin: string,
|
|
1114
1103
|
) => Effect.Effect<
|
|
1115
1104
|
void,
|
|
1116
|
-
|
|
|
1117
|
-
| ParseResult.ParseError
|
|
1118
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1119
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1120
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1121
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1105
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1122
1106
|
>
|
|
1123
1107
|
/**
|
|
1124
1108
|
* Reconfigure a basin.
|
|
@@ -1128,11 +1112,7 @@ export interface Client {
|
|
|
1128
1112
|
options: typeof BasinReconfiguration.Encoded,
|
|
1129
1113
|
) => Effect.Effect<
|
|
1130
1114
|
typeof BasinConfig.Type,
|
|
1131
|
-
|
|
|
1132
|
-
| ParseResult.ParseError
|
|
1133
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1134
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1135
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1115
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1136
1116
|
>
|
|
1137
1117
|
/**
|
|
1138
1118
|
* Account-level metrics.
|
|
@@ -1141,10 +1121,7 @@ export interface Client {
|
|
|
1141
1121
|
options: typeof AccountMetricsParams.Encoded,
|
|
1142
1122
|
) => Effect.Effect<
|
|
1143
1123
|
typeof MetricSetResponse.Type,
|
|
1144
|
-
|
|
|
1145
|
-
| ParseResult.ParseError
|
|
1146
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1147
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1124
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1148
1125
|
>
|
|
1149
1126
|
/**
|
|
1150
1127
|
* Basin-level metrics.
|
|
@@ -1154,10 +1131,7 @@ export interface Client {
|
|
|
1154
1131
|
options: typeof BasinMetricsParams.Encoded,
|
|
1155
1132
|
) => Effect.Effect<
|
|
1156
1133
|
typeof MetricSetResponse.Type,
|
|
1157
|
-
|
|
|
1158
|
-
| ParseResult.ParseError
|
|
1159
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1160
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1134
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1161
1135
|
>
|
|
1162
1136
|
/**
|
|
1163
1137
|
* Stream-level metrics.
|
|
@@ -1168,23 +1142,16 @@ export interface Client {
|
|
|
1168
1142
|
options: typeof StreamMetricsParams.Encoded,
|
|
1169
1143
|
) => Effect.Effect<
|
|
1170
1144
|
typeof MetricSetResponse.Type,
|
|
1171
|
-
|
|
|
1172
|
-
| ParseResult.ParseError
|
|
1173
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1174
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1145
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1175
1146
|
>
|
|
1176
1147
|
/**
|
|
1177
1148
|
* List streams.
|
|
1178
1149
|
*/
|
|
1179
1150
|
readonly listStreams: (
|
|
1180
|
-
options?: typeof ListStreamsParams.Encoded
|
|
1151
|
+
options?: typeof ListStreamsParams.Encoded,
|
|
1181
1152
|
) => Effect.Effect<
|
|
1182
1153
|
typeof ListStreamsResponse.Type,
|
|
1183
|
-
|
|
|
1184
|
-
| ParseResult.ParseError
|
|
1185
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1186
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1187
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1154
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1188
1155
|
>
|
|
1189
1156
|
/**
|
|
1190
1157
|
* Create a stream.
|
|
@@ -1193,12 +1160,7 @@ export interface Client {
|
|
|
1193
1160
|
options: typeof CreateStreamRequest.Encoded,
|
|
1194
1161
|
) => Effect.Effect<
|
|
1195
1162
|
typeof StreamInfo.Type,
|
|
1196
|
-
|
|
|
1197
|
-
| ParseResult.ParseError
|
|
1198
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1199
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1200
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1201
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1163
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1202
1164
|
>
|
|
1203
1165
|
/**
|
|
1204
1166
|
* Get stream configuration.
|
|
@@ -1207,12 +1169,7 @@ export interface Client {
|
|
|
1207
1169
|
stream: string,
|
|
1208
1170
|
) => Effect.Effect<
|
|
1209
1171
|
typeof StreamConfig.Type,
|
|
1210
|
-
|
|
|
1211
|
-
| ParseResult.ParseError
|
|
1212
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1213
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1214
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1215
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1172
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1216
1173
|
>
|
|
1217
1174
|
/**
|
|
1218
1175
|
* Create or reconfigure a stream.
|
|
@@ -1225,12 +1182,7 @@ export interface Client {
|
|
|
1225
1182
|
},
|
|
1226
1183
|
) => Effect.Effect<
|
|
1227
1184
|
typeof StreamInfo.Type,
|
|
1228
|
-
|
|
|
1229
|
-
| ParseResult.ParseError
|
|
1230
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1231
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1232
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1233
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1185
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1234
1186
|
>
|
|
1235
1187
|
/**
|
|
1236
1188
|
* Delete a stream.
|
|
@@ -1239,11 +1191,7 @@ export interface Client {
|
|
|
1239
1191
|
stream: string,
|
|
1240
1192
|
) => Effect.Effect<
|
|
1241
1193
|
void,
|
|
1242
|
-
|
|
|
1243
|
-
| ParseResult.ParseError
|
|
1244
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1245
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1246
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1194
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1247
1195
|
>
|
|
1248
1196
|
/**
|
|
1249
1197
|
* Reconfigure a stream.
|
|
@@ -1253,29 +1201,20 @@ export interface Client {
|
|
|
1253
1201
|
options: typeof StreamReconfiguration.Encoded,
|
|
1254
1202
|
) => Effect.Effect<
|
|
1255
1203
|
typeof StreamConfig.Type,
|
|
1256
|
-
|
|
|
1257
|
-
| ParseResult.ParseError
|
|
1258
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1259
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1260
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1261
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1204
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1262
1205
|
>
|
|
1263
1206
|
/**
|
|
1264
1207
|
* Read records.
|
|
1265
1208
|
*/
|
|
1266
1209
|
readonly read: (
|
|
1267
1210
|
stream: string,
|
|
1268
|
-
options?: typeof ReadParams.Encoded
|
|
1211
|
+
options?: typeof ReadParams.Encoded,
|
|
1269
1212
|
) => Effect.Effect<
|
|
1270
1213
|
typeof ReadBatch.Type,
|
|
1271
1214
|
| HttpClientError.HttpClientError
|
|
1272
|
-
|
|
|
1273
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1274
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1275
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1215
|
+
| S.SchemaError
|
|
1276
1216
|
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1277
1217
|
| ClientError<'TailResponse', typeof TailResponse.Type>
|
|
1278
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1279
1218
|
>
|
|
1280
1219
|
/**
|
|
1281
1220
|
* Append records.
|
|
@@ -1289,13 +1228,9 @@ export interface Client {
|
|
|
1289
1228
|
) => Effect.Effect<
|
|
1290
1229
|
typeof AppendAck.Type,
|
|
1291
1230
|
| HttpClientError.HttpClientError
|
|
1292
|
-
|
|
|
1293
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1294
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1295
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1231
|
+
| S.SchemaError
|
|
1296
1232
|
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1297
1233
|
| ClientError<'AppendConditionFailed', typeof AppendConditionFailed.Type>
|
|
1298
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1299
1234
|
>
|
|
1300
1235
|
/**
|
|
1301
1236
|
* Check the tail.
|
|
@@ -1304,13 +1239,7 @@ export interface Client {
|
|
|
1304
1239
|
stream: string,
|
|
1305
1240
|
) => Effect.Effect<
|
|
1306
1241
|
typeof TailResponse.Type,
|
|
1307
|
-
|
|
|
1308
|
-
| ParseResult.ParseError
|
|
1309
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1310
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1311
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1312
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1313
|
-
| ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1242
|
+
HttpClientError.HttpClientError | S.SchemaError | ClientError<'ErrorResponse', typeof ErrorResponse.Type>
|
|
1314
1243
|
>
|
|
1315
1244
|
}
|
|
1316
1245
|
|