-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: default export, npm package, include dist
- Loading branch information
Showing
49 changed files
with
710 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
dist/**/* | ||
node_modules/**/* | ||
src/test/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
dist/**/* | ||
node_modules/**/* | ||
src/test/**/* | ||
docs/**/* | ||
__tests__/**/* | ||
src/test/**/* |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/*! | ||
* The buffer module from node.js, for the browser. | ||
* | ||
* @author Feross Aboukhadijeh <https://feross.org> | ||
* @license MIT | ||
*/ | ||
|
||
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ | ||
|
||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ | ||
|
||
/** @preserve | ||
* Counter block mode compatible with Dr Brian Gladman fileenc.c | ||
* derived from CryptoJS.mode.CTR | ||
* Jan Hruby [email protected] | ||
*/ | ||
|
||
/** @preserve | ||
(c) 2012 by Cédric Mesnil. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/*! | ||
* mime-db | ||
* Copyright(c) 2014 Jonathan Ong | ||
* Copyright(c) 2015-2022 Douglas Christopher Wilson | ||
* MIT Licensed | ||
*/ | ||
|
||
/*! | ||
* mime-types | ||
* Copyright(c) 2014 Jonathan Ong | ||
* Copyright(c) 2015 Douglas Christopher Wilson | ||
* MIT Licensed | ||
*/ | ||
|
||
/** @preserve | ||
* Counter block mode compatible with Dr Brian Gladman fileenc.c | ||
* derived from CryptoJS.mode.CTR | ||
* Jan Hruby [email protected] | ||
*/ | ||
|
||
/** @preserve | ||
(c) 2012 by Cédric Mesnil. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
export type APIClientConfig = { | ||
apiKey: string; | ||
}; | ||
export type BaseRequestParameters = { | ||
endpoint: string; | ||
url?: string; | ||
signal?: AbortSignal; | ||
timeout?: number; | ||
maxRetries?: number; | ||
retryTimeout?: number; | ||
}; | ||
export type GetRequestParameters = BaseRequestParameters & { | ||
method: "GET"; | ||
}; | ||
export type PostRequestParameters = BaseRequestParameters & { | ||
method: "POST"; | ||
data: Record<string, unknown>; | ||
}; | ||
export type RequestParameters = GetRequestParameters | PostRequestParameters; | ||
export declare const APIClientDefaults: { | ||
readonly url: "https://gateway.filen.io"; | ||
readonly timeout: 300000; | ||
readonly maxRetries: 3; | ||
readonly retryTimeout: 1000; | ||
}; | ||
/** | ||
* APIClient | ||
* @date 2/1/2024 - 2:45:15 AM | ||
* | ||
* @export | ||
* @class APIClient | ||
* @typedef {APIClient} | ||
*/ | ||
export declare class APIClient { | ||
private readonly config; | ||
/** | ||
* Creates an instance of APIClient. | ||
* @date 1/31/2024 - 4:09:17 PM | ||
* | ||
* @constructor | ||
* @public | ||
* @param {APIClientConfig} params | ||
*/ | ||
constructor(params: APIClientConfig); | ||
/** | ||
* Build API request headers | ||
* @date 1/31/2024 - 4:09:33 PM | ||
* | ||
* @private | ||
* @returns {Record<string, string>} | ||
*/ | ||
private buildHeaders; | ||
/** | ||
* Send a POST request. | ||
* @date 2/1/2024 - 2:48:57 AM | ||
* | ||
* @private | ||
* @async | ||
* @param {PostRequestParameters} params | ||
* @returns {unknown} | ||
*/ | ||
private post; | ||
/** | ||
* Send a GET request. | ||
* @date 2/1/2024 - 2:49:04 AM | ||
* | ||
* @private | ||
* @async | ||
* @param {GetRequestParameters} params | ||
* @returns {unknown} | ||
*/ | ||
private get; | ||
/** | ||
* Sends the request to the API. | ||
* @date 2/1/2024 - 2:49:20 AM | ||
* | ||
* @public | ||
* @async | ||
* @template T | ||
* @param {RequestParameters} params | ||
* @returns {Promise<T>} | ||
*/ | ||
request<T>(params: RequestParameters): Promise<T>; | ||
} | ||
export default APIClient; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type APIClient from "../client"; | ||
import type { FileEncryptionVersion } from "../../types"; | ||
export type DirContentUpload = { | ||
uuid: string; | ||
metadata: string; | ||
rm: string; | ||
timestamp: number; | ||
chunks: number; | ||
size: number; | ||
bucket: string; | ||
region: string; | ||
parent: string; | ||
version: FileEncryptionVersion; | ||
favorited: 0 | 1; | ||
}; | ||
export type DirContentFolder = { | ||
uuid: string; | ||
name: string; | ||
parent: string; | ||
color: string | null; | ||
timestamp: number; | ||
favorited: 0 | 1; | ||
is_sync: 0 | 1; | ||
is_default: 0 | 1; | ||
}; | ||
export type DirContentResponse = { | ||
uploads: DirContentUpload[]; | ||
folders: DirContentFolder[]; | ||
}; | ||
export default class DirContent { | ||
private readonly apiClient; | ||
constructor({ apiClient }: { | ||
apiClient: APIClient; | ||
}); | ||
get({ uuid }: { | ||
uuid: string; | ||
}): Promise<DirContentResponse>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type APIClient from "../client"; | ||
export default class Health { | ||
private readonly apiClient; | ||
constructor({ apiClient }: { | ||
apiClient: APIClient; | ||
}); | ||
get(): Promise<string>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import V3Health from "./v3/health"; | ||
import V3DirContent from "./v3/dir/content"; | ||
export type APIConfig = { | ||
apiKey: string; | ||
}; | ||
export declare class API { | ||
private readonly config; | ||
private apiClient; | ||
constructor(params: APIConfig); | ||
v3(): { | ||
health: () => V3Health; | ||
dir: () => { | ||
content: () => V3DirContent; | ||
}; | ||
}; | ||
} | ||
export default API; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import type APIClient from "../../client"; | ||
import type { FileEncryptionVersion } from "../../../types"; | ||
export type DirContentUpload = { | ||
uuid: string; | ||
metadata: string; | ||
rm: string; | ||
timestamp: number; | ||
chunks: number; | ||
size: number; | ||
bucket: string; | ||
region: string; | ||
parent: string; | ||
version: FileEncryptionVersion; | ||
favorited: 0 | 1; | ||
}; | ||
export type DirContentFolder = { | ||
uuid: string; | ||
name: string; | ||
parent: string; | ||
color: string | null; | ||
timestamp: number; | ||
favorited: 0 | 1; | ||
is_sync: 0 | 1; | ||
is_default: 0 | 1; | ||
}; | ||
export type DirContentResponse = { | ||
uploads: DirContentUpload[]; | ||
folders: DirContentFolder[]; | ||
}; | ||
/** | ||
* DirContent | ||
* @date 2/1/2024 - 3:22:32 AM | ||
* | ||
* @export | ||
* @class DirContent | ||
* @typedef {DirContent} | ||
*/ | ||
export declare class DirContent { | ||
private readonly apiClient; | ||
constructor({ apiClient }: { | ||
apiClient: APIClient; | ||
}); | ||
/** | ||
* Returns all files and folders inside a folder. | ||
* @date 2/1/2024 - 3:22:42 AM | ||
* | ||
* @public | ||
* @async | ||
* @param {{ uuid: string }} param0 | ||
* @param {string} param0.uuid | ||
* @returns {Promise<DirContentResponse>} | ||
*/ | ||
fetch({ uuid }: { | ||
uuid: string; | ||
}): Promise<DirContentResponse>; | ||
} | ||
export default DirContent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import type APIClient from "../../client"; | ||
/** | ||
* Health | ||
* @date 2/1/2024 - 3:23:04 AM | ||
* | ||
* @export | ||
* @class Health | ||
* @typedef {Health} | ||
*/ | ||
export declare class Health { | ||
private readonly apiClient; | ||
constructor({ apiClient }: { | ||
apiClient: APIClient; | ||
}); | ||
/** | ||
* Returns "OK" when API is healthy. | ||
* @date 2/1/2024 - 3:23:14 AM | ||
* | ||
* @public | ||
* @async | ||
* @returns {Promise<"OK">} | ||
*/ | ||
fetch(): Promise<"OK">; | ||
} | ||
export default Health; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export declare const environment: "node" | "react-native" | "browser"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import type { CryptoConfig } from "."; | ||
import type { FileMetadata, FolderMetadata } from "../types"; | ||
/** | ||
* Decrypt | ||
* @date 1/31/2024 - 6:36:57 PM | ||
* | ||
* @export | ||
* @class Decrypt | ||
* @typedef {Decrypt} | ||
*/ | ||
export declare class Decrypt { | ||
private readonly config; | ||
private readonly textEncoder; | ||
private readonly textDecoder; | ||
/** | ||
* Creates an instance of Decrypt. | ||
* @date 1/31/2024 - 3:59:10 PM | ||
* | ||
* @constructor | ||
* @public | ||
* @param {CryptoConfig} params | ||
*/ | ||
constructor(params: CryptoConfig); | ||
/** | ||
* Decrypt a string with the given key. | ||
* @date 1/31/2024 - 3:58:27 PM | ||
* | ||
* @public | ||
* @async | ||
* @param {{ data: string; key: string }} param0 | ||
* @param {string} param0.data | ||
* @param {string} param0.key | ||
* @returns {Promise<string>} | ||
*/ | ||
metadata({ metadata, key }: { | ||
metadata: string; | ||
key: string; | ||
}): Promise<string>; | ||
/** | ||
* Decrypt file metadata. | ||
* @date 1/31/2024 - 4:20:32 PM | ||
* | ||
* @public | ||
* @async | ||
* @param {{ metadata: string }} param0 | ||
* @param {string} param0.metadata | ||
* @returns {Promise<FileMetadata>} | ||
*/ | ||
fileMetadata({ metadata }: { | ||
metadata: string; | ||
}): Promise<FileMetadata>; | ||
/** | ||
* Decrypt folder metadata. | ||
* @date 1/31/2024 - 4:26:11 PM | ||
* | ||
* @public | ||
* @async | ||
* @param {{ metadata: string }} param0 | ||
* @param {string} param0.metadata | ||
* @returns {Promise<FolderMetadata>} | ||
*/ | ||
folderMetadata({ metadata }: { | ||
metadata: string; | ||
}): Promise<FolderMetadata>; | ||
} | ||
export default Decrypt; |
Oops, something went wrong.