Skip to content

Commit

Permalink
2.0.0-beta.5
Browse files Browse the repository at this point in the history
  • Loading branch information
raucao committed Nov 21, 2022
1 parent 572495f commit 0aea9b1
Show file tree
Hide file tree
Showing 27 changed files with 299 additions and 139 deletions.
2 changes: 1 addition & 1 deletion doc/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.0.0-beta.4'
__version__ = '2.0.0-beta.5'
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "remotestoragejs",
"description": "JavaScript library for integrating remoteStorage",
"version": "2.0.0-beta.4",
"version": "2.0.0-beta.5",
"private": false,
"license": "MIT",
"main": "./release/remotestorage.js",
Expand Down
10 changes: 6 additions & 4 deletions release/remotestorage.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion release/remotestorage.js.map

Large diffs are not rendered by default.

19 changes: 12 additions & 7 deletions release/types/authorize.d.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import RemoteStorage from './remotestorage';
interface AuthOptions {
authURL: string;
scope?: string;
clientId?: string;
redirectUri?: string;
}
import { AuthorizeOptions } from "./interfaces/authorize_options";
import { Remote } from "./remote";
interface AuthResult {
access_token?: string;
refresh_token?: string;
code?: string;
rsDiscovery?: object;
error?: string;
remotestorage?: string;
state?: string;
}
declare class Authorize {
static IMPLIED_FAKE_TOKEN: boolean;
static authorize(remoteStorage: RemoteStorage, { authURL, scope, redirectUri, clientId }: AuthOptions): void;
/**
* Navigates browser to provider's OAuth page. When user grants access,
* browser will navigate back to redirectUri and OAuth will continue
* with onFeaturesLoaded.
*/
static authorize(remoteStorage: RemoteStorage, options: AuthorizeOptions): void;
/** On success, calls remote.configure() with new access token */
static refreshAccessToken(rs: RemoteStorage, remote: Remote, refreshToken: string): Promise<void>;
/**
* Get current document location
*
Expand Down
2 changes: 1 addition & 1 deletion release/types/authorize.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions release/types/baseclient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ declare class BaseClient {
/**
* Retrieve full URL of a document. Useful for example for sharing the public
* URL of an item in the ``/public`` folder.
* TODO: refactor this into the Remote interface
*
* @param {string} path - Path relative to the module root.
* @returns {string} The full URL of the item, including the storage origin
Expand Down
2 changes: 1 addition & 1 deletion release/types/baseclient.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion release/types/discover.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

129 changes: 88 additions & 41 deletions release/types/dropbox.d.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,71 @@
import EventHandling from './eventhandling';
import RevisionCache from './revisioncache';
import { Remote, RemoteBase, RemoteResponse, RemoteSettings } from "./remote";
import RemoteStorage from "./remotestorage";
interface Metadata {
".tag": "folder" | "file";
id: string;
name: string;
path_display: string;
path_lower: string;
property_groups: any[];
sharing_info: {
no_access?: boolean;
parent_shared_folder_id: string;
read_only: boolean;
traverse_only?: boolean;
modified_by?: string;
};
client_modified?: string;
content_hash?: string;
file_lock_info?: {
created: string;
is_lockholder: boolean;
lockholder_name: string;
};
has_explicit_shared_members?: boolean;
is_downloadable?: boolean;
rev?: string;
server_modified?: string;
size?: number;
preview_url?: string;
}
/**
* @class
*/
declare class Dropbox {
rs: any;
connected: boolean;
online: boolean;
declare class Dropbox extends RemoteBase implements Remote {
clientId: string;
TOKEN_URL: string;
token: string;
refreshToken: string;
tokenType: string;
userAddress: string;
_initialFetchDone: boolean;
_revCache: RevisionCache;
_fetchDeltaCursor: any;
_fetchDeltaPromise: any;
_itemRefs: any;
_fetchDeltaCursor: string;
_fetchDeltaPromise: Promise<undefined[]>;
_itemRefs: {
[key: string]: string;
};
_emit: any;
constructor(rs: any);
/**
* Set the backed to 'dropbox' and start the authentication flow in order
* to obtain an API token from Dropbox.
*/
connect(): void;
connect(): Promise<void>;
/**
* Sets the connected flag
* Accepts its parameters according to the <WireClient>.
* @param {Object} settings
* @param {string} [settings.userAddress] - The user's email address
* @param {string} [settings.token] - Authorization token
* @param {string} [settings.refreshToken] - OAuth2 PKCE refresh token
* @param {string} [settings.tokenType] - usually 'bearer' - no support for 'mac' tokens yet
*
* @protected
**/
configure(settings: any): void;
/**
* Stop waiting for the token and emit not-connected
*
* @protected
*/
stopWaitingForToken(): void;
configure(settings: RemoteSettings): Promise<void>;
/**
* Get all items in a folder.
*
Expand All @@ -50,7 +78,12 @@ declare class Dropbox {
*
* @private
*/
_getFolder(path: any): any;
_getFolder(path: string): Promise<{
statusCode: number;
body: any;
contentType: string;
revision: string;
}>;
/**
* Checks for the path in ``_revCache`` and decides based on that if file
* has changed. Calls ``_getFolder`` is the path points to a folder.
Expand All @@ -64,7 +97,9 @@ declare class Dropbox {
*
* @protected
*/
get(path: any, options: any): any;
get(path: string, options?: {
ifNoneMatch?: string;
}): Promise<RemoteResponse>;
/**
* Checks for the path in ``_revCache`` and decides based on that if file
* has changed.
Expand All @@ -74,14 +109,19 @@ declare class Dropbox {
* Calls ``Dropbox.share`` afterwards to fill ``_itemRefs``.
*
* @param {string} path - path of the folder to put, with leading slash
* @param {XMLHttpRequestBodyInit} body - Blob | BufferSource | FormData | URLSearchParams | string
* @param {string} contentType - MIME type of body
* @param {Object} options
* @param {string} options.ifNoneMatch - Only create of update the file if the
* current ETag doesn't match this string
* @param {string} options.ifNoneMatch - When *, only create or update the file if it doesn't yet exist
* @param {string} options.ifMatch - Only saves if this matches current revision
* @returns {Promise} Resolves with an object containing the status code,
* content-type and revision
* @protected
*/
put(path: any, body: any, contentType: any, options: any): any;
put(path: string, body: any, contentType: string, options?: {
ifMatch?: string;
ifNoneMatch?: string;
}): Promise<RemoteResponse>;
/**
* Checks for the path in ``_revCache`` and decides based on that if file
* has changed.
Expand All @@ -95,13 +135,14 @@ declare class Dropbox {
*
* @protected
*/
'delete'(path: any, options: any): any;
'delete'(path: string, options?: {
ifMatch?: string;
}): Promise<RemoteResponse>;
/**
* Calls share, if the provided path resides in a public folder.
*
* @private
*/
_shareIfNeeded(path: any): void;
_shareIfNeeded(path: string): Promise<any>;
/**
* Gets a publicly-accessible URL for the path from Dropbox and stores it
* in ``_itemRefs``.
Expand All @@ -110,34 +151,37 @@ declare class Dropbox {
*
* @private
*/
share(path: any): any;
share(path: string): Promise<string>;
/**
* Fetches the user's info from dropbox and returns a promise for it.
*
* @return {Promise} a promise for user info object (email - the user's email address)
*
* @protected
*/
info(): any;
info(): Promise<{
email: string;
}>;
/**
* Make a network request.
* Makes a network request.
*
* @param {string} method - Request method
* @param {string} url - Target URL
* @param {object} options - Request options
* @param {number} numAttempts - # of times same request repeated
* @returns {Promise} Resolves with the response of the network request
*
* @private
*/
_request(method: any, url: any, options: any): any;
_request(method: string, url: string, options: any, numAttempts?: number): Promise<any>;
/**
* Fetches the revision of all the files from dropbox API and puts them
* into ``_revCache``. These values can then be used to determine if
* something has changed.
*
* @private
*/
fetchDelta(...args: any[]): any;
fetchDelta(...args: undefined[]): Promise<undefined[]>;
/**
* Gets metadata for a path (can point to either a file or a folder).
*
Expand All @@ -147,24 +191,28 @@ declare class Dropbox {
*
* @private
*/
_getMetadata(path: any): any;
_getMetadata(path: string): Promise<Metadata>;
/**
* Upload a simple file (the size is no more than 150MB).
*
* @param {Object} params
* @param {string} options.ifMatch - Only update the file if its ETag
* @param {string} params.ifMatch - Only update the file if its ETag
* matches this string
* @param {string} options.path - path of the file
* @param {string} options.body - contents of the file to upload
* @param {string} options.contentType - mime type of the file
*
* @param {string} params.path - path of the file
* @param {string} params.body - contents of the file to upload
* @param {string} params.contentType - mime type of the file *
* @return {Promise} A promise for an object with the following structure:
* statusCode - HTTP status code
* revision - revision of the newly-created file, if any
*
* @private
*/
_uploadSimple(params: any): any;
_uploadSimple(params: {
body: XMLHttpRequestBodyInit;
contentType?: string;
path: string;
ifMatch?: string;
}): Promise<RemoteResponse>;
/**
* Deletes a file or a folder.
*
Expand All @@ -175,7 +223,7 @@ declare class Dropbox {
*
* @private
*/
_deleteSimple(path: any): any;
_deleteSimple(path: string): Promise<RemoteResponse>;
/**
* Requests the link for an already-shared file or folder.
*
Expand All @@ -189,15 +237,14 @@ declare class Dropbox {
/**
* Initialize the Dropbox backend.
*
* @param {object} remoteStorage - RemoteStorage instance
* @param {object} rs - RemoteStorage instance
*
* @protected
*/
static _rs_init(rs: any): void;
static _rs_init(rs: RemoteStorage): void;
/**
* Inform about the availability of the Dropbox backend.
*
* @param {object} rs - RemoteStorage instance
* @returns {Boolean}
*
* @protected
Expand All @@ -206,11 +253,11 @@ declare class Dropbox {
/**
* Remove Dropbox as a backend.
*
* @param {object} remoteStorage - RemoteStorage instance
* @param {object} rs - RemoteStorage instance
*
* @protected
*/
static _rs_cleanup(rs: any): void;
static _rs_cleanup(rs: RemoteStorage): void;
}
interface Dropbox extends EventHandling {
}
Expand Down
Loading

0 comments on commit 0aea9b1

Please sign in to comment.