Comparing version 1.11.0 to 1.11.1
@@ -37,5 +37,3 @@ "use strict"; | ||
try { | ||
/* Deno */ // @ts-ignore | ||
/* Deno */ value = typeof Deno !== 'undefined' ? (Deno.env.get(arg) || '') : ''; | ||
/* Node */ value = (process === null || process === void 0 ? void 0 : process.env[arg]) || ''; | ||
value = (process === null || process === void 0 ? void 0 : process.env[arg]) || ''; | ||
} | ||
@@ -98,3 +96,3 @@ catch (_e) { | ||
constructor(apiKeyOrJwt, ott, options) { | ||
var _a, _b, _c, _d, _f, _g, _h, _j, _k; | ||
var _a, _b, _c, _d, _f, _g, _h, _j; | ||
let _ott = String(ott || '').trim().toLowerCase(); | ||
@@ -122,11 +120,3 @@ const isRawJwt = apiKeyOrJwt.length !== 36; | ||
if (localStorageJwt === null || localStorageJwt === void 0 ? void 0 : localStorageJwt.jwt) { | ||
// @ts-ignore | ||
const decodedJwt = typeof Deno !== 'undefined' | ||
// @ts-ignore | ||
? new TextDecoder().decode(decode((_g = localStorageJwt.jwt.split('.')) === null || _g === void 0 ? void 0 : _g[1])) | ||
: | ||
// @ts-ignore | ||
/* Node */ buffer_1.Buffer.from((_h = localStorageJwt.jwt.split('.')) === null || _h === void 0 ? void 0 : _h[1], 'base64').toString('utf8') + | ||
// @ts-ignore | ||
/* Deno */ ''; | ||
const decodedJwt = buffer_1.Buffer.from((_g = localStorageJwt.jwt.split('.')) === null || _g === void 0 ? void 0 : _g[1], 'base64').toString('utf8'); | ||
const jwtContents = JSON.parse(decodedJwt); | ||
@@ -199,6 +189,6 @@ if (jwtContents === null || jwtContents === void 0 ? void 0 : jwtContents.exp) { | ||
}; | ||
if ((_j = options === null || options === void 0 ? void 0 : options.store) === null || _j === void 0 ? void 0 : _j.get) { | ||
if ((_h = options === null || options === void 0 ? void 0 : options.store) === null || _h === void 0 ? void 0 : _h.get) { | ||
this.store.get = options.store.get; | ||
} | ||
if ((_k = options === null || options === void 0 ? void 0 : options.store) === null || _k === void 0 ? void 0 : _k.set) { | ||
if ((_j = options === null || options === void 0 ? void 0 : options.store) === null || _j === void 0 ? void 0 : _j.set) { | ||
this.store.set = options.store.set; | ||
@@ -205,0 +195,0 @@ } |
@@ -16,2 +16,7 @@ "use strict"; | ||
const log = debug_1.debug('xumm-sdk:xapp:userdata'); | ||
const validateKey = (key) => { | ||
if (!(typeof key === 'string' && key.match(/^[a-z0-9]{3,}$/))) { | ||
throw new Error('Invalid key, only a-z0-9 (min three chars) allowed: ' + key); | ||
} | ||
}; | ||
class JwtUserdata { | ||
@@ -33,2 +38,3 @@ constructor(MetaObject) { | ||
const keys = Array.isArray(key) ? key.join(',') : key; | ||
keys.split(',').forEach(k => validateKey(k)); | ||
const call = yield this.Meta.call('userdata/' + keys, 'GET'); | ||
@@ -41,2 +47,3 @@ utils_1.throwIfError(call); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
validateKey(key); | ||
const call = yield this.Meta.call('userdata/' + key, 'DELETE'); | ||
@@ -49,2 +56,3 @@ utils_1.throwIfError(call); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
validateKey(key); | ||
const call = yield this.Meta.call('userdata/' + key, 'POST', data); | ||
@@ -51,0 +59,0 @@ utils_1.throwIfError(call); |
@@ -148,3 +148,2 @@ "use strict"; | ||
if (!this.isBrowser) { | ||
// TODO: Deno | ||
Object.assign(headers, { | ||
@@ -151,0 +150,0 @@ 'User-Agent': `xumm-sdk/node (${os_browserify_1.hostname()}) node-fetch` |
@@ -18,3 +18,3 @@ "use strict"; | ||
const logWs = debug_1.debug('xumm-sdk:payload:websocket'); | ||
const maxSocketConnectAttempts = 30; | ||
const maxSocketConnectAttempts = typeof jest !== 'undefined' ? 0 : 30; | ||
const socketConnectAttemptSecondsDelay = 2; | ||
@@ -81,3 +81,3 @@ const socketKeepaliveSendSeconds = 2; | ||
if (payloadDetails) { | ||
const _u = 'undefined'; // For globalThis.mockedWebSocket (leave note for Deno gen!) | ||
const _u = 'undefined'; // For Jest tests | ||
let socket; | ||
@@ -172,7 +172,11 @@ let keepAlivePing; | ||
logWs('# Reconnect'); | ||
socket = connect(); | ||
if (typeof jest === 'undefined') { | ||
socket = connect(); | ||
} | ||
}, socketConnectAttemptSecondsDelay * 1000); | ||
} | ||
else { | ||
console.log(`WebSocket for ${payloadDetails.meta.uuid} exceeded reconnect timeouts, give up`); | ||
if (typeof jest === 'undefined') { | ||
console.log(`WebSocket for ${payloadDetails.meta.uuid} exceeded reconnect timeouts, give up`); | ||
} | ||
} | ||
@@ -179,0 +183,0 @@ } |
"use strict"; | ||
// deno-lint-ignore-file camelcase | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
"use strict"; | ||
// deno-lint-ignore-file | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// Type definitions for non-npm package xumm-sdk 0.1 | ||
@@ -8,2 +6,3 @@ // Project: https://xumm.app | ||
// Definitions: https://github.com/XRPL-Labs/XUMM-SDK | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const XummTxTypes = [ | ||
@@ -10,0 +9,0 @@ 'SignIn', |
{ | ||
"name": "xumm-sdk", | ||
"version": "1.11.0", | ||
"version": "1.11.1", | ||
"description": "Interact with the Xumm Developer API", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
@@ -1,2 +0,2 @@ | ||
# XUMM SDK (JS/TS) [![npm version](https://badge.fury.io/js/xumm-sdk.svg)](https://www.npmjs.com/xumm-sdk) [![GitHub Actions NodeJS status](https://github.com/XRPL-Labs/XUMM-SDK/workflows/NodeJS/badge.svg?branch=master)](https://github.com/XRPL-Labs/XUMM-SDK/actions) [![GitHub Actions Deno status](https://github.com/XRPL-Labs/XUMM-SDK/workflows/Deno/badge.svg?branch=master)](https://github.com/XRPL-Labs/XUMM-SDK/actions) | ||
# XUMM SDK (JS/TS) [![npm version](https://badge.fury.io/js/xumm-sdk.svg)](https://www.npmjs.com/xumm-sdk) [![GitHub Actions NodeJS status](https://github.com/XRPL-Labs/XUMM-SDK/workflows/NodeJS/badge.svg?branch=master)](https://github.com/XRPL-Labs/XUMM-SDK/actions) | ||
@@ -30,3 +30,3 @@ Interact with the XUMM SDK from Javascript / Typescript environments. | ||
Get the SDK straight from npm: `npm install xumm-sdk`. The SDK is [also available](https://deno.land/x/xumm) for [Deno](https://deno.land) ([XUMM SDK Deno Readme](https://github.com/XRPL-Labs/XUMM-SDK/blob/master/deno/README.md)). | ||
Get the SDK straight from npm: `npm install xumm-sdk`. | ||
@@ -33,0 +33,0 @@ Initialize the SDK in Javascript (backend use): |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
6293
314850