Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@textile/users

Package Overview
Dependencies
Maintainers
5
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@textile/users - npm Package Compare versions

Comparing version 0.1.4 to 0.2.0-alpha.0

9

dist/api/index.d.ts
import { grpc } from '@improbable-eng/grpc-web';
import { GrpcConnection } from '@textile/grpc-connection';
import { ContextInterface } from '@textile/context';
import { ThreadID } from '@textile/threads-id';
/**

@@ -40,6 +41,6 @@ * Global settings for mailboxes

*/
export interface GetThreadReplyObj {
export interface GetThreadResponseObj {
isDB: boolean;
name: string;
id: string;
id: ThreadID;
}

@@ -77,7 +78,7 @@ /**

*/
export declare function listThreads(api: GrpcConnection, ctx?: ContextInterface): Promise<Array<GetThreadReplyObj>>;
export declare function listThreads(api: GrpcConnection, ctx?: ContextInterface): Promise<Array<GetThreadResponseObj>>;
/**
* @internal
*/
export declare function getThread(api: GrpcConnection, name: string, ctx?: ContextInterface): Promise<GetThreadReplyObj>;
export declare function getThread(api: GrpcConnection, name: string, ctx?: ContextInterface): Promise<GetThreadResponseObj>;
/**

@@ -84,0 +85,0 @@ * @internal

@@ -55,4 +55,4 @@ "use strict";

to: input.getTo(),
createdAt: input.getCreatedat(),
readAt: input.getReadat(),
createdAt: input.getCreatedAt(),
readAt: input.getReadAt(),
};

@@ -67,9 +67,9 @@ }

const req = new users_pb_1.ListThreadsRequest();
const res = yield api.unary(users_pb_service_1.API.ListThreads, req, ctx);
const res = yield api.unary(users_pb_service_1.APIService.ListThreads, req, ctx);
return res.getListList().map((value) => {
const thread = value.toObject();
const res = {
isDB: thread.isdb,
isDB: thread.isDb,
name: thread.name,
id: threads_id_1.ThreadID.fromBytes(Buffer.from(thread.id, 'base64')).toString(),
id: threads_id_1.ThreadID.fromBytes(Buffer.from(thread.id, 'base64')),
};

@@ -89,8 +89,8 @@ return res;

req.setName(name);
const res = yield api.unary(users_pb_service_1.API.GetThread, req, ctx);
const res = yield api.unary(users_pb_service_1.APIService.GetThread, req, ctx);
const thread = res.toObject();
return {
isDB: thread.isdb,
isDB: thread.isDb,
name: thread.name,
id: threads_id_1.ThreadID.fromBytes(Buffer.from(thread.id, 'base64')).toString(),
id: threads_id_1.ThreadID.fromBytes(Buffer.from(thread.id, 'base64')),
};

@@ -107,5 +107,5 @@ });

const req = new users_pb_1.SetupMailboxRequest();
const res = yield api.unary(users_pb_service_1.API.SetupMailbox, req, ctx);
const mailboxID = threads_id_1.ThreadID.fromBytes(Buffer.from(res.getMailboxid_asB64(), 'base64')).toString();
return mailboxID;
const res = yield api.unary(users_pb_service_1.APIService.SetupMailbox, req, ctx);
const mailboxID = threads_id_1.ThreadID.fromBytes(Buffer.from(res.getMailboxId_asB64(), 'base64'));
return mailboxID.toString();
});

@@ -121,3 +121,3 @@ }

const thread = yield getThread(api, exports.MailConfig.ThreadName, ctx);
return thread.id;
return thread.id.toString();
});

@@ -134,10 +134,10 @@ }

req.setTo(to);
req.setTobody(toBody);
req.setTosignature(toSignature);
req.setFrombody(fromBody);
req.setFromsignature(fromSignature);
const res = yield api.unary(users_pb_service_1.API.SendMessage, req, ctx);
req.setToBody(toBody);
req.setToSignature(toSignature);
req.setFromBody(fromBody);
req.setFromSignature(fromSignature);
const res = yield api.unary(users_pb_service_1.APIService.SendMessage, req, ctx);
return {
id: res.getId(),
createdAt: res.getCreatedat(),
createdAt: res.getCreatedAt(),
body: fromBody,

@@ -164,5 +164,11 @@ signature: fromSignature,

req.setAscending(opts.ascending);
if (opts && opts.status)
req.setStatus(opts.status);
const res = yield api.unary(users_pb_service_1.API.ListInboxMessages, req, ctx);
if (opts && opts.status) {
switch (opts.status) {
case Status.READ:
req.setStatus(users_pb_1.ListInboxMessagesRequest.Status.STATUS_READ);
case Status.UNREAD:
req.setStatus(users_pb_1.ListInboxMessagesRequest.Status.STATUS_UNREAD);
}
}
const res = yield api.unary(users_pb_service_1.APIService.ListInboxMessages, req, ctx);
return res.getMessagesList().map(convertMessageObj);

@@ -185,3 +191,3 @@ });

req.setAscending(opts.ascending);
const res = yield api.unary(users_pb_service_1.API.ListSentboxMessages, req, ctx);
const res = yield api.unary(users_pb_service_1.APIService.ListSentboxMessages, req, ctx);
return res.getMessagesList().map(convertMessageObj);

@@ -199,4 +205,4 @@ });

req.setId(id);
const res = yield api.unary(users_pb_service_1.API.ReadInboxMessage, req, ctx);
return { readAt: res.toObject().readat };
const res = yield api.unary(users_pb_service_1.APIService.ReadInboxMessage, req, ctx);
return { readAt: res.toObject().readAt };
});

@@ -211,5 +217,5 @@ }

logger.debug('delete inbox message request');
const req = new users_pb_1.DeleteMessageRequest();
const req = new users_pb_1.DeleteInboxMessageRequest();
req.setId(id);
yield api.unary(users_pb_service_1.API.DeleteInboxMessage, req, ctx);
yield api.unary(users_pb_service_1.APIService.DeleteInboxMessage, req, ctx);
return;

@@ -225,5 +231,5 @@ });

logger.debug('delete sentbox message request');
const req = new users_pb_1.DeleteMessageRequest();
const req = new users_pb_1.DeleteSentboxMessageRequest();
req.setId(id);
yield api.unary(users_pb_service_1.API.DeleteSentboxMessage, req, ctx);
yield api.unary(users_pb_service_1.APIService.DeleteSentboxMessage, req, ctx);
return;

@@ -230,0 +236,0 @@ });

export * from './api';
export * from './users';
export { SetupMailboxRequest, SetupMailboxReply, ListThreadsRequest, ListThreadsReply, GetThreadReply, GetThreadRequest, SendMessageRequest, SendMessageReply, ListInboxMessagesRequest, ListMessagesReply, ListSentboxMessagesRequest, ReadInboxMessageRequest, ReadInboxMessageReply, DeleteMessageRequest, DeleteMessageReply, } from '@textile/users-grpc/users_pb';
export { SetupMailboxRequest, SetupMailboxResponse, ListThreadsRequest, ListThreadsResponse, GetThreadResponse, GetThreadRequest, SendMessageRequest, SendMessageResponse, ListInboxMessagesRequest, ListInboxMessagesResponse, ListSentboxMessagesRequest, ListSentboxMessagesResponse, ReadInboxMessageRequest, ReadInboxMessageResponse, DeleteInboxMessageRequest, DeleteInboxMessageResponse, DeleteSentboxMessageRequest, DeleteSentboxMessageResponse, } from '@textile/users-grpc/users_pb';

@@ -18,16 +18,19 @@ "use strict";

Object.defineProperty(exports, "SetupMailboxRequest", { enumerable: true, get: function () { return users_pb_1.SetupMailboxRequest; } });
Object.defineProperty(exports, "SetupMailboxReply", { enumerable: true, get: function () { return users_pb_1.SetupMailboxReply; } });
Object.defineProperty(exports, "SetupMailboxResponse", { enumerable: true, get: function () { return users_pb_1.SetupMailboxResponse; } });
Object.defineProperty(exports, "ListThreadsRequest", { enumerable: true, get: function () { return users_pb_1.ListThreadsRequest; } });
Object.defineProperty(exports, "ListThreadsReply", { enumerable: true, get: function () { return users_pb_1.ListThreadsReply; } });
Object.defineProperty(exports, "GetThreadReply", { enumerable: true, get: function () { return users_pb_1.GetThreadReply; } });
Object.defineProperty(exports, "ListThreadsResponse", { enumerable: true, get: function () { return users_pb_1.ListThreadsResponse; } });
Object.defineProperty(exports, "GetThreadResponse", { enumerable: true, get: function () { return users_pb_1.GetThreadResponse; } });
Object.defineProperty(exports, "GetThreadRequest", { enumerable: true, get: function () { return users_pb_1.GetThreadRequest; } });
Object.defineProperty(exports, "SendMessageRequest", { enumerable: true, get: function () { return users_pb_1.SendMessageRequest; } });
Object.defineProperty(exports, "SendMessageReply", { enumerable: true, get: function () { return users_pb_1.SendMessageReply; } });
Object.defineProperty(exports, "SendMessageResponse", { enumerable: true, get: function () { return users_pb_1.SendMessageResponse; } });
Object.defineProperty(exports, "ListInboxMessagesRequest", { enumerable: true, get: function () { return users_pb_1.ListInboxMessagesRequest; } });
Object.defineProperty(exports, "ListMessagesReply", { enumerable: true, get: function () { return users_pb_1.ListMessagesReply; } });
Object.defineProperty(exports, "ListInboxMessagesResponse", { enumerable: true, get: function () { return users_pb_1.ListInboxMessagesResponse; } });
Object.defineProperty(exports, "ListSentboxMessagesRequest", { enumerable: true, get: function () { return users_pb_1.ListSentboxMessagesRequest; } });
Object.defineProperty(exports, "ListSentboxMessagesResponse", { enumerable: true, get: function () { return users_pb_1.ListSentboxMessagesResponse; } });
Object.defineProperty(exports, "ReadInboxMessageRequest", { enumerable: true, get: function () { return users_pb_1.ReadInboxMessageRequest; } });
Object.defineProperty(exports, "ReadInboxMessageReply", { enumerable: true, get: function () { return users_pb_1.ReadInboxMessageReply; } });
Object.defineProperty(exports, "DeleteMessageRequest", { enumerable: true, get: function () { return users_pb_1.DeleteMessageRequest; } });
Object.defineProperty(exports, "DeleteMessageReply", { enumerable: true, get: function () { return users_pb_1.DeleteMessageReply; } });
Object.defineProperty(exports, "ReadInboxMessageResponse", { enumerable: true, get: function () { return users_pb_1.ReadInboxMessageResponse; } });
Object.defineProperty(exports, "DeleteInboxMessageRequest", { enumerable: true, get: function () { return users_pb_1.DeleteInboxMessageRequest; } });
Object.defineProperty(exports, "DeleteInboxMessageResponse", { enumerable: true, get: function () { return users_pb_1.DeleteInboxMessageResponse; } });
Object.defineProperty(exports, "DeleteSentboxMessageRequest", { enumerable: true, get: function () { return users_pb_1.DeleteSentboxMessageRequest; } });
Object.defineProperty(exports, "DeleteSentboxMessageResponse", { enumerable: true, get: function () { return users_pb_1.DeleteSentboxMessageResponse; } });
//# sourceMappingURL=index.js.map

@@ -6,5 +6,5 @@ import * as pb from '@textile/hub-grpc/hub_pb';

export declare const confirmEmail: (gurl: string, secret: string) => Promise<boolean>;
export declare const createKey: (ctx: ContextInterface, kind: keyof pb.KeyTypeMap) => Promise<pb.GetKeyReply.AsObject>;
export declare const createKey: (ctx: ContextInterface, kind: keyof pb.KeyTypeMap) => Promise<pb.CreateKeyResponse.AsObject>;
export declare const signUp: (ctx: ContextInterface, addrGatewayUrl: string, sessionSecret: string) => Promise<{
user: pb.SignupReply.AsObject | undefined;
user: pb.SignupResponse.AsObject | undefined;
username: string;

@@ -11,0 +11,0 @@ email: string;

@@ -63,3 +63,3 @@ "use strict";

req.setType(pb.KeyType[kind]);
const client = new hub_pb_service_1.APIClient(ctx.host, { transport: grpc_transport_1.WebsocketTransport() });
const client = new hub_pb_service_1.APIServiceClient(ctx.host, { transport: grpc_transport_1.WebsocketTransport() });
ctx.toMetadata().then((meta) => {

@@ -81,3 +81,3 @@ return client.createKey(req, meta, (err, message) => {

req.setUsername(username);
const client = new hub_pb_service_1.APIClient(ctx.host, { transport: grpc_transport_1.WebsocketTransport() });
const client = new hub_pb_service_1.APIServiceClient(ctx.host, { transport: grpc_transport_1.WebsocketTransport() });
ctx.toMetadata().then((meta) => {

@@ -84,0 +84,0 @@ client.signup(req, meta, (err, message) => {

@@ -1,6 +0,6 @@

import { grpc } from "@improbable-eng/grpc-web";
import { GrpcAuthentication } from '@textile/grpc-authentication';
import { grpc } from '@improbable-eng/grpc-web';
import { CopyAuthOptions, GrpcAuthentication, WithKeyInfoOptions, WithUserAuthOptions } from '@textile/grpc-authentication';
import { Identity, Public } from '@textile/crypto';
import { UserAuth, KeyInfo } from '@textile/security';
import { InboxListOptions, SentboxListOptions, GetThreadReplyObj, UserMessage, MailboxEvent } from './api';
import { InboxListOptions, SentboxListOptions, GetThreadResponseObj, UserMessage, MailboxEvent } from './api';
/**

@@ -63,3 +63,3 @@ * Users provides a web-gRPC wrapper client for communicating with the Textile

* Copy an authenticated Users api instance to Buckets.
* ```tyepscript
* ```typescript
* import { Buckets, Users } from '@textile/hub'

@@ -75,3 +75,3 @@ *

* Copy an authenticated Buckets api instance to Users.
* ```tyepscript
* ```typescript
* import { Buckets, Users } from '@textile/hub'

@@ -85,3 +85,3 @@ *

*/
static copyAuth(auth: GrpcAuthentication, debug?: boolean): Users;
static copyAuth(auth: GrpcAuthentication, options?: CopyAuthOptions): Users;
/**

@@ -99,3 +99,3 @@ * {@inheritDoc @textile/hub#GrpcAuthentication.withUserAuth}

*/
static withUserAuth(auth: UserAuth | (() => Promise<UserAuth>), host?: string, debug?: boolean): Users;
static withUserAuth(auth: UserAuth | (() => Promise<UserAuth>), options?: WithUserAuthOptions): Users;
/**

@@ -117,3 +117,3 @@ * {@inheritDoc @textile/hub#GrpcAuthentication.withKeyInfo}

*/
static withKeyInfo(key: KeyInfo, host?: string, debug?: boolean): Promise<Users>;
static withKeyInfo(key: KeyInfo, options?: WithKeyInfoOptions): Promise<Users>;
/**

@@ -181,3 +181,3 @@ * {@inheritDoc @textile/hub#GrpcAuthentication.withThread}

*/
listThreads(): Promise<Array<GetThreadReplyObj>>;
listThreads(): Promise<Array<GetThreadResponseObj>>;
/**

@@ -196,3 +196,3 @@ * Gets a users existing thread by name.

*/
getThread(name: string): Promise<GetThreadReplyObj>;
getThread(name: string): Promise<GetThreadResponseObj>;
/**

@@ -199,0 +199,0 @@ * Setup a user's inbox. This is required for each new user.

@@ -19,3 +19,2 @@ "use strict";

const crypto_1 = require("@textile/crypto");
const context_1 = require("@textile/context");
const api_1 = require("./api");

@@ -80,3 +79,3 @@ const logger = loglevel_1.default.getLogger('users');

* Copy an authenticated Users api instance to Buckets.
* ```tyepscript
* ```typescript
* import { Buckets, Users } from '@textile/hub'

@@ -92,3 +91,3 @@ *

* Copy an authenticated Buckets api instance to Users.
* ```tyepscript
* ```typescript
* import { Buckets, Users } from '@textile/hub'

@@ -102,4 +101,4 @@ *

*/
static copyAuth(auth, debug = false) {
return new Users(auth.context, debug);
static copyAuth(auth, options) {
return new Users(auth.context, options === null || options === void 0 ? void 0 : options.debug);
}

@@ -118,5 +117,5 @@ /**

*/
static withUserAuth(auth, host = context_1.defaultHost, debug = false) {
const res = super.withUserAuth(auth, host, debug);
return this.copyAuth(res, debug);
static withUserAuth(auth, options) {
const res = super.withUserAuth(auth, options);
return this.copyAuth(res, options);
}

@@ -139,3 +138,3 @@ /**

*/
static withKeyInfo(key, host = context_1.defaultHost, debug = false) {
static withKeyInfo(key, options) {
const _super = Object.create(null, {

@@ -145,4 +144,4 @@ withKeyInfo: { get: () => super.withKeyInfo }

return __awaiter(this, void 0, void 0, function* () {
const auth = yield _super.withKeyInfo.call(this, key, host, debug);
return this.copyAuth(auth, debug);
const auth = yield _super.withKeyInfo.call(this, key, options);
return this.copyAuth(auth, options);
});

@@ -149,0 +148,0 @@ }

{
"name": "@textile/users",
"version": "0.1.4",
"version": "0.2.0-alpha.0",
"description": "web-gRPC wrapper client for managing Textile Users.",

@@ -32,23 +32,23 @@ "main": "dist/index",

"dependencies": {
"@improbable-eng/grpc-web": "^0.12.0",
"@textile/buckets-grpc": "^1.0.14",
"@improbable-eng/grpc-web": "^0.13.0",
"@textile/buckets-grpc": "2.0.0-rc5",
"@textile/context": "^0.6.7",
"@textile/crypto": "^0.1.0",
"@textile/grpc-authentication": "^0.1.4",
"@textile/grpc-authentication": "^0.2.0-alpha.0",
"@textile/grpc-connection": "^0.1.2",
"@textile/grpc-transport": "^0.0.3",
"@textile/hub-threads-client": "^0.4.4",
"@textile/hub-threads-client": "^0.5.0-alpha.0",
"@textile/security": "^0.2.6",
"@textile/threads-id": "^0.1.13",
"@textile/users-grpc": "^1.0.14",
"@textile/users-grpc": "2.0.0-rc5",
"@types/next-tick": "^1.0.0",
"cids": "^0.8.0",
"event-iterator": "^2.0.0",
"loglevel": "^1.6.8",
"loglevel": "^1.7.0",
"next-tick": "^1.1.0"
},
"devDependencies": {
"@textile/hub-grpc": "^1.0.14",
"axios": "^0.19.2",
"delay": "^4.3.0",
"@textile/hub-grpc": "2.0.0-rc5",
"axios": "^0.20.0",
"delay": "^4.4.0",
"fast-sha256": "^1.3.0",

@@ -73,3 +73,3 @@ "multibase": "^0.7.0",

],
"gitHead": "5e84b1428117c4fdd2cdfd57249550ce1c03fc87"
"gitHead": "a191c5fe51715865640826ee6ad3c8acb6c631ad"
}

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 not supported yet

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