@textile/context
Advanced tools
Comparing version 0.6.1 to 0.6.2
@@ -49,10 +49,2 @@ import { grpc } from '@improbable-eng/grpc-web'; | ||
/** | ||
* The transport to use for gRPC calls. Defaults to web-sockets. | ||
*/ | ||
transport?: grpc.TransportFactory; | ||
/** | ||
* Whether to enable debugging output during gRPC calls. | ||
*/ | ||
debug?: boolean; | ||
/** | ||
* ContextKeys may also contain any number of additional custom keys. | ||
@@ -73,10 +65,2 @@ */ | ||
/** | ||
* Whether to enable debugging output during gRPC calls. | ||
*/ | ||
debug: boolean; | ||
/** | ||
* The transport to use for gRPC calls. Defaults to web-sockets. | ||
*/ | ||
transport: grpc.TransportFactory; | ||
/** | ||
* Set the session key. Used for various session contexts. | ||
@@ -152,11 +136,7 @@ */ | ||
* @param host The remote gRPC host. This input exists to comply with the Config interface. | ||
* @param debug For testing and debugging purposes. | ||
* @param transport To comply with Config interface. Should be left as websocket transport. | ||
*/ | ||
constructor(host?: HostString, debug?: boolean, transport?: import("@improbable-eng/grpc-web/dist/typings/transports/Transport").TransportFactory); | ||
static fromUserAuth(auth: UserAuth, host?: HostString, debug?: boolean, transport?: grpc.TransportFactory): Context; | ||
static fromUserAuthCallback(authCallback: () => Promise<UserAuth>, host?: HostString, debug?: boolean, transport?: grpc.TransportFactory): Context; | ||
constructor(host?: HostString); | ||
static fromUserAuth(auth: UserAuth, host?: HostString): Context; | ||
static fromUserAuthCallback(authCallback: () => Promise<UserAuth>, host?: HostString): Context; | ||
get host(): any; | ||
get transport(): any; | ||
get debug(): any; | ||
set(key: keyof ContextKeys, value?: any): this; | ||
@@ -206,6 +186,4 @@ get(key: keyof ContextKeys): any; | ||
* @param host Optional host string. | ||
* @param debug Optional debug setting. | ||
* @param transport Optional transport option. | ||
*/ | ||
static fromJSON(json: ContextKeys, host?: HostString, debug?: boolean, transport?: grpc.TransportFactory): Context; | ||
static fromJSON(json: ContextKeys, host?: HostString): Context; | ||
} |
@@ -35,19 +35,15 @@ "use strict"; | ||
* @param host The remote gRPC host. This input exists to comply with the Config interface. | ||
* @param debug For testing and debugging purposes. | ||
* @param transport To comply with Config interface. Should be left as websocket transport. | ||
*/ | ||
constructor(host = exports.defaultHost, debug = false, transport = grpc_web_1.grpc.WebsocketTransport()) { | ||
constructor(host = exports.defaultHost) { | ||
// Internal context variables | ||
this._context = {}; | ||
this._context['host'] = host; | ||
this._context['transport'] = transport; | ||
this._context['debug'] = debug; | ||
} | ||
static fromUserAuth(auth, host = exports.defaultHost, debug = false, transport = grpc_web_1.grpc.WebsocketTransport()) { | ||
const ctx = new Context(host, debug, transport); | ||
static fromUserAuth(auth, host = exports.defaultHost) { | ||
const ctx = new Context(host); | ||
const { key, token } = auth, sig = __rest(auth, ["key", "token"]); | ||
return ctx.withAPIKey(key).withAPISig(sig).withToken(token); | ||
} | ||
static fromUserAuthCallback(authCallback, host = exports.defaultHost, debug = false, transport = grpc_web_1.grpc.WebsocketTransport()) { | ||
const ctx = new Context(host, debug, transport); | ||
static fromUserAuthCallback(authCallback, host = exports.defaultHost) { | ||
const ctx = new Context(host); | ||
// @todo: Should we now callback right away? | ||
@@ -60,8 +56,2 @@ ctx.authCallback = authCallback; | ||
} | ||
get transport() { | ||
return this._context['transport']; | ||
} | ||
get debug() { | ||
return this._context['debug']; | ||
} | ||
set(key, value) { | ||
@@ -171,6 +161,6 @@ this._context[key] = value; | ||
toJSON() { | ||
// Strip out transport | ||
// @todo: Phase out transport out entirely | ||
const _a = this._context, { transport } = _a, json = __rest(_a, ["transport"]); | ||
const json = __rest(this._context | ||
// If we're expired, throw... | ||
, []); | ||
// If we're expired, throw... | ||
if (this.isExpired) { | ||
@@ -203,10 +193,6 @@ throw security_1.expirationError; | ||
* @param host Optional host string. | ||
* @param debug Optional debug setting. | ||
* @param transport Optional transport option. | ||
*/ | ||
static fromJSON(json, host = exports.defaultHost, debug = false, transport = grpc_web_1.grpc.WebsocketTransport()) { | ||
static fromJSON(json, host = exports.defaultHost) { | ||
const newContext = Object.assign({}, json); | ||
newContext['host'] = host; | ||
newContext['transport'] = transport; | ||
newContext['debug'] = debug; | ||
const ctx = new Context(); | ||
@@ -213,0 +199,0 @@ ctx._context = newContext; |
{ | ||
"name": "@textile/context", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"main": "dist/index", | ||
@@ -16,8 +16,5 @@ "types": "dist/index", | ||
"prepublishOnly": "npm run build", | ||
"prepare": "npm run build:node", | ||
"prepare": "npm run build", | ||
"prebuild": "npm run clean", | ||
"build": "npm run build:node && npm run build:browser", | ||
"build:node": "npm run compile", | ||
"build:browser": "webpack --mode production --config ../../webpack.config.js", | ||
"compile": "tsc -b tsconfig.json", | ||
"build": "tsc -b tsconfig.json", | ||
"clean": "rimraf ./dist ./tsconfig.tsbuildinfo", | ||
@@ -41,5 +38,5 @@ "test:browser": "polendina --cleanup --timeout 60 src/**/*.spec.ts --webpack-config ../../webpack.test.js" | ||
"dependencies": { | ||
"@textile/security": "^0.2.1" | ||
"@textile/security": "^0.2.2" | ||
}, | ||
"gitHead": "7493073dfc7a790d0e0f9c5a8e87e738a2251f67" | ||
"gitHead": "6e6a1a1acc861b61bb5318b8b3beec765bd960ac" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
0
31207
2310
6
384
Updated@textile/security@^0.2.2