@putdotio/sdk 9.0.0 → 9.0.1

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,5 +1,5 @@
1
1
  import { FetchHttpClient, Headers, HttpClient, HttpClientRequest, HttpClientResponse } from "@effect/platform";
2
- import { Cause, Context, Data, Effect, Exit, Layer, Option, Schema } from "effect";
2
+ import { Context, Data, Effect, Layer, ManagedRuntime, Option, Schema } from "effect";
3
3
  //#region src/core/errors.ts
4
4
  const PutioErrorEnvelopeSchema = Schema.Struct({
5
5
  error_message: Schema.optional(Schema.String),
@@ -13,7 +13,7 @@ const isKnownContractMatch = (contract, error) => {
13
13
  return false;
14
14
  };
15
15
  const isMatchableApiError = (error) => error._tag === "PutioApiError" || error._tag === "PutioAuthError";
16
- const toOperationReason = (contract) => {
16
+ function toOperationReason(contract) {
17
17
  if (contract.errorType !== void 0) return {
18
18
  kind: "error_type",
19
19
  errorType: contract.errorType
@@ -22,7 +22,7 @@ const toOperationReason = (contract) => {
22
22
  kind: "status_code",
23
23
  statusCode: contract.statusCode
24
24
  };
25
- };
25
+ }
26
26
  var PutioTransportError = class extends Data.TaggedError("PutioTransportError") {};
27
27
  var PutioConfigurationError = class extends Data.TaggedError("PutioConfigurationError") {};
28
28
  var PutioValidationError = class extends Data.TaggedError("PutioValidationError") {};
@@ -63,19 +63,27 @@ const makeResponseError = (status, headers, body) => {
63
63
  });
64
64
  };
65
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
- }));
66
+ function withOperationErrors(effectOrSpec, maybeSpec) {
67
+ if (maybeSpec === void 0) {
68
+ const spec = effectOrSpec;
69
+ return (effect) => withOperationErrors(effect, spec);
70
+ }
71
+ const effect = effectOrSpec;
72
+ const spec = maybeSpec;
73
+ return effect.pipe(Effect.mapError((error) => {
74
+ if (!isMatchableApiError(error)) return error;
75
+ const contract = spec.knownErrors.find((candidate) => isKnownContractMatch(candidate, error));
76
+ if (!contract) return error;
77
+ return new PutioOperationError({
78
+ body: error.body,
79
+ contract,
80
+ domain: spec.domain,
81
+ operation: spec.operation,
82
+ reason: toOperationReason(contract),
83
+ status: error.status
84
+ });
85
+ }));
86
+ }
79
87
  //#endregion
80
88
  //#region src/core/defaults.ts
81
89
  const DEFAULT_PUTIO_API_BASE_URL = "https://api.put.io";
@@ -142,36 +150,17 @@ const makeRequest = (url, options, authorization) => Effect.gen(function* () {
142
150
  headers
143
151
  }), body);
144
152
  });
145
- const requestJson = (schema, options) => Effect.gen(function* () {
153
+ const executeRequest = (options) => Effect.gen(function* () {
146
154
  const config = yield* PutioSdkConfig;
147
155
  const authorization = yield* resolveAuthorization(config, options.auth);
148
156
  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);
157
+ return yield* HttpClient.execute(request).pipe(Effect.mapError(mapTransportError));
174
158
  });
159
+ const requestJson = (schema, options) => executeRequest(options).pipe(Effect.flatMap((response) => isSuccessStatus(response.status) ? decodeSuccessJson(schema, response) : decodeFailure(response, response.headers).pipe(Effect.flatMap(Effect.fail))));
160
+ const selectJsonField = (field) => (effect) => effect.pipe(Effect.map((value) => value[field]));
161
+ const selectJsonFields = (...fields) => (effect) => effect.pipe(Effect.map((value) => Object.fromEntries(fields.map((field) => [field, value[field]]))));
162
+ const requestArrayBuffer = (options) => executeRequest(options).pipe(Effect.flatMap((response) => isSuccessStatus(response.status) ? response.arrayBuffer.pipe(Effect.mapError(mapTransportError), Effect.map((buffer) => new Uint8Array(buffer))) : decodeFailure(response, response.headers).pipe(Effect.flatMap(Effect.fail))));
163
+ const requestVoid = (options) => executeRequest(options).pipe(Effect.flatMap((response) => isSuccessStatus(response.status) ? Effect.void : decodeFailure(response, response.headers).pipe(Effect.flatMap(Effect.fail))));
175
164
  //#endregion
176
165
  //#region src/domains/account.ts
177
166
  const RequestedFlag$1 = Schema.Literal(1);
@@ -293,12 +282,24 @@ const AccountConfirmationsEnvelopeSchema = Schema.Struct({
293
282
  status: Schema.Literal("OK")
294
283
  });
295
284
  const missingFieldError$1 = (field) => new PutioValidationError({ cause: `Expected put.io to include "${field}" because it was requested` });
285
+ const failMissingField$1 = (field) => Effect.fail(missingFieldError$1(field));
286
+ const widenValidationError$1 = (effect) => effect;
296
287
  const hasDownloadToken = (value) => typeof value.download_token === "string";
297
288
  const hasFeatures = (value) => typeof value.features === "object" && value.features !== null;
298
289
  const hasIntercomUserHash = (value) => typeof value.user_hash === "string";
299
290
  const hasPas = (value) => typeof value.pas === "object" && value.pas !== null && typeof value.pas.user_hash === "string";
300
291
  const hasPaddleUserId = (value) => "paddle_user_id" in value;
301
292
  const hasPushToken = (value) => typeof value.push_token === "string";
293
+ const ensureAccountInfoFields = (effect, query) => Effect.gen(function* () {
294
+ const info = yield* widenValidationError$1(effect);
295
+ if (query.download_token === 1 && !hasDownloadToken(info)) return yield* failMissingField$1("download_token");
296
+ if (query.features === 1 && !hasFeatures(info)) return yield* failMissingField$1("features");
297
+ if (query.intercom === 1 && !hasIntercomUserHash(info)) return yield* failMissingField$1("user_hash");
298
+ if (query.pas === 1 && !hasPas(info)) return yield* failMissingField$1("pas");
299
+ if (query.profitwell === 1 && !hasPaddleUserId(info)) return yield* failMissingField$1("paddle_user_id");
300
+ if (query.push_token === 1 && !hasPushToken(info)) return yield* failMissingField$1("push_token");
301
+ return info;
302
+ });
302
303
  const SaveAccountSettingsErrorSpec = definePutioOperationErrorSpec({
303
304
  domain: "account",
304
305
  operation: "saveSettings",
@@ -386,24 +387,16 @@ const AccountConfirmationsErrorSpec = definePutioOperationErrorSpec({
386
387
  }]
387
388
  });
388
389
  function getAccountInfo(query) {
389
- const effect = requestJson(AccountInfoEnvelopeSchema, {
390
+ return ensureAccountInfoFields(requestJson(AccountInfoEnvelopeSchema, {
390
391
  method: "GET",
391
392
  path: "/v2/account/info",
392
393
  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;
394
+ }).pipe(selectJsonField("info")), query);
402
395
  }
403
396
  const getAccountSettings = () => requestJson(AccountSettingsEnvelopeSchema, {
404
397
  method: "GET",
405
398
  path: "/v2/account/settings"
406
- }).pipe(Effect.map(({ settings }) => settings));
399
+ }).pipe(selectJsonField("settings"));
407
400
  const saveAccountSettings = (payload) => requestJson(OkResponseSchema, {
408
401
  body: {
409
402
  type: "json",
@@ -411,7 +404,7 @@ const saveAccountSettings = (payload) => requestJson(OkResponseSchema, {
411
404
  },
412
405
  method: "POST",
413
406
  path: "/v2/account/settings"
414
- }).pipe((effect) => withOperationErrors(effect, SaveAccountSettingsErrorSpec));
407
+ }).pipe(withOperationErrors(SaveAccountSettingsErrorSpec));
415
408
  const clearAccount = (options) => requestJson(OkResponseSchema, {
416
409
  body: {
417
410
  type: "form",
@@ -432,7 +425,7 @@ const listAccountConfirmations = (subject) => requestJson(AccountConfirmationsEn
432
425
  method: "GET",
433
426
  path: "/v2/account/confirmation/list",
434
427
  query: subject ? { type: subject } : void 0
435
- }).pipe(Effect.map(({ confirmations }) => confirmations), (effect) => withOperationErrors(effect, AccountConfirmationsErrorSpec));
428
+ }).pipe(selectJsonField("confirmations"), withOperationErrors(AccountConfirmationsErrorSpec));
436
429
  //#endregion
437
430
  //#region src/domains/oauth.ts
438
431
  const OAuthAppBaseSchema = Schema.Struct({
@@ -585,11 +578,11 @@ const buildOAuthAppIconUrl = (options) => buildPutioUrl(options.baseUrl ?? "http
585
578
  const queryOAuthApps = () => requestJson(OAuthAppsEnvelopeSchema, {
586
579
  method: "GET",
587
580
  path: "/v2/oauth/apps"
588
- }).pipe(Effect.map(({ apps }) => apps), (effect) => withOperationErrors(effect, QueryOAuthAppsErrorSpec));
581
+ }).pipe(selectJsonField("apps"), withOperationErrors(QueryOAuthAppsErrorSpec));
589
582
  const getOAuthApp = (id, options) => requestJson(OAuthAppWithTokenSchema, {
590
583
  method: "GET",
591
584
  path: options?.edit ? `/v2/oauth/apps/${id}/edit` : `/v2/oauth/apps/${id}`
592
- }).pipe((effect) => withOperationErrors(effect, GetOAuthAppErrorSpec));
585
+ }).pipe(withOperationErrors(GetOAuthAppErrorSpec));
593
586
  const setOAuthAppIcon = (id, input) => {
594
587
  const formData = new FormData();
595
588
  formData.append("icon", input.icon);
@@ -609,7 +602,7 @@ const createOAuthApp = (input) => requestJson(OAuthAppEnvelopeSchema, {
609
602
  },
610
603
  method: "POST",
611
604
  path: "/v2/oauth/apps/register"
612
- }).pipe((effect) => withOperationErrors(effect, CreateOAuthAppErrorSpec));
605
+ }).pipe(withOperationErrors(CreateOAuthAppErrorSpec));
613
606
  const updateOAuthApp = (input) => requestJson(OAuthAppWithTokenSchema, {
614
607
  body: {
615
608
  type: "form-data",
@@ -617,19 +610,19 @@ const updateOAuthApp = (input) => requestJson(OAuthAppWithTokenSchema, {
617
610
  },
618
611
  method: "POST",
619
612
  path: `/v2/oauth/apps/${input.id}`
620
- }).pipe((effect) => withOperationErrors(effect, UpdateOAuthAppErrorSpec));
613
+ }).pipe(withOperationErrors(UpdateOAuthAppErrorSpec));
621
614
  const deleteOAuthApp = (id) => requestJson(OkResponseSchema, {
622
615
  method: "POST",
623
616
  path: `/v2/oauth/apps/${id}/delete`
624
- }).pipe((effect) => withOperationErrors(effect, DeleteOAuthAppErrorSpec));
617
+ }).pipe(withOperationErrors(DeleteOAuthAppErrorSpec));
625
618
  const regenerateOAuthAppToken = (id) => requestJson(OAuthRegeneratedTokenEnvelopeSchema, {
626
619
  method: "POST",
627
620
  path: `/v2/oauth/apps/${id}/regenerate_token`
628
- }).pipe(Effect.map(({ access_token }) => access_token), (effect) => withOperationErrors(effect, RegenerateOAuthAppTokenErrorSpec));
621
+ }).pipe(selectJsonField("access_token"), withOperationErrors(RegenerateOAuthAppTokenErrorSpec));
629
622
  const getPopularOAuthApps = () => requestJson(PopularOAuthAppsEnvelopeSchema, {
630
623
  method: "GET",
631
624
  path: "/v2/oauth/apps/popular"
632
- }).pipe(Effect.map(({ apps }) => apps));
625
+ }).pipe(selectJsonField("apps"));
633
626
  //#endregion
634
627
  //#region src/domains/auth.ts
635
628
  const LoginResponseSchema = Schema.Struct({
@@ -1004,10 +997,7 @@ const login = (input) => requestJson(LoginResponseSchema, {
1004
997
  client_name: input.clientName,
1005
998
  client_secret: input.clientSecret
1006
999
  }
1007
- }).pipe(Effect.map(({ access_token, user_id }) => ({
1008
- access_token,
1009
- user_id
1010
- })), (effect) => withOperationErrors(effect, LoginErrorSpec));
1000
+ }).pipe(selectJsonFields("access_token", "user_id"), withOperationErrors(LoginErrorSpec));
1011
1001
  const logout = () => requestJson(OkResponseSchema, {
1012
1002
  method: "POST",
1013
1003
  path: "/v2/oauth/grants/logout"
@@ -1020,33 +1010,33 @@ const register = (input) => requestJson(ResetPasswordEnvelopeSchema, {
1020
1010
  },
1021
1011
  method: "POST",
1022
1012
  path: "/v2/registration/register"
1023
- }).pipe(Effect.map(({ access_token }) => ({ access_token })), (effect) => withOperationErrors(effect, RegisterErrorSpec));
1013
+ }).pipe(selectJsonFields("access_token"), withOperationErrors(RegisterErrorSpec));
1024
1014
  const exists = (key, value) => requestJson(ExistsEnvelopeSchema, {
1025
1015
  auth: { type: "none" },
1026
1016
  method: "GET",
1027
1017
  path: `/v2/registration/exists/${key}`,
1028
1018
  query: { value }
1029
- }).pipe(Effect.map(({ exists }) => exists));
1019
+ }).pipe(selectJsonField("exists"));
1030
1020
  const getVoucher = (code) => requestJson(VoucherEnvelopeSchema, {
1031
1021
  auth: { type: "none" },
1032
1022
  method: "GET",
1033
1023
  path: `/v2/registration/voucher/${code}`
1034
- }).pipe(Effect.map(({ voucher }) => voucher), (effect) => withOperationErrors(effect, VoucherLookupErrorSpec));
1024
+ }).pipe(selectJsonField("voucher"), withOperationErrors(VoucherLookupErrorSpec));
1035
1025
  const getGiftCard = (code) => requestJson(GiftCardEnvelopeSchema, {
1036
1026
  auth: { type: "none" },
1037
1027
  method: "GET",
1038
1028
  path: `/v2/registration/gift_card/${code}`
1039
- }).pipe(Effect.map(({ gift_card }) => gift_card), (effect) => withOperationErrors(effect, GiftCardLookupErrorSpec));
1029
+ }).pipe(selectJsonField("gift_card"), withOperationErrors(GiftCardLookupErrorSpec));
1040
1030
  const getFamilyInvite = (code) => requestJson(FamilyInviteEnvelopeSchema, {
1041
1031
  auth: { type: "none" },
1042
1032
  method: "GET",
1043
1033
  path: `/v2/registration/family/${code}`
1044
- }).pipe(Effect.map(({ invite }) => invite), (effect) => withOperationErrors(effect, FamilyInviteLookupErrorSpec));
1034
+ }).pipe(selectJsonField("invite"), withOperationErrors(FamilyInviteLookupErrorSpec));
1045
1035
  const getFriendInvite = (code) => requestJson(FriendInviteEnvelopeSchema, {
1046
1036
  auth: { type: "none" },
1047
1037
  method: "GET",
1048
1038
  path: `/v2/registration/friend/${code}`
1049
- }).pipe(Effect.map(({ invite }) => invite), (effect) => withOperationErrors(effect, FriendInviteLookupErrorSpec));
1039
+ }).pipe(selectJsonField("invite"), withOperationErrors(FriendInviteLookupErrorSpec));
1050
1040
  const forgotPassword = (mail) => requestJson(OkResponseSchema, {
1051
1041
  auth: { type: "none" },
1052
1042
  body: {
@@ -1055,7 +1045,7 @@ const forgotPassword = (mail) => requestJson(OkResponseSchema, {
1055
1045
  },
1056
1046
  method: "POST",
1057
1047
  path: "/v2/registration/password/forgot"
1058
- }).pipe((effect) => withOperationErrors(effect, ForgotPasswordErrorSpec));
1048
+ }).pipe(withOperationErrors(ForgotPasswordErrorSpec));
1059
1049
  const resetPassword = (key, password) => requestJson(ResetPasswordEnvelopeSchema, {
1060
1050
  auth: { type: "none" },
1061
1051
  body: {
@@ -1067,7 +1057,7 @@ const resetPassword = (key, password) => requestJson(ResetPasswordEnvelopeSchema
1067
1057
  },
1068
1058
  method: "POST",
1069
1059
  path: "/v2/registration/password/reset"
1070
- }).pipe(Effect.map(({ access_token }) => ({ access_token })), (effect) => withOperationErrors(effect, ResetPasswordErrorSpec));
1060
+ }).pipe(selectJsonFields("access_token"), withOperationErrors(ResetPasswordErrorSpec));
1071
1061
  const getCode = (input) => requestJson(AuthorizationCodeEnvelopeSchema, {
1072
1062
  auth: { type: "none" },
1073
1063
  method: "GET",
@@ -1076,15 +1066,12 @@ const getCode = (input) => requestJson(AuthorizationCodeEnvelopeSchema, {
1076
1066
  app_id: input.appId,
1077
1067
  client_name: input.clientName
1078
1068
  }
1079
- }).pipe(Effect.map(({ code, qr_code_url }) => ({
1080
- code,
1081
- qr_code_url
1082
- })));
1069
+ }).pipe(selectJsonFields("code", "qr_code_url"));
1083
1070
  const checkCodeMatch = (code) => requestJson(CodeMatchEnvelopeSchema, {
1084
1071
  auth: { type: "none" },
1085
1072
  method: "GET",
1086
1073
  path: `/v2/oauth2/oob/code/${code}`
1087
- }).pipe(Effect.map(({ oauth_token }) => oauth_token));
1074
+ }).pipe(selectJsonField("oauth_token"));
1088
1075
  const linkDevice = (code) => requestJson(LinkDeviceEnvelopeSchema, {
1089
1076
  body: {
1090
1077
  type: "form",
@@ -1092,27 +1079,27 @@ const linkDevice = (code) => requestJson(LinkDeviceEnvelopeSchema, {
1092
1079
  },
1093
1080
  method: "POST",
1094
1081
  path: "/v2/oauth2/oob/code"
1095
- }).pipe(Effect.map(({ app }) => app), (effect) => withOperationErrors(effect, LinkDeviceErrorSpec));
1082
+ }).pipe(selectJsonField("app"), withOperationErrors(LinkDeviceErrorSpec));
1096
1083
  const grants = () => requestJson(GrantsEnvelopeSchema, {
1097
1084
  method: "GET",
1098
1085
  path: "/v2/oauth/grants/"
1099
- }).pipe(Effect.map(({ apps }) => apps), (effect) => withOperationErrors(effect, GrantsErrorSpec));
1086
+ }).pipe(selectJsonField("apps"), withOperationErrors(GrantsErrorSpec));
1100
1087
  const revokeApp = (id) => requestJson(OkResponseSchema, {
1101
1088
  method: "POST",
1102
1089
  path: `/v2/oauth/grants/${id}/delete`
1103
- }).pipe((effect) => withOperationErrors(effect, RevokeOAuthGrantErrorSpec));
1090
+ }).pipe(withOperationErrors(RevokeOAuthGrantErrorSpec));
1104
1091
  const clients = () => requestJson(ClientsEnvelopeSchema, {
1105
1092
  method: "GET",
1106
1093
  path: "/v2/oauth/clients/"
1107
- }).pipe(Effect.map(({ clients }) => clients), (effect) => withOperationErrors(effect, ClientsErrorSpec));
1094
+ }).pipe(selectJsonField("clients"), withOperationErrors(ClientsErrorSpec));
1108
1095
  const revokeClient = (id) => requestJson(OkResponseSchema, {
1109
1096
  method: "POST",
1110
1097
  path: `/v2/oauth/clients/${id}/delete`
1111
- }).pipe((effect) => withOperationErrors(effect, RevokeOAuthClientErrorSpec));
1098
+ }).pipe(withOperationErrors(RevokeOAuthClientErrorSpec));
1112
1099
  const revokeAllClients = () => requestJson(OkResponseSchema, {
1113
1100
  method: "POST",
1114
1101
  path: "/v2/oauth/clients/delete-all"
1115
- }).pipe((effect) => withOperationErrors(effect, RevokeAllOAuthClientsErrorSpec));
1102
+ }).pipe(withOperationErrors(RevokeAllOAuthClientsErrorSpec));
1116
1103
  const validateToken = (token) => requestJson(ValidateTokenResponseSchema, {
1117
1104
  auth: { type: "none" },
1118
1105
  method: "GET",
@@ -1126,7 +1113,7 @@ const generateTOTP = () => requestJson(GenerateTOTPEnvelopeSchema, {
1126
1113
  recovery_codes,
1127
1114
  secret,
1128
1115
  uri
1129
- })), (effect) => withOperationErrors(effect, GenerateTOTPErrorSpec));
1116
+ })), withOperationErrors(GenerateTOTPErrorSpec));
1130
1117
  const verifyTOTP = (twoFactorScopedToken, code) => requestJson(VerifyTOTPEnvelopeSchema, {
1131
1118
  auth: { type: "none" },
1132
1119
  body: {
@@ -1139,15 +1126,15 @@ const verifyTOTP = (twoFactorScopedToken, code) => requestJson(VerifyTOTPEnvelop
1139
1126
  }).pipe(Effect.map(({ token, user_id }) => ({
1140
1127
  token,
1141
1128
  user_id
1142
- })), (effect) => withOperationErrors(effect, VerifyTOTPErrorSpec));
1129
+ })), withOperationErrors(VerifyTOTPErrorSpec));
1143
1130
  const getRecoveryCodes = () => requestJson(RecoveryCodesEnvelopeSchema, {
1144
1131
  method: "GET",
1145
1132
  path: "/v2/two_factor/recovery_codes"
1146
- }).pipe(Effect.map(({ recovery_codes }) => recovery_codes), (effect) => withOperationErrors(effect, RecoveryCodesErrorSpec));
1133
+ }).pipe(selectJsonField("recovery_codes"), withOperationErrors(RecoveryCodesErrorSpec));
1147
1134
  const regenerateRecoveryCodes = () => requestJson(RecoveryCodesEnvelopeSchema, {
1148
1135
  method: "POST",
1149
1136
  path: "/v2/two_factor/recovery_codes/refresh"
1150
- }).pipe(Effect.map(({ recovery_codes }) => recovery_codes), (effect) => withOperationErrors(effect, RegenerateRecoveryCodesErrorSpec));
1137
+ }).pipe(selectJsonField("recovery_codes"), withOperationErrors(RegenerateRecoveryCodesErrorSpec));
1151
1138
  //#endregion
1152
1139
  //#region src/domains/config.ts
1153
1140
  const isJsonValue = (value) => {
@@ -1170,14 +1157,14 @@ const ConfigValueEnvelopeSchema = Schema.Struct({
1170
1157
  const readConfig = () => requestJson(ConfigEnvelopeSchema, {
1171
1158
  method: "GET",
1172
1159
  path: "/v2/config"
1173
- }).pipe(Effect.map(({ config }) => config));
1160
+ }).pipe(selectJsonField("config"));
1174
1161
  const readConfigWith = (schema) => requestJson(Schema.Struct({
1175
1162
  config: schema,
1176
1163
  status: Schema.Literal("OK")
1177
1164
  }), {
1178
1165
  method: "GET",
1179
1166
  path: "/v2/config"
1180
- }).pipe(Effect.map(({ config }) => config));
1167
+ }).pipe(selectJsonField("config"));
1181
1168
  const writeConfig = (config) => requestJson(OkResponseSchema, {
1182
1169
  body: {
1183
1170
  type: "json",
@@ -1189,14 +1176,14 @@ const writeConfig = (config) => requestJson(OkResponseSchema, {
1189
1176
  const getConfigKey = (key) => requestJson(ConfigValueEnvelopeSchema, {
1190
1177
  method: "GET",
1191
1178
  path: `/v2/config/${key}`
1192
- }).pipe(Effect.map(({ value }) => value));
1179
+ }).pipe(selectJsonField("value"));
1193
1180
  const getConfigKeyWith = (key, schema) => requestJson(Schema.Struct({
1194
1181
  status: Schema.Literal("OK"),
1195
1182
  value: schema
1196
1183
  }), {
1197
1184
  method: "GET",
1198
1185
  path: `/v2/config/${key}`
1199
- }).pipe(Effect.map(({ value }) => value));
1186
+ }).pipe(selectJsonField("value"));
1200
1187
  const setConfigKey = (key, value) => requestJson(OkResponseSchema, {
1201
1188
  body: {
1202
1189
  type: "json",
@@ -1210,6 +1197,17 @@ const deleteConfigKey = (key) => requestJson(OkResponseSchema, {
1210
1197
  path: `/v2/config/${key}`
1211
1198
  });
1212
1199
  //#endregion
1200
+ //#region src/core/forms.ts
1201
+ const joinCsv = (values) => values && values.length > 0 ? values.join(",") : void 0;
1202
+ const toCursorSelectionForm = (selection, idsFieldName) => {
1203
+ const resolvedIdsFieldName = idsFieldName ?? "file_ids";
1204
+ return {
1205
+ cursor: selection.cursor,
1206
+ exclude_ids: joinCsv(selection.excludeIds),
1207
+ [resolvedIdsFieldName]: joinCsv(selection.ids)
1208
+ };
1209
+ };
1210
+ //#endregion
1213
1211
  //#region src/domains/download-links.ts
1214
1212
  const DownloadLinksStatusSchema = Schema.Literal("NEW", "PROCESSING", "DONE", "ERROR");
1215
1213
  const DownloadLinksCreateInputSchema = Schema.Struct({
@@ -1290,19 +1288,15 @@ const GetDownloadLinksErrorSpec = definePutioOperationErrorSpec({
1290
1288
  const createDownloadLinks = (input = {}) => requestJson(DownloadLinksCreateEnvelopeSchema, {
1291
1289
  body: {
1292
1290
  type: "form",
1293
- value: {
1294
- cursor: input.cursor,
1295
- exclude_ids: input.excludeIds?.join(","),
1296
- file_ids: input.ids?.join(",")
1297
- }
1291
+ value: toCursorSelectionForm(input)
1298
1292
  },
1299
1293
  method: "POST",
1300
1294
  path: "/v2/download_links/create"
1301
- }).pipe(Effect.map(({ id }) => ({ id })), (effect) => withOperationErrors(effect, CreateDownloadLinksErrorSpec));
1295
+ }).pipe(selectJsonFields("id"), withOperationErrors(CreateDownloadLinksErrorSpec));
1302
1296
  const getDownloadLinks = (id) => requestJson(DownloadLinksInfoSchema, {
1303
1297
  method: "GET",
1304
1298
  path: `/v2/download_links/${id}`
1305
- }).pipe((effect) => withOperationErrors(effect, GetDownloadLinksErrorSpec));
1299
+ }).pipe(withOperationErrors(GetDownloadLinksErrorSpec));
1306
1300
  //#endregion
1307
1301
  //#region src/domains/events.ts
1308
1302
  const HistoryEventBaseSchema = Schema.Struct({
@@ -1430,19 +1424,19 @@ const listEvents = (query = {}) => requestJson(EventsListEnvelopeSchema, {
1430
1424
  method: "GET",
1431
1425
  path: "/v2/events/list",
1432
1426
  query
1433
- }).pipe((effect) => withOperationErrors(effect, ListEventsErrorSpec));
1427
+ }).pipe(withOperationErrors(ListEventsErrorSpec));
1434
1428
  const deleteEvent = (id) => requestJson(OkResponseSchema, {
1435
1429
  method: "POST",
1436
1430
  path: `/v2/events/delete/${id}`
1437
- }).pipe((effect) => withOperationErrors(effect, DeleteEventErrorSpec));
1431
+ }).pipe(withOperationErrors(DeleteEventErrorSpec));
1438
1432
  const clearEvents = () => requestJson(OkResponseSchema, {
1439
1433
  method: "POST",
1440
1434
  path: "/v2/events/delete"
1441
- }).pipe((effect) => withOperationErrors(effect, ClearEventsErrorSpec));
1435
+ }).pipe(withOperationErrors(ClearEventsErrorSpec));
1442
1436
  const getEventTorrent = (id) => requestArrayBuffer({
1443
1437
  method: "GET",
1444
1438
  path: `/v2/events/${id}/torrent`
1445
- }).pipe((effect) => withOperationErrors(effect, GetEventTorrentErrorSpec));
1439
+ }).pipe(withOperationErrors(GetEventTorrentErrorSpec));
1446
1440
  //#endregion
1447
1441
  //#region src/domains/family.ts
1448
1442
  const NonNegativeIntegerSchema = Schema.Number.pipe(Schema.int(), Schema.nonNegative());
@@ -1552,27 +1546,23 @@ const JoinFamilyErrorSpec = definePutioOperationErrorSpec({
1552
1546
  const listFamilyInvites = () => requestJson(FamilyInvitesEnvelopeSchema, {
1553
1547
  method: "GET",
1554
1548
  path: "/v2/family/invites"
1555
- }).pipe(Effect.map(({ invites, limit, remaining_limit }) => ({
1556
- invites,
1557
- limit,
1558
- remaining_limit
1559
- })), (effect) => withOperationErrors(effect, ListFamilyInvitesErrorSpec));
1549
+ }).pipe(selectJsonFields("invites", "limit", "remaining_limit"), withOperationErrors(ListFamilyInvitesErrorSpec));
1560
1550
  const listFamilyMembers = () => requestJson(FamilyMembersEnvelopeSchema, {
1561
1551
  method: "GET",
1562
1552
  path: "/v2/family/members"
1563
- }).pipe(Effect.map(({ members }) => members), (effect) => withOperationErrors(effect, ListFamilyMembersErrorSpec));
1553
+ }).pipe(selectJsonField("members"), withOperationErrors(ListFamilyMembersErrorSpec));
1564
1554
  const createFamilyInvite = () => requestJson(FamilyCreateInviteEnvelopeSchema, {
1565
1555
  method: "POST",
1566
1556
  path: "/v2/family/sub_account"
1567
- }).pipe(Effect.map(({ code }) => ({ code })), (effect) => withOperationErrors(effect, CreateFamilyInviteErrorSpec));
1557
+ }).pipe(selectJsonFields("code"), withOperationErrors(CreateFamilyInviteErrorSpec));
1568
1558
  const removeFamilyMember = (username) => requestJson(OkResponseSchema, {
1569
1559
  method: "DELETE",
1570
1560
  path: `/v2/family/sub_account/${encodeURIComponent(username)}`
1571
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, RemoveFamilyMemberErrorSpec));
1561
+ }).pipe(Effect.asVoid, withOperationErrors(RemoveFamilyMemberErrorSpec));
1572
1562
  const joinFamily = (inviteCode) => requestJson(OkResponseSchema, {
1573
1563
  method: "POST",
1574
1564
  path: `/v2/family/join/${encodeURIComponent(inviteCode)}`
1575
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, JoinFamilyErrorSpec));
1565
+ }).pipe(Effect.asVoid, withOperationErrors(JoinFamilyErrorSpec));
1576
1566
  //#endregion
1577
1567
  //#region src/domains/ifttt.ts
1578
1568
  const IFTTTStatusEnvelopeSchema = Schema.Struct({
@@ -1607,7 +1597,7 @@ const SendIftttEventErrorSpec = definePutioOperationErrorSpec({
1607
1597
  const getIftttStatus = () => requestJson(IFTTTStatusEnvelopeSchema, {
1608
1598
  method: "GET",
1609
1599
  path: "/v2/ifttt-client/status"
1610
- }).pipe(Effect.map(({ enabled }) => ({ enabled })), (effect) => withOperationErrors(effect, GetIftttStatusErrorSpec));
1600
+ }).pipe(selectJsonFields("enabled"), withOperationErrors(GetIftttStatusErrorSpec));
1611
1601
  const sendIftttEvent = (input) => requestJson(OkResponseSchema, {
1612
1602
  body: {
1613
1603
  type: "form",
@@ -1619,7 +1609,7 @@ const sendIftttEvent = (input) => requestJson(OkResponseSchema, {
1619
1609
  },
1620
1610
  method: "POST",
1621
1611
  path: "/v2/ifttt-client/event"
1622
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, SendIftttEventErrorSpec));
1612
+ }).pipe(Effect.asVoid, withOperationErrors(SendIftttEventErrorSpec));
1623
1613
  //#endregion
1624
1614
  //#region src/domains/files.ts
1625
1615
  const RequestedFlag = Schema.Literal(1);
@@ -2083,19 +2073,16 @@ const FileUploadErrorSpec = definePutioOperationErrorSpec({
2083
2073
  ]
2084
2074
  });
2085
2075
  const missingFieldError = (field) => new PutioValidationError({ cause: `Expected put.io to include "${field}" because it was requested` });
2076
+ const failMissingField = (field) => Effect.fail(missingFieldError(field));
2077
+ const widenValidationError = (effect) => effect;
2086
2078
  const normalizeFilesSearchQuery = (query) => {
2087
- const type = query.type === void 0 || typeof query.type === "string" ? query.type : query.type.join(",");
2079
+ const type = query.type === void 0 || typeof query.type === "string" ? query.type : joinCsv(query.type);
2088
2080
  return {
2089
2081
  per_page: query.per_page,
2090
2082
  query: query.query,
2091
2083
  type
2092
2084
  };
2093
2085
  };
2094
- const selectionToForm = (selection, idsFieldName = "file_ids") => ({
2095
- cursor: selection.cursor,
2096
- exclude_ids: selection.excludeIds?.join(","),
2097
- [idsFieldName]: selection.ids?.join(",")
2098
- });
2099
2086
  const hasStreamUrl = (value) => "stream_url" in value;
2100
2087
  const hasMp4StreamUrl = (value) => "mp4_stream_url" in value;
2101
2088
  const hasMp4StreamUrlWhenAvailable = (value) => !value.is_mp4_available || hasMp4StreamUrl(value);
@@ -2105,10 +2092,13 @@ const hasMediaMetadata = (value) => "media_metadata" in value;
2105
2092
  const hasCodecs = (value) => "content_type_and_codecs" in value;
2106
2093
  const hasMediaInfo = (value) => "media_info" in value;
2107
2094
  const useTunnelToQuery = (useTunnel) => useTunnel === false ? { notunnel: 1 } : {};
2108
- const resolveRouteToken = (oauthToken) => Effect.gen(function* () {
2109
- if (oauthToken) return oauthToken;
2095
+ const resolveRouteContext = (oauthToken) => Effect.gen(function* () {
2110
2096
  const config = yield* PutioSdkConfig;
2111
- if (config.accessToken) return config.accessToken;
2097
+ const resolvedOauthToken = oauthToken ?? config.accessToken;
2098
+ if (resolvedOauthToken) return {
2099
+ config,
2100
+ oauthToken: resolvedOauthToken
2101
+ };
2112
2102
  return yield* Effect.fail(mapConfigurationError("This helper requires an oauth token, but neither an override nor PutioSdkConfig.accessToken was provided"));
2113
2103
  });
2114
2104
  const normalizeFileName = (name) => encodeURIComponent(name);
@@ -2140,7 +2130,7 @@ const buildFileHlsStreamUrl = (baseUrl, fileId, options = {}) => buildPutioUrl(b
2140
2130
  max_subtitle_count: options.maxSubtitleCount,
2141
2131
  oauth_token: options.oauthToken,
2142
2132
  original: typeof options.playOriginal === "boolean" ? options.playOriginal ? 1 : 0 : void 0,
2143
- subtitle_languages: options.subtitleLanguages?.join(",")
2133
+ subtitle_languages: joinCsv(options.subtitleLanguages)
2144
2134
  });
2145
2135
  const createFileUploadFormData = (input) => {
2146
2136
  const formData = new FormData();
@@ -2149,17 +2139,17 @@ const createFileUploadFormData = (input) => {
2149
2139
  if (input.parentId !== void 0) formData.append("parent_id", String(input.parentId));
2150
2140
  return formData;
2151
2141
  };
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
- };
2142
+ const ensureFileQueryFields = (effect, query) => Effect.gen(function* () {
2143
+ const file = yield* widenValidationError(effect);
2144
+ if (query.stream_url === 1 && !hasStreamUrl(file)) return yield* failMissingField("stream_url");
2145
+ 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");
2146
+ if (query.mp4_stream_url === 1 && !hasMp4StreamUrlWhenAvailable(file)) return yield* failMissingField("mp4_stream_url");
2147
+ if (query.video_metadata === 1 && query.media_metadata !== 1 && !hasVideoMetadata(file)) return yield* failMissingField("video_metadata");
2148
+ if (query.media_metadata === 1 && !hasMediaMetadata(file)) return yield* failMissingField("media_metadata");
2149
+ if (query.codecs === 1 && !hasCodecs(file)) return yield* failMissingField("content_type_and_codecs");
2150
+ if (query.media_info === 1 && !hasMediaInfo(file)) return yield* failMissingField("media_info");
2151
+ return file;
2152
+ });
2163
2153
  const queryFiles = (parent, query = {}) => requestJson(FilesListEnvelopeSchema, {
2164
2154
  method: "GET",
2165
2155
  path: parent === "friends" ? "/v2/files/list/items-shared-with-you" : "/v2/files/list",
@@ -2167,7 +2157,7 @@ const queryFiles = (parent, query = {}) => requestJson(FilesListEnvelopeSchema,
2167
2157
  ...query,
2168
2158
  parent_id: parent
2169
2159
  }
2170
- }).pipe((effect) => withOperationErrors(effect, QueryFilesErrorSpec));
2160
+ }).pipe(withOperationErrors(QueryFilesErrorSpec));
2171
2161
  const continueFiles = (cursor, query = {}) => requestJson(FilesListContinueEnvelopeSchema, {
2172
2162
  body: {
2173
2163
  type: "form",
@@ -2176,20 +2166,21 @@ const continueFiles = (cursor, query = {}) => requestJson(FilesListContinueEnvel
2176
2166
  method: "POST",
2177
2167
  path: "/v2/files/list/continue",
2178
2168
  query
2179
- }).pipe((effect) => withOperationErrors(effect, ContinueFilesErrorSpec));
2169
+ }).pipe(withOperationErrors(ContinueFilesErrorSpec));
2180
2170
  function getFile(input) {
2181
- const query = input.query ?? {};
2182
- return ensureFileQueryFields(requestJson(FileEnvelopeSchema, {
2171
+ const effect = requestJson(FileEnvelopeSchema, {
2183
2172
  method: "GET",
2184
2173
  path: `/v2/files/${input.id}`,
2185
- query
2186
- }).pipe(Effect.map(({ file }) => file), (requestEffect) => withOperationErrors(requestEffect, GetFileErrorSpec)), query);
2174
+ query: input.query
2175
+ }).pipe(selectJsonField("file"), withOperationErrors(GetFileErrorSpec));
2176
+ if (input.query === void 0) return effect;
2177
+ return ensureFileQueryFields(effect, input.query);
2187
2178
  }
2188
2179
  const searchFiles = (query) => requestJson(FilesSearchEnvelopeSchema, {
2189
2180
  method: "GET",
2190
2181
  path: "/v2/files/search",
2191
2182
  query: normalizeFilesSearchQuery(query)
2192
- }).pipe((effect) => withOperationErrors(effect, SearchFilesErrorSpec));
2183
+ }).pipe(withOperationErrors(SearchFilesErrorSpec));
2193
2184
  const continueSearch = (cursor, query = {}) => requestJson(FilesSearchEnvelopeSchema, {
2194
2185
  body: {
2195
2186
  type: "form",
@@ -2198,7 +2189,7 @@ const continueSearch = (cursor, query = {}) => requestJson(FilesSearchEnvelopeSc
2198
2189
  method: "POST",
2199
2190
  path: "/v2/files/search/continue",
2200
2191
  query
2201
- }).pipe((effect) => withOperationErrors(effect, SearchFilesErrorSpec));
2192
+ }).pipe(withOperationErrors(SearchFilesErrorSpec));
2202
2193
  const createFolder = (input) => requestJson(FileEnvelopeSchema, {
2203
2194
  body: {
2204
2195
  type: "form",
@@ -2206,7 +2197,7 @@ const createFolder = (input) => requestJson(FileEnvelopeSchema, {
2206
2197
  },
2207
2198
  method: "POST",
2208
2199
  path: "/v2/files/create-folder"
2209
- }).pipe(Effect.map(({ file }) => file), (effect) => withOperationErrors(effect, CreateFolderErrorSpec));
2200
+ }).pipe(selectJsonField("file"), withOperationErrors(CreateFolderErrorSpec));
2210
2201
  const renameFile = (input) => requestJson(OkResponseSchema, {
2211
2202
  body: {
2212
2203
  type: "form",
@@ -2214,11 +2205,11 @@ const renameFile = (input) => requestJson(OkResponseSchema, {
2214
2205
  },
2215
2206
  method: "POST",
2216
2207
  path: "/v2/files/rename"
2217
- }).pipe((effect) => withOperationErrors(effect, RenameFileErrorSpec));
2208
+ }).pipe(withOperationErrors(RenameFileErrorSpec));
2218
2209
  const deleteFiles = (ids, options = {}) => requestJson(FileDeleteResultEnvelopeSchema, {
2219
2210
  body: {
2220
2211
  type: "form",
2221
- value: { file_ids: ids.join(",") }
2212
+ value: { file_ids: joinCsv(ids) }
2222
2213
  },
2223
2214
  method: "POST",
2224
2215
  path: "/v2/files/delete",
@@ -2232,7 +2223,7 @@ const deleteFiles = (ids, options = {}) => requestJson(FileDeleteResultEnvelopeS
2232
2223
  const deleteFileSelection = (selection, options = {}) => requestJson(FileDeleteResultEnvelopeSchema, {
2233
2224
  body: {
2234
2225
  type: "form",
2235
- value: selectionToForm(selection)
2226
+ value: toCursorSelectionForm(selection)
2236
2227
  },
2237
2228
  method: "POST",
2238
2229
  path: "/v2/files/delete",
@@ -2246,53 +2237,53 @@ const moveFiles = (ids, parentId) => requestJson(FilesMoveEnvelopeSchema, {
2246
2237
  body: {
2247
2238
  type: "form",
2248
2239
  value: {
2249
- file_ids: ids.join(","),
2240
+ file_ids: joinCsv(ids),
2250
2241
  parent_id: parentId
2251
2242
  }
2252
2243
  },
2253
2244
  method: "POST",
2254
2245
  path: "/v2/files/move"
2255
- }).pipe(Effect.map(({ errors }) => errors));
2246
+ }).pipe(selectJsonField("errors"));
2256
2247
  const moveFileSelection = (selection, parentId) => requestJson(FilesMoveEnvelopeSchema, {
2257
2248
  body: {
2258
2249
  type: "form",
2259
2250
  value: {
2260
- ...selectionToForm(selection),
2251
+ ...toCursorSelectionForm(selection),
2261
2252
  parent_id: parentId
2262
2253
  }
2263
2254
  },
2264
2255
  method: "POST",
2265
2256
  path: "/v2/files/move"
2266
- }).pipe(Effect.map(({ errors }) => errors));
2257
+ }).pipe(selectJsonField("errors"));
2267
2258
  const getStartFrom = (fileId) => requestJson(FileStartFromEnvelopeSchema, {
2268
2259
  method: "GET",
2269
2260
  path: `/v2/files/${fileId}/start-from`
2270
- }).pipe(Effect.map(({ start_from }) => start_from), (effect) => withOperationErrors(effect, StartFromErrorSpec));
2261
+ }).pipe(selectJsonField("start_from"), withOperationErrors(StartFromErrorSpec));
2271
2262
  const getDownloadUrl = (fileId) => requestJson(FileDownloadUrlEnvelopeSchema, {
2272
2263
  method: "GET",
2273
2264
  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, {
2265
+ }).pipe(selectJsonField("url"), withOperationErrors(DownloadUrlErrorSpec));
2266
+ const getApiDownloadUrl = (fileId, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileApiDownloadUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2276
2267
  ...options,
2277
2268
  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, {
2269
+ })));
2270
+ const getApiContentUrl = (fileId, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileApiContentUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2280
2271
  ...options,
2281
2272
  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, {
2273
+ })));
2274
+ const getApiMp4DownloadUrl = (fileId, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileApiMp4DownloadUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2284
2275
  ...options,
2285
2276
  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, {
2277
+ })));
2278
+ const getHlsStreamUrl = (fileId, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => buildFileHlsStreamUrl(config.baseUrl ?? "https://api.put.io", fileId, {
2288
2279
  ...options,
2289
2280
  oauthToken
2290
- }))));
2281
+ })));
2291
2282
  const listFileSubtitles = (fileId, options = {}) => requestJson(FileSubtitlesEnvelopeSchema, {
2292
2283
  method: "GET",
2293
2284
  path: `/v2/files/${fileId}/subtitles`,
2294
- query: options.languages ? { languages: options.languages.join(",") } : void 0
2295
- }).pipe((effect) => withOperationErrors(effect, FileSubtitlesErrorSpec));
2285
+ query: options.languages ? { languages: joinCsv(options.languages) } : void 0
2286
+ }).pipe(withOperationErrors(FileSubtitlesErrorSpec));
2296
2287
  const setStartFrom = (input) => requestJson(OkResponseSchema, {
2297
2288
  body: {
2298
2289
  type: "form",
@@ -2300,73 +2291,73 @@ const setStartFrom = (input) => requestJson(OkResponseSchema, {
2300
2291
  },
2301
2292
  method: "POST",
2302
2293
  path: `/v2/files/${input.file_id}/start-from/set`
2303
- }).pipe((effect) => withOperationErrors(effect, StartFromErrorSpec));
2294
+ }).pipe(withOperationErrors(StartFromErrorSpec));
2304
2295
  const resetStartFrom = (fileId) => requestJson(OkResponseSchema, {
2305
2296
  method: "GET",
2306
2297
  path: `/v2/files/${fileId}/start-from/delete`
2307
- }).pipe((effect) => withOperationErrors(effect, StartFromErrorSpec));
2298
+ }).pipe(withOperationErrors(StartFromErrorSpec));
2308
2299
  const getMp4Status = (fileId) => requestJson(FileConversionStatusEnvelopeSchema, {
2309
2300
  method: "GET",
2310
2301
  path: `/v2/files/${fileId}/mp4`
2311
- }).pipe(Effect.map(({ mp4 }) => mp4), (effect) => withOperationErrors(effect, FileMp4ErrorSpec));
2302
+ }).pipe(selectJsonField("mp4"), withOperationErrors(FileMp4ErrorSpec));
2312
2303
  const convertFileToMp4 = (fileId) => requestJson(FileConversionStatusEnvelopeSchema, {
2313
2304
  method: "POST",
2314
2305
  path: `/v2/files/${fileId}/mp4`
2315
- }).pipe(Effect.map(({ mp4 }) => mp4), (effect) => withOperationErrors(effect, FileMp4ErrorSpec));
2306
+ }).pipe(selectJsonField("mp4"), withOperationErrors(FileMp4ErrorSpec));
2316
2307
  const deleteFileMp4 = (fileId) => requestVoid({
2317
2308
  method: "DELETE",
2318
2309
  path: `/v2/files/${fileId}/mp4`
2319
- }).pipe((effect) => withOperationErrors(effect, FileMp4MutationErrorSpec));
2310
+ }).pipe(withOperationErrors(FileMp4MutationErrorSpec));
2320
2311
  const putMp4ToMyFiles = (fileId) => requestVoid({
2321
2312
  method: "GET",
2322
2313
  path: `/v2/files/${fileId}/put-mp4-to-my-folders`
2323
- }).pipe((effect) => withOperationErrors(effect, FileMp4MutationErrorSpec));
2314
+ }).pipe(withOperationErrors(FileMp4MutationErrorSpec));
2324
2315
  const convertFilesToMp4 = (ids) => requestJson(FilesBulkConvertEnvelopeSchema, {
2325
2316
  body: {
2326
2317
  type: "form",
2327
- value: { file_ids: ids.join(",") }
2318
+ value: { file_ids: joinCsv(ids) }
2328
2319
  },
2329
2320
  method: "POST",
2330
2321
  path: "/v2/files/convert_mp4"
2331
- }).pipe(Effect.map(({ count }) => count));
2322
+ }).pipe(selectJsonField("count"));
2332
2323
  const convertFileSelectionToMp4 = (selection) => requestJson(FilesBulkConvertEnvelopeSchema, {
2333
2324
  body: {
2334
2325
  type: "form",
2335
- value: selectionToForm(selection)
2326
+ value: toCursorSelectionForm(selection)
2336
2327
  },
2337
2328
  method: "POST",
2338
2329
  path: "/v2/files/convert_mp4"
2339
- }).pipe(Effect.map(({ count }) => count));
2330
+ }).pipe(selectJsonField("count"));
2340
2331
  const listActiveMp4Conversions = () => requestJson(FileActiveConversionsEnvelopeSchema, {
2341
2332
  method: "GET",
2342
2333
  path: "/v2/mp4/queue"
2343
- }).pipe(Effect.map(({ mp4s }) => mp4s), (effect) => withOperationErrors(effect, FileActiveConversionsErrorSpec));
2334
+ }).pipe(selectJsonField("mp4s"), withOperationErrors(FileActiveConversionsErrorSpec));
2344
2335
  const setFilesWatchStatus = (selection) => requestVoid({
2345
2336
  body: {
2346
2337
  type: "form",
2347
2338
  value: {
2348
- ...selectionToForm(selection),
2339
+ ...toCursorSelectionForm(selection),
2349
2340
  watched: selection.watched
2350
2341
  }
2351
2342
  },
2352
2343
  method: "POST",
2353
2344
  path: "/v2/files/watch-status"
2354
- }).pipe((effect) => withOperationErrors(effect, FileWatchStatusErrorSpec));
2345
+ }).pipe(withOperationErrors(FileWatchStatusErrorSpec));
2355
2346
  const extractFiles = (selection) => requestJson(FileExtractionsEnvelopeSchema, {
2356
2347
  body: {
2357
2348
  type: "form",
2358
2349
  value: {
2359
- ...selectionToForm(selection, "user_file_ids"),
2350
+ ...toCursorSelectionForm(selection, "user_file_ids"),
2360
2351
  password: selection.password
2361
2352
  }
2362
2353
  },
2363
2354
  method: "POST",
2364
2355
  path: "/v2/files/extract"
2365
- }).pipe(Effect.map(({ extractions }) => extractions), (effect) => withOperationErrors(effect, FileExtractionsErrorSpec));
2356
+ }).pipe(selectJsonField("extractions"), withOperationErrors(FileExtractionsErrorSpec));
2366
2357
  const listFileExtractions = () => requestJson(FileExtractionsEnvelopeSchema, {
2367
2358
  method: "GET",
2368
2359
  path: "/v2/files/extract"
2369
- }).pipe(Effect.map(({ extractions }) => extractions), (effect) => withOperationErrors(effect, FileExtractionsErrorSpec));
2360
+ }).pipe(selectJsonField("extractions"), withOperationErrors(FileExtractionsErrorSpec));
2370
2361
  const deleteFileExtraction = (extractionId) => requestVoid({
2371
2362
  method: "DELETE",
2372
2363
  path: `/v2/files/extract/${extractionId}`
@@ -2375,22 +2366,19 @@ const findNextFile = (fileId, fileType) => requestJson(FilesNextFileEnvelopeSche
2375
2366
  method: "GET",
2376
2367
  path: `/v2/files/${fileId}/next-file`,
2377
2368
  query: { file_type: fileType }
2378
- }).pipe(Effect.map(({ next_file }) => next_file));
2369
+ }).pipe(selectJsonField("next_file"));
2379
2370
  const findNextVideo = (fileId) => requestJson(FilesNextVideoEnvelopeSchema, {
2380
2371
  method: "GET",
2381
2372
  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) => ({
2373
+ }).pipe(selectJsonField("next_video"));
2374
+ const createFileUploadRequest = (input, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.map(({ config, oauthToken }) => ({
2384
2375
  body: createFileUploadFormData(input),
2385
2376
  method: "POST",
2386
2377
  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, {
2378
+ })));
2379
+ const uploadFile = (input, options = {}) => resolveRouteContext(options.oauthToken).pipe(Effect.flatMap(({ config, oauthToken }) => requestJson(FileUploadEnvelopeSchema, {
2392
2380
  auth: { type: "none" },
2393
- baseUrl: uploadBaseUrl,
2381
+ baseUrl: config.uploadBaseUrl ?? "https://upload.put.io",
2394
2382
  body: {
2395
2383
  type: "form-data",
2396
2384
  value: createFileUploadFormData(input)
@@ -2398,7 +2386,7 @@ const uploadFile = (input, options = {}) => resolveRouteToken(options.oauthToken
2398
2386
  method: "POST",
2399
2387
  path: "/v2/files/upload",
2400
2388
  query: { oauth_token: oauthToken }
2401
- })), Effect.map(toUploadResult), (effect) => withOperationErrors(effect, FileUploadErrorSpec));
2389
+ })), Effect.map(toUploadResult), withOperationErrors(FileUploadErrorSpec));
2402
2390
  //#endregion
2403
2391
  //#region src/domains/friend-invites.ts
2404
2392
  const FriendInviteJoinedUserStatusSchema = Schema.Literal("CONVERTED", "IN_TRIAL", "TRIAL_ENDED", "TRIAL_NOT_STARTED", "UNKNOWN");
@@ -2453,14 +2441,11 @@ const CreateFriendInviteErrorSpec = definePutioOperationErrorSpec({
2453
2441
  const listFriendInvites = () => requestJson(FriendInvitesListEnvelopeSchema, {
2454
2442
  method: "GET",
2455
2443
  path: "/v2/account/friend_invites"
2456
- }).pipe(Effect.map(({ invites, remaining_limit }) => ({
2457
- invites,
2458
- remaining_limit
2459
- })), (effect) => withOperationErrors(effect, ListFriendInvitesErrorSpec));
2444
+ }).pipe(selectJsonFields("invites", "remaining_limit"), withOperationErrors(ListFriendInvitesErrorSpec));
2460
2445
  const createFriendInvite = () => requestJson(FriendInviteCreateEnvelopeSchema, {
2461
2446
  method: "POST",
2462
2447
  path: "/v2/account/create_friend_invitation"
2463
- }).pipe(Effect.map(({ code }) => ({ code })), (effect) => withOperationErrors(effect, CreateFriendInviteErrorSpec));
2448
+ }).pipe(selectJsonFields("code"), withOperationErrors(CreateFriendInviteErrorSpec));
2464
2449
  //#endregion
2465
2450
  //#region src/domains/friends.ts
2466
2451
  const FriendBaseSchema = Schema.Struct({
@@ -2612,46 +2597,43 @@ const FriendSharedFolderErrorSpec = definePutioOperationErrorSpec({
2612
2597
  const listFriends = () => requestJson(FriendsListEnvelopeSchema, {
2613
2598
  method: "GET",
2614
2599
  path: "/v2/friends/list"
2615
- }).pipe(Effect.map(({ friends, total }) => ({
2616
- friends,
2617
- total
2618
- })), (effect) => withOperationErrors(effect, ListFriendsErrorSpec));
2600
+ }).pipe(selectJsonFields("friends", "total"), withOperationErrors(ListFriendsErrorSpec));
2619
2601
  const searchFriends = (username) => requestJson(FriendSearchEnvelopeSchema, {
2620
2602
  method: "GET",
2621
2603
  path: `/v2/friends/user-search/${encodeURIComponent(username)}`
2622
- }).pipe(Effect.map(({ users }) => users), (effect) => withOperationErrors(effect, SearchFriendsErrorSpec));
2604
+ }).pipe(selectJsonField("users"), withOperationErrors(SearchFriendsErrorSpec));
2623
2605
  const listWaitingRequests = () => requestJson(FriendRequestsEnvelopeSchema, {
2624
2606
  method: "GET",
2625
2607
  path: "/v2/friends/waiting-requests"
2626
- }).pipe(Effect.map(({ friends }) => friends), (effect) => withOperationErrors(effect, ListWaitingRequestsErrorSpec));
2608
+ }).pipe(selectJsonField("friends"), withOperationErrors(ListWaitingRequestsErrorSpec));
2627
2609
  const countWaitingRequests = () => requestJson(FriendRequestsCountEnvelopeSchema, {
2628
2610
  method: "GET",
2629
2611
  path: "/v2/friends/waiting-requests-count"
2630
- }).pipe(Effect.map(({ count }) => count), (effect) => withOperationErrors(effect, CountWaitingRequestsErrorSpec));
2612
+ }).pipe(selectJsonField("count"), withOperationErrors(CountWaitingRequestsErrorSpec));
2631
2613
  const listSentRequests = () => requestJson(FriendRequestsEnvelopeSchema, {
2632
2614
  method: "GET",
2633
2615
  path: "/v2/friends/sent-requests"
2634
- }).pipe(Effect.map(({ friends }) => friends), (effect) => withOperationErrors(effect, ListSentRequestsErrorSpec));
2616
+ }).pipe(selectJsonField("friends"), withOperationErrors(ListSentRequestsErrorSpec));
2635
2617
  const sendFriendRequest = (username) => requestJson(OkResponseSchema, {
2636
2618
  method: "POST",
2637
2619
  path: `/v2/friends/${encodeURIComponent(username)}/request`
2638
- }).pipe((effect) => withOperationErrors(effect, SendFriendRequestErrorSpec));
2620
+ }).pipe(withOperationErrors(SendFriendRequestErrorSpec));
2639
2621
  const removeFriend = (username) => requestJson(OkResponseSchema, {
2640
2622
  method: "POST",
2641
2623
  path: `/v2/friends/${encodeURIComponent(username)}/unfriend`
2642
- }).pipe((effect) => withOperationErrors(effect, RemoveFriendErrorSpec));
2624
+ }).pipe(withOperationErrors(RemoveFriendErrorSpec));
2643
2625
  const approveFriendRequest = (username) => requestJson(OkResponseSchema, {
2644
2626
  method: "POST",
2645
2627
  path: `/v2/friends/${encodeURIComponent(username)}/approve`
2646
- }).pipe((effect) => withOperationErrors(effect, ApproveFriendRequestErrorSpec));
2628
+ }).pipe(withOperationErrors(ApproveFriendRequestErrorSpec));
2647
2629
  const denyFriendRequest = (username) => requestJson(OkResponseSchema, {
2648
2630
  method: "POST",
2649
2631
  path: `/v2/friends/${encodeURIComponent(username)}/deny`
2650
- }).pipe((effect) => withOperationErrors(effect, DenyFriendRequestErrorSpec));
2632
+ }).pipe(withOperationErrors(DenyFriendRequestErrorSpec));
2651
2633
  const getFriendSharedFolder = (username) => requestJson(FriendSharedFolderEnvelopeSchema, {
2652
2634
  method: "GET",
2653
2635
  path: `/v2/friends/${encodeURIComponent(username)}/files`
2654
- }).pipe(Effect.map(({ file }) => file), (effect) => withOperationErrors(effect, FriendSharedFolderErrorSpec));
2636
+ }).pipe(selectJsonField("file"), withOperationErrors(FriendSharedFolderErrorSpec));
2655
2637
  //#endregion
2656
2638
  //#region src/domains/payment.ts
2657
2639
  const PaymentPlanTypeSchema = Schema.Literal("onetime", "subscription");
@@ -3172,25 +3154,25 @@ const classifyPaymentChangePlanResponse = (response) => {
3172
3154
  const getPaymentInfo = () => requestJson(PaymentInfoSchema, {
3173
3155
  method: "GET",
3174
3156
  path: "/v2/payment/info"
3175
- }).pipe((effect) => withOperationErrors(effect, GetPaymentInfoErrorSpec));
3157
+ }).pipe(withOperationErrors(GetPaymentInfoErrorSpec));
3176
3158
  const listPaymentPlans = () => requestJson(PaymentPlansEnvelopeSchema, {
3177
3159
  method: "GET",
3178
3160
  path: "/v2/payment/plans"
3179
- }).pipe(Effect.map(({ plans }) => plans), (effect) => withOperationErrors(effect, ListPaymentPlansErrorSpec));
3161
+ }).pipe(selectJsonField("plans"), withOperationErrors(ListPaymentPlansErrorSpec));
3180
3162
  const listPaymentOptions = () => requestJson(PaymentOptionsEnvelopeSchema, {
3181
3163
  auth: { type: "none" },
3182
3164
  method: "GET",
3183
3165
  path: "/v2/payment/options"
3184
- }).pipe(Effect.map(({ options }) => options), (effect) => withOperationErrors(effect, ListPaymentOptionsErrorSpec));
3166
+ }).pipe(selectJsonField("options"), withOperationErrors(ListPaymentOptionsErrorSpec));
3185
3167
  const listPaymentHistory = (query) => requestJson(PaymentHistoryEnvelopeSchema, {
3186
3168
  method: "GET",
3187
3169
  path: "/v2/payment/history",
3188
3170
  query
3189
- }).pipe(Effect.map(({ payments }) => payments), (effect) => withOperationErrors(effect, ListPaymentHistoryErrorSpec));
3171
+ }).pipe(selectJsonField("payments"), withOperationErrors(ListPaymentHistoryErrorSpec));
3190
3172
  const listPaymentInvites = () => requestJson(PaymentInvitesEnvelopeSchema, {
3191
3173
  method: "GET",
3192
3174
  path: "/v2/payment/invites"
3193
- }).pipe(Effect.map(({ vouchers }) => vouchers), (effect) => withOperationErrors(effect, ListPaymentInvitesErrorSpec));
3175
+ }).pipe(selectJsonField("vouchers"), withOperationErrors(ListPaymentInvitesErrorSpec));
3194
3176
  const previewPaymentChangePlan = (input) => requestJson(PaymentChangePlanPreviewSchema, {
3195
3177
  method: "GET",
3196
3178
  path: `/v2/payment/change_plan/${encodeURIComponent(input.plan_path)}`,
@@ -3198,7 +3180,7 @@ const previewPaymentChangePlan = (input) => requestJson(PaymentChangePlanPreview
3198
3180
  coupon_code: input.coupon_code,
3199
3181
  payment_type: input.payment_type
3200
3182
  }
3201
- }).pipe((effect) => withOperationErrors(effect, PreviewPaymentChangePlanErrorSpec));
3183
+ }).pipe(withOperationErrors(PreviewPaymentChangePlanErrorSpec));
3202
3184
  const submitPaymentChangePlan = (input) => requestJson(PaymentChangePlanSubmitSchema, {
3203
3185
  body: {
3204
3186
  type: "form",
@@ -3210,31 +3192,31 @@ const submitPaymentChangePlan = (input) => requestJson(PaymentChangePlanSubmitSc
3210
3192
  method: "POST",
3211
3193
  path: `/v2/payment/change_plan/${encodeURIComponent(input.plan_path)}`,
3212
3194
  query: { coupon_code: input.coupon_code }
3213
- }).pipe((effect) => withOperationErrors(effect, SubmitPaymentChangePlanErrorSpec));
3195
+ }).pipe(withOperationErrors(SubmitPaymentChangePlanErrorSpec));
3214
3196
  const confirmFastspringOrder = (reference) => requestJson(PaymentFastspringConfirmEnvelopeSchema, {
3215
3197
  method: "GET",
3216
3198
  path: `/v2/payment/fs-confirm/${encodeURIComponent(reference)}`
3217
- }).pipe(Effect.map(({ confirmed }) => confirmed), (effect) => withOperationErrors(effect, ConfirmFastspringOrderErrorSpec));
3199
+ }).pipe(selectJsonField("confirmed"), withOperationErrors(ConfirmFastspringOrderErrorSpec));
3218
3200
  const stopPaymentSubscription = () => requestJson(OkResponseSchema, {
3219
3201
  method: "POST",
3220
3202
  path: "/v2/payment/stop_subscription"
3221
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, StopSubscriptionErrorSpec));
3203
+ }).pipe(Effect.asVoid, withOperationErrors(StopSubscriptionErrorSpec));
3222
3204
  const getPaymentVoucherInfo = (code) => requestJson(PaymentVoucherInfoSchema, {
3223
3205
  method: "GET",
3224
3206
  path: `/v2/payment/redeem_voucher/${encodeURIComponent(code)}`
3225
- }).pipe((effect) => withOperationErrors(effect, GetPaymentVoucherInfoErrorSpec));
3207
+ }).pipe(withOperationErrors(GetPaymentVoucherInfoErrorSpec));
3226
3208
  const redeemPaymentVoucher = (code) => requestJson(OkResponseSchema, {
3227
3209
  method: "POST",
3228
3210
  path: `/v2/payment/redeem_voucher/${encodeURIComponent(code)}`
3229
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, RedeemPaymentVoucherErrorSpec));
3211
+ }).pipe(Effect.asVoid, withOperationErrors(RedeemPaymentVoucherErrorSpec));
3230
3212
  const reportPayments = (paymentIds) => requestJson(OkResponseSchema, {
3231
3213
  body: {
3232
3214
  type: "form",
3233
- value: { payment_ids: paymentIds.join(",") }
3215
+ value: { payment_ids: joinCsv(paymentIds) }
3234
3216
  },
3235
3217
  method: "POST",
3236
3218
  path: "/v2/payment/report"
3237
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, ReportPaymentsErrorSpec));
3219
+ }).pipe(Effect.asVoid, withOperationErrors(ReportPaymentsErrorSpec));
3238
3220
  const createPaddleWaitingPayment = (input) => requestJson(OkResponseSchema, {
3239
3221
  body: {
3240
3222
  type: "form",
@@ -3242,7 +3224,7 @@ const createPaddleWaitingPayment = (input) => requestJson(OkResponseSchema, {
3242
3224
  },
3243
3225
  method: "POST",
3244
3226
  path: "/v2/payment/paddle_waiting_payment"
3245
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, CreatePaddleWaitingPaymentErrorSpec));
3227
+ }).pipe(Effect.asVoid, withOperationErrors(CreatePaddleWaitingPaymentErrorSpec));
3246
3228
  const createCoinbaseCharge = (planPath) => requestJson(PaymentCoinbaseChargeEnvelopeSchema, {
3247
3229
  body: {
3248
3230
  type: "form",
@@ -3250,7 +3232,7 @@ const createCoinbaseCharge = (planPath) => requestJson(PaymentCoinbaseChargeEnve
3250
3232
  },
3251
3233
  method: "POST",
3252
3234
  path: "/v2/payment/methods/coinbase/charge"
3253
- }).pipe(Effect.map(({ coinbase }) => coinbase.code), (effect) => withOperationErrors(effect, CreateCoinbaseChargeErrorSpec));
3235
+ }).pipe(selectJsonField("coinbase"), Effect.map(({ code }) => code), withOperationErrors(CreateCoinbaseChargeErrorSpec));
3254
3236
  const createOpenNodeCharge = (planPath) => requestJson(PaymentOpenNodeChargeEnvelopeSchema, {
3255
3237
  body: {
3256
3238
  type: "form",
@@ -3258,7 +3240,7 @@ const createOpenNodeCharge = (planPath) => requestJson(PaymentOpenNodeChargeEnve
3258
3240
  },
3259
3241
  method: "POST",
3260
3242
  path: "/v2/payment/methods/opennode/charge"
3261
- }).pipe(Effect.map(({ opennode }) => opennode.checkout_url), (effect) => withOperationErrors(effect, CreateOpenNodeChargeErrorSpec));
3243
+ }).pipe(selectJsonField("opennode"), Effect.map(({ checkout_url }) => checkout_url), withOperationErrors(CreateOpenNodeChargeErrorSpec));
3262
3244
  const createNanoPaymentRequest = (planCode) => requestJson(PaymentNanoRequestEnvelopeSchema, {
3263
3245
  body: {
3264
3246
  type: "form",
@@ -3266,7 +3248,7 @@ const createNanoPaymentRequest = (planCode) => requestJson(PaymentNanoRequestEnv
3266
3248
  },
3267
3249
  method: "POST",
3268
3250
  path: "/v2/payment/methods/nano/request"
3269
- }).pipe(Effect.map(({ nano }) => nano.token), (effect) => withOperationErrors(effect, CreateNanoPaymentRequestErrorSpec));
3251
+ }).pipe(selectJsonField("nano"), Effect.map(({ token }) => token), withOperationErrors(CreateNanoPaymentRequestErrorSpec));
3270
3252
  //#endregion
3271
3253
  //#region src/domains/rss.ts
3272
3254
  const RssFeedSchema = Schema.Struct({
@@ -3545,11 +3527,11 @@ const toUpdateBody = (params) => ({
3545
3527
  const listRssFeeds = () => requestJson(RssFeedsEnvelopeSchema, {
3546
3528
  method: "GET",
3547
3529
  path: "/v2/rss/list"
3548
- }).pipe(Effect.map(({ feeds }) => feeds), (effect) => withOperationErrors(effect, ListRssFeedsErrorSpec));
3530
+ }).pipe(selectJsonField("feeds"), withOperationErrors(ListRssFeedsErrorSpec));
3549
3531
  const getRssFeed = (id) => requestJson(RssFeedEnvelopeSchema, {
3550
3532
  method: "GET",
3551
3533
  path: `/v2/rss/${id}`
3552
- }).pipe(Effect.map(({ feed }) => feed), (effect) => withOperationErrors(effect, GetRssFeedErrorSpec));
3534
+ }).pipe(selectJsonField("feed"), withOperationErrors(GetRssFeedErrorSpec));
3553
3535
  const createRssFeed = (params) => requestJson(RssFeedEnvelopeSchema, {
3554
3536
  body: {
3555
3537
  type: "form",
@@ -3557,7 +3539,7 @@ const createRssFeed = (params) => requestJson(RssFeedEnvelopeSchema, {
3557
3539
  },
3558
3540
  method: "POST",
3559
3541
  path: "/v2/rss/create"
3560
- }).pipe(Effect.map(({ feed }) => feed), (effect) => withOperationErrors(effect, CreateRssFeedErrorSpec));
3542
+ }).pipe(selectJsonField("feed"), withOperationErrors(CreateRssFeedErrorSpec));
3561
3543
  const updateRssFeed = (id, params) => requestJson(OkResponseSchema, {
3562
3544
  body: {
3563
3545
  type: "form",
@@ -3565,38 +3547,35 @@ const updateRssFeed = (id, params) => requestJson(OkResponseSchema, {
3565
3547
  },
3566
3548
  method: "POST",
3567
3549
  path: `/v2/rss/${id}`
3568
- }).pipe((effect) => withOperationErrors(effect, UpdateRssFeedErrorSpec));
3550
+ }).pipe(withOperationErrors(UpdateRssFeedErrorSpec));
3569
3551
  const pauseRssFeed = (id) => requestJson(OkResponseSchema, {
3570
3552
  method: "POST",
3571
3553
  path: `/v2/rss/${id}/pause`
3572
- }).pipe((effect) => withOperationErrors(effect, PauseRssFeedErrorSpec));
3554
+ }).pipe(withOperationErrors(PauseRssFeedErrorSpec));
3573
3555
  const resumeRssFeed = (id) => requestJson(OkResponseSchema, {
3574
3556
  method: "POST",
3575
3557
  path: `/v2/rss/${id}/resume`
3576
- }).pipe((effect) => withOperationErrors(effect, ResumeRssFeedErrorSpec));
3558
+ }).pipe(withOperationErrors(ResumeRssFeedErrorSpec));
3577
3559
  const deleteRssFeed = (id) => requestJson(OkResponseSchema, {
3578
3560
  method: "POST",
3579
3561
  path: `/v2/rss/${id}/delete`
3580
- }).pipe((effect) => withOperationErrors(effect, DeleteRssFeedErrorSpec));
3562
+ }).pipe(withOperationErrors(DeleteRssFeedErrorSpec));
3581
3563
  const listRssFeedItems = (id) => requestJson(RssFeedItemsEnvelopeSchema, {
3582
3564
  method: "GET",
3583
3565
  path: `/v2/rss/${id}/items`
3584
- }).pipe(Effect.map(({ feed, items }) => ({
3585
- feed,
3586
- items
3587
- })), (effect) => withOperationErrors(effect, ListRssFeedItemsErrorSpec));
3566
+ }).pipe(selectJsonFields("feed", "items"), withOperationErrors(ListRssFeedItemsErrorSpec));
3588
3567
  const clearRssFeedLogs = (id) => requestJson(OkResponseSchema, {
3589
3568
  method: "POST",
3590
3569
  path: `/v2/rss/${id}/clear-log`
3591
- }).pipe((effect) => withOperationErrors(effect, ClearRssFeedLogsErrorSpec));
3570
+ }).pipe(withOperationErrors(ClearRssFeedLogsErrorSpec));
3592
3571
  const retryRssFeedItem = (feedId, itemId) => requestJson(OkResponseSchema, {
3593
3572
  method: "POST",
3594
3573
  path: `/v2/rss/${feedId}/items/${itemId}/retry`
3595
- }).pipe((effect) => withOperationErrors(effect, RetryRssFeedItemErrorSpec));
3574
+ }).pipe(withOperationErrors(RetryRssFeedItemErrorSpec));
3596
3575
  const retryAllRssFeedItems = (feedId) => requestJson(OkResponseSchema, {
3597
3576
  method: "POST",
3598
3577
  path: `/v2/rss/${feedId}/retry-all`
3599
- }).pipe((effect) => withOperationErrors(effect, RetryAllRssFeedItemsErrorSpec));
3578
+ }).pipe(withOperationErrors(RetryAllRssFeedItemsErrorSpec));
3600
3579
  //#endregion
3601
3580
  //#region src/domains/sharing.ts
3602
3581
  const SharingCloneStatusSchema = Schema.Literal("NEW", "PROCESSING", "DONE", "ERROR");
@@ -3898,75 +3877,70 @@ const GetPublicShareFileUrlErrorSpec = definePutioOperationErrorSpec({
3898
3877
  { statusCode: 404 }
3899
3878
  ]
3900
3879
  });
3901
- const toCsv = (values) => values && values.length > 0 ? values.join(",") : void 0;
3902
- const toShareTarget = (target) => target.type === "everyone" ? "everyone" : target.friendNames.join(",");
3880
+ const toShareTarget = (target) => target.type === "everyone" ? "everyone" : joinCsv(target.friendNames) ?? "everyone";
3903
3881
  const cloneSharedFiles = (input = {}) => requestJson(SharingCloneEnvelopeSchema, {
3904
3882
  body: {
3905
3883
  type: "form",
3906
3884
  value: {
3907
- cursor: input.cursor,
3908
- exclude_ids: toCsv(input.excludeIds),
3909
- file_ids: toCsv(input.ids),
3885
+ ...toCursorSelectionForm(input),
3910
3886
  parent_id: input.parentId ?? 0
3911
3887
  }
3912
3888
  },
3913
3889
  method: "POST",
3914
3890
  path: "/v2/sharing/clone"
3915
- }).pipe(Effect.map(({ id }) => ({ id })), (effect) => withOperationErrors(effect, CreateSharingCloneErrorSpec));
3891
+ }).pipe(selectJsonFields("id"), withOperationErrors(CreateSharingCloneErrorSpec));
3916
3892
  const getSharingCloneInfo = (id) => requestJson(SharingCloneInfoSchema, {
3917
3893
  method: "GET",
3918
3894
  path: `/v2/sharing/clone/${id}`
3919
- }).pipe((effect) => withOperationErrors(effect, GetSharingCloneInfoErrorSpec));
3895
+ }).pipe(withOperationErrors(GetSharingCloneInfoErrorSpec));
3920
3896
  const shareFiles = (input) => requestJson(OkResponseSchema, {
3921
3897
  body: {
3922
3898
  type: "form",
3923
3899
  value: {
3924
- cursor: input.cursor,
3925
- exclude_ids: toCsv(input.excludeIds),
3926
- file_ids: toCsv(input.ids),
3900
+ ...toCursorSelectionForm(input),
3927
3901
  friends: toShareTarget(input.target)
3928
3902
  }
3929
3903
  },
3930
3904
  method: "POST",
3931
3905
  path: "/v2/files/share"
3932
- }).pipe((effect) => withOperationErrors(effect, ShareFilesErrorSpec));
3906
+ }).pipe(withOperationErrors(ShareFilesErrorSpec));
3933
3907
  const listSharedFiles = () => requestJson(SharedFilesEnvelopeSchema, {
3934
3908
  method: "GET",
3935
3909
  path: "/v2/files/shared"
3936
- }).pipe(Effect.map(({ shared }) => shared), (effect) => withOperationErrors(effect, ListSharedFilesErrorSpec));
3910
+ }).pipe(selectJsonField("shared"), withOperationErrors(ListSharedFilesErrorSpec));
3937
3911
  const getSharedWith = (fileId) => requestJson(SharedFileSharedWithSchema, {
3938
3912
  method: "GET",
3939
3913
  path: `/v2/files/${fileId}/shared-with-v2`
3940
- }).pipe((effect) => withOperationErrors(effect, GetSharedWithErrorSpec));
3914
+ }).pipe(withOperationErrors(GetSharedWithErrorSpec));
3941
3915
  const unshareFile = (input) => requestJson(OkResponseSchema, {
3942
3916
  body: {
3943
3917
  type: "form",
3944
- value: { shares: input.shares && input.shares.length > 0 ? toCsv(input.shares) : "everyone" }
3918
+ value: { shares: joinCsv(input.shares) ?? "everyone" }
3945
3919
  },
3946
3920
  method: "POST",
3947
3921
  path: `/v2/files/${input.fileId}/unshare`
3948
- }).pipe((effect) => withOperationErrors(effect, UnshareFileErrorSpec));
3922
+ }).pipe(withOperationErrors(UnshareFileErrorSpec));
3949
3923
  const createPublicShare = (fileId) => requestJson(PublicShareEnvelopeSchema, {
3950
3924
  method: "POST",
3951
3925
  path: `/v2/public_share/${fileId}`
3952
- }).pipe(Effect.map(({ public_share }) => public_share), (effect) => withOperationErrors(effect, CreatePublicShareErrorSpec));
3926
+ }).pipe(selectJsonField("public_share"), withOperationErrors(CreatePublicShareErrorSpec));
3953
3927
  const listPublicShares = () => requestJson(PublicSharesEnvelopeSchema, {
3954
3928
  method: "GET",
3955
3929
  path: "/v2/public_share/list"
3956
- }).pipe(Effect.map(({ public_shares }) => public_shares), (effect) => withOperationErrors(effect, ListPublicSharesErrorSpec));
3930
+ }).pipe(selectJsonField("public_shares"), withOperationErrors(ListPublicSharesErrorSpec));
3957
3931
  const deletePublicShare = (id) => requestJson(OkResponseSchema, {
3958
3932
  method: "DELETE",
3959
3933
  path: `/v2/public_share/${id}`
3960
- }).pipe((effect) => withOperationErrors(effect, DeletePublicShareErrorSpec));
3934
+ }).pipe(withOperationErrors(DeletePublicShareErrorSpec));
3961
3935
  const getPublicShare = () => requestJson(PublicShareEnvelopeSchema, {
3962
3936
  method: "GET",
3963
3937
  path: "/v2/public_share"
3964
- }).pipe(Effect.map(({ public_share }) => public_share), (effect) => withOperationErrors(effect, GetPublicShareErrorSpec));
3938
+ }).pipe(selectJsonField("public_share"), withOperationErrors(GetPublicShareErrorSpec));
3965
3939
  const listPublicShareFiles = (query = {}) => requestJson(PublicShareFileListEnvelopeSchema, {
3966
3940
  method: "GET",
3967
3941
  path: "/v2/public_share/files/list",
3968
3942
  query
3969
- }).pipe((effect) => withOperationErrors(effect, ListPublicShareFilesErrorSpec));
3943
+ }).pipe(withOperationErrors(ListPublicShareFilesErrorSpec));
3970
3944
  const continuePublicShareFiles = (cursor, query = {}) => requestJson(PublicShareFileListContinueEnvelopeSchema, {
3971
3945
  body: {
3972
3946
  type: "form",
@@ -3975,11 +3949,11 @@ const continuePublicShareFiles = (cursor, query = {}) => requestJson(PublicShare
3975
3949
  method: "POST",
3976
3950
  path: "/v2/public_share/files/list/continue",
3977
3951
  query
3978
- }).pipe((effect) => withOperationErrors(effect, ContinuePublicShareFilesErrorSpec));
3952
+ }).pipe(withOperationErrors(ContinuePublicShareFilesErrorSpec));
3979
3953
  const getPublicShareFileUrl = (fileId) => requestJson(PublicShareFileUrlEnvelopeSchema, {
3980
3954
  method: "GET",
3981
3955
  path: `/v2/public_share/files/${fileId}/url`
3982
- }).pipe(Effect.map(({ url }) => url), (effect) => withOperationErrors(effect, GetPublicShareFileUrlErrorSpec));
3956
+ }).pipe(selectJsonField("url"), withOperationErrors(GetPublicShareFileUrlErrorSpec));
3983
3957
  //#endregion
3984
3958
  //#region src/domains/trash.ts
3985
3959
  const TrashFileSchema = Schema.Struct({
@@ -4086,14 +4060,14 @@ const toBulkTrashBody = (input) => {
4086
4060
  if (!input.file_ids) throw new Error("trash bulk file_ids are required when useCursor is not set");
4087
4061
  return {
4088
4062
  cursor: void 0,
4089
- file_ids: input.file_ids.join(",")
4063
+ file_ids: joinCsv(input.file_ids)
4090
4064
  };
4091
4065
  };
4092
4066
  const listTrash = (query) => requestJson(TrashListEnvelopeSchema, {
4093
4067
  method: "GET",
4094
4068
  path: "/v2/trash/list",
4095
4069
  query
4096
- }).pipe((effect) => withOperationErrors(effect, ListTrashErrorSpec));
4070
+ }).pipe(withOperationErrors(ListTrashErrorSpec));
4097
4071
  const continueTrash = (cursor, query) => requestJson(TrashContinueEnvelopeSchema, {
4098
4072
  body: {
4099
4073
  type: "form",
@@ -4102,7 +4076,7 @@ const continueTrash = (cursor, query) => requestJson(TrashContinueEnvelopeSchema
4102
4076
  method: "POST",
4103
4077
  path: "/v2/trash/list/continue",
4104
4078
  query
4105
- }).pipe((effect) => withOperationErrors(effect, ContinueTrashErrorSpec));
4079
+ }).pipe(withOperationErrors(ContinueTrashErrorSpec));
4106
4080
  const restoreTrash = (input) => requestJson(OkResponseSchema, {
4107
4081
  body: {
4108
4082
  type: "form",
@@ -4110,7 +4084,7 @@ const restoreTrash = (input) => requestJson(OkResponseSchema, {
4110
4084
  },
4111
4085
  method: "POST",
4112
4086
  path: "/v2/trash/restore"
4113
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, RestoreTrashErrorSpec));
4087
+ }).pipe(Effect.asVoid, withOperationErrors(RestoreTrashErrorSpec));
4114
4088
  const deleteTrash = (input) => requestJson(OkResponseSchema, {
4115
4089
  body: {
4116
4090
  type: "form",
@@ -4118,11 +4092,11 @@ const deleteTrash = (input) => requestJson(OkResponseSchema, {
4118
4092
  },
4119
4093
  method: "POST",
4120
4094
  path: "/v2/trash/delete"
4121
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, DeleteTrashErrorSpec));
4095
+ }).pipe(Effect.asVoid, withOperationErrors(DeleteTrashErrorSpec));
4122
4096
  const emptyTrash = () => requestJson(OkResponseSchema, {
4123
4097
  method: "POST",
4124
4098
  path: "/v2/trash/empty"
4125
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, EmptyTrashErrorSpec));
4099
+ }).pipe(Effect.asVoid, withOperationErrors(EmptyTrashErrorSpec));
4126
4100
  //#endregion
4127
4101
  //#region src/domains/transfers.ts
4128
4102
  const TransferTypeSchema = Schema.Literal("URL", "TORRENT", "PLAYLIST", "LIVE_STREAM", "N/A");
@@ -4348,7 +4322,7 @@ const listTransfers = (query = {}) => requestJson(TransfersListEnvelopeSchema, {
4348
4322
  method: "GET",
4349
4323
  path: "/v2/transfers/list",
4350
4324
  query
4351
- }).pipe((effect) => withOperationErrors(effect, ListTransfersErrorSpec));
4325
+ }).pipe(withOperationErrors(ListTransfersErrorSpec));
4352
4326
  const continueTransfers = (cursor, query = {}) => requestJson(TransfersContinueEnvelopeSchema, {
4353
4327
  body: {
4354
4328
  type: "form",
@@ -4357,15 +4331,15 @@ const continueTransfers = (cursor, query = {}) => requestJson(TransfersContinueE
4357
4331
  method: "POST",
4358
4332
  path: "/v2/transfers/list/continue",
4359
4333
  query
4360
- }).pipe((effect) => withOperationErrors(effect, ListTransfersErrorSpec));
4334
+ }).pipe(withOperationErrors(ListTransfersErrorSpec));
4361
4335
  const getTransfer = (id) => requestJson(TransferEnvelopeSchema, {
4362
4336
  method: "GET",
4363
4337
  path: `/v2/transfers/${id}`
4364
- }).pipe(Effect.map(({ transfer }) => transfer), (effect) => withOperationErrors(effect, GetTransferErrorSpec));
4338
+ }).pipe(selectJsonField("transfer"), withOperationErrors(GetTransferErrorSpec));
4365
4339
  const countTransfers = () => requestJson(TransferCountEnvelopeSchema, {
4366
4340
  method: "GET",
4367
4341
  path: "/v2/transfers/count"
4368
- }).pipe(Effect.map(({ count }) => count));
4342
+ }).pipe(selectJsonField("count"));
4369
4343
  const getTransferInfo = (urls) => requestJson(TransferInfoEnvelopeSchema, {
4370
4344
  body: {
4371
4345
  type: "form",
@@ -4373,10 +4347,7 @@ const getTransferInfo = (urls) => requestJson(TransferInfoEnvelopeSchema, {
4373
4347
  },
4374
4348
  method: "POST",
4375
4349
  path: "/v2/transfers/info"
4376
- }).pipe(Effect.map(({ disk_avail, ret }) => ({
4377
- disk_avail,
4378
- ret
4379
- })));
4350
+ }).pipe(selectJsonFields("disk_avail", "ret"));
4380
4351
  const addTransfer = (input) => requestJson(TransferEnvelopeSchema, {
4381
4352
  body: {
4382
4353
  type: "form",
@@ -4384,7 +4355,7 @@ const addTransfer = (input) => requestJson(TransferEnvelopeSchema, {
4384
4355
  },
4385
4356
  method: "POST",
4386
4357
  path: "/v2/transfers/add"
4387
- }).pipe(Effect.map(({ transfer }) => transfer), (effect) => withOperationErrors(effect, AddTransferErrorSpec));
4358
+ }).pipe(selectJsonField("transfer"), withOperationErrors(AddTransferErrorSpec));
4388
4359
  const addManyTransfers = (inputs) => requestJson(TransfersAddMultiEnvelopeSchema, {
4389
4360
  body: {
4390
4361
  type: "form",
@@ -4392,14 +4363,11 @@ const addManyTransfers = (inputs) => requestJson(TransfersAddMultiEnvelopeSchema
4392
4363
  },
4393
4364
  method: "POST",
4394
4365
  path: "/v2/transfers/add-multi"
4395
- }).pipe(Effect.map(({ errors, transfers }) => ({
4396
- errors,
4397
- transfers
4398
- })), (effect) => withOperationErrors(effect, AddManyTransfersErrorSpec));
4366
+ }).pipe(selectJsonFields("errors", "transfers"), withOperationErrors(AddManyTransfersErrorSpec));
4399
4367
  const cancelTransfers = (ids) => requestJson(OkResponseSchema, {
4400
4368
  body: {
4401
4369
  type: "form",
4402
- value: { transfer_ids: ids.join(",") }
4370
+ value: { transfer_ids: joinCsv(ids) }
4403
4371
  },
4404
4372
  method: "POST",
4405
4373
  path: "/v2/transfers/cancel"
@@ -4407,11 +4375,11 @@ const cancelTransfers = (ids) => requestJson(OkResponseSchema, {
4407
4375
  const cleanTransfers = (ids = []) => requestJson(TransfersCleanEnvelopeSchema, {
4408
4376
  body: {
4409
4377
  type: "form",
4410
- value: ids.length > 0 ? { transfer_ids: ids.join(",") } : {}
4378
+ value: ids.length > 0 ? { transfer_ids: joinCsv(ids) } : {}
4411
4379
  },
4412
4380
  method: "POST",
4413
4381
  path: "/v2/transfers/clean"
4414
- }).pipe(Effect.map(({ deleted_ids }) => ({ deleted_ids })));
4382
+ }).pipe(selectJsonFields("deleted_ids"));
4415
4383
  const retryTransfer = (id) => requestJson(TransferEnvelopeSchema, {
4416
4384
  body: {
4417
4385
  type: "form",
@@ -4419,7 +4387,7 @@ const retryTransfer = (id) => requestJson(TransferEnvelopeSchema, {
4419
4387
  },
4420
4388
  method: "POST",
4421
4389
  path: "/v2/transfers/retry"
4422
- }).pipe(Effect.map(({ transfer }) => transfer), (effect) => withOperationErrors(effect, RetryTransferErrorSpec));
4390
+ }).pipe(selectJsonField("transfer"), withOperationErrors(RetryTransferErrorSpec));
4423
4391
  const reannounceTransfer = (id) => requestJson(OkResponseSchema, {
4424
4392
  body: {
4425
4393
  type: "form",
@@ -4427,7 +4395,7 @@ const reannounceTransfer = (id) => requestJson(OkResponseSchema, {
4427
4395
  },
4428
4396
  method: "POST",
4429
4397
  path: "/v2/transfers/reannounce"
4430
- }).pipe((effect) => withOperationErrors(effect, ReannounceTransferErrorSpec));
4398
+ }).pipe(withOperationErrors(ReannounceTransferErrorSpec));
4431
4399
  const stopTransferRecording = (id) => requestJson(OkResponseSchema, {
4432
4400
  body: {
4433
4401
  type: "form",
@@ -4435,7 +4403,7 @@ const stopTransferRecording = (id) => requestJson(OkResponseSchema, {
4435
4403
  },
4436
4404
  method: "POST",
4437
4405
  path: "/v2/transfers/stop-recording"
4438
- }).pipe((effect) => withOperationErrors(effect, StopRecordingTransferErrorSpec));
4406
+ }).pipe(withOperationErrors(StopRecordingTransferErrorSpec));
4439
4407
  //#endregion
4440
4408
  //#region src/domains/tunnel.ts
4441
4409
  const TunnelRouteSchema = Schema.Struct({
@@ -4458,7 +4426,7 @@ const ListTunnelRoutesErrorSpec = definePutioOperationErrorSpec({
4458
4426
  const listTunnelRoutes = () => requestJson(TunnelRoutesEnvelopeSchema, {
4459
4427
  method: "GET",
4460
4428
  path: "/v2/tunnel/routes"
4461
- }).pipe(Effect.map(({ routes }) => routes), (effect) => withOperationErrors(effect, ListTunnelRoutesErrorSpec));
4429
+ }).pipe(selectJsonField("routes"), withOperationErrors(ListTunnelRoutesErrorSpec));
4462
4430
  //#endregion
4463
4431
  //#region src/domains/zips.ts
4464
4432
  const ZipStatusSchema = Schema.Literal("NEW", "PROCESSING", "DONE", "ERROR");
@@ -4554,36 +4522,47 @@ const CancelZipErrorSpec = definePutioOperationErrorSpec({
4554
4522
  const listZips = () => requestJson(ZipsListEnvelopeSchema, {
4555
4523
  method: "GET",
4556
4524
  path: "/v2/zips/list"
4557
- }).pipe(Effect.map(({ zips }) => zips), (effect) => withOperationErrors(effect, ListZipsErrorSpec));
4525
+ }).pipe(selectJsonField("zips"), withOperationErrors(ListZipsErrorSpec));
4558
4526
  const createZip = (input) => requestJson(ZipCreateEnvelopeSchema, {
4559
4527
  body: {
4560
4528
  type: "form",
4561
- value: {
4529
+ value: { ...toCursorSelectionForm({
4562
4530
  cursor: input.cursor,
4563
- exclude_ids: input.exclude_ids?.join(","),
4564
- file_ids: input.file_ids?.join(",")
4565
- }
4531
+ excludeIds: input.exclude_ids,
4532
+ ids: input.file_ids
4533
+ }) }
4566
4534
  },
4567
4535
  method: "POST",
4568
4536
  path: "/v2/zips/create"
4569
- }).pipe(Effect.map(({ zip_id }) => zip_id), (effect) => withOperationErrors(effect, CreateZipErrorSpec));
4537
+ }).pipe(selectJsonField("zip_id"), withOperationErrors(CreateZipErrorSpec));
4570
4538
  const getZip = (id) => requestJson(ZipInfoSchema, {
4571
4539
  method: "GET",
4572
4540
  path: `/v2/zips/${id}`
4573
- }).pipe((effect) => withOperationErrors(effect, GetZipErrorSpec));
4541
+ }).pipe(withOperationErrors(GetZipErrorSpec));
4574
4542
  const cancelZip = (id) => requestJson(OkResponseSchema, {
4575
4543
  method: "GET",
4576
4544
  path: `/v2/zips/${id}/cancel`
4577
- }).pipe(Effect.asVoid, (effect) => withOperationErrors(effect, CancelZipErrorSpec));
4545
+ }).pipe(Effect.asVoid, withOperationErrors(CancelZipErrorSpec));
4578
4546
  //#endregion
4579
4547
  //#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);
4548
+ const promiseClientRuntimeCache = /* @__PURE__ */ new WeakMap();
4549
+ const disposedPromiseClientConfigs = /* @__PURE__ */ new WeakSet();
4550
+ const getPromiseClientRuntime = (config) => {
4551
+ if (disposedPromiseClientConfigs.has(config)) throw mapConfigurationError("This Promise client has been disposed and can no longer execute SDK effects");
4552
+ const cachedRuntime = promiseClientRuntimeCache.get(config);
4553
+ if (cachedRuntime) return cachedRuntime;
4554
+ const runtime = ManagedRuntime.make(Layer.mergeAll(makePutioSdkLayer(config), FetchHttpClient.layer));
4555
+ promiseClientRuntimeCache.set(config, runtime);
4556
+ return runtime;
4557
+ };
4558
+ const disposePromiseClientRuntime = async (config) => {
4559
+ disposedPromiseClientConfigs.add(config);
4560
+ const runtime = promiseClientRuntimeCache.get(config);
4561
+ promiseClientRuntimeCache.delete(config);
4562
+ if (!runtime) return;
4563
+ await runtime.dispose();
4585
4564
  };
4586
- const provideSdk = (config, effect) => runWithConfig(config, effect.pipe(Effect.provide(makePutioSdkLayer(config)), Effect.provide(FetchHttpClient.layer)));
4565
+ const provideSdk = async (config, effect) => getPromiseClientRuntime(config).runPromise(effect);
4587
4566
  const createPutioSdkEffectClient = () => ({
4588
4567
  account: {
4589
4568
  clear: clearAccount,
@@ -4802,7 +4781,8 @@ const createPutioSdkEffectClient = () => ({
4802
4781
  list: listZips
4803
4782
  }
4804
4783
  });
4805
- const createPutioSdkPromiseClient = (config = {}) => {
4784
+ const createPutioSdkPromiseClient = (initialConfig = {}) => {
4785
+ const config = { ...initialConfig };
4806
4786
  function getInfo(query) {
4807
4787
  return provideSdk(config, getAccountInfo(query));
4808
4788
  }
@@ -4810,6 +4790,7 @@ const createPutioSdkPromiseClient = (config = {}) => {
4810
4790
  return provideSdk(config, getFile(input));
4811
4791
  }
4812
4792
  return {
4793
+ dispose: () => disposePromiseClientRuntime(config),
4813
4794
  account: {
4814
4795
  clear: (options) => provideSdk(config, clearAccount(options)),
4815
4796
  destroy: (currentPassword) => provideSdk(config, destroyAccount(currentPassword)),
@@ -5030,6 +5011,6 @@ const createPutioSdkPromiseClient = (config = {}) => {
5030
5011
  };
5031
5012
  };
5032
5013
  //#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 };
5014
+ 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
5015
 
5035
5016
  //# sourceMappingURL=index.js.map