@putdotio/sdk 13.3.2 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { A as PutioOperationError, B as isPutioOperationError, C as DEFAULT_PUTIO_API_BASE_URL, D as PutioAuthError, E as PutioApiError, F as definePutioOperationErrorSpec, G as mapTransportError, H as makeResponseError, I as fallbackPutioErrorEnvelope, J as withOperationErrors, K as parseErrorBody, L as isPutioApiError, M as PutioTransportError, N as PutioValidationError, O as PutioConfigurationError, P as decodePutioErrorEnvelope, R as isPutioAuthError, S as selectJsonFields, T as DEFAULT_PUTIO_WEB_APP_URL, U as mapConfigurationError, V as isPutioRateLimitError, W as mapDecodeErrorToValidationError, _ as requestArrayBuffer, a as decodeAndRun, b as requestVoid, c as PutioHttpClient, d as encodePathSegment, f as makePutioFetchClient, g as makePutioSdkLiveLayer, h as makePutioSdkLayer, i as PositiveIntegerSchema, j as PutioRateLimitError, k as PutioErrorEnvelopeSchema, l as PutioSdkConfig, m as makePutioSdkConfig, n as toCursorSelectionForm, o as makeCursorSelectionSchema, p as makePutioFetchLayer, q as responseRateLimitHeaders, r as NonEmptyStringSchema, s as OkResponseSchema, t as joinCsv, u as buildPutioUrl, v as requestJson, w as DEFAULT_PUTIO_UPLOAD_BASE_URL, x as selectJsonField, y as requestText, z as isPutioErrorEnvelope } from "./forms-D5duroB1.js";
2
- import { Cause, Context, Effect, Exit, Layer, ManagedRuntime, Schema, SchemaIssue, SchemaParser } from "effect";
1
+ import { A as PutioOperationError, B as isPutioOperationError, C as PositiveIntegerSchema, D as PutioAuthError, E as PutioApiError, F as definePutioOperationErrorSpec, G as parseErrorBody, H as mapConfigurationError, I as fallbackPutioErrorEnvelope, J as withOperationErrors, K as responseRateLimitHeaders, L as isPutioApiError, M as PutioTransportError, N as PutioValidationError, O as PutioConfigurationError, P as decodePutioErrorEnvelope, R as isPutioAuthError, S as NonEmptyStringSchema, T as decodeAndRun, U as mapDecodeErrorToValidationError, V as isPutioRateLimitError, W as mapTransportError, _ as selectJsonField, a as PutioSdkConfig, b as DEFAULT_PUTIO_UPLOAD_BASE_URL, c as makePutioFetchClient, d as putioSdkLayer, f as putioSdkLiveLayer, g as requestVoid, h as requestText, i as PutioHttpClient, j as PutioRateLimitError, k as PutioErrorEnvelopeSchema, l as makePutioFetchLayer, m as requestJson, n as toCursorSelectionForm, o as buildPutioUrl, p as requestArrayBuffer, q as toPutioResponseError, r as OkResponseSchema, s as encodePathSegment, t as joinCsv, u as normalizePutioSdkOptions, v as selectJsonFields, w as cursorSelectionSchema, x as DEFAULT_PUTIO_WEB_APP_URL, y as DEFAULT_PUTIO_API_BASE_URL, z as isPutioErrorEnvelope } from "./forms-B9-NYUR5.js";
2
+ import { Context, Effect, Layer, ManagedRuntime, Predicate, Schema, SchemaIssue, SchemaParser, Struct } from "effect";
3
3
  // src/domains/account.ts
4
4
  const RequestedFlag$1 = Schema.Literal(1);
5
5
  const AccountDiskSchema = Schema.Struct({
@@ -180,26 +180,19 @@ const AccountConfirmationsEnvelopeSchema = Schema.Struct({
180
180
  confirmations: Schema.Array(AccountConfirmationSchema),
181
181
  status: Schema.Literal("OK")
182
182
  });
183
- const missingFieldError$1 = (field) => new PutioValidationError({ cause: `Expected put.io to include "${field}" because it was requested` });
184
- const failMissingField$1 = (field) => Effect.fail(missingFieldError$1(field));
185
- const widenValidationError$1 = (effect) => effect;
183
+ const failMissingField$1 = (field) => Effect.fail(new PutioValidationError({ cause: `Expected put.io to include "${field}" because it was requested` }));
186
184
  const mapSensitiveAccountDecodeError = (operation) => () => new PutioValidationError({ cause: {
187
185
  domain: "account",
188
186
  operation,
189
187
  reason: "Invalid request input"
190
188
  } });
191
- const hasDownloadToken = (value) => typeof value.download_token === "string";
192
- const hasFeatures = (value) => typeof value.features === "object" && value.features !== null;
193
- const hasPas = (value) => typeof value.pas === "object" && value.pas !== null && typeof value.pas.user_hash === "string";
194
- const hasPaddleUserId = (value) => "paddle_user_id" in value;
195
- const hasPushToken = (value) => typeof value.push_token === "string";
196
189
  const ensureAccountInfoFields = (effect, query) => Effect.gen(function* () {
197
- const info = yield* widenValidationError$1(effect);
198
- if (query.download_token === 1 && !hasDownloadToken(info)) return yield* failMissingField$1("download_token");
199
- if (query.features === 1 && !hasFeatures(info)) return yield* failMissingField$1("features");
200
- if (query.pas === 1 && !hasPas(info)) return yield* failMissingField$1("pas");
201
- if (query.profitwell === 1 && !hasPaddleUserId(info)) return yield* failMissingField$1("paddle_user_id");
202
- if (query.push_token === 1 && !hasPushToken(info)) return yield* failMissingField$1("push_token");
190
+ const info = yield* effect;
191
+ if (query.download_token === 1 && info.download_token === void 0) return yield* failMissingField$1("download_token");
192
+ if (query.features === 1 && info.features === void 0) return yield* failMissingField$1("features");
193
+ if (query.pas === 1 && info.pas === void 0) return yield* failMissingField$1("pas");
194
+ if (query.profitwell === 1 && !("paddle_user_id" in info)) return yield* failMissingField$1("paddle_user_id");
195
+ if (query.push_token === 1 && info.push_token === void 0) return yield* failMissingField$1("push_token");
203
196
  return info;
204
197
  });
205
198
  const SaveAccountSettingsErrorSpec = definePutioOperationErrorSpec({
@@ -289,14 +282,14 @@ const AccountConfirmationsErrorSpec = definePutioOperationErrorSpec({
289
282
  }]
290
283
  });
291
284
  function getAccountInfo(query = {}) {
292
- return Schema.decodeUnknownEffect(AccountInfoQuerySchema, { onExcessProperty: "error" })(query).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedQuery) => {
285
+ return decodeAndRun(AccountInfoQuerySchema, query, (decodedQuery) => {
293
286
  const effect = requestJson(AccountInfoEnvelopeSchema, {
294
287
  method: "GET",
295
288
  path: "/v2/account/info",
296
289
  query: decodedQuery
297
290
  }).pipe(selectJsonField("info"));
298
291
  return ensureAccountInfoFields(effect, decodedQuery);
299
- }));
292
+ });
300
293
  }
301
294
  const getAccountSettings = () => requestJson(AccountSettingsEnvelopeSchema, {
302
295
  method: "GET",
@@ -314,14 +307,14 @@ const saveAccountSettings = (payload) => Schema.decodeUnknownEffect(SaveAccountS
314
307
  method: "POST",
315
308
  path: "/v2/account/settings"
316
309
  })), withOperationErrors(SaveAccountSettingsErrorSpec));
317
- const clearAccount = (options) => Schema.decodeUnknownEffect(AccountClearOptionsSchema, { onExcessProperty: "error" })(options).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedOptions) => requestJson(OkResponseSchema, {
310
+ const clearAccount = (options) => decodeAndRun(AccountClearOptionsSchema, options, (decodedOptions) => requestJson(OkResponseSchema, {
318
311
  body: {
319
312
  type: "form",
320
313
  value: decodedOptions
321
314
  },
322
315
  method: "POST",
323
316
  path: "/v2/account/clear"
324
- })));
317
+ }));
325
318
  const destroyAccount = (currentPassword) => Schema.decodeUnknownEffect(Schema.String.check(Schema.isMinLength(1)))(currentPassword).pipe(Effect.mapError(mapSensitiveAccountDecodeError("destroy")), Effect.flatMap((decodedPassword) => requestJson(OkResponseSchema, {
326
319
  body: {
327
320
  type: "form",
@@ -330,11 +323,11 @@ const destroyAccount = (currentPassword) => Schema.decodeUnknownEffect(Schema.St
330
323
  method: "POST",
331
324
  path: "/v2/account/destroy"
332
325
  })));
333
- const listAccountConfirmations = (subject) => Schema.decodeUnknownEffect(Schema.UndefinedOr(AccountConfirmationSubjectSchema))(subject).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedSubject) => requestJson(AccountConfirmationsEnvelopeSchema, {
326
+ const listAccountConfirmations = (subject) => decodeAndRun(Schema.UndefinedOr(AccountConfirmationSubjectSchema), subject, (decodedSubject) => requestJson(AccountConfirmationsEnvelopeSchema, {
334
327
  method: "GET",
335
328
  path: "/v2/account/confirmation/list",
336
329
  query: decodedSubject ? { type: decodedSubject } : void 0
337
- })), selectJsonField("confirmations"), withOperationErrors(AccountConfirmationsErrorSpec));
330
+ })).pipe(selectJsonField("confirmations"), withOperationErrors(AccountConfirmationsErrorSpec));
338
331
  // src/domains/app-specific-passwords.ts
339
332
  const AppSpecificPasswordIdSchema = Schema.Int.check(Schema.isGreaterThan(0));
340
333
  const AppSpecificPasswordNoteSchema = Schema.Trim.check(Schema.isMinLength(1), Schema.isMaxLength(255));
@@ -404,42 +397,41 @@ const DeleteAllAppSpecificPasswordsErrorSpec = definePutioOperationErrorSpec({
404
397
  operation: "appSpecificPasswords.deleteAll",
405
398
  knownErrors: [RestrictedAppSpecificPasswordError]
406
399
  });
407
- const createAppSpecificPassword = (input) => Schema.decodeUnknownEffect(CreateAppSpecificPasswordInputSchema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(CreateAppSpecificPasswordEnvelopeSchema, {
400
+ const createAppSpecificPassword = (input) => decodeAndRun(CreateAppSpecificPasswordInputSchema, input, (decodedInput) => requestJson(CreateAppSpecificPasswordEnvelopeSchema, {
408
401
  body: {
409
402
  type: "form",
410
403
  value: decodedInput
411
404
  },
412
405
  method: "POST",
413
406
  path: "/v2/app_specific_password/create"
414
- })), selectJsonFields("created_at", "id", "ip_address", "last_used_at", "note", "password"), withOperationErrors(CreateAppSpecificPasswordErrorSpec));
407
+ })).pipe(selectJsonFields("created_at", "id", "ip_address", "last_used_at", "note", "password"), withOperationErrors(CreateAppSpecificPasswordErrorSpec));
415
408
  const listAppSpecificPasswords = () => requestJson(ListAppSpecificPasswordsEnvelopeSchema, {
416
409
  method: "GET",
417
410
  path: "/v2/app_specific_password/list"
418
411
  }).pipe(selectJsonField("passwords"), withOperationErrors(ListAppSpecificPasswordsErrorSpec));
419
- const deleteAppSpecificPassword = (id) => Schema.decodeUnknownEffect(AppSpecificPasswordIdSchema)(id).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedId) => requestJson(OkResponseSchema, {
412
+ const deleteAppSpecificPassword = (id) => decodeAndRun(AppSpecificPasswordIdSchema, id, (decodedId) => requestJson(OkResponseSchema, {
420
413
  method: "POST",
421
414
  path: `/v2/app_specific_password/${encodePathSegment(decodedId)}/delete`
422
- })), Effect.asVoid, withOperationErrors(DeleteAppSpecificPasswordErrorSpec));
415
+ })).pipe(Effect.asVoid, withOperationErrors(DeleteAppSpecificPasswordErrorSpec));
423
416
  const deleteAllAppSpecificPasswords = () => requestJson(OkResponseSchema, {
424
417
  method: "POST",
425
418
  path: "/v2/app_specific_password/delete_all"
426
419
  }).pipe(Effect.asVoid, withOperationErrors(DeleteAllAppSpecificPasswordsErrorSpec));
427
420
  // src/domains/oauth.ts
428
- const OAuthAppBaseSchema = Schema.Struct({
421
+ const OAuthAppSchema = Schema.Struct({
429
422
  description: Schema.String,
430
423
  has_icon: Schema.NullOr(Schema.Boolean),
431
424
  id: Schema.Int,
432
425
  name: Schema.String,
433
426
  website: Schema.String
434
427
  });
435
- const OAuthAppSchema = OAuthAppBaseSchema;
436
- const OwnedOAuthAppSchema = OAuthAppBaseSchema.pipe(Schema.fieldsAssign({
428
+ const OwnedOAuthAppSchema = OAuthAppSchema.pipe(Schema.fieldsAssign({
437
429
  callback: Schema.String,
438
430
  hidden: Schema.Boolean,
439
431
  secret: Schema.String
440
432
  }));
441
433
  const MyOAuthAppSchema = OwnedOAuthAppSchema.pipe(Schema.fieldsAssign({ users: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)) }));
442
- const PopularOAuthAppSchema = OAuthAppBaseSchema.pipe(Schema.fieldsAssign({
434
+ const PopularOAuthAppSchema = OAuthAppSchema.pipe(Schema.fieldsAssign({
443
435
  hidden: Schema.optional(Schema.Boolean),
444
436
  maker: Schema.String,
445
437
  users: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))
@@ -579,60 +571,58 @@ const queryOAuthApps = () => requestJson(OAuthAppsEnvelopeSchema, {
579
571
  method: "GET",
580
572
  path: "/v2/oauth/apps"
581
573
  }).pipe(selectJsonField("apps"), withOperationErrors(QueryOAuthAppsErrorSpec));
582
- const getOAuthApp = (id, options) => Schema.decodeUnknownEffect(Schema.Struct({
574
+ const getOAuthApp = (id, options) => decodeAndRun(Schema.Struct({
583
575
  id: OAuthAppIdSchema,
584
576
  options: Schema.optional(Schema.Struct({ edit: Schema.optional(Schema.Boolean) }))
585
- }), { onExcessProperty: "error" })({
577
+ }), {
586
578
  id,
587
579
  options
588
- }).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(OAuthAppWithTokenSchema, {
580
+ }, (decodedInput) => requestJson(OAuthAppWithTokenSchema, {
589
581
  method: "GET",
590
582
  path: decodedInput.options?.edit ? `/v2/oauth/apps/${encodePathSegment(decodedInput.id)}/edit` : `/v2/oauth/apps/${encodePathSegment(decodedInput.id)}`
591
- })), withOperationErrors(GetOAuthAppErrorSpec));
592
- const setOAuthAppIcon = (id, input) => {
593
- return Schema.decodeUnknownEffect(Schema.Struct({
594
- id: OAuthAppIdSchema,
595
- input: OAuthSetIconInputSchema
596
- }), { onExcessProperty: "error" })({
597
- id,
598
- input
599
- }).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => {
600
- const formData = new FormData();
601
- formData.append("icon", decodedInput.input.icon);
602
- return requestJson(OkResponseSchema, {
603
- body: {
604
- type: "form-data",
605
- value: formData
606
- },
607
- method: "POST",
608
- path: `/v2/oauth/apps/${encodePathSegment(decodedInput.id)}/icon`
609
- });
610
- }));
611
- };
612
- const createOAuthApp = (input) => Schema.decodeUnknownEffect(OAuthAppCreateInputSchema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(OAuthAppEnvelopeSchema, {
583
+ })).pipe(withOperationErrors(GetOAuthAppErrorSpec));
584
+ const setOAuthAppIcon = (id, input) => decodeAndRun(Schema.Struct({
585
+ id: OAuthAppIdSchema,
586
+ input: OAuthSetIconInputSchema
587
+ }), {
588
+ id,
589
+ input
590
+ }, (decodedInput) => {
591
+ const formData = new FormData();
592
+ formData.append("icon", decodedInput.input.icon);
593
+ return requestJson(OkResponseSchema, {
594
+ body: {
595
+ type: "form-data",
596
+ value: formData
597
+ },
598
+ method: "POST",
599
+ path: `/v2/oauth/apps/${encodePathSegment(decodedInput.id)}/icon`
600
+ });
601
+ });
602
+ const createOAuthApp = (input) => decodeAndRun(OAuthAppCreateInputSchema, input, (decodedInput) => requestJson(OAuthAppEnvelopeSchema, {
613
603
  body: {
614
604
  type: "form-data",
615
605
  value: makeCreateOAuthAppFormData(decodedInput)
616
606
  },
617
607
  method: "POST",
618
608
  path: "/v2/oauth/apps/register"
619
- })), withOperationErrors(CreateOAuthAppErrorSpec));
620
- const updateOAuthApp = (input) => Schema.decodeUnknownEffect(OAuthAppUpdateInputSchema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(OAuthAppWithTokenSchema, {
609
+ })).pipe(withOperationErrors(CreateOAuthAppErrorSpec));
610
+ const updateOAuthApp = (input) => decodeAndRun(OAuthAppUpdateInputSchema, input, (decodedInput) => requestJson(OAuthAppWithTokenSchema, {
621
611
  body: {
622
612
  type: "form-data",
623
613
  value: makeUpdateOAuthAppFormData(decodedInput)
624
614
  },
625
615
  method: "POST",
626
616
  path: `/v2/oauth/apps/${encodePathSegment(decodedInput.id)}`
627
- })), withOperationErrors(UpdateOAuthAppErrorSpec));
628
- const deleteOAuthApp = (id) => Schema.decodeUnknownEffect(OAuthAppIdSchema)(id).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedId) => requestJson(OkResponseSchema, {
617
+ })).pipe(withOperationErrors(UpdateOAuthAppErrorSpec));
618
+ const deleteOAuthApp = (id) => decodeAndRun(OAuthAppIdSchema, id, (decodedId) => requestJson(OkResponseSchema, {
629
619
  method: "POST",
630
620
  path: `/v2/oauth/apps/${encodePathSegment(decodedId)}/delete`
631
- })), withOperationErrors(DeleteOAuthAppErrorSpec));
632
- const regenerateOAuthAppToken = (id) => Schema.decodeUnknownEffect(OAuthAppIdSchema)(id).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedId) => requestJson(OAuthRegeneratedTokenEnvelopeSchema, {
621
+ })).pipe(withOperationErrors(DeleteOAuthAppErrorSpec));
622
+ const regenerateOAuthAppToken = (id) => decodeAndRun(OAuthAppIdSchema, id, (decodedId) => requestJson(OAuthRegeneratedTokenEnvelopeSchema, {
633
623
  method: "POST",
634
624
  path: `/v2/oauth/apps/${encodePathSegment(decodedId)}/regenerate_token`
635
- })), selectJsonField("access_token"), withOperationErrors(RegenerateOAuthAppTokenErrorSpec));
625
+ })).pipe(selectJsonField("access_token"), withOperationErrors(RegenerateOAuthAppTokenErrorSpec));
636
626
  const getPopularOAuthApps = () => requestJson(PopularOAuthAppsEnvelopeSchema, {
637
627
  method: "GET",
638
628
  path: "/v2/oauth/apps/popular"
@@ -686,11 +676,7 @@ const AuthorizationCodeSchema = Schema.Struct({
686
676
  code: Schema.String,
687
677
  qr_code_url: Schema.String
688
678
  });
689
- const AuthorizationCodeEnvelopeSchema = Schema.Struct({
690
- code: Schema.String,
691
- qr_code_url: Schema.String,
692
- status: Schema.Literal("OK")
693
- });
679
+ const AuthorizationCodeEnvelopeSchema = AuthorizationCodeSchema.pipe(Schema.fieldsAssign({ status: Schema.Literal("OK") }));
694
680
  const CodeMatchEnvelopeSchema = Schema.Struct({
695
681
  oauth_token: Schema.NullOr(Schema.String),
696
682
  status: Schema.Literal("OK")
@@ -743,21 +729,12 @@ const ExistsEnvelopeSchema = Schema.Struct({
743
729
  exists: Schema.Boolean,
744
730
  status: Schema.Literal("OK")
745
731
  });
746
- const ResetPasswordEnvelopeSchema = Schema.Struct({
732
+ const AccessTokenEnvelopeSchema = Schema.Struct({
747
733
  access_token: Schema.String,
748
734
  status: Schema.Literal("OK")
749
735
  });
750
- const GenerateTOTPEnvelopeSchema = Schema.Struct({
751
- recovery_codes: TwoFactorRecoveryCodesSchema,
752
- secret: Schema.String,
753
- status: Schema.Literal("OK"),
754
- uri: Schema.String
755
- });
756
- const VerifyTOTPEnvelopeSchema = Schema.Struct({
757
- status: Schema.Literal("OK"),
758
- token: Schema.String,
759
- user_id: Schema.Int
760
- });
736
+ const GenerateTOTPEnvelopeSchema = GenerateTOTPResponseSchema.pipe(Schema.fieldsAssign({ status: Schema.Literal("OK") }));
737
+ const VerifyTOTPEnvelopeSchema = VerifyTOTPResponseSchema.pipe(Schema.fieldsAssign({ status: Schema.Literal("OK") }));
761
738
  const RecoveryCodesEnvelopeSchema = Schema.Struct({
762
739
  recovery_codes: TwoFactorRecoveryCodesSchema,
763
740
  status: Schema.Literal("OK")
@@ -1094,7 +1071,7 @@ const logout = () => requestJson(OkResponseSchema, {
1094
1071
  method: "POST",
1095
1072
  path: "/v2/oauth/grants/logout"
1096
1073
  });
1097
- const register = (input) => decodeAuthInput("register", RegisterInputSchema, input, (decodedInput) => requestJson(ResetPasswordEnvelopeSchema, {
1074
+ const register = (input) => decodeAuthInput("register", RegisterInputSchema, input, (decodedInput) => requestJson(AccessTokenEnvelopeSchema, {
1098
1075
  auth: { type: "none" },
1099
1076
  body: {
1100
1077
  type: "form",
@@ -1144,7 +1121,7 @@ const forgotPassword = (mail) => decodeAuthInput("forgotPassword", NonEmptyStrin
1144
1121
  const resetPassword = (key, password) => decodeAuthInput("resetPassword", AuthResetPasswordInputSchema, {
1145
1122
  key,
1146
1123
  password
1147
- }, (decodedInput) => requestJson(ResetPasswordEnvelopeSchema, {
1124
+ }, (decodedInput) => requestJson(AccessTokenEnvelopeSchema, {
1148
1125
  auth: { type: "none" },
1149
1126
  body: {
1150
1127
  type: "form",
@@ -1204,11 +1181,7 @@ const validateToken = (token) => decodeAuthInput("validateToken", NonEmptyString
1204
1181
  const generateTOTP = () => requestJson(GenerateTOTPEnvelopeSchema, {
1205
1182
  method: "POST",
1206
1183
  path: "/v2/two_factor/generate/totp"
1207
- }).pipe(Effect.map(({ recovery_codes, secret, uri }) => ({
1208
- recovery_codes,
1209
- secret,
1210
- uri
1211
- })), withOperationErrors(GenerateTOTPErrorSpec));
1184
+ }).pipe(selectJsonFields("recovery_codes", "secret", "uri"), withOperationErrors(GenerateTOTPErrorSpec));
1212
1185
  const verifyTOTP = (twoFactorScopedToken, code) => decodeAuthInput("verifyTOTP", AuthVerifyTotpInputSchema, {
1213
1186
  code,
1214
1187
  twoFactorScopedToken
@@ -1221,10 +1194,7 @@ const verifyTOTP = (twoFactorScopedToken, code) => decodeAuthInput("verifyTOTP",
1221
1194
  method: "POST",
1222
1195
  path: "/v2/two_factor/verify/totp",
1223
1196
  query: { oauth_token: decodedInput.twoFactorScopedToken }
1224
- }).pipe(Effect.map(({ token, user_id }) => ({
1225
- token,
1226
- user_id
1227
- })))).pipe(withOperationErrors(VerifyTOTPErrorSpec));
1197
+ }).pipe(selectJsonFields("token", "user_id"))).pipe(withOperationErrors(VerifyTOTPErrorSpec));
1228
1198
  const getRecoveryCodes = () => requestJson(RecoveryCodesEnvelopeSchema, {
1229
1199
  method: "GET",
1230
1200
  path: "/v2/two_factor/recovery_codes"
@@ -1236,150 +1206,106 @@ const regenerateRecoveryCodes = () => requestJson(RecoveryCodesEnvelopeSchema, {
1236
1206
  // src/domains/config.ts
1237
1207
  const nativeObjectConstructorSource = Function.prototype.toString.call(Object);
1238
1208
  const nativeArrayConstructorSource = Function.prototype.toString.call(Array);
1239
- const hasMatchingNativeConstructor = (prototype, constructorSource) => {
1209
+ const isNativePrototype = (prototype, constructorSource) => {
1240
1210
  const constructor = Object.getOwnPropertyDescriptor(prototype, "constructor")?.value;
1241
- const constructorPrototype = typeof constructor === "function" ? Object.getOwnPropertyDescriptor(constructor, "prototype")?.value : void 0;
1242
- return typeof constructor === "function" && constructorPrototype === prototype && Function.prototype.toString.call(constructor) === constructorSource;
1211
+ return Predicate.isFunction(constructor) && Object.getOwnPropertyDescriptor(constructor, "prototype")?.value === prototype && Function.prototype.toString.call(constructor) === constructorSource;
1243
1212
  };
1244
1213
  const isPlainRecord = (value) => {
1245
1214
  try {
1215
+ if (Array.isArray(value)) return false;
1246
1216
  const prototype = Object.getPrototypeOf(value);
1247
1217
  if (prototype === null) return true;
1248
1218
  if (Object.getPrototypeOf(prototype) !== null) return false;
1249
- return hasMatchingNativeConstructor(prototype, nativeObjectConstructorSource);
1219
+ return isNativePrototype(prototype, nativeObjectConstructorSource);
1250
1220
  } catch {
1251
1221
  return false;
1252
1222
  }
1253
1223
  };
1254
1224
  const isPlainArray = (value) => {
1255
1225
  try {
1226
+ if (!Array.isArray(value)) return false;
1256
1227
  const prototype = Object.getPrototypeOf(value);
1257
- return prototype !== null && Object.getPrototypeOf(prototype) !== null && hasMatchingNativeConstructor(prototype, nativeArrayConstructorSource);
1228
+ return prototype !== null && Object.getPrototypeOf(prototype) !== null && isNativePrototype(prototype, nativeArrayConstructorSource);
1258
1229
  } catch {
1259
1230
  return false;
1260
1231
  }
1261
1232
  };
1262
- const invalidJsonWalk = { _tag: "Invalid" };
1263
- const validatedJsonWalk = { _tag: "Validated" };
1264
- const walkJsonValue = (value, mode, ancestors = /* @__PURE__ */ new Set()) => {
1265
- if (value === null || typeof value === "string" || typeof value === "boolean") return mode === "snapshot" ? {
1266
- _tag: "Snapshot",
1267
- value
1268
- } : validatedJsonWalk;
1269
- if (typeof value === "number") return Number.isFinite(value) ? mode === "snapshot" ? {
1270
- _tag: "Snapshot",
1271
- value
1272
- } : validatedJsonWalk : invalidJsonWalk;
1273
- if (typeof value !== "object" || ancestors.has(value)) return invalidJsonWalk;
1233
+ const copyOfJsonValue = (value, copies) => (Predicate.isObjectKeyword(value) ? copies.get(value) : void 0) ?? value;
1234
+ const isJsonValueWithin = (value, ancestors, copies) => {
1235
+ if (Predicate.isNull(value) || Predicate.isString(value) || Predicate.isBoolean(value)) return true;
1236
+ if (Predicate.isNumber(value)) return Number.isFinite(value);
1237
+ if (!Predicate.isObjectKeyword(value) || ancestors.has(value)) return false;
1274
1238
  ancestors.add(value);
1275
1239
  try {
1276
1240
  if (Array.isArray(value)) {
1277
- if (!isPlainArray(value)) return invalidJsonWalk;
1241
+ if (!isPlainArray(value)) return false;
1278
1242
  const descriptors = Object.getOwnPropertyDescriptors(value);
1279
- const lengthDescriptor = descriptors["length"];
1280
- if (lengthDescriptor === void 0 || !("value" in lengthDescriptor) || !Number.isSafeInteger(lengthDescriptor.value) || lengthDescriptor.value < 0) return invalidJsonWalk;
1281
- const output = mode === "snapshot" ? [] : void 0;
1282
- for (let index = 0; index < lengthDescriptor.value; index += 1) {
1243
+ const length = descriptors["length"]?.value;
1244
+ if (!Number.isSafeInteger(length) || length < 0) return false;
1245
+ const output = [];
1246
+ for (let index = 0; index < length; index += 1) {
1283
1247
  const descriptor = descriptors[String(index)];
1284
- if (descriptor === void 0 || !("value" in descriptor)) return invalidJsonWalk;
1285
- const item = walkJsonValue(descriptor.value, mode, ancestors);
1286
- if (item._tag === "Invalid") return item;
1287
- if (output === void 0) {
1288
- if (item._tag !== "Validated") return invalidJsonWalk;
1289
- } else {
1290
- if (item._tag !== "Snapshot") return invalidJsonWalk;
1291
- output.push(item.value);
1292
- }
1248
+ if (descriptor === void 0 || !("value" in descriptor) || !isJsonValueWithin(descriptor.value, ancestors, copies)) return false;
1249
+ if (copies !== void 0) output.push(copyOfJsonValue(descriptor.value, copies));
1293
1250
  }
1294
- return output === void 0 ? validatedJsonWalk : {
1295
- _tag: "Snapshot",
1296
- value: output
1297
- };
1251
+ copies?.set(value, output);
1252
+ return true;
1298
1253
  }
1299
- if (!isPlainRecord(value)) return invalidJsonWalk;
1300
- const output = mode === "snapshot" ? {} : void 0;
1254
+ if (!isPlainRecord(value)) return false;
1255
+ const output = {};
1301
1256
  for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(value))) {
1302
1257
  if (!descriptor.enumerable) continue;
1303
- if (!("value" in descriptor)) return invalidJsonWalk;
1304
- const item = walkJsonValue(descriptor.value, mode, ancestors);
1305
- if (item._tag === "Invalid") return item;
1306
- if (output === void 0) {
1307
- if (item._tag !== "Validated") return invalidJsonWalk;
1308
- continue;
1309
- }
1310
- if (item._tag !== "Snapshot") return invalidJsonWalk;
1311
- Object.defineProperty(output, key, {
1258
+ if (!("value" in descriptor) || !isJsonValueWithin(descriptor.value, ancestors, copies)) return false;
1259
+ if (copies !== void 0) Object.defineProperty(output, key, {
1312
1260
  configurable: true,
1313
1261
  enumerable: true,
1314
- value: item.value,
1262
+ value: copyOfJsonValue(descriptor.value, copies),
1315
1263
  writable: true
1316
1264
  });
1317
1265
  }
1318
- return output === void 0 ? validatedJsonWalk : {
1319
- _tag: "Snapshot",
1320
- value: output
1321
- };
1266
+ copies?.set(value, output);
1267
+ return true;
1322
1268
  } catch {
1323
- return invalidJsonWalk;
1269
+ return false;
1324
1270
  } finally {
1325
1271
  ancestors.delete(value);
1326
1272
  }
1327
1273
  };
1328
- const snapshotJsonValue = (value) => {
1329
- const result = walkJsonValue(value, "snapshot");
1330
- return result._tag === "Snapshot" ? result.value : void 0;
1331
- };
1332
- const snapshotJsonObject = (value) => {
1333
- const snapshot = snapshotJsonValue(value);
1334
- return typeof snapshot === "object" && snapshot !== null && !Array.isArray(snapshot) ? snapshot : void 0;
1335
- };
1336
- const isJsonValue = (value) => walkJsonValue(value, "validate")._tag === "Validated";
1337
- const isJsonObject = (value) => typeof value === "object" && value !== null && isJsonValue(value) && !Array.isArray(value);
1274
+ const isJsonValue = (value) => isJsonValueWithin(value, /* @__PURE__ */ new Set(), void 0);
1275
+ const isJsonObjectValue = (value) => Predicate.isObjectKeyword(value) && !Array.isArray(value);
1276
+ const isJsonObject = (value) => isJsonValue(value) && isJsonObjectValue(value);
1338
1277
  const JsonValueSchema = Schema.declareConstructor()([], () => (input, ast, options) => {
1339
- const snapshot = snapshotJsonValue(input);
1340
- return snapshot === void 0 ? Effect.fail(new SchemaIssue.InvalidType(ast, input, options)) : Effect.succeed(snapshot);
1278
+ const copies = /* @__PURE__ */ new Map();
1279
+ return isJsonValueWithin(input, /* @__PURE__ */ new Set(), copies) ? Effect.succeed(copyOfJsonValue(input, copies)) : Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
1341
1280
  }, { expected: "a JSON-compatible value" });
1342
1281
  const JsonValueResponseSchema = Schema.declareConstructor()([], () => (input, ast, options) => isJsonValue(input) ? Effect.succeed(input) : Effect.fail(new SchemaIssue.InvalidType(ast, input, options)), { expected: "a JSON-compatible value" });
1343
1282
  const JsonObjectResponseSchema = Schema.declareConstructor()([], () => (input, ast, options) => isJsonObject(input) ? Effect.succeed(input) : Effect.fail(new SchemaIssue.InvalidType(ast, input, options)), { expected: "a JSON object" });
1344
1283
  const JsonObjectSchema = Schema.declareConstructor()([], () => (input, ast, options) => {
1345
- const snapshot = snapshotJsonObject(input);
1346
- return snapshot === void 0 ? Effect.fail(new SchemaIssue.InvalidType(ast, input, options)) : Effect.succeed(snapshot);
1284
+ const copies = /* @__PURE__ */ new Map();
1285
+ if (!isJsonValueWithin(input, /* @__PURE__ */ new Set(), copies)) return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
1286
+ const copy = copyOfJsonValue(input, copies);
1287
+ return isJsonObjectValue(copy) ? Effect.succeed(copy) : Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
1347
1288
  }, { expected: "a JSON object" });
1348
1289
  const ConfigKeySchema = Schema.String.check(Schema.isMinLength(1), Schema.isPattern(/^(?!\.{1,2}$)/), Schema.makeFilter((key) => key.isWellFormed(), { expected: "a well-formed Unicode config key" }));
1349
1290
  const ConfigSetKeyInputSchema = Schema.Struct({
1350
1291
  key: ConfigKeySchema,
1351
1292
  value: JsonValueSchema
1352
1293
  });
1353
- const getResponseEnvelopeFields = (input, valueField) => {
1354
- if (typeof input !== "object" || input === null || !isPlainRecord(input)) return;
1355
- try {
1356
- const statusDescriptor = Object.getOwnPropertyDescriptor(input, "status");
1357
- const valueDescriptor = Object.getOwnPropertyDescriptor(input, valueField);
1358
- if (statusDescriptor === void 0 || !("value" in statusDescriptor) || valueDescriptor === void 0 || !("value" in valueDescriptor)) return;
1359
- return {
1360
- status: statusDescriptor.value,
1361
- value: valueDescriptor.value
1362
- };
1363
- } catch {
1364
- return;
1365
- }
1366
- };
1367
- const makeConfigEnvelopeSchema = (schema) => Schema.declareConstructor()([schema], ([configSchema]) => (input, ast, options) => {
1368
- const fields = getResponseEnvelopeFields(input, "config");
1369
- if (fields === void 0 || fields.status !== "OK") return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
1370
- return SchemaParser.decodeUnknownEffect(configSchema)(fields.value, options).pipe(Effect.map((config) => ({
1371
- config,
1372
- status: "OK"
1373
- })));
1374
- });
1375
- const makeConfigValueEnvelopeSchema = (schema) => Schema.declareConstructor()([schema], ([valueSchema]) => (input, ast, options) => {
1376
- const fields = getResponseEnvelopeFields(input, "value");
1377
- if (fields === void 0 || fields.status !== "OK") return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
1378
- return SchemaParser.decodeUnknownEffect(valueSchema)(fields.value, options).pipe(Effect.map((value) => ({
1379
- status: "OK",
1380
- value
1381
- })));
1382
- });
1294
+ const okEnvelopeField = (status, field) => status !== void 0 && "value" in status && status.value === "OK" && field !== void 0 && "value" in field ? field : void 0;
1295
+ const makeConfigEnvelopeSchema = (schema) => Schema.declareConstructor()([schema], ([configSchema]) => (input, ast, options) => Effect.try({
1296
+ try: () => isPlainRecord(input) ? okEnvelopeField(Object.getOwnPropertyDescriptor(input, "status"), Object.getOwnPropertyDescriptor(input, "config")) : void 0,
1297
+ catch: () => new SchemaIssue.InvalidType(ast, input, options)
1298
+ }).pipe(Effect.flatMap((field) => field === void 0 ? Effect.fail(new SchemaIssue.InvalidType(ast, input, options)) : SchemaParser.decodeUnknownEffect(configSchema)(field.value, options)), Effect.map((config) => ({
1299
+ config,
1300
+ status: "OK"
1301
+ }))));
1302
+ const makeConfigValueEnvelopeSchema = (schema) => Schema.declareConstructor()([schema], ([valueSchema]) => (input, ast, options) => Effect.try({
1303
+ try: () => isPlainRecord(input) ? okEnvelopeField(Object.getOwnPropertyDescriptor(input, "status"), Object.getOwnPropertyDescriptor(input, "value")) : void 0,
1304
+ catch: () => new SchemaIssue.InvalidType(ast, input, options)
1305
+ }).pipe(Effect.flatMap((field) => field === void 0 ? Effect.fail(new SchemaIssue.InvalidType(ast, input, options)) : SchemaParser.decodeUnknownEffect(valueSchema)(field.value, options)), Effect.map((value) => ({
1306
+ status: "OK",
1307
+ value
1308
+ }))));
1383
1309
  const ConfigEnvelopeSchema = makeConfigEnvelopeSchema(JsonObjectResponseSchema);
1384
1310
  const ConfigValueEnvelopeSchema = makeConfigValueEnvelopeSchema(JsonValueResponseSchema);
1385
1311
  const readConfig = () => requestJson(ConfigEnvelopeSchema, {
@@ -1390,37 +1316,37 @@ const readConfigWith = (schema) => requestJson(makeConfigEnvelopeSchema(JsonObje
1390
1316
  method: "GET",
1391
1317
  path: "/v2/config"
1392
1318
  }).pipe(Effect.map((envelope) => envelope["config"]));
1393
- const writeConfig = (config) => Schema.decodeUnknownEffect(JsonObjectSchema)(config).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedConfig) => requestJson(OkResponseSchema, {
1319
+ const writeConfig = (config) => decodeAndRun(JsonObjectSchema, config, (decodedConfig) => requestJson(OkResponseSchema, {
1394
1320
  body: {
1395
1321
  type: "json",
1396
1322
  value: { config: decodedConfig }
1397
1323
  },
1398
1324
  method: "PUT",
1399
1325
  path: "/v2/config"
1400
- })));
1401
- const getConfigKey = (key) => Schema.decodeUnknownEffect(ConfigKeySchema)(key).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedKey) => requestJson(ConfigValueEnvelopeSchema, {
1326
+ }));
1327
+ const getConfigKey = (key) => decodeAndRun(ConfigKeySchema, key, (decodedKey) => requestJson(ConfigValueEnvelopeSchema, {
1402
1328
  method: "GET",
1403
1329
  path: `/v2/config/${encodePathSegment(decodedKey)}`
1404
- })), selectJsonField("value"));
1405
- const getConfigKeyWith = (key, schema) => Schema.decodeUnknownEffect(ConfigKeySchema)(key).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedKey) => requestJson(makeConfigValueEnvelopeSchema(JsonValueResponseSchema.pipe(Schema.decodeTo(schema))), {
1330
+ })).pipe(selectJsonField("value"));
1331
+ const getConfigKeyWith = (key, schema) => decodeAndRun(ConfigKeySchema, key, (decodedKey) => requestJson(makeConfigValueEnvelopeSchema(JsonValueResponseSchema.pipe(Schema.decodeTo(schema))), {
1406
1332
  method: "GET",
1407
1333
  path: `/v2/config/${encodePathSegment(decodedKey)}`
1408
- })), Effect.map((envelope) => envelope["value"]));
1409
- const setConfigKey = (key, value) => Schema.decodeUnknownEffect(ConfigSetKeyInputSchema, { onExcessProperty: "error" })({
1334
+ })).pipe(Effect.map((envelope) => envelope["value"]));
1335
+ const setConfigKey = (key, value) => decodeAndRun(ConfigSetKeyInputSchema, {
1410
1336
  key,
1411
1337
  value
1412
- }).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(OkResponseSchema, {
1338
+ }, (decodedInput) => requestJson(OkResponseSchema, {
1413
1339
  body: {
1414
1340
  type: "json",
1415
1341
  value: { value: decodedInput.value }
1416
1342
  },
1417
1343
  method: "PUT",
1418
1344
  path: `/v2/config/${encodePathSegment(decodedInput.key)}`
1419
- })));
1420
- const deleteConfigKey = (key) => Schema.decodeUnknownEffect(ConfigKeySchema)(key).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedKey) => requestJson(OkResponseSchema, {
1345
+ }));
1346
+ const deleteConfigKey = (key) => decodeAndRun(ConfigKeySchema, key, (decodedKey) => requestJson(OkResponseSchema, {
1421
1347
  method: "DELETE",
1422
1348
  path: `/v2/config/${encodePathSegment(decodedKey)}`
1423
- })));
1349
+ }));
1424
1350
  // src/domains/download-links.ts
1425
1351
  const DownloadLinksStatusSchema = Schema.Literals([
1426
1352
  "NEW",
@@ -1428,7 +1354,7 @@ const DownloadLinksStatusSchema = Schema.Literals([
1428
1354
  "DONE",
1429
1355
  "ERROR"
1430
1356
  ]);
1431
- const DownloadLinksCreateInputSchema = makeCursorSelectionSchema("ids", "excludeIds", {});
1357
+ const DownloadLinksCreateInputSchema = cursorSelectionSchema("ids", "excludeIds", {});
1432
1358
  const DownloadLinksPayloadSchema = Schema.Struct({
1433
1359
  download_links: Schema.Array(Schema.String),
1434
1360
  media_links: Schema.Array(Schema.String),
@@ -1503,18 +1429,18 @@ const GetDownloadLinksErrorSpec = definePutioOperationErrorSpec({
1503
1429
  { statusCode: 404 }
1504
1430
  ]
1505
1431
  });
1506
- const createDownloadLinks = (input = {}) => Schema.decodeUnknownEffect(DownloadLinksCreateInputSchema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(DownloadLinksCreateEnvelopeSchema, {
1432
+ const createDownloadLinks = (input = {}) => decodeAndRun(DownloadLinksCreateInputSchema, input, (decodedInput) => requestJson(DownloadLinksCreateEnvelopeSchema, {
1507
1433
  body: {
1508
1434
  type: "form",
1509
1435
  value: toCursorSelectionForm(decodedInput)
1510
1436
  },
1511
1437
  method: "POST",
1512
1438
  path: "/v2/download_links/create"
1513
- })), selectJsonFields("id"), withOperationErrors(CreateDownloadLinksErrorSpec));
1514
- const getDownloadLinks = (id) => Schema.decodeUnknownEffect(PositiveIntegerSchema)(id).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedId) => requestJson(DownloadLinksInfoSchema, {
1439
+ })).pipe(selectJsonFields("id"), withOperationErrors(CreateDownloadLinksErrorSpec));
1440
+ const getDownloadLinks = (id) => decodeAndRun(PositiveIntegerSchema, id, (decodedId) => requestJson(DownloadLinksInfoSchema, {
1515
1441
  method: "GET",
1516
1442
  path: `/v2/download_links/${encodePathSegment(decodedId)}`
1517
- })), withOperationErrors(GetDownloadLinksErrorSpec));
1443
+ })).pipe(withOperationErrors(GetDownloadLinksErrorSpec));
1518
1444
  // src/domains/events.ts
1519
1445
  const HistoryEventBaseSchema = Schema.Struct({
1520
1446
  created_at: Schema.String,
@@ -1662,23 +1588,23 @@ const GetEventTorrentErrorSpec = definePutioOperationErrorSpec({
1662
1588
  { statusCode: 500 }
1663
1589
  ]
1664
1590
  });
1665
- const listEvents = (query = {}) => Schema.decodeUnknownEffect(EventsListQuerySchema, { onExcessProperty: "error" })(query).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedQuery) => requestJson(EventsListEnvelopeSchema, {
1591
+ const listEvents = (query = {}) => decodeAndRun(EventsListQuerySchema, query, (decodedQuery) => requestJson(EventsListEnvelopeSchema, {
1666
1592
  method: "GET",
1667
1593
  path: "/v2/events/list",
1668
1594
  query: decodedQuery
1669
- })), withOperationErrors(ListEventsErrorSpec));
1670
- const deleteEvent = (id) => Schema.decodeUnknownEffect(PositiveIntegerSchema)(id).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedId) => requestJson(OkResponseSchema, {
1595
+ })).pipe(withOperationErrors(ListEventsErrorSpec));
1596
+ const deleteEvent = (id) => decodeAndRun(PositiveIntegerSchema, id, (decodedId) => requestJson(OkResponseSchema, {
1671
1597
  method: "POST",
1672
1598
  path: `/v2/events/delete/${encodePathSegment(decodedId)}`
1673
- })), withOperationErrors(DeleteEventErrorSpec));
1599
+ })).pipe(withOperationErrors(DeleteEventErrorSpec));
1674
1600
  const clearEvents = () => requestJson(OkResponseSchema, {
1675
1601
  method: "POST",
1676
1602
  path: "/v2/events/delete"
1677
1603
  }).pipe(withOperationErrors(ClearEventsErrorSpec));
1678
- const getEventTorrent = (id) => Schema.decodeUnknownEffect(PositiveIntegerSchema)(id).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedId) => requestArrayBuffer({
1604
+ const getEventTorrent = (id) => decodeAndRun(PositiveIntegerSchema, id, (decodedId) => requestArrayBuffer({
1679
1605
  method: "GET",
1680
1606
  path: `/v2/events/${encodePathSegment(decodedId)}/torrent`
1681
- })), withOperationErrors(GetEventTorrentErrorSpec));
1607
+ })).pipe(withOperationErrors(GetEventTorrentErrorSpec));
1682
1608
  // src/domains/family.ts
1683
1609
  const NonNegativeIntegerSchema = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
1684
1610
  const NonNegativeIntegerFromStringSchema = Schema.NumberFromString.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0));
@@ -1796,14 +1722,14 @@ const createFamilyInvite = () => requestJson(FamilyCreateInviteEnvelopeSchema, {
1796
1722
  method: "POST",
1797
1723
  path: "/v2/family/sub_account"
1798
1724
  }).pipe(selectJsonFields("code"), withOperationErrors(CreateFamilyInviteErrorSpec));
1799
- const removeFamilyMember = (username) => Schema.decodeUnknownEffect(NonEmptyStringSchema)(username).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedUsername) => requestJson(OkResponseSchema, {
1725
+ const removeFamilyMember = (username) => decodeAndRun(NonEmptyStringSchema, username, (decodedUsername) => requestJson(OkResponseSchema, {
1800
1726
  method: "DELETE",
1801
1727
  path: `/v2/family/sub_account/${encodePathSegment(decodedUsername)}`
1802
- })), Effect.asVoid, withOperationErrors(RemoveFamilyMemberErrorSpec));
1803
- const joinFamily = (inviteCode) => Schema.decodeUnknownEffect(NonEmptyStringSchema)(inviteCode).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInviteCode) => requestJson(OkResponseSchema, {
1728
+ })).pipe(Effect.asVoid, withOperationErrors(RemoveFamilyMemberErrorSpec));
1729
+ const joinFamily = (inviteCode) => decodeAndRun(NonEmptyStringSchema, inviteCode, (decodedInviteCode) => requestJson(OkResponseSchema, {
1804
1730
  method: "POST",
1805
1731
  path: `/v2/family/join/${encodePathSegment(decodedInviteCode)}`
1806
- })), Effect.asVoid, withOperationErrors(JoinFamilyErrorSpec));
1732
+ })).pipe(Effect.asVoid, withOperationErrors(JoinFamilyErrorSpec));
1807
1733
  // src/domains/ifttt.ts
1808
1734
  const IFTTTStatusEnvelopeSchema = Schema.Struct({
1809
1735
  enabled: Schema.Boolean,
@@ -2021,14 +1947,7 @@ const FilesListEnvelopeSchema = Schema.Struct({
2021
1947
  status: Schema.Literal("OK"),
2022
1948
  total: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))
2023
1949
  });
2024
- const FilesListContinueEnvelopeSchema = Schema.Struct({
2025
- breadcrumbs: Schema.optional(Schema.Array(FileBreadcrumbSchema)),
2026
- cursor: Schema.NullOr(Schema.String),
2027
- files: Schema.Array(FileBroadSchema),
2028
- parent: Schema.optional(Schema.NullOr(FileBroadSchema)),
2029
- status: Schema.Literal("OK"),
2030
- total: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))
2031
- });
1950
+ const FilesListContinueEnvelopeSchema = FilesListEnvelopeSchema.pipe(Schema.fieldsAssign({ parent: Schema.optional(Schema.NullOr(FileBroadSchema)) }));
2032
1951
  const FilesSearchEnvelopeSchema = Schema.Struct({
2033
1952
  cursor: Schema.NullOr(Schema.String),
2034
1953
  files: Schema.Array(FileBroadSchema),
@@ -2047,10 +1966,6 @@ const FileGetInputSchema = Schema.Struct({
2047
1966
  id: ReadableFileIdSchema,
2048
1967
  query: Schema.optional(FileQuerySchema)
2049
1968
  });
2050
- const FilesSearchContinueInputSchema = Schema.Struct({
2051
- cursor: NonEmptyStringSchema,
2052
- query: Schema.Struct({ per_page: Schema.optional(PositiveIntegerSchema) })
2053
- });
2054
1969
  const FileSubtitlesInputSchema = Schema.Struct({
2055
1970
  fileId: PositiveFileIdSchema,
2056
1971
  options: Schema.Struct({ languages: Schema.optional(Schema.Array(NonEmptyStringSchema).check(Schema.isMinLength(1))) })
@@ -2213,8 +2128,8 @@ const FilesMoveSelectionInputSchema = Schema.Struct({
2213
2128
  parentId: NonNegativeFileIdSchema,
2214
2129
  selection: FilesBulkSelectionSchema
2215
2130
  });
2216
- const FilesWatchStatusInputSchema = makeCursorSelectionSchema("ids", "excludeIds", { watched: Schema.Boolean });
2217
- const FilesExtractInputSchema = makeCursorSelectionSchema("ids", "excludeIds", { password: Schema.optional(NonEmptyStringSchema) });
2131
+ const FilesWatchStatusInputSchema = cursorSelectionSchema("ids", "excludeIds", { watched: Schema.Boolean });
2132
+ const FilesExtractInputSchema = cursorSelectionSchema("ids", "excludeIds", { password: Schema.optional(NonEmptyStringSchema) });
2218
2133
  const FileUploadInputSchema = Schema.Struct({
2219
2134
  file: Schema.instanceOf(Blob),
2220
2135
  fileName: Schema.optional(NonEmptyStringSchema),
@@ -2552,13 +2467,11 @@ const FileUploadErrorSpec = definePutioOperationErrorSpec({
2552
2467
  { statusCode: 429 }
2553
2468
  ]
2554
2469
  });
2555
- const missingFieldError = (field) => new PutioValidationError({ cause: `Expected put.io to include "${field}" because it was requested` });
2556
- const failMissingField = (field) => Effect.fail(missingFieldError(field));
2557
- const widenValidationError = (effect) => effect;
2470
+ const failMissingField = (field) => Effect.fail(new PutioValidationError({ cause: `Expected put.io to include "${field}" because it was requested` }));
2558
2471
  const hasStreamUrl = (value) => "stream_url" in value;
2559
2472
  const hasMp4StreamUrl = (value) => "mp4_stream_url" in value;
2560
2473
  const hasMp4StreamUrlWhenAvailable = (value) => !value.is_mp4_available || hasMp4StreamUrl(value);
2561
- const hasMp4StatusFields = (value) => "mp4_size" in value && typeof value.need_convert === "boolean";
2474
+ const hasMp4StatusFields = (value) => "mp4_size" in value && value.need_convert !== void 0;
2562
2475
  const hasVideoMetadata = (value) => "video_metadata" in value;
2563
2476
  const hasMediaMetadata = (value) => "media_metadata" in value;
2564
2477
  const hasCodecs = (value) => "content_type_and_codecs" in value;
@@ -2576,19 +2489,19 @@ const resolveRouteContext = (token) => Effect.gen(function* () {
2576
2489
  const resolveApiBaseUrl = Effect.gen(function* () {
2577
2490
  return (yield* PutioSdkConfig).baseUrl ?? "https://api.put.io";
2578
2491
  });
2579
- const normalizeFileName = (name) => encodeURIComponent(name);
2492
+ const toOriginalFlag = (playOriginal) => playOriginal === void 0 ? void 0 : playOriginal ? 1 : 0;
2580
2493
  const toUploadResult = (value) => {
2581
- if (value.file) return {
2494
+ if (value.file) return Effect.succeed({
2582
2495
  file: value.file,
2583
2496
  type: "file"
2584
- };
2585
- if (value.transfer) return {
2497
+ });
2498
+ if (value.transfer) return Effect.succeed({
2586
2499
  transfer: value.transfer,
2587
2500
  type: "transfer"
2588
- };
2589
- throw new PutioValidationError({ cause: "Expected put.io upload response to contain either \"file\" or \"transfer\"" });
2501
+ });
2502
+ return Effect.fail(new PutioValidationError({ cause: "Expected put.io upload response to contain either \"file\" or \"transfer\"" }));
2590
2503
  };
2591
- const buildFileApiDownloadUrl = (baseUrl, fileId, options) => buildPutioUrl(baseUrl, options.name ? `/v2/files/${encodePathSegment(fileId)}/download/${normalizeFileName(options.name)}` : `/v2/files/${encodePathSegment(fileId)}/download`, {
2504
+ const buildFileApiDownloadUrl = (baseUrl, fileId, options) => buildPutioUrl(baseUrl, options.name ? `/v2/files/${encodePathSegment(fileId)}/download/${encodePathSegment(options.name)}` : `/v2/files/${encodePathSegment(fileId)}/download`, {
2592
2505
  ...useTunnelToQuery(options.useTunnel),
2593
2506
  oauth_token: options.downloadToken
2594
2507
  });
@@ -2596,7 +2509,7 @@ const buildFileApiContentUrl = (baseUrl, fileId, options) => buildPutioUrl(baseU
2596
2509
  ...useTunnelToQuery(options.useTunnel),
2597
2510
  oauth_token: options.downloadToken
2598
2511
  });
2599
- const buildFileApiMp4DownloadUrl = (baseUrl, fileId, options) => buildPutioUrl(baseUrl, options.name ? `/v2/files/${encodePathSegment(fileId)}/mp4/download/${normalizeFileName(options.name)}` : `/v2/files/${encodePathSegment(fileId)}/mp4/download`, {
2512
+ const buildFileApiMp4DownloadUrl = (baseUrl, fileId, options) => buildPutioUrl(baseUrl, options.name ? `/v2/files/${encodePathSegment(fileId)}/mp4/download/${encodePathSegment(options.name)}` : `/v2/files/${encodePathSegment(fileId)}/mp4/download`, {
2600
2513
  ...useTunnelToQuery(options.useTunnel),
2601
2514
  convert: options.convert ? 1 : void 0,
2602
2515
  oauth_token: options.downloadToken
@@ -2604,7 +2517,7 @@ const buildFileApiMp4DownloadUrl = (baseUrl, fileId, options) => buildPutioUrl(b
2604
2517
  const buildFileHlsStreamUrl = (baseUrl, fileId, options) => buildPutioUrl(baseUrl, `/v2/files/${encodePathSegment(fileId)}/hls/media.m3u8`, {
2605
2518
  max_subtitle_count: options.maxSubtitleCount,
2606
2519
  oauth_token: options.downloadToken,
2607
- original: typeof options.playOriginal === "boolean" ? options.playOriginal ? 1 : 0 : void 0,
2520
+ original: toOriginalFlag(options.playOriginal),
2608
2521
  subtitle_languages: joinCsv(options.subtitleLanguages)
2609
2522
  });
2610
2523
  const buildFileXspfPlaylistUrl = (baseUrl, fileId, options) => buildPutioUrl(baseUrl, `/v2/files/${encodePathSegment(fileId)}/xspf`, { oauth_token: options.downloadToken });
@@ -2616,7 +2529,7 @@ const createFileUploadFormData = (input) => {
2616
2529
  return formData;
2617
2530
  };
2618
2531
  const ensureFileQueryFields = (effect, query) => Effect.gen(function* () {
2619
- const file = yield* widenValidationError(effect);
2532
+ const file = yield* effect;
2620
2533
  if (query.stream_url === 1 && !hasStreamUrl(file)) return yield* failMissingField("stream_url");
2621
2534
  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");
2622
2535
  if (query.mp4_stream_url === 1 && !hasMp4StreamUrlWhenAvailable(file)) return yield* failMissingField("mp4_stream_url");
@@ -2660,7 +2573,7 @@ function getFile(input) {
2660
2573
  });
2661
2574
  }
2662
2575
  function getFileChild(input) {
2663
- return Schema.decodeUnknownEffect(FileGetChildInputSchema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => {
2576
+ return decodeAndRun(FileGetChildInputSchema, input, (decodedInput) => {
2664
2577
  const effect = requestJson(FileEnvelopeSchema, {
2665
2578
  method: "GET",
2666
2579
  path: `/v2/files/${encodePathSegment(decodedInput.parentId)}/child`,
@@ -2670,9 +2583,9 @@ function getFileChild(input) {
2670
2583
  }
2671
2584
  }).pipe(selectJsonField("file"), withOperationErrors(GetFileChildErrorSpec));
2672
2585
  return decodedInput.query === void 0 ? effect : ensureFileQueryFields(effect, decodedInput.query);
2673
- }));
2586
+ });
2674
2587
  }
2675
- const copyFile = (input) => Schema.decodeUnknownEffect(FileCopyInputSchema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(FileEnvelopeSchema, {
2588
+ const copyFile = (input) => decodeAndRun(FileCopyInputSchema, input, (decodedInput) => requestJson(FileEnvelopeSchema, {
2676
2589
  body: {
2677
2590
  type: "form",
2678
2591
  value: {
@@ -2683,8 +2596,8 @@ const copyFile = (input) => Schema.decodeUnknownEffect(FileCopyInputSchema, { on
2683
2596
  },
2684
2597
  method: "POST",
2685
2598
  path: "/v2/files/copy"
2686
- })), selectJsonField("file"), withOperationErrors(CopyFileErrorSpec));
2687
- const touchFiles = (input) => Schema.decodeUnknownEffect(FileTouchInputSchema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(OkResponseSchema, {
2599
+ })).pipe(selectJsonField("file"), withOperationErrors(CopyFileErrorSpec));
2600
+ const touchFiles = (input) => decodeAndRun(FileTouchInputSchema, input, (decodedInput) => requestJson(OkResponseSchema, {
2688
2601
  body: {
2689
2602
  type: "form",
2690
2603
  value: {
@@ -2694,17 +2607,17 @@ const touchFiles = (input) => Schema.decodeUnknownEffect(FileTouchInputSchema, {
2694
2607
  },
2695
2608
  method: "POST",
2696
2609
  path: "/v2/files/touch"
2697
- })), Effect.asVoid, withOperationErrors(TouchFilesErrorSpec));
2698
- const canWriteFile = (fileId) => Schema.decodeUnknownEffect(PositiveFileIdSchema)(fileId).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedFileId) => requestJson(FileCanWriteEnvelopeSchema, {
2610
+ })).pipe(Effect.asVoid, withOperationErrors(TouchFilesErrorSpec));
2611
+ const canWriteFile = (fileId) => decodeAndRun(PositiveFileIdSchema, fileId, (decodedFileId) => requestJson(FileCanWriteEnvelopeSchema, {
2699
2612
  method: "GET",
2700
2613
  path: `/v2/files/${encodePathSegment(decodedFileId)}/can-write`
2701
- })), selectJsonField("user_id"), withOperationErrors(CanWriteFileErrorSpec));
2702
- const searchFiles = (query) => Schema.decodeUnknownEffect(FilesSearchQuerySchema, { onExcessProperty: "error" })(query).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedQuery) => requestJson(FilesSearchEnvelopeSchema, {
2614
+ })).pipe(selectJsonField("user_id"), withOperationErrors(CanWriteFileErrorSpec));
2615
+ const searchFiles = (query) => decodeAndRun(FilesSearchQuerySchema, query, (decodedQuery) => requestJson(FilesSearchEnvelopeSchema, {
2703
2616
  method: "GET",
2704
2617
  path: "/v2/files/search",
2705
2618
  query: decodedQuery
2706
- })), withOperationErrors(SearchFilesErrorSpec));
2707
- const continueSearch = (cursor, query = {}) => decodeAndRun(FilesSearchContinueInputSchema, {
2619
+ })).pipe(withOperationErrors(SearchFilesErrorSpec));
2620
+ const continueSearch = (cursor, query = {}) => decodeAndRun(FilesContinueInputSchema, {
2708
2621
  cursor,
2709
2622
  query
2710
2623
  }, (decodedInput) => requestJson(FilesSearchEnvelopeSchema, {
@@ -2716,7 +2629,7 @@ const continueSearch = (cursor, query = {}) => decodeAndRun(FilesSearchContinueI
2716
2629
  path: "/v2/files/search/continue",
2717
2630
  query: decodedInput.query
2718
2631
  })).pipe(withOperationErrors(SearchFilesErrorSpec));
2719
- const setFileSort = (input) => Schema.decodeUnknownEffect(FileSetSortInputSchema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(OkResponseSchema, {
2632
+ const setFileSort = (input) => decodeAndRun(FileSetSortInputSchema, input, (decodedInput) => requestJson(OkResponseSchema, {
2720
2633
  body: {
2721
2634
  type: "form",
2722
2635
  value: {
@@ -2726,7 +2639,7 @@ const setFileSort = (input) => Schema.decodeUnknownEffect(FileSetSortInputSchema
2726
2639
  },
2727
2640
  method: "POST",
2728
2641
  path: "/v2/files/set-sort-by"
2729
- })), Effect.asVoid);
2642
+ })).pipe(Effect.asVoid);
2730
2643
  const resetFileSortSettings = () => requestJson(OkResponseSchema, {
2731
2644
  method: "POST",
2732
2645
  path: "/v2/files/remove-sort-by-settings"
@@ -2868,7 +2781,7 @@ const getHlsMasterPlaylist = (fileId, options = {}) => decodeAndRun(Schema.Struc
2868
2781
  path: `/v2/files/${encodePathSegment(decoded.fileId)}/hls/media.m3u8`,
2869
2782
  query: {
2870
2783
  max_subtitle_count: decoded.options.maxSubtitleCount,
2871
- original: typeof decoded.options.playOriginal === "boolean" ? decoded.options.playOriginal ? 1 : 0 : void 0,
2784
+ original: toOriginalFlag(decoded.options.playOriginal),
2872
2785
  subtitle_languages: joinCsv(decoded.options.subtitleLanguages)
2873
2786
  }
2874
2787
  })).pipe(withOperationErrors(GetHlsMasterPlaylistErrorSpec));
@@ -3004,7 +2917,7 @@ const uploadFile = (input, options = {}) => decodeAndRun(Schema.Struct({
3004
2917
  method: "POST",
3005
2918
  path: "/v2/files/upload",
3006
2919
  query: { oauth_token: token }
3007
- })))).pipe(Effect.map(toUploadResult), withOperationErrors(FileUploadErrorSpec));
2920
+ })))).pipe(Effect.flatMap(toUploadResult), withOperationErrors(FileUploadErrorSpec));
3008
2921
  // src/domains/friend-invites.ts
3009
2922
  const FriendInviteJoinedUserStatusSchema = Schema.Literals([
3010
2923
  "CONVERTED",
@@ -3216,15 +3129,14 @@ const FriendSharedFolderErrorSpec = definePutioOperationErrorSpec({
3216
3129
  { statusCode: 404 }
3217
3130
  ]
3218
3131
  });
3219
- const decodeUsername = (username) => Schema.decodeUnknownEffect(NonEmptyStringSchema)(username).pipe(Effect.mapError(mapDecodeErrorToValidationError));
3220
3132
  const listFriends = () => requestJson(FriendsListEnvelopeSchema, {
3221
3133
  method: "GET",
3222
3134
  path: "/v2/friends/list"
3223
3135
  }).pipe(selectJsonFields("friends", "total"), withOperationErrors(ListFriendsErrorSpec));
3224
- const searchFriends = (username) => decodeUsername(username).pipe(Effect.flatMap((decodedUsername) => requestJson(FriendSearchEnvelopeSchema, {
3136
+ const searchFriends = (username) => decodeAndRun(NonEmptyStringSchema, username, (decodedUsername) => requestJson(FriendSearchEnvelopeSchema, {
3225
3137
  method: "GET",
3226
3138
  path: `/v2/friends/user-search/${encodePathSegment(decodedUsername)}`
3227
- })), selectJsonField("users"), withOperationErrors(SearchFriendsErrorSpec));
3139
+ })).pipe(selectJsonField("users"), withOperationErrors(SearchFriendsErrorSpec));
3228
3140
  const listWaitingRequests = () => requestJson(FriendRequestsEnvelopeSchema, {
3229
3141
  method: "GET",
3230
3142
  path: "/v2/friends/waiting-requests"
@@ -3237,26 +3149,26 @@ const listSentRequests = () => requestJson(FriendRequestsEnvelopeSchema, {
3237
3149
  method: "GET",
3238
3150
  path: "/v2/friends/sent-requests"
3239
3151
  }).pipe(selectJsonField("friends"), withOperationErrors(ListSentRequestsErrorSpec));
3240
- const sendFriendRequest = (username) => decodeUsername(username).pipe(Effect.flatMap((decodedUsername) => requestJson(OkResponseSchema, {
3152
+ const sendFriendRequest = (username) => decodeAndRun(NonEmptyStringSchema, username, (decodedUsername) => requestJson(OkResponseSchema, {
3241
3153
  method: "POST",
3242
3154
  path: `/v2/friends/${encodePathSegment(decodedUsername)}/request`
3243
- })), withOperationErrors(SendFriendRequestErrorSpec));
3244
- const removeFriend = (username) => decodeUsername(username).pipe(Effect.flatMap((decodedUsername) => requestJson(OkResponseSchema, {
3155
+ })).pipe(withOperationErrors(SendFriendRequestErrorSpec));
3156
+ const removeFriend = (username) => decodeAndRun(NonEmptyStringSchema, username, (decodedUsername) => requestJson(OkResponseSchema, {
3245
3157
  method: "POST",
3246
3158
  path: `/v2/friends/${encodePathSegment(decodedUsername)}/unfriend`
3247
- })), withOperationErrors(RemoveFriendErrorSpec));
3248
- const approveFriendRequest = (username) => decodeUsername(username).pipe(Effect.flatMap((decodedUsername) => requestJson(OkResponseSchema, {
3159
+ })).pipe(withOperationErrors(RemoveFriendErrorSpec));
3160
+ const approveFriendRequest = (username) => decodeAndRun(NonEmptyStringSchema, username, (decodedUsername) => requestJson(OkResponseSchema, {
3249
3161
  method: "POST",
3250
3162
  path: `/v2/friends/${encodePathSegment(decodedUsername)}/approve`
3251
- })), withOperationErrors(ApproveFriendRequestErrorSpec));
3252
- const denyFriendRequest = (username) => decodeUsername(username).pipe(Effect.flatMap((decodedUsername) => requestJson(OkResponseSchema, {
3163
+ })).pipe(withOperationErrors(ApproveFriendRequestErrorSpec));
3164
+ const denyFriendRequest = (username) => decodeAndRun(NonEmptyStringSchema, username, (decodedUsername) => requestJson(OkResponseSchema, {
3253
3165
  method: "POST",
3254
3166
  path: `/v2/friends/${encodePathSegment(decodedUsername)}/deny`
3255
- })), withOperationErrors(DenyFriendRequestErrorSpec));
3256
- const getFriendSharedFolder = (username) => decodeUsername(username).pipe(Effect.flatMap((decodedUsername) => requestJson(FriendSharedFolderEnvelopeSchema, {
3167
+ })).pipe(withOperationErrors(DenyFriendRequestErrorSpec));
3168
+ const getFriendSharedFolder = (username) => decodeAndRun(NonEmptyStringSchema, username, (decodedUsername) => requestJson(FriendSharedFolderEnvelopeSchema, {
3257
3169
  method: "GET",
3258
3170
  path: `/v2/friends/${encodePathSegment(decodedUsername)}/files`
3259
- })), selectJsonField("file"), withOperationErrors(FriendSharedFolderErrorSpec));
3171
+ })).pipe(selectJsonField("file"), withOperationErrors(FriendSharedFolderErrorSpec));
3260
3172
  // src/domains/payment.ts
3261
3173
  const PaymentPlanTypeSchema = Schema.Literals(["onetime", "subscription"]);
3262
3174
  const PaymentOptionPlanTypeSchema = Schema.Literals([
@@ -3852,7 +3764,7 @@ const listPaymentInvites = () => requestJson(PaymentInvitesEnvelopeSchema, {
3852
3764
  }).pipe(selectJsonField("vouchers"), withOperationErrors(ListPaymentInvitesErrorSpec));
3853
3765
  const previewPaymentChangePlan = (input) => decodeAndRun(PaymentChangePlanPreviewInputSchema, input, (decodedInput) => requestJson(PaymentChangePlanPreviewSchema, {
3854
3766
  method: "GET",
3855
- path: `/v2/payment/change_plan/${encodeURIComponent(decodedInput.plan_path)}`,
3767
+ path: `/v2/payment/change_plan/${encodePathSegment(decodedInput.plan_path)}`,
3856
3768
  query: {
3857
3769
  coupon_code: decodedInput.coupon_code,
3858
3770
  payment_type: decodedInput.payment_type
@@ -3867,12 +3779,12 @@ const submitPaymentChangePlan = (input) => decodeAndRun(PaymentChangePlanSubmitI
3867
3779
  }
3868
3780
  },
3869
3781
  method: "POST",
3870
- path: `/v2/payment/change_plan/${encodeURIComponent(decodedInput.plan_path)}`,
3782
+ path: `/v2/payment/change_plan/${encodePathSegment(decodedInput.plan_path)}`,
3871
3783
  query: { coupon_code: decodedInput.coupon_code }
3872
3784
  })).pipe(withOperationErrors(SubmitPaymentChangePlanErrorSpec));
3873
3785
  const confirmFastspringOrder = (reference) => decodeAndRun(NonEmptyStringSchema, reference, (decodedReference) => requestJson(PaymentFastspringConfirmEnvelopeSchema, {
3874
3786
  method: "GET",
3875
- path: `/v2/payment/fs-confirm/${encodeURIComponent(decodedReference)}`
3787
+ path: `/v2/payment/fs-confirm/${encodePathSegment(decodedReference)}`
3876
3788
  }).pipe(selectJsonField("confirmed"))).pipe(withOperationErrors(ConfirmFastspringOrderErrorSpec));
3877
3789
  const stopPaymentSubscription = () => requestJson(OkResponseSchema, {
3878
3790
  method: "POST",
@@ -3880,11 +3792,11 @@ const stopPaymentSubscription = () => requestJson(OkResponseSchema, {
3880
3792
  }).pipe(Effect.asVoid, withOperationErrors(StopSubscriptionErrorSpec));
3881
3793
  const getPaymentVoucherInfo = (code) => decodeAndRun(NonEmptyStringSchema, code, (decodedCode) => requestJson(PaymentVoucherInfoSchema, {
3882
3794
  method: "GET",
3883
- path: `/v2/payment/redeem_voucher/${encodeURIComponent(decodedCode)}`
3795
+ path: `/v2/payment/redeem_voucher/${encodePathSegment(decodedCode)}`
3884
3796
  })).pipe(withOperationErrors(GetPaymentVoucherInfoErrorSpec));
3885
3797
  const redeemPaymentVoucher = (code) => decodeAndRun(NonEmptyStringSchema, code, (decodedCode) => requestJson(OkResponseSchema, {
3886
3798
  method: "POST",
3887
- path: `/v2/payment/redeem_voucher/${encodeURIComponent(decodedCode)}`
3799
+ path: `/v2/payment/redeem_voucher/${encodePathSegment(decodedCode)}`
3888
3800
  })).pipe(Effect.asVoid, withOperationErrors(RedeemPaymentVoucherErrorSpec));
3889
3801
  const reportPayments = (paymentIds) => decodeAndRun(PaymentIdsSchema, paymentIds, (decodedPaymentIds) => requestJson(OkResponseSchema, {
3890
3802
  body: {
@@ -3904,11 +3816,11 @@ const createPaddleWaitingPayment = (input) => decodeAndRun(PaymentPaddleWaitingP
3904
3816
  })).pipe(Effect.asVoid, withOperationErrors(CreatePaddleWaitingPaymentErrorSpec));
3905
3817
  const getPaddleBillingInvoiceUrl = (paymentId) => decodeAndRun(PositiveIntegerSchema, paymentId, (decodedPaymentId) => requestJson(PaymentPaddleBillingInvoiceEnvelopeSchema, {
3906
3818
  method: "GET",
3907
- path: `/v2/payment/methods/paddle_billing/invoice/${encodeURIComponent(decodedPaymentId)}`
3819
+ path: `/v2/payment/methods/paddle_billing/invoice/${encodePathSegment(decodedPaymentId)}`
3908
3820
  }).pipe(selectJsonField("url"))).pipe(withOperationErrors(GetPaddleBillingInvoiceUrlErrorSpec));
3909
3821
  const createPaddleBillingUpdatePaymentMethodTransaction = (userSubscriptionId) => decodeAndRun(PositiveIntegerSchema, userSubscriptionId, (decodedUserSubscriptionId) => requestJson(PaymentPaddleBillingUpdatePaymentMethodEnvelopeSchema, {
3910
3822
  method: "GET",
3911
- path: `/v2/payment/methods/paddle_billing/update_payment_method/${encodeURIComponent(decodedUserSubscriptionId)}`
3823
+ path: `/v2/payment/methods/paddle_billing/update_payment_method/${encodePathSegment(decodedUserSubscriptionId)}`
3912
3824
  }).pipe(selectJsonField("transaction_id"))).pipe(withOperationErrors(CreatePaddleBillingUpdatePaymentMethodTransactionErrorSpec));
3913
3825
  const createOpenNodeCharge = (planPath) => decodeAndRun(NonEmptyStringSchema, planPath, (decodedPlanPath) => requestJson(PaymentOpenNodeChargeEnvelopeSchema, {
3914
3826
  body: {
@@ -3917,7 +3829,7 @@ const createOpenNodeCharge = (planPath) => decodeAndRun(NonEmptyStringSchema, pl
3917
3829
  },
3918
3830
  method: "POST",
3919
3831
  path: "/v2/payment/methods/opennode/charge"
3920
- }).pipe(selectJsonField("opennode"), Effect.map(({ checkout_url }) => checkout_url))).pipe(withOperationErrors(CreateOpenNodeChargeErrorSpec));
3832
+ }).pipe(selectJsonField("opennode"), selectJsonField("checkout_url"))).pipe(withOperationErrors(CreateOpenNodeChargeErrorSpec));
3921
3833
  // src/domains/podcast.ts
3922
3834
  const PodcastLinkTypeSchema = Schema.Literals([
3923
3835
  "all",
@@ -3940,14 +3852,14 @@ const PodcastLinksEnvelopeSchema = Schema.Struct({
3940
3852
  status: Schema.Literal("OK"),
3941
3853
  token: Schema.String
3942
3854
  });
3943
- const getPodcastLinks = (input) => Schema.decodeUnknownEffect(PodcastGetLinksInputSchema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(PodcastLinksEnvelopeSchema, {
3855
+ const getPodcastLinks = (input) => decodeAndRun(PodcastGetLinksInputSchema, input, (decodedInput) => requestJson(PodcastLinksEnvelopeSchema, {
3944
3856
  method: "GET",
3945
3857
  path: "/v2/podcast/links",
3946
3858
  query: {
3947
3859
  parent_id: decodedInput.parentId,
3948
3860
  type: decodedInput.types ? joinCsv(decodedInput.types) : void 0
3949
3861
  }
3950
- })), selectJsonFields("links", "token"));
3862
+ })).pipe(selectJsonFields("links", "token"));
3951
3863
  // src/domains/rss.ts
3952
3864
  const RssFeedSchema = Schema.Struct({
3953
3865
  created_at: Schema.String,
@@ -4222,72 +4134,67 @@ const toCreateBody = (params) => ({
4222
4134
  unwanted_keywords: params.unwanted_keywords ?? ""
4223
4135
  });
4224
4136
  const toUpdateBody = (params) => ({
4225
- delete_old_files: params.delete_old_files,
4226
- dont_process_whole_feed: params.dont_process_whole_feed,
4227
- keyword: params.keyword ?? void 0,
4228
- parent_dir_id: params.parent_dir_id,
4229
- rss_source_url: params.rss_source_url,
4230
- title: params.title,
4231
- unwanted_keywords: params.unwanted_keywords ?? ""
4137
+ ...toCreateBody(params),
4138
+ delete_old_files: params.delete_old_files
4232
4139
  });
4233
4140
  const listRssFeeds = () => requestJson(RssFeedsEnvelopeSchema, {
4234
4141
  method: "GET",
4235
4142
  path: "/v2/rss/list"
4236
4143
  }).pipe(selectJsonField("feeds"), withOperationErrors(ListRssFeedsErrorSpec));
4237
- const getRssFeed = (id) => Schema.decodeUnknownEffect(PositiveIntegerSchema)(id).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedId) => requestJson(RssFeedEnvelopeSchema, {
4144
+ const getRssFeed = (id) => decodeAndRun(PositiveIntegerSchema, id, (decodedId) => requestJson(RssFeedEnvelopeSchema, {
4238
4145
  method: "GET",
4239
4146
  path: `/v2/rss/${encodePathSegment(decodedId)}`
4240
- })), selectJsonField("feed"), withOperationErrors(GetRssFeedErrorSpec));
4241
- const createRssFeed = (params) => Schema.decodeUnknownEffect(RssFeedParamsSchema, { onExcessProperty: "error" })(params).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedParams) => requestJson(RssFeedEnvelopeSchema, {
4147
+ })).pipe(selectJsonField("feed"), withOperationErrors(GetRssFeedErrorSpec));
4148
+ const createRssFeed = (params) => decodeAndRun(RssFeedParamsSchema, params, (decodedParams) => requestJson(RssFeedEnvelopeSchema, {
4242
4149
  body: {
4243
4150
  type: "form",
4244
4151
  value: toCreateBody(decodedParams)
4245
4152
  },
4246
4153
  method: "POST",
4247
4154
  path: "/v2/rss/create"
4248
- })), selectJsonField("feed"), withOperationErrors(CreateRssFeedErrorSpec));
4249
- const updateRssFeed = (id, params) => Schema.decodeUnknownEffect(RssFeedUpdateInputSchema, { onExcessProperty: "error" })({
4155
+ })).pipe(selectJsonField("feed"), withOperationErrors(CreateRssFeedErrorSpec));
4156
+ const updateRssFeed = (id, params) => decodeAndRun(RssFeedUpdateInputSchema, {
4250
4157
  id,
4251
4158
  params
4252
- }).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(OkResponseSchema, {
4159
+ }, (decodedInput) => requestJson(OkResponseSchema, {
4253
4160
  body: {
4254
4161
  type: "form",
4255
4162
  value: toUpdateBody(decodedInput.params)
4256
4163
  },
4257
4164
  method: "POST",
4258
4165
  path: `/v2/rss/${encodePathSegment(decodedInput.id)}`
4259
- })), withOperationErrors(UpdateRssFeedErrorSpec));
4260
- const pauseRssFeed = (id) => Schema.decodeUnknownEffect(PositiveIntegerSchema)(id).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedId) => requestJson(OkResponseSchema, {
4166
+ })).pipe(withOperationErrors(UpdateRssFeedErrorSpec));
4167
+ const pauseRssFeed = (id) => decodeAndRun(PositiveIntegerSchema, id, (decodedId) => requestJson(OkResponseSchema, {
4261
4168
  method: "POST",
4262
4169
  path: `/v2/rss/${encodePathSegment(decodedId)}/pause`
4263
- })), withOperationErrors(PauseRssFeedErrorSpec));
4264
- const resumeRssFeed = (id) => Schema.decodeUnknownEffect(PositiveIntegerSchema)(id).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedId) => requestJson(OkResponseSchema, {
4170
+ })).pipe(withOperationErrors(PauseRssFeedErrorSpec));
4171
+ const resumeRssFeed = (id) => decodeAndRun(PositiveIntegerSchema, id, (decodedId) => requestJson(OkResponseSchema, {
4265
4172
  method: "POST",
4266
4173
  path: `/v2/rss/${encodePathSegment(decodedId)}/resume`
4267
- })), withOperationErrors(ResumeRssFeedErrorSpec));
4268
- const deleteRssFeed = (id) => Schema.decodeUnknownEffect(PositiveIntegerSchema)(id).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedId) => requestJson(OkResponseSchema, {
4174
+ })).pipe(withOperationErrors(ResumeRssFeedErrorSpec));
4175
+ const deleteRssFeed = (id) => decodeAndRun(PositiveIntegerSchema, id, (decodedId) => requestJson(OkResponseSchema, {
4269
4176
  method: "POST",
4270
4177
  path: `/v2/rss/${encodePathSegment(decodedId)}/delete`
4271
- })), withOperationErrors(DeleteRssFeedErrorSpec));
4272
- const listRssFeedItems = (id) => Schema.decodeUnknownEffect(PositiveIntegerSchema)(id).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedId) => requestJson(RssFeedItemsEnvelopeSchema, {
4178
+ })).pipe(withOperationErrors(DeleteRssFeedErrorSpec));
4179
+ const listRssFeedItems = (id) => decodeAndRun(PositiveIntegerSchema, id, (decodedId) => requestJson(RssFeedItemsEnvelopeSchema, {
4273
4180
  method: "GET",
4274
4181
  path: `/v2/rss/${encodePathSegment(decodedId)}/items`
4275
- })), selectJsonFields("feed", "items"), withOperationErrors(ListRssFeedItemsErrorSpec));
4276
- const clearRssFeedLogs = (id) => Schema.decodeUnknownEffect(PositiveIntegerSchema)(id).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedId) => requestJson(OkResponseSchema, {
4182
+ })).pipe(selectJsonFields("feed", "items"), withOperationErrors(ListRssFeedItemsErrorSpec));
4183
+ const clearRssFeedLogs = (id) => decodeAndRun(PositiveIntegerSchema, id, (decodedId) => requestJson(OkResponseSchema, {
4277
4184
  method: "POST",
4278
4185
  path: `/v2/rss/${encodePathSegment(decodedId)}/clear-log`
4279
- })), withOperationErrors(ClearRssFeedLogsErrorSpec));
4280
- const retryRssFeedItem = (feedId, itemId) => Schema.decodeUnknownEffect(RssFeedItemRetryInputSchema, { onExcessProperty: "error" })({
4186
+ })).pipe(withOperationErrors(ClearRssFeedLogsErrorSpec));
4187
+ const retryRssFeedItem = (feedId, itemId) => decodeAndRun(RssFeedItemRetryInputSchema, {
4281
4188
  feedId,
4282
4189
  itemId
4283
- }).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(OkResponseSchema, {
4190
+ }, (decodedInput) => requestJson(OkResponseSchema, {
4284
4191
  method: "POST",
4285
4192
  path: `/v2/rss/${encodePathSegment(decodedInput.feedId)}/items/${encodePathSegment(decodedInput.itemId)}/retry`
4286
- })), withOperationErrors(RetryRssFeedItemErrorSpec));
4287
- const retryAllRssFeedItems = (feedId) => Schema.decodeUnknownEffect(PositiveIntegerSchema)(feedId).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedFeedId) => requestJson(OkResponseSchema, {
4193
+ })).pipe(withOperationErrors(RetryRssFeedItemErrorSpec));
4194
+ const retryAllRssFeedItems = (feedId) => decodeAndRun(PositiveIntegerSchema, feedId, (decodedFeedId) => requestJson(OkResponseSchema, {
4288
4195
  method: "POST",
4289
4196
  path: `/v2/rss/${encodePathSegment(decodedFeedId)}/retry-all`
4290
- })), withOperationErrors(RetryAllRssFeedItemsErrorSpec));
4197
+ })).pipe(withOperationErrors(RetryAllRssFeedItemsErrorSpec));
4291
4198
  // src/domains/sharing.ts
4292
4199
  const SharingCloneStatusSchema = Schema.Literals([
4293
4200
  "NEW",
@@ -4369,22 +4276,7 @@ const PublicSharesEnvelopeSchema = Schema.Struct({
4369
4276
  public_shares: Schema.Array(PublicShareSchema),
4370
4277
  status: Schema.optional(Schema.Literal("OK"))
4371
4278
  });
4372
- const PublicShareFileListEnvelopeSchema = Schema.Struct({
4373
- breadcrumbs: Schema.optional(Schema.Array(Schema.Tuple([Schema.Int, Schema.String]))),
4374
- cursor: Schema.NullOr(Schema.String),
4375
- files: Schema.Array(FileBroadSchema),
4376
- parent: Schema.NullOr(FileBroadSchema),
4377
- status: Schema.Literal("OK"),
4378
- total: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))
4379
- });
4380
- const PublicShareFileListContinueEnvelopeSchema = Schema.Struct({
4381
- breadcrumbs: Schema.optional(Schema.Array(Schema.Tuple([Schema.Int, Schema.String]))),
4382
- cursor: Schema.NullOr(Schema.String),
4383
- files: Schema.Array(FileBroadSchema),
4384
- parent: Schema.optional(Schema.NullOr(FileBroadSchema)),
4385
- status: Schema.Literal("OK"),
4386
- total: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)))
4387
- });
4279
+ const PublicShareFileListContinueEnvelopeSchema = FilesListEnvelopeSchema.pipe(Schema.fieldsAssign({ parent: Schema.optional(Schema.NullOr(FileBroadSchema)) }));
4388
4280
  const PublicShareFileUrlEnvelopeSchema = Schema.Struct({
4389
4281
  status: Schema.optional(Schema.Literal("OK")),
4390
4282
  url: Schema.String
@@ -4602,7 +4494,7 @@ const GetPublicShareFileUrlErrorSpec = definePutioOperationErrorSpec({
4602
4494
  ]
4603
4495
  });
4604
4496
  const toShareTarget = (target) => target.type === "everyone" ? "everyone" : target.friendNames.join(",");
4605
- const cloneSharedFiles = (input = {}) => Schema.decodeUnknownEffect(SharingCloneInputSchema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(SharingCloneEnvelopeSchema, {
4497
+ const cloneSharedFiles = (input = {}) => decodeAndRun(SharingCloneInputSchema, input, (decodedInput) => requestJson(SharingCloneEnvelopeSchema, {
4606
4498
  body: {
4607
4499
  type: "form",
4608
4500
  value: {
@@ -4612,12 +4504,12 @@ const cloneSharedFiles = (input = {}) => Schema.decodeUnknownEffect(SharingClone
4612
4504
  },
4613
4505
  method: "POST",
4614
4506
  path: "/v2/sharing/clone"
4615
- })), selectJsonFields("id"), withOperationErrors(CreateSharingCloneErrorSpec));
4616
- const getSharingCloneInfo = (id) => Schema.decodeUnknownEffect(PositiveIntegerSchema)(id).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedId) => requestJson(SharingCloneInfoSchema, {
4507
+ })).pipe(selectJsonFields("id"), withOperationErrors(CreateSharingCloneErrorSpec));
4508
+ const getSharingCloneInfo = (id) => decodeAndRun(PositiveIntegerSchema, id, (decodedId) => requestJson(SharingCloneInfoSchema, {
4617
4509
  method: "GET",
4618
4510
  path: `/v2/sharing/clone/${encodePathSegment(decodedId)}`
4619
- })), withOperationErrors(GetSharingCloneInfoErrorSpec));
4620
- const shareFiles = (input) => Schema.decodeUnknownEffect(SharingShareInputSchema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(OkResponseSchema, {
4511
+ })).pipe(withOperationErrors(GetSharingCloneInfoErrorSpec));
4512
+ const shareFiles = (input) => decodeAndRun(SharingShareInputSchema, input, (decodedInput) => requestJson(OkResponseSchema, {
4621
4513
  body: {
4622
4514
  type: "form",
4623
4515
  value: {
@@ -4627,48 +4519,48 @@ const shareFiles = (input) => Schema.decodeUnknownEffect(SharingShareInputSchema
4627
4519
  },
4628
4520
  method: "POST",
4629
4521
  path: "/v2/files/share"
4630
- })), withOperationErrors(ShareFilesErrorSpec));
4522
+ })).pipe(withOperationErrors(ShareFilesErrorSpec));
4631
4523
  const listSharedFiles = () => requestJson(SharedFilesEnvelopeSchema, {
4632
4524
  method: "GET",
4633
4525
  path: "/v2/files/shared"
4634
4526
  }).pipe(selectJsonField("shared"), withOperationErrors(ListSharedFilesErrorSpec));
4635
- const getSharedWith = (fileId) => Schema.decodeUnknownEffect(PositiveIntegerSchema)(fileId).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedFileId) => requestJson(SharedFileSharedWithSchema, {
4527
+ const getSharedWith = (fileId) => decodeAndRun(PositiveIntegerSchema, fileId, (decodedFileId) => requestJson(SharedFileSharedWithSchema, {
4636
4528
  method: "GET",
4637
4529
  path: `/v2/files/${encodePathSegment(decodedFileId)}/shared-with-v2`
4638
- })), withOperationErrors(GetSharedWithErrorSpec));
4639
- const unshareFile = (input) => Schema.decodeUnknownEffect(SharingUnshareInputSchema, { onExcessProperty: "error" })(input).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(OkResponseSchema, {
4530
+ })).pipe(withOperationErrors(GetSharedWithErrorSpec));
4531
+ const unshareFile = (input) => decodeAndRun(SharingUnshareInputSchema, input, (decodedInput) => requestJson(OkResponseSchema, {
4640
4532
  body: {
4641
4533
  type: "form",
4642
4534
  value: { shares: joinCsv(decodedInput.shares) ?? "everyone" }
4643
4535
  },
4644
4536
  method: "POST",
4645
4537
  path: `/v2/files/${encodePathSegment(decodedInput.fileId)}/unshare`
4646
- })), withOperationErrors(UnshareFileErrorSpec));
4647
- const createPublicShare = (fileId) => Schema.decodeUnknownEffect(PositiveIntegerSchema)(fileId).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedFileId) => requestJson(PublicShareEnvelopeSchema, {
4538
+ })).pipe(withOperationErrors(UnshareFileErrorSpec));
4539
+ const createPublicShare = (fileId) => decodeAndRun(PositiveIntegerSchema, fileId, (decodedFileId) => requestJson(PublicShareEnvelopeSchema, {
4648
4540
  method: "POST",
4649
4541
  path: `/v2/public_share/${encodePathSegment(decodedFileId)}`
4650
- })), selectJsonField("public_share"), withOperationErrors(CreatePublicShareErrorSpec));
4542
+ })).pipe(selectJsonField("public_share"), withOperationErrors(CreatePublicShareErrorSpec));
4651
4543
  const listPublicShares = () => requestJson(PublicSharesEnvelopeSchema, {
4652
4544
  method: "GET",
4653
4545
  path: "/v2/public_share/list"
4654
4546
  }).pipe(selectJsonField("public_shares"), withOperationErrors(ListPublicSharesErrorSpec));
4655
- const deletePublicShare = (id) => Schema.decodeUnknownEffect(PositiveIntegerSchema)(id).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedId) => requestJson(OkResponseSchema, {
4547
+ const deletePublicShare = (id) => decodeAndRun(PositiveIntegerSchema, id, (decodedId) => requestJson(OkResponseSchema, {
4656
4548
  method: "DELETE",
4657
4549
  path: `/v2/public_share/${encodePathSegment(decodedId)}`
4658
- })), withOperationErrors(DeletePublicShareErrorSpec));
4550
+ })).pipe(withOperationErrors(DeletePublicShareErrorSpec));
4659
4551
  const getPublicShare = () => requestJson(PublicShareEnvelopeSchema, {
4660
4552
  method: "GET",
4661
4553
  path: "/v2/public_share"
4662
4554
  }).pipe(selectJsonField("public_share"), withOperationErrors(GetPublicShareErrorSpec));
4663
- const listPublicShareFiles = (query = {}) => Schema.decodeUnknownEffect(PublicShareListQuerySchema, { onExcessProperty: "error" })(query).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedQuery) => requestJson(PublicShareFileListEnvelopeSchema, {
4555
+ const listPublicShareFiles = (query = {}) => decodeAndRun(PublicShareListQuerySchema, query, (decodedQuery) => requestJson(FilesListEnvelopeSchema, {
4664
4556
  method: "GET",
4665
4557
  path: "/v2/public_share/files/list",
4666
4558
  query: decodedQuery
4667
- })), withOperationErrors(ListPublicShareFilesErrorSpec));
4668
- const continuePublicShareFiles = (cursor, query = {}) => Schema.decodeUnknownEffect(PublicShareContinueInputSchema, { onExcessProperty: "error" })({
4559
+ })).pipe(withOperationErrors(ListPublicShareFilesErrorSpec));
4560
+ const continuePublicShareFiles = (cursor, query = {}) => decodeAndRun(PublicShareContinueInputSchema, {
4669
4561
  cursor,
4670
4562
  query
4671
- }).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedInput) => requestJson(PublicShareFileListContinueEnvelopeSchema, {
4563
+ }, (decodedInput) => requestJson(PublicShareFileListContinueEnvelopeSchema, {
4672
4564
  body: {
4673
4565
  type: "form",
4674
4566
  value: { cursor: decodedInput.cursor }
@@ -4676,11 +4568,11 @@ const continuePublicShareFiles = (cursor, query = {}) => Schema.decodeUnknownEff
4676
4568
  method: "POST",
4677
4569
  path: "/v2/public_share/files/list/continue",
4678
4570
  query: decodedInput.query
4679
- })), withOperationErrors(ContinuePublicShareFilesErrorSpec));
4680
- const getPublicShareFileUrl = (fileId) => Schema.decodeUnknownEffect(PositiveIntegerSchema)(fileId).pipe(Effect.mapError(mapDecodeErrorToValidationError), Effect.flatMap((decodedFileId) => requestJson(PublicShareFileUrlEnvelopeSchema, {
4571
+ })).pipe(withOperationErrors(ContinuePublicShareFilesErrorSpec));
4572
+ const getPublicShareFileUrl = (fileId) => decodeAndRun(PositiveIntegerSchema, fileId, (decodedFileId) => requestJson(PublicShareFileUrlEnvelopeSchema, {
4681
4573
  method: "GET",
4682
4574
  path: `/v2/public_share/files/${encodePathSegment(decodedFileId)}/url`
4683
- })), selectJsonField("url"), withOperationErrors(GetPublicShareFileUrlErrorSpec));
4575
+ })).pipe(selectJsonField("url"), withOperationErrors(GetPublicShareFileUrlErrorSpec));
4684
4576
  // src/domains/trash.ts
4685
4577
  const TrashFileSchema = Schema.Struct({
4686
4578
  content_type: Schema.NullOr(Schema.String),
@@ -4726,23 +4618,19 @@ const TrashContinueInputSchema = Schema.Struct({
4726
4618
  cursor: NonEmptyStringSchema,
4727
4619
  query: TrashListQuerySchema
4728
4620
  });
4729
- const RestrictedReadError = {
4730
- errorType: "invalid_scope",
4731
- statusCode: 401
4732
- };
4733
- const RestrictedWriteError = {
4621
+ const RestrictedScopeError$1 = {
4734
4622
  errorType: "invalid_scope",
4735
4623
  statusCode: 401
4736
4624
  };
4737
4625
  const ListTrashErrorSpec = definePutioOperationErrorSpec({
4738
4626
  domain: "trash",
4739
4627
  operation: "list",
4740
- knownErrors: [RestrictedReadError]
4628
+ knownErrors: [RestrictedScopeError$1]
4741
4629
  });
4742
4630
  const ContinueTrashErrorSpec = definePutioOperationErrorSpec({
4743
4631
  domain: "trash",
4744
4632
  operation: "continue",
4745
- knownErrors: [RestrictedReadError, { statusCode: 400 }]
4633
+ knownErrors: [RestrictedScopeError$1, { statusCode: 400 }]
4746
4634
  });
4747
4635
  const RestoreTrashErrorSpec = definePutioOperationErrorSpec({
4748
4636
  domain: "trash",
@@ -4764,7 +4652,7 @@ const RestoreTrashErrorSpec = definePutioOperationErrorSpec({
4764
4652
  errorType: "TRASH_RESTORE_TOO_MANY_FILES",
4765
4653
  statusCode: 400
4766
4654
  },
4767
- RestrictedWriteError,
4655
+ RestrictedScopeError$1,
4768
4656
  { statusCode: 400 },
4769
4657
  { statusCode: 404 }
4770
4658
  ]
@@ -4781,7 +4669,7 @@ const DeleteTrashErrorSpec = definePutioOperationErrorSpec({
4781
4669
  errorType: "TRASH_LOCK_TIMEOUT",
4782
4670
  statusCode: 400
4783
4671
  },
4784
- RestrictedWriteError,
4672
+ RestrictedScopeError$1,
4785
4673
  { statusCode: 400 },
4786
4674
  { statusCode: 404 }
4787
4675
  ]
@@ -4792,7 +4680,7 @@ const EmptyTrashErrorSpec = definePutioOperationErrorSpec({
4792
4680
  knownErrors: [{
4793
4681
  errorType: "TRASH_LOCK_TIMEOUT",
4794
4682
  statusCode: 400
4795
- }, RestrictedWriteError]
4683
+ }, RestrictedScopeError$1]
4796
4684
  });
4797
4685
  const toBulkTrashBody = (input) => {
4798
4686
  if (input.useCursor === true) return {
@@ -5390,19 +5278,19 @@ const ZipInfoSchema = Schema.Union([
5390
5278
  ZipInfoErrorSchema,
5391
5279
  ZipInfoDoneSchema
5392
5280
  ]);
5393
- const CreateZipInputSchema = makeCursorSelectionSchema("file_ids", "exclude_ids", {});
5394
- const FilesReadScopeError = {
5395
- errorType: "invalid_scope",
5396
- statusCode: 401
5397
- };
5398
- const FilesWriteScopeError = {
5281
+ const CreateZipInputSchema = Schema.Struct({
5282
+ cursor: Schema.optional(NonEmptyStringSchema),
5283
+ exclude_ids: Schema.optional(Schema.Array(PositiveIntegerSchema)),
5284
+ file_ids: Schema.optional(Schema.Array(PositiveIntegerSchema).check(Schema.isMinLength(1)))
5285
+ }).check(Schema.makeFilter((input) => input.cursor !== void 0 || input.file_ids !== void 0, { expected: "a non-empty cursor or file ID selection" }));
5286
+ const RestrictedScopeError = {
5399
5287
  errorType: "invalid_scope",
5400
5288
  statusCode: 401
5401
5289
  };
5402
5290
  const ListZipsErrorSpec = definePutioOperationErrorSpec({
5403
5291
  domain: "zips",
5404
5292
  operation: "list",
5405
- knownErrors: [FilesReadScopeError]
5293
+ knownErrors: [RestrictedScopeError]
5406
5294
  });
5407
5295
  const CreateZipErrorSpec = definePutioOperationErrorSpec({
5408
5296
  domain: "zips",
@@ -5412,7 +5300,7 @@ const CreateZipErrorSpec = definePutioOperationErrorSpec({
5412
5300
  errorType: "ZIP_TOTAL_SIZE_EXCEEDED",
5413
5301
  statusCode: 403
5414
5302
  },
5415
- FilesWriteScopeError,
5303
+ RestrictedScopeError,
5416
5304
  { statusCode: 400 },
5417
5305
  { statusCode: 403 }
5418
5306
  ]
@@ -5429,7 +5317,7 @@ const GetZipErrorSpec = definePutioOperationErrorSpec({
5429
5317
  errorType: "ERROR_IN_ZIP",
5430
5318
  statusCode: 500
5431
5319
  },
5432
- FilesReadScopeError,
5320
+ RestrictedScopeError,
5433
5321
  { statusCode: 403 },
5434
5322
  { statusCode: 410 },
5435
5323
  { statusCode: 500 }
@@ -5443,7 +5331,7 @@ const CancelZipErrorSpec = definePutioOperationErrorSpec({
5443
5331
  errorType: "LINK_EXPIRED",
5444
5332
  statusCode: 410
5445
5333
  },
5446
- FilesWriteScopeError,
5334
+ RestrictedScopeError,
5447
5335
  { statusCode: 403 },
5448
5336
  { statusCode: 410 }
5449
5337
  ]
@@ -5455,11 +5343,11 @@ const listZips = () => requestJson(ZipsListEnvelopeSchema, {
5455
5343
  const createZip = (input) => decodeAndRun(CreateZipInputSchema, input, (decodedInput) => requestJson(ZipCreateEnvelopeSchema, {
5456
5344
  body: {
5457
5345
  type: "form",
5458
- value: { ...toCursorSelectionForm({
5346
+ value: toCursorSelectionForm({
5459
5347
  cursor: decodedInput.cursor,
5460
5348
  excludeIds: decodedInput.exclude_ids,
5461
5349
  ids: decodedInput.file_ids
5462
- }) }
5350
+ })
5463
5351
  },
5464
5352
  method: "POST",
5465
5353
  path: "/v2/zips/create"
@@ -5473,340 +5361,289 @@ const cancelZip = (id) => decodeAndRun(PositiveIntegerSchema, id, (decodedId) =>
5473
5361
  path: `/v2/zips/${encodePathSegment(decodedId)}/cancel`
5474
5362
  })).pipe(Effect.asVoid, withOperationErrors(CancelZipErrorSpec));
5475
5363
  // src/core/client.ts
5476
- const promiseClientRuntimeCache = /* @__PURE__ */ new WeakMap();
5477
- const disposedPromiseClientStates = /* @__PURE__ */ new WeakSet();
5478
5364
  const getPromiseClientRuntime = (state) => {
5479
- if (disposedPromiseClientStates.has(state)) throw mapConfigurationError("This Promise client has been disposed and can no longer execute SDK effects");
5480
- const cachedRuntime = promiseClientRuntimeCache.get(state);
5481
- if (cachedRuntime) return cachedRuntime;
5482
- const runtime = ManagedRuntime.make(makePutioSdkLiveLayer(state.runtimeConfig));
5483
- promiseClientRuntimeCache.set(state, runtime);
5484
- return runtime;
5365
+ if (state.disposed) throw mapConfigurationError("This Promise client has been disposed and can no longer execute SDK effects");
5366
+ state.runtime ??= ManagedRuntime.make(putioSdkLiveLayer(state.runtimeConfig));
5367
+ return state.runtime;
5485
5368
  };
5486
5369
  const disposePromiseClientRuntime = async (state) => {
5487
- disposedPromiseClientStates.add(state);
5488
- const runtime = promiseClientRuntimeCache.get(state);
5489
- promiseClientRuntimeCache.delete(state);
5490
- if (!runtime) return;
5491
- await runtime.dispose();
5370
+ const { runtime } = state;
5371
+ state.disposed = true;
5372
+ state.runtime = void 0;
5373
+ await runtime?.dispose();
5492
5374
  };
5493
- const rejectWithSdkFailure = (exit) => Exit.match(exit, {
5494
- onSuccess: (value) => Promise.resolve(value),
5495
- onFailure: (cause) => {
5496
- const failure = cause.reasons.find(Cause.isFailReason);
5497
- if (failure) return Promise.reject(failure.error);
5498
- return Promise.reject(Cause.squash(cause));
5499
- }
5500
- });
5501
- const provideSdk = async (state, effect) => {
5502
- const operationConfig = {
5503
- ...state.runtimeConfig,
5504
- accessToken: state.accessToken
5505
- };
5506
- const operation = Effect.provideService(effect, PutioSdkConfig, operationConfig);
5507
- return rejectWithSdkFailure(await getPromiseClientRuntime(state).runPromiseExit(operation));
5508
- };
5509
- const snapshotUrl = (value) => typeof value === "string" || value === void 0 ? value : new URL(value.href);
5375
+ const provideSdk = async (state, effect) => getPromiseClientRuntime(state).runPromise(Effect.provideService(effect, PutioSdkConfig, {
5376
+ ...state.runtimeConfig,
5377
+ accessToken: state.accessToken
5378
+ }));
5379
+ const snapshotUrl = (value) => Predicate.isString(value) || value === void 0 ? value : new URL(value.href);
5510
5380
  const snapshotHeaders = (value) => value === void 0 ? void 0 : [...new Headers(value)];
5511
- const operationEntryMarker = Symbol("PutioSdkOperationEntry");
5512
- const operationAtBoundary = (run, boundary) => {
5513
- const entry = {
5514
- boundary,
5515
- run
5516
- };
5517
- Object.defineProperty(entry, operationEntryMarker, { value: true });
5518
- return Object.freeze(entry);
5519
- };
5520
- const inputFree = (operation) => operationAtBoundary(operation, "input-free");
5521
- const pure = (operation) => operationAtBoundary(operation, "pure");
5522
- const validated = (operation) => operationAtBoundary(operation, "validated");
5523
- const isOperationEntry = (value) => typeof value === "object" && value !== null && Object.getPrototypeOf(value) === Object.prototype && Object.isFrozen(value) && Object.hasOwn(value, operationEntryMarker) && value[operationEntryMarker] === true && Object.hasOwn(value, "boundary") && Object.hasOwn(value, "run") && Reflect.ownKeys(value).length === 3 && (value.boundary === "input-free" || value.boundary === "pure" || value.boundary === "validated") && typeof value.run === "function";
5524
- const runClassifiedOperation = (entry, args) => {
5525
- const result = Reflect.apply(entry.run, void 0, args);
5526
- if (entry.boundary === "pure") {
5527
- if (Effect.isEffect(result)) throw new TypeError("Pure SDK operation returned an Effect");
5528
- return result;
5529
- }
5530
- if (!Effect.isEffect(result)) throw new TypeError(`${entry.boundary} SDK operation did not return an Effect`);
5531
- return result;
5532
- };
5533
- const cloneOperationTree = (tree) => Object.fromEntries(Object.entries(tree).map(([key, value]) => [key, isOperationEntry(value) ? value.run : cloneOperationTree(value)]));
5534
- const runPromiseOperation = (entry, state, args) => {
5535
- const result = runClassifiedOperation(entry, args);
5536
- return entry.boundary === "pure" ? result : provideSdk(state, result);
5537
- };
5538
- const makePromiseOperationTree = (tree, state) => Object.fromEntries(Object.entries(tree).map(([key, value]) => [key, isOperationEntry(value) ? (...args) => runPromiseOperation(value, state, args) : makePromiseOperationTree(value, state)]));
5539
- const assertClassifiedOperationTree = (tree, parentPath = "") => {
5540
- const entries = Object.entries(tree);
5541
- if (Object.getPrototypeOf(tree) !== Object.prototype || entries.length === 0) throw new TypeError(`SDK operation namespace ${parentPath || "<root>"} is not a non-empty plain object`);
5542
- for (const [key, value] of entries) {
5543
- const path = parentPath ? `${parentPath}.${key}` : key;
5544
- if (isOperationEntry(value)) continue;
5545
- if (typeof value === "object" && value !== null) assertClassifiedOperationTree(value, path);
5546
- else throw new TypeError(`SDK operation ${path} has no request-boundary classification`);
5381
+ var OperationEntry = class {
5382
+ run;
5383
+ toPromise;
5384
+ constructor(run, toPromise) {
5385
+ this.run = run;
5386
+ this.toPromise = toPromise;
5547
5387
  }
5548
5388
  };
5389
+ const effect = (operation) => new OperationEntry(operation, (state) => (...args) => provideSdk(state, operation(...args)));
5390
+ const pure = (operation) => new OperationEntry(operation, () => operation);
5391
+ const mapOperationTree = (tree, toOperation) => Object.fromEntries(Object.entries(tree).map(([key, value]) => [key, value instanceof OperationEntry ? toOperation(value) : mapOperationTree(value, toOperation)]));
5549
5392
  const sharedOperationTree = {
5550
5393
  account: {
5551
5394
  appSpecificPasswords: {
5552
- create: validated(createAppSpecificPassword),
5553
- delete: validated(deleteAppSpecificPassword),
5554
- deleteAll: inputFree(deleteAllAppSpecificPasswords),
5555
- list: inputFree(listAppSpecificPasswords)
5556
- },
5557
- clear: validated(clearAccount),
5558
- destroy: validated(destroyAccount),
5559
- getInfo: validated(getAccountInfo),
5560
- getSettings: inputFree(getAccountSettings),
5561
- listSubtitleLanguages: inputFree(listAccountSubtitleLanguages),
5562
- listConfirmations: validated(listAccountConfirmations),
5563
- saveSettings: validated(saveAccountSettings)
5395
+ create: effect(createAppSpecificPassword),
5396
+ delete: effect(deleteAppSpecificPassword),
5397
+ deleteAll: effect(deleteAllAppSpecificPasswords),
5398
+ list: effect(listAppSpecificPasswords)
5399
+ },
5400
+ clear: effect(clearAccount),
5401
+ destroy: effect(destroyAccount),
5402
+ getInfo: effect(getAccountInfo),
5403
+ getSettings: effect(getAccountSettings),
5404
+ listSubtitleLanguages: effect(listAccountSubtitleLanguages),
5405
+ listConfirmations: effect(listAccountConfirmations),
5406
+ saveSettings: effect(saveAccountSettings)
5564
5407
  },
5565
5408
  auth: {
5566
5409
  buildLoginUrl: pure(buildAuthLoginUrl),
5567
- checkCodeMatch: validated(checkCodeMatch),
5568
- clients: inputFree(clients),
5569
- exchangeAuthorizationCode: validated(exchangeOAuthAuthorizationCode),
5570
- exists: validated(exists),
5571
- forgotPassword: validated(forgotPassword),
5572
- getCode: validated(getCode),
5573
- getFamilyInvite: validated(getFamilyInvite),
5574
- getFriendInvite: validated(getFriendInvite),
5575
- getGiftCard: validated(getGiftCard),
5576
- getVoucher: validated(getVoucher),
5577
- grants: inputFree(grants),
5578
- linkDevice: validated(linkDevice),
5579
- login: validated(login),
5580
- logout: inputFree(logout),
5581
- register: validated(register),
5582
- resetPassword: validated(resetPassword),
5583
- revokeAllClients: inputFree(revokeAllClients),
5584
- revokeApp: validated(revokeApp),
5585
- revokeClient: validated(revokeClient),
5410
+ checkCodeMatch: effect(checkCodeMatch),
5411
+ clients: effect(clients),
5412
+ exchangeAuthorizationCode: effect(exchangeOAuthAuthorizationCode),
5413
+ exists: effect(exists),
5414
+ forgotPassword: effect(forgotPassword),
5415
+ getCode: effect(getCode),
5416
+ getFamilyInvite: effect(getFamilyInvite),
5417
+ getFriendInvite: effect(getFriendInvite),
5418
+ getGiftCard: effect(getGiftCard),
5419
+ getVoucher: effect(getVoucher),
5420
+ grants: effect(grants),
5421
+ linkDevice: effect(linkDevice),
5422
+ login: effect(login),
5423
+ logout: effect(logout),
5424
+ register: effect(register),
5425
+ resetPassword: effect(resetPassword),
5426
+ revokeAllClients: effect(revokeAllClients),
5427
+ revokeApp: effect(revokeApp),
5428
+ revokeClient: effect(revokeClient),
5586
5429
  twoFactor: {
5587
- generateTOTP: inputFree(generateTOTP),
5588
- getRecoveryCodes: inputFree(getRecoveryCodes),
5589
- regenerateRecoveryCodes: inputFree(regenerateRecoveryCodes),
5590
- verifyTOTP: validated(verifyTOTP)
5430
+ generateTOTP: effect(generateTOTP),
5431
+ getRecoveryCodes: effect(getRecoveryCodes),
5432
+ regenerateRecoveryCodes: effect(regenerateRecoveryCodes),
5433
+ verifyTOTP: effect(verifyTOTP)
5591
5434
  },
5592
- validateToken: validated(validateToken)
5435
+ validateToken: effect(validateToken)
5593
5436
  },
5594
5437
  config: {
5595
- deleteKey: validated(deleteConfigKey),
5596
- getKey: validated(getConfigKey),
5597
- getKeyWith: validated(getConfigKeyWith),
5598
- read: inputFree(readConfig),
5599
- readWith: validated(readConfigWith),
5600
- setKey: validated(setConfigKey),
5601
- write: validated(writeConfig)
5438
+ deleteKey: effect(deleteConfigKey),
5439
+ getKey: effect(getConfigKey),
5440
+ getKeyWith: effect(getConfigKeyWith),
5441
+ read: effect(readConfig),
5442
+ readWith: effect(readConfigWith),
5443
+ setKey: effect(setConfigKey),
5444
+ write: effect(writeConfig)
5602
5445
  },
5603
5446
  downloadLinks: {
5604
- create: validated(createDownloadLinks),
5605
- get: validated(getDownloadLinks)
5447
+ create: effect(createDownloadLinks),
5448
+ get: effect(getDownloadLinks)
5606
5449
  },
5607
5450
  events: {
5608
- clear: inputFree(clearEvents),
5609
- delete: validated(deleteEvent),
5610
- getTorrent: validated(getEventTorrent),
5611
- list: validated(listEvents)
5451
+ clear: effect(clearEvents),
5452
+ delete: effect(deleteEvent),
5453
+ getTorrent: effect(getEventTorrent),
5454
+ list: effect(listEvents)
5612
5455
  },
5613
5456
  family: {
5614
- createInvite: inputFree(createFamilyInvite),
5615
- join: validated(joinFamily),
5616
- listInvites: inputFree(listFamilyInvites),
5617
- listMembers: inputFree(listFamilyMembers),
5618
- removeMember: validated(removeFamilyMember)
5457
+ createInvite: effect(createFamilyInvite),
5458
+ join: effect(joinFamily),
5459
+ listInvites: effect(listFamilyInvites),
5460
+ listMembers: effect(listFamilyMembers),
5461
+ removeMember: effect(removeFamilyMember)
5619
5462
  },
5620
5463
  ifttt: {
5621
- getStatus: inputFree(getIftttStatus),
5622
- sendEvent: validated(sendIftttEvent)
5464
+ getStatus: effect(getIftttStatus),
5465
+ sendEvent: effect(sendIftttEvent)
5623
5466
  },
5624
- podcast: { getLinks: validated(getPodcastLinks) },
5467
+ podcast: { getLinks: effect(getPodcastLinks) },
5625
5468
  files: {
5626
- canWrite: validated(canWriteFile),
5627
- continue: validated(continueFiles),
5628
- continueSearch: validated(continueSearch),
5629
- copy: validated(copyFile),
5630
- convertToMp4: validated(convertFileToMp4),
5631
- convertManyToMp4: validated(convertFilesToMp4),
5632
- convertSelectionToMp4: validated(convertFileSelectionToMp4),
5633
- createUploadRequest: validated(createFileUploadRequest),
5634
- createFolder: validated(createFolder),
5635
- deleteExtraction: validated(deleteFileExtraction),
5636
- deleteMp4: validated(deleteFileMp4),
5637
- deleteSelection: validated(deleteFileSelection),
5638
- delete: validated(deleteFiles),
5639
- extract: validated(extractFiles),
5640
- findNext: validated(findNextFile),
5641
- findNextVideo: validated(findNextVideo),
5642
- getApiContentUrl: validated(getApiContentUrl),
5643
- getApiDownloadUrl: validated(getApiDownloadUrl),
5644
- getApiMp4DownloadUrl: validated(getApiMp4DownloadUrl),
5645
- get: validated(getFile),
5646
- getChild: validated(getFileChild),
5647
- getDownloadUrl: validated(getDownloadUrl),
5648
- getHlsMasterPlaylist: validated(getHlsMasterPlaylist),
5649
- getHlsStreamUrl: validated(getHlsStreamUrl),
5650
- getXspfPlaylistUrl: validated(getXspfPlaylistUrl),
5651
- getMp4Status: validated(getMp4Status),
5652
- getStartFrom: validated(getStartFrom),
5653
- list: validated(queryFiles),
5654
- listActiveConversions: inputFree(listActiveMp4Conversions),
5655
- listExtractions: inputFree(listFileExtractions),
5656
- listSubtitles: validated(listFileSubtitles),
5657
- move: validated(moveFiles),
5658
- moveSelection: validated(moveFileSelection),
5659
- putMp4ToMyFiles: validated(putMp4ToMyFiles),
5660
- rename: validated(renameFile),
5661
- resetSortSettings: inputFree(resetFileSortSettings),
5662
- resetStartFrom: validated(resetStartFrom),
5663
- search: validated(searchFiles),
5664
- setSort: validated(setFileSort),
5665
- setWatchStatus: validated(setFilesWatchStatus),
5666
- setStartFrom: validated(setStartFrom),
5667
- touch: validated(touchFiles),
5668
- upload: validated(uploadFile)
5469
+ canWrite: effect(canWriteFile),
5470
+ continue: effect(continueFiles),
5471
+ continueSearch: effect(continueSearch),
5472
+ copy: effect(copyFile),
5473
+ convertToMp4: effect(convertFileToMp4),
5474
+ convertManyToMp4: effect(convertFilesToMp4),
5475
+ convertSelectionToMp4: effect(convertFileSelectionToMp4),
5476
+ createUploadRequest: effect(createFileUploadRequest),
5477
+ createFolder: effect(createFolder),
5478
+ deleteExtraction: effect(deleteFileExtraction),
5479
+ deleteMp4: effect(deleteFileMp4),
5480
+ deleteSelection: effect(deleteFileSelection),
5481
+ delete: effect(deleteFiles),
5482
+ extract: effect(extractFiles),
5483
+ findNext: effect(findNextFile),
5484
+ findNextVideo: effect(findNextVideo),
5485
+ getApiContentUrl: effect(getApiContentUrl),
5486
+ getApiDownloadUrl: effect(getApiDownloadUrl),
5487
+ getApiMp4DownloadUrl: effect(getApiMp4DownloadUrl),
5488
+ get: effect(getFile),
5489
+ getChild: effect(getFileChild),
5490
+ getDownloadUrl: effect(getDownloadUrl),
5491
+ getHlsMasterPlaylist: effect(getHlsMasterPlaylist),
5492
+ getHlsStreamUrl: effect(getHlsStreamUrl),
5493
+ getXspfPlaylistUrl: effect(getXspfPlaylistUrl),
5494
+ getMp4Status: effect(getMp4Status),
5495
+ getStartFrom: effect(getStartFrom),
5496
+ list: effect(queryFiles),
5497
+ listActiveConversions: effect(listActiveMp4Conversions),
5498
+ listExtractions: effect(listFileExtractions),
5499
+ listSubtitles: effect(listFileSubtitles),
5500
+ move: effect(moveFiles),
5501
+ moveSelection: effect(moveFileSelection),
5502
+ putMp4ToMyFiles: effect(putMp4ToMyFiles),
5503
+ rename: effect(renameFile),
5504
+ resetSortSettings: effect(resetFileSortSettings),
5505
+ resetStartFrom: effect(resetStartFrom),
5506
+ search: effect(searchFiles),
5507
+ setSort: effect(setFileSort),
5508
+ setWatchStatus: effect(setFilesWatchStatus),
5509
+ setStartFrom: effect(setStartFrom),
5510
+ touch: effect(touchFiles),
5511
+ upload: effect(uploadFile)
5669
5512
  },
5670
5513
  friendInvites: {
5671
- create: inputFree(createFriendInvite),
5672
- list: inputFree(listFriendInvites)
5514
+ create: effect(createFriendInvite),
5515
+ list: effect(listFriendInvites)
5673
5516
  },
5674
5517
  friends: {
5675
- approve: validated(approveFriendRequest),
5676
- countWaitingRequests: inputFree(countWaitingRequests),
5677
- deny: validated(denyFriendRequest),
5678
- list: inputFree(listFriends),
5679
- listSentRequests: inputFree(listSentRequests),
5680
- listWaitingRequests: inputFree(listWaitingRequests),
5681
- remove: validated(removeFriend),
5682
- search: validated(searchFriends),
5683
- sendRequest: validated(sendFriendRequest),
5684
- sharedFolder: validated(getFriendSharedFolder)
5518
+ approve: effect(approveFriendRequest),
5519
+ countWaitingRequests: effect(countWaitingRequests),
5520
+ deny: effect(denyFriendRequest),
5521
+ list: effect(listFriends),
5522
+ listSentRequests: effect(listSentRequests),
5523
+ listWaitingRequests: effect(listWaitingRequests),
5524
+ remove: effect(removeFriend),
5525
+ search: effect(searchFriends),
5526
+ sendRequest: effect(sendFriendRequest),
5527
+ sharedFolder: effect(getFriendSharedFolder)
5685
5528
  },
5686
5529
  oauth: {
5687
5530
  buildAuthorizeUrl: pure(buildOAuthAuthorizeUrl),
5688
5531
  buildIconUrl: pure(buildOAuthAppIconUrl),
5689
- create: validated(createOAuthApp),
5690
- delete: validated(deleteOAuthApp),
5691
- get: validated(getOAuthApp),
5692
- getPopularApps: inputFree(getPopularOAuthApps),
5693
- query: inputFree(queryOAuthApps),
5694
- regenerateToken: validated(regenerateOAuthAppToken),
5695
- setIcon: validated(setOAuthAppIcon),
5696
- update: validated(updateOAuthApp)
5532
+ create: effect(createOAuthApp),
5533
+ delete: effect(deleteOAuthApp),
5534
+ get: effect(getOAuthApp),
5535
+ getPopularApps: effect(getPopularOAuthApps),
5536
+ query: effect(queryOAuthApps),
5537
+ regenerateToken: effect(regenerateOAuthAppToken),
5538
+ setIcon: effect(setOAuthAppIcon),
5539
+ update: effect(updateOAuthApp)
5697
5540
  },
5698
5541
  payment: {
5699
5542
  changePlan: {
5700
5543
  classifyResponse: pure(classifyPaymentChangePlanResponse),
5701
- preview: validated(previewPaymentChangePlan),
5702
- submit: validated(submitPaymentChangePlan)
5703
- },
5704
- confirmFastspringOrder: validated(confirmFastspringOrder),
5705
- getInfo: inputFree(getPaymentInfo),
5706
- listHistory: validated(listPaymentHistory),
5707
- listInvites: inputFree(listPaymentInvites),
5708
- listOptions: inputFree(listPaymentOptions),
5709
- listPlans: inputFree(listPaymentPlans),
5544
+ preview: effect(previewPaymentChangePlan),
5545
+ submit: effect(submitPaymentChangePlan)
5546
+ },
5547
+ confirmFastspringOrder: effect(confirmFastspringOrder),
5548
+ getInfo: effect(getPaymentInfo),
5549
+ listHistory: effect(listPaymentHistory),
5550
+ listInvites: effect(listPaymentInvites),
5551
+ listOptions: effect(listPaymentOptions),
5552
+ listPlans: effect(listPaymentPlans),
5710
5553
  methods: {
5711
- addPaddleWaitingPayment: validated(createPaddleWaitingPayment),
5712
- createOpenNodeCharge: validated(createOpenNodeCharge),
5713
- createPaddleBillingUpdatePaymentMethodTransaction: validated(createPaddleBillingUpdatePaymentMethodTransaction),
5714
- getPaddleBillingInvoiceUrl: validated(getPaddleBillingInvoiceUrl)
5554
+ addPaddleWaitingPayment: effect(createPaddleWaitingPayment),
5555
+ createOpenNodeCharge: effect(createOpenNodeCharge),
5556
+ createPaddleBillingUpdatePaymentMethodTransaction: effect(createPaddleBillingUpdatePaymentMethodTransaction),
5557
+ getPaddleBillingInvoiceUrl: effect(getPaddleBillingInvoiceUrl)
5715
5558
  },
5716
- report: validated(reportPayments),
5717
- stopSubscription: inputFree(stopPaymentSubscription),
5559
+ report: effect(reportPayments),
5560
+ stopSubscription: effect(stopPaymentSubscription),
5718
5561
  voucher: {
5719
- getInfo: validated(getPaymentVoucherInfo),
5720
- redeem: validated(redeemPaymentVoucher)
5562
+ getInfo: effect(getPaymentVoucherInfo),
5563
+ redeem: effect(redeemPaymentVoucher)
5721
5564
  }
5722
5565
  },
5723
- rateLimits: { removeBan: validated(removeRateLimitBan) },
5566
+ rateLimits: { removeBan: effect(removeRateLimitBan) },
5724
5567
  rss: {
5725
- clearLogs: validated(clearRssFeedLogs),
5726
- create: validated(createRssFeed),
5727
- delete: validated(deleteRssFeed),
5728
- get: validated(getRssFeed),
5729
- list: inputFree(listRssFeeds),
5730
- listItems: validated(listRssFeedItems),
5731
- pause: validated(pauseRssFeed),
5732
- resume: validated(resumeRssFeed),
5733
- retryAll: validated(retryAllRssFeedItems),
5734
- retryItem: validated(retryRssFeedItem),
5735
- update: validated(updateRssFeed)
5568
+ clearLogs: effect(clearRssFeedLogs),
5569
+ create: effect(createRssFeed),
5570
+ delete: effect(deleteRssFeed),
5571
+ get: effect(getRssFeed),
5572
+ list: effect(listRssFeeds),
5573
+ listItems: effect(listRssFeedItems),
5574
+ pause: effect(pauseRssFeed),
5575
+ resume: effect(resumeRssFeed),
5576
+ retryAll: effect(retryAllRssFeedItems),
5577
+ retryItem: effect(retryRssFeedItem),
5578
+ update: effect(updateRssFeed)
5736
5579
  },
5737
5580
  sharing: {
5738
- clone: validated(cloneSharedFiles),
5739
- getCloneInfo: validated(getSharingCloneInfo),
5740
- getSharedWith: validated(getSharedWith),
5741
- listSharedFiles: inputFree(listSharedFiles),
5581
+ clone: effect(cloneSharedFiles),
5582
+ getCloneInfo: effect(getSharingCloneInfo),
5583
+ getSharedWith: effect(getSharedWith),
5584
+ listSharedFiles: effect(listSharedFiles),
5742
5585
  publicAccess: {
5743
- continueFiles: validated(continuePublicShareFiles),
5744
- get: inputFree(getPublicShare),
5745
- getFileUrl: validated(getPublicShareFileUrl),
5746
- listFiles: validated(listPublicShareFiles)
5586
+ continueFiles: effect(continuePublicShareFiles),
5587
+ get: effect(getPublicShare),
5588
+ getFileUrl: effect(getPublicShareFileUrl),
5589
+ listFiles: effect(listPublicShareFiles)
5747
5590
  },
5748
5591
  publicShares: {
5749
- create: validated(createPublicShare),
5750
- delete: validated(deletePublicShare),
5751
- list: inputFree(listPublicShares)
5592
+ create: effect(createPublicShare),
5593
+ delete: effect(deletePublicShare),
5594
+ list: effect(listPublicShares)
5752
5595
  },
5753
- shareFiles: validated(shareFiles),
5754
- unshare: validated(unshareFile)
5596
+ shareFiles: effect(shareFiles),
5597
+ unshare: effect(unshareFile)
5755
5598
  },
5756
- tunnel: { listRoutes: inputFree(listTunnelRoutes) },
5599
+ tunnel: { listRoutes: effect(listTunnelRoutes) },
5757
5600
  trash: {
5758
- continue: validated(continueTrash),
5759
- delete: validated(deleteTrash),
5760
- empty: inputFree(emptyTrash),
5761
- list: validated(listTrash),
5762
- restore: validated(restoreTrash)
5601
+ continue: effect(continueTrash),
5602
+ delete: effect(deleteTrash),
5603
+ empty: effect(emptyTrash),
5604
+ list: effect(listTrash),
5605
+ restore: effect(restoreTrash)
5763
5606
  },
5764
5607
  transfers: {
5765
- add: validated(addTransfer),
5766
- addMany: validated(addManyTransfers),
5767
- addTrackers: validated(addTransferTrackers),
5768
- cancel: validated(cancelTransfers),
5769
- clean: validated(cleanTransfers),
5770
- continue: validated(continueTransfers),
5771
- count: inputFree(countTransfers),
5772
- get: validated(getTransfer),
5773
- getTorrent: validated(getTransferTorrent),
5774
- info: validated(getTransferInfo),
5775
- list: validated(listTransfers),
5776
- reannounce: validated(reannounceTransfer),
5777
- remove: validated(removeTransfers),
5778
- retry: validated(retryTransfer),
5779
- stopRecording: validated(stopTransferRecording)
5608
+ add: effect(addTransfer),
5609
+ addMany: effect(addManyTransfers),
5610
+ addTrackers: effect(addTransferTrackers),
5611
+ cancel: effect(cancelTransfers),
5612
+ clean: effect(cleanTransfers),
5613
+ continue: effect(continueTransfers),
5614
+ count: effect(countTransfers),
5615
+ get: effect(getTransfer),
5616
+ getTorrent: effect(getTransferTorrent),
5617
+ info: effect(getTransferInfo),
5618
+ list: effect(listTransfers),
5619
+ reannounce: effect(reannounceTransfer),
5620
+ remove: effect(removeTransfers),
5621
+ retry: effect(retryTransfer),
5622
+ stopRecording: effect(stopTransferRecording)
5780
5623
  },
5781
5624
  zips: {
5782
- cancel: validated(cancelZip),
5783
- create: validated(createZip),
5784
- get: validated(getZip),
5785
- list: inputFree(listZips)
5625
+ cancel: effect(cancelZip),
5626
+ create: effect(createZip),
5627
+ get: effect(getZip),
5628
+ list: effect(listZips)
5786
5629
  }
5787
5630
  };
5788
- assertClassifiedOperationTree(sharedOperationTree);
5789
- const createPutioSdkEffectClient = () => cloneOperationTree(sharedOperationTree);
5631
+ const createPutioSdkEffectClient = () => mapOperationTree(sharedOperationTree, (entry) => entry.run);
5790
5632
  var PutioSdk = class extends Context.Service()("PutioSdk") {};
5791
5633
  const makePutioSdkEffectClientLayer = () => Layer.succeed(PutioSdk, createPutioSdkEffectClient());
5792
- const makePutioSdkLiveClientLayer = (config) => Layer.mergeAll(makePutioSdkEffectClientLayer(), makePutioSdkLiveLayer(config));
5634
+ const makePutioSdkLiveClientLayer = (config) => Layer.mergeAll(makePutioSdkEffectClientLayer(), putioSdkLiveLayer(config));
5793
5635
  const createPutioSdkPromiseClient = (initialConfig = {}) => {
5794
- const normalizedConfig = makePutioSdkConfig({
5795
- ...initialConfig,
5796
- baseUrl: snapshotUrl(initialConfig.baseUrl),
5797
- headers: snapshotHeaders(initialConfig.headers),
5798
- uploadBaseUrl: snapshotUrl(initialConfig.uploadBaseUrl),
5799
- webAppUrl: snapshotUrl(initialConfig.webAppUrl)
5800
- });
5801
- const runtimeConfig = {
5802
- baseUrl: normalizedConfig.baseUrl,
5803
- headers: normalizedConfig.headers,
5804
- uploadBaseUrl: normalizedConfig.uploadBaseUrl,
5805
- webAppUrl: normalizedConfig.webAppUrl
5806
- };
5807
5636
  const config = {
5808
5637
  accessToken: initialConfig.accessToken,
5809
- runtimeConfig
5638
+ disposed: false,
5639
+ runtime: void 0,
5640
+ runtimeConfig: Struct.omit(normalizePutioSdkOptions({
5641
+ ...initialConfig,
5642
+ baseUrl: snapshotUrl(initialConfig.baseUrl),
5643
+ headers: snapshotHeaders(initialConfig.headers),
5644
+ uploadBaseUrl: snapshotUrl(initialConfig.uploadBaseUrl),
5645
+ webAppUrl: snapshotUrl(initialConfig.webAppUrl)
5646
+ }), ["accessToken"])
5810
5647
  };
5811
5648
  function getInfo(query = {}) {
5812
5649
  return provideSdk(config, getAccountInfo(query));
@@ -5817,7 +5654,7 @@ const createPutioSdkPromiseClient = (initialConfig = {}) => {
5817
5654
  function getChildByName(input) {
5818
5655
  return provideSdk(config, getFileChild(input));
5819
5656
  }
5820
- const operations = makePromiseOperationTree(sharedOperationTree, config);
5657
+ const operations = mapOperationTree(sharedOperationTree, (entry) => entry.toPromise(config));
5821
5658
  return {
5822
5659
  dispose: () => disposePromiseClientRuntime(config),
5823
5660
  setAccessToken: (accessToken) => {
@@ -5848,6 +5685,6 @@ const createPutioSdkPromiseClient = (initialConfig = {}) => {
5848
5685
  }
5849
5686
  };
5850
5687
  };
5851
- export { AccountClearOptionsSchema, AccountConfirmationSchema, AccountConfirmationsErrorSpec, AccountDiskSchema, AccountInfoBaseSchema, AccountInfoBroadSchema, AccountInfoQuerySchema, AccountSettingsSchema, AccountSubtitleLanguageSchema, AccountTwoFactorSettingsSchema, AccountWarningsSchema, AddManyTransfersErrorSpec, AddTransferErrorSpec, AddTransferTrackersErrorSpec, AppSpecificPasswordSchema, ApproveFriendRequestErrorSpec, AuthorizationCodeSchema, CanWriteFileErrorSpec, CancelZipErrorSpec, ClearEventsErrorSpec, ClearRssFeedLogsErrorSpec, ClientsErrorSpec, ConfirmFastspringOrderErrorSpec, ContinueFilesErrorSpec, ContinuePublicShareFilesErrorSpec, ContinueTrashErrorSpec, CopyFileErrorSpec, CountWaitingRequestsErrorSpec, CreateAppSpecificPasswordErrorSpec, CreateAppSpecificPasswordInputSchema, CreateDownloadLinksErrorSpec, CreateFamilyInviteErrorSpec, CreateFolderErrorSpec, CreateFriendInviteErrorSpec, CreateOAuthAppErrorSpec, CreateOpenNodeChargeErrorSpec, CreatePaddleBillingUpdatePaymentMethodTransactionErrorSpec, CreatePaddleWaitingPaymentErrorSpec, CreatePublicShareErrorSpec, CreateRssFeedErrorSpec, CreateSharingCloneErrorSpec, CreateZipErrorSpec, DEFAULT_PUTIO_API_BASE_URL, DEFAULT_PUTIO_UPLOAD_BASE_URL, DEFAULT_PUTIO_WEB_APP_URL, DeleteAllAppSpecificPasswordsErrorSpec, DeleteAppSpecificPasswordErrorSpec, DeleteEventErrorSpec, DeleteOAuthAppErrorSpec, DeletePublicShareErrorSpec, DeleteRssFeedErrorSpec, DeleteTrashErrorSpec, DenyFriendRequestErrorSpec, DownloadLinksCreateInputSchema, DownloadLinksInfoSchema, DownloadLinksPayloadSchema, DownloadLinksStatusSchema, DownloadUrlErrorSpec, EmptyTrashErrorSpec, EventsListQuerySchema, FamilyInviteLookupErrorSpec, FamilyInviteSchema, FamilyMemberSchema, FileActiveConversionSchema, FileActiveConversionsErrorSpec, FileBaseSchema, FileBreadcrumbSchema, FileBroadSchema, FileConversionStatusSchema, FileCopyInputSchema, FileExtractionSchema, FileExtractionStatusSchema, FileExtractionsErrorSpec, FileGetChildInputSchema, FileMediaInfoFormatSchema, FileMediaInfoSchema, FileMediaInfoStreamSchema, FileMediaMetadataSchema, FileMp4ErrorSpec, FileMp4MutationErrorSpec, FileQuerySchema, FileSetSortInputSchema, FileSortSchema, FileSubtitleSchema, FileSubtitlesErrorSpec, FileTouchInputSchema, FileTypeSchema, FileUploadErrorSpec, FileWatchStatusErrorSpec, FilesListEnvelopeSchema, FilesListQuerySchema, FilesMoveErrorSchema, FilesSearchQuerySchema, FolderTypeSchema, ForgotPasswordErrorSpec, FriendBaseSchema, FriendInviteJoinedUserSchema, FriendInviteJoinedUserStatusSchema, FriendInviteLookupErrorSpec, FriendInviteSchema, FriendSchema, FriendSharedFolderErrorSpec, GenerateTOTPErrorSpec, GenerateTOTPResponseSchema, GetDownloadLinksErrorSpec, GetEventTorrentErrorSpec, GetFileChildErrorSpec, GetFileErrorSpec, GetHlsMasterPlaylistErrorSpec, GetIftttStatusErrorSpec, GetOAuthAppErrorSpec, GetPaddleBillingInvoiceUrlErrorSpec, GetPaymentInfoErrorSpec, GetPaymentVoucherInfoErrorSpec, GetPublicShareErrorSpec, GetPublicShareFileUrlErrorSpec, GetRssFeedErrorSpec, GetSharedWithErrorSpec, GetSharingCloneInfoErrorSpec, GetTransferErrorSpec, GetTransferTorrentErrorSpec, GetZipErrorSpec, GiftCardLookupErrorSpec, GrantsErrorSpec, HistoryEventSchema, HistoryFileFromRssDeletedEventSchema, HistoryFileSharedEventSchema, HistoryKnownEventTypeSchema, HistoryPrivateTorrentPinEventSchema, HistoryRssFilterPausedEventSchema, HistoryTransferCallbackErrorEventSchema, HistoryTransferCompletedEventSchema, HistoryTransferErrorEventSchema, HistoryTransferFromRssErrorEventSchema, HistoryUploadEventSchema, HistoryVoucherEventSchema, HistoryZipCreatedEventSchema, JoinFamilyErrorSpec, JsonObjectSchema, JsonValueSchema, LinkDeviceErrorSpec, ListAppSpecificPasswordsErrorSpec, 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, OAuthAuthorizationCodeExchangeError, OAuthAuthorizationCodeExchangeErrorCodeSchema, OAuthAuthorizationCodeExchangeInputSchema, OAuthSetIconInputSchema, OkResponseSchema, OwnedOAuthAppSchema, PasInfoSchema, PauseRssFeedErrorSpec, PaymentChangePlanPreviewSchema, PaymentChangePlanSubmitSchema, PaymentHistoryItemSchema, PaymentInfoPlanSchema, PaymentInfoSchema, PaymentInviteSchema, PaymentOptionPlanTypeSchema, PaymentOptionSchema, PaymentPlanGroupSchema, PaymentPlanTypeSchema, PaymentProviderNameSchema, PaymentProviderSchema, PaymentSubscriptionInfoSchema, PaymentTypeSchema, PaymentVoucherInfoSchema, PodcastGetLinksInputSchema, PodcastLinkTypeSchema, PodcastLinksSchema, PopularOAuthAppSchema, PreviewPaymentChangePlanErrorSpec, PublicShareListQuerySchema, PublicShareSchema, PutioApiError, PutioAuthError, PutioConfigurationError, PutioErrorEnvelopeSchema, PutioHttpClient, PutioOperationError, PutioRateLimitError, PutioSdk, PutioSdkConfig, PutioTransportError, PutioValidationError, QueryFilesErrorSpec, QueryOAuthAppsErrorSpec, ReannounceTransferErrorSpec, RecoveryCodesErrorSpec, RedeemPaymentVoucherErrorSpec, RegenerateOAuthAppTokenErrorSpec, RegenerateRecoveryCodesErrorSpec, RegisterErrorSpec, RegisterInputSchema, RemoveFamilyMemberErrorSpec, RemoveFriendErrorSpec, RemoveRateLimitBanErrorSpec, RemoveTransfersErrorSpec, RenameFileErrorSpec, ReportPaymentsErrorSpec, ResetPasswordErrorSpec, RestoreTrashErrorSpec, ResumeRssFeedErrorSpec, RetryAllRssFeedItemsErrorSpec, RetryRssFeedItemErrorSpec, RetryTransferErrorSpec, RevokeAllOAuthClientsErrorSpec, RevokeOAuthClientErrorSpec, RevokeOAuthGrantErrorSpec, RssFeedItemFailedSchema, RssFeedItemSchema, RssFeedItemSucceededSchema, RssFeedParamsSchema, RssFeedSchema, SHARED_WITH_YOU_ROOT_ID, SaveAccountSettingsErrorSpec, SaveAccountSettingsPayloadSchema, SearchFilesErrorSpec, SearchFriendsErrorSpec, SendFriendRequestErrorSpec, SendIftttEventErrorSpec, ShareFilesErrorSpec, SharedFileSchema, SharedFileShareSchema, SharedFileSharedWithSchema, SharingCloneInfoSchema, SharingCloneInputSchema, SharingCloneStatusSchema, SharingShareInputSchema, SharingUnshareInputSchema, StartFromErrorSpec, StopRecordingTransferErrorSpec, StopSubscriptionErrorSpec, SubmitPaymentChangePlanErrorSpec, TouchFilesErrorSpec, TransferAddInputSchema, TransferAddTrackersInputSchema, TransferBaseSchema, TransferRemoveInputSchema, TransferSchema, TransferStatusSchema, TransferTypeSchema, TransfersListQuerySchema, TrashFileSchema, TunnelRouteSchema, TwoFactorRecoveryCodesSchema, UnshareFileErrorSpec, UpdateOAuthAppErrorSpec, UpdateRssFeedErrorSpec, UserSearchResultSchema, UserSubscriptionStatusSchema, ValidateTokenResponseSchema, VerifyTOTPErrorSpec, VerifyTOTPResponseSchema, VoucherLookupErrorSpec, ZipStatusSchema, addManyTransfers, addTransfer, addTransferTrackers, approveFriendRequest, buildAuthLoginUrl, buildFileApiContentUrl, buildFileApiDownloadUrl, buildFileApiMp4DownloadUrl, buildFileHlsStreamUrl, buildFileXspfPlaylistUrl, buildOAuthAppIconUrl, buildOAuthAuthorizeUrl, buildPutioUrl, canWriteFile, cancelTransfers, cancelZip, checkCodeMatch, classifyPaymentChangePlanResponse, cleanTransfers, clearAccount, clearEvents, clearRssFeedLogs, clients, cloneSharedFiles, confirmFastspringOrder, continueFiles, continuePublicShareFiles, continueSearch, continueTransfers, continueTrash, convertFileSelectionToMp4, convertFileToMp4, convertFilesToMp4, copyFile, countTransfers, countWaitingRequests, createAppSpecificPassword, createDownloadLinks, createFamilyInvite, createFileUploadFormData, createFileUploadRequest, createFolder, createFriendInvite, createOAuthApp, createOpenNodeCharge, createPaddleBillingUpdatePaymentMethodTransaction, createPaddleWaitingPayment, createPublicShare, createPutioSdkEffectClient, createPutioSdkPromiseClient, createRssFeed, createZip, decodePutioErrorEnvelope, definePutioOperationErrorSpec, deleteAllAppSpecificPasswords, deleteAppSpecificPassword, deleteConfigKey, deleteEvent, deleteFileExtraction, deleteFileMp4, deleteFileSelection, deleteFiles, deleteOAuthApp, deletePublicShare, deleteRssFeed, deleteTrash, denyFriendRequest, destroyAccount, emptyTrash, encodePathSegment, exchangeOAuthAuthorizationCode, exists, extractFiles, fallbackPutioErrorEnvelope, findNextFile, findNextVideo, forgotPassword, generateTOTP, getAccountInfo, getAccountSettings, getApiContentUrl, getApiDownloadUrl, getApiMp4DownloadUrl, getCode, getConfigKey, getConfigKeyWith, getDownloadLinks, getDownloadUrl, getEventTorrent, getFamilyInvite, getFile, getFileChild, getFriendInvite, getFriendSharedFolder, getGiftCard, getHlsMasterPlaylist, getHlsStreamUrl, getIftttStatus, getMp4Status, getOAuthApp, getPaddleBillingInvoiceUrl, getPaymentInfo, getPaymentVoucherInfo, getPodcastLinks, getPopularOAuthApps, getPublicShare, getPublicShareFileUrl, getRecoveryCodes, getRssFeed, getSharedWith, getSharingCloneInfo, getStartFrom, getTransfer, getTransferInfo, getTransferTorrent, getVoucher, getXspfPlaylistUrl, getZip, grants, isPutioApiError, isPutioAuthError, isPutioErrorEnvelope, isPutioOperationError, isPutioRateLimitError, joinFamily, linkDevice, listAccountConfirmations, listAccountSubtitleLanguages, listActiveMp4Conversions, listAppSpecificPasswords, listEvents, listFamilyInvites, listFamilyMembers, listFileExtractions, listFileSubtitles, listFriendInvites, listFriends, listPaymentHistory, listPaymentInvites, listPaymentOptions, listPaymentPlans, listPublicShareFiles, listPublicShares, listRssFeedItems, listRssFeeds, listSentRequests, listSharedFiles, listTransfers, listTrash, listTunnelRoutes, listWaitingRequests, listZips, login, logout, makePutioFetchClient, makePutioFetchLayer, makePutioSdkConfig, makePutioSdkEffectClientLayer, makePutioSdkLayer, makePutioSdkLiveClientLayer, makePutioSdkLiveLayer, makeResponseError, mapConfigurationError, mapDecodeErrorToValidationError, mapTransportError, moveFileSelection, moveFiles, parseErrorBody, pauseRssFeed, previewPaymentChangePlan, putMp4ToMyFiles, queryFiles, queryOAuthApps, readConfig, readConfigWith, reannounceTransfer, redeemPaymentVoucher, regenerateOAuthAppToken, regenerateRecoveryCodes, register, removeFamilyMember, removeFriend, removeRateLimitBan, removeTransfers, renameFile, reportPayments, requestArrayBuffer, requestJson, requestText, requestVoid, resetFileSortSettings, resetPassword, resetStartFrom, responseRateLimitHeaders, restoreTrash, resumeRssFeed, retryAllRssFeedItems, retryRssFeedItem, retryTransfer, revokeAllClients, revokeApp, revokeClient, saveAccountSettings, searchFiles, searchFriends, selectJsonField, selectJsonFields, sendFriendRequest, sendIftttEvent, setConfigKey, setFileSort, setFilesWatchStatus, setOAuthAppIcon, setStartFrom, shareFiles, stopPaymentSubscription, stopTransferRecording, submitPaymentChangePlan, touchFiles, unshareFile, updateOAuthApp, updateRssFeed, uploadFile, validateToken, verifyTOTP, withOperationErrors, writeConfig };
5688
+ export { AccountClearOptionsSchema, AccountConfirmationSchema, AccountConfirmationsErrorSpec, AccountDiskSchema, AccountInfoBaseSchema, AccountInfoBroadSchema, AccountInfoQuerySchema, AccountSettingsSchema, AccountSubtitleLanguageSchema, AccountTwoFactorSettingsSchema, AccountWarningsSchema, AddManyTransfersErrorSpec, AddTransferErrorSpec, AddTransferTrackersErrorSpec, AppSpecificPasswordSchema, ApproveFriendRequestErrorSpec, AuthorizationCodeSchema, CanWriteFileErrorSpec, CancelZipErrorSpec, ClearEventsErrorSpec, ClearRssFeedLogsErrorSpec, ClientsErrorSpec, ConfirmFastspringOrderErrorSpec, ContinueFilesErrorSpec, ContinuePublicShareFilesErrorSpec, ContinueTrashErrorSpec, CopyFileErrorSpec, CountWaitingRequestsErrorSpec, CreateAppSpecificPasswordErrorSpec, CreateAppSpecificPasswordInputSchema, CreateDownloadLinksErrorSpec, CreateFamilyInviteErrorSpec, CreateFolderErrorSpec, CreateFriendInviteErrorSpec, CreateOAuthAppErrorSpec, CreateOpenNodeChargeErrorSpec, CreatePaddleBillingUpdatePaymentMethodTransactionErrorSpec, CreatePaddleWaitingPaymentErrorSpec, CreatePublicShareErrorSpec, CreateRssFeedErrorSpec, CreateSharingCloneErrorSpec, CreateZipErrorSpec, DEFAULT_PUTIO_API_BASE_URL, DEFAULT_PUTIO_UPLOAD_BASE_URL, DEFAULT_PUTIO_WEB_APP_URL, DeleteAllAppSpecificPasswordsErrorSpec, DeleteAppSpecificPasswordErrorSpec, DeleteEventErrorSpec, DeleteOAuthAppErrorSpec, DeletePublicShareErrorSpec, DeleteRssFeedErrorSpec, DeleteTrashErrorSpec, DenyFriendRequestErrorSpec, DownloadLinksCreateInputSchema, DownloadLinksInfoSchema, DownloadLinksPayloadSchema, DownloadLinksStatusSchema, DownloadUrlErrorSpec, EmptyTrashErrorSpec, EventsListQuerySchema, FamilyInviteLookupErrorSpec, FamilyInviteSchema, FamilyMemberSchema, FileActiveConversionSchema, FileActiveConversionsErrorSpec, FileBaseSchema, FileBreadcrumbSchema, FileBroadSchema, FileConversionStatusSchema, FileCopyInputSchema, FileExtractionSchema, FileExtractionStatusSchema, FileExtractionsErrorSpec, FileGetChildInputSchema, FileMediaInfoFormatSchema, FileMediaInfoSchema, FileMediaInfoStreamSchema, FileMediaMetadataSchema, FileMp4ErrorSpec, FileMp4MutationErrorSpec, FileQuerySchema, FileSetSortInputSchema, FileSortSchema, FileSubtitleSchema, FileSubtitlesErrorSpec, FileTouchInputSchema, FileTypeSchema, FileUploadErrorSpec, FileWatchStatusErrorSpec, FilesListEnvelopeSchema, FilesListQuerySchema, FilesMoveErrorSchema, FilesSearchQuerySchema, FolderTypeSchema, ForgotPasswordErrorSpec, FriendBaseSchema, FriendInviteJoinedUserSchema, FriendInviteJoinedUserStatusSchema, FriendInviteLookupErrorSpec, FriendInviteSchema, FriendSchema, FriendSharedFolderErrorSpec, GenerateTOTPErrorSpec, GenerateTOTPResponseSchema, GetDownloadLinksErrorSpec, GetEventTorrentErrorSpec, GetFileChildErrorSpec, GetFileErrorSpec, GetHlsMasterPlaylistErrorSpec, GetIftttStatusErrorSpec, GetOAuthAppErrorSpec, GetPaddleBillingInvoiceUrlErrorSpec, GetPaymentInfoErrorSpec, GetPaymentVoucherInfoErrorSpec, GetPublicShareErrorSpec, GetPublicShareFileUrlErrorSpec, GetRssFeedErrorSpec, GetSharedWithErrorSpec, GetSharingCloneInfoErrorSpec, GetTransferErrorSpec, GetTransferTorrentErrorSpec, GetZipErrorSpec, GiftCardLookupErrorSpec, GrantsErrorSpec, HistoryEventSchema, HistoryFileFromRssDeletedEventSchema, HistoryFileSharedEventSchema, HistoryKnownEventTypeSchema, HistoryPrivateTorrentPinEventSchema, HistoryRssFilterPausedEventSchema, HistoryTransferCallbackErrorEventSchema, HistoryTransferCompletedEventSchema, HistoryTransferErrorEventSchema, HistoryTransferFromRssErrorEventSchema, HistoryUploadEventSchema, HistoryVoucherEventSchema, HistoryZipCreatedEventSchema, JoinFamilyErrorSpec, JsonObjectSchema, JsonValueSchema, LinkDeviceErrorSpec, ListAppSpecificPasswordsErrorSpec, 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, OAuthAuthorizationCodeExchangeError, OAuthAuthorizationCodeExchangeErrorCodeSchema, OAuthAuthorizationCodeExchangeInputSchema, OAuthSetIconInputSchema, OkResponseSchema, OwnedOAuthAppSchema, PasInfoSchema, PauseRssFeedErrorSpec, PaymentChangePlanPreviewSchema, PaymentChangePlanSubmitSchema, PaymentHistoryItemSchema, PaymentInfoPlanSchema, PaymentInfoSchema, PaymentInviteSchema, PaymentOptionPlanTypeSchema, PaymentOptionSchema, PaymentPlanGroupSchema, PaymentPlanTypeSchema, PaymentProviderNameSchema, PaymentProviderSchema, PaymentSubscriptionInfoSchema, PaymentTypeSchema, PaymentVoucherInfoSchema, PodcastGetLinksInputSchema, PodcastLinkTypeSchema, PodcastLinksSchema, PopularOAuthAppSchema, PreviewPaymentChangePlanErrorSpec, PublicShareListQuerySchema, PublicShareSchema, PutioApiError, PutioAuthError, PutioConfigurationError, PutioErrorEnvelopeSchema, PutioHttpClient, PutioOperationError, PutioRateLimitError, PutioSdk, PutioSdkConfig, PutioTransportError, PutioValidationError, QueryFilesErrorSpec, QueryOAuthAppsErrorSpec, ReannounceTransferErrorSpec, RecoveryCodesErrorSpec, RedeemPaymentVoucherErrorSpec, RegenerateOAuthAppTokenErrorSpec, RegenerateRecoveryCodesErrorSpec, RegisterErrorSpec, RegisterInputSchema, RemoveFamilyMemberErrorSpec, RemoveFriendErrorSpec, RemoveRateLimitBanErrorSpec, RemoveTransfersErrorSpec, RenameFileErrorSpec, ReportPaymentsErrorSpec, ResetPasswordErrorSpec, RestoreTrashErrorSpec, ResumeRssFeedErrorSpec, RetryAllRssFeedItemsErrorSpec, RetryRssFeedItemErrorSpec, RetryTransferErrorSpec, RevokeAllOAuthClientsErrorSpec, RevokeOAuthClientErrorSpec, RevokeOAuthGrantErrorSpec, RssFeedItemFailedSchema, RssFeedItemSchema, RssFeedItemSucceededSchema, RssFeedParamsSchema, RssFeedSchema, SHARED_WITH_YOU_ROOT_ID, SaveAccountSettingsErrorSpec, SaveAccountSettingsPayloadSchema, SearchFilesErrorSpec, SearchFriendsErrorSpec, SendFriendRequestErrorSpec, SendIftttEventErrorSpec, ShareFilesErrorSpec, SharedFileSchema, SharedFileShareSchema, SharedFileSharedWithSchema, SharingCloneInfoSchema, SharingCloneInputSchema, SharingCloneStatusSchema, SharingShareInputSchema, SharingUnshareInputSchema, StartFromErrorSpec, StopRecordingTransferErrorSpec, StopSubscriptionErrorSpec, SubmitPaymentChangePlanErrorSpec, TouchFilesErrorSpec, TransferAddInputSchema, TransferAddTrackersInputSchema, TransferBaseSchema, TransferRemoveInputSchema, TransferSchema, TransferStatusSchema, TransferTypeSchema, TransfersListQuerySchema, TrashFileSchema, TunnelRouteSchema, TwoFactorRecoveryCodesSchema, UnshareFileErrorSpec, UpdateOAuthAppErrorSpec, UpdateRssFeedErrorSpec, UserSearchResultSchema, UserSubscriptionStatusSchema, ValidateTokenResponseSchema, VerifyTOTPErrorSpec, VerifyTOTPResponseSchema, VoucherLookupErrorSpec, ZipStatusSchema, addManyTransfers, addTransfer, addTransferTrackers, approveFriendRequest, buildAuthLoginUrl, buildFileApiContentUrl, buildFileApiDownloadUrl, buildFileApiMp4DownloadUrl, buildFileHlsStreamUrl, buildFileXspfPlaylistUrl, buildOAuthAppIconUrl, buildOAuthAuthorizeUrl, buildPutioUrl, canWriteFile, cancelTransfers, cancelZip, checkCodeMatch, classifyPaymentChangePlanResponse, cleanTransfers, clearAccount, clearEvents, clearRssFeedLogs, clients, cloneSharedFiles, confirmFastspringOrder, continueFiles, continuePublicShareFiles, continueSearch, continueTransfers, continueTrash, convertFileSelectionToMp4, convertFileToMp4, convertFilesToMp4, copyFile, countTransfers, countWaitingRequests, createAppSpecificPassword, createDownloadLinks, createFamilyInvite, createFileUploadFormData, createFileUploadRequest, createFolder, createFriendInvite, createOAuthApp, createOpenNodeCharge, createPaddleBillingUpdatePaymentMethodTransaction, createPaddleWaitingPayment, createPublicShare, createPutioSdkEffectClient, createPutioSdkPromiseClient, createRssFeed, createZip, decodePutioErrorEnvelope, definePutioOperationErrorSpec, deleteAllAppSpecificPasswords, deleteAppSpecificPassword, deleteConfigKey, deleteEvent, deleteFileExtraction, deleteFileMp4, deleteFileSelection, deleteFiles, deleteOAuthApp, deletePublicShare, deleteRssFeed, deleteTrash, denyFriendRequest, destroyAccount, emptyTrash, encodePathSegment, exchangeOAuthAuthorizationCode, exists, extractFiles, fallbackPutioErrorEnvelope, findNextFile, findNextVideo, forgotPassword, generateTOTP, getAccountInfo, getAccountSettings, getApiContentUrl, getApiDownloadUrl, getApiMp4DownloadUrl, getCode, getConfigKey, getConfigKeyWith, getDownloadLinks, getDownloadUrl, getEventTorrent, getFamilyInvite, getFile, getFileChild, getFriendInvite, getFriendSharedFolder, getGiftCard, getHlsMasterPlaylist, getHlsStreamUrl, getIftttStatus, getMp4Status, getOAuthApp, getPaddleBillingInvoiceUrl, getPaymentInfo, getPaymentVoucherInfo, getPodcastLinks, getPopularOAuthApps, getPublicShare, getPublicShareFileUrl, getRecoveryCodes, getRssFeed, getSharedWith, getSharingCloneInfo, getStartFrom, getTransfer, getTransferInfo, getTransferTorrent, getVoucher, getXspfPlaylistUrl, getZip, grants, isPutioApiError, isPutioAuthError, isPutioErrorEnvelope, isPutioOperationError, isPutioRateLimitError, joinFamily, linkDevice, listAccountConfirmations, listAccountSubtitleLanguages, listActiveMp4Conversions, listAppSpecificPasswords, listEvents, listFamilyInvites, listFamilyMembers, listFileExtractions, listFileSubtitles, listFriendInvites, listFriends, listPaymentHistory, listPaymentInvites, listPaymentOptions, listPaymentPlans, listPublicShareFiles, listPublicShares, listRssFeedItems, listRssFeeds, listSentRequests, listSharedFiles, listTransfers, listTrash, listTunnelRoutes, listWaitingRequests, listZips, login, logout, makePutioFetchClient, makePutioFetchLayer, makePutioSdkEffectClientLayer, makePutioSdkLiveClientLayer, mapConfigurationError, mapDecodeErrorToValidationError, mapTransportError, moveFileSelection, moveFiles, normalizePutioSdkOptions, parseErrorBody, pauseRssFeed, previewPaymentChangePlan, putMp4ToMyFiles, putioSdkLayer, putioSdkLiveLayer, queryFiles, queryOAuthApps, readConfig, readConfigWith, reannounceTransfer, redeemPaymentVoucher, regenerateOAuthAppToken, regenerateRecoveryCodes, register, removeFamilyMember, removeFriend, removeRateLimitBan, removeTransfers, renameFile, reportPayments, requestArrayBuffer, requestJson, requestText, requestVoid, resetFileSortSettings, resetPassword, resetStartFrom, responseRateLimitHeaders, restoreTrash, resumeRssFeed, retryAllRssFeedItems, retryRssFeedItem, retryTransfer, revokeAllClients, revokeApp, revokeClient, saveAccountSettings, searchFiles, searchFriends, selectJsonField, selectJsonFields, sendFriendRequest, sendIftttEvent, setConfigKey, setFileSort, setFilesWatchStatus, setOAuthAppIcon, setStartFrom, shareFiles, stopPaymentSubscription, stopTransferRecording, submitPaymentChangePlan, toPutioResponseError, touchFiles, unshareFile, updateOAuthApp, updateRssFeed, uploadFile, validateToken, verifyTOTP, withOperationErrors, writeConfig };
5852
5689
 
5853
5690
  //# sourceMappingURL=index.js.map