Socket
Socket
Sign inDemoInstall

@fleekhq/space-client

Package Overview
Dependencies
Maintainers
6
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fleekhq/space-client - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

5

dist/client.d.ts
import grpcWeb, { ClientReadableStream } from 'grpc-web';
import { SpaceApiClient } from './definitions/SpaceServiceClientPb';
import { OpenFilePayload, CreateBucketPayload, AddItemsPayload, CreateFolderPayload, BackupKeysByPassphrasePayload, RecoverKeysByPassphrasePayload, ToggleFusePayload, GetFuseDriveStatusPayload, ListDirectoriesPayload, ListDirectoryPayload, ToggleBucketBackupPayload, ShareBucketPayload, JoinBucketPayload, ReadNotificationPayload, GetNotificationsPayload, RestoreKeyPairViaMnemonicPayload, GetSharedWithMeFilesPayload, ShareFilesViaPublicKeyPayload, GeneratePublicFileLinkPayload, TestKeysPassphrasePayload, SetNotificationsLastSeenAtPayload, HandleFilesInvitationPayload } from './types';
import { TextileEventResponse, ListDirectoriesResponse, ToggleBucketBackupResponse, OpenFileResponse, CreateBucketResponse, AddItemsResponse, CreateFolderResponse, BackupKeysByPassphraseResponse, RecoverKeysByPassphraseResponse, FuseDriveResponse, FileEventResponse, FileInfoEventResponse, ListBucketsResponse, ListDirectoryResponse, ShareBucketResponse, JoinBucketResponse, GetPublicKeyResponse, NotificationEventResponse, ReadNotificationResponse, GetNotificationsResponse, HandleFilesInvitationResponse, DeleteKeyPairResponse, GetUsageInfoResponse, GetStoredMnemonicResponse, RestoreKeyPairViaMnemonicResponse, GetSharedWithMeFilesResponse, ShareFilesViaPublicKeyResponse, GetAPISessionTokensResponse, GetRecentlySharedWithResponse, GeneratePublicFileLinkResponse, TestKeysPassphraseResponse, SetNotificationsLastSeenAtResponse, GenerateKeyPairResponse } from './definitions/space_pb';
import { OpenFilePayload, CreateBucketPayload, AddItemsPayload, CreateFolderPayload, BackupKeysByPassphrasePayload, RecoverKeysByPassphrasePayload, ToggleFusePayload, GetFuseDriveStatusPayload, ListDirectoriesPayload, ListDirectoryPayload, ToggleBucketBackupPayload, ShareBucketPayload, JoinBucketPayload, ReadNotificationPayload, GetNotificationsPayload, RestoreKeyPairViaMnemonicPayload, GetSharedWithMeFilesPayload, ShareFilesViaPublicKeyPayload, GeneratePublicFileLinkPayload, TestKeysPassphrasePayload, SetNotificationsLastSeenAtPayload, HandleFilesInvitationPayload, OpenPublicFilePayload } from './types';
import { TextileEventResponse, ListDirectoriesResponse, ToggleBucketBackupResponse, OpenFileResponse, CreateBucketResponse, AddItemsResponse, CreateFolderResponse, BackupKeysByPassphraseResponse, RecoverKeysByPassphraseResponse, FuseDriveResponse, FileEventResponse, FileInfoEventResponse, ListBucketsResponse, ListDirectoryResponse, ShareBucketResponse, JoinBucketResponse, GetPublicKeyResponse, NotificationEventResponse, ReadNotificationResponse, GetNotificationsResponse, HandleFilesInvitationResponse, DeleteKeyPairResponse, GetUsageInfoResponse, GetStoredMnemonicResponse, RestoreKeyPairViaMnemonicResponse, GetSharedWithMeFilesResponse, ShareFilesViaPublicKeyResponse, GetAPISessionTokensResponse, GetRecentlySharedWithResponse, GeneratePublicFileLinkResponse, TestKeysPassphraseResponse, SetNotificationsLastSeenAtResponse, GenerateKeyPairResponse, OpenPublicFileResponse } from './definitions/space_pb';
export interface SpaceClientOpts {

@@ -65,3 +65,4 @@ url: string;

generateKeyPairWithForce(metadata?: grpcWeb.Metadata): Promise<GenerateKeyPairResponse>;
openPublicFile(payload: OpenPublicFilePayload, metadata?: grpcWeb.Metadata): Promise<OpenPublicFileResponse>;
}
export default SpaceClient;

@@ -479,4 +479,19 @@ "use strict";

}
openPublicFile(payload, metadata = {}) {
return new Promise((resolve, reject) => {
const request = new space_pb_1.OpenPublicFileRequest();
request.setFilecid(payload.fileCid);
request.setPassword(payload.password);
request.setFilename(payload.filename);
this.instance.openPublicFile(request, metadata, (err, res) => {
if (err) {
reject(err);
return;
}
resolve(res);
});
});
}
}
exports.default = SpaceClient;
//# sourceMappingURL=client.js.map

19

dist/esm/client.js
import { Empty } from 'google-protobuf/google/protobuf/empty_pb';
import { SpaceApiClient } from './definitions/SpaceServiceClientPb';
import { ListDirectoriesRequest, ToggleBucketBackupRequest, OpenFileRequest, CreateBucketRequest, AddItemsRequest, CreateFolderRequest, BackupKeysByPassphraseRequest, RecoverKeysByPassphraseRequest, ToggleFuseRequest, ListBucketsRequest, ListDirectoryRequest, ShareBucketRequest, JoinBucketRequest, ThreadInfo, GetPublicKeyRequest, ReadNotificationRequest, GetNotificationsRequest, HandleFilesInvitationRequest, DeleteKeyPairRequest, DeleteAccountRequest, GetUsageInfoRequest, GetStoredMnemonicRequest, RestoreKeyPairViaMnemonicRequest, GetSharedWithMeFilesRequest, ShareFilesViaPublicKeyRequest, GetAPISessionTokensRequest, GetRecentlySharedWithRequest, GeneratePublicFileLinkRequest, TestKeysPassphraseRequest, SetNotificationsLastSeenAtRequest, GenerateKeyPairRequest, FullPath, } from './definitions/space_pb';
import { ListDirectoriesRequest, ToggleBucketBackupRequest, OpenFileRequest, CreateBucketRequest, AddItemsRequest, CreateFolderRequest, BackupKeysByPassphraseRequest, RecoverKeysByPassphraseRequest, ToggleFuseRequest, ListBucketsRequest, ListDirectoryRequest, ShareBucketRequest, JoinBucketRequest, ThreadInfo, GetPublicKeyRequest, ReadNotificationRequest, GetNotificationsRequest, HandleFilesInvitationRequest, DeleteKeyPairRequest, DeleteAccountRequest, GetUsageInfoRequest, GetStoredMnemonicRequest, RestoreKeyPairViaMnemonicRequest, GetSharedWithMeFilesRequest, ShareFilesViaPublicKeyRequest, GetAPISessionTokensRequest, GetRecentlySharedWithRequest, GeneratePublicFileLinkRequest, TestKeysPassphraseRequest, SetNotificationsLastSeenAtRequest, GenerateKeyPairRequest, FullPath, OpenPublicFileRequest, } from './definitions/space_pb';
var DEFAULT_BUCKET = 'personal';

@@ -543,2 +543,19 @@ var SpaceClient = /** @class */ (function () {

};
SpaceClient.prototype.openPublicFile = function (payload, metadata) {
var _this = this;
if (metadata === void 0) { metadata = {}; }
return new Promise(function (resolve, reject) {
var request = new OpenPublicFileRequest();
request.setFilecid(payload.fileCid);
request.setPassword(payload.password);
request.setFilename(payload.filename);
_this.instance.openPublicFile(request, metadata, function (err, res) {
if (err) {
reject(err);
return;
}
resolve(res);
});
});
};
return SpaceClient;

@@ -545,0 +562,0 @@ }());

@@ -91,1 +91,6 @@ export interface ListDirectoryPayload {

}
export interface OpenPublicFilePayload {
fileCid: string;
password: string;
filename: string;
}
{
"name": "@fleekhq/space-client",
"version": "1.0.3",
"version": "1.1.0",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "module": "dist/esm/index.js",

@@ -1079,2 +1079,37 @@ ![Publish Action Status](https://github.com/FleekHQ/space-client/workflows/Publish/badge.svg?branch=master)

#### .openPublicFile({ fileCid: string, password: string, filename: string })
Open a file from a shared public link.
```js
client
.openPublicFile({
fileCid: 'some-id',
password: 'file-password',
filename: 'some-filename',
})
.then((res) => {
const location = res.getLocation();
console.log(location);
})
.catch((err) => {
console.error(err);
});
/* Or using Async/Await */
const asyncFunc = async () => {
const res = await client.openPublicFile({
fileCid: 'some-id',
fileKey: 'some-password',
filename: 'some-filename',
});
res.getLocation()
...
};
```
## Example

@@ -1081,0 +1116,0 @@ You can check the example included in the `example` folder.

@@ -49,2 +49,3 @@ // We disable the type checking because it interferes with jest's mocking function

generateKeyPairWithForce: jest.fn(),
openPublicFile: jest.fn(),
};

@@ -311,1 +312,11 @@

});
it('openPublicFile makes the right request', async () => {
client.openPublicFile({
fileCid: 'some-cid',
password: 'file-password',
filename: 'some-filename',
});
expect(client.instance.openPublicFile).toHaveBeenCalledTimes(1);
});

@@ -28,2 +28,3 @@ import grpcWeb, { ClientReadableStream } from 'grpc-web';

HandleFilesInvitationPayload,
OpenPublicFilePayload,
} from './types';

@@ -98,2 +99,4 @@

FullPath,
OpenPublicFileRequest,
OpenPublicFileResponse,
} from './definitions/space_pb';

@@ -925,4 +928,29 @@

}
openPublicFile(
payload: OpenPublicFilePayload,
metadata: grpcWeb.Metadata = {},
): Promise<OpenPublicFileResponse> {
return new Promise((resolve, reject) => {
const request = new OpenPublicFileRequest();
request.setFilecid(payload.fileCid);
request.setPassword(payload.password);
request.setFilename(payload.filename);
this.instance.openPublicFile(
request,
metadata,
(err: grpcWeb.Error, res: OpenPublicFileResponse) => {
if (err) {
reject(err);
return;
}
resolve(res);
},
);
});
}
}
export default SpaceClient;

@@ -117,1 +117,7 @@ export interface ListDirectoryPayload {

}
export interface OpenPublicFilePayload {
fileCid: string;
password: string;
filename: string;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc