@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
|
@@ -4,68 +4,86 @@
|
|
|
4
4
|
// 1) Use Effect imports from @livestore/utils/effect
|
|
5
5
|
// 2) Fixed CreateOrReconfigureBasinRequest to not be self-referencing
|
|
6
6
|
import { Data, Effect, HttpClientError, HttpClientRequest, HttpClientResponse, Schema as S, } from '@livestore/utils/effect';
|
|
7
|
-
export class ListAccessTokensParams extends S.
|
|
8
|
-
prefix: S.
|
|
9
|
-
start_after: S.
|
|
10
|
-
limit: S.
|
|
11
|
-
nullable: true,
|
|
12
|
-
default: () => 1000,
|
|
13
|
-
}),
|
|
7
|
+
export class ListAccessTokensParams extends S.Class('ListAccessTokensParams')({
|
|
8
|
+
prefix: S.String.pipe(S.optional, S.withDecodingDefault(Effect.succeed(''))),
|
|
9
|
+
start_after: S.String.pipe(S.optional, S.withDecodingDefault(Effect.succeed(''))),
|
|
10
|
+
limit: S.Int.check(S.isGreaterThanOrEqualTo(0), S.isLessThanOrEqualTo(1000)).pipe(S.optional, S.withDecodingDefault(Effect.succeed(1000))),
|
|
14
11
|
}) {
|
|
15
12
|
}
|
|
16
|
-
export
|
|
17
|
-
/**
|
|
18
|
-
* Match only the resource with this exact name.
|
|
19
|
-
* Use an empty string to match no resources.
|
|
20
|
-
*/
|
|
21
|
-
S.Struct({
|
|
13
|
+
export const ResourceSet = S.Union([
|
|
22
14
|
/**
|
|
23
15
|
* Match only the resource with this exact name.
|
|
24
16
|
* Use an empty string to match no resources.
|
|
25
17
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
S.Struct({
|
|
19
|
+
/**
|
|
20
|
+
* Match only the resource with this exact name.
|
|
21
|
+
* Use an empty string to match no resources.
|
|
22
|
+
*/
|
|
23
|
+
exact: S.String,
|
|
24
|
+
}),
|
|
33
25
|
/**
|
|
34
26
|
* Match all resources that start with this prefix.
|
|
35
27
|
* Use an empty string to match all resource.
|
|
36
28
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
S.Struct({
|
|
30
|
+
/**
|
|
31
|
+
* Match all resources that start with this prefix.
|
|
32
|
+
* Use an empty string to match all resource.
|
|
33
|
+
*/
|
|
34
|
+
prefix: S.String,
|
|
35
|
+
}),
|
|
36
|
+
]);
|
|
40
37
|
export class ReadWritePermissions extends S.Class('ReadWritePermissions')({
|
|
41
38
|
/**
|
|
42
39
|
* Read permission.
|
|
43
40
|
*/
|
|
44
|
-
read: S.
|
|
41
|
+
read: S.Boolean.pipe(S.optional, S.withDecodingDefault(Effect.succeed(false))),
|
|
45
42
|
/**
|
|
46
43
|
* Write permission.
|
|
47
44
|
*/
|
|
48
|
-
write: S.
|
|
45
|
+
write: S.Boolean.pipe(S.optional, S.withDecodingDefault(Effect.succeed(false))),
|
|
49
46
|
}) {
|
|
50
47
|
}
|
|
51
48
|
export class PermittedOperationGroups extends S.Class('PermittedOperationGroups')({
|
|
52
|
-
account: S.
|
|
53
|
-
basin: S.
|
|
54
|
-
stream: S.
|
|
55
|
-
}) {
|
|
56
|
-
}
|
|
57
|
-
export
|
|
58
|
-
|
|
49
|
+
account: S.optional(S.NullOr(ReadWritePermissions)),
|
|
50
|
+
basin: S.optional(S.NullOr(ReadWritePermissions)),
|
|
51
|
+
stream: S.optional(S.NullOr(ReadWritePermissions)),
|
|
52
|
+
}) {
|
|
53
|
+
}
|
|
54
|
+
export const Operation = S.Literals([
|
|
55
|
+
'list-basins',
|
|
56
|
+
'create-basin',
|
|
57
|
+
'delete-basin',
|
|
58
|
+
'reconfigure-basin',
|
|
59
|
+
'get-basin-config',
|
|
60
|
+
'issue-access-token',
|
|
61
|
+
'revoke-access-token',
|
|
62
|
+
'list-access-tokens',
|
|
63
|
+
'list-streams',
|
|
64
|
+
'create-stream',
|
|
65
|
+
'delete-stream',
|
|
66
|
+
'get-stream-config',
|
|
67
|
+
'reconfigure-stream',
|
|
68
|
+
'check-tail',
|
|
69
|
+
'append',
|
|
70
|
+
'read',
|
|
71
|
+
'trim',
|
|
72
|
+
'fence',
|
|
73
|
+
'account-metrics',
|
|
74
|
+
'basin-metrics',
|
|
75
|
+
'stream-metrics',
|
|
76
|
+
]);
|
|
59
77
|
export class AccessTokenScope extends S.Class('AccessTokenScope')({
|
|
60
|
-
access_tokens: S.
|
|
61
|
-
basins: S.
|
|
62
|
-
op_groups: S.
|
|
78
|
+
access_tokens: S.optional(S.NullOr(ResourceSet)),
|
|
79
|
+
basins: S.optional(S.NullOr(ResourceSet)),
|
|
80
|
+
op_groups: S.optional(S.NullOr(PermittedOperationGroups)),
|
|
63
81
|
/**
|
|
64
82
|
* Operations allowed for the token.
|
|
65
83
|
* A union of allowed operations and groups is used as an effective set of allowed operations.
|
|
66
84
|
*/
|
|
67
|
-
ops: S.
|
|
68
|
-
streams: S.
|
|
85
|
+
ops: S.optional(S.NullOr(S.Array(Operation))),
|
|
86
|
+
streams: S.optional(S.NullOr(ResourceSet)),
|
|
69
87
|
}) {
|
|
70
88
|
}
|
|
71
89
|
export class AccessTokenInfo extends S.Class('AccessTokenInfo')({
|
|
@@ -73,12 +91,12 @@ export class AccessTokenInfo extends S.Class('AccessTokenInfo')({
|
|
|
73
91
|
* Namespace streams based on the configured stream-level scope, which must be a prefix.
|
|
74
92
|
* Stream name arguments will be automatically prefixed, and the prefix will be stripped when listing streams.
|
|
75
93
|
*/
|
|
76
|
-
auto_prefix_streams: S.
|
|
94
|
+
auto_prefix_streams: S.Boolean.pipe(S.optional, S.withDecodingDefault(Effect.succeed(false))),
|
|
77
95
|
/**
|
|
78
96
|
* Expiration time in ISO 8601 format.
|
|
79
97
|
* If not set, the expiration will be set to that of the requestor's token.
|
|
80
98
|
*/
|
|
81
|
-
expires_at: S.
|
|
99
|
+
expires_at: S.optional(S.NullOr(S.String)),
|
|
82
100
|
/**
|
|
83
101
|
* Access token ID.
|
|
84
102
|
* It must be unique to the account and between 1 and 96 bytes in length.
|
|
@@ -94,7 +112,7 @@ export class ListAccessTokensResponse extends S.Class('ListAccessTokensResponse'
|
|
|
94
112
|
/**
|
|
95
113
|
* Matching access tokens.
|
|
96
114
|
*/
|
|
97
|
-
access_tokens: S.Array(AccessTokenInfo).
|
|
115
|
+
access_tokens: S.Array(AccessTokenInfo).check(S.isMaxLength(1000)),
|
|
98
116
|
/**
|
|
99
117
|
* Indicates that there are more access tokens that match the criteria.
|
|
100
118
|
*/
|
|
@@ -102,7 +120,7 @@ export class ListAccessTokensResponse extends S.Class('ListAccessTokensResponse'
|
|
|
102
120
|
}) {
|
|
103
121
|
}
|
|
104
122
|
export class ErrorResponse extends S.Class('ErrorResponse')({
|
|
105
|
-
code: S.
|
|
123
|
+
code: S.optional(S.NullOr(S.String)),
|
|
106
124
|
message: S.String,
|
|
107
125
|
}) {
|
|
108
126
|
}
|
|
@@ -113,19 +131,14 @@ export class IssueAccessTokenResponse extends S.Class('IssueAccessTokenResponse'
|
|
|
113
131
|
access_token: S.String,
|
|
114
132
|
}) {
|
|
115
133
|
}
|
|
116
|
-
export class ListBasinsParams extends S.
|
|
117
|
-
prefix: S.
|
|
118
|
-
start_after: S.
|
|
119
|
-
limit: S.
|
|
120
|
-
nullable: true,
|
|
121
|
-
default: () => 1000,
|
|
122
|
-
}),
|
|
134
|
+
export class ListBasinsParams extends S.Class('ListBasinsParams')({
|
|
135
|
+
prefix: S.String.pipe(S.optional, S.withDecodingDefault(Effect.succeed(''))),
|
|
136
|
+
start_after: S.String.pipe(S.optional, S.withDecodingDefault(Effect.succeed(''))),
|
|
137
|
+
limit: S.Int.check(S.isGreaterThanOrEqualTo(0), S.isLessThanOrEqualTo(1000)).pipe(S.optional, S.withDecodingDefault(Effect.succeed(1000))),
|
|
123
138
|
}) {
|
|
124
139
|
}
|
|
125
|
-
export
|
|
126
|
-
|
|
127
|
-
export class BasinState extends S.Literal('active', 'creating', 'deleting') {
|
|
128
|
-
}
|
|
140
|
+
export const BasinScope = S.Literal('aws:us-east-1');
|
|
141
|
+
export const BasinState = S.Literals(['active', 'creating', 'deleting']);
|
|
129
142
|
export class BasinInfo extends S.Class('BasinInfo')({
|
|
130
143
|
/**
|
|
131
144
|
* Basin name.
|
|
@@ -145,7 +158,7 @@ export class ListBasinsResponse extends S.Class('ListBasinsResponse')({
|
|
|
145
158
|
/**
|
|
146
159
|
* Matching basins.
|
|
147
160
|
*/
|
|
148
|
-
basins: S.Array(BasinInfo).
|
|
161
|
+
basins: S.Array(BasinInfo).check(S.isMaxLength(1000)),
|
|
149
162
|
/**
|
|
150
163
|
* Indicates that there are more basins that match the criteria.
|
|
151
164
|
*/
|
|
@@ -157,65 +170,62 @@ export class DeleteOnEmptyConfig extends S.Class('DeleteOnEmptyConfig')({
|
|
|
157
170
|
* Minimum age in seconds before an empty stream can be deleted.
|
|
158
171
|
* Set to 0 (default) to disable delete-on-empty (don't delete automatically).
|
|
159
172
|
*/
|
|
160
|
-
min_age_secs: S.
|
|
173
|
+
min_age_secs: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
161
174
|
}) {
|
|
162
175
|
}
|
|
163
|
-
export
|
|
164
|
-
|
|
165
|
-
export class RetentionPolicy extends S.Union(
|
|
166
|
-
/**
|
|
167
|
-
* Age in seconds for automatic trimming of records older than this threshold.
|
|
168
|
-
* This must be set to a value greater than 0 seconds.
|
|
169
|
-
* (While S2 is in public preview, this is capped at 28 days. Let us know if you'd like the cap removed.)
|
|
170
|
-
*/
|
|
171
|
-
S.Struct({
|
|
176
|
+
export const InfiniteRetention = S.Record(S.String, S.Unknown);
|
|
177
|
+
export const RetentionPolicy = S.Union([
|
|
172
178
|
/**
|
|
173
179
|
* Age in seconds for automatic trimming of records older than this threshold.
|
|
174
180
|
* This must be set to a value greater than 0 seconds.
|
|
175
181
|
* (While S2 is in public preview, this is capped at 28 days. Let us know if you'd like the cap removed.)
|
|
176
182
|
*/
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
S.Struct({
|
|
184
|
+
/**
|
|
185
|
+
* Age in seconds for automatic trimming of records older than this threshold.
|
|
186
|
+
* This must be set to a value greater than 0 seconds.
|
|
187
|
+
* (While S2 is in public preview, this is capped at 28 days. Let us know if you'd like the cap removed.)
|
|
188
|
+
*/
|
|
189
|
+
age: S.Int.check(S.isGreaterThanOrEqualTo(0)),
|
|
190
|
+
}),
|
|
183
191
|
/**
|
|
184
192
|
* Retain records unless explicitly trimmed.
|
|
185
193
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
S.Struct({
|
|
195
|
+
/**
|
|
196
|
+
* Retain records unless explicitly trimmed.
|
|
197
|
+
*/
|
|
198
|
+
infinite: InfiniteRetention,
|
|
199
|
+
}),
|
|
200
|
+
]);
|
|
201
|
+
export const StorageClass = S.Literals(['standard', 'express']);
|
|
202
|
+
export const TimestampingMode = S.Literals(['client-prefer', 'client-require', 'arrival']);
|
|
193
203
|
export class TimestampingConfig extends S.Class('TimestampingConfig')({
|
|
194
|
-
mode: S.
|
|
204
|
+
mode: S.optional(S.NullOr(TimestampingMode)),
|
|
195
205
|
/**
|
|
196
206
|
* Allow client-specified timestamps to exceed the arrival time.
|
|
197
207
|
* If this is `false` or not set, client timestamps will be capped at the arrival time.
|
|
198
208
|
*/
|
|
199
|
-
uncapped: S.
|
|
209
|
+
uncapped: S.optional(S.NullOr(S.Boolean)),
|
|
200
210
|
}) {
|
|
201
211
|
}
|
|
202
212
|
export class StreamConfig extends S.Class('StreamConfig')({
|
|
203
|
-
delete_on_empty: S.
|
|
204
|
-
retention_policy: S.
|
|
205
|
-
storage_class: S.
|
|
206
|
-
timestamping: S.
|
|
213
|
+
delete_on_empty: S.optional(S.NullOr(DeleteOnEmptyConfig)),
|
|
214
|
+
retention_policy: S.optional(S.NullOr(RetentionPolicy)),
|
|
215
|
+
storage_class: S.optional(S.NullOr(StorageClass)),
|
|
216
|
+
timestamping: S.optional(S.NullOr(TimestampingConfig)),
|
|
207
217
|
}) {
|
|
208
218
|
}
|
|
209
219
|
export class BasinConfig extends S.Class('BasinConfig')({
|
|
210
220
|
/**
|
|
211
221
|
* Create stream on append if it doesn't exist, using the default stream configuration.
|
|
212
222
|
*/
|
|
213
|
-
create_stream_on_append: S.
|
|
223
|
+
create_stream_on_append: S.optional(S.NullOr(S.Boolean)),
|
|
214
224
|
/**
|
|
215
225
|
* Create stream on read if it doesn't exist, using the default stream configuration.
|
|
216
226
|
*/
|
|
217
|
-
create_stream_on_read: S.
|
|
218
|
-
default_stream_config: S.
|
|
227
|
+
create_stream_on_read: S.optional(S.NullOr(S.Boolean)),
|
|
228
|
+
default_stream_config: S.optional(S.NullOr(StreamConfig)),
|
|
219
229
|
}) {
|
|
220
230
|
}
|
|
221
231
|
export class CreateBasinRequest extends S.Class('CreateBasinRequest')({
|
|
@@ -225,68 +235,64 @@ export class CreateBasinRequest extends S.Class('CreateBasinRequest')({
|
|
|
225
235
|
* It cannot begin or end with a hyphen.
|
|
226
236
|
*/
|
|
227
237
|
basin: S.String,
|
|
228
|
-
config: S.
|
|
238
|
+
config: S.optional(S.NullOr(BasinConfig)),
|
|
229
239
|
/**
|
|
230
240
|
* Basin scope.
|
|
231
241
|
*/
|
|
232
|
-
scope: S.
|
|
242
|
+
scope: BasinScope.pipe(S.optional, S.withDecodingDefault(Effect.succeed('aws:us-east-1'))),
|
|
233
243
|
}) {
|
|
234
244
|
}
|
|
235
|
-
export class CreateOrReconfigureBasinParams extends S.
|
|
236
|
-
's2-request-token': S.
|
|
245
|
+
export class CreateOrReconfigureBasinParams extends S.Class('CreateOrReconfigureBasinParams')({
|
|
246
|
+
's2-request-token': S.optional(S.NullOr(S.String)),
|
|
237
247
|
}) {
|
|
238
248
|
}
|
|
239
|
-
export
|
|
240
|
-
}
|
|
249
|
+
export const CreateOrReconfigureBasinRequest = S.Union([S.Null]);
|
|
241
250
|
// export class CreateOrReconfigureBasinRequest extends S.Union(S.Null, CreateOrReconfigureBasinRequest) {}
|
|
242
251
|
export class DeleteOnEmptyReconfiguration extends S.Class('DeleteOnEmptyReconfiguration')({
|
|
243
252
|
/**
|
|
244
253
|
* Minimum age in seconds before an empty stream can be deleted.
|
|
245
254
|
* Set to 0 to disable delete-on-empty (don't delete automatically).
|
|
246
255
|
*/
|
|
247
|
-
min_age_secs: S.
|
|
256
|
+
min_age_secs: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
248
257
|
}) {
|
|
249
258
|
}
|
|
250
259
|
export class TimestampingReconfiguration extends S.Class('TimestampingReconfiguration')({
|
|
251
|
-
mode: S.
|
|
260
|
+
mode: S.optional(S.NullOr(TimestampingMode)),
|
|
252
261
|
/**
|
|
253
262
|
* Allow client-specified timestamps to exceed the arrival time.
|
|
254
263
|
*/
|
|
255
|
-
uncapped: S.
|
|
264
|
+
uncapped: S.optional(S.NullOr(S.Boolean)),
|
|
256
265
|
}) {
|
|
257
266
|
}
|
|
258
267
|
export class StreamReconfiguration extends S.Class('StreamReconfiguration')({
|
|
259
|
-
delete_on_empty: S.
|
|
260
|
-
retention_policy: S.
|
|
261
|
-
storage_class: S.
|
|
262
|
-
timestamping: S.
|
|
268
|
+
delete_on_empty: S.optional(S.NullOr(DeleteOnEmptyReconfiguration)),
|
|
269
|
+
retention_policy: S.optional(S.NullOr(RetentionPolicy)),
|
|
270
|
+
storage_class: S.optional(S.NullOr(StorageClass)),
|
|
271
|
+
timestamping: S.optional(S.NullOr(TimestampingReconfiguration)),
|
|
263
272
|
}) {
|
|
264
273
|
}
|
|
265
274
|
export class BasinReconfiguration extends S.Class('BasinReconfiguration')({
|
|
266
275
|
/**
|
|
267
276
|
* Create a stream on append.
|
|
268
277
|
*/
|
|
269
|
-
create_stream_on_append: S.
|
|
278
|
+
create_stream_on_append: S.optional(S.NullOr(S.Boolean)),
|
|
270
279
|
/**
|
|
271
280
|
* Create a stream on read.
|
|
272
281
|
*/
|
|
273
|
-
create_stream_on_read: S.
|
|
274
|
-
default_stream_config: S.
|
|
282
|
+
create_stream_on_read: S.optional(S.NullOr(S.Boolean)),
|
|
283
|
+
default_stream_config: S.optional(S.NullOr(StreamReconfiguration)),
|
|
275
284
|
}) {
|
|
276
285
|
}
|
|
277
|
-
export
|
|
278
|
-
|
|
279
|
-
export class
|
|
280
|
-
}
|
|
281
|
-
export class AccountMetricsParams extends S.Struct({
|
|
286
|
+
export const AccountMetricSet = S.Literals(['active-basins', 'account-ops']);
|
|
287
|
+
export const TimeseriesInterval = S.Literals(['minute', 'hour', 'day']);
|
|
288
|
+
export class AccountMetricsParams extends S.Class('AccountMetricsParams')({
|
|
282
289
|
set: AccountMetricSet,
|
|
283
|
-
start: S.
|
|
284
|
-
end: S.
|
|
285
|
-
interval: S.
|
|
290
|
+
start: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
291
|
+
end: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
292
|
+
interval: S.optional(S.NullOr(TimeseriesInterval)),
|
|
286
293
|
}) {
|
|
287
294
|
}
|
|
288
|
-
export
|
|
289
|
-
}
|
|
295
|
+
export const MetricUnit = S.Literals(['bytes', 'operations']);
|
|
290
296
|
export class Scalar extends S.Class('Scalar')({
|
|
291
297
|
/**
|
|
292
298
|
* Metric name.
|
|
@@ -339,46 +345,46 @@ export class Label extends S.Class('Label')({
|
|
|
339
345
|
values: S.Array(S.String),
|
|
340
346
|
}) {
|
|
341
347
|
}
|
|
342
|
-
export
|
|
343
|
-
/**
|
|
344
|
-
* Single named value.
|
|
345
|
-
*/
|
|
346
|
-
S.Struct({
|
|
348
|
+
export const Metric = S.Union([
|
|
347
349
|
/**
|
|
348
350
|
* Single named value.
|
|
349
351
|
*/
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
S.Struct({
|
|
352
|
+
S.Struct({
|
|
353
|
+
/**
|
|
354
|
+
* Single named value.
|
|
355
|
+
*/
|
|
356
|
+
scalar: Scalar,
|
|
357
|
+
}),
|
|
357
358
|
/**
|
|
358
359
|
* Named series of `(timestamp, value)` points representing an accumulation over a specified
|
|
359
360
|
* bucket.
|
|
360
361
|
*/
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
362
|
+
S.Struct({
|
|
363
|
+
/**
|
|
364
|
+
* Named series of `(timestamp, value)` points representing an accumulation over a specified
|
|
365
|
+
* bucket.
|
|
366
|
+
*/
|
|
367
|
+
accumulation: Accumulation,
|
|
368
|
+
}),
|
|
367
369
|
/**
|
|
368
370
|
* Named series of `(timestamp, value)` points each representing an instantaneous value.
|
|
369
371
|
*/
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
372
|
+
S.Struct({
|
|
373
|
+
/**
|
|
374
|
+
* Named series of `(timestamp, value)` points each representing an instantaneous value.
|
|
375
|
+
*/
|
|
376
|
+
gauge: Gauge,
|
|
377
|
+
}),
|
|
376
378
|
/**
|
|
377
379
|
* Set of string labels.
|
|
378
380
|
*/
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
381
|
+
S.Struct({
|
|
382
|
+
/**
|
|
383
|
+
* Set of string labels.
|
|
384
|
+
*/
|
|
385
|
+
label: Label,
|
|
386
|
+
}),
|
|
387
|
+
]);
|
|
382
388
|
export class MetricSetResponse extends S.Class('MetricSetResponse')({
|
|
383
389
|
/**
|
|
384
390
|
* Metrics comprising the set.
|
|
@@ -386,31 +392,33 @@ export class MetricSetResponse extends S.Class('MetricSetResponse')({
|
|
|
386
392
|
values: S.Array(Metric),
|
|
387
393
|
}) {
|
|
388
394
|
}
|
|
389
|
-
export
|
|
390
|
-
|
|
391
|
-
|
|
395
|
+
export const BasinMetricSet = S.Literals([
|
|
396
|
+
'storage',
|
|
397
|
+
'append-ops',
|
|
398
|
+
'read-ops',
|
|
399
|
+
'read-throughput',
|
|
400
|
+
'append-throughput',
|
|
401
|
+
'basin-ops',
|
|
402
|
+
]);
|
|
403
|
+
export class BasinMetricsParams extends S.Class('BasinMetricsParams')({
|
|
392
404
|
set: BasinMetricSet,
|
|
393
|
-
start: S.
|
|
394
|
-
end: S.
|
|
395
|
-
interval: S.
|
|
405
|
+
start: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
406
|
+
end: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
407
|
+
interval: S.optional(S.NullOr(TimeseriesInterval)),
|
|
396
408
|
}) {
|
|
397
409
|
}
|
|
398
|
-
export
|
|
399
|
-
|
|
400
|
-
export class StreamMetricsParams extends S.Struct({
|
|
410
|
+
export const StreamMetricSet = S.Literal('storage');
|
|
411
|
+
export class StreamMetricsParams extends S.Class('StreamMetricsParams')({
|
|
401
412
|
set: StreamMetricSet,
|
|
402
|
-
start: S.
|
|
403
|
-
end: S.
|
|
404
|
-
interval: S.
|
|
413
|
+
start: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
414
|
+
end: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
415
|
+
interval: S.optional(S.NullOr(TimeseriesInterval)),
|
|
405
416
|
}) {
|
|
406
417
|
}
|
|
407
|
-
export class ListStreamsParams extends S.
|
|
408
|
-
prefix: S.
|
|
409
|
-
start_after: S.
|
|
410
|
-
limit: S.
|
|
411
|
-
nullable: true,
|
|
412
|
-
default: () => 1000,
|
|
413
|
-
}),
|
|
418
|
+
export class ListStreamsParams extends S.Class('ListStreamsParams')({
|
|
419
|
+
prefix: S.String.pipe(S.optional, S.withDecodingDefault(Effect.succeed(''))),
|
|
420
|
+
start_after: S.String.pipe(S.optional, S.withDecodingDefault(Effect.succeed(''))),
|
|
421
|
+
limit: S.Int.check(S.isGreaterThanOrEqualTo(0), S.isLessThanOrEqualTo(1000)).pipe(S.optional, S.withDecodingDefault(Effect.succeed(1000))),
|
|
414
422
|
}) {
|
|
415
423
|
}
|
|
416
424
|
export class StreamInfo extends S.Class('StreamInfo')({
|
|
@@ -421,7 +429,7 @@ export class StreamInfo extends S.Class('StreamInfo')({
|
|
|
421
429
|
/**
|
|
422
430
|
* Deletion time in ISO 8601 format, if the stream is being deleted.
|
|
423
431
|
*/
|
|
424
|
-
deleted_at: S.
|
|
432
|
+
deleted_at: S.optional(S.NullOr(S.String)),
|
|
425
433
|
/**
|
|
426
434
|
* Stream name.
|
|
427
435
|
*/
|
|
@@ -436,11 +444,11 @@ export class ListStreamsResponse extends S.Class('ListStreamsResponse')({
|
|
|
436
444
|
/**
|
|
437
445
|
* Matching streams.
|
|
438
446
|
*/
|
|
439
|
-
streams: S.Array(StreamInfo).
|
|
447
|
+
streams: S.Array(StreamInfo).check(S.isMaxLength(1000)),
|
|
440
448
|
}) {
|
|
441
449
|
}
|
|
442
450
|
export class CreateStreamRequest extends S.Class('CreateStreamRequest')({
|
|
443
|
-
config: S.
|
|
451
|
+
config: S.optional(S.NullOr(StreamConfig)),
|
|
444
452
|
/**
|
|
445
453
|
* Stream name that is unique to the basin.
|
|
446
454
|
* It can be between 1 and 512 bytes in length.
|
|
@@ -448,25 +456,22 @@ export class CreateStreamRequest extends S.Class('CreateStreamRequest')({
|
|
|
448
456
|
stream: S.String,
|
|
449
457
|
}) {
|
|
450
458
|
}
|
|
451
|
-
export class CreateOrReconfigureStreamParams extends S.
|
|
452
|
-
's2-request-token': S.
|
|
459
|
+
export class CreateOrReconfigureStreamParams extends S.Class('CreateOrReconfigureStreamParams')({
|
|
460
|
+
's2-request-token': S.optional(S.NullOr(S.String)),
|
|
453
461
|
}) {
|
|
454
462
|
}
|
|
455
|
-
export
|
|
456
|
-
|
|
457
|
-
export
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
bytes: S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(0)), { nullable: true }),
|
|
468
|
-
until: S.optionalWith(U64, { nullable: true }),
|
|
469
|
-
clamp: S.optionalWith(S.Boolean, { nullable: true }),
|
|
463
|
+
export const CreateOrReconfigureStreamRequest = S.Union([S.Null, StreamConfig]);
|
|
464
|
+
export const S2Format = S.Literals(['raw', 'base64']);
|
|
465
|
+
export const U64 = S.Int.check(S.isGreaterThanOrEqualTo(0));
|
|
466
|
+
export class ReadParams extends S.Class('ReadParams')({
|
|
467
|
+
's2-format': S.optional(S.NullOr(S2Format)),
|
|
468
|
+
seq_num: S.optional(S.NullOr(U64)),
|
|
469
|
+
timestamp: S.optional(S.NullOr(U64)),
|
|
470
|
+
tail_offset: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
471
|
+
count: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
472
|
+
bytes: S.optional(S.NullOr(S.Int.check(S.isGreaterThanOrEqualTo(0)))),
|
|
473
|
+
until: S.optional(S.NullOr(U64)),
|
|
474
|
+
clamp: S.optional(S.NullOr(S.Boolean)),
|
|
470
475
|
}) {
|
|
471
476
|
}
|
|
472
477
|
/**
|
|
@@ -474,8 +479,7 @@ export class ReadParams extends S.Struct({
|
|
|
474
479
|
*
|
|
475
480
|
* The name cannot be empty, with the exception of an S2 command record.
|
|
476
481
|
*/
|
|
477
|
-
export
|
|
478
|
-
}
|
|
482
|
+
export const Header = S.NonEmptyArray(S.String).check(S.isMinLength(2), S.isMaxLength(2));
|
|
479
483
|
/**
|
|
480
484
|
* Record that is durably sequenced on a stream.
|
|
481
485
|
*/
|
|
@@ -483,11 +487,11 @@ export class SequencedRecord extends S.Class('SequencedRecord')({
|
|
|
483
487
|
/**
|
|
484
488
|
* Body of the record.
|
|
485
489
|
*/
|
|
486
|
-
body: S.
|
|
490
|
+
body: S.optional(S.NullOr(S.String)),
|
|
487
491
|
/**
|
|
488
492
|
* Series of name-value pairs for this record.
|
|
489
493
|
*/
|
|
490
|
-
headers: S.
|
|
494
|
+
headers: S.optional(S.NullOr(S.Array(Header))),
|
|
491
495
|
/**
|
|
492
496
|
* Sequence number assigned by the service.
|
|
493
497
|
*/
|
|
@@ -505,12 +509,12 @@ export class StreamPosition extends S.Class('StreamPosition')({
|
|
|
505
509
|
/**
|
|
506
510
|
* Sequence number assigned by the service.
|
|
507
511
|
*/
|
|
508
|
-
seq_num: S.Int.
|
|
512
|
+
seq_num: S.Int.check(S.isGreaterThanOrEqualTo(0)),
|
|
509
513
|
/**
|
|
510
514
|
* Timestamp, which may be client-specified or assigned by the service.
|
|
511
515
|
* If it is assigned by the service, it will represent milliseconds since Unix epoch.
|
|
512
516
|
*/
|
|
513
|
-
timestamp: S.Int.
|
|
517
|
+
timestamp: S.Int.check(S.isGreaterThanOrEqualTo(0)),
|
|
514
518
|
}) {
|
|
515
519
|
}
|
|
516
520
|
export class ReadBatch extends S.Class('ReadBatch')({
|
|
@@ -519,7 +523,7 @@ export class ReadBatch extends S.Class('ReadBatch')({
|
|
|
519
523
|
* This can only be empty in response to a regular (non-SSE) read, if the request cannot be satisfied without violating an explicit limit.
|
|
520
524
|
*/
|
|
521
525
|
records: S.Array(SequencedRecord),
|
|
522
|
-
tail: S.
|
|
526
|
+
tail: S.optional(S.NullOr(StreamPosition)),
|
|
523
527
|
}) {
|
|
524
528
|
}
|
|
525
529
|
export class TailResponse extends S.Class('TailResponse')({
|
|
@@ -529,8 +533,8 @@ export class TailResponse extends S.Class('TailResponse')({
|
|
|
529
533
|
tail: StreamPosition,
|
|
530
534
|
}) {
|
|
531
535
|
}
|
|
532
|
-
export class AppendParams extends S.
|
|
533
|
-
's2-format': S.
|
|
536
|
+
export class AppendParams extends S.Class('AppendParams')({
|
|
537
|
+
's2-format': S.optional(S.NullOr(S2Format)),
|
|
534
538
|
}) {
|
|
535
539
|
}
|
|
536
540
|
/**
|
|
@@ -540,12 +544,12 @@ export class AppendRecord extends S.Class('AppendRecord')({
|
|
|
540
544
|
/**
|
|
541
545
|
* Body of the record.
|
|
542
546
|
*/
|
|
543
|
-
body: S.
|
|
547
|
+
body: S.optional(S.NullOr(S.String)),
|
|
544
548
|
/**
|
|
545
549
|
* Series of name-value pairs for this record.
|
|
546
550
|
*/
|
|
547
|
-
headers: S.
|
|
548
|
-
timestamp: S.
|
|
551
|
+
headers: S.optional(S.NullOr(S.Array(Header))),
|
|
552
|
+
timestamp: S.optional(S.NullOr(U64)),
|
|
549
553
|
}) {
|
|
550
554
|
}
|
|
551
555
|
/**
|
|
@@ -555,8 +559,8 @@ export class AppendInput extends S.Class('AppendInput')({
|
|
|
555
559
|
/**
|
|
556
560
|
* Enforce a fencing token, which starts out as an empty string that can be overridden by a `fence` command record.
|
|
557
561
|
*/
|
|
558
|
-
fencing_token: S.
|
|
559
|
-
match_seq_num: S.
|
|
562
|
+
fencing_token: S.optional(S.NullOr(S.String)),
|
|
563
|
+
match_seq_num: S.optional(S.NullOr(U64)),
|
|
560
564
|
/**
|
|
561
565
|
* Batch of records to append atomically, which must contain at least one record, and no more than 1000.
|
|
562
566
|
* The total size of a batch of records may not exceed 1 MiB of metered bytes.
|
|
@@ -587,45 +591,46 @@ export class AppendAck extends S.Class('AppendAck')({
|
|
|
587
591
|
/**
|
|
588
592
|
* Aborted due to a failed condition.
|
|
589
593
|
*/
|
|
590
|
-
export
|
|
591
|
-
/**
|
|
592
|
-
* Fencing token did not match.
|
|
593
|
-
* The expected fencing token is returned.
|
|
594
|
-
*/
|
|
595
|
-
S.Struct({
|
|
594
|
+
export const AppendConditionFailed = S.Union([
|
|
596
595
|
/**
|
|
597
596
|
* Fencing token did not match.
|
|
598
597
|
* The expected fencing token is returned.
|
|
599
598
|
*/
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
599
|
+
S.Struct({
|
|
600
|
+
/**
|
|
601
|
+
* Fencing token did not match.
|
|
602
|
+
* The expected fencing token is returned.
|
|
603
|
+
*/
|
|
604
|
+
fencing_token_mismatch: S.String,
|
|
605
|
+
}),
|
|
607
606
|
/**
|
|
608
607
|
* Sequence number did not match the tail of the stream.
|
|
609
608
|
* The expected next sequence number is returned.
|
|
610
609
|
*/
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
610
|
+
S.Struct({
|
|
611
|
+
/**
|
|
612
|
+
* Sequence number did not match the tail of the stream.
|
|
613
|
+
* The expected next sequence number is returned.
|
|
614
|
+
*/
|
|
615
|
+
seq_num_mismatch: S.Int.check(S.isGreaterThanOrEqualTo(0)),
|
|
616
|
+
}),
|
|
617
|
+
]);
|
|
614
618
|
export const make = (httpClient, options = {}) => {
|
|
615
|
-
const unexpectedStatus = (response) => Effect.flatMap(Effect.orElseSucceed(response.json, () => 'Unexpected status code'), (description) => Effect.fail(new HttpClientError.
|
|
619
|
+
const unexpectedStatus = (response) => Effect.flatMap(Effect.orElseSucceed(response.json, () => 'Unexpected status code'), (description) => Effect.fail(new HttpClientError.StatusCodeError({
|
|
616
620
|
request: response.request,
|
|
617
621
|
response,
|
|
618
|
-
reason: 'StatusCode',
|
|
619
622
|
description: typeof description === 'string' ? description : JSON.stringify(description),
|
|
620
623
|
})));
|
|
621
|
-
const withResponse = options.transformClient
|
|
624
|
+
const withResponse = options.transformClient !== undefined
|
|
622
625
|
? (f) => (request) => Effect.flatMap(Effect.flatMap(options.transformClient(httpClient), (client) => client.execute(request)), f)
|
|
623
626
|
: (f) => (request) => Effect.flatMap(httpClient.execute(request), f);
|
|
624
627
|
const decodeSuccess = (schema) => (response) => HttpClientResponse.schemaBodyJson(schema)(response);
|
|
625
628
|
const decodeError = (tag, schema) => (response) => Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)(response), (cause) => Effect.fail(ClientError(tag, cause, response)));
|
|
626
629
|
return {
|
|
627
630
|
httpClient,
|
|
628
|
-
listAccessTokens: (options) =>
|
|
631
|
+
listAccessTokens: (options) =>
|
|
632
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
633
|
+
HttpClientRequest.get(`/access-tokens`).pipe(HttpClientRequest.setUrlParams({
|
|
629
634
|
prefix: options?.prefix,
|
|
630
635
|
start_after: options?.start_after,
|
|
631
636
|
limit: options?.limit,
|
|
@@ -635,20 +640,26 @@ export const make = (httpClient, options = {}) => {
|
|
|
635
640
|
'403': decodeError('ErrorResponse', ErrorResponse),
|
|
636
641
|
orElse: unexpectedStatus,
|
|
637
642
|
}))),
|
|
638
|
-
issueAccessToken: (options) =>
|
|
643
|
+
issueAccessToken: (options) =>
|
|
644
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
645
|
+
HttpClientRequest.post(`/access-tokens`).pipe(HttpClientRequest.bodyJsonUnsafe(options), withResponse(HttpClientResponse.matchStatus({
|
|
639
646
|
'2xx': decodeSuccess(IssueAccessTokenResponse),
|
|
640
647
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
641
648
|
'403': decodeError('ErrorResponse', ErrorResponse),
|
|
642
649
|
'409': decodeError('ErrorResponse', ErrorResponse),
|
|
643
650
|
orElse: unexpectedStatus,
|
|
644
651
|
}))),
|
|
645
|
-
revokeAccessToken: (id) =>
|
|
652
|
+
revokeAccessToken: (id) =>
|
|
653
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
654
|
+
HttpClientRequest.delete(`/access-tokens/${id}`).pipe(withResponse(HttpClientResponse.matchStatus({
|
|
646
655
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
647
656
|
'403': decodeError('ErrorResponse', ErrorResponse),
|
|
648
657
|
'200': () => Effect.void,
|
|
649
658
|
orElse: unexpectedStatus,
|
|
650
659
|
}))),
|
|
651
|
-
listBasins: (options) =>
|
|
660
|
+
listBasins: (options) =>
|
|
661
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
662
|
+
HttpClientRequest.get(`/basins`).pipe(HttpClientRequest.setUrlParams({
|
|
652
663
|
prefix: options?.prefix,
|
|
653
664
|
start_after: options?.start_after,
|
|
654
665
|
limit: options?.limit,
|
|
@@ -658,7 +669,9 @@ export const make = (httpClient, options = {}) => {
|
|
|
658
669
|
'403': decodeError('ErrorResponse', ErrorResponse),
|
|
659
670
|
orElse: unexpectedStatus,
|
|
660
671
|
}))),
|
|
661
|
-
createBasin: (options) =>
|
|
672
|
+
createBasin: (options) =>
|
|
673
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
674
|
+
HttpClientRequest.post(`/basins`).pipe(HttpClientRequest.bodyJsonUnsafe(options), withResponse(HttpClientResponse.matchStatus({
|
|
662
675
|
'200': decodeSuccess(BasinInfo),
|
|
663
676
|
'201': decodeSuccess(BasinInfo),
|
|
664
677
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
@@ -667,21 +680,27 @@ export const make = (httpClient, options = {}) => {
|
|
|
667
680
|
'409': decodeError('ErrorResponse', ErrorResponse),
|
|
668
681
|
orElse: unexpectedStatus,
|
|
669
682
|
}))),
|
|
670
|
-
getBasinConfig: (basin) =>
|
|
683
|
+
getBasinConfig: (basin) =>
|
|
684
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
685
|
+
HttpClientRequest.get(`/basins/${basin}`).pipe(withResponse(HttpClientResponse.matchStatus({
|
|
671
686
|
'2xx': decodeSuccess(BasinConfig),
|
|
672
687
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
673
688
|
'403': decodeError('ErrorResponse', ErrorResponse),
|
|
674
689
|
'404': decodeError('ErrorResponse', ErrorResponse),
|
|
675
690
|
orElse: unexpectedStatus,
|
|
676
691
|
}))),
|
|
677
|
-
createOrReconfigureBasin: (basin, options) =>
|
|
692
|
+
createOrReconfigureBasin: (basin, options) =>
|
|
693
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
694
|
+
HttpClientRequest.put(`/basins/${basin}`).pipe(HttpClientRequest.setHeaders({ 's2-request-token': options.params?.['s2-request-token'] ?? undefined }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(HttpClientResponse.matchStatus({
|
|
678
695
|
'200': decodeSuccess(BasinInfo),
|
|
679
696
|
'201': decodeSuccess(BasinInfo),
|
|
680
697
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
681
698
|
'204': () => Effect.void,
|
|
682
699
|
orElse: unexpectedStatus,
|
|
683
700
|
}))),
|
|
684
|
-
deleteBasin: (basin) =>
|
|
701
|
+
deleteBasin: (basin) =>
|
|
702
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
703
|
+
HttpClientRequest.delete(`/basins/${basin}`).pipe(withResponse(HttpClientResponse.matchStatus({
|
|
685
704
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
686
705
|
'401': decodeError('ErrorResponse', ErrorResponse),
|
|
687
706
|
'403': decodeError('ErrorResponse', ErrorResponse),
|
|
@@ -689,14 +708,18 @@ export const make = (httpClient, options = {}) => {
|
|
|
689
708
|
'202': () => Effect.void,
|
|
690
709
|
orElse: unexpectedStatus,
|
|
691
710
|
}))),
|
|
692
|
-
reconfigureBasin: (basin, options) =>
|
|
711
|
+
reconfigureBasin: (basin, options) =>
|
|
712
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
713
|
+
HttpClientRequest.patch(`/basins/${basin}`).pipe(HttpClientRequest.bodyJsonUnsafe(options), withResponse(HttpClientResponse.matchStatus({
|
|
693
714
|
'2xx': decodeSuccess(BasinConfig),
|
|
694
715
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
695
716
|
'403': decodeError('ErrorResponse', ErrorResponse),
|
|
696
717
|
'404': decodeError('ErrorResponse', ErrorResponse),
|
|
697
718
|
orElse: unexpectedStatus,
|
|
698
719
|
}))),
|
|
699
|
-
accountMetrics: (options) =>
|
|
720
|
+
accountMetrics: (options) =>
|
|
721
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
722
|
+
HttpClientRequest.get(`/metrics`).pipe(HttpClientRequest.setUrlParams({
|
|
700
723
|
set: options?.set,
|
|
701
724
|
start: options?.start,
|
|
702
725
|
end: options?.end,
|
|
@@ -707,7 +730,9 @@ export const make = (httpClient, options = {}) => {
|
|
|
707
730
|
'403': decodeError('ErrorResponse', ErrorResponse),
|
|
708
731
|
orElse: unexpectedStatus,
|
|
709
732
|
}))),
|
|
710
|
-
basinMetrics: (basin, options) =>
|
|
733
|
+
basinMetrics: (basin, options) =>
|
|
734
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
735
|
+
HttpClientRequest.get(`/metrics/${basin}`).pipe(HttpClientRequest.setUrlParams({
|
|
711
736
|
set: options?.set,
|
|
712
737
|
start: options?.start,
|
|
713
738
|
end: options?.end,
|
|
@@ -718,7 +743,9 @@ export const make = (httpClient, options = {}) => {
|
|
|
718
743
|
'403': decodeError('ErrorResponse', ErrorResponse),
|
|
719
744
|
orElse: unexpectedStatus,
|
|
720
745
|
}))),
|
|
721
|
-
streamMetrics: (basin, stream, options) =>
|
|
746
|
+
streamMetrics: (basin, stream, options) =>
|
|
747
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
748
|
+
HttpClientRequest.get(`/metrics/${basin}/${stream}`).pipe(HttpClientRequest.setUrlParams({
|
|
722
749
|
set: options?.set,
|
|
723
750
|
start: options?.start,
|
|
724
751
|
end: options?.end,
|
|
@@ -729,7 +756,9 @@ export const make = (httpClient, options = {}) => {
|
|
|
729
756
|
'403': decodeError('ErrorResponse', ErrorResponse),
|
|
730
757
|
orElse: unexpectedStatus,
|
|
731
758
|
}))),
|
|
732
|
-
listStreams: (options) =>
|
|
759
|
+
listStreams: (options) =>
|
|
760
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
761
|
+
HttpClientRequest.get(`/streams`).pipe(HttpClientRequest.setUrlParams({
|
|
733
762
|
prefix: options?.prefix,
|
|
734
763
|
start_after: options?.start_after,
|
|
735
764
|
limit: options?.limit,
|
|
@@ -740,7 +769,9 @@ export const make = (httpClient, options = {}) => {
|
|
|
740
769
|
'404': decodeError('ErrorResponse', ErrorResponse),
|
|
741
770
|
orElse: unexpectedStatus,
|
|
742
771
|
}))),
|
|
743
|
-
createStream: (options) =>
|
|
772
|
+
createStream: (options) =>
|
|
773
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
774
|
+
HttpClientRequest.post(`/streams`).pipe(HttpClientRequest.bodyJsonUnsafe(options), withResponse(HttpClientResponse.matchStatus({
|
|
744
775
|
'2xx': decodeSuccess(StreamInfo),
|
|
745
776
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
746
777
|
'403': decodeError('ErrorResponse', ErrorResponse),
|
|
@@ -748,7 +779,9 @@ export const make = (httpClient, options = {}) => {
|
|
|
748
779
|
'409': decodeError('ErrorResponse', ErrorResponse),
|
|
749
780
|
orElse: unexpectedStatus,
|
|
750
781
|
}))),
|
|
751
|
-
getStreamConfig: (stream) =>
|
|
782
|
+
getStreamConfig: (stream) =>
|
|
783
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
784
|
+
HttpClientRequest.get(`/streams/${stream}`).pipe(withResponse(HttpClientResponse.matchStatus({
|
|
752
785
|
'2xx': decodeSuccess(StreamConfig),
|
|
753
786
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
754
787
|
'403': decodeError('ErrorResponse', ErrorResponse),
|
|
@@ -756,7 +789,9 @@ export const make = (httpClient, options = {}) => {
|
|
|
756
789
|
'409': decodeError('ErrorResponse', ErrorResponse),
|
|
757
790
|
orElse: unexpectedStatus,
|
|
758
791
|
}))),
|
|
759
|
-
createOrReconfigureStream: (stream, options) =>
|
|
792
|
+
createOrReconfigureStream: (stream, options) =>
|
|
793
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
794
|
+
HttpClientRequest.put(`/streams/${stream}`).pipe(HttpClientRequest.setHeaders({ 's2-request-token': options.params?.['s2-request-token'] ?? undefined }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(HttpClientResponse.matchStatus({
|
|
760
795
|
'2xx': decodeSuccess(StreamInfo),
|
|
761
796
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
762
797
|
'403': decodeError('ErrorResponse', ErrorResponse),
|
|
@@ -765,14 +800,18 @@ export const make = (httpClient, options = {}) => {
|
|
|
765
800
|
'204': () => Effect.void,
|
|
766
801
|
orElse: unexpectedStatus,
|
|
767
802
|
}))),
|
|
768
|
-
deleteStream: (stream) =>
|
|
803
|
+
deleteStream: (stream) =>
|
|
804
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
805
|
+
HttpClientRequest.delete(`/streams/${stream}`).pipe(withResponse(HttpClientResponse.matchStatus({
|
|
769
806
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
770
807
|
'403': decodeError('ErrorResponse', ErrorResponse),
|
|
771
808
|
'404': decodeError('ErrorResponse', ErrorResponse),
|
|
772
809
|
'202': () => Effect.void,
|
|
773
810
|
orElse: unexpectedStatus,
|
|
774
811
|
}))),
|
|
775
|
-
reconfigureStream: (stream, options) =>
|
|
812
|
+
reconfigureStream: (stream, options) =>
|
|
813
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
814
|
+
HttpClientRequest.patch(`/streams/${stream}`).pipe(HttpClientRequest.bodyJsonUnsafe(options), withResponse(HttpClientResponse.matchStatus({
|
|
776
815
|
'2xx': decodeSuccess(StreamConfig),
|
|
777
816
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
778
817
|
'403': decodeError('ErrorResponse', ErrorResponse),
|
|
@@ -780,7 +819,9 @@ export const make = (httpClient, options = {}) => {
|
|
|
780
819
|
'409': decodeError('ErrorResponse', ErrorResponse),
|
|
781
820
|
orElse: unexpectedStatus,
|
|
782
821
|
}))),
|
|
783
|
-
read: (stream, options) =>
|
|
822
|
+
read: (stream, options) =>
|
|
823
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
824
|
+
HttpClientRequest.get(`/streams/${stream}/records`).pipe(HttpClientRequest.setUrlParams({
|
|
784
825
|
seq_num: options?.seq_num,
|
|
785
826
|
timestamp: options?.timestamp,
|
|
786
827
|
tail_offset: options?.tail_offset,
|
|
@@ -798,7 +839,9 @@ export const make = (httpClient, options = {}) => {
|
|
|
798
839
|
'500': decodeError('ErrorResponse', ErrorResponse),
|
|
799
840
|
orElse: unexpectedStatus,
|
|
800
841
|
}))),
|
|
801
|
-
append: (stream, options) =>
|
|
842
|
+
append: (stream, options) =>
|
|
843
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
844
|
+
HttpClientRequest.post(`/streams/${stream}/records`).pipe(HttpClientRequest.setHeaders({ 's2-format': options.params?.['s2-format'] ?? undefined }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(HttpClientResponse.matchStatus({
|
|
802
845
|
'2xx': decodeSuccess(AppendAck),
|
|
803
846
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
804
847
|
'401': decodeError('ErrorResponse', ErrorResponse),
|
|
@@ -808,7 +851,9 @@ export const make = (httpClient, options = {}) => {
|
|
|
808
851
|
'500': decodeError('ErrorResponse', ErrorResponse),
|
|
809
852
|
orElse: unexpectedStatus,
|
|
810
853
|
}))),
|
|
811
|
-
checkTail: (stream) =>
|
|
854
|
+
checkTail: (stream) =>
|
|
855
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off
|
|
856
|
+
HttpClientRequest.get(`/streams/${stream}/records/tail`).pipe(withResponse(HttpClientResponse.matchStatus({
|
|
812
857
|
'2xx': decodeSuccess(TailResponse),
|
|
813
858
|
'400': decodeError('ErrorResponse', ErrorResponse),
|
|
814
859
|
'401': decodeError('ErrorResponse', ErrorResponse),
|