@putdotio/sdk 9.0.0 → 9.1.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/index.js CHANGED
@@ -1,178 +1,6 @@
1
- import { FetchHttpClient, Headers, HttpClient, HttpClientRequest, HttpClientResponse } from "@effect/platform";
2
- import { Cause, Context, Data, Effect, Exit, Layer, Option, Schema } from "effect";
3
- //#region src/core/errors.ts
4
- const PutioErrorEnvelopeSchema = Schema.Struct({
5
- error_message: Schema.optional(Schema.String),
6
- error_type: Schema.optional(Schema.String),
7
- status_code: Schema.optional(Schema.Number.pipe(Schema.int())),
8
- details: Schema.optional(Schema.Unknown)
9
- });
10
- const isKnownContractMatch = (contract, error) => {
11
- if (contract.errorType !== void 0) return error.body.error_type === contract.errorType;
12
- if (contract.statusCode !== void 0) return error.status === contract.statusCode;
13
- return false;
14
- };
15
- const isMatchableApiError = (error) => error._tag === "PutioApiError" || error._tag === "PutioAuthError";
16
- const toOperationReason = (contract) => {
17
- if (contract.errorType !== void 0) return {
18
- kind: "error_type",
19
- errorType: contract.errorType
20
- };
21
- return {
22
- kind: "status_code",
23
- statusCode: contract.statusCode
24
- };
25
- };
26
- var PutioTransportError = class extends Data.TaggedError("PutioTransportError") {};
27
- var PutioConfigurationError = class extends Data.TaggedError("PutioConfigurationError") {};
28
- var PutioValidationError = class extends Data.TaggedError("PutioValidationError") {};
29
- var PutioApiError = class extends Data.TaggedError("PutioApiError") {};
30
- var PutioAuthError = class extends Data.TaggedError("PutioAuthError") {};
31
- var PutioRateLimitError = class extends Data.TaggedError("PutioRateLimitError") {};
32
- var PutioOperationError = class extends Data.TaggedError("PutioOperationError") {};
33
- const definePutioOperationErrorSpec = (spec) => spec;
34
- const decodePutioErrorEnvelope = Schema.decodeUnknown(PutioErrorEnvelopeSchema);
35
- const fallbackPutioErrorEnvelope = (status) => ({
36
- error_message: `put.io API request failed with status ${status}`,
37
- status_code: status
38
- });
39
- const responseRateLimitHeaders = (headers) => ({
40
- action: Option.getOrUndefined(Headers.get(headers, "x-ratelimit-action")),
41
- id: Option.getOrUndefined(Headers.get(headers, "x-ratelimit-id")),
42
- limit: Option.getOrUndefined(Headers.get(headers, "x-ratelimit-limit")),
43
- remaining: Option.getOrUndefined(Headers.get(headers, "x-ratelimit-remaining")),
44
- retryAfter: Option.getOrUndefined(Headers.get(headers, "retry-after")),
45
- reset: Option.getOrUndefined(Headers.get(headers, "x-ratelimit-reset"))
46
- });
47
- const mapDecodeErrorToValidationError = (cause) => new PutioValidationError({ cause });
48
- const mapConfigurationError = (cause) => new PutioConfigurationError({ cause });
49
- const mapTransportError = (cause) => new PutioTransportError({ cause });
50
- const makeResponseError = (status, headers, body) => {
51
- if (status === 429) return new PutioRateLimitError({
52
- status,
53
- body,
54
- ...responseRateLimitHeaders(headers)
55
- });
56
- if (status === 401 || status === 403) return new PutioAuthError({
57
- status,
58
- body
59
- });
60
- return new PutioApiError({
61
- status,
62
- body
63
- });
64
- };
65
- const parseErrorBody = (status, json) => decodePutioErrorEnvelope(json).pipe(Effect.orElseSucceed(() => fallbackPutioErrorEnvelope(status)));
66
- const withOperationErrors = (effect, spec) => effect.pipe(Effect.mapError((error) => {
67
- if (!isMatchableApiError(error)) return error;
68
- const contract = spec.knownErrors.find((candidate) => isKnownContractMatch(candidate, error));
69
- if (!contract) return error;
70
- return new PutioOperationError({
71
- body: error.body,
72
- contract,
73
- domain: spec.domain,
74
- operation: spec.operation,
75
- reason: toOperationReason(contract),
76
- status: error.status
77
- });
78
- }));
79
- //#endregion
80
- //#region src/core/defaults.ts
81
- const DEFAULT_PUTIO_API_BASE_URL = "https://api.put.io";
82
- const DEFAULT_PUTIO_UPLOAD_BASE_URL = "https://upload.put.io";
83
- const DEFAULT_PUTIO_WEB_APP_URL = "https://app.put.io";
84
- //#endregion
85
- //#region src/core/http.ts
86
- var PutioSdkConfig = class extends Context.Tag("PutioSdkConfig")() {};
87
- const makePutioSdkConfig = (config) => ({
88
- accessToken: config.accessToken,
89
- baseUrl: config.baseUrl ?? "https://api.put.io",
90
- uploadBaseUrl: config.uploadBaseUrl ?? "https://upload.put.io",
91
- webAppUrl: config.webAppUrl ?? "https://app.put.io"
92
- });
93
- const makePutioSdkLayer = (config) => Layer.succeed(PutioSdkConfig, makePutioSdkConfig(config));
94
- const buildPutioUrl = (baseUrl, path, query) => {
95
- const url = new URL(path, baseUrl);
96
- if (query) {
97
- for (const [key, value] of Object.entries(query)) if (value !== void 0 && value !== null) url.searchParams.set(key, String(value));
98
- }
99
- return url.toString();
100
- };
101
- const OkResponseSchema = Schema.Struct({ status: Schema.Literal("OK") });
102
- const isSuccessStatus = (status) => status >= 200 && status < 300;
103
- const decodeSuccessJson = (schema, response) => HttpClientResponse.schemaBodyJson(schema)(response).pipe(Effect.mapError(mapDecodeErrorToValidationError));
104
- const decodeFailure = (response, headers) => response.json.pipe(Effect.flatMap((json) => parseErrorBody(response.status, json)), Effect.orElseSucceed(() => fallbackPutioErrorEnvelope(response.status)), Effect.map((body) => makeResponseError(response.status, headers, body)));
105
- const toBasicAuthorization = (username, password) => {
106
- if (typeof globalThis.btoa === "function") return `Basic ${globalThis.btoa(`${username}:${password}`)}`;
107
- throw mapConfigurationError("This runtime does not provide btoa(), so Basic auth cannot be encoded safely");
108
- };
109
- const resolveAuthorization = (config, auth) => {
110
- const resolvedAuth = auth ?? { type: "config-token" };
111
- switch (resolvedAuth.type) {
112
- case "none": return Effect.succeed(void 0);
113
- case "token": return Effect.succeed(`Token ${resolvedAuth.token}`);
114
- case "basic": return Effect.try({
115
- try: () => toBasicAuthorization(resolvedAuth.username, resolvedAuth.password),
116
- catch: mapConfigurationError
117
- });
118
- case "config-token":
119
- if (!config.accessToken) return Effect.fail(mapConfigurationError("This endpoint requires an access token, but PutioSdkConfig.accessToken is missing"));
120
- return Effect.succeed(`Token ${config.accessToken}`);
121
- }
122
- };
123
- const normalizeFormValue = (value) => {
124
- if (value === null || value === void 0) return "";
125
- if (typeof value === "string") return value;
126
- if (typeof value === "number" || typeof value === "boolean") return String(value);
127
- return JSON.stringify(value);
128
- };
129
- const withBody = (request, body) => {
130
- switch (body.type) {
131
- case "none": return Effect.succeed(request);
132
- case "json": return HttpClientRequest.bodyJson(request, body.value).pipe(Effect.mapError(mapDecodeErrorToValidationError));
133
- case "form": return Effect.succeed(HttpClientRequest.bodyUrlParams(request, Object.fromEntries(Object.entries(body.value).flatMap(([key, value]) => value === void 0 ? [] : [[key, normalizeFormValue(value)]]))));
134
- case "form-data": return Effect.succeed(HttpClientRequest.bodyFormData(request, body.value));
135
- }
136
- };
137
- const makeRequest = (url, options, authorization) => Effect.gen(function* () {
138
- const headers = authorization ? Headers.set(Headers.fromInput(options.headers), "authorization", authorization) : Headers.fromInput(options.headers);
139
- const body = options.body ?? { type: "none" };
140
- return yield* withBody(HttpClientRequest.make(options.method)(url, {
141
- acceptJson: true,
142
- headers
143
- }), body);
144
- });
145
- const requestJson = (schema, options) => Effect.gen(function* () {
146
- const config = yield* PutioSdkConfig;
147
- const authorization = yield* resolveAuthorization(config, options.auth);
148
- const request = yield* makeRequest(buildPutioUrl(options.baseUrl ?? config.baseUrl ?? "https://api.put.io", options.path, options.query), options, authorization);
149
- const response = yield* HttpClient.execute(request).pipe(Effect.mapError(mapTransportError));
150
- if (isSuccessStatus(response.status)) return yield* decodeSuccessJson(schema, response);
151
- const error = yield* decodeFailure(response, response.headers);
152
- return yield* Effect.fail(error);
153
- });
154
- const requestArrayBuffer = (options) => Effect.gen(function* () {
155
- const config = yield* PutioSdkConfig;
156
- const authorization = yield* resolveAuthorization(config, options.auth);
157
- const request = yield* makeRequest(buildPutioUrl(options.baseUrl ?? config.baseUrl ?? "https://api.put.io", options.path, options.query), options, authorization);
158
- const response = yield* HttpClient.execute(request).pipe(Effect.mapError(mapTransportError));
159
- if (isSuccessStatus(response.status)) {
160
- const buffer = yield* response.arrayBuffer.pipe(Effect.mapError(mapTransportError));
161
- return new Uint8Array(buffer);
162
- }
163
- const error = yield* decodeFailure(response, response.headers);
164
- return yield* Effect.fail(error);
165
- });
166
- const requestVoid = (options) => Effect.gen(function* () {
167
- const config = yield* PutioSdkConfig;
168
- const authorization = yield* resolveAuthorization(config, options.auth);
169
- const request = yield* makeRequest(buildPutioUrl(options.baseUrl ?? config.baseUrl ?? "https://api.put.io", options.path, options.query), options, authorization);
170
- const response = yield* HttpClient.execute(request).pipe(Effect.mapError(mapTransportError));
171
- if (isSuccessStatus(response.status)) return;
172
- const error = yield* decodeFailure(response, response.headers);
173
- return yield* Effect.fail(error);
174
- });
175
- //#endregion
1
+ import { A as mapTransportError, C as PutioValidationError, D as makeResponseError, E as fallbackPutioErrorEnvelope, M as responseRateLimitHeaders, N as withOperationErrors, O as mapConfigurationError, S as PutioTransportError, T as definePutioOperationErrorSpec, _ as PutioAuthError, a as buildPutioUrl, b as PutioOperationError, c as requestArrayBuffer, d as selectJsonField, f as selectJsonFields, g as PutioApiError, h as DEFAULT_PUTIO_WEB_APP_URL, i as PutioSdkConfig, j as parseErrorBody, k as mapDecodeErrorToValidationError, l as requestJson, m as DEFAULT_PUTIO_UPLOAD_BASE_URL, n as toCursorSelectionForm, o as makePutioSdkConfig, p as DEFAULT_PUTIO_API_BASE_URL, r as OkResponseSchema, s as makePutioSdkLayer, t as joinCsv, u as requestVoid, v as PutioConfigurationError, w as decodePutioErrorEnvelope, x as PutioRateLimitError, y as PutioErrorEnvelopeSchema } from "./forms-DM_sjuyz.js";
2
+ import { FetchHttpClient } from "@effect/platform";
3
+ import { Effect, Layer, ManagedRuntime, Schema } from "effect";
176
4
  //#region src/domains/account.ts
177
5
  const RequestedFlag$1 = Schema.Literal(1);
178
6
  const AccountDiskSchema = Schema.Struct({
@@ -293,12 +121,24 @@ const AccountConfirmationsEnvelopeSchema = Schema.Struct({
293
121
  status: Schema.Literal("OK")
294
122
  });
295
123
  const missingFieldError$1 = (field) => new PutioValidationError({ cause: `Expected put.io to include "${field}" because it was requested` });
124
+ const failMissingField$1 = (field) => Effect.fail(missingFieldError$1(field));
125
+ const widenValidationError$1 = (effect) => effect;
296
126
  const hasDownloadToken = (value) => typeof value.download_token === "string";
297
127
  const hasFeatures = (value) => typeof value.features === "object" && value.features !== null;
298
128
  const hasIntercomUserHash = (value) => typeof value.user_hash === "string";
299
129
  const hasPas = (value) => typeof value.pas === "object" && value.pas !== null && typeof value.pas.user_hash === "string";
300
130
  const hasPaddleUserId = (value) => "paddle_user_id" in value;
301
131
  const hasPushToken = (value) => typeof value.push_token === "string";
132
+ const ensureAccountInfoFields = (effect, query) => Effect.gen(function* () {
133
+ const info = yield* widenValidationError$1(effect);
134
+ if (query.download_token === 1 && !hasDownloadToken(info)) return yield* failMissingField$1("download_token");
135
+ if (query.features === 1 && !hasFeatures(info)) return yield* failMissingField$1("features");
136
+ if (query.intercom === 1 && !hasIntercomUserHash(info)) return yield* failMissingField$1("user_hash");
137
+ if (query.pas === 1 && !hasPas(info)) return yield* failMissingField$1("pas");
138
+ if (query.profitwell === 1 && !hasPaddleUserId(info)) return yield* failMissingField$1("paddle_user_id");
139
+ if (query.push_token === 1 && !hasPushToken(info)) return yield* failMissingField$1("push_token");
140
+ return info;
141
+ });
302
142
  const SaveAccountSettingsErrorSpec = definePutioOperationErrorSpec({
303
143
  domain: "account",
304
144
  operation: "saveSettings",
@@ -386,24 +226,16 @@ const AccountConfirmationsErrorSpec = definePutioOperationErrorSpec({
386
226
  }]
387
227
  });
388
228
  function getAccountInfo(query) {
389
- const effect = requestJson(AccountInfoEnvelopeSchema, {
229
+ return ensureAccountInfoFields(requestJson(AccountInfoEnvelopeSchema, {
390
230
  method: "GET",
391
231
  path: "/v2/account/info",
392
232
  query
393
- }).pipe(Effect.map(({ info }) => info));
394
- if (query.download_token === 1 && query.pas === 1) return effect.pipe(Effect.filterOrFail(hasDownloadToken, () => missingFieldError$1("download_token")), Effect.filterOrFail(hasPas, () => missingFieldError$1("pas")));
395
- if (query.download_token === 1) return effect.pipe(Effect.filterOrFail(hasDownloadToken, () => missingFieldError$1("download_token")));
396
- if (query.features === 1) return effect.pipe(Effect.filterOrFail(hasFeatures, () => missingFieldError$1("features")));
397
- if (query.intercom === 1) return effect.pipe(Effect.filterOrFail(hasIntercomUserHash, () => missingFieldError$1("user_hash")));
398
- if (query.pas === 1) return effect.pipe(Effect.filterOrFail(hasPas, () => missingFieldError$1("pas")));
399
- if (query.profitwell === 1) return effect.pipe(Effect.filterOrFail(hasPaddleUserId, () => missingFieldError$1("paddle_user_id")));
400
- if (query.push_token === 1) return effect.pipe(Effect.filterOrFail(hasPushToken, () => missingFieldError$1("push_token")));
401
- return effect;
233
+ }).pipe(selectJsonField("info")), query);
402
234
  }
403
235
  const getAccountSettings = () => requestJson(AccountSettingsEnvelopeSchema, {
404
236
  method: "GET",
405
237
  path: "/v2/account/settings"
406
- }).pipe(Effect.map(({ settings }) => settings));
238
+ }).pipe(selectJsonField("settings"));
407
239
  const saveAccountSettings = (payload) => requestJson(OkResponseSchema, {
408
240
  body: {
409
241
  type: "json",
@@ -411,7 +243,7 @@ const saveAccountSettings = (payload) => requestJson(OkResponseSchema, {
411
243
  },
412
244
  method: "POST",
413
245
  path: "/v2/account/settings"
414
- }).pipe((effect) => withOperationErrors(effect, SaveAccountSettingsErrorSpec));
246
+ }).pipe(withOperationErrors(SaveAccountSettingsErrorSpec));
415
247
  const clearAccount = (options) => requestJson(OkResponseSchema, {
416
248
  body: {
417
249
  type: "form",
@@ -432,7 +264,7 @@ const listAccountConfirmations = (subject) => requestJson(AccountConfirmationsEn
432
264
  method: "GET",
433
265
  path: "/v2/account/confirmation/list",
434
266
  query: subject ? { type: subject } : void 0
435
- }).pipe(Effect.map(({ confirmations }) => confirmations), (effect) => withOperationErrors(effect, AccountConfirmationsErrorSpec));
267
+ }).pipe(selectJsonField("confirmations"), withOperationErrors(AccountConfirmationsErrorSpec));
436
268
  //#endregion
437
269
  //#region src/domains/oauth.ts
438
270
  const OAuthAppBaseSchema = Schema.Struct({
@@ -585,11 +417,11 @@ const buildOAuthAppIconUrl = (options) => buildPutioUrl(options.baseUrl ?? "http
585
417
  const queryOAuthApps = () => requestJson(OAuthAppsEnvelopeSchema, {
586
418
  method: "GET",
587
419
  path: "/v2/oauth/apps"
588
- }).pipe(Effect.map(({ apps }) => apps), (effect) => withOperationErrors(effect, QueryOAuthAppsErrorSpec));
420
+ }).pipe(selectJsonField("apps"), withOperationErrors(QueryOAuthAppsErrorSpec));
589
421
  const getOAuthApp = (id, options) => requestJson(OAuthAppWithTokenSchema, {
590
422
  method: "GET",
591
423
  path: options?.edit ? `/v2/oauth/apps/${id}/edit` : `/v2/oauth/apps/${id}`
592
- }).pipe((effect) => withOperationErrors(effect, GetOAuthAppErrorSpec));
424
+ }).pipe(withOperationErrors(GetOAuthAppErrorSpec));
593
425
  const setOAuthAppIcon = (id, input) => {
594
426
  const formData = new FormData();
595
427
  formData.append("icon", input.icon);
@@ -609,7 +441,7 @@ const createOAuthApp = (input) => requestJson(OAuthAppEnvelopeSchema, {
609
441
  },
610
442
  method: "POST",
611
443
  path: "/v2/oauth/apps/register"
612
- }).pipe((effect) => withOperationErrors(effect, CreateOAuthAppErrorSpec));
444
+ }).pipe(withOperationErrors(CreateOAuthAppErrorSpec));
613
445
  const updateOAuthApp = (input) => requestJson(OAuthAppWithTokenSchema, {
614
446
  body: {
615
447
  type: "form-data",
@@ -617,19 +449,19 @@ const updateOAuthApp = (input) => requestJson(OAuthAppWithTokenSchema, {
617
449
  },
618
450
  method: "POST",
619
451
  path: `/v2/oauth/apps/${input.id}`
620
- }).pipe((effect) => withOperationErrors(effect, UpdateOAuthAppErrorSpec));
452
+ }).pipe(withOperationErrors(UpdateOAuthAppErrorSpec));
621
453
  const deleteOAuthApp = (id) => requestJson(OkResponseSchema, {
622
454
  method: "POST",
623
455
  path: `/v2/oauth/apps/${id}/delete`
624
- }).pipe((effect) => withOperationErrors(effect, DeleteOAuthAppErrorSpec));
456
+ }).pipe(withOperationErrors(DeleteOAuthAppErrorSpec));
625
457
  const regenerateOAuthAppToken = (id) => requestJson(OAuthRegeneratedTokenEnvelopeSchema, {
626
458
  method: "POST",
627
459
  path: `/v2/oauth/apps/${id}/regenerate_token`
628
- }).pipe(Effect.map(({ access_token }) => access_token), (effect) => withOperationErrors(effect, RegenerateOAuthAppTokenErrorSpec));
460
+ }).pipe(selectJsonField("access_token"), withOperationErrors(RegenerateOAuthAppTokenErrorSpec));
629
461
  const getPopularOAuthApps = () => requestJson(PopularOAuthAppsEnvelopeSchema, {
630
462
  method: "GET",
631
463
  path: "/v2/oauth/apps/popular"
632
- }).pipe(Effect.map(({ apps }) => apps));
464
+ }).pipe(selectJsonField("apps"));
633
465
  //#endregion
634
466
  //#region src/domains/auth.ts
635
467
  const LoginResponseSchema = Schema.Struct({
@@ -1004,10 +836,7 @@ const login = (input) => requestJson(LoginResponseSchema, {
1004
836
  client_name: input.clientName,
1005
837
  client_secret: input.clientSecret
1006
838
  }
1007
- }).pipe(Effect.map(({ access_token, user_id }) => ({
1008
- access_token,
1009
- user_id
1010
- })), (effect) => withOperationErrors(effect, LoginErrorSpec));
839
+ }).pipe(selectJsonFields("access_token", "user_id"), withOperationErrors(LoginErrorSpec));
1011
840
  const logout = () => requestJson(OkResponseSchema, {
1012
841
  method: "POST",
1013
842
  path: "/v2/oauth/grants/logout"
@@ -1020,33 +849,33 @@ const register = (input) => requestJson(ResetPasswordEnvelopeSchema, {
1020
849
  },
1021
850
  method: "POST",
1022
851
  path: "/v2/registration/register"
1023
- }).pipe(Effect.map(({ access_token }) => ({ access_token })), (effect) => withOperationErrors(effect, RegisterErrorSpec));
852
+ }).pipe(selectJsonFields("access_token"), withOperationErrors(RegisterErrorSpec));
1024
853
  const exists = (key, value) => requestJson(ExistsEnvelopeSchema, {
1025
854
  auth: { type: "none" },
1026
855
  method: "GET",
1027
856
  path: `/v2/registration/exists/${key}`,
1028
857
  query: { value }
1029
- }).pipe(Effect.map(({ exists }) => exists));
858
+ }).pipe(selectJsonField("exists"));
1030
859
  const getVoucher = (code) => requestJson(VoucherEnvelopeSchema, {
1031
860
  auth: { type: "none" },
1032
861
  method: "GET",
1033
862
  path: `/v2/registration/voucher/${code}`
1034
- }).pipe(Effect.map(({ voucher }) => voucher), (effect) => withOperationErrors(effect, VoucherLookupErrorSpec));
863
+ }).pipe(selectJsonField("voucher"), withOperationErrors(VoucherLookupErrorSpec));
1035
864
  const getGiftCard = (code) => requestJson(GiftCardEnvelopeSchema, {
1036
865
  auth: { type: "none" },
1037
866
  method: "GET",
1038
867
  path: `/v2/registration/gift_card/${code}`
1039
- }).pipe(Effect.map(({ gift_card }) => gift_card), (effect) => withOperationErrors(effect, GiftCardLookupErrorSpec));
868
+ }).pipe(selectJsonField("gift_card"), withOperationErrors(GiftCardLookupErrorSpec));
1040
869
  const getFamilyInvite = (code) => requestJson(FamilyInviteEnvelopeSchema, {
1041
870
  auth: { type: "none" },
1042
871
  method: "GET",
1043
872
  path: `/v2/registration/family/${code}`
1044
- }).pipe(Effect.map(({ invite }) => invite), (effect) => withOperationErrors(effect, FamilyInviteLookupErrorSpec));
873
+ }).pipe(selectJsonField("invite"), withOperationErrors(FamilyInviteLookupErrorSpec));
1045
874
  const getFriendInvite = (code) => requestJson(FriendInviteEnvelopeSchema, {
1046
875
  auth: { type: "none" },
1047
876
  method: "GET",
1048
877
  path: `/v2/registration/friend/${code}`
1049
- }).pipe(Effect.map(({ invite }) => invite), (effect) => withOperationErrors(effect, FriendInviteLookupErrorSpec));
878
+ }).pipe(selectJsonField("invite"), withOperationErrors(FriendInviteLookupErrorSpec));
1050
879
  const forgotPassword = (mail) => requestJson(OkResponseSchema, {
1051
880
  auth: { type: "none" },
1052
881
  body: {
@@ -1055,7 +884,7 @@ const forgotPassword = (mail) => requestJson(OkResponseSchema, {
1055
884
  },
1056
885
  method: "POST",
1057
886
  path: "/v2/registration/password/forgot"
1058
- }).pipe((effect) => withOperationErrors(effect, ForgotPasswordErrorSpec));
887
+ }).pipe(withOperationErrors(ForgotPasswordErrorSpec));
1059
888
  const resetPassword = (key, password) => requestJson(ResetPasswordEnvelopeSchema, {
1060
889
  auth: { type: "none" },
1061
890
  body: {
@@ -1067,7 +896,7 @@ const resetPassword = (key, password) => requestJson(ResetPasswordEnvelopeSchema
1067
896
  },
1068
897
  method: "POST",
1069
898
  path: "/v2/registration/password/reset"
1070
- }).pipe(Effect.map(({ access_token }) => ({ access_token })), (effect) => withOperationErrors(effect, ResetPasswordErrorSpec));
899
+ }).pipe(selectJsonFields("access_token"), withOperationErrors(ResetPasswordErrorSpec));
1071
900
  const getCode = (input) => requestJson(AuthorizationCodeEnvelopeSchema, {
1072
901
  auth: { type: "none" },
1073
902
  method: "GET",
@@ -1076,15 +905,12 @@ const getCode = (input) => requestJson(AuthorizationCodeEnvelopeSchema, {
1076
905
  app_id: input.appId,
1077
906
  client_name: input.clientName
1078
907
  }
1079
- }).pipe(Effect.map(({ code, qr_code_url }) => ({
1080
- code,
1081
- qr_code_url
1082
- })));
908
+ }).pipe(selectJsonFields("code", "qr_code_url"));
1083
909
  const checkCodeMatch = (code) => requestJson(CodeMatchEnvelopeSchema, {
1084
910
  auth: { type: "none" },
1085
911
  method: "GET",
1086
912
  path: `/v2/oauth2/oob/code/${code}`
1087
- }).pipe(Effect.map(({ oauth_token }) => oauth_token));
913
+ }).pipe(selectJsonField("oauth_token"));
1088
914
  const linkDevice = (code) => requestJson(LinkDeviceEnvelopeSchema, {
1089
915
  body: {
1090
916
  type: "form",
@@ -1092,27 +918,27 @@ const linkDevice = (code) => requestJson(LinkDeviceEnvelopeSchema, {
1092
918
  },
1093
919
  method: "POST",
1094
920
  path: "/v2/oauth2/oob/code"
1095
- }).pipe(Effect.map(({ app }) => app), (effect) => withOperationErrors(effect, LinkDeviceErrorSpec));
921
+ }).pipe(selectJsonField("app"), withOperationErrors(LinkDeviceErrorSpec));
1096
922
  const grants = () => requestJson(GrantsEnvelopeSchema, {
1097
923
  method: "GET",
1098
924
  path: "/v2/oauth/grants/"
1099
- }).pipe(Effect.map(({ apps }) => apps), (effect) => withOperationErrors(effect, GrantsErrorSpec));
925
+ }).pipe(selectJsonField("apps"), withOperationErrors(GrantsErrorSpec));
1100
926
  const revokeApp = (id) => requestJson(OkResponseSchema, {
1101
927
  method: "POST",
1102
928
  path: `/v2/oauth/grants/${id}/delete`
1103
- }).pipe((effect) => withOperationErrors(effect, RevokeOAuthGrantErrorSpec));
929
+ }).pipe(withOperationErrors(RevokeOAuthGrantErrorSpec));
1104
930
  const clients = () => requestJson(ClientsEnvelopeSchema, {
1105
931
  method: "GET",
1106
932
  path: "/v2/oauth/clients/"
1107
- }).pipe(Effect.map(({ clients }) => clients), (effect) => withOperationErrors(effect, ClientsErrorSpec));
933
+ }).pipe(selectJsonField("clients"), withOperationErrors(ClientsErrorSpec));
1108
934
  const revokeClient = (id) => requestJson(OkResponseSchema, {
1109
935
  method: "POST",
1110
936
  path: `/v2/oauth/clients/${id}/delete`
1111
- }).pipe((effect) => withOperationErrors(effect, RevokeOAuthClientErrorSpec));
937
+ }).pipe(withOperationErrors(RevokeOAuthClientErrorSpec));
1112
938
  const revokeAllClients = () => requestJson(OkResponseSchema, {
1113
939
  method: "POST",
1114
940
  path: "/v2/oauth/clients/delete-all"
1115
- }).pipe((effect) => withOperationErrors(effect, RevokeAllOAuthClientsErrorSpec));
941
+ }).pipe(withOperationErrors(RevokeAllOAuthClientsErrorSpec));
1116
942
  const validateToken = (token) => requestJson(ValidateTokenResponseSchema, {
1117
943
  auth: { type: "none" },
1118
944
  method: "GET",
@@ -1126,7 +952,7 @@ const generateTOTP = () => requestJson(GenerateTOTPEnvelopeSchema, {
1126
952
  recovery_codes,
1127
953
  secret,
1128
954
  uri
1129
- })), (effect) => withOperationErrors(effect, GenerateTOTPErrorSpec));
955
+ })), withOperationErrors(GenerateTOTPErrorSpec));
1130
956
  const verifyTOTP = (twoFactorScopedToken, code) => requestJson(VerifyTOTPEnvelopeSchema, {
1131
957
  auth: { type: "none" },
1132
958
  body: {
@@ -1139,15 +965,15 @@ const verifyTOTP = (twoFactorScopedToken, code) => requestJson(VerifyTOTPEnvelop
1139
965
  }).pipe(Effect.map(({ token, user_id }) => ({
1140
966
  token,
1141
967
  user_id
1142
- })), (effect) => withOperationErrors(effect, VerifyTOTPErrorSpec));
968
+ })), withOperationErrors(VerifyTOTPErrorSpec));
1143
969
  const getRecoveryCodes = () => requestJson(RecoveryCodesEnvelopeSchema, {
1144
970
  method: "GET",
1145
971
  path: "/v2/two_factor/recovery_codes"
1146
- }).pipe(Effect.map(({ recovery_codes }) => recovery_codes), (effect) => withOperationErrors(effect, RecoveryCodesErrorSpec));
972
+ }).pipe(selectJsonField("recovery_codes"), withOperationErrors(RecoveryCodesErrorSpec));
1147
973
  const regenerateRecoveryCodes = () => requestJson(RecoveryCodesEnvelopeSchema, {
1148
974
  method: "POST",
1149
975
  path: "/v2/two_factor/recovery_codes/refresh"
1150
- }).pipe(Effect.map(({ recovery_codes }) => recovery_codes), (effect) => withOperationErrors(effect, RegenerateRecoveryCodesErrorSpec));
976
+ }).pipe(selectJsonField("recovery_codes"), withOperationErrors(RegenerateRecoveryCodesErrorSpec));
1151
977
  //#endregion
1152
978
  //#region src/domains/config.ts
1153
979
  const isJsonValue = (value) => {
@@ -1170,14 +996,14 @@ const ConfigValueEnvelopeSchema = Schema.Struct({
1170
996
  const readConfig = () => requestJson(ConfigEnvelopeSchema, {
1171
997
  method: "GET",
1172
998
  path: "/v2/config"
1173
- }).pipe(Effect.map(({ config }) => config));
999
+ }).pipe(selectJsonField("config"));
1174
1000
  const readConfigWith = (schema) => requestJson(Schema.Struct({
1175
1001
  config: schema,
1176
1002
  status: Schema.Literal("OK")
1177
1003
  }), {
1178
1004
  method: "GET",
1179
1005
  path: "/v2/config"
1180
- }).pipe(Effect.map(({ config }) => config));
1006
+ }).pipe(selectJsonField("config"));
1181
1007
  const writeConfig = (config) => requestJson(OkResponseSchema, {
1182
1008
  body: {
1183
1009
  type: "json",
@@ -1189,14 +1015,14 @@ const writeConfig = (config) => requestJson(OkResponseSchema, {
1189
1015
  const getConfigKey = (key) => requestJson(ConfigValueEnvelopeSchema, {
1190
1016
  method: "GET",
1191
1017
  path: `/v2/config/${key}`
1192
- }).pipe(Effect.map(({ value }) => value));
1018
+ }).pipe(selectJsonField("value"));
1193
1019
  const getConfigKeyWith = (key, schema) => requestJson(Schema.Struct({
1194
1020
  status: Schema.Literal("OK"),
1195
1021
  value: schema
1196
1022
  }), {
1197
1023
  method: "GET",
1198
1024
  path: `/v2/config/${key}`
1199
- }).pipe(Effect.map(({ value }) => value));
1025
+ }).pipe(selectJsonField("value"));
1200
1026
  const setConfigKey = (key, value) => requestJson(OkResponseSchema, {
1201
1027
  body: {
1202
1028
  type: "json",
@@ -1290,19 +1116,15 @@ const GetDownloadLinksErrorSpec = definePutioOperationErrorSpec({
1290
1116
  const createDownloadLinks = (input = {}) => requestJson(DownloadLinksCreateEnvelopeSchema, {
1291
1117
  body: {
1292
1118
  type: "form",
1293
- value: {
1294
- cursor: input.cursor,
1295
- exclude_ids: input.excludeIds?.join(","),
1296
- file_ids: input.ids?.join(",")
1297
- }
1119
+ value: toCursorSelectionForm(input)
1298
1120
  },
1299
1121
  method: "POST",
1300
1122
  path: "/v2/download_links/create"
1301
- }).pipe(Effect.map(({ id }) => ({ id })), (effect) => withOperationErrors(effect, CreateDownloadLinksErrorSpec));
1123
+ }).pipe(selectJsonFields("id"), withOperationErrors(CreateDownloadLinksErrorSpec));
1302
1124
  const getDownloadLinks = (id) => requestJson(DownloadLinksInfoSchema, {
1303
1125
  method: "GET",
1304
1126
  path: `/v2/download_links/${id}`
1305
- }).pipe((effect) => withOperationErrors(effect, GetDownloadLinksErrorSpec));
1127
+ }).pipe(withOperationErrors(GetDownloadLinksErrorSpec));
1306
1128
  //#endregion
1307
1129
  //#region src/domains/events.ts
1308
1130
  const HistoryEventBaseSchema = Schema.Struct({
@@ -1430,19 +1252,19 @@ const listEvents = (query = {}) => requestJson(EventsListEnvelopeSchema, {
1430
1252
  method: "GET",
1431
1253
  path: "/v2/events/list",
1432
1254
  query
1433
- }).pipe((effect) => withOperationErrors(effect, ListEventsErrorSpec));
1255
+ }).pipe(withOperationErrors(ListEventsErrorSpec));
1434
1256
  const deleteEvent = (id) => requestJson(OkResponseSchema, {
1435
1257
  method: "POST",
1436
1258
  path: `/v2/events/delete/${id}`
1437
- }).pipe((effect) => withOperationErrors(effect, DeleteEventErrorSpec));
1259
+ }).pipe(withOperationErrors(DeleteEventErrorSpec));
1438
1260
  const clearEvents = () => requestJson(OkResponseSchema, {
1439
1261
  method: "POST",
1440
1262
  path: "/v2/events/delete"
1441
- }).pipe((effect) => withOperationErrors(effect, ClearEventsErrorSpec));
1263
+ }).pipe(withOperationErrors(ClearEventsErrorSpec));
1442
1264
  const getEventTorrent = (id) => requestArrayBuffer({
1443
1265
  method: "GET",
1444
1266
  path: `/v2/events/${id}/torrent`
1445
- }).pipe((effect) => withOperationErrors(effect, GetEventTorrentErrorSpec));
1267
+ }).pipe(withOperationErrors(GetEventTorrentErrorSpec));
1446
1268
  //#endregion
1447
1269
  //#region src/domains/family.ts
1448
1270
  const NonNegativeIntegerSchema = Schema.Number.pipe(Schema.int(), Schema.nonNegative());
@@ -1552,27 +1374,23 @@ const JoinFamilyErrorSpec = definePutioOperationErrorSpec({
1552
1374
  const listFamilyInvites = () => requestJson(FamilyInvitesEnvelopeSchema, {
1553
1375
  method: "GET",
1554
1376
  path: "/v2/family/invites"
1555
- }).pipe(Effect.map(({ invites, limit, remaining_limit }) => ({
1556
- invites,
1557
- limit,
1558
- remaining_limit
1559
- })), (effect) => withOperationErrors(effect, ListFamilyInvitesErrorSpec));
1377
+ }).pipe(selectJsonFields("invites", "limit", "remaining_limit"), withOperationErrors(ListFamilyInvitesErrorSpec));
1560
1378
  const listFamilyMembers = () => requestJson(FamilyMembersEnvelopeSchema, {
1561
1379
  method: "GET",
1562
1380
  path: "/v2/family/members"
1563
- }).pipe(Effect.map(({ members }) => members), (effect) => withOperationErrors(effect, ListFamilyMembersErrorSpec));
1381
+ }).pipe(selectJsonField("members"), withOperationErrors(ListFamilyMembersErrorSpec));
1564
1382
  const createFamilyInvite = () => requestJson(FamilyCreateInviteEnvelopeSchema, {
1565
1383
  method: "POST",
1566
1384
  path: "/v2/family/sub_account"
1567
- }).pipe(Effect.map(({ code }) => ({ code })), (effect) => withOperationErrors(effect, CreateFamilyInviteErrorSpec));
1385
+ }).pipe(selectJsonFields("code"), withOperationErrors(CreateFamilyInviteErrorSpec));
1568
1386
  const removeFamilyMember = (username) => requestJson(OkResponseSchema, {
1569
1387
  method: "DELETE",
1570
1388
  path: `/v2/family/sub_account/${encodeURIComponent(username)}`
1571
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, RemoveFamilyMemberErrorSpec));
1389
+ }).pipe(Effect.asVoid, withOperationErrors(RemoveFamilyMemberErrorSpec));
1572
1390
  const joinFamily = (inviteCode) => requestJson(OkResponseSchema, {
1573
1391
  method: "POST",
1574
1392
  path: `/v2/family/join/${encodeURIComponent(inviteCode)}`
1575
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, JoinFamilyErrorSpec));
1393
+ }).pipe(Effect.asVoid, withOperationErrors(JoinFamilyErrorSpec));
1576
1394
  //#endregion
1577
1395
  //#region src/domains/ifttt.ts
1578
1396
  const IFTTTStatusEnvelopeSchema = Schema.Struct({
@@ -1607,7 +1425,7 @@ const SendIftttEventErrorSpec = definePutioOperationErrorSpec({
1607
1425
  const getIftttStatus = () => requestJson(IFTTTStatusEnvelopeSchema, {
1608
1426
  method: "GET",
1609
1427
  path: "/v2/ifttt-client/status"
1610
- }).pipe(Effect.map(({ enabled }) => ({ enabled })), (effect) => withOperationErrors(effect, GetIftttStatusErrorSpec));
1428
+ }).pipe(selectJsonFields("enabled"), withOperationErrors(GetIftttStatusErrorSpec));
1611
1429
  const sendIftttEvent = (input) => requestJson(OkResponseSchema, {
1612
1430
  body: {
1613
1431
  type: "form",
@@ -1619,7 +1437,7 @@ const sendIftttEvent = (input) => requestJson(OkResponseSchema, {
1619
1437
  },
1620
1438
  method: "POST",
1621
1439
  path: "/v2/ifttt-client/event"
1622
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, SendIftttEventErrorSpec));
1440
+ }).pipe(Effect.asVoid, withOperationErrors(SendIftttEventErrorSpec));
1623
1441
  //#endregion
1624
1442
  //#region src/domains/files.ts
1625
1443
  const RequestedFlag = Schema.Literal(1);
@@ -2083,19 +1901,16 @@ const FileUploadErrorSpec = definePutioOperationErrorSpec({
2083
1901
  ]
2084
1902
  });
2085
1903
  const missingFieldError = (field) => new PutioValidationError({ cause: `Expected put.io to include "${field}" because it was requested` });
1904
+ const failMissingField = (field) => Effect.fail(missingFieldError(field));
1905
+ const widenValidationError = (effect) => effect;
2086
1906
  const normalizeFilesSearchQuery = (query) => {
2087
- const type = query.type === void 0 || typeof query.type === "string" ? query.type : query.type.join(",");
1907
+ const type = query.type === void 0 || typeof query.type === "string" ? query.type : joinCsv(query.type);
2088
1908
  return {
2089
1909
  per_page: query.per_page,
2090
1910
  query: query.query,
2091
1911
  type
2092
1912
  };
2093
1913
  };
2094
- const selectionToForm = (selection, idsFieldName = "file_ids") => ({
2095
- cursor: selection.cursor,
2096
- exclude_ids: selection.excludeIds?.join(","),
2097
- [idsFieldName]: selection.ids?.join(",")
2098
- });
2099
1914
  const hasStreamUrl = (value) => "stream_url" in value;
2100
1915
  const hasMp4StreamUrl = (value) => "mp4_stream_url" in value;
2101
1916
  const hasMp4StreamUrlWhenAvailable = (value) => !value.is_mp4_available || hasMp4StreamUrl(value);
@@ -2105,10 +1920,13 @@ const hasMediaMetadata = (value) => "media_metadata" in value;
2105
1920
  const hasCodecs = (value) => "content_type_and_codecs" in value;
2106
1921
  const hasMediaInfo = (value) => "media_info" in value;
2107
1922
  const useTunnelToQuery = (useTunnel) => useTunnel === false ? { notunnel: 1 } : {};
2108
- const resolveRouteToken = (oauthToken) => Effect.gen(function* () {
2109
- if (oauthToken) return oauthToken;
1923
+ const resolveRouteContext = (oauthToken) => Effect.gen(function* () {
2110
1924
  const config = yield* PutioSdkConfig;
2111
- if (config.accessToken) return config.accessToken;
1925
+ const resolvedOauthToken = oauthToken ?? config.accessToken;
1926
+ if (resolvedOauthToken) return {
1927
+ config,
1928
+ oauthToken: resolvedOauthToken
1929
+ };
2112
1930
  return yield* Effect.fail(mapConfigurationError("This helper requires an oauth token, but neither an override nor PutioSdkConfig.accessToken was provided"));
2113
1931
  });
2114
1932
  const normalizeFileName = (name) => encodeURIComponent(name);
@@ -2140,7 +1958,7 @@ const buildFileHlsStreamUrl = (baseUrl, fileId, options = {}) => buildPutioUrl(b
2140
1958
  max_subtitle_count: options.maxSubtitleCount,
2141
1959
  oauth_token: options.oauthToken,
2142
1960
  original: typeof options.playOriginal === "boolean" ? options.playOriginal ? 1 : 0 : void 0,
2143
- subtitle_languages: options.subtitleLanguages?.join(",")
1961
+ subtitle_languages: joinCsv(options.subtitleLanguages)
2144
1962
  });
2145
1963
  const createFileUploadFormData = (input) => {
2146
1964
  const formData = new FormData();
@@ -2149,17 +1967,17 @@ const createFileUploadFormData = (input) => {
2149
1967
  if (input.parentId !== void 0) formData.append("parent_id", String(input.parentId));
2150
1968
  return formData;
2151
1969
  };
2152
- const ensureFileQueryFields = (effect, query) => {
2153
- let narrowed = effect;
2154
- if (query.stream_url === 1) narrowed = narrowed.pipe(Effect.filterOrFail(hasStreamUrl, () => missingFieldError("stream_url")));
2155
- if (query.mp4_status === 1 || query.mp4_stream_url === 1) narrowed = narrowed.pipe(Effect.filterOrFail(hasMp4StatusFields, () => missingFieldError(query.mp4_stream_url === 1 ? "mp4_size/need_convert" : "mp4_size")));
2156
- if (query.mp4_stream_url === 1) narrowed = narrowed.pipe(Effect.filterOrFail(hasMp4StreamUrlWhenAvailable, () => missingFieldError("mp4_stream_url")));
2157
- if (query.video_metadata === 1 && query.media_metadata !== 1) narrowed = narrowed.pipe(Effect.filterOrFail(hasVideoMetadata, () => missingFieldError("video_metadata")));
2158
- if (query.media_metadata === 1) narrowed = narrowed.pipe(Effect.filterOrFail(hasMediaMetadata, () => missingFieldError("media_metadata")));
2159
- if (query.codecs === 1) narrowed = narrowed.pipe(Effect.filterOrFail(hasCodecs, () => missingFieldError("content_type_and_codecs")));
2160
- if (query.media_info === 1) narrowed = narrowed.pipe(Effect.filterOrFail(hasMediaInfo, () => missingFieldError("media_info")));
2161
- return narrowed;
2162
- };
1970
+ const ensureFileQueryFields = (effect, query) => Effect.gen(function* () {
1971
+ const file = yield* widenValidationError(effect);
1972
+ if (query.stream_url === 1 && !hasStreamUrl(file)) return yield* failMissingField("stream_url");
1973
+ if ((query.mp4_status === 1 || query.mp4_stream_url === 1) && !hasMp4StatusFields(file)) return yield* failMissingField(query.mp4_stream_url === 1 ? "mp4_size/need_convert" : "mp4_size");
1974
+ if (query.mp4_stream_url === 1 && !hasMp4StreamUrlWhenAvailable(file)) return yield* failMissingField("mp4_stream_url");
1975
+ if (query.video_metadata === 1 && query.media_metadata !== 1 && !hasVideoMetadata(file)) return yield* failMissingField("video_metadata");
1976
+ if (query.media_metadata === 1 && !hasMediaMetadata(file)) return yield* failMissingField("media_metadata");
1977
+ if (query.codecs === 1 && !hasCodecs(file)) return yield* failMissingField("content_type_and_codecs");
1978
+ if (query.media_info === 1 && !hasMediaInfo(file)) return yield* failMissingField("media_info");
1979
+ return file;
1980
+ });
2163
1981
  const queryFiles = (parent, query = {}) => requestJson(FilesListEnvelopeSchema, {
2164
1982
  method: "GET",
2165
1983
  path: parent === "friends" ? "/v2/files/list/items-shared-with-you" : "/v2/files/list",
@@ -2167,7 +1985,7 @@ const queryFiles = (parent, query = {}) => requestJson(FilesListEnvelopeSchema,
2167
1985
  ...query,
2168
1986
  parent_id: parent
2169
1987
  }
2170
- }).pipe((effect) => withOperationErrors(effect, QueryFilesErrorSpec));
1988
+ }).pipe(withOperationErrors(QueryFilesErrorSpec));
2171
1989
  const continueFiles = (cursor, query = {}) => requestJson(FilesListContinueEnvelopeSchema, {
2172
1990
  body: {
2173
1991
  type: "form",
@@ -2176,20 +1994,21 @@ const continueFiles = (cursor, query = {}) => requestJson(FilesListContinueEnvel
2176
1994
  method: "POST",
2177
1995
  path: "/v2/files/list/continue",
2178
1996
  query
2179
- }).pipe((effect) => withOperationErrors(effect, ContinueFilesErrorSpec));
1997
+ }).pipe(withOperationErrors(ContinueFilesErrorSpec));
2180
1998
  function getFile(input) {
2181
- const query = input.query ?? {};
2182
- return ensureFileQueryFields(requestJson(FileEnvelopeSchema, {
1999
+ const effect = requestJson(FileEnvelopeSchema, {
2183
2000
  method: "GET",
2184
2001
  path: `/v2/files/${input.id}`,
2185
- query
2186
- }).pipe(Effect.map(({ file }) => file), (requestEffect) => withOperationErrors(requestEffect, GetFileErrorSpec)), query);
2002
+ query: input.query
2003
+ }).pipe(selectJsonField("file"), withOperationErrors(GetFileErrorSpec));
2004
+ if (input.query === void 0) return effect;
2005
+ return ensureFileQueryFields(effect, input.query);
2187
2006
  }
2188
2007
  const searchFiles = (query) => requestJson(FilesSearchEnvelopeSchema, {
2189
2008
  method: "GET",
2190
2009
  path: "/v2/files/search",
2191
2010
  query: normalizeFilesSearchQuery(query)
2192
- }).pipe((effect) => withOperationErrors(effect, SearchFilesErrorSpec));
2011
+ }).pipe(withOperationErrors(SearchFilesErrorSpec));
2193
2012
  const continueSearch = (cursor, query = {}) => requestJson(FilesSearchEnvelopeSchema, {
2194
2013
  body: {
2195
2014
  type: "form",
@@ -2198,7 +2017,7 @@ const continueSearch = (cursor, query = {}) => requestJson(FilesSearchEnvelopeSc
2198
2017
  method: "POST",
2199
2018
  path: "/v2/files/search/continue",
2200
2019
  query
2201
- }).pipe((effect) => withOperationErrors(effect, SearchFilesErrorSpec));
2020
+ }).pipe(withOperationErrors(SearchFilesErrorSpec));
2202
2021
  const createFolder = (input) => requestJson(FileEnvelopeSchema, {
2203
2022
  body: {
2204
2023
  type: "form",
@@ -2206,7 +2025,7 @@ const createFolder = (input) => requestJson(FileEnvelopeSchema, {
2206
2025
  },
2207
2026
  method: "POST",
2208
2027
  path: "/v2/files/create-folder"
2209
- }).pipe(Effect.map(({ file }) => file), (effect) => withOperationErrors(effect, CreateFolderErrorSpec));
2028
+ }).pipe(selectJsonField("file"), withOperationErrors(CreateFolderErrorSpec));
2210
2029
  const renameFile = (input) => requestJson(OkResponseSchema, {
2211
2030
  body: {
2212
2031
  type: "form",
@@ -2214,11 +2033,11 @@ const renameFile = (input) => requestJson(OkResponseSchema, {
2214
2033
  },
2215
2034
  method: "POST",
2216
2035
  path: "/v2/files/rename"
2217
- }).pipe((effect) => withOperationErrors(effect, RenameFileErrorSpec));
2036
+ }).pipe(withOperationErrors(RenameFileErrorSpec));
2218
2037
  const deleteFiles = (ids, options = {}) => requestJson(FileDeleteResultEnvelopeSchema, {
2219
2038
  body: {
2220
2039
  type: "form",
2221
- value: { file_ids: ids.join(",") }
2040
+ value: { file_ids: joinCsv(ids) }
2222
2041
  },
2223
2042
  method: "POST",
2224
2043
  path: "/v2/files/delete",
@@ -2232,7 +2051,7 @@ const deleteFiles = (ids, options = {}) => requestJson(FileDeleteResultEnvelopeS
2232
2051
  const deleteFileSelection = (selection, options = {}) => requestJson(FileDeleteResultEnvelopeSchema, {
2233
2052
  body: {
2234
2053
  type: "form",
2235
- value: selectionToForm(selection)
2054
+ value: toCursorSelectionForm(selection)
2236
2055
  },
2237
2056
  method: "POST",
2238
2057
  path: "/v2/files/delete",
@@ -2246,53 +2065,53 @@ const moveFiles = (ids, parentId) => requestJson(FilesMoveEnvelopeSchema, {
2246
2065
  body: {
2247
2066
  type: "form",
2248
2067
  value: {
2249
- file_ids: ids.join(","),
2068
+ file_ids: joinCsv(ids),
2250
2069
  parent_id: parentId
2251
2070
  }
2252
2071
  },
2253
2072
  method: "POST",
2254
2073
  path: "/v2/files/move"
2255
- }).pipe(Effect.map(({ errors }) => errors));
2074
+ }).pipe(selectJsonField("errors"));
2256
2075
  const moveFileSelection = (selection, parentId) => requestJson(FilesMoveEnvelopeSchema, {
2257
2076
  body: {
2258
2077
  type: "form",
2259
2078
  value: {
2260
- ...selectionToForm(selection),
2079
+ ...toCursorSelectionForm(selection),
2261
2080
  parent_id: parentId
2262
2081
  }
2263
2082
  },
2264
2083
  method: "POST",
2265
2084
  path: "/v2/files/move"
2266
- }).pipe(Effect.map(({ errors }) => errors));
2085
+ }).pipe(selectJsonField("errors"));
2267
2086
  const getStartFrom = (fileId) => requestJson(FileStartFromEnvelopeSchema, {
2268
2087
  method: "GET",
2269
2088
  path: `/v2/files/${fileId}/start-from`
2270
- }).pipe(Effect.map(({ start_from }) => start_from), (effect) => withOperationErrors(effect, StartFromErrorSpec));
2089
+ }).pipe(selectJsonField("start_from"), withOperationErrors(StartFromErrorSpec));
2271
2090
  const getDownloadUrl = (fileId) => requestJson(FileDownloadUrlEnvelopeSchema, {
2272
2091
  method: "GET",
2273
2092
  path: `/v2/files/${fileId}/url`
2274
- }).pipe(Effect.map(({ url }) => url), (effect) => withOperationErrors(effect, DownloadUrlErrorSpec));
2275
- const getApiDownloadUrl = (fileId, options = {}) => resolveRouteToken(options.oauthToken).pipe(Effect.flatMap((oauthToken) => Effect.map(PutioSdkConfig, (config) => buildFileApiDownloadUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2093
+ }).pipe(selectJsonField("url"), withOperationErrors(DownloadUrlErrorSpec));
2094
+ const getApiDownloadUrl = (fileId, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileApiDownloadUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2276
2095
  ...options,
2277
2096
  oauthToken
2278
- }))));
2279
- const getApiContentUrl = (fileId, options = {}) => resolveRouteToken(options.oauthToken).pipe(Effect.flatMap((oauthToken) => Effect.map(PutioSdkConfig, (config) => buildFileApiContentUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2097
+ })));
2098
+ const getApiContentUrl = (fileId, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileApiContentUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2280
2099
  ...options,
2281
2100
  oauthToken
2282
- }))));
2283
- const getApiMp4DownloadUrl = (fileId, options = {}) => resolveRouteToken(options.oauthToken).pipe(Effect.flatMap((oauthToken) => Effect.map(PutioSdkConfig, (config) => buildFileApiMp4DownloadUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2101
+ })));
2102
+ const getApiMp4DownloadUrl = (fileId, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileApiMp4DownloadUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2284
2103
  ...options,
2285
2104
  oauthToken
2286
- }))));
2287
- const getHlsStreamUrl = (fileId, options = {}) => resolveRouteToken(options.oauthToken).pipe(Effect.flatMap((oauthToken) => Effect.map(PutioSdkConfig, (config) => buildFileHlsStreamUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2105
+ })));
2106
+ const getHlsStreamUrl = (fileId, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileHlsStreamUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2288
2107
  ...options,
2289
2108
  oauthToken
2290
- }))));
2109
+ })));
2291
2110
  const listFileSubtitles = (fileId, options = {}) => requestJson(FileSubtitlesEnvelopeSchema, {
2292
2111
  method: "GET",
2293
2112
  path: `/v2/files/${fileId}/subtitles`,
2294
- query: options.languages ? { languages: options.languages.join(",") } : void 0
2295
- }).pipe((effect) => withOperationErrors(effect, FileSubtitlesErrorSpec));
2113
+ query: options.languages ? { languages: joinCsv(options.languages) } : void 0
2114
+ }).pipe(withOperationErrors(FileSubtitlesErrorSpec));
2296
2115
  const setStartFrom = (input) => requestJson(OkResponseSchema, {
2297
2116
  body: {
2298
2117
  type: "form",
@@ -2300,73 +2119,73 @@ const setStartFrom = (input) => requestJson(OkResponseSchema, {
2300
2119
  },
2301
2120
  method: "POST",
2302
2121
  path: `/v2/files/${input.file_id}/start-from/set`
2303
- }).pipe((effect) => withOperationErrors(effect, StartFromErrorSpec));
2122
+ }).pipe(withOperationErrors(StartFromErrorSpec));
2304
2123
  const resetStartFrom = (fileId) => requestJson(OkResponseSchema, {
2305
2124
  method: "GET",
2306
2125
  path: `/v2/files/${fileId}/start-from/delete`
2307
- }).pipe((effect) => withOperationErrors(effect, StartFromErrorSpec));
2126
+ }).pipe(withOperationErrors(StartFromErrorSpec));
2308
2127
  const getMp4Status = (fileId) => requestJson(FileConversionStatusEnvelopeSchema, {
2309
2128
  method: "GET",
2310
2129
  path: `/v2/files/${fileId}/mp4`
2311
- }).pipe(Effect.map(({ mp4 }) => mp4), (effect) => withOperationErrors(effect, FileMp4ErrorSpec));
2130
+ }).pipe(selectJsonField("mp4"), withOperationErrors(FileMp4ErrorSpec));
2312
2131
  const convertFileToMp4 = (fileId) => requestJson(FileConversionStatusEnvelopeSchema, {
2313
2132
  method: "POST",
2314
2133
  path: `/v2/files/${fileId}/mp4`
2315
- }).pipe(Effect.map(({ mp4 }) => mp4), (effect) => withOperationErrors(effect, FileMp4ErrorSpec));
2134
+ }).pipe(selectJsonField("mp4"), withOperationErrors(FileMp4ErrorSpec));
2316
2135
  const deleteFileMp4 = (fileId) => requestVoid({
2317
2136
  method: "DELETE",
2318
2137
  path: `/v2/files/${fileId}/mp4`
2319
- }).pipe((effect) => withOperationErrors(effect, FileMp4MutationErrorSpec));
2138
+ }).pipe(withOperationErrors(FileMp4MutationErrorSpec));
2320
2139
  const putMp4ToMyFiles = (fileId) => requestVoid({
2321
2140
  method: "GET",
2322
2141
  path: `/v2/files/${fileId}/put-mp4-to-my-folders`
2323
- }).pipe((effect) => withOperationErrors(effect, FileMp4MutationErrorSpec));
2142
+ }).pipe(withOperationErrors(FileMp4MutationErrorSpec));
2324
2143
  const convertFilesToMp4 = (ids) => requestJson(FilesBulkConvertEnvelopeSchema, {
2325
2144
  body: {
2326
2145
  type: "form",
2327
- value: { file_ids: ids.join(",") }
2146
+ value: { file_ids: joinCsv(ids) }
2328
2147
  },
2329
2148
  method: "POST",
2330
2149
  path: "/v2/files/convert_mp4"
2331
- }).pipe(Effect.map(({ count }) => count));
2150
+ }).pipe(selectJsonField("count"));
2332
2151
  const convertFileSelectionToMp4 = (selection) => requestJson(FilesBulkConvertEnvelopeSchema, {
2333
2152
  body: {
2334
2153
  type: "form",
2335
- value: selectionToForm(selection)
2154
+ value: toCursorSelectionForm(selection)
2336
2155
  },
2337
2156
  method: "POST",
2338
2157
  path: "/v2/files/convert_mp4"
2339
- }).pipe(Effect.map(({ count }) => count));
2158
+ }).pipe(selectJsonField("count"));
2340
2159
  const listActiveMp4Conversions = () => requestJson(FileActiveConversionsEnvelopeSchema, {
2341
2160
  method: "GET",
2342
2161
  path: "/v2/mp4/queue"
2343
- }).pipe(Effect.map(({ mp4s }) => mp4s), (effect) => withOperationErrors(effect, FileActiveConversionsErrorSpec));
2162
+ }).pipe(selectJsonField("mp4s"), withOperationErrors(FileActiveConversionsErrorSpec));
2344
2163
  const setFilesWatchStatus = (selection) => requestVoid({
2345
2164
  body: {
2346
2165
  type: "form",
2347
2166
  value: {
2348
- ...selectionToForm(selection),
2167
+ ...toCursorSelectionForm(selection),
2349
2168
  watched: selection.watched
2350
2169
  }
2351
2170
  },
2352
2171
  method: "POST",
2353
2172
  path: "/v2/files/watch-status"
2354
- }).pipe((effect) => withOperationErrors(effect, FileWatchStatusErrorSpec));
2173
+ }).pipe(withOperationErrors(FileWatchStatusErrorSpec));
2355
2174
  const extractFiles = (selection) => requestJson(FileExtractionsEnvelopeSchema, {
2356
2175
  body: {
2357
2176
  type: "form",
2358
2177
  value: {
2359
- ...selectionToForm(selection, "user_file_ids"),
2178
+ ...toCursorSelectionForm(selection, "user_file_ids"),
2360
2179
  password: selection.password
2361
2180
  }
2362
2181
  },
2363
2182
  method: "POST",
2364
2183
  path: "/v2/files/extract"
2365
- }).pipe(Effect.map(({ extractions }) => extractions), (effect) => withOperationErrors(effect, FileExtractionsErrorSpec));
2184
+ }).pipe(selectJsonField("extractions"), withOperationErrors(FileExtractionsErrorSpec));
2366
2185
  const listFileExtractions = () => requestJson(FileExtractionsEnvelopeSchema, {
2367
2186
  method: "GET",
2368
2187
  path: "/v2/files/extract"
2369
- }).pipe(Effect.map(({ extractions }) => extractions), (effect) => withOperationErrors(effect, FileExtractionsErrorSpec));
2188
+ }).pipe(selectJsonField("extractions"), withOperationErrors(FileExtractionsErrorSpec));
2370
2189
  const deleteFileExtraction = (extractionId) => requestVoid({
2371
2190
  method: "DELETE",
2372
2191
  path: `/v2/files/extract/${extractionId}`
@@ -2375,22 +2194,19 @@ const findNextFile = (fileId, fileType) => requestJson(FilesNextFileEnvelopeSche
2375
2194
  method: "GET",
2376
2195
  path: `/v2/files/${fileId}/next-file`,
2377
2196
  query: { file_type: fileType }
2378
- }).pipe(Effect.map(({ next_file }) => next_file));
2197
+ }).pipe(selectJsonField("next_file"));
2379
2198
  const findNextVideo = (fileId) => requestJson(FilesNextVideoEnvelopeSchema, {
2380
2199
  method: "GET",
2381
2200
  path: `/v2/files/${fileId}/next-video`
2382
- }).pipe(Effect.map(({ next_video }) => next_video));
2383
- const createFileUploadRequest = (input, options = {}) => resolveRouteToken(options.oauthToken).pipe(Effect.flatMap((oauthToken) => Effect.map(PutioSdkConfig, (config) => ({
2201
+ }).pipe(selectJsonField("next_video"));
2202
+ const createFileUploadRequest = (input, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => ({
2384
2203
  body: createFileUploadFormData(input),
2385
2204
  method: "POST",
2386
2205
  url: buildPutioUrl(config.uploadBaseUrl ?? "https://upload.put.io", "/v2/files/upload", { oauth_token: oauthToken })
2387
- }))));
2388
- const uploadFile = (input, options = {}) => resolveRouteToken(options.oauthToken).pipe(Effect.flatMap((oauthToken) => Effect.map(PutioSdkConfig, (config) => ({
2389
- oauthToken,
2390
- uploadBaseUrl: config.uploadBaseUrl ?? "https://upload.put.io"
2391
- }))), Effect.flatMap(({ oauthToken, uploadBaseUrl }) => requestJson(FileUploadEnvelopeSchema, {
2206
+ })));
2207
+ const uploadFile = (input, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.flatMap(({ config, oauthToken }) => requestJson(FileUploadEnvelopeSchema, {
2392
2208
  auth: { type: "none" },
2393
- baseUrl: uploadBaseUrl,
2209
+ baseUrl: config.uploadBaseUrl ?? "https://upload.put.io",
2394
2210
  body: {
2395
2211
  type: "form-data",
2396
2212
  value: createFileUploadFormData(input)
@@ -2398,7 +2214,7 @@ const uploadFile = (input, options = {}) => resolveRouteToken(options.oauthToken
2398
2214
  method: "POST",
2399
2215
  path: "/v2/files/upload",
2400
2216
  query: { oauth_token: oauthToken }
2401
- })), Effect.map(toUploadResult), (effect) => withOperationErrors(effect, FileUploadErrorSpec));
2217
+ })), Effect.map(toUploadResult), withOperationErrors(FileUploadErrorSpec));
2402
2218
  //#endregion
2403
2219
  //#region src/domains/friend-invites.ts
2404
2220
  const FriendInviteJoinedUserStatusSchema = Schema.Literal("CONVERTED", "IN_TRIAL", "TRIAL_ENDED", "TRIAL_NOT_STARTED", "UNKNOWN");
@@ -2453,14 +2269,11 @@ const CreateFriendInviteErrorSpec = definePutioOperationErrorSpec({
2453
2269
  const listFriendInvites = () => requestJson(FriendInvitesListEnvelopeSchema, {
2454
2270
  method: "GET",
2455
2271
  path: "/v2/account/friend_invites"
2456
- }).pipe(Effect.map(({ invites, remaining_limit }) => ({
2457
- invites,
2458
- remaining_limit
2459
- })), (effect) => withOperationErrors(effect, ListFriendInvitesErrorSpec));
2272
+ }).pipe(selectJsonFields("invites", "remaining_limit"), withOperationErrors(ListFriendInvitesErrorSpec));
2460
2273
  const createFriendInvite = () => requestJson(FriendInviteCreateEnvelopeSchema, {
2461
2274
  method: "POST",
2462
2275
  path: "/v2/account/create_friend_invitation"
2463
- }).pipe(Effect.map(({ code }) => ({ code })), (effect) => withOperationErrors(effect, CreateFriendInviteErrorSpec));
2276
+ }).pipe(selectJsonFields("code"), withOperationErrors(CreateFriendInviteErrorSpec));
2464
2277
  //#endregion
2465
2278
  //#region src/domains/friends.ts
2466
2279
  const FriendBaseSchema = Schema.Struct({
@@ -2612,46 +2425,43 @@ const FriendSharedFolderErrorSpec = definePutioOperationErrorSpec({
2612
2425
  const listFriends = () => requestJson(FriendsListEnvelopeSchema, {
2613
2426
  method: "GET",
2614
2427
  path: "/v2/friends/list"
2615
- }).pipe(Effect.map(({ friends, total }) => ({
2616
- friends,
2617
- total
2618
- })), (effect) => withOperationErrors(effect, ListFriendsErrorSpec));
2428
+ }).pipe(selectJsonFields("friends", "total"), withOperationErrors(ListFriendsErrorSpec));
2619
2429
  const searchFriends = (username) => requestJson(FriendSearchEnvelopeSchema, {
2620
2430
  method: "GET",
2621
2431
  path: `/v2/friends/user-search/${encodeURIComponent(username)}`
2622
- }).pipe(Effect.map(({ users }) => users), (effect) => withOperationErrors(effect, SearchFriendsErrorSpec));
2432
+ }).pipe(selectJsonField("users"), withOperationErrors(SearchFriendsErrorSpec));
2623
2433
  const listWaitingRequests = () => requestJson(FriendRequestsEnvelopeSchema, {
2624
2434
  method: "GET",
2625
2435
  path: "/v2/friends/waiting-requests"
2626
- }).pipe(Effect.map(({ friends }) => friends), (effect) => withOperationErrors(effect, ListWaitingRequestsErrorSpec));
2436
+ }).pipe(selectJsonField("friends"), withOperationErrors(ListWaitingRequestsErrorSpec));
2627
2437
  const countWaitingRequests = () => requestJson(FriendRequestsCountEnvelopeSchema, {
2628
2438
  method: "GET",
2629
2439
  path: "/v2/friends/waiting-requests-count"
2630
- }).pipe(Effect.map(({ count }) => count), (effect) => withOperationErrors(effect, CountWaitingRequestsErrorSpec));
2440
+ }).pipe(selectJsonField("count"), withOperationErrors(CountWaitingRequestsErrorSpec));
2631
2441
  const listSentRequests = () => requestJson(FriendRequestsEnvelopeSchema, {
2632
2442
  method: "GET",
2633
2443
  path: "/v2/friends/sent-requests"
2634
- }).pipe(Effect.map(({ friends }) => friends), (effect) => withOperationErrors(effect, ListSentRequestsErrorSpec));
2444
+ }).pipe(selectJsonField("friends"), withOperationErrors(ListSentRequestsErrorSpec));
2635
2445
  const sendFriendRequest = (username) => requestJson(OkResponseSchema, {
2636
2446
  method: "POST",
2637
2447
  path: `/v2/friends/${encodeURIComponent(username)}/request`
2638
- }).pipe((effect) => withOperationErrors(effect, SendFriendRequestErrorSpec));
2448
+ }).pipe(withOperationErrors(SendFriendRequestErrorSpec));
2639
2449
  const removeFriend = (username) => requestJson(OkResponseSchema, {
2640
2450
  method: "POST",
2641
2451
  path: `/v2/friends/${encodeURIComponent(username)}/unfriend`
2642
- }).pipe((effect) => withOperationErrors(effect, RemoveFriendErrorSpec));
2452
+ }).pipe(withOperationErrors(RemoveFriendErrorSpec));
2643
2453
  const approveFriendRequest = (username) => requestJson(OkResponseSchema, {
2644
2454
  method: "POST",
2645
2455
  path: `/v2/friends/${encodeURIComponent(username)}/approve`
2646
- }).pipe((effect) => withOperationErrors(effect, ApproveFriendRequestErrorSpec));
2456
+ }).pipe(withOperationErrors(ApproveFriendRequestErrorSpec));
2647
2457
  const denyFriendRequest = (username) => requestJson(OkResponseSchema, {
2648
2458
  method: "POST",
2649
2459
  path: `/v2/friends/${encodeURIComponent(username)}/deny`
2650
- }).pipe((effect) => withOperationErrors(effect, DenyFriendRequestErrorSpec));
2460
+ }).pipe(withOperationErrors(DenyFriendRequestErrorSpec));
2651
2461
  const getFriendSharedFolder = (username) => requestJson(FriendSharedFolderEnvelopeSchema, {
2652
2462
  method: "GET",
2653
2463
  path: `/v2/friends/${encodeURIComponent(username)}/files`
2654
- }).pipe(Effect.map(({ file }) => file), (effect) => withOperationErrors(effect, FriendSharedFolderErrorSpec));
2464
+ }).pipe(selectJsonField("file"), withOperationErrors(FriendSharedFolderErrorSpec));
2655
2465
  //#endregion
2656
2466
  //#region src/domains/payment.ts
2657
2467
  const PaymentPlanTypeSchema = Schema.Literal("onetime", "subscription");
@@ -3172,25 +2982,25 @@ const classifyPaymentChangePlanResponse = (response) => {
3172
2982
  const getPaymentInfo = () => requestJson(PaymentInfoSchema, {
3173
2983
  method: "GET",
3174
2984
  path: "/v2/payment/info"
3175
- }).pipe((effect) => withOperationErrors(effect, GetPaymentInfoErrorSpec));
2985
+ }).pipe(withOperationErrors(GetPaymentInfoErrorSpec));
3176
2986
  const listPaymentPlans = () => requestJson(PaymentPlansEnvelopeSchema, {
3177
2987
  method: "GET",
3178
2988
  path: "/v2/payment/plans"
3179
- }).pipe(Effect.map(({ plans }) => plans), (effect) => withOperationErrors(effect, ListPaymentPlansErrorSpec));
2989
+ }).pipe(selectJsonField("plans"), withOperationErrors(ListPaymentPlansErrorSpec));
3180
2990
  const listPaymentOptions = () => requestJson(PaymentOptionsEnvelopeSchema, {
3181
2991
  auth: { type: "none" },
3182
2992
  method: "GET",
3183
2993
  path: "/v2/payment/options"
3184
- }).pipe(Effect.map(({ options }) => options), (effect) => withOperationErrors(effect, ListPaymentOptionsErrorSpec));
2994
+ }).pipe(selectJsonField("options"), withOperationErrors(ListPaymentOptionsErrorSpec));
3185
2995
  const listPaymentHistory = (query) => requestJson(PaymentHistoryEnvelopeSchema, {
3186
2996
  method: "GET",
3187
2997
  path: "/v2/payment/history",
3188
2998
  query
3189
- }).pipe(Effect.map(({ payments }) => payments), (effect) => withOperationErrors(effect, ListPaymentHistoryErrorSpec));
2999
+ }).pipe(selectJsonField("payments"), withOperationErrors(ListPaymentHistoryErrorSpec));
3190
3000
  const listPaymentInvites = () => requestJson(PaymentInvitesEnvelopeSchema, {
3191
3001
  method: "GET",
3192
3002
  path: "/v2/payment/invites"
3193
- }).pipe(Effect.map(({ vouchers }) => vouchers), (effect) => withOperationErrors(effect, ListPaymentInvitesErrorSpec));
3003
+ }).pipe(selectJsonField("vouchers"), withOperationErrors(ListPaymentInvitesErrorSpec));
3194
3004
  const previewPaymentChangePlan = (input) => requestJson(PaymentChangePlanPreviewSchema, {
3195
3005
  method: "GET",
3196
3006
  path: `/v2/payment/change_plan/${encodeURIComponent(input.plan_path)}`,
@@ -3198,7 +3008,7 @@ const previewPaymentChangePlan = (input) => requestJson(PaymentChangePlanPreview
3198
3008
  coupon_code: input.coupon_code,
3199
3009
  payment_type: input.payment_type
3200
3010
  }
3201
- }).pipe((effect) => withOperationErrors(effect, PreviewPaymentChangePlanErrorSpec));
3011
+ }).pipe(withOperationErrors(PreviewPaymentChangePlanErrorSpec));
3202
3012
  const submitPaymentChangePlan = (input) => requestJson(PaymentChangePlanSubmitSchema, {
3203
3013
  body: {
3204
3014
  type: "form",
@@ -3210,31 +3020,31 @@ const submitPaymentChangePlan = (input) => requestJson(PaymentChangePlanSubmitSc
3210
3020
  method: "POST",
3211
3021
  path: `/v2/payment/change_plan/${encodeURIComponent(input.plan_path)}`,
3212
3022
  query: { coupon_code: input.coupon_code }
3213
- }).pipe((effect) => withOperationErrors(effect, SubmitPaymentChangePlanErrorSpec));
3023
+ }).pipe(withOperationErrors(SubmitPaymentChangePlanErrorSpec));
3214
3024
  const confirmFastspringOrder = (reference) => requestJson(PaymentFastspringConfirmEnvelopeSchema, {
3215
3025
  method: "GET",
3216
3026
  path: `/v2/payment/fs-confirm/${encodeURIComponent(reference)}`
3217
- }).pipe(Effect.map(({ confirmed }) => confirmed), (effect) => withOperationErrors(effect, ConfirmFastspringOrderErrorSpec));
3027
+ }).pipe(selectJsonField("confirmed"), withOperationErrors(ConfirmFastspringOrderErrorSpec));
3218
3028
  const stopPaymentSubscription = () => requestJson(OkResponseSchema, {
3219
3029
  method: "POST",
3220
3030
  path: "/v2/payment/stop_subscription"
3221
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, StopSubscriptionErrorSpec));
3031
+ }).pipe(Effect.asVoid, withOperationErrors(StopSubscriptionErrorSpec));
3222
3032
  const getPaymentVoucherInfo = (code) => requestJson(PaymentVoucherInfoSchema, {
3223
3033
  method: "GET",
3224
3034
  path: `/v2/payment/redeem_voucher/${encodeURIComponent(code)}`
3225
- }).pipe((effect) => withOperationErrors(effect, GetPaymentVoucherInfoErrorSpec));
3035
+ }).pipe(withOperationErrors(GetPaymentVoucherInfoErrorSpec));
3226
3036
  const redeemPaymentVoucher = (code) => requestJson(OkResponseSchema, {
3227
3037
  method: "POST",
3228
3038
  path: `/v2/payment/redeem_voucher/${encodeURIComponent(code)}`
3229
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, RedeemPaymentVoucherErrorSpec));
3039
+ }).pipe(Effect.asVoid, withOperationErrors(RedeemPaymentVoucherErrorSpec));
3230
3040
  const reportPayments = (paymentIds) => requestJson(OkResponseSchema, {
3231
3041
  body: {
3232
3042
  type: "form",
3233
- value: { payment_ids: paymentIds.join(",") }
3043
+ value: { payment_ids: joinCsv(paymentIds) }
3234
3044
  },
3235
3045
  method: "POST",
3236
3046
  path: "/v2/payment/report"
3237
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, ReportPaymentsErrorSpec));
3047
+ }).pipe(Effect.asVoid, withOperationErrors(ReportPaymentsErrorSpec));
3238
3048
  const createPaddleWaitingPayment = (input) => requestJson(OkResponseSchema, {
3239
3049
  body: {
3240
3050
  type: "form",
@@ -3242,7 +3052,7 @@ const createPaddleWaitingPayment = (input) => requestJson(OkResponseSchema, {
3242
3052
  },
3243
3053
  method: "POST",
3244
3054
  path: "/v2/payment/paddle_waiting_payment"
3245
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, CreatePaddleWaitingPaymentErrorSpec));
3055
+ }).pipe(Effect.asVoid, withOperationErrors(CreatePaddleWaitingPaymentErrorSpec));
3246
3056
  const createCoinbaseCharge = (planPath) => requestJson(PaymentCoinbaseChargeEnvelopeSchema, {
3247
3057
  body: {
3248
3058
  type: "form",
@@ -3250,7 +3060,7 @@ const createCoinbaseCharge = (planPath) => requestJson(PaymentCoinbaseChargeEnve
3250
3060
  },
3251
3061
  method: "POST",
3252
3062
  path: "/v2/payment/methods/coinbase/charge"
3253
- }).pipe(Effect.map(({ coinbase }) => coinbase.code), (effect) => withOperationErrors(effect, CreateCoinbaseChargeErrorSpec));
3063
+ }).pipe(selectJsonField("coinbase"), Effect.map(({ code }) => code), withOperationErrors(CreateCoinbaseChargeErrorSpec));
3254
3064
  const createOpenNodeCharge = (planPath) => requestJson(PaymentOpenNodeChargeEnvelopeSchema, {
3255
3065
  body: {
3256
3066
  type: "form",
@@ -3258,7 +3068,7 @@ const createOpenNodeCharge = (planPath) => requestJson(PaymentOpenNodeChargeEnve
3258
3068
  },
3259
3069
  method: "POST",
3260
3070
  path: "/v2/payment/methods/opennode/charge"
3261
- }).pipe(Effect.map(({ opennode }) => opennode.checkout_url), (effect) => withOperationErrors(effect, CreateOpenNodeChargeErrorSpec));
3071
+ }).pipe(selectJsonField("opennode"), Effect.map(({ checkout_url }) => checkout_url), withOperationErrors(CreateOpenNodeChargeErrorSpec));
3262
3072
  const createNanoPaymentRequest = (planCode) => requestJson(PaymentNanoRequestEnvelopeSchema, {
3263
3073
  body: {
3264
3074
  type: "form",
@@ -3266,7 +3076,7 @@ const createNanoPaymentRequest = (planCode) => requestJson(PaymentNanoRequestEnv
3266
3076
  },
3267
3077
  method: "POST",
3268
3078
  path: "/v2/payment/methods/nano/request"
3269
- }).pipe(Effect.map(({ nano }) => nano.token), (effect) => withOperationErrors(effect, CreateNanoPaymentRequestErrorSpec));
3079
+ }).pipe(selectJsonField("nano"), Effect.map(({ token }) => token), withOperationErrors(CreateNanoPaymentRequestErrorSpec));
3270
3080
  //#endregion
3271
3081
  //#region src/domains/rss.ts
3272
3082
  const RssFeedSchema = Schema.Struct({
@@ -3545,11 +3355,11 @@ const toUpdateBody = (params) => ({
3545
3355
  const listRssFeeds = () => requestJson(RssFeedsEnvelopeSchema, {
3546
3356
  method: "GET",
3547
3357
  path: "/v2/rss/list"
3548
- }).pipe(Effect.map(({ feeds }) => feeds), (effect) => withOperationErrors(effect, ListRssFeedsErrorSpec));
3358
+ }).pipe(selectJsonField("feeds"), withOperationErrors(ListRssFeedsErrorSpec));
3549
3359
  const getRssFeed = (id) => requestJson(RssFeedEnvelopeSchema, {
3550
3360
  method: "GET",
3551
3361
  path: `/v2/rss/${id}`
3552
- }).pipe(Effect.map(({ feed }) => feed), (effect) => withOperationErrors(effect, GetRssFeedErrorSpec));
3362
+ }).pipe(selectJsonField("feed"), withOperationErrors(GetRssFeedErrorSpec));
3553
3363
  const createRssFeed = (params) => requestJson(RssFeedEnvelopeSchema, {
3554
3364
  body: {
3555
3365
  type: "form",
@@ -3557,7 +3367,7 @@ const createRssFeed = (params) => requestJson(RssFeedEnvelopeSchema, {
3557
3367
  },
3558
3368
  method: "POST",
3559
3369
  path: "/v2/rss/create"
3560
- }).pipe(Effect.map(({ feed }) => feed), (effect) => withOperationErrors(effect, CreateRssFeedErrorSpec));
3370
+ }).pipe(selectJsonField("feed"), withOperationErrors(CreateRssFeedErrorSpec));
3561
3371
  const updateRssFeed = (id, params) => requestJson(OkResponseSchema, {
3562
3372
  body: {
3563
3373
  type: "form",
@@ -3565,38 +3375,35 @@ const updateRssFeed = (id, params) => requestJson(OkResponseSchema, {
3565
3375
  },
3566
3376
  method: "POST",
3567
3377
  path: `/v2/rss/${id}`
3568
- }).pipe((effect) => withOperationErrors(effect, UpdateRssFeedErrorSpec));
3378
+ }).pipe(withOperationErrors(UpdateRssFeedErrorSpec));
3569
3379
  const pauseRssFeed = (id) => requestJson(OkResponseSchema, {
3570
3380
  method: "POST",
3571
3381
  path: `/v2/rss/${id}/pause`
3572
- }).pipe((effect) => withOperationErrors(effect, PauseRssFeedErrorSpec));
3382
+ }).pipe(withOperationErrors(PauseRssFeedErrorSpec));
3573
3383
  const resumeRssFeed = (id) => requestJson(OkResponseSchema, {
3574
3384
  method: "POST",
3575
3385
  path: `/v2/rss/${id}/resume`
3576
- }).pipe((effect) => withOperationErrors(effect, ResumeRssFeedErrorSpec));
3386
+ }).pipe(withOperationErrors(ResumeRssFeedErrorSpec));
3577
3387
  const deleteRssFeed = (id) => requestJson(OkResponseSchema, {
3578
3388
  method: "POST",
3579
3389
  path: `/v2/rss/${id}/delete`
3580
- }).pipe((effect) => withOperationErrors(effect, DeleteRssFeedErrorSpec));
3390
+ }).pipe(withOperationErrors(DeleteRssFeedErrorSpec));
3581
3391
  const listRssFeedItems = (id) => requestJson(RssFeedItemsEnvelopeSchema, {
3582
3392
  method: "GET",
3583
3393
  path: `/v2/rss/${id}/items`
3584
- }).pipe(Effect.map(({ feed, items }) => ({
3585
- feed,
3586
- items
3587
- })), (effect) => withOperationErrors(effect, ListRssFeedItemsErrorSpec));
3394
+ }).pipe(selectJsonFields("feed", "items"), withOperationErrors(ListRssFeedItemsErrorSpec));
3588
3395
  const clearRssFeedLogs = (id) => requestJson(OkResponseSchema, {
3589
3396
  method: "POST",
3590
3397
  path: `/v2/rss/${id}/clear-log`
3591
- }).pipe((effect) => withOperationErrors(effect, ClearRssFeedLogsErrorSpec));
3398
+ }).pipe(withOperationErrors(ClearRssFeedLogsErrorSpec));
3592
3399
  const retryRssFeedItem = (feedId, itemId) => requestJson(OkResponseSchema, {
3593
3400
  method: "POST",
3594
3401
  path: `/v2/rss/${feedId}/items/${itemId}/retry`
3595
- }).pipe((effect) => withOperationErrors(effect, RetryRssFeedItemErrorSpec));
3402
+ }).pipe(withOperationErrors(RetryRssFeedItemErrorSpec));
3596
3403
  const retryAllRssFeedItems = (feedId) => requestJson(OkResponseSchema, {
3597
3404
  method: "POST",
3598
3405
  path: `/v2/rss/${feedId}/retry-all`
3599
- }).pipe((effect) => withOperationErrors(effect, RetryAllRssFeedItemsErrorSpec));
3406
+ }).pipe(withOperationErrors(RetryAllRssFeedItemsErrorSpec));
3600
3407
  //#endregion
3601
3408
  //#region src/domains/sharing.ts
3602
3409
  const SharingCloneStatusSchema = Schema.Literal("NEW", "PROCESSING", "DONE", "ERROR");
@@ -3898,75 +3705,70 @@ const GetPublicShareFileUrlErrorSpec = definePutioOperationErrorSpec({
3898
3705
  { statusCode: 404 }
3899
3706
  ]
3900
3707
  });
3901
- const toCsv = (values) => values && values.length > 0 ? values.join(",") : void 0;
3902
- const toShareTarget = (target) => target.type === "everyone" ? "everyone" : target.friendNames.join(",");
3708
+ const toShareTarget = (target) => target.type === "everyone" ? "everyone" : joinCsv(target.friendNames) ?? "everyone";
3903
3709
  const cloneSharedFiles = (input = {}) => requestJson(SharingCloneEnvelopeSchema, {
3904
3710
  body: {
3905
3711
  type: "form",
3906
3712
  value: {
3907
- cursor: input.cursor,
3908
- exclude_ids: toCsv(input.excludeIds),
3909
- file_ids: toCsv(input.ids),
3713
+ ...toCursorSelectionForm(input),
3910
3714
  parent_id: input.parentId ?? 0
3911
3715
  }
3912
3716
  },
3913
3717
  method: "POST",
3914
3718
  path: "/v2/sharing/clone"
3915
- }).pipe(Effect.map(({ id }) => ({ id })), (effect) => withOperationErrors(effect, CreateSharingCloneErrorSpec));
3719
+ }).pipe(selectJsonFields("id"), withOperationErrors(CreateSharingCloneErrorSpec));
3916
3720
  const getSharingCloneInfo = (id) => requestJson(SharingCloneInfoSchema, {
3917
3721
  method: "GET",
3918
3722
  path: `/v2/sharing/clone/${id}`
3919
- }).pipe((effect) => withOperationErrors(effect, GetSharingCloneInfoErrorSpec));
3723
+ }).pipe(withOperationErrors(GetSharingCloneInfoErrorSpec));
3920
3724
  const shareFiles = (input) => requestJson(OkResponseSchema, {
3921
3725
  body: {
3922
3726
  type: "form",
3923
3727
  value: {
3924
- cursor: input.cursor,
3925
- exclude_ids: toCsv(input.excludeIds),
3926
- file_ids: toCsv(input.ids),
3728
+ ...toCursorSelectionForm(input),
3927
3729
  friends: toShareTarget(input.target)
3928
3730
  }
3929
3731
  },
3930
3732
  method: "POST",
3931
3733
  path: "/v2/files/share"
3932
- }).pipe((effect) => withOperationErrors(effect, ShareFilesErrorSpec));
3734
+ }).pipe(withOperationErrors(ShareFilesErrorSpec));
3933
3735
  const listSharedFiles = () => requestJson(SharedFilesEnvelopeSchema, {
3934
3736
  method: "GET",
3935
3737
  path: "/v2/files/shared"
3936
- }).pipe(Effect.map(({ shared }) => shared), (effect) => withOperationErrors(effect, ListSharedFilesErrorSpec));
3738
+ }).pipe(selectJsonField("shared"), withOperationErrors(ListSharedFilesErrorSpec));
3937
3739
  const getSharedWith = (fileId) => requestJson(SharedFileSharedWithSchema, {
3938
3740
  method: "GET",
3939
3741
  path: `/v2/files/${fileId}/shared-with-v2`
3940
- }).pipe((effect) => withOperationErrors(effect, GetSharedWithErrorSpec));
3742
+ }).pipe(withOperationErrors(GetSharedWithErrorSpec));
3941
3743
  const unshareFile = (input) => requestJson(OkResponseSchema, {
3942
3744
  body: {
3943
3745
  type: "form",
3944
- value: { shares: input.shares && input.shares.length > 0 ? toCsv(input.shares) : "everyone" }
3746
+ value: { shares: joinCsv(input.shares) ?? "everyone" }
3945
3747
  },
3946
3748
  method: "POST",
3947
3749
  path: `/v2/files/${input.fileId}/unshare`
3948
- }).pipe((effect) => withOperationErrors(effect, UnshareFileErrorSpec));
3750
+ }).pipe(withOperationErrors(UnshareFileErrorSpec));
3949
3751
  const createPublicShare = (fileId) => requestJson(PublicShareEnvelopeSchema, {
3950
3752
  method: "POST",
3951
3753
  path: `/v2/public_share/${fileId}`
3952
- }).pipe(Effect.map(({ public_share }) => public_share), (effect) => withOperationErrors(effect, CreatePublicShareErrorSpec));
3754
+ }).pipe(selectJsonField("public_share"), withOperationErrors(CreatePublicShareErrorSpec));
3953
3755
  const listPublicShares = () => requestJson(PublicSharesEnvelopeSchema, {
3954
3756
  method: "GET",
3955
3757
  path: "/v2/public_share/list"
3956
- }).pipe(Effect.map(({ public_shares }) => public_shares), (effect) => withOperationErrors(effect, ListPublicSharesErrorSpec));
3758
+ }).pipe(selectJsonField("public_shares"), withOperationErrors(ListPublicSharesErrorSpec));
3957
3759
  const deletePublicShare = (id) => requestJson(OkResponseSchema, {
3958
3760
  method: "DELETE",
3959
3761
  path: `/v2/public_share/${id}`
3960
- }).pipe((effect) => withOperationErrors(effect, DeletePublicShareErrorSpec));
3762
+ }).pipe(withOperationErrors(DeletePublicShareErrorSpec));
3961
3763
  const getPublicShare = () => requestJson(PublicShareEnvelopeSchema, {
3962
3764
  method: "GET",
3963
3765
  path: "/v2/public_share"
3964
- }).pipe(Effect.map(({ public_share }) => public_share), (effect) => withOperationErrors(effect, GetPublicShareErrorSpec));
3766
+ }).pipe(selectJsonField("public_share"), withOperationErrors(GetPublicShareErrorSpec));
3965
3767
  const listPublicShareFiles = (query = {}) => requestJson(PublicShareFileListEnvelopeSchema, {
3966
3768
  method: "GET",
3967
3769
  path: "/v2/public_share/files/list",
3968
3770
  query
3969
- }).pipe((effect) => withOperationErrors(effect, ListPublicShareFilesErrorSpec));
3771
+ }).pipe(withOperationErrors(ListPublicShareFilesErrorSpec));
3970
3772
  const continuePublicShareFiles = (cursor, query = {}) => requestJson(PublicShareFileListContinueEnvelopeSchema, {
3971
3773
  body: {
3972
3774
  type: "form",
@@ -3975,11 +3777,11 @@ const continuePublicShareFiles = (cursor, query = {}) => requestJson(PublicShare
3975
3777
  method: "POST",
3976
3778
  path: "/v2/public_share/files/list/continue",
3977
3779
  query
3978
- }).pipe((effect) => withOperationErrors(effect, ContinuePublicShareFilesErrorSpec));
3780
+ }).pipe(withOperationErrors(ContinuePublicShareFilesErrorSpec));
3979
3781
  const getPublicShareFileUrl = (fileId) => requestJson(PublicShareFileUrlEnvelopeSchema, {
3980
3782
  method: "GET",
3981
3783
  path: `/v2/public_share/files/${fileId}/url`
3982
- }).pipe(Effect.map(({ url }) => url), (effect) => withOperationErrors(effect, GetPublicShareFileUrlErrorSpec));
3784
+ }).pipe(selectJsonField("url"), withOperationErrors(GetPublicShareFileUrlErrorSpec));
3983
3785
  //#endregion
3984
3786
  //#region src/domains/trash.ts
3985
3787
  const TrashFileSchema = Schema.Struct({
@@ -4086,14 +3888,14 @@ const toBulkTrashBody = (input) => {
4086
3888
  if (!input.file_ids) throw new Error("trash bulk file_ids are required when useCursor is not set");
4087
3889
  return {
4088
3890
  cursor: void 0,
4089
- file_ids: input.file_ids.join(",")
3891
+ file_ids: joinCsv(input.file_ids)
4090
3892
  };
4091
3893
  };
4092
3894
  const listTrash = (query) => requestJson(TrashListEnvelopeSchema, {
4093
3895
  method: "GET",
4094
3896
  path: "/v2/trash/list",
4095
3897
  query
4096
- }).pipe((effect) => withOperationErrors(effect, ListTrashErrorSpec));
3898
+ }).pipe(withOperationErrors(ListTrashErrorSpec));
4097
3899
  const continueTrash = (cursor, query) => requestJson(TrashContinueEnvelopeSchema, {
4098
3900
  body: {
4099
3901
  type: "form",
@@ -4102,7 +3904,7 @@ const continueTrash = (cursor, query) => requestJson(TrashContinueEnvelopeSchema
4102
3904
  method: "POST",
4103
3905
  path: "/v2/trash/list/continue",
4104
3906
  query
4105
- }).pipe((effect) => withOperationErrors(effect, ContinueTrashErrorSpec));
3907
+ }).pipe(withOperationErrors(ContinueTrashErrorSpec));
4106
3908
  const restoreTrash = (input) => requestJson(OkResponseSchema, {
4107
3909
  body: {
4108
3910
  type: "form",
@@ -4110,7 +3912,7 @@ const restoreTrash = (input) => requestJson(OkResponseSchema, {
4110
3912
  },
4111
3913
  method: "POST",
4112
3914
  path: "/v2/trash/restore"
4113
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, RestoreTrashErrorSpec));
3915
+ }).pipe(Effect.asVoid, withOperationErrors(RestoreTrashErrorSpec));
4114
3916
  const deleteTrash = (input) => requestJson(OkResponseSchema, {
4115
3917
  body: {
4116
3918
  type: "form",
@@ -4118,11 +3920,11 @@ const deleteTrash = (input) => requestJson(OkResponseSchema, {
4118
3920
  },
4119
3921
  method: "POST",
4120
3922
  path: "/v2/trash/delete"
4121
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, DeleteTrashErrorSpec));
3923
+ }).pipe(Effect.asVoid, withOperationErrors(DeleteTrashErrorSpec));
4122
3924
  const emptyTrash = () => requestJson(OkResponseSchema, {
4123
3925
  method: "POST",
4124
3926
  path: "/v2/trash/empty"
4125
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, EmptyTrashErrorSpec));
3927
+ }).pipe(Effect.asVoid, withOperationErrors(EmptyTrashErrorSpec));
4126
3928
  //#endregion
4127
3929
  //#region src/domains/transfers.ts
4128
3930
  const TransferTypeSchema = Schema.Literal("URL", "TORRENT", "PLAYLIST", "LIVE_STREAM", "N/A");
@@ -4348,7 +4150,7 @@ const listTransfers = (query = {}) => requestJson(TransfersListEnvelopeSchema, {
4348
4150
  method: "GET",
4349
4151
  path: "/v2/transfers/list",
4350
4152
  query
4351
- }).pipe((effect) => withOperationErrors(effect, ListTransfersErrorSpec));
4153
+ }).pipe(withOperationErrors(ListTransfersErrorSpec));
4352
4154
  const continueTransfers = (cursor, query = {}) => requestJson(TransfersContinueEnvelopeSchema, {
4353
4155
  body: {
4354
4156
  type: "form",
@@ -4357,15 +4159,15 @@ const continueTransfers = (cursor, query = {}) => requestJson(TransfersContinueE
4357
4159
  method: "POST",
4358
4160
  path: "/v2/transfers/list/continue",
4359
4161
  query
4360
- }).pipe((effect) => withOperationErrors(effect, ListTransfersErrorSpec));
4162
+ }).pipe(withOperationErrors(ListTransfersErrorSpec));
4361
4163
  const getTransfer = (id) => requestJson(TransferEnvelopeSchema, {
4362
4164
  method: "GET",
4363
4165
  path: `/v2/transfers/${id}`
4364
- }).pipe(Effect.map(({ transfer }) => transfer), (effect) => withOperationErrors(effect, GetTransferErrorSpec));
4166
+ }).pipe(selectJsonField("transfer"), withOperationErrors(GetTransferErrorSpec));
4365
4167
  const countTransfers = () => requestJson(TransferCountEnvelopeSchema, {
4366
4168
  method: "GET",
4367
4169
  path: "/v2/transfers/count"
4368
- }).pipe(Effect.map(({ count }) => count));
4170
+ }).pipe(selectJsonField("count"));
4369
4171
  const getTransferInfo = (urls) => requestJson(TransferInfoEnvelopeSchema, {
4370
4172
  body: {
4371
4173
  type: "form",
@@ -4373,10 +4175,7 @@ const getTransferInfo = (urls) => requestJson(TransferInfoEnvelopeSchema, {
4373
4175
  },
4374
4176
  method: "POST",
4375
4177
  path: "/v2/transfers/info"
4376
- }).pipe(Effect.map(({ disk_avail, ret }) => ({
4377
- disk_avail,
4378
- ret
4379
- })));
4178
+ }).pipe(selectJsonFields("disk_avail", "ret"));
4380
4179
  const addTransfer = (input) => requestJson(TransferEnvelopeSchema, {
4381
4180
  body: {
4382
4181
  type: "form",
@@ -4384,7 +4183,7 @@ const addTransfer = (input) => requestJson(TransferEnvelopeSchema, {
4384
4183
  },
4385
4184
  method: "POST",
4386
4185
  path: "/v2/transfers/add"
4387
- }).pipe(Effect.map(({ transfer }) => transfer), (effect) => withOperationErrors(effect, AddTransferErrorSpec));
4186
+ }).pipe(selectJsonField("transfer"), withOperationErrors(AddTransferErrorSpec));
4388
4187
  const addManyTransfers = (inputs) => requestJson(TransfersAddMultiEnvelopeSchema, {
4389
4188
  body: {
4390
4189
  type: "form",
@@ -4392,14 +4191,11 @@ const addManyTransfers = (inputs) => requestJson(TransfersAddMultiEnvelopeSchema
4392
4191
  },
4393
4192
  method: "POST",
4394
4193
  path: "/v2/transfers/add-multi"
4395
- }).pipe(Effect.map(({ errors, transfers }) => ({
4396
- errors,
4397
- transfers
4398
- })), (effect) => withOperationErrors(effect, AddManyTransfersErrorSpec));
4194
+ }).pipe(selectJsonFields("errors", "transfers"), withOperationErrors(AddManyTransfersErrorSpec));
4399
4195
  const cancelTransfers = (ids) => requestJson(OkResponseSchema, {
4400
4196
  body: {
4401
4197
  type: "form",
4402
- value: { transfer_ids: ids.join(",") }
4198
+ value: { transfer_ids: joinCsv(ids) }
4403
4199
  },
4404
4200
  method: "POST",
4405
4201
  path: "/v2/transfers/cancel"
@@ -4407,11 +4203,11 @@ const cancelTransfers = (ids) => requestJson(OkResponseSchema, {
4407
4203
  const cleanTransfers = (ids = []) => requestJson(TransfersCleanEnvelopeSchema, {
4408
4204
  body: {
4409
4205
  type: "form",
4410
- value: ids.length > 0 ? { transfer_ids: ids.join(",") } : {}
4206
+ value: ids.length > 0 ? { transfer_ids: joinCsv(ids) } : {}
4411
4207
  },
4412
4208
  method: "POST",
4413
4209
  path: "/v2/transfers/clean"
4414
- }).pipe(Effect.map(({ deleted_ids }) => ({ deleted_ids })));
4210
+ }).pipe(selectJsonFields("deleted_ids"));
4415
4211
  const retryTransfer = (id) => requestJson(TransferEnvelopeSchema, {
4416
4212
  body: {
4417
4213
  type: "form",
@@ -4419,7 +4215,7 @@ const retryTransfer = (id) => requestJson(TransferEnvelopeSchema, {
4419
4215
  },
4420
4216
  method: "POST",
4421
4217
  path: "/v2/transfers/retry"
4422
- }).pipe(Effect.map(({ transfer }) => transfer), (effect) => withOperationErrors(effect, RetryTransferErrorSpec));
4218
+ }).pipe(selectJsonField("transfer"), withOperationErrors(RetryTransferErrorSpec));
4423
4219
  const reannounceTransfer = (id) => requestJson(OkResponseSchema, {
4424
4220
  body: {
4425
4221
  type: "form",
@@ -4427,7 +4223,7 @@ const reannounceTransfer = (id) => requestJson(OkResponseSchema, {
4427
4223
  },
4428
4224
  method: "POST",
4429
4225
  path: "/v2/transfers/reannounce"
4430
- }).pipe((effect) => withOperationErrors(effect, ReannounceTransferErrorSpec));
4226
+ }).pipe(withOperationErrors(ReannounceTransferErrorSpec));
4431
4227
  const stopTransferRecording = (id) => requestJson(OkResponseSchema, {
4432
4228
  body: {
4433
4229
  type: "form",
@@ -4435,7 +4231,7 @@ const stopTransferRecording = (id) => requestJson(OkResponseSchema, {
4435
4231
  },
4436
4232
  method: "POST",
4437
4233
  path: "/v2/transfers/stop-recording"
4438
- }).pipe((effect) => withOperationErrors(effect, StopRecordingTransferErrorSpec));
4234
+ }).pipe(withOperationErrors(StopRecordingTransferErrorSpec));
4439
4235
  //#endregion
4440
4236
  //#region src/domains/tunnel.ts
4441
4237
  const TunnelRouteSchema = Schema.Struct({
@@ -4458,7 +4254,7 @@ const ListTunnelRoutesErrorSpec = definePutioOperationErrorSpec({
4458
4254
  const listTunnelRoutes = () => requestJson(TunnelRoutesEnvelopeSchema, {
4459
4255
  method: "GET",
4460
4256
  path: "/v2/tunnel/routes"
4461
- }).pipe(Effect.map(({ routes }) => routes), (effect) => withOperationErrors(effect, ListTunnelRoutesErrorSpec));
4257
+ }).pipe(selectJsonField("routes"), withOperationErrors(ListTunnelRoutesErrorSpec));
4462
4258
  //#endregion
4463
4259
  //#region src/domains/zips.ts
4464
4260
  const ZipStatusSchema = Schema.Literal("NEW", "PROCESSING", "DONE", "ERROR");
@@ -4554,36 +4350,47 @@ const CancelZipErrorSpec = definePutioOperationErrorSpec({
4554
4350
  const listZips = () => requestJson(ZipsListEnvelopeSchema, {
4555
4351
  method: "GET",
4556
4352
  path: "/v2/zips/list"
4557
- }).pipe(Effect.map(({ zips }) => zips), (effect) => withOperationErrors(effect, ListZipsErrorSpec));
4353
+ }).pipe(selectJsonField("zips"), withOperationErrors(ListZipsErrorSpec));
4558
4354
  const createZip = (input) => requestJson(ZipCreateEnvelopeSchema, {
4559
4355
  body: {
4560
4356
  type: "form",
4561
- value: {
4357
+ value: { ...toCursorSelectionForm({
4562
4358
  cursor: input.cursor,
4563
- exclude_ids: input.exclude_ids?.join(","),
4564
- file_ids: input.file_ids?.join(",")
4565
- }
4359
+ excludeIds: input.exclude_ids,
4360
+ ids: input.file_ids
4361
+ }) }
4566
4362
  },
4567
4363
  method: "POST",
4568
4364
  path: "/v2/zips/create"
4569
- }).pipe(Effect.map(({ zip_id }) => zip_id), (effect) => withOperationErrors(effect, CreateZipErrorSpec));
4365
+ }).pipe(selectJsonField("zip_id"), withOperationErrors(CreateZipErrorSpec));
4570
4366
  const getZip = (id) => requestJson(ZipInfoSchema, {
4571
4367
  method: "GET",
4572
4368
  path: `/v2/zips/${id}`
4573
- }).pipe((effect) => withOperationErrors(effect, GetZipErrorSpec));
4369
+ }).pipe(withOperationErrors(GetZipErrorSpec));
4574
4370
  const cancelZip = (id) => requestJson(OkResponseSchema, {
4575
4371
  method: "GET",
4576
4372
  path: `/v2/zips/${id}/cancel`
4577
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, CancelZipErrorSpec));
4373
+ }).pipe(Effect.asVoid, withOperationErrors(CancelZipErrorSpec));
4578
4374
  //#endregion
4579
4375
  //#region src/core/client.ts
4580
- const unwrapPromiseFailure = (cause) => Option.getOrElse(Cause.failureOption(cause), () => Cause.squash(cause));
4581
- const runWithConfig = async (config, effect) => {
4582
- const exit = await Effect.runPromiseExit(effect);
4583
- if (Exit.isSuccess(exit)) return exit.value;
4584
- throw unwrapPromiseFailure(exit.cause);
4376
+ const promiseClientRuntimeCache = /* @__PURE__ */ new WeakMap();
4377
+ const disposedPromiseClientConfigs = /* @__PURE__ */ new WeakSet();
4378
+ const getPromiseClientRuntime = (config) => {
4379
+ if (disposedPromiseClientConfigs.has(config)) throw mapConfigurationError("This Promise client has been disposed and can no longer execute SDK effects");
4380
+ const cachedRuntime = promiseClientRuntimeCache.get(config);
4381
+ if (cachedRuntime) return cachedRuntime;
4382
+ const runtime = ManagedRuntime.make(Layer.mergeAll(makePutioSdkLayer(config), FetchHttpClient.layer));
4383
+ promiseClientRuntimeCache.set(config, runtime);
4384
+ return runtime;
4385
+ };
4386
+ const disposePromiseClientRuntime = async (config) => {
4387
+ disposedPromiseClientConfigs.add(config);
4388
+ const runtime = promiseClientRuntimeCache.get(config);
4389
+ promiseClientRuntimeCache.delete(config);
4390
+ if (!runtime) return;
4391
+ await runtime.dispose();
4585
4392
  };
4586
- const provideSdk = (config, effect) => runWithConfig(config, effect.pipe(Effect.provide(makePutioSdkLayer(config)), Effect.provide(FetchHttpClient.layer)));
4393
+ const provideSdk = async (config, effect) => getPromiseClientRuntime(config).runPromise(effect);
4587
4394
  const createPutioSdkEffectClient = () => ({
4588
4395
  account: {
4589
4396
  clear: clearAccount,
@@ -4802,7 +4609,8 @@ const createPutioSdkEffectClient = () => ({
4802
4609
  list: listZips
4803
4610
  }
4804
4611
  });
4805
- const createPutioSdkPromiseClient = (config = {}) => {
4612
+ const createPutioSdkPromiseClient = (initialConfig = {}) => {
4613
+ const config = { ...initialConfig };
4806
4614
  function getInfo(query) {
4807
4615
  return provideSdk(config, getAccountInfo(query));
4808
4616
  }
@@ -4810,6 +4618,7 @@ const createPutioSdkPromiseClient = (config = {}) => {
4810
4618
  return provideSdk(config, getFile(input));
4811
4619
  }
4812
4620
  return {
4621
+ dispose: () => disposePromiseClientRuntime(config),
4813
4622
  account: {
4814
4623
  clear: (options) => provideSdk(config, clearAccount(options)),
4815
4624
  destroy: (currentPassword) => provideSdk(config, destroyAccount(currentPassword)),
@@ -5030,6 +4839,6 @@ const createPutioSdkPromiseClient = (config = {}) => {
5030
4839
  };
5031
4840
  };
5032
4841
  //#endregion
5033
- export { AccountClearOptionsSchema, AccountConfirmationSchema, AccountConfirmationsErrorSpec, AccountDiskSchema, AccountInfoBaseSchema, AccountInfoBroadSchema, AccountInfoQuerySchema, AccountSettingsSchema, AccountTwoFactorSettingsSchema, AccountWarningsSchema, AddManyTransfersErrorSpec, AddTransferErrorSpec, ApproveFriendRequestErrorSpec, AuthorizationCodeSchema, CancelZipErrorSpec, ClearEventsErrorSpec, ClearRssFeedLogsErrorSpec, ClientsErrorSpec, ConfirmFastspringOrderErrorSpec, ContinueFilesErrorSpec, ContinuePublicShareFilesErrorSpec, ContinueTrashErrorSpec, CountWaitingRequestsErrorSpec, CreateCoinbaseChargeErrorSpec, CreateDownloadLinksErrorSpec, CreateFamilyInviteErrorSpec, CreateFolderErrorSpec, CreateFriendInviteErrorSpec, CreateNanoPaymentRequestErrorSpec, CreateOAuthAppErrorSpec, CreateOpenNodeChargeErrorSpec, CreatePaddleWaitingPaymentErrorSpec, CreatePublicShareErrorSpec, CreateRssFeedErrorSpec, CreateSharingCloneErrorSpec, CreateZipErrorSpec, DEFAULT_PUTIO_API_BASE_URL, DEFAULT_PUTIO_UPLOAD_BASE_URL, DEFAULT_PUTIO_WEB_APP_URL, DeleteEventErrorSpec, DeleteOAuthAppErrorSpec, DeletePublicShareErrorSpec, DeleteRssFeedErrorSpec, DeleteTrashErrorSpec, DenyFriendRequestErrorSpec, DownloadLinksCreateInputSchema, DownloadLinksInfoSchema, DownloadLinksPayloadSchema, DownloadLinksStatusSchema, DownloadUrlErrorSpec, EmptyTrashErrorSpec, EventsListQuerySchema, FamilyInviteLookupErrorSpec, FamilyInviteSchema, FamilyMemberSchema, FileActiveConversionSchema, FileActiveConversionsErrorSpec, FileBaseSchema, FileBreadcrumbSchema, FileBroadSchema, FileConversionStatusSchema, FileExtractionSchema, FileExtractionStatusSchema, FileExtractionsErrorSpec, FileMediaInfoFormatSchema, FileMediaInfoSchema, FileMediaInfoStreamSchema, FileMediaMetadataSchema, FileMp4ErrorSpec, FileMp4MutationErrorSpec, FileQuerySchema, FileSortSchema, FileSubtitleSchema, FileSubtitlesErrorSpec, FileTypeSchema, FileUploadErrorSpec, FileWatchStatusErrorSpec, FilesListEnvelopeSchema, FilesListQuerySchema, FilesMoveErrorSchema, FilesSearchQuerySchema, FolderTypeSchema, ForgotPasswordErrorSpec, FriendBaseSchema, FriendInviteJoinedUserSchema, FriendInviteJoinedUserStatusSchema, FriendInviteLookupErrorSpec, FriendInviteSchema, FriendSchema, FriendSharedFolderErrorSpec, GenerateTOTPErrorSpec, GenerateTOTPResponseSchema, GetDownloadLinksErrorSpec, GetEventTorrentErrorSpec, GetFileErrorSpec, GetIftttStatusErrorSpec, GetOAuthAppErrorSpec, GetPaymentInfoErrorSpec, GetPaymentVoucherInfoErrorSpec, GetPublicShareErrorSpec, GetPublicShareFileUrlErrorSpec, GetRssFeedErrorSpec, GetSharedWithErrorSpec, GetSharingCloneInfoErrorSpec, GetTransferErrorSpec, GetZipErrorSpec, GiftCardLookupErrorSpec, GrantsErrorSpec, HistoryEventSchema, HistoryFileFromRssDeletedEventSchema, HistoryFileSharedEventSchema, HistoryKnownEventTypeSchema, HistoryPrivateTorrentPinEventSchema, HistoryRssFilterPausedEventSchema, HistoryTransferCallbackErrorEventSchema, HistoryTransferCompletedEventSchema, HistoryTransferErrorEventSchema, HistoryTransferFromRssErrorEventSchema, HistoryUploadEventSchema, HistoryVoucherEventSchema, HistoryZipCreatedEventSchema, JoinFamilyErrorSpec, JsonObjectSchema, JsonValueSchema, LinkDeviceErrorSpec, ListEventsErrorSpec, ListFamilyInvitesErrorSpec, ListFamilyMembersErrorSpec, ListFriendInvitesErrorSpec, ListFriendsErrorSpec, ListPaymentHistoryErrorSpec, ListPaymentInvitesErrorSpec, ListPaymentOptionsErrorSpec, ListPaymentPlansErrorSpec, ListPublicShareFilesErrorSpec, ListPublicSharesErrorSpec, ListRssFeedItemsErrorSpec, ListRssFeedsErrorSpec, ListSentRequestsErrorSpec, ListSharedFilesErrorSpec, ListTransfersErrorSpec, ListTrashErrorSpec, ListTunnelRoutesErrorSpec, ListWaitingRequestsErrorSpec, ListZipsErrorSpec, LoginErrorSpec, LoginResponseSchema, MyOAuthAppSchema, OAuthAppCreateInputSchema, OAuthAppSchema, OAuthAppSessionSchema, OAuthAppUpdateInputSchema, OAuthAppWithTokenSchema, OAuthSetIconInputSchema, OkResponseSchema, OwnedOAuthAppSchema, PasInfoSchema, PauseRssFeedErrorSpec, PaymentChangePlanPreviewSchema, PaymentChangePlanSubmitSchema, PaymentHistoryItemSchema, PaymentInfoPlanSchema, PaymentInfoSchema, PaymentInviteSchema, PaymentOptionPlanTypeSchema, PaymentOptionSchema, PaymentPlanGroupSchema, PaymentPlanTypeSchema, PaymentProviderNameSchema, PaymentProviderSchema, PaymentSubscriptionInfoSchema, PaymentTypeSchema, PaymentVoucherInfoSchema, PopularOAuthAppSchema, PreviewPaymentChangePlanErrorSpec, PublicShareListQuerySchema, PublicShareSchema, PutioApiError, PutioAuthError, PutioConfigurationError, PutioErrorEnvelopeSchema, PutioOperationError, PutioRateLimitError, PutioSdkConfig, PutioTransportError, PutioValidationError, QueryFilesErrorSpec, QueryOAuthAppsErrorSpec, ReannounceTransferErrorSpec, RecoveryCodesErrorSpec, RedeemPaymentVoucherErrorSpec, RegenerateOAuthAppTokenErrorSpec, RegenerateRecoveryCodesErrorSpec, RegisterErrorSpec, RegisterInputSchema, RemoveFamilyMemberErrorSpec, RemoveFriendErrorSpec, RenameFileErrorSpec, ReportPaymentsErrorSpec, ResetPasswordErrorSpec, RestoreTrashErrorSpec, ResumeRssFeedErrorSpec, RetryAllRssFeedItemsErrorSpec, RetryRssFeedItemErrorSpec, RetryTransferErrorSpec, RevokeAllOAuthClientsErrorSpec, RevokeOAuthClientErrorSpec, RevokeOAuthGrantErrorSpec, RssFeedItemFailedSchema, RssFeedItemSchema, RssFeedItemSucceededSchema, RssFeedParamsSchema, RssFeedSchema, SaveAccountSettingsErrorSpec, SaveAccountSettingsPayloadSchema, SearchFilesErrorSpec, SearchFriendsErrorSpec, SendFriendRequestErrorSpec, SendIftttEventErrorSpec, ShareFilesErrorSpec, SharedFileSchema, SharedFileShareSchema, SharedFileSharedWithSchema, SharingCloneInfoSchema, SharingCloneInputSchema, SharingCloneStatusSchema, SharingShareInputSchema, SharingUnshareInputSchema, StartFromErrorSpec, StopRecordingTransferErrorSpec, StopSubscriptionErrorSpec, SubmitPaymentChangePlanErrorSpec, TransferAddInputSchema, TransferBaseSchema, TransferSchema, TransferStatusSchema, TransferTypeSchema, TransfersListQuerySchema, TrashFileSchema, TunnelRouteSchema, TwoFactorRecoveryCodesSchema, UnshareFileErrorSpec, UpdateOAuthAppErrorSpec, UpdateRssFeedErrorSpec, UserSearchResultSchema, UserSubscriptionStatusSchema, ValidateTokenResponseSchema, VerifyTOTPErrorSpec, VerifyTOTPResponseSchema, VoucherLookupErrorSpec, ZipStatusSchema, addManyTransfers, addTransfer, approveFriendRequest, buildAuthLoginUrl, buildFileApiContentUrl, buildFileApiDownloadUrl, buildFileApiMp4DownloadUrl, buildFileHlsStreamUrl, buildOAuthAppIconUrl, buildOAuthAuthorizeUrl, buildPutioUrl, cancelTransfers, cancelZip, checkCodeMatch, classifyPaymentChangePlanResponse, cleanTransfers, clearAccount, clearEvents, clearRssFeedLogs, clients, cloneSharedFiles, confirmFastspringOrder, continueFiles, continuePublicShareFiles, continueSearch, continueTransfers, continueTrash, convertFileSelectionToMp4, convertFileToMp4, convertFilesToMp4, countTransfers, countWaitingRequests, createCoinbaseCharge, createDownloadLinks, createFamilyInvite, createFileUploadFormData, createFileUploadRequest, createFolder, createFriendInvite, createNanoPaymentRequest, createOAuthApp, createOpenNodeCharge, createPaddleWaitingPayment, createPublicShare, createPutioSdkEffectClient, createPutioSdkPromiseClient, createRssFeed, createZip, decodePutioErrorEnvelope, definePutioOperationErrorSpec, deleteConfigKey, deleteEvent, deleteFileExtraction, deleteFileMp4, deleteFileSelection, deleteFiles, deleteOAuthApp, deletePublicShare, deleteRssFeed, deleteTrash, denyFriendRequest, destroyAccount, emptyTrash, exists, extractFiles, fallbackPutioErrorEnvelope, findNextFile, findNextVideo, forgotPassword, generateTOTP, getAccountInfo, getAccountSettings, getApiContentUrl, getApiDownloadUrl, getApiMp4DownloadUrl, getCode, getConfigKey, getConfigKeyWith, getDownloadLinks, getDownloadUrl, getEventTorrent, getFamilyInvite, getFile, getFriendInvite, getFriendSharedFolder, getGiftCard, getHlsStreamUrl, getIftttStatus, getMp4Status, getOAuthApp, getPaymentInfo, getPaymentVoucherInfo, getPopularOAuthApps, getPublicShare, getPublicShareFileUrl, getRecoveryCodes, getRssFeed, getSharedWith, getSharingCloneInfo, getStartFrom, getTransfer, getTransferInfo, getVoucher, getZip, grants, joinFamily, linkDevice, listAccountConfirmations, listActiveMp4Conversions, listEvents, listFamilyInvites, listFamilyMembers, listFileExtractions, listFileSubtitles, listFriendInvites, listFriends, listPaymentHistory, listPaymentInvites, listPaymentOptions, listPaymentPlans, listPublicShareFiles, listPublicShares, listRssFeedItems, listRssFeeds, listSentRequests, listSharedFiles, listTransfers, listTrash, listTunnelRoutes, listWaitingRequests, listZips, login, logout, makePutioSdkConfig, makePutioSdkLayer, makeResponseError, mapConfigurationError, mapDecodeErrorToValidationError, mapTransportError, moveFileSelection, moveFiles, parseErrorBody, pauseRssFeed, previewPaymentChangePlan, putMp4ToMyFiles, queryFiles, queryOAuthApps, readConfig, readConfigWith, reannounceTransfer, redeemPaymentVoucher, regenerateOAuthAppToken, regenerateRecoveryCodes, register, removeFamilyMember, removeFriend, renameFile, reportPayments, requestArrayBuffer, requestJson, requestVoid, resetPassword, resetStartFrom, responseRateLimitHeaders, restoreTrash, resumeRssFeed, retryAllRssFeedItems, retryRssFeedItem, retryTransfer, revokeAllClients, revokeApp, revokeClient, saveAccountSettings, searchFiles, searchFriends, sendFriendRequest, sendIftttEvent, setConfigKey, setFilesWatchStatus, setOAuthAppIcon, setStartFrom, shareFiles, stopPaymentSubscription, stopTransferRecording, submitPaymentChangePlan, unshareFile, updateOAuthApp, updateRssFeed, uploadFile, validateToken, verifyTOTP, withOperationErrors, writeConfig };
4842
+ export { AccountClearOptionsSchema, AccountConfirmationSchema, AccountConfirmationsErrorSpec, AccountDiskSchema, AccountInfoBaseSchema, AccountInfoBroadSchema, AccountInfoQuerySchema, AccountSettingsSchema, AccountTwoFactorSettingsSchema, AccountWarningsSchema, AddManyTransfersErrorSpec, AddTransferErrorSpec, ApproveFriendRequestErrorSpec, AuthorizationCodeSchema, CancelZipErrorSpec, ClearEventsErrorSpec, ClearRssFeedLogsErrorSpec, ClientsErrorSpec, ConfirmFastspringOrderErrorSpec, ContinueFilesErrorSpec, ContinuePublicShareFilesErrorSpec, ContinueTrashErrorSpec, CountWaitingRequestsErrorSpec, CreateCoinbaseChargeErrorSpec, CreateDownloadLinksErrorSpec, CreateFamilyInviteErrorSpec, CreateFolderErrorSpec, CreateFriendInviteErrorSpec, CreateNanoPaymentRequestErrorSpec, CreateOAuthAppErrorSpec, CreateOpenNodeChargeErrorSpec, CreatePaddleWaitingPaymentErrorSpec, CreatePublicShareErrorSpec, CreateRssFeedErrorSpec, CreateSharingCloneErrorSpec, CreateZipErrorSpec, DEFAULT_PUTIO_API_BASE_URL, DEFAULT_PUTIO_UPLOAD_BASE_URL, DEFAULT_PUTIO_WEB_APP_URL, DeleteEventErrorSpec, DeleteOAuthAppErrorSpec, DeletePublicShareErrorSpec, DeleteRssFeedErrorSpec, DeleteTrashErrorSpec, DenyFriendRequestErrorSpec, DownloadLinksCreateInputSchema, DownloadLinksInfoSchema, DownloadLinksPayloadSchema, DownloadLinksStatusSchema, DownloadUrlErrorSpec, EmptyTrashErrorSpec, EventsListQuerySchema, FamilyInviteLookupErrorSpec, FamilyInviteSchema, FamilyMemberSchema, FileActiveConversionSchema, FileActiveConversionsErrorSpec, FileBaseSchema, FileBreadcrumbSchema, FileBroadSchema, FileConversionStatusSchema, FileExtractionSchema, FileExtractionStatusSchema, FileExtractionsErrorSpec, FileMediaInfoFormatSchema, FileMediaInfoSchema, FileMediaInfoStreamSchema, FileMediaMetadataSchema, FileMp4ErrorSpec, FileMp4MutationErrorSpec, FileQuerySchema, FileSortSchema, FileSubtitleSchema, FileSubtitlesErrorSpec, FileTypeSchema, FileUploadErrorSpec, FileWatchStatusErrorSpec, FilesListEnvelopeSchema, FilesListQuerySchema, FilesMoveErrorSchema, FilesSearchQuerySchema, FolderTypeSchema, ForgotPasswordErrorSpec, FriendBaseSchema, FriendInviteJoinedUserSchema, FriendInviteJoinedUserStatusSchema, FriendInviteLookupErrorSpec, FriendInviteSchema, FriendSchema, FriendSharedFolderErrorSpec, GenerateTOTPErrorSpec, GenerateTOTPResponseSchema, GetDownloadLinksErrorSpec, GetEventTorrentErrorSpec, GetFileErrorSpec, GetIftttStatusErrorSpec, GetOAuthAppErrorSpec, GetPaymentInfoErrorSpec, GetPaymentVoucherInfoErrorSpec, GetPublicShareErrorSpec, GetPublicShareFileUrlErrorSpec, GetRssFeedErrorSpec, GetSharedWithErrorSpec, GetSharingCloneInfoErrorSpec, GetTransferErrorSpec, GetZipErrorSpec, GiftCardLookupErrorSpec, GrantsErrorSpec, HistoryEventSchema, HistoryFileFromRssDeletedEventSchema, HistoryFileSharedEventSchema, HistoryKnownEventTypeSchema, HistoryPrivateTorrentPinEventSchema, HistoryRssFilterPausedEventSchema, HistoryTransferCallbackErrorEventSchema, HistoryTransferCompletedEventSchema, HistoryTransferErrorEventSchema, HistoryTransferFromRssErrorEventSchema, HistoryUploadEventSchema, HistoryVoucherEventSchema, HistoryZipCreatedEventSchema, JoinFamilyErrorSpec, JsonObjectSchema, JsonValueSchema, LinkDeviceErrorSpec, ListEventsErrorSpec, ListFamilyInvitesErrorSpec, ListFamilyMembersErrorSpec, ListFriendInvitesErrorSpec, ListFriendsErrorSpec, ListPaymentHistoryErrorSpec, ListPaymentInvitesErrorSpec, ListPaymentOptionsErrorSpec, ListPaymentPlansErrorSpec, ListPublicShareFilesErrorSpec, ListPublicSharesErrorSpec, ListRssFeedItemsErrorSpec, ListRssFeedsErrorSpec, ListSentRequestsErrorSpec, ListSharedFilesErrorSpec, ListTransfersErrorSpec, ListTrashErrorSpec, ListTunnelRoutesErrorSpec, ListWaitingRequestsErrorSpec, ListZipsErrorSpec, LoginErrorSpec, LoginResponseSchema, MyOAuthAppSchema, OAuthAppCreateInputSchema, OAuthAppSchema, OAuthAppSessionSchema, OAuthAppUpdateInputSchema, OAuthAppWithTokenSchema, OAuthSetIconInputSchema, OkResponseSchema, OwnedOAuthAppSchema, PasInfoSchema, PauseRssFeedErrorSpec, PaymentChangePlanPreviewSchema, PaymentChangePlanSubmitSchema, PaymentHistoryItemSchema, PaymentInfoPlanSchema, PaymentInfoSchema, PaymentInviteSchema, PaymentOptionPlanTypeSchema, PaymentOptionSchema, PaymentPlanGroupSchema, PaymentPlanTypeSchema, PaymentProviderNameSchema, PaymentProviderSchema, PaymentSubscriptionInfoSchema, PaymentTypeSchema, PaymentVoucherInfoSchema, PopularOAuthAppSchema, PreviewPaymentChangePlanErrorSpec, PublicShareListQuerySchema, PublicShareSchema, PutioApiError, PutioAuthError, PutioConfigurationError, PutioErrorEnvelopeSchema, PutioOperationError, PutioRateLimitError, PutioSdkConfig, PutioTransportError, PutioValidationError, QueryFilesErrorSpec, QueryOAuthAppsErrorSpec, ReannounceTransferErrorSpec, RecoveryCodesErrorSpec, RedeemPaymentVoucherErrorSpec, RegenerateOAuthAppTokenErrorSpec, RegenerateRecoveryCodesErrorSpec, RegisterErrorSpec, RegisterInputSchema, RemoveFamilyMemberErrorSpec, RemoveFriendErrorSpec, RenameFileErrorSpec, ReportPaymentsErrorSpec, ResetPasswordErrorSpec, RestoreTrashErrorSpec, ResumeRssFeedErrorSpec, RetryAllRssFeedItemsErrorSpec, RetryRssFeedItemErrorSpec, RetryTransferErrorSpec, RevokeAllOAuthClientsErrorSpec, RevokeOAuthClientErrorSpec, RevokeOAuthGrantErrorSpec, RssFeedItemFailedSchema, RssFeedItemSchema, RssFeedItemSucceededSchema, RssFeedParamsSchema, RssFeedSchema, SaveAccountSettingsErrorSpec, SaveAccountSettingsPayloadSchema, SearchFilesErrorSpec, SearchFriendsErrorSpec, SendFriendRequestErrorSpec, SendIftttEventErrorSpec, ShareFilesErrorSpec, SharedFileSchema, SharedFileShareSchema, SharedFileSharedWithSchema, SharingCloneInfoSchema, SharingCloneInputSchema, SharingCloneStatusSchema, SharingShareInputSchema, SharingUnshareInputSchema, StartFromErrorSpec, StopRecordingTransferErrorSpec, StopSubscriptionErrorSpec, SubmitPaymentChangePlanErrorSpec, TransferAddInputSchema, TransferBaseSchema, TransferSchema, TransferStatusSchema, TransferTypeSchema, TransfersListQuerySchema, TrashFileSchema, TunnelRouteSchema, TwoFactorRecoveryCodesSchema, UnshareFileErrorSpec, UpdateOAuthAppErrorSpec, UpdateRssFeedErrorSpec, UserSearchResultSchema, UserSubscriptionStatusSchema, ValidateTokenResponseSchema, VerifyTOTPErrorSpec, VerifyTOTPResponseSchema, VoucherLookupErrorSpec, ZipStatusSchema, addManyTransfers, addTransfer, approveFriendRequest, buildAuthLoginUrl, buildFileApiContentUrl, buildFileApiDownloadUrl, buildFileApiMp4DownloadUrl, buildFileHlsStreamUrl, buildOAuthAppIconUrl, buildOAuthAuthorizeUrl, buildPutioUrl, cancelTransfers, cancelZip, checkCodeMatch, classifyPaymentChangePlanResponse, cleanTransfers, clearAccount, clearEvents, clearRssFeedLogs, clients, cloneSharedFiles, confirmFastspringOrder, continueFiles, continuePublicShareFiles, continueSearch, continueTransfers, continueTrash, convertFileSelectionToMp4, convertFileToMp4, convertFilesToMp4, countTransfers, countWaitingRequests, createCoinbaseCharge, createDownloadLinks, createFamilyInvite, createFileUploadFormData, createFileUploadRequest, createFolder, createFriendInvite, createNanoPaymentRequest, createOAuthApp, createOpenNodeCharge, createPaddleWaitingPayment, createPublicShare, createPutioSdkEffectClient, createPutioSdkPromiseClient, createRssFeed, createZip, decodePutioErrorEnvelope, definePutioOperationErrorSpec, deleteConfigKey, deleteEvent, deleteFileExtraction, deleteFileMp4, deleteFileSelection, deleteFiles, deleteOAuthApp, deletePublicShare, deleteRssFeed, deleteTrash, denyFriendRequest, destroyAccount, emptyTrash, exists, extractFiles, fallbackPutioErrorEnvelope, findNextFile, findNextVideo, forgotPassword, generateTOTP, getAccountInfo, getAccountSettings, getApiContentUrl, getApiDownloadUrl, getApiMp4DownloadUrl, getCode, getConfigKey, getConfigKeyWith, getDownloadLinks, getDownloadUrl, getEventTorrent, getFamilyInvite, getFile, getFriendInvite, getFriendSharedFolder, getGiftCard, getHlsStreamUrl, getIftttStatus, getMp4Status, getOAuthApp, getPaymentInfo, getPaymentVoucherInfo, getPopularOAuthApps, getPublicShare, getPublicShareFileUrl, getRecoveryCodes, getRssFeed, getSharedWith, getSharingCloneInfo, getStartFrom, getTransfer, getTransferInfo, getVoucher, getZip, grants, joinFamily, linkDevice, listAccountConfirmations, listActiveMp4Conversions, listEvents, listFamilyInvites, listFamilyMembers, listFileExtractions, listFileSubtitles, listFriendInvites, listFriends, listPaymentHistory, listPaymentInvites, listPaymentOptions, listPaymentPlans, listPublicShareFiles, listPublicShares, listRssFeedItems, listRssFeeds, listSentRequests, listSharedFiles, listTransfers, listTrash, listTunnelRoutes, listWaitingRequests, listZips, login, logout, makePutioSdkConfig, makePutioSdkLayer, makeResponseError, mapConfigurationError, mapDecodeErrorToValidationError, mapTransportError, moveFileSelection, moveFiles, parseErrorBody, pauseRssFeed, previewPaymentChangePlan, putMp4ToMyFiles, queryFiles, queryOAuthApps, readConfig, readConfigWith, reannounceTransfer, redeemPaymentVoucher, regenerateOAuthAppToken, regenerateRecoveryCodes, register, removeFamilyMember, removeFriend, renameFile, reportPayments, requestArrayBuffer, requestJson, requestVoid, resetPassword, resetStartFrom, responseRateLimitHeaders, restoreTrash, resumeRssFeed, retryAllRssFeedItems, retryRssFeedItem, retryTransfer, revokeAllClients, revokeApp, revokeClient, saveAccountSettings, searchFiles, searchFriends, selectJsonField, selectJsonFields, sendFriendRequest, sendIftttEvent, setConfigKey, setFilesWatchStatus, setOAuthAppIcon, setStartFrom, shareFiles, stopPaymentSubscription, stopTransferRecording, submitPaymentChangePlan, unshareFile, updateOAuthApp, updateRssFeed, uploadFile, validateToken, verifyTOTP, withOperationErrors, writeConfig };
5034
4843
 
5035
4844
  //# sourceMappingURL=index.js.map