New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ryuu-client

Package Overview
Dependencies
Maintainers
0
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ryuu-client - npm Package Compare versions

Comparing version 4.3.4-beta.4 to 4.4.0

lib/models/constants/content.d.ts

26

lib/domoapps-client.d.ts
import { AxiosRequestConfig, AxiosResponse } from 'axios';
import HttpsProxyAgent = require('https-proxy-agent');
import { manifest, DesignAggregate, LoginData } from './models';
import { LoginData, Manifest, Design, InstanceAndCards, Environment } from './models';
import { Asset } from './models/interfaces/asset';
export = Domo;
declare class Domo {
private instance;
private server;
private refreshToken;

@@ -18,19 +18,17 @@ private clientId;

deleteDevToken(): void;
createDesign(manifest: manifest): Promise<unknown>;
getDesign(id: string): Promise<DesignAggregate>;
getDesigns(): Promise<unknown>;
getSimpleDesigns(): Promise<unknown>;
createDesign(manifest: Manifest): Promise<Design>;
getDesign(id: string, params: any): Promise<Design>;
getDesigns(params: any): Promise<Design[]>;
createContext(designId: string, mapping: any): Promise<any>;
getEnv(): string;
checkSession(): Promise<void>;
getDomoappsURL(manifest: manifest): Promise<unknown>;
download(designId: string, versionParam: string): Promise<AxiosResponse<AxiosResponse<any, any>, any>>;
getDomoappsData(manifest: Manifest, proxyId?: string): Promise<Environment>;
download(designId: string, version: string): Promise<AxiosResponse<AxiosResponse<any, any>, any>>;
deleteDesign(id: string, force: boolean): Promise<unknown>;
unDeleteDesign(id: string): Promise<unknown>;
addOwners(designId: string, owners: string[]): Promise<unknown>;
removeOwners: (designId: string, owners: string[]) => any;
getOwners(designId: string): Promise<unknown>;
uploadAsset(designId: string, version: string, file: string, contents?: string): Promise<File>;
uploadAllAssets(manifest: manifest): Promise<any[]>;
getAsset(designId: string, version: string, file: string): Promise<unknown>;
removeOwners(designId: string, owners: string[]): Promise<unknown>;
uploadAsset(designId: string, version: string, path: string, contents?: string): Promise<Asset>;
uploadAllAssets(manifest: Manifest): Promise<Asset[]>;
getAsset(designId: string, version: string, path: string): Promise<unknown>;
/**

@@ -42,3 +40,3 @@ * authenticate to a domo instance

getNewAuthorization(): Promise<LoginData>;
createApp(designId: string, domoappId?: string): Promise<unknown>;
createApp(designId: string, proxyId?: string): Promise<InstanceAndCards>;
createAppAndCard(designId: string, domoappId: string, pageId: string, cardTitle: string): Promise<unknown>;

@@ -45,0 +43,0 @@ /**

"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -48,5 +59,5 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

var glob = require("glob");
var FormData = require("form-data");
var open = require("open");
var HttpsProxyAgent = require("https-proxy-agent");
var models_1 = require("./models");
var qs_1 = __importDefault(require("qs"));

@@ -57,20 +68,6 @@ var POLL_INTERVAL = 1000;

function Domo(instanceParam, refreshTokenParam, clientIdParam, proxyParams, devTokenParam) {
this.removeOwners = function (designId, owners) {
var options = {
url: this.server +
'/domoapps/designs/' +
designId +
'/permissions/ADMINISTRATION?users=' +
owners,
method: 'DELETE',
headers: {
Accept: 'application/json',
},
};
return this.processRequest(options);
};
this.instance = instanceParam;
this.server = 'https://' + instanceParam;
this.refreshToken = refreshTokenParam;
this.clientId = clientIdParam;
axios_1.default.defaults.baseURL = 'https://' + instanceParam;
if (this.instance.endsWith('domorig.io'))

@@ -120,3 +117,3 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

var options = {
url: this.server + '/domoapps/designs?path=manifest.json',
url: "".concat(models_1.DESIGNS_BASE_URL, "?path=manifest.json"),
method: 'POST',

@@ -127,5 +124,5 @@ data: manifest,

};
Domo.prototype.getDesign = function (id) {
Domo.prototype.getDesign = function (id, params) {
var options = {
url: this.server + '/domoapps/designs/' + id,
url: "".concat(models_1.DESIGNS_BASE_URL, "/").concat(id),
method: 'GET',

@@ -135,8 +132,10 @@ headers: {

},
params: params,
};
return this.processRequest(options);
};
Domo.prototype.getDesigns = function () {
// TODO: I think this endpoint is returning more designs than it should
Domo.prototype.getDesigns = function (params) {
var options = {
url: this.server + '/domoapps/designs/',
url: "".concat(models_1.DESIGNS_BASE_URL, "/"),
method: 'GET',

@@ -146,18 +145,9 @@ headers: {

},
params: params,
};
return this.processRequest(options);
};
Domo.prototype.getSimpleDesigns = function () {
var options = {
url: this.server + '/domoapps/designs/simple',
method: 'GET',
headers: {
Accept: 'application/json',
},
};
return this.processRequest(options);
};
Domo.prototype.createContext = function (designId, mapping) {
var options = {
url: this.server + '/domoapps/apps/v2/contexts',
url: '/domoapps/apps/v2/contexts',
method: 'POST',

@@ -192,48 +182,24 @@ data: { designId: designId, mapping: mapping },

};
Domo.prototype.getDomoappsURL = function (manifest) {
return __awaiter(this, void 0, void 0, function () {
var uuid, _a, options;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
if (!manifest['proxyId']) return [3 /*break*/, 1];
_a = manifest.proxyId;
return [3 /*break*/, 3];
case 1: return [4 /*yield*/, this.createApp(manifest.id).then(function (test) {
//@ts-ignore
return test.instance.id;
})];
case 2:
_a = _b.sent();
_b.label = 3;
case 3:
uuid = _a;
options = {
url: this.server + '/api/content/v1/mobile/environment',
};
return [2 /*return*/, this.processRequest(options)
.then(function (res) {
var data = res;
//@ts-ignore
data.url = "https://".concat(uuid, ".").concat(data.domoappsDomain);
return data;
})
.catch(function () {
// This catch is for running on rigs in which the domoappsDomain wouldn't be accessible/correct
var data = { url: "https://".concat(uuid, ".domoapps.").concat(this.getEnv()) };
return data;
})];
}
});
Domo.prototype.getDomoappsData = function (manifest, proxyId) {
var _this_1 = this;
var uuid = proxyId !== null && proxyId !== void 0 ? proxyId : this.createApp(manifest.id).then(function (test) {
return test.instance.id;
});
var options = {
url: '/api/content/v1/mobile/environment',
};
return this.processRequest(options)
.then(function (res) {
return __assign(__assign({}, res), { url: "https://".concat(uuid, ".").concat(res.domoappsDomain) });
})
.catch(function () {
// This catch is for running on rigs in which the domoappsDomain wouldn't be accessible/correct
return {
url: "https://".concat(uuid, ".domoapps.").concat(_this_1.getEnv()),
};
});
};
Domo.prototype.download = function (designId, versionParam) {
var version = versionParam || 'latest';
Domo.prototype.download = function (designId, version) {
var options = {
url: this.server +
'/domoapps/designs/' +
designId +
'/versions/' +
version +
'/assets',
url: "".concat(models_1.DESIGNS_BASE_URL, "/").concat(designId, "/versions/").concat(version, "/assets"),
method: 'GET',

@@ -243,6 +209,5 @@ responseType: 'stream',

};
return getAuthHeader(this.clientId, this.refreshToken, this.server, this.devToken, this.agent).then(function (headers) {
return getAuthHeader(this.clientId, this.refreshToken, this.devToken, this.agent).then(function (headers) {
//@ts-ignore
options.headers = headers;
//@ts-ignore
return (0, axios_1.default)(options);

@@ -253,3 +218,3 @@ });

var options = {
url: this.server + '/domoapps/designs/' + id + '?force=' + force,
url: "".concat(models_1.DESIGNS_BASE_URL, "/").concat(id, "?force=").concat(force),
method: 'DELETE',

@@ -264,3 +229,3 @@ headers: {

var options = {
url: this.server + '/domoapps/designs/' + id + '/undelete',
url: "".concat(models_1.DESIGNS_BASE_URL, "/").concat(id, "/undelete"),
method: 'PUT',

@@ -275,8 +240,5 @@ headers: {

var options = {
url: this.server +
'/domoapps/designs/' +
designId +
'/permissions/ADMINISTRATION',
url: "".concat(models_1.DESIGNS_BASE_URL, "/").concat(designId, "/permissions/ADMIN"),
method: 'POST',
data: [owners],
data: owners,
headers: {

@@ -286,32 +248,34 @@ Accept: 'application/json',

},
params: {
format: 'email',
},
};
return this.processRequest(options);
};
Domo.prototype.getOwners = function (designId) {
Domo.prototype.removeOwners = function (designId, owners) {
var options = {
url: this.server +
'/domoapps/designs/' +
designId +
'/permissions/ADMINISTRATION',
method: 'GET',
url: "".concat(models_1.DESIGNS_BASE_URL, "/").concat(designId, "/permissions/ADMIN?users=").concat(owners),
method: 'DELETE',
headers: {
Accept: 'application/json',
},
params: {
format: 'email',
},
};
return this.processRequest(options);
};
Domo.prototype.uploadAsset = function (designId, version, file, contents) {
if (file.indexOf(' ') !== -1) {
return new Promise(function (resolve, reject) {
reject('Spaces in file names not allowed. Please rename ' + file);
});
}
var form = new FormData();
contents = contents || fs.createReadStream(file);
form.append('file', contents);
Domo.prototype.uploadAsset = function (designId, version, path, contents) {
var _a, _b;
if (path.indexOf(' ') !== -1)
return Promise.reject('Spaces in file names not allowed. Please rename ' + path);
contents = contents || fs.readFileSync(path);
var extension = (_b = (_a = (path.match(/\.(\w+)$/) || [])) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : '';
var options = {
url: "".concat(this.server, "/domoapps/designs/").concat(designId, "/versions/").concat(version, "/assets?path=").concat(file),
url: "".concat(models_1.DESIGNS_BASE_URL, "/").concat(designId, "/versions/").concat(version, "/assets?path=").concat(path),
method: 'POST',
data: form,
headers: form.getHeaders(),
data: contents,
headers: extension in models_1.CONTENT_TYPE_MAP
? { 'Content-Type': models_1.CONTENT_TYPE_MAP[extension] }
: {},
maxBodyLength: Infinity,

@@ -329,13 +293,7 @@ maxContentLength: Infinity,

var _this = this;
var ignore = ['**/*/node_modules/**/*', 'node_modules/**/*'];
var userIgnore = manifest.ignore;
if (userIgnore) {
if (userIgnore instanceof Array) {
ignore = ignore.concat(userIgnore);
}
else {
return Promise.reject('The manifest.json "ignore" property must be an Array');
}
}
var manifestUpload = _this.uploadAsset(manifest.id, manifest.version, 'manifest.json', JSON.stringify(manifest));
var defaultIgnore = ['**/*/node_modules/**/*', 'node_modules/**/*'];
var combinedIgnore = manifest.ignore
? defaultIgnore.concat(manifest.ignore)
: defaultIgnore;
var manifestUpload = this.uploadAsset(manifest.id, manifest.version, 'manifest.json', JSON.stringify(manifest));
var chunkArray = function (array, chunkSize) {

@@ -353,5 +311,3 @@ var results = [];

case 0:
rest = glob
.sync('**/*', { ignore: ignore })
.filter(function (file) {
rest = glob.sync('**/*', { ignore: combinedIgnore }).filter(function (file) {
return !fs.lstatSync(file).isDirectory() && file !== 'manifest.json';

@@ -372,3 +328,3 @@ });

case 1:
// CATCH THE ERROR HERE
// Catch the file size error here?
return [2 /*return*/, _a.sent()];

@@ -391,11 +347,5 @@ }

};
Domo.prototype.getAsset = function (designId, version, file) {
Domo.prototype.getAsset = function (designId, version, path) {
var options = {
url: this.server +
'/domoapps/designs/' +
designId +
'/versions/' +
version +
'/assets/' +
file,
url: "".concat(models_1.DESIGNS_BASE_URL, "/\n ").concat(designId, "\n /versions/\n ").concat(version, "\n /assets"),
method: 'GET',

@@ -405,2 +355,3 @@ headers: {

},
params: { path: path },
};

@@ -437,5 +388,5 @@ return this.processRequest(options);

//@ts-ignore
return getAuthToken(this.server, this.clientId, scope, this.agent).then(function (resp) {
return getAuthToken(this.clientId, scope, this.agent).then(function (resp) {
getAuthorizationPrompt(resp);
return poll(getRefreshToken, POLL_TIMEOUT, POLL_INTERVAL, _self.clientId, resp['device_code'], _self.server, _self.agent).then(function (data) {
return poll(getRefreshToken, POLL_TIMEOUT, POLL_INTERVAL, _self.clientId, resp['device_code'], _self.agent).then(function (data) {
_self.refreshToken = data['refresh_token'];

@@ -447,9 +398,9 @@ return _self.getLoginUser();

// createApp currently is only used to provide proxyIds when one isn't already in the manifest
Domo.prototype.createApp = function (designId, domoappId) {
Domo.prototype.createApp = function (designId, proxyId) {
var options = {
url: this.server + '/api/apps/v1/instances',
url: '/api/apps/v1/instances',
method: 'POST',
data: {
designId: designId,
id: domoappId ? domoappId : null,
id: proxyId ? proxyId : null,
},

@@ -470,7 +421,3 @@ params: { temporary: true },

var options = {
url: this.server +
'/domoapps/apps?pageId=' +
pageId +
'&cardTitle=' +
cardTitle,
url: '/domoapps/apps?pageId=' + pageId + '&cardTitle=' + cardTitle,
method: 'POST',

@@ -489,3 +436,3 @@ data: qs_1.default.stringify(data),

var options = {
url: this.server + '/domoapps/designs/' + designId + '/versions',
url: "".concat(models_1.DESIGNS_BASE_URL, "/").concat(designId, "/versions"),
method: 'GET',

@@ -501,8 +448,5 @@ };

var options = {
url: this.server + '/domoapps/designs/' + designId + '/release',
method: 'POST',
url: "".concat(models_1.DESIGNS_BASE_URL, "/").concat(designId, "/versions/").concat(version, "/release"),
method: 'PUT',
};
if (version) {
options.url += '?version=' + version;
}
return this.processRequest(options);

@@ -512,3 +456,3 @@ };

var options = {
url: this.server + '/api/content/v2/users/me',
url: '/api/content/v2/users/me',
method: 'GET',

@@ -522,3 +466,3 @@ };

//const test = this.test;
return getAuthHeader(this.clientId, this.refreshToken, this.server, this.devToken, this.agent)
return getAuthHeader(this.clientId, this.refreshToken, this.devToken, this.agent)
.then(function (headers) {

@@ -548,3 +492,3 @@ if (options.headers) {

//const test = this.test;
return getAuthHeader(this.clientId, this.refreshToken, this.server, this.devToken, this.agent)
return getAuthHeader(this.clientId, this.refreshToken, this.devToken, this.agent)
.then(function (headers) {

@@ -608,5 +552,5 @@ if (options.headers) {

}
function getAuthToken(server, clientId, scope, agent) {
function getAuthToken(clientId, scope, agent) {
var options = {
url: server + '/api/oauth2/device_authorization',
url: '/api/oauth2/device_authorization',
method: 'POST',

@@ -618,2 +562,3 @@ data: qs_1.default.stringify({

};
console.log(options);
if (agent)

@@ -627,5 +572,5 @@ options.httpsAgent = agent;

}
function getRefreshToken(clientId, deviceToken, server, agent) {
function getRefreshToken(clientId, deviceToken, agent) {
var options = {
url: server + '/api/oauth2/token',
url: '/api/oauth2/token',
method: 'POST',

@@ -642,5 +587,5 @@ data: qs_1.default.stringify({

}
function getAccessToken(clientId, refreshToken, server, agent) {
function getAccessToken(clientId, refreshToken, agent) {
var options = {
url: server + '/api/oauth2/token',
url: '/api/oauth2/token',
method: 'POST',

@@ -660,5 +605,5 @@ data: qs_1.default.stringify({

}
function getSID(server, accessToken, agent) {
function getSID(accessToken, agent) {
var options = {
url: server + '/api/oauth2/sid',
url: '/api/oauth2/sid',
method: 'GET',

@@ -672,7 +617,7 @@ headers: {

}
function poll(fn, timeout, interval, clientId, token, server, agent) {
function poll(fn, timeout, interval, clientId, token, agent) {
var endTime = Number(new Date()) + (timeout || 2000);
interval = interval || 100;
var checkCondition = function (resolve, reject) {
var p = fn(clientId, token, server, agent);
var p = fn(clientId, token, agent);
console.log('Waiting for browser authentication...');

@@ -692,9 +637,9 @@ p.then(function (resp) {

}
function getAuthHeader(clientId, refreshToken, server, devToken, agent) {
function getAuthHeader(clientId, refreshToken, devToken, agent) {
if (devToken) {
return getDevTokenHeader(refreshToken);
}
return getAccessToken(clientId, refreshToken, server, agent)
return getAccessToken(clientId, refreshToken, agent)
.then(function (resp) {
return getSIDHeader(server, resp['access_token'], agent);
return getSIDHeader(resp['access_token'], agent);
})

@@ -705,4 +650,4 @@ .catch(function (err) {

}
function getSIDHeader(server, accessToken, agent) {
return getSID(server, accessToken, agent).then(function (resp) {
function getSIDHeader(accessToken, agent) {
return getSID(accessToken, agent).then(function (resp) {
var headers = { 'X-Domo-Authentication': resp.sid };

@@ -709,0 +654,0 @@ return headers;

@@ -1,4 +0,20 @@

export { DomoResponse, DomoRequestError, DevToken, DomoSIDHeader, } from './interfaces/domo-response';
export { LoginData } from './interfaces/login-data';
export { manifest, DataPoint } from './interfaces/manifest';
export { DesignAggregate, DesignVersion } from './interfaces/domoappstypes';
export * from './constants/endpoints';
export * from './constants/content';
export * from './enums/collection';
export * from './enums/filter';
export * from './enums/package';
export * from './interfaces/asset';
export * from './interfaces/card';
export * from './interfaces/collection';
export * from './interfaces/context';
export * from './interfaces/dataset';
export * from './interfaces/design';
export * from './interfaces/environment';
export * from './interfaces/filter';
export * from './interfaces/instance';
export * from './interfaces/manifest';
export * from './interfaces/package';
export * from './interfaces/user';
export * from './interfaces/workflow';
export * from './interfaces/domo-response';
export * from './interfaces/login-data';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./constants/endpoints"), exports);
__exportStar(require("./constants/content"), exports);
__exportStar(require("./enums/collection"), exports);
__exportStar(require("./enums/filter"), exports);
__exportStar(require("./enums/package"), exports);
__exportStar(require("./interfaces/asset"), exports);
__exportStar(require("./interfaces/card"), exports);
__exportStar(require("./interfaces/collection"), exports);
__exportStar(require("./interfaces/context"), exports);
__exportStar(require("./interfaces/dataset"), exports);
__exportStar(require("./interfaces/design"), exports);
__exportStar(require("./interfaces/environment"), exports);
__exportStar(require("./interfaces/filter"), exports);
__exportStar(require("./interfaces/instance"), exports);
__exportStar(require("./interfaces/manifest"), exports);
__exportStar(require("./interfaces/package"), exports);
__exportStar(require("./interfaces/user"), exports);
__exportStar(require("./interfaces/workflow"), exports);
__exportStar(require("./interfaces/domo-response"), exports);
__exportStar(require("./interfaces/login-data"), exports);
//# sourceMappingURL=index.js.map

@@ -1,26 +0,26 @@

export interface manifest {
id: string;
import { Collection } from './collection';
import { DataPoint } from './dataset';
import { DesignSize } from './design';
import { FunctionPackage } from './package';
import { Workflow } from './workflow';
export interface Manifest {
id?: string;
name: string;
fileName: string;
mapping: DataPoint[];
description?: string;
version: string;
oAuthEnabled: boolean;
cardId: string;
appContextId: string;
proxyId: string;
scopes: any;
draft: boolean;
publicAssetsEnabled: boolean;
flags: Map<string, boolean>;
scopes?: string[];
mapping?: DataPoint[];
datasetsMapping?: DataPoint[];
collections?: Collection[];
collectionsMapping?: Collection[];
workflowsMapping?: Workflow[];
packagesMapping?: FunctionPackage[];
size?: DesignSize;
fullpage: boolean;
ignore: any;
contextId: any;
size: any;
fileName?: string;
ignore?: string[];
proxyId?: string;
}
export interface DataPoint {
dataSetId: string;
alias: string;
fields: Fields[];
}
interface Fields {
alias: string;
columnName: string;
}
export {};
{
"name": "ryuu-client",
"version": "4.3.4-beta.4",
"version": "4.4.0",
"description": "Node client for ryuu services",

@@ -5,0 +5,0 @@ "author": "Domo",

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