@putdotio/sdk 15.0.2 → 16.0.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/README.md +60 -4
- package/dist/{forms-C_Ti7aer.js → forms-CcQuZ3hG.js} +110 -62
- package/dist/forms-CcQuZ3hG.js.map +1 -0
- package/dist/index-Bsp5xXc1.d.ts +18531 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +230 -197
- package/dist/index.js.map +1 -1
- package/dist/utilities.d.ts +3 -3
- package/dist/utilities.js +3 -3
- package/dist/utilities.js.map +1 -1
- package/package.json +5 -3
- package/dist/forms-C_Ti7aer.js.map +0 -1
- package/dist/index-cA579zP3.d.ts +0 -9918
package/README.md
CHANGED
|
@@ -75,6 +75,8 @@ const account = await sdk.account.getInfo({});
|
|
|
75
75
|
sdk.setAccessToken(undefined);
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
+
`accessToken` and `setAccessToken(...)` take a string or an Effect `Redacted<string>`. The SDK stores the token as `Redacted`, so `PutioSdkConfig` never prints it, and unwraps it only to build the `Authorization` header.
|
|
79
|
+
|
|
78
80
|
The token is snapshotted when each Promise-client operation is invoked. Token changes apply to subsequent operations; an operation already in flight keeps the snapshot it started with. Base, upload, and web app URLs remain fixed from client creation.
|
|
79
81
|
|
|
80
82
|
Authorization-code clients can exchange a code without configuring a default access token:
|
|
@@ -127,14 +129,20 @@ const sdk = createPutioSdkEffectClient();
|
|
|
127
129
|
|
|
128
130
|
const program = sdk.files
|
|
129
131
|
.list(0, {
|
|
132
|
+
breadcrumbs: 1,
|
|
130
133
|
per_page: 20,
|
|
131
|
-
total: 1,
|
|
132
134
|
})
|
|
133
135
|
.pipe(Effect.provide(putioSdkLiveLayer({ accessToken: userAccessToken })));
|
|
134
136
|
|
|
135
|
-
const
|
|
137
|
+
const { breadcrumbs, files } = await Effect.runPromise(program);
|
|
136
138
|
```
|
|
137
139
|
|
|
140
|
+
A field the query asks for is required in the result type, and the call fails with
|
|
141
|
+
`PutioContractError` when the response leaves it out: `breadcrumbs` on `files.list` and
|
|
142
|
+
`sharing.publicAccess.listFiles`, `cursor` and `total` on `transfers.list` with `per_page`, and the
|
|
143
|
+
flags of `account.getInfo`, `files.get`, and `files.getChild`. The Effect client, the `PutioSdk`
|
|
144
|
+
service, and the Promise client share these checks and result types.
|
|
145
|
+
|
|
138
146
|
Effect workflows can also depend on the SDK as a service:
|
|
139
147
|
|
|
140
148
|
```ts
|
|
@@ -145,6 +153,8 @@ const serviceProgram = Effect.gen(function* () {
|
|
|
145
153
|
```
|
|
146
154
|
|
|
147
155
|
`makePutioSdkLiveClientLayer(...)` provides the SDK service, SDK config, and default fetch-backed transport.
|
|
156
|
+
`PutioSdk` methods need no further services: `makePutioSdkEffectClientLayer()` reads `PutioSdkConfig` and `PutioHttpClient` once and provides them to every operation, so a test can replace `PutioSdk` alone.
|
|
157
|
+
The free domain functions and `createPutioSdkEffectClient()` keep requiring both services.
|
|
148
158
|
`putioSdkLiveLayer(...)` provides both the SDK config and the default fetch-backed transport.
|
|
149
159
|
Use `putioSdkLayer(...)` with `makePutioFetchLayer(...)` or your own `PutioHttpClient` service when you want to supply custom transport.
|
|
150
160
|
|
|
@@ -165,6 +175,27 @@ Effect is the canonical typed surface; the Promise client adapts it to standard
|
|
|
165
175
|
|
|
166
176
|
Interrupting an Effect during fetch or body reads aborts the underlying request.
|
|
167
177
|
|
|
178
|
+
### Cancelling Promise requests
|
|
179
|
+
|
|
180
|
+
`sdk.withSignal(signal)` returns the same operations bound to an `AbortSignal`. It shares the
|
|
181
|
+
client's runtime and access token, and leaves `dispose` and `setAccessToken` on the client.
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
const controller = new AbortController();
|
|
185
|
+
const transfers = sdk.withSignal(controller.signal).transfers.list();
|
|
186
|
+
|
|
187
|
+
controller.abort();
|
|
188
|
+
await transfers;
|
|
189
|
+
|
|
190
|
+
await sdk.withSignal(AbortSignal.timeout(5_000)).account.getInfo();
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
- Aborting cancels the underlying fetch and rejects the promise with `signal.reason`: an
|
|
194
|
+
`AbortError` `DOMException` by default, a `TimeoutError` from `AbortSignal.timeout(...)`, or the
|
|
195
|
+
value passed to `controller.abort(reason)`.
|
|
196
|
+
- A signal that is already aborted rejects the same way without sending a request.
|
|
197
|
+
- A request that fails before the abort still rejects with its SDK error.
|
|
198
|
+
|
|
168
199
|
## Namespaces
|
|
169
200
|
|
|
170
201
|
Both clients expose the namespaces of `sharedOperationTree` in
|
|
@@ -190,6 +221,20 @@ polyfills or adapters instead of patching the SDK surface.
|
|
|
190
221
|
Backend error bodies parse into `PutioErrorEnvelopeSchema` in
|
|
191
222
|
[src/core/errors.ts](./src/core/errors.ts); current backend errors carry metadata in `extra`.
|
|
192
223
|
|
|
224
|
+
Each error tag names who has to act, and each has an `isPutio*` guard:
|
|
225
|
+
|
|
226
|
+
| Tag | Meaning | Who acts |
|
|
227
|
+
| -------------------------------------------------------- | ------------------------------------------------------------------ | ---------------------- |
|
|
228
|
+
| `PutioValidationError` | Your arguments are invalid, or a value fails the schema you passed | You fix the call |
|
|
229
|
+
| `PutioConfigurationError` | The client options are missing or invalid, such as no access token | You fix the setup |
|
|
230
|
+
| `PutioContractError` | A 2xx response was not JSON or did not match the expected shape | Report it; retry later |
|
|
231
|
+
| `PutioTransportError` | The request or the response body read failed | Retry |
|
|
232
|
+
| `PutioApiError`, `PutioAuthError`, `PutioRateLimitError` | put.io answered with an error status | Read `status`, `body` |
|
|
233
|
+
| `PutioOperationError` | An error status the operation documents | Branch on `operation` |
|
|
234
|
+
|
|
235
|
+
`PutioContractError.missingField` names a field you requested with a query flag, such as
|
|
236
|
+
`stream_url`, that the response left out.
|
|
237
|
+
|
|
193
238
|
Promise consumers receive tagged SDK error objects:
|
|
194
239
|
|
|
195
240
|
```ts
|
|
@@ -216,7 +261,7 @@ try {
|
|
|
216
261
|
}
|
|
217
262
|
|
|
218
263
|
if (isPutioRateLimitError(error)) {
|
|
219
|
-
console.log(error.
|
|
264
|
+
console.log(error.retryAfterSeconds);
|
|
220
265
|
}
|
|
221
266
|
}
|
|
222
267
|
```
|
|
@@ -280,6 +325,17 @@ const upload = await sdk.files.upload({
|
|
|
280
325
|
});
|
|
281
326
|
```
|
|
282
327
|
|
|
328
|
+
## Bulk Selections
|
|
329
|
+
|
|
330
|
+
Bulk operations take file IDs or a list cursor, and reject a selection that has neither before
|
|
331
|
+
sending a request:
|
|
332
|
+
|
|
333
|
+
```ts
|
|
334
|
+
await sdk.downloadLinks.create({ ids: [fileId] });
|
|
335
|
+
await sdk.sharing.clone({ cursor, excludeIds: [skippedFileId], parentId: 0 });
|
|
336
|
+
await sdk.zips.create({ file_ids: [fileId] });
|
|
337
|
+
```
|
|
338
|
+
|
|
283
339
|
## Endpoint Coverage
|
|
284
340
|
|
|
285
341
|
The SDK covers the supported public put.io API surface. It leaves out admin,
|
|
@@ -301,7 +357,7 @@ const sdk = createPutioSdkPromiseClient({
|
|
|
301
357
|
export const useAccountInfo = () =>
|
|
302
358
|
useQuery({
|
|
303
359
|
queryKey: ["account", "info"],
|
|
304
|
-
queryFn: () => sdk.account.getInfo({ download_token: 1 }),
|
|
360
|
+
queryFn: ({ signal }) => sdk.withSignal(signal).account.getInfo({ download_token: 1 }),
|
|
305
361
|
});
|
|
306
362
|
```
|
|
307
363
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, Data, Effect, Layer, Predicate, Schema, Struct } from "effect";
|
|
1
|
+
import { Context, Data, Effect, Layer, Predicate, Redacted, Schema, Struct } from "effect";
|
|
2
2
|
import { dual, flow } from "effect/Function";
|
|
3
3
|
// src/core/errors.ts
|
|
4
4
|
const PutioErrorEnvelopeSchema = Schema.Struct({
|
|
@@ -34,7 +34,7 @@ const PutioOperationErrorReasonSchema = Schema.Union([Schema.Struct({
|
|
|
34
34
|
errorType: Schema.String
|
|
35
35
|
}), Schema.Struct({
|
|
36
36
|
kind: Schema.Literal("status_code"),
|
|
37
|
-
statusCode: Schema.
|
|
37
|
+
statusCode: Schema.Int
|
|
38
38
|
})]);
|
|
39
39
|
const toOperationReason = (contract) => {
|
|
40
40
|
if (contract.errorType !== void 0) return {
|
|
@@ -46,15 +46,21 @@ const toOperationReason = (contract) => {
|
|
|
46
46
|
statusCode: contract.statusCode
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
|
-
|
|
50
|
-
var
|
|
51
|
-
var
|
|
49
|
+
const CauseErrorFields = { cause: Schema.Defect() };
|
|
50
|
+
var PutioTransportError = class extends Schema.TaggedError()("PutioTransportError", { ...CauseErrorFields }) {};
|
|
51
|
+
var PutioConfigurationError = class extends Schema.TaggedError()("PutioConfigurationError", { ...CauseErrorFields }) {};
|
|
52
|
+
var PutioValidationError = class extends Schema.TaggedError()("PutioValidationError", { ...CauseErrorFields }) {};
|
|
53
|
+
var PutioContractError = class extends Schema.TaggedError()("PutioContractError", {
|
|
54
|
+
cause: Schema.optional(Schema.Defect()),
|
|
55
|
+
missingField: Schema.optional(Schema.String)
|
|
56
|
+
}) {};
|
|
52
57
|
const RateLimitHeaderFields = {
|
|
53
58
|
action: Schema.optional(Schema.String),
|
|
54
59
|
id: Schema.optional(Schema.String),
|
|
55
60
|
limit: Schema.optional(Schema.String),
|
|
56
61
|
remaining: Schema.optional(Schema.String),
|
|
57
62
|
retryAfter: Schema.optional(Schema.String),
|
|
63
|
+
retryAfterSeconds: Schema.optional(Schema.Finite),
|
|
58
64
|
reset: Schema.optional(Schema.String)
|
|
59
65
|
};
|
|
60
66
|
const PutioResponseErrorFields = {
|
|
@@ -73,31 +79,35 @@ const definePutioOperationErrorSpec = (spec) => spec;
|
|
|
73
79
|
const decodePutioErrorEnvelope = Schema.decodeUnknownEffect(PutioErrorEnvelopeSchema);
|
|
74
80
|
const isPutioErrorEnvelopeValue = Schema.is(PutioErrorEnvelopeSchema);
|
|
75
81
|
const isPutioErrorEnvelope = (value) => isPutioErrorEnvelopeValue(value);
|
|
76
|
-
const
|
|
77
|
-
body:
|
|
78
|
-
status:
|
|
79
|
-
};
|
|
80
|
-
const PutioApiErrorValueSchema = Schema.Struct({
|
|
81
|
-
_tag: Schema.Literal("PutioApiError"),
|
|
82
|
-
...responseErrorFields
|
|
83
|
-
});
|
|
84
|
-
const PutioAuthErrorValueSchema = Schema.Struct({
|
|
85
|
-
_tag: Schema.Literal("PutioAuthError"),
|
|
86
|
-
...responseErrorFields
|
|
87
|
-
});
|
|
88
|
-
const PutioRateLimitErrorValueSchema = Schema.Struct({
|
|
89
|
-
_tag: Schema.Literal("PutioRateLimitError"),
|
|
90
|
-
...responseErrorFields,
|
|
91
|
-
...RateLimitHeaderFields
|
|
92
|
-
});
|
|
93
|
-
const PutioOperationErrorValueSchema = Schema.Struct({
|
|
94
|
-
_tag: Schema.Literal("PutioOperationError"),
|
|
95
|
-
...responseErrorFields,
|
|
82
|
+
const PutioOperationErrorValueSchema = Schema.TaggedStruct("PutioOperationError", {
|
|
83
|
+
body: PutioResponseErrorFields.body,
|
|
84
|
+
status: PutioResponseErrorFields.status,
|
|
96
85
|
contract: PutioKnownOperationErrorContractSchema,
|
|
97
86
|
domain: Schema.String,
|
|
98
87
|
operation: Schema.String,
|
|
99
88
|
reason: PutioOperationErrorReasonSchema
|
|
100
89
|
});
|
|
90
|
+
const CauseErrorValueFields = { cause: Schema.optional(Schema.Defect()) };
|
|
91
|
+
const PutioTransportErrorValueSchema = Schema.Struct({
|
|
92
|
+
...PutioTransportError.fields,
|
|
93
|
+
...CauseErrorValueFields
|
|
94
|
+
});
|
|
95
|
+
const PutioConfigurationErrorValueSchema = Schema.Struct({
|
|
96
|
+
...PutioConfigurationError.fields,
|
|
97
|
+
...CauseErrorValueFields
|
|
98
|
+
});
|
|
99
|
+
const PutioValidationErrorValueSchema = Schema.Struct({
|
|
100
|
+
...PutioValidationError.fields,
|
|
101
|
+
...CauseErrorValueFields
|
|
102
|
+
});
|
|
103
|
+
const PutioContractErrorValueSchema = Schema.Struct(PutioContractError.fields);
|
|
104
|
+
const PutioApiErrorValueSchema = Schema.Struct(PutioApiError.fields);
|
|
105
|
+
const PutioAuthErrorValueSchema = Schema.Struct(PutioAuthError.fields);
|
|
106
|
+
const PutioRateLimitErrorValueSchema = Schema.Struct(PutioRateLimitError.fields);
|
|
107
|
+
const isPutioTransportError = Schema.is(PutioTransportErrorValueSchema);
|
|
108
|
+
const isPutioConfigurationError = Schema.is(PutioConfigurationErrorValueSchema);
|
|
109
|
+
const isPutioValidationError = Schema.is(PutioValidationErrorValueSchema);
|
|
110
|
+
const isPutioContractError = Schema.is(PutioContractErrorValueSchema);
|
|
101
111
|
const isPutioApiError = Schema.is(PutioApiErrorValueSchema);
|
|
102
112
|
const isPutioAuthError = Schema.is(PutioAuthErrorValueSchema);
|
|
103
113
|
const isPutioRateLimitError = Schema.is(PutioRateLimitErrorValueSchema);
|
|
@@ -107,15 +117,33 @@ const fallbackPutioErrorEnvelope = (status) => ({
|
|
|
107
117
|
status_code: status
|
|
108
118
|
});
|
|
109
119
|
const getHeader = (headers, name) => headers.get(name) ?? void 0;
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
const deltaSecondsPattern = /^\d+$/;
|
|
121
|
+
const httpDatePattern = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), \d{2} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} \d{2}:\d{2}:\d{2} GMT$/;
|
|
122
|
+
const parseRetryAfterSeconds = (value) => {
|
|
123
|
+
const trimmed = value?.trim();
|
|
124
|
+
if (trimmed === void 0) return;
|
|
125
|
+
if (deltaSecondsPattern.test(trimmed)) {
|
|
126
|
+
const seconds = Number(trimmed);
|
|
127
|
+
return Number.isSafeInteger(seconds) ? seconds : void 0;
|
|
128
|
+
}
|
|
129
|
+
if (!httpDatePattern.test(trimmed)) return;
|
|
130
|
+
const retryAt = Date.parse(trimmed);
|
|
131
|
+
return Number.isNaN(retryAt) ? void 0 : Math.max(0, Math.ceil((retryAt - Date.now()) / 1e3));
|
|
132
|
+
};
|
|
133
|
+
const responseRateLimitHeaders = (headers) => {
|
|
134
|
+
const retryAfter = getHeader(headers, "retry-after");
|
|
135
|
+
return {
|
|
136
|
+
action: getHeader(headers, "x-ratelimit-action"),
|
|
137
|
+
id: getHeader(headers, "x-ratelimit-id"),
|
|
138
|
+
limit: getHeader(headers, "x-ratelimit-limit"),
|
|
139
|
+
remaining: getHeader(headers, "x-ratelimit-remaining"),
|
|
140
|
+
retryAfter,
|
|
141
|
+
retryAfterSeconds: parseRetryAfterSeconds(retryAfter),
|
|
142
|
+
reset: getHeader(headers, "x-ratelimit-reset")
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
const mapValidationError = (cause) => new PutioValidationError({ cause });
|
|
146
|
+
const mapContractError = (cause) => new PutioContractError({ cause });
|
|
119
147
|
const mapConfigurationError = (cause) => new PutioConfigurationError({ cause });
|
|
120
148
|
const mapTransportError = (cause) => new PutioTransportError({ cause });
|
|
121
149
|
const toPutioResponseError = (status, headers, body, cause) => {
|
|
@@ -153,12 +181,15 @@ const withOperationErrors = dual(2, (effect, spec) => effect.pipe(Effect.mapErro
|
|
|
153
181
|
// src/core/validation.ts
|
|
154
182
|
const PositiveIntegerSchema = Schema.Int.check(Schema.isGreaterThan(0));
|
|
155
183
|
const NonEmptyStringSchema = Schema.String.check(Schema.isMinLength(1));
|
|
156
|
-
const
|
|
184
|
+
const NonNegativeNumberSchema = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));
|
|
185
|
+
const decodeAndRun = (schema, input, run) => Schema.decodeUnknownEffect(schema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(mapValidationError), Effect.flatMap(run));
|
|
157
186
|
const decodeAndRunRedacted = (domain, operation) => (schema, input, run) => Schema.decodeUnknownEffect(schema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(() => new PutioValidationError({ cause: {
|
|
158
187
|
domain,
|
|
159
188
|
operation,
|
|
160
189
|
reason: "Invalid request input"
|
|
161
190
|
} })), Effect.flatMap(run));
|
|
191
|
+
const failMissingField = (field) => Effect.fail(new PutioContractError({ missingField: field }));
|
|
192
|
+
const requireRequestedBreadcrumbs = (query) => (effect) => effect.pipe(Effect.filterOrElse((response) => query.breadcrumbs !== 1 || response.breadcrumbs !== void 0, () => failMissingField("breadcrumbs")));
|
|
162
193
|
const cursorSelectionSchema = (fields) => Schema.Struct({
|
|
163
194
|
cursor: Schema.optional(NonEmptyStringSchema),
|
|
164
195
|
excludeIds: Schema.optional(Schema.Array(PositiveIntegerSchema)),
|
|
@@ -169,11 +200,25 @@ const cursorSelectionSchema = (fields) => Schema.Struct({
|
|
|
169
200
|
const DEFAULT_PUTIO_API_BASE_URL = "https://api.put.io";
|
|
170
201
|
const DEFAULT_PUTIO_UPLOAD_BASE_URL = "https://upload.put.io";
|
|
171
202
|
const DEFAULT_PUTIO_WEB_APP_URL = "https://app.put.io";
|
|
203
|
+
// src/core/response-body.ts
|
|
204
|
+
const isSuccessStatus = (status) => status >= 200 && status < 300;
|
|
205
|
+
const unparsableJsonBodyError = (status, headers) => isSuccessStatus(status) ? mapContractError(/* @__PURE__ */ new SyntaxError("The HTTP response body is not valid JSON")) : toPutioResponseError(status, headers, fallbackPutioErrorEnvelope(status), /* @__PURE__ */ new SyntaxError("The HTTP error response body is not valid JSON"));
|
|
206
|
+
// src/core/secrets.ts
|
|
207
|
+
const revealSecret = (secret) => Predicate.isString(secret) ? Effect.succeed(secret) : Effect.try({
|
|
208
|
+
try: () => Redacted.value(secret),
|
|
209
|
+
catch: mapConfigurationError
|
|
210
|
+
});
|
|
211
|
+
const revealAccessToken = (accessToken) => accessToken === void 0 ? Effect.undefined : revealSecret(accessToken).pipe(Effect.map((token) => token === "" ? void 0 : token));
|
|
172
212
|
// src/core/http.ts
|
|
173
|
-
var PutioSdkConfig = class extends Context.Service()("PutioSdkConfig") {};
|
|
174
|
-
var PutioHttpClient = class extends Context.Service()("PutioHttpClient") {};
|
|
213
|
+
var PutioSdkConfig = class extends Context.Service()("@putdotio/sdk/PutioSdkConfig") {};
|
|
214
|
+
var PutioHttpClient = class extends Context.Service()("@putdotio/sdk/PutioHttpClient") {};
|
|
215
|
+
const redactPutioSecret = (secret) => {
|
|
216
|
+
if (secret === void 0) return;
|
|
217
|
+
if (Predicate.isString(secret)) return secret === "" ? void 0 : Redacted.make(secret);
|
|
218
|
+
return secret;
|
|
219
|
+
};
|
|
175
220
|
const normalizePutioSdkOptions = (config) => ({
|
|
176
|
-
accessToken: config.accessToken,
|
|
221
|
+
accessToken: redactPutioSecret(config.accessToken),
|
|
177
222
|
baseUrl: config.baseUrl ?? "https://api.put.io",
|
|
178
223
|
headers: config.headers,
|
|
179
224
|
uploadBaseUrl: config.uploadBaseUrl ?? "https://upload.put.io",
|
|
@@ -182,6 +227,7 @@ const normalizePutioSdkOptions = (config) => ({
|
|
|
182
227
|
const putioSdkLayer = (config) => Layer.succeed(PutioSdkConfig, normalizePutioSdkOptions(config));
|
|
183
228
|
const putioSdkLiveLayer = (config) => Layer.mergeAll(putioSdkLayer(config), makePutioFetchLayer());
|
|
184
229
|
const makePutioFetchLayer = (fetchImplementation = globalThis.fetch) => Layer.succeed(PutioHttpClient, makePutioFetchClient(fetchImplementation));
|
|
230
|
+
const decodeJsonText = Schema.decodeEffect(Schema.fromJsonString(Schema.Unknown));
|
|
185
231
|
const makePutioFetchClient = (fetchImplementation = globalThis.fetch) => ({ execute: (request) => Effect.suspend(() => {
|
|
186
232
|
const controller = new AbortController();
|
|
187
233
|
const read = (body) => Effect.tryPromise({
|
|
@@ -190,7 +236,7 @@ const makePutioFetchClient = (fetchImplementation = globalThis.fetch) => ({ exec
|
|
|
190
236
|
}).pipe(Effect.onInterrupt(() => Effect.sync(() => controller.abort())));
|
|
191
237
|
return read(async () => {
|
|
192
238
|
const response = await fetchImplementation(request.url, {
|
|
193
|
-
body: request.body,
|
|
239
|
+
body: request.body ?? null,
|
|
194
240
|
headers: request.headers,
|
|
195
241
|
method: request.method,
|
|
196
242
|
signal: controller.signal
|
|
@@ -198,7 +244,7 @@ const makePutioFetchClient = (fetchImplementation = globalThis.fetch) => ({ exec
|
|
|
198
244
|
return {
|
|
199
245
|
arrayBuffer: read(() => response.arrayBuffer()),
|
|
200
246
|
headers: response.headers,
|
|
201
|
-
json:
|
|
247
|
+
json: read(() => response.text()).pipe(Effect.flatMap((text) => decodeJsonText(text).pipe(Effect.mapError(() => unparsableJsonBodyError(response.status, response.headers))))),
|
|
202
248
|
status: response.status
|
|
203
249
|
};
|
|
204
250
|
});
|
|
@@ -209,9 +255,9 @@ const dotSegmentPattern = /^(?:\.|%2e){1,2}$/i;
|
|
|
209
255
|
const parserRewrittenPattern = /[\\\p{Cc}]|^ | $/u;
|
|
210
256
|
const normalizeApiPath = (path) => {
|
|
211
257
|
if (absoluteUrlPattern.test(path)) throw mapConfigurationError("SDK API request paths must be relative to the configured baseUrl");
|
|
212
|
-
if (parserRewrittenPattern.test(path)) throw
|
|
258
|
+
if (parserRewrittenPattern.test(path)) throw mapValidationError("SDK API request paths must not contain backslashes, control characters, or edge spaces");
|
|
213
259
|
const [pathname = ""] = path.split(/[?#]/, 1);
|
|
214
|
-
if (pathname.split("/").some((segment) => dotSegmentPattern.test(segment))) throw
|
|
260
|
+
if (pathname.split("/").some((segment) => dotSegmentPattern.test(segment))) throw mapValidationError("SDK API request paths must not contain dot segments");
|
|
215
261
|
return path.startsWith("/") ? path : `/${path}`;
|
|
216
262
|
};
|
|
217
263
|
const buildPutioUrl = (baseUrl, path, query) => {
|
|
@@ -223,21 +269,18 @@ const buildPutioUrl = (baseUrl, path, query) => {
|
|
|
223
269
|
};
|
|
224
270
|
const mapUrlBuildError = (cause) => cause instanceof PutioConfigurationError || cause instanceof PutioValidationError ? cause : mapConfigurationError(cause);
|
|
225
271
|
const OkResponseSchema = Schema.Struct({ status: Schema.Literal("OK") });
|
|
226
|
-
const
|
|
227
|
-
const decodeSuccessJson = (schema, response) => response.json.pipe(Effect.flatMap((json) => Schema.decodeUnknownEffect(schema)(json).pipe(Effect.mapError(mapDecodeErrorToValidationError))));
|
|
272
|
+
const decodeSuccessJson = (schema, response) => response.json.pipe(Effect.flatMap((json) => Schema.decodeUnknownEffect(schema)(json).pipe(Effect.mapError(mapContractError))));
|
|
228
273
|
const decodeFailure = (response, headers) => response.json.pipe(Effect.flatMap(parseErrorBody(response.status)), Effect.map((body) => toPutioResponseError(response.status, headers, body)));
|
|
229
274
|
const resolveAuthorization = (config, auth) => {
|
|
230
275
|
const resolvedAuth = auth ?? { type: "config-token" };
|
|
231
276
|
switch (resolvedAuth.type) {
|
|
232
|
-
case "none": return Effect.
|
|
233
|
-
case "token": return Effect.
|
|
234
|
-
case "basic": return Effect.try({
|
|
235
|
-
try: () => `Basic ${btoa(`${resolvedAuth.username}:${
|
|
277
|
+
case "none": return Effect.undefined;
|
|
278
|
+
case "token": return revealSecret(resolvedAuth.token).pipe(Effect.map((token) => `Token ${token}`));
|
|
279
|
+
case "basic": return revealSecret(resolvedAuth.password).pipe(Effect.flatMap((password) => Effect.try({
|
|
280
|
+
try: () => `Basic ${btoa(`${resolvedAuth.username}:${password}`)}`,
|
|
236
281
|
catch: mapConfigurationError
|
|
237
|
-
});
|
|
238
|
-
case "config-token":
|
|
239
|
-
if (!config.accessToken) return Effect.fail(mapConfigurationError("This endpoint requires an access token, but PutioSdkConfig.accessToken is missing"));
|
|
240
|
-
return Effect.succeed(`Token ${config.accessToken}`);
|
|
282
|
+
})));
|
|
283
|
+
case "config-token": return revealAccessToken(config.accessToken).pipe(Effect.flatMap((token) => token === void 0 ? Effect.fail(mapConfigurationError("This endpoint requires an access token, but PutioSdkConfig.accessToken is missing")) : Effect.succeed(`Token ${token}`)));
|
|
241
284
|
}
|
|
242
285
|
};
|
|
243
286
|
const normalizeFormValue = (value) => {
|
|
@@ -248,16 +291,16 @@ const normalizeFormValue = (value) => {
|
|
|
248
291
|
};
|
|
249
292
|
const withBody = (body) => {
|
|
250
293
|
switch (body.type) {
|
|
251
|
-
case "none": return Effect.
|
|
294
|
+
case "none": return Effect.undefined;
|
|
252
295
|
case "json": return Effect.try({
|
|
253
296
|
try: () => JSON.stringify(body.value),
|
|
254
|
-
catch:
|
|
297
|
+
catch: mapValidationError
|
|
255
298
|
});
|
|
256
299
|
case "form": return Effect.succeed(new URLSearchParams(Object.entries(body.value).flatMap(([key, value]) => value === void 0 ? [] : [[key, normalizeFormValue(value)]])));
|
|
257
300
|
case "form-data": return Effect.succeed(body.value);
|
|
258
301
|
}
|
|
259
302
|
};
|
|
260
|
-
const makeRequest = (url, options, configHeaders, authorization)
|
|
303
|
+
const makeRequest = Effect.fnUntraced(function* (url, options, configHeaders, authorization) {
|
|
261
304
|
const headers = new Headers(configHeaders);
|
|
262
305
|
headers.delete("authorization");
|
|
263
306
|
new Headers(options.headers).forEach((value, name) => headers.set(name, value));
|
|
@@ -265,19 +308,24 @@ const makeRequest = (url, options, configHeaders, authorization) => Effect.gen(f
|
|
|
265
308
|
if (!headers.has("accept")) headers.set("accept", "application/json");
|
|
266
309
|
if (authorization) headers.set("authorization", authorization);
|
|
267
310
|
if (body.type === "json" && !headers.has("content-type")) headers.set("content-type", "application/json");
|
|
268
|
-
|
|
269
|
-
|
|
311
|
+
const requestBody = yield* withBody(body);
|
|
312
|
+
const request = {
|
|
270
313
|
headers,
|
|
271
314
|
method: options.method,
|
|
272
315
|
url
|
|
273
316
|
};
|
|
317
|
+
return requestBody === void 0 ? request : {
|
|
318
|
+
...request,
|
|
319
|
+
body: requestBody
|
|
320
|
+
};
|
|
274
321
|
});
|
|
275
|
-
const executeRequest =
|
|
322
|
+
const executeRequest = Effect.fn("PutioSdk.executeRequest")(function* (options) {
|
|
323
|
+
yield* Effect.annotateCurrentSpan("http.request.method", options.method);
|
|
276
324
|
const config = yield* PutioSdkConfig;
|
|
277
325
|
const httpClient = yield* PutioHttpClient;
|
|
278
326
|
const authorization = yield* resolveAuthorization(config, options.auth);
|
|
279
327
|
const url = yield* Effect.try({
|
|
280
|
-
try: () => buildPutioUrl(options.baseUrl ?? config.baseUrl
|
|
328
|
+
try: () => buildPutioUrl(options.baseUrl ?? config.baseUrl, options.path, options.query),
|
|
281
329
|
catch: mapUrlBuildError
|
|
282
330
|
});
|
|
283
331
|
const request = yield* makeRequest(url, options, config.headers, authorization);
|
|
@@ -288,7 +336,7 @@ const selectJsonField = (field) => (effect) => effect.pipe(Effect.map((value) =>
|
|
|
288
336
|
const selectJsonFields = (...fields) => (effect) => effect.pipe(Effect.map((value) => Struct.pick(value, fields)));
|
|
289
337
|
const requestArrayBuffer = (options) => executeRequest(options).pipe(Effect.flatMap((response) => isSuccessStatus(response.status) ? response.arrayBuffer.pipe(Effect.map((buffer) => new Uint8Array(buffer))) : decodeFailure(response, response.headers).pipe(Effect.flatMap(Effect.fail))));
|
|
290
338
|
const requestText = (options) => requestArrayBuffer(options).pipe(Effect.map((bytes) => new TextDecoder().decode(bytes)));
|
|
291
|
-
const requestVoid = (options) => executeRequest(options).pipe(Effect.flatMap((response) => isSuccessStatus(response.status) ? Effect.
|
|
339
|
+
const requestVoid = (options) => executeRequest(options).pipe(Effect.flatMap((response) => isSuccessStatus(response.status) ? Effect.ignore(response.arrayBuffer) : decodeFailure(response, response.headers).pipe(Effect.flatMap(Effect.fail))));
|
|
292
340
|
// src/core/forms.ts
|
|
293
341
|
const joinCsv = (values) => values && values.length > 0 ? values.join(",") : void 0;
|
|
294
342
|
function toCursorSelectionForm(selection, idsFieldName = "file_ids") {
|
|
@@ -298,6 +346,6 @@ function toCursorSelectionForm(selection, idsFieldName = "file_ids") {
|
|
|
298
346
|
[idsFieldName]: joinCsv(selection.ids)
|
|
299
347
|
};
|
|
300
348
|
}
|
|
301
|
-
export {
|
|
349
|
+
export { mapContractError as $, requireRequestedBreadcrumbs as A, decodePutioErrorEnvelope as B, NonEmptyStringSchema as C, decodeAndRun as D, cursorSelectionSchema as E, PutioErrorEnvelopeSchema as F, isPutioConfigurationError as G, fallbackPutioErrorEnvelope as H, PutioOperationError as I, isPutioOperationError as J, isPutioContractError as K, PutioRateLimitError as L, PutioAuthError as M, PutioConfigurationError as N, decodeAndRunRedacted as O, PutioContractError as P, mapConfigurationError as Q, PutioTransportError as R, DEFAULT_PUTIO_WEB_APP_URL as S, PositiveIntegerSchema as T, isPutioApiError as U, definePutioOperationErrorSpec as V, isPutioAuthError as W, isPutioTransportError as X, isPutioRateLimitError as Y, isPutioValidationError as Z, selectJsonField as _, PutioSdkConfig as a, withOperationErrors as at, DEFAULT_PUTIO_API_BASE_URL as b, makePutioFetchClient as c, putioSdkLayer as d, mapTransportError as et, putioSdkLiveLayer as f, requestVoid as g, requestText as h, PutioHttpClient as i, toPutioResponseError as it, PutioApiError as j, failMissingField as k, makePutioFetchLayer as l, requestJson as m, toCursorSelectionForm as n, parseErrorBody as nt, buildPutioUrl as o, requestArrayBuffer as p, isPutioErrorEnvelope as q, OkResponseSchema as r, responseRateLimitHeaders as rt, encodePathSegment as s, joinCsv as t, mapValidationError as tt, normalizePutioSdkOptions as u, selectJsonFields as v, NonNegativeNumberSchema as w, DEFAULT_PUTIO_UPLOAD_BASE_URL as x, revealAccessToken as y, PutioValidationError as z };
|
|
302
350
|
|
|
303
|
-
//# sourceMappingURL=forms-
|
|
351
|
+
//# sourceMappingURL=forms-CcQuZ3hG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forms-CcQuZ3hG.js","names":[],"sources":["../src/core/errors.ts","../src/core/validation.ts","../src/core/defaults.ts","../src/core/response-body.ts","../src/core/secrets.ts","../src/core/http.ts","../src/core/forms.ts"],"sourcesContent":["import { Data, Effect, Predicate, Schema } from \"effect\";\nimport { dual, flow } from \"effect/Function\";\n\nexport const PutioErrorEnvelopeSchema = Schema.Struct({\n status: Schema.optional(Schema.String),\n error: Schema.optional(Schema.String),\n error_message: Schema.optional(Schema.String),\n error_type: Schema.optional(Schema.String),\n error_uri: Schema.optional(Schema.String),\n error_id: Schema.optional(Schema.NullOr(Schema.String)),\n extra: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n status_code: Schema.optional(Schema.Int),\n details: Schema.optional(Schema.Unknown),\n});\n\nexport type PutioErrorEnvelope = Schema.Schema.Type<typeof PutioErrorEnvelopeSchema>;\n\nexport interface PutioKnownErrorContract<\n TType extends string = string,\n TStatus extends number = number,\n TBody extends PutioErrorEnvelope = PutioErrorEnvelope,\n> {\n readonly bodySchema?: Schema.Schema<TBody> | undefined;\n readonly errorType?: TType | undefined;\n readonly statusCode?: TStatus | undefined;\n}\n\ntype ContractErrorType<TContract extends PutioKnownErrorContract> =\n TContract extends PutioKnownErrorContract<infer TType, number> ? TType : never;\n\ntype ContractStatusCode<TContract extends PutioKnownErrorContract> =\n TContract extends PutioKnownErrorContract<string, infer TStatus> ? TStatus : never;\n\ntype ContractBody<TContract extends PutioKnownErrorContract> = TContract extends {\n readonly bodySchema: Schema.Schema<infer TBody extends PutioErrorEnvelope>;\n}\n ? TBody\n : PutioErrorEnvelope;\n\nexport type PutioTypedErrorEnvelope<TContract extends PutioKnownErrorContract> =\n TContract extends PutioKnownErrorContract\n ? Omit<ContractBody<TContract>, \"error_message\" | \"error_type\" | \"status_code\"> & {\n readonly error_message?: string | undefined;\n readonly error_type?: [ContractErrorType<TContract>] extends [never]\n ? string | undefined\n : ContractErrorType<TContract> | undefined;\n readonly status_code?: [ContractStatusCode<TContract>] extends [never]\n ? number | undefined\n : ContractStatusCode<TContract> | undefined;\n }\n : never;\n\nexport interface PutioOperationErrorSpec<\n TDomain extends string = string,\n TOperation extends string = string,\n TContracts extends ReadonlyArray<PutioKnownErrorContract> =\n ReadonlyArray<PutioKnownErrorContract>,\n> {\n readonly domain: TDomain;\n readonly operation: TOperation;\n readonly knownErrors: TContracts;\n}\n\ntype KnownOperationContractOf<TContracts extends ReadonlyArray<PutioKnownErrorContract>> = Extract<\n TContracts[number],\n PutioKnownOperationErrorContract\n>;\n\ntype PutioOperationErrorReason<TContract extends PutioKnownErrorContract> = TContract extends {\n readonly errorType: infer TType extends string;\n}\n ? {\n readonly kind: \"error_type\";\n readonly errorType: TType;\n }\n : TContract extends { readonly statusCode: infer TStatus extends number }\n ? {\n readonly kind: \"status_code\";\n readonly statusCode: TStatus;\n }\n : never;\n\nexport type PutioKnownOperationErrorContract =\n | {\n readonly errorType: string;\n readonly statusCode?: number;\n }\n | {\n readonly errorType?: undefined;\n readonly statusCode: number;\n };\n\nconst isKnownContractMatch = <TContract extends PutioKnownErrorContract>(\n contract: TContract,\n error: PutioApiError | PutioAuthError,\n): contract is TContract & PutioKnownOperationErrorContract => {\n if (contract.bodySchema !== undefined && !Schema.is(contract.bodySchema)(error.body)) {\n return false;\n }\n\n if (contract.errorType !== undefined) {\n if (error.body.error_type !== contract.errorType) {\n return false;\n }\n\n return contract.statusCode === undefined || error.status === contract.statusCode;\n }\n\n if (contract.statusCode !== undefined) {\n return error.status === contract.statusCode;\n }\n\n return false;\n};\n\nconst isMatchableApiError = (error: PutioSdkError): error is PutioApiError | PutioAuthError =>\n Predicate.isTagged(error, \"PutioApiError\") || Predicate.isTagged(error, \"PutioAuthError\");\n\nconst PutioKnownOperationErrorContractSchema = Schema.Union([\n Schema.Struct({\n errorType: Schema.String,\n statusCode: Schema.optional(Schema.Int),\n }),\n Schema.Struct({\n errorType: Schema.optional(Schema.Undefined),\n statusCode: Schema.Int,\n }),\n]);\n\nconst PutioOperationErrorReasonSchema = Schema.Union([\n Schema.Struct({\n kind: Schema.Literal(\"error_type\"),\n errorType: Schema.String,\n }),\n Schema.Struct({\n kind: Schema.Literal(\"status_code\"),\n statusCode: Schema.Int,\n }),\n]);\n\nconst toOperationReason = (\n contract: PutioKnownOperationErrorContract,\n): PutioOperationErrorReason<PutioKnownOperationErrorContract> => {\n if (contract.errorType !== undefined) {\n return {\n kind: \"error_type\",\n errorType: contract.errorType,\n };\n }\n\n return {\n kind: \"status_code\",\n statusCode: contract.statusCode,\n };\n};\n\nconst CauseErrorFields = {\n cause: Schema.Defect(),\n};\n\nexport class PutioTransportError extends Schema.TaggedError<\n PutioTransportError,\n { readonly brand: unique symbol }\n>()(\"PutioTransportError\", { ...CauseErrorFields }) {}\n\nexport class PutioConfigurationError extends Schema.TaggedError<\n PutioConfigurationError,\n { readonly brand: unique symbol }\n>()(\"PutioConfigurationError\", { ...CauseErrorFields }) {}\n\nexport class PutioValidationError extends Schema.TaggedError<\n PutioValidationError,\n { readonly brand: unique symbol }\n>()(\"PutioValidationError\", { ...CauseErrorFields }) {}\n\nexport class PutioContractError extends Schema.TaggedError<\n PutioContractError,\n { readonly brand: unique symbol }\n>()(\"PutioContractError\", {\n cause: Schema.optional(Schema.Defect()),\n missingField: Schema.optional(Schema.String),\n}) {}\n\nconst RateLimitHeaderFields = {\n action: Schema.optional(Schema.String),\n id: Schema.optional(Schema.String),\n limit: Schema.optional(Schema.String),\n remaining: Schema.optional(Schema.String),\n retryAfter: Schema.optional(Schema.String),\n retryAfterSeconds: Schema.optional(Schema.Finite),\n reset: Schema.optional(Schema.String),\n};\n\nconst PutioResponseErrorFields = {\n status: Schema.Int,\n body: PutioErrorEnvelopeSchema,\n cause: Schema.optional(Schema.Defect()),\n};\n\nexport class PutioApiError extends Schema.TaggedError<\n PutioApiError,\n { readonly brand: unique symbol }\n>()(\"PutioApiError\", {\n ...PutioResponseErrorFields,\n}) {}\n\nexport class PutioAuthError extends Schema.TaggedError<\n PutioAuthError,\n { readonly brand: unique symbol }\n>()(\"PutioAuthError\", {\n ...PutioResponseErrorFields,\n}) {}\n\nexport class PutioRateLimitError extends Schema.TaggedError<\n PutioRateLimitError,\n { readonly brand: unique symbol }\n>()(\"PutioRateLimitError\", { ...PutioResponseErrorFields, ...RateLimitHeaderFields }) {}\n\nexport class PutioOperationError<\n TDomain extends string,\n TOperation extends string,\n TContract extends PutioKnownOperationErrorContract,\n> extends Data.TaggedError(\"PutioOperationError\")<{\n readonly body: PutioTypedErrorEnvelope<TContract>;\n readonly contract: TContract;\n readonly domain: TDomain;\n readonly operation: TOperation;\n readonly reason: PutioOperationErrorReason<TContract>;\n readonly status: number;\n}> {}\n\nexport type PutioSdkError =\n | PutioConfigurationError\n | PutioTransportError\n | PutioValidationError\n | PutioContractError\n | PutioApiError\n | PutioAuthError\n | PutioRateLimitError;\n\nexport type PutioUnhandledSdkError = PutioSdkError;\n\nexport type PutioOperationErrorFromSpec<TSpec extends PutioOperationErrorSpec> =\n PutioOperationError<\n TSpec[\"domain\"],\n TSpec[\"operation\"],\n KnownOperationContractOf<TSpec[\"knownErrors\"]>\n >;\n\nexport type PutioOperationFailure<TSpec extends PutioOperationErrorSpec> =\n | PutioUnhandledSdkError\n | PutioOperationErrorFromSpec<TSpec>;\n\nexport type AnyPutioOperationError = PutioOperationError<\n string,\n string,\n PutioKnownOperationErrorContract\n>;\n\nexport const definePutioOperationErrorSpec = <\n const TDomain extends string,\n const TOperation extends string,\n const TContracts extends ReadonlyArray<PutioKnownErrorContract>,\n>(\n spec: PutioOperationErrorSpec<TDomain, TOperation, TContracts>,\n) => spec;\n\nexport const decodePutioErrorEnvelope = Schema.decodeUnknownEffect(PutioErrorEnvelopeSchema);\n\nconst isPutioErrorEnvelopeValue = Schema.is(PutioErrorEnvelopeSchema);\n\nexport const isPutioErrorEnvelope = (value: unknown): value is PutioErrorEnvelope =>\n isPutioErrorEnvelopeValue(value);\n\nconst PutioOperationErrorValueSchema = Schema.TaggedStruct(\"PutioOperationError\", {\n body: PutioResponseErrorFields.body,\n status: PutioResponseErrorFields.status,\n contract: PutioKnownOperationErrorContractSchema,\n domain: Schema.String,\n operation: Schema.String,\n reason: PutioOperationErrorReasonSchema,\n});\n\nconst CauseErrorValueFields = {\n cause: Schema.optional(Schema.Defect()),\n};\n\nconst PutioTransportErrorValueSchema = Schema.Struct({\n ...PutioTransportError.fields,\n ...CauseErrorValueFields,\n});\n\nconst PutioConfigurationErrorValueSchema = Schema.Struct({\n ...PutioConfigurationError.fields,\n ...CauseErrorValueFields,\n});\n\nconst PutioValidationErrorValueSchema = Schema.Struct({\n ...PutioValidationError.fields,\n ...CauseErrorValueFields,\n});\n\nconst PutioContractErrorValueSchema = Schema.Struct(PutioContractError.fields);\n\nconst PutioApiErrorValueSchema = Schema.Struct(PutioApiError.fields);\n\nconst PutioAuthErrorValueSchema = Schema.Struct(PutioAuthError.fields);\n\nconst PutioRateLimitErrorValueSchema = Schema.Struct(PutioRateLimitError.fields);\n\nexport type PutioTransportErrorValue = typeof PutioTransportErrorValueSchema.Type;\n\nexport type PutioConfigurationErrorValue = typeof PutioConfigurationErrorValueSchema.Type;\n\nexport type PutioValidationErrorValue = typeof PutioValidationErrorValueSchema.Type;\n\nexport type PutioContractErrorValue = typeof PutioContractErrorValueSchema.Type;\n\nexport type PutioApiErrorValue = typeof PutioApiErrorValueSchema.Type;\n\nexport type PutioAuthErrorValue = typeof PutioAuthErrorValueSchema.Type;\n\nexport type PutioRateLimitErrorValue = typeof PutioRateLimitErrorValueSchema.Type;\n\nexport type PutioOperationErrorValue = typeof PutioOperationErrorValueSchema.Type;\n\nexport const isPutioTransportError = Schema.is(PutioTransportErrorValueSchema);\n\nexport const isPutioConfigurationError = Schema.is(PutioConfigurationErrorValueSchema);\n\nexport const isPutioValidationError = Schema.is(PutioValidationErrorValueSchema);\n\nexport const isPutioContractError = Schema.is(PutioContractErrorValueSchema);\n\nexport const isPutioApiError = Schema.is(PutioApiErrorValueSchema);\n\nexport const isPutioAuthError = Schema.is(PutioAuthErrorValueSchema);\n\nexport const isPutioRateLimitError = Schema.is(PutioRateLimitErrorValueSchema);\n\nexport const isPutioOperationError = Schema.is(PutioOperationErrorValueSchema);\n\nexport const fallbackPutioErrorEnvelope = (status: number): PutioErrorEnvelope => ({\n error_message: `put.io API request failed with status ${status}`,\n status_code: status,\n});\n\nconst getHeader = (headers: Headers, name: string): string | undefined =>\n headers.get(name) ?? undefined;\n\nconst deltaSecondsPattern = /^\\d+$/;\n\nconst httpDatePattern =\n /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), \\d{2} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \\d{4} \\d{2}:\\d{2}:\\d{2} GMT$/;\n\nconst parseRetryAfterSeconds = (value: string | undefined): number | undefined => {\n const trimmed = value?.trim();\n\n if (trimmed === undefined) {\n return undefined;\n }\n\n if (deltaSecondsPattern.test(trimmed)) {\n const seconds = Number(trimmed);\n\n return Number.isSafeInteger(seconds) ? seconds : undefined;\n }\n\n if (!httpDatePattern.test(trimmed)) {\n return undefined;\n }\n\n const retryAt = Date.parse(trimmed);\n\n return Number.isNaN(retryAt) ? undefined : Math.max(0, Math.ceil((retryAt - Date.now()) / 1000));\n};\n\nexport const responseRateLimitHeaders = (headers: Headers) => {\n const retryAfter = getHeader(headers, \"retry-after\");\n\n return {\n action: getHeader(headers, \"x-ratelimit-action\"),\n id: getHeader(headers, \"x-ratelimit-id\"),\n limit: getHeader(headers, \"x-ratelimit-limit\"),\n remaining: getHeader(headers, \"x-ratelimit-remaining\"),\n retryAfter,\n retryAfterSeconds: parseRetryAfterSeconds(retryAfter),\n reset: getHeader(headers, \"x-ratelimit-reset\"),\n };\n};\n\nexport const mapValidationError = (cause: unknown) => new PutioValidationError({ cause });\n\nexport const mapContractError = (cause: unknown) => new PutioContractError({ cause });\n\nexport const mapConfigurationError = (cause: unknown) => new PutioConfigurationError({ cause });\n\nexport const mapTransportError = (cause: unknown) => new PutioTransportError({ cause });\n\nexport const toPutioResponseError = (\n status: number,\n headers: Headers,\n body: PutioErrorEnvelope,\n cause?: unknown,\n): PutioSdkError => {\n if (status === 429) {\n return new PutioRateLimitError({\n status,\n body,\n ...responseRateLimitHeaders(headers),\n cause,\n });\n }\n\n if (status === 401 || status === 403) {\n return new PutioAuthError({ status, body, cause });\n }\n\n return new PutioApiError({ status, body, cause });\n};\n\nexport const parseErrorBody = (status: number) =>\n flow(\n decodePutioErrorEnvelope,\n Effect.orElseSucceed(() => fallbackPutioErrorEnvelope(status)),\n );\n\nexport const withOperationErrors: {\n <\n const TDomain extends string,\n const TOperation extends string,\n const TContracts extends ReadonlyArray<PutioKnownErrorContract>,\n >(\n spec: PutioOperationErrorSpec<TDomain, TOperation, TContracts>,\n ): <A, E extends PutioSdkError, R>(\n effect: Effect.Effect<A, E, R>,\n ) => Effect.Effect<\n A,\n E | PutioOperationError<TDomain, TOperation, KnownOperationContractOf<TContracts>>,\n R\n >;\n <\n A,\n E extends PutioSdkError,\n R,\n const TDomain extends string,\n const TOperation extends string,\n const TContracts extends ReadonlyArray<PutioKnownErrorContract>,\n >(\n effect: Effect.Effect<A, E, R>,\n spec: PutioOperationErrorSpec<TDomain, TOperation, TContracts>,\n ): Effect.Effect<\n A,\n E | PutioOperationError<TDomain, TOperation, KnownOperationContractOf<TContracts>>,\n R\n >;\n} = dual(\n 2,\n <A, E extends PutioSdkError, R>(\n effect: Effect.Effect<A, E, R>,\n spec: PutioOperationErrorSpec,\n ): Effect.Effect<A, E | AnyPutioOperationError, R> =>\n effect.pipe(\n Effect.mapError((error) => {\n if (!isMatchableApiError(error)) {\n return error;\n }\n\n const contract = spec.knownErrors.find((candidate) =>\n isKnownContractMatch(candidate, error),\n );\n\n if (!contract) {\n return error;\n }\n\n return new PutioOperationError({\n body: error.body,\n contract,\n domain: spec.domain,\n operation: spec.operation,\n reason: toOperationReason(contract),\n status: error.status,\n });\n }),\n ),\n);\n","import { Effect, Schema } from \"effect\";\n\nimport { mapValidationError, PutioContractError, PutioValidationError } from \"./errors.js\";\n\nexport const PositiveIntegerSchema = Schema.Int.check(Schema.isGreaterThan(0));\nexport const NonEmptyStringSchema = Schema.String.check(Schema.isMinLength(1));\nexport const NonNegativeNumberSchema = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));\n\nexport const decodeAndRun = <S extends Schema.Top, A, E, R>(\n schema: S,\n input: S[\"Encoded\"],\n run: (decoded: S[\"Type\"]) => Effect.Effect<A, E, R>,\n) =>\n Schema.decodeUnknownEffect(schema, { onExcessProperty: \"error\" })(input).pipe(\n Effect.mapError(mapValidationError),\n Effect.flatMap(run),\n );\n\nexport const decodeAndRunRedacted =\n (domain: string, operation: string) =>\n <S extends Schema.Top, A, E, R>(\n schema: S,\n input: S[\"Encoded\"],\n run: (decoded: S[\"Type\"]) => Effect.Effect<A, E, R>,\n ) =>\n Schema.decodeUnknownEffect(schema, { onExcessProperty: \"error\" })(input).pipe(\n Effect.mapError(\n () =>\n new PutioValidationError({\n cause: { domain, operation, reason: \"Invalid request input\" },\n }),\n ),\n Effect.flatMap(run),\n );\n\nexport const failMissingField = (field: string): Effect.Effect<never, PutioContractError> =>\n Effect.fail(new PutioContractError({ missingField: field }));\n\nexport const requireRequestedBreadcrumbs =\n (query: { readonly breadcrumbs?: 1 | undefined }) =>\n <A extends { readonly breadcrumbs?: unknown }, E, R>(\n effect: Effect.Effect<A, E, R>,\n ): Effect.Effect<A, E | PutioContractError, R> =>\n effect.pipe(\n Effect.filterOrElse(\n (response) => query.breadcrumbs !== 1 || response.breadcrumbs !== undefined,\n () => failMissingField(\"breadcrumbs\"),\n ),\n );\n\ntype CursorOrIdsSelection = {\n readonly cursor?: string | undefined;\n readonly ids?: ReadonlyArray<number> | undefined;\n};\n\nexport type CursorSelection<TFields extends CursorOrIdsSelection> =\n | (TFields & { readonly cursor: string })\n | (TFields & { readonly ids: ReadonlyArray<number> });\n\nexport const cursorSelectionSchema = <const TFields extends Schema.Struct.Fields>(\n fields: TFields,\n) =>\n Schema.Struct({\n cursor: Schema.optional(NonEmptyStringSchema),\n excludeIds: Schema.optional(Schema.Array(PositiveIntegerSchema)),\n ids: Schema.optional(Schema.Array(PositiveIntegerSchema).check(Schema.isMinLength(1))),\n ...fields,\n }).check(\n Schema.makeFilter(\n (input: CursorOrIdsSelection) => input.cursor !== undefined || input.ids !== undefined,\n { expected: \"a non-empty cursor or file ID selection\" },\n ),\n );\n","export const DEFAULT_PUTIO_API_BASE_URL = \"https://api.put.io\";\nexport const DEFAULT_PUTIO_UPLOAD_BASE_URL = \"https://upload.put.io\";\nexport const DEFAULT_PUTIO_WEB_APP_URL = \"https://app.put.io\";\n","import {\n fallbackPutioErrorEnvelope,\n mapContractError,\n type PutioSdkError,\n toPutioResponseError,\n} from \"./errors.js\";\n\nexport const isSuccessStatus = (status: number) => status >= 200 && status < 300;\n\nexport const unparsableJsonBodyError = (status: number, headers: Headers): PutioSdkError =>\n isSuccessStatus(status)\n ? mapContractError(new SyntaxError(\"The HTTP response body is not valid JSON\"))\n : toPutioResponseError(\n status,\n headers,\n fallbackPutioErrorEnvelope(status),\n new SyntaxError(\"The HTTP error response body is not valid JSON\"),\n );\n","import { Effect, Predicate, Redacted } from \"effect\";\n\nimport { mapConfigurationError, type PutioConfigurationError } from \"./errors.js\";\n\nexport const revealSecret = (\n secret: string | Redacted.Redacted<string>,\n): Effect.Effect<string, PutioConfigurationError> =>\n Predicate.isString(secret)\n ? Effect.succeed(secret)\n : Effect.try({\n try: () => Redacted.value(secret),\n catch: mapConfigurationError,\n });\n\nexport const revealAccessToken = (\n accessToken: Redacted.Redacted<string> | undefined,\n): Effect.Effect<string | undefined, PutioConfigurationError> =>\n accessToken === undefined\n ? Effect.undefined\n : revealSecret(accessToken).pipe(Effect.map((token) => (token === \"\" ? undefined : token)));\n","import { Context, Effect, Layer, Predicate, Redacted, Schema, Struct } from \"effect\";\n\nimport {\n DEFAULT_PUTIO_API_BASE_URL,\n DEFAULT_PUTIO_UPLOAD_BASE_URL,\n DEFAULT_PUTIO_WEB_APP_URL,\n} from \"./defaults.js\";\nimport {\n mapConfigurationError,\n mapContractError,\n mapTransportError,\n mapValidationError,\n parseErrorBody,\n PutioConfigurationError,\n type PutioSdkError,\n PutioValidationError,\n toPutioResponseError,\n} from \"./errors.js\";\nimport { isSuccessStatus, unparsableJsonBodyError } from \"./response-body.js\";\nimport { revealAccessToken, revealSecret } from \"./secrets.js\";\n\nexport type PutioQueryValue = string | number | boolean | null | undefined;\n\nexport type PutioQuery = Readonly<Record<string, PutioQueryValue>>;\n\nexport type PutioPathSegment = string | number | boolean;\n\nexport type PutioSecret = string | Redacted.Redacted<string>;\n\nexport interface PutioSdkOptions {\n readonly accessToken?: PutioSecret | undefined;\n readonly baseUrl?: string | URL | undefined;\n readonly headers?: HeadersInit | undefined;\n readonly uploadBaseUrl?: string | URL | undefined;\n readonly webAppUrl?: string | URL | undefined;\n}\n\nexport interface PutioSdkResolvedConfig {\n readonly accessToken: Redacted.Redacted<string> | undefined;\n readonly baseUrl: string | URL;\n readonly headers: HeadersInit | undefined;\n readonly uploadBaseUrl: string | URL;\n readonly webAppUrl: string | URL;\n}\n\nexport class PutioSdkConfig extends Context.Service<PutioSdkConfig, PutioSdkResolvedConfig>()(\n \"@putdotio/sdk/PutioSdkConfig\",\n) {}\n\nexport interface PutioHttpRequest {\n readonly body?: BodyInit;\n readonly headers: Headers;\n readonly method: PutioRequestMethod;\n readonly url: string;\n}\n\nexport interface PutioHttpResponse {\n readonly arrayBuffer: Effect.Effect<ArrayBuffer, PutioSdkError>;\n readonly headers: Headers;\n readonly json: Effect.Effect<unknown, PutioSdkError>;\n readonly status: number;\n}\n\nexport interface PutioHttpClientService {\n readonly execute: (request: PutioHttpRequest) => Effect.Effect<PutioHttpResponse, PutioSdkError>;\n}\n\nexport class PutioHttpClient extends Context.Service<PutioHttpClient, PutioHttpClientService>()(\n \"@putdotio/sdk/PutioHttpClient\",\n) {}\n\nexport type PutioSdkContext = PutioSdkConfig | PutioHttpClient;\n\nconst redactPutioSecret = (\n secret: PutioSecret | undefined,\n): Redacted.Redacted<string> | undefined => {\n if (secret === undefined) {\n return undefined;\n }\n\n if (Predicate.isString(secret)) {\n return secret === \"\" ? undefined : Redacted.make(secret);\n }\n\n return secret;\n};\n\nexport const normalizePutioSdkOptions = (config: PutioSdkOptions): PutioSdkResolvedConfig => ({\n accessToken: redactPutioSecret(config.accessToken),\n baseUrl: config.baseUrl ?? DEFAULT_PUTIO_API_BASE_URL,\n headers: config.headers,\n uploadBaseUrl: config.uploadBaseUrl ?? DEFAULT_PUTIO_UPLOAD_BASE_URL,\n webAppUrl: config.webAppUrl ?? DEFAULT_PUTIO_WEB_APP_URL,\n});\n\nexport const putioSdkLayer = (config: PutioSdkOptions) =>\n Layer.succeed(PutioSdkConfig, normalizePutioSdkOptions(config));\n\nexport const putioSdkLiveLayer = (config: PutioSdkOptions) =>\n Layer.mergeAll(putioSdkLayer(config), makePutioFetchLayer());\n\nexport const makePutioFetchLayer = (\n fetchImplementation: typeof globalThis.fetch = globalThis.fetch,\n) => Layer.succeed(PutioHttpClient, makePutioFetchClient(fetchImplementation));\n\nconst decodeJsonText = Schema.decodeEffect(Schema.fromJsonString(Schema.Unknown));\n\nexport const makePutioFetchClient = (\n fetchImplementation: typeof globalThis.fetch = globalThis.fetch,\n): PutioHttpClientService => ({\n execute: (request) =>\n Effect.suspend(() => {\n const controller = new AbortController();\n\n const read = <A>(body: () => Promise<A>) =>\n Effect.tryPromise({ try: body, catch: mapTransportError }).pipe(\n Effect.onInterrupt(() => Effect.sync(() => controller.abort())),\n );\n\n return read(async () => {\n const response = await fetchImplementation(request.url, {\n body: request.body ?? null,\n headers: request.headers,\n method: request.method,\n signal: controller.signal,\n });\n\n return {\n arrayBuffer: read(() => response.arrayBuffer()),\n headers: response.headers,\n json: read(() => response.text()).pipe(\n Effect.flatMap((text) =>\n decodeJsonText(text).pipe(\n Effect.mapError(() => unparsableJsonBodyError(response.status, response.headers)),\n ),\n ),\n ),\n status: response.status,\n };\n });\n }),\n});\n\nexport const encodePathSegment = (value: PutioPathSegment): string =>\n encodeURIComponent(String(value));\n\nconst absoluteUrlPattern = /^(?:[a-z][a-z\\d+.-]*:|\\/\\/)/i;\n\nconst dotSegmentPattern = /^(?:\\.|%2e){1,2}$/i;\n\nconst parserRewrittenPattern = /[\\\\\\p{Cc}]|^ | $/u;\n\nconst normalizeApiPath = (path: string): string => {\n if (absoluteUrlPattern.test(path)) {\n throw mapConfigurationError(\"SDK API request paths must be relative to the configured baseUrl\");\n }\n\n if (parserRewrittenPattern.test(path)) {\n throw mapValidationError(\n \"SDK API request paths must not contain backslashes, control characters, or edge spaces\",\n );\n }\n\n const [pathname = \"\"] = path.split(/[?#]/, 1);\n\n if (pathname.split(\"/\").some((segment) => dotSegmentPattern.test(segment))) {\n throw mapValidationError(\"SDK API request paths must not contain dot segments\");\n }\n\n return path.startsWith(\"/\") ? path : `/${path}`;\n};\n\nexport const buildPutioUrl = (baseUrl: string | URL, path: string, query?: PutioQuery): string => {\n const url = new URL(normalizeApiPath(path), baseUrl);\n\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n return url.toString();\n};\n\nconst mapUrlBuildError = (cause: unknown) =>\n cause instanceof PutioConfigurationError || cause instanceof PutioValidationError\n ? cause\n : mapConfigurationError(cause);\n\nexport const OkResponseSchema = Schema.Struct({\n status: Schema.Literal(\"OK\"),\n});\n\nexport type PutioAuth =\n | { readonly type: \"config-token\" }\n | { readonly type: \"token\"; readonly token: PutioSecret }\n | { readonly type: \"basic\"; readonly username: string; readonly password: PutioSecret }\n | { readonly type: \"none\" };\n\ntype PutioRequestMethod = \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n\ntype PutioRequestBody =\n | { readonly type: \"none\" }\n | { readonly type: \"json\"; readonly value: unknown }\n | { readonly type: \"form\"; readonly value: Readonly<Record<string, Schema.Json | undefined>> }\n | { readonly type: \"form-data\"; readonly value: FormData };\n\ninterface PutioRequestOptions {\n readonly method: PutioRequestMethod;\n readonly path: string;\n readonly baseUrl?: string | URL | undefined;\n readonly query?: PutioQuery | undefined;\n readonly headers?: HeadersInit | undefined;\n readonly auth?: PutioAuth | undefined;\n readonly body?: PutioRequestBody | undefined;\n}\n\nconst decodeSuccessJson = <S extends Schema.Top>(schema: S, response: PutioHttpResponse) =>\n response.json.pipe(\n Effect.flatMap((json) =>\n Schema.decodeUnknownEffect(schema)(json).pipe(Effect.mapError(mapContractError)),\n ),\n );\n\nconst decodeFailure = (response: PutioHttpResponse, headers: Headers) =>\n response.json.pipe(\n Effect.flatMap(parseErrorBody(response.status)),\n Effect.map((body) => toPutioResponseError(response.status, headers, body)),\n );\n\nconst resolveAuthorization = (\n config: PutioSdkResolvedConfig,\n auth: PutioAuth | undefined,\n): Effect.Effect<string | undefined, PutioSdkError> => {\n const resolvedAuth = auth ?? { type: \"config-token\" as const };\n\n switch (resolvedAuth.type) {\n case \"none\":\n return Effect.undefined;\n case \"token\":\n return revealSecret(resolvedAuth.token).pipe(Effect.map((token) => `Token ${token}`));\n case \"basic\":\n return revealSecret(resolvedAuth.password).pipe(\n Effect.flatMap((password) =>\n Effect.try({\n try: () => `Basic ${btoa(`${resolvedAuth.username}:${password}`)}`,\n catch: mapConfigurationError,\n }),\n ),\n );\n case \"config-token\":\n return revealAccessToken(config.accessToken).pipe(\n Effect.flatMap((token) =>\n token === undefined\n ? Effect.fail(\n mapConfigurationError(\n \"This endpoint requires an access token, but PutioSdkConfig.accessToken is missing\",\n ),\n )\n : Effect.succeed(`Token ${token}`),\n ),\n );\n }\n};\n\nconst normalizeFormValue = (value: Schema.Json): string => {\n if (value === null) {\n return \"\";\n }\n\n if (Predicate.isString(value)) {\n return value;\n }\n\n if (Predicate.isNumber(value) || Predicate.isBoolean(value)) {\n return String(value);\n }\n\n return JSON.stringify(value);\n};\n\nconst withBody = (body: PutioRequestBody): Effect.Effect<BodyInit | undefined, PutioSdkError> => {\n switch (body.type) {\n case \"none\":\n return Effect.undefined;\n case \"json\":\n return Effect.try({\n try: () => JSON.stringify(body.value),\n catch: mapValidationError,\n });\n case \"form\":\n return Effect.succeed(\n new URLSearchParams(\n Object.entries(body.value).flatMap(([key, value]) =>\n value === undefined ? [] : [[key, normalizeFormValue(value)]],\n ),\n ),\n );\n case \"form-data\":\n return Effect.succeed(body.value);\n }\n};\n\nconst makeRequest = Effect.fnUntraced(function* (\n url: string,\n options: PutioRequestOptions,\n configHeaders: HeadersInit | undefined,\n authorization?: string,\n) {\n const headers = new Headers(configHeaders);\n headers.delete(\"authorization\");\n new Headers(options.headers).forEach((value, name) => headers.set(name, value));\n\n const body = options.body ?? { type: \"none\" as const };\n\n if (!headers.has(\"accept\")) {\n headers.set(\"accept\", \"application/json\");\n }\n\n if (authorization) {\n headers.set(\"authorization\", authorization);\n }\n\n if (body.type === \"json\" && !headers.has(\"content-type\")) {\n headers.set(\"content-type\", \"application/json\");\n }\n\n const requestBody = yield* withBody(body);\n\n const request: PutioHttpRequest = { headers, method: options.method, url };\n\n return requestBody === undefined ? request : { ...request, body: requestBody };\n});\n\nconst executeRequest = Effect.fn(\"PutioSdk.executeRequest\")(function* (\n options: PutioRequestOptions,\n) {\n yield* Effect.annotateCurrentSpan(\"http.request.method\", options.method);\n\n const config = yield* PutioSdkConfig;\n const httpClient = yield* PutioHttpClient;\n const authorization = yield* resolveAuthorization(config, options.auth);\n\n const url = yield* Effect.try({\n try: () => buildPutioUrl(options.baseUrl ?? config.baseUrl, options.path, options.query),\n catch: mapUrlBuildError,\n });\n\n const request = yield* makeRequest(url, options, config.headers, authorization);\n\n return yield* httpClient.execute(request);\n});\n\nexport const requestJson = <S extends Schema.Top>(\n schema: S,\n options: PutioRequestOptions,\n): Effect.Effect<S[\"Type\"], PutioSdkError, PutioSdkContext | S[\"DecodingServices\"]> =>\n executeRequest(options).pipe(\n Effect.flatMap((response) =>\n isSuccessStatus(response.status)\n ? decodeSuccessJson(schema, response)\n : decodeFailure(response, response.headers).pipe(Effect.flatMap(Effect.fail)),\n ),\n );\n\nexport const selectJsonField =\n <K extends string>(field: K) =>\n <A extends { readonly [P in K]: unknown }, E, R>(\n effect: Effect.Effect<A, E, R>,\n ): Effect.Effect<A[K], E, R> =>\n effect.pipe(Effect.map((value) => value[field]));\n\nexport const selectJsonFields =\n <const K extends readonly string[]>(...fields: K) =>\n <A extends { readonly [P in K[number]]: unknown }, E, R>(\n effect: Effect.Effect<A, E, R>,\n ): Effect.Effect<Pick<A, K[number]>, E, R> =>\n effect.pipe(Effect.map((value) => Struct.pick(value, fields)));\n\nexport const requestArrayBuffer = (\n options: PutioRequestOptions,\n): Effect.Effect<Uint8Array, PutioSdkError, PutioSdkContext> =>\n executeRequest(options).pipe(\n Effect.flatMap((response) =>\n isSuccessStatus(response.status)\n ? response.arrayBuffer.pipe(Effect.map((buffer) => new Uint8Array(buffer)))\n : decodeFailure(response, response.headers).pipe(Effect.flatMap(Effect.fail)),\n ),\n );\n\nexport const requestText = (\n options: PutioRequestOptions,\n): Effect.Effect<string, PutioSdkError, PutioSdkContext> =>\n requestArrayBuffer(options).pipe(Effect.map((bytes) => new TextDecoder().decode(bytes)));\n\nexport const requestVoid = (\n options: PutioRequestOptions,\n): Effect.Effect<void, PutioSdkError, PutioSdkContext> =>\n executeRequest(options).pipe(\n Effect.flatMap((response) =>\n isSuccessStatus(response.status)\n ? Effect.ignore(response.arrayBuffer)\n : decodeFailure(response, response.headers).pipe(Effect.flatMap(Effect.fail)),\n ),\n );\n","type CsvValue = string | number;\n\nexport interface CursorSelectionInput<TValue extends CsvValue = number> {\n readonly cursor?: string | undefined;\n readonly excludeIds?: ReadonlyArray<TValue> | undefined;\n readonly ids?: ReadonlyArray<TValue> | undefined;\n}\n\nexport const joinCsv = <TValue extends CsvValue>(\n values: ReadonlyArray<TValue> | undefined,\n): string | undefined => (values && values.length > 0 ? values.join(\",\") : undefined);\n\ntype CursorSelectionForm<TIdsFieldName extends string> = {\n readonly cursor?: string | undefined;\n readonly exclude_ids?: string | undefined;\n} & Record<TIdsFieldName, string | undefined>;\n\nexport function toCursorSelectionForm<TValue extends CsvValue>(\n selection: CursorSelectionInput<TValue>,\n): CursorSelectionForm<\"file_ids\">;\nexport function toCursorSelectionForm<TValue extends CsvValue, const TIdsFieldName extends string>(\n selection: CursorSelectionInput<TValue>,\n idsFieldName: TIdsFieldName,\n): CursorSelectionForm<TIdsFieldName>;\nexport function toCursorSelectionForm(\n selection: CursorSelectionInput<CsvValue>,\n idsFieldName = \"file_ids\",\n): CursorSelectionForm<string> {\n return {\n cursor: selection.cursor,\n exclude_ids: joinCsv(selection.excludeIds),\n [idsFieldName]: joinCsv(selection.ids),\n };\n}\n"],"mappings":";;;AAGA,MAAa,2BAA2B,OAAO,OAAO;CACpD,QAAQ,OAAO,SAAS,OAAO,MAAM;CACrC,OAAO,OAAO,SAAS,OAAO,MAAM;CACpC,eAAe,OAAO,SAAS,OAAO,MAAM;CAC5C,YAAY,OAAO,SAAS,OAAO,MAAM;CACzC,WAAW,OAAO,SAAS,OAAO,MAAM;CACxC,UAAU,OAAO,SAAS,OAAO,OAAO,OAAO,MAAM,CAAC;CACtD,OAAO,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO,CAAC;CACnE,aAAa,OAAO,SAAS,OAAO,GAAG;CACvC,SAAS,OAAO,SAAS,OAAO,OAAO;AACzC,CAAC;AA+ED,MAAM,wBACJ,UACA,UAC6D;CAC7D,IAAI,SAAS,eAAe,KAAA,KAAa,CAAC,OAAO,GAAG,SAAS,UAAU,CAAC,CAAC,MAAM,IAAI,GACjF,OAAO;CAGT,IAAI,SAAS,cAAc,KAAA,GAAW;EACpC,IAAI,MAAM,KAAK,eAAe,SAAS,WACrC,OAAO;EAGT,OAAO,SAAS,eAAe,KAAA,KAAa,MAAM,WAAW,SAAS;CACxE;CAEA,IAAI,SAAS,eAAe,KAAA,GAC1B,OAAO,MAAM,WAAW,SAAS;CAGnC,OAAO;AACT;AAEA,MAAM,uBAAuB,UAC3B,UAAU,SAAS,OAAO,eAAe,KAAK,UAAU,SAAS,OAAO,gBAAgB;AAE1F,MAAM,yCAAyC,OAAO,MAAM,CAC1D,OAAO,OAAO;CACZ,WAAW,OAAO;CAClB,YAAY,OAAO,SAAS,OAAO,GAAG;AACxC,CAAC,GACD,OAAO,OAAO;CACZ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