@putdotio/sdk 11.4.4 → 11.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -47
- package/dist/{index-BE2uTdeq.d.ts → index-DCF_sa0r.d.ts} +31 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/utilities.d.ts +36 -37
- package/package.json +3 -3
package/dist/utilities.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { Am as PutioErrorEnvelope, Dm as PutioApiError, Nm as PutioKnownOperationErrorContract, Om as PutioAuthError, Pm as PutioOperationError, Rm as PutioRateLimitError, zo as FileBroad } from "./index-
|
|
1
|
+
import { Am as PutioErrorEnvelope, Dm as PutioApiError, Nm as PutioKnownOperationErrorContract, Om as PutioAuthError, Pm as PutioOperationError, Rm as PutioRateLimitError, zo as FileBroad } from "./index-DCF_sa0r.js";
|
|
2
2
|
//#region src/utilities/date.d.ts
|
|
3
|
-
declare const ensureUTC: (date?: unknown) => string;
|
|
4
|
-
declare const toTimeAgo: (date?: unknown) => string;
|
|
5
|
-
declare const formatDate: (date?: unknown, format?: "LL" | Intl.DateTimeFormatOptions) => string;
|
|
6
|
-
declare const daysDiff: (date1: unknown, date2: unknown) => number;
|
|
7
|
-
declare const daysDiffFromNow: (date?: unknown) => number;
|
|
8
|
-
declare const getUnixTimestamp: (date: unknown) => number;
|
|
3
|
+
export declare const ensureUTC: (date?: unknown) => string;
|
|
4
|
+
export declare const toTimeAgo: (date?: unknown) => string;
|
|
5
|
+
export declare const formatDate: (date?: unknown, format?: "LL" | Intl.DateTimeFormatOptions) => string;
|
|
6
|
+
export declare const daysDiff: (date1: unknown, date2: unknown) => number;
|
|
7
|
+
export declare const daysDiffFromNow: (date?: unknown) => number;
|
|
8
|
+
export declare const getUnixTimestamp: (date: unknown) => number;
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/utilities/duration.d.ts
|
|
11
|
-
declare const secondsToDuration: (seconds: unknown) => string;
|
|
12
|
-
declare const secondsToReadableDuration: (seconds: unknown) => string;
|
|
11
|
+
export declare const secondsToDuration: (seconds: unknown) => string;
|
|
12
|
+
export declare const secondsToReadableDuration: (seconds: unknown) => string;
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/utilities/file-render-type.d.ts
|
|
15
|
-
type FileRenderType = "archive" | "audio" | "epub" | "folder" | "image" | "other" | "pdf" | "text" | "text/markdown" | "video";
|
|
16
|
-
type FileRenderTypeInput = Pick<FileBroad, "content_type" | "extension" | "file_type">;
|
|
17
|
-
declare const getFileRenderType: (file: FileRenderTypeInput) => FileRenderType;
|
|
15
|
+
export type FileRenderType = "archive" | "audio" | "epub" | "folder" | "image" | "other" | "pdf" | "text" | "text/markdown" | "video";
|
|
16
|
+
export type FileRenderTypeInput = Pick<FileBroad, "content_type" | "extension" | "file_type">;
|
|
17
|
+
export declare const getFileRenderType: (file: FileRenderTypeInput) => FileRenderType;
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/utilities/file-size.d.ts
|
|
20
|
-
interface HumanFileSizeOptions {
|
|
20
|
+
export interface HumanFileSizeOptions {
|
|
21
21
|
readonly decimals?: number;
|
|
22
22
|
readonly unitSeparator?: string;
|
|
23
23
|
}
|
|
24
|
-
declare const toHumanFileSize: (fileSizeInBytes: string | number, options?: HumanFileSizeOptions) => string;
|
|
24
|
+
export declare const toHumanFileSize: (fileSizeInBytes: string | number, options?: HumanFileSizeOptions) => string;
|
|
25
25
|
//#endregion
|
|
26
26
|
//#region src/utilities/file-url-provider.d.ts
|
|
27
|
-
type FileUrlProviderInput = Pick<FileBroad, "content_type" | "extension" | "file_type" | "id" | "is_mp4_available">;
|
|
28
|
-
declare class FileURLProvider {
|
|
27
|
+
export type FileUrlProviderInput = Pick<FileBroad, "content_type" | "extension" | "file_type" | "id" | "is_mp4_available">;
|
|
28
|
+
export declare class FileURLProvider {
|
|
29
29
|
readonly apiURL: string;
|
|
30
30
|
readonly token: string;
|
|
31
31
|
readonly baseURL: string;
|
|
@@ -43,11 +43,11 @@ declare class FileURLProvider {
|
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
45
45
|
//#region src/utilities/localized-error.d.ts
|
|
46
|
-
type LocalizedErrorRecoverySuggestionTypeInstruction = {
|
|
46
|
+
export type LocalizedErrorRecoverySuggestionTypeInstruction = {
|
|
47
47
|
readonly type: "instruction";
|
|
48
48
|
readonly description: string;
|
|
49
49
|
};
|
|
50
|
-
type LocalizedErrorRecoverySuggestionTypeAction = {
|
|
50
|
+
export type LocalizedErrorRecoverySuggestionTypeAction = {
|
|
51
51
|
readonly type: "action";
|
|
52
52
|
readonly description: string;
|
|
53
53
|
readonly trigger: {
|
|
@@ -55,66 +55,65 @@ type LocalizedErrorRecoverySuggestionTypeAction = {
|
|
|
55
55
|
readonly callback: () => void;
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
|
-
type LocalizedErrorRecoverySuggestionTypeCaptcha = {
|
|
58
|
+
export type LocalizedErrorRecoverySuggestionTypeCaptcha = {
|
|
59
59
|
readonly type: "captcha";
|
|
60
60
|
readonly description: string;
|
|
61
61
|
};
|
|
62
|
-
type LocalizedErrorRecoverySuggestion = LocalizedErrorRecoverySuggestionTypeInstruction | LocalizedErrorRecoverySuggestionTypeAction | LocalizedErrorRecoverySuggestionTypeCaptcha;
|
|
63
|
-
interface LocalizedErrorParams {
|
|
62
|
+
export type LocalizedErrorRecoverySuggestion = LocalizedErrorRecoverySuggestionTypeInstruction | LocalizedErrorRecoverySuggestionTypeAction | LocalizedErrorRecoverySuggestionTypeCaptcha;
|
|
63
|
+
export interface LocalizedErrorParams {
|
|
64
64
|
readonly message: string;
|
|
65
65
|
readonly recoverySuggestion: LocalizedErrorRecoverySuggestion;
|
|
66
66
|
readonly underlyingError: unknown;
|
|
67
67
|
readonly meta?: Record<string, unknown>;
|
|
68
68
|
}
|
|
69
|
-
declare class LocalizedError extends Error {
|
|
69
|
+
export declare class LocalizedError extends Error {
|
|
70
70
|
readonly recoverySuggestion: LocalizedErrorRecoverySuggestion;
|
|
71
71
|
readonly underlyingError: unknown;
|
|
72
72
|
readonly meta: Record<string, unknown>;
|
|
73
73
|
constructor(params: LocalizedErrorParams);
|
|
74
74
|
}
|
|
75
75
|
type StatusAndBodyError = PutioApiError | PutioAuthError | PutioRateLimitError | PutioOperationError<string, string, PutioKnownOperationErrorContract>;
|
|
76
|
-
type PutioLocalizableError = {
|
|
76
|
+
export type PutioLocalizableError = {
|
|
77
77
|
readonly _tag?: string;
|
|
78
78
|
readonly body: PutioErrorEnvelope;
|
|
79
79
|
readonly status?: number;
|
|
80
80
|
};
|
|
81
|
-
type PutioErrorWithBody = StatusAndBodyError;
|
|
82
|
-
type LocalizeErrorFn<E> = (error: E) => Pick<LocalizedErrorParams, "message" | "recoverySuggestion" | "meta">;
|
|
83
|
-
type APIErrorByStatusCodeLocalizer = {
|
|
81
|
+
export type PutioErrorWithBody = StatusAndBodyError;
|
|
82
|
+
export type LocalizeErrorFn<E> = (error: E) => Pick<LocalizedErrorParams, "message" | "recoverySuggestion" | "meta">;
|
|
83
|
+
export type APIErrorByStatusCodeLocalizer = {
|
|
84
84
|
readonly kind: "api_status_code";
|
|
85
85
|
readonly status_code: number;
|
|
86
86
|
readonly localize: LocalizeErrorFn<PutioLocalizableError>;
|
|
87
87
|
};
|
|
88
|
-
type APIErrorByErrorTypeLocalizer = {
|
|
88
|
+
export type APIErrorByErrorTypeLocalizer = {
|
|
89
89
|
readonly kind: "api_error_type";
|
|
90
90
|
readonly error_type: string;
|
|
91
91
|
readonly localize: LocalizeErrorFn<PutioLocalizableError>;
|
|
92
92
|
};
|
|
93
|
-
type MatchConditionLocalizer<E> = {
|
|
93
|
+
export type MatchConditionLocalizer<E> = {
|
|
94
94
|
readonly kind: "match_condition";
|
|
95
95
|
readonly match: (error: E) => boolean;
|
|
96
96
|
readonly localize: LocalizeErrorFn<E>;
|
|
97
97
|
};
|
|
98
|
-
type GenericErrorLocalizer = {
|
|
98
|
+
export type GenericErrorLocalizer = {
|
|
99
99
|
readonly kind: "generic";
|
|
100
100
|
readonly localize: LocalizeErrorFn<unknown>;
|
|
101
101
|
};
|
|
102
|
-
type ErrorLocalizer<E> = APIErrorByStatusCodeLocalizer | APIErrorByErrorTypeLocalizer | MatchConditionLocalizer<E> | GenericErrorLocalizer;
|
|
103
|
-
type ErrorLocalizerFn = (error: unknown) => LocalizedError;
|
|
104
|
-
declare const isErrorLocalizer: (fn: unknown) => fn is ErrorLocalizerFn;
|
|
105
|
-
declare const createLocalizeError: <GlobalError>(globalLocalizers: ReadonlyArray<ErrorLocalizer<GlobalError>>) => <ScopedError extends GlobalError>(error: ScopedError, scopedLocalizers?: ReadonlyArray<ErrorLocalizer<ScopedError>>) => LocalizedError;
|
|
102
|
+
export type ErrorLocalizer<E> = APIErrorByStatusCodeLocalizer | APIErrorByErrorTypeLocalizer | MatchConditionLocalizer<E> | GenericErrorLocalizer;
|
|
103
|
+
export type ErrorLocalizerFn = (error: unknown) => LocalizedError;
|
|
104
|
+
export declare const isErrorLocalizer: (fn: unknown) => fn is ErrorLocalizerFn;
|
|
105
|
+
export declare const createLocalizeError: <GlobalError>(globalLocalizers: ReadonlyArray<ErrorLocalizer<GlobalError>>) => <ScopedError extends GlobalError>(error: ScopedError, scopedLocalizers?: ReadonlyArray<ErrorLocalizer<ScopedError>>) => LocalizedError;
|
|
106
106
|
//#endregion
|
|
107
107
|
//#region src/utilities/string.d.ts
|
|
108
|
-
declare const dotsToSpaces: (input: string) => string;
|
|
109
|
-
declare const truncate: (input: string, options: {
|
|
108
|
+
export declare const dotsToSpaces: (input: string) => string;
|
|
109
|
+
export declare const truncate: (input: string, options: {
|
|
110
110
|
readonly length: number;
|
|
111
111
|
readonly ellipsis?: string;
|
|
112
112
|
}) => string;
|
|
113
|
-
declare const truncateMiddle: (input: string, options: {
|
|
113
|
+
export declare const truncateMiddle: (input: string, options: {
|
|
114
114
|
readonly frontLength: number;
|
|
115
115
|
readonly backLength: number;
|
|
116
116
|
readonly ellipsis?: string;
|
|
117
117
|
}) => string;
|
|
118
118
|
//#endregion
|
|
119
|
-
export { APIErrorByErrorTypeLocalizer, APIErrorByStatusCodeLocalizer, ErrorLocalizer, ErrorLocalizerFn, FileRenderType, FileRenderTypeInput, FileURLProvider, FileUrlProviderInput, GenericErrorLocalizer, HumanFileSizeOptions, LocalizeErrorFn, LocalizedError, LocalizedErrorParams, LocalizedErrorRecoverySuggestion, LocalizedErrorRecoverySuggestionTypeAction, LocalizedErrorRecoverySuggestionTypeCaptcha, LocalizedErrorRecoverySuggestionTypeInstruction, MatchConditionLocalizer, PutioErrorWithBody, PutioLocalizableError, createLocalizeError, daysDiff, daysDiffFromNow, dotsToSpaces, ensureUTC, formatDate, getFileRenderType, getUnixTimestamp, isErrorLocalizer, secondsToDuration, secondsToReadableDuration, toHumanFileSize, toTimeAgo, truncate, truncateMiddle };
|
|
120
119
|
//# sourceMappingURL=utilities.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putdotio/sdk",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.5.1",
|
|
4
4
|
"description": "Effect-first TypeScript SDK for the put.io API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"effect",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"verify": "vp check . && vp run lint:package && knip && knip --production --no-gitignore && vp run validate:routes:packed && vp test run --coverage --passWithNoTests"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"effect": "4.0.0
|
|
65
|
+
"effect": "4.0.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"engines": {
|
|
80
80
|
"node": ">=24.19.0"
|
|
81
81
|
},
|
|
82
|
-
"packageManager": "pnpm@12.
|
|
82
|
+
"packageManager": "pnpm@12.4.2"
|
|
83
83
|
}
|