openscript
Advanced tools
+17
-4
| { | ||
| "name": "openscript", | ||
| "version": "1.0.0-alpha.4", | ||
| "version": "1.0.0-dev.1", | ||
| "description": "a package manager for linux-scripts", | ||
@@ -33,19 +33,29 @@ "author": "Alexandros Fotiadis <fotiadis90@gmail.com>", | ||
| "scripts": { | ||
| "codegen": "cd src/ && apollo client:codegen --localSchemaFile ../../../backend/services/graphql/schema/definitions.gql --target typescript codegen --queries 'graphql/*'", | ||
| "codegen": "cd src/ && apollo client:codegen --no-addTypename --localSchemaFile ../../../backend/services/graphql/schema/definitions.gql --target typescript codegen --queries 'graphql/*'", | ||
| "build": "tsc && npm run copy-graphql", | ||
| "copy-graphql": "cd src/ && copyfiles '**/*.graphql' '../dist/'", | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| "test": "echo \"Warning: no test specified\" && exit 0" | ||
| }, | ||
| "dependencies": { | ||
| "@types/blessed": "^0.1.10", | ||
| "@types/colors": "^1.2.1", | ||
| "@types/getos": "^3.0.0", | ||
| "@types/table": "^4.0.5", | ||
| "apollo-boost": "^0.1.22", | ||
| "apollo-client": "^2.4.7", | ||
| "blessed": "^0.1.81", | ||
| "bluebird": "^3.5.3", | ||
| "colors": "^1.3.3", | ||
| "commander": "^2.19.0", | ||
| "getos": "^3.1.1", | ||
| "graphql": "^14.0.2", | ||
| "jsonwebtoken": "^8.4.0", | ||
| "md5": "^2.2.1", | ||
| "mqtt": "^2.18.8", | ||
| "node-fetch": "^2.3.0", | ||
| "node-pty": "^0.7.8", | ||
| "promptly": "^3.0.3", | ||
| "prompts": "^2.0.4", | ||
| "semver": "^5.6.0", | ||
| "table": "^5.2.3", | ||
| "underscore.string": "^3.3.5", | ||
| "yaml": "^1.0.3" | ||
@@ -57,6 +67,9 @@ }, | ||
| "@types/jsonwebtoken": "^8.3.0", | ||
| "@types/md5": "^2.1.33", | ||
| "@types/node": "8", | ||
| "@types/node-fetch": "^2.1.4", | ||
| "@types/promptly": "^1.1.28", | ||
| "@types/prompts": "^1.2.0", | ||
| "@types/semver": "^5.5.0", | ||
| "@types/underscore.string": "^0.0.36", | ||
| "@types/yaml": "^1.0.1", | ||
@@ -63,0 +76,0 @@ "apollo": "^2.1.3", |
| export declare enum ScriptPlatformOS { | ||
| linux = "linux" | ||
| } | ||
| export declare enum UserAccessStatus { | ||
| ADMIN_NO_SRP_AUTH = "ADMIN_NO_SRP_AUTH", | ||
| CUSTOM_CHALLENGE = "CUSTOM_CHALLENGE", | ||
| DEVICE_PASSWORD_VERIFIER = "DEVICE_PASSWORD_VERIFIER", | ||
| DEVICE_SRP_AUTH = "DEVICE_SRP_AUTH", | ||
| LOGGED_IN = "LOGGED_IN", | ||
| MFA_SETUP = "MFA_SETUP", | ||
| NEW_PASSWORD_REQUIRED = "NEW_PASSWORD_REQUIRED", | ||
| PASSWORD_VERIFIER = "PASSWORD_VERIFIER", | ||
| SELECT_MFA_TYPE = "SELECT_MFA_TYPE", | ||
| SMS_MFA = "SMS_MFA", | ||
| SOFTWARE_TOKEN_MFA = "SOFTWARE_TOKEN_MFA" | ||
| } | ||
| export declare enum UserDeliveryMedium { | ||
| EMAIL = "EMAIL", | ||
| SMS = "SMS" | ||
| } | ||
| export interface PackageQueryInput { | ||
| name: string; | ||
| namespace?: string | null; | ||
| } | ||
| export interface PublishMutationInput { | ||
| name: string; | ||
| namespace?: string | null; | ||
| description?: string | null; | ||
| version: string; | ||
| platform?: (ScriptPlatformInput | null)[] | null; | ||
| execute: (string | null)[]; | ||
| superuser?: boolean | null; | ||
| accessToken: string; | ||
| } | ||
| export interface ScriptPlatformInput { | ||
| os: ScriptPlatformOS; | ||
| dist: string; | ||
| codename: string; | ||
| } | ||
| export interface ScriptQueryInput { | ||
| name: string; | ||
| namespace?: string | null; | ||
| version: string; | ||
| } | ||
| export interface SubscriptionQueryInput { | ||
| accessToken: string; | ||
| } | ||
| export interface UserAccessTokenQueryInput { | ||
| username: string; | ||
| password: string; | ||
| } | ||
| export interface UserConfirmSignUpInput { | ||
| username: string; | ||
| confirmationCode: string; | ||
| } | ||
| export interface UserRefreshAccessTokenInput { | ||
| refreshToken: string; | ||
| } | ||
| export interface UserSetNewPasswordInput { | ||
| username: string; | ||
| password: string; | ||
| session: string; | ||
| } | ||
| export interface UserSignUpMutationInput { | ||
| username: string; | ||
| password: string; | ||
| } |
| "use strict"; | ||
| /* tslint:disable */ | ||
| // This file was automatically generated and should not be edited. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //============================================================== | ||
| // START Enums and Input Objects | ||
| //============================================================== | ||
| var ScriptPlatformOS; | ||
| (function (ScriptPlatformOS) { | ||
| ScriptPlatformOS["linux"] = "linux"; | ||
| })(ScriptPlatformOS = exports.ScriptPlatformOS || (exports.ScriptPlatformOS = {})); | ||
| var UserAccessStatus; | ||
| (function (UserAccessStatus) { | ||
| UserAccessStatus["ADMIN_NO_SRP_AUTH"] = "ADMIN_NO_SRP_AUTH"; | ||
| UserAccessStatus["CUSTOM_CHALLENGE"] = "CUSTOM_CHALLENGE"; | ||
| UserAccessStatus["DEVICE_PASSWORD_VERIFIER"] = "DEVICE_PASSWORD_VERIFIER"; | ||
| UserAccessStatus["DEVICE_SRP_AUTH"] = "DEVICE_SRP_AUTH"; | ||
| UserAccessStatus["LOGGED_IN"] = "LOGGED_IN"; | ||
| UserAccessStatus["MFA_SETUP"] = "MFA_SETUP"; | ||
| UserAccessStatus["NEW_PASSWORD_REQUIRED"] = "NEW_PASSWORD_REQUIRED"; | ||
| UserAccessStatus["PASSWORD_VERIFIER"] = "PASSWORD_VERIFIER"; | ||
| UserAccessStatus["SELECT_MFA_TYPE"] = "SELECT_MFA_TYPE"; | ||
| UserAccessStatus["SMS_MFA"] = "SMS_MFA"; | ||
| UserAccessStatus["SOFTWARE_TOKEN_MFA"] = "SOFTWARE_TOKEN_MFA"; | ||
| })(UserAccessStatus = exports.UserAccessStatus || (exports.UserAccessStatus = {})); | ||
| var UserDeliveryMedium; | ||
| (function (UserDeliveryMedium) { | ||
| UserDeliveryMedium["EMAIL"] = "EMAIL"; | ||
| UserDeliveryMedium["SMS"] = "SMS"; | ||
| })(UserDeliveryMedium = exports.UserDeliveryMedium || (exports.UserDeliveryMedium = {})); | ||
| //============================================================== | ||
| // END Enums and Input Objects | ||
| //============================================================== | ||
| //# sourceMappingURL=globalTypes.js.map |
| {"version":3,"file":"globalTypes.js","sourceRoot":"","sources":["../../src/codegen/globalTypes.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,kEAAkE;;AAElE,gEAAgE;AAChE,gCAAgC;AAChC,gEAAgE;AAEhE,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;AACjB,CAAC,EAFW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAE3B;AAED,IAAY,gBAYX;AAZD,WAAY,gBAAgB;IAC1B,2DAAuC,CAAA;IACvC,yDAAqC,CAAA;IACrC,yEAAqD,CAAA;IACrD,uDAAmC,CAAA;IACnC,2CAAuB,CAAA;IACvB,2CAAuB,CAAA;IACvB,mEAA+C,CAAA;IAC/C,2DAAuC,CAAA;IACvC,uDAAmC,CAAA;IACnC,uCAAmB,CAAA;IACnB,6DAAyC,CAAA;AAC3C,CAAC,EAZW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAY3B;AAED,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,qCAAe,CAAA;IACf,iCAAW,CAAA;AACb,CAAC,EAHW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAG7B;AA2DD,gEAAgE;AAChE,8BAA8B;AAC9B,gEAAgE"} |
| import { prompt, password, confirm, choose } from "promptly"; | ||
| import { CommanderStatic, Command } from "commander"; | ||
| import { SessionConfig } from "./SessionConfig"; | ||
| import { SubscriptionClient } from "../vendors/notification"; | ||
| export declare abstract class AbstractCommand { | ||
| protected program: CommanderStatic; | ||
| session: SessionConfig; | ||
| constructor(program: CommanderStatic); | ||
| abstract init(): Command; | ||
| abstract handler(): Promise<void>; | ||
| protected log(message: string, data?: object): void; | ||
| protected getAccessToken(): Promise<string>; | ||
| protected subscribe(): Promise<SubscriptionClient>; | ||
| readonly input: { | ||
| prompt: typeof prompt; | ||
| password: typeof password; | ||
| confirm: typeof confirm; | ||
| choose: typeof choose; | ||
| }; | ||
| } |
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const promptly_1 = require("promptly"); | ||
| const SessionConfig_1 = require("./SessionConfig"); | ||
| const notification_1 = require("../vendors/notification"); | ||
| const graphql_1 = require("../graphql"); | ||
| const jwt = require("jsonwebtoken"); | ||
| const HOME_CONFIG_FILE = ".openscript.json"; | ||
| class AbstractCommand { | ||
| constructor(program) { | ||
| this.program = program; | ||
| this.session = new SessionConfig_1.SessionConfig(HOME_CONFIG_FILE); | ||
| } | ||
| log(message, data) { | ||
| console.log(`LOG: ${message}`); | ||
| if (data) { | ||
| console.log(JSON.stringify(data, null, 4)); | ||
| } | ||
| } | ||
| getAccessToken() { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const { accessToken, refreshToken } = this.session.get(); | ||
| if (!accessToken || !refreshToken) { | ||
| throw new Error("No user session data stored."); | ||
| } | ||
| const res = jwt.decode(accessToken, { json: true }); | ||
| const now = Math.round(new Date().getTime() / 1000); | ||
| if (now > res.exp) { | ||
| const { userRefreshAccessToken: { accessToken } } = yield graphql_1.refreshAccessToken({ | ||
| input: { refreshToken } | ||
| }); | ||
| this.session.update({ | ||
| accessToken | ||
| }); | ||
| return accessToken; | ||
| } | ||
| else { | ||
| return accessToken; | ||
| } | ||
| }); | ||
| } | ||
| subscribe() { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const accessToken = yield this.getAccessToken(); | ||
| let endpoint; | ||
| let topic; | ||
| const { sub } = this.session.get(); | ||
| const now = Math.round(new Date().getTime() / 1000); | ||
| if (!sub || | ||
| !sub.endpoint || | ||
| !sub.expiration || | ||
| !sub.topic || | ||
| now > sub.expiration || | ||
| true // @todo: Re-using the subscription token doesn't work as expected. | ||
| ) { | ||
| this.log("Update subscription token..."); | ||
| const { subscription: sub } = yield graphql_1.subscription({ | ||
| input: { accessToken } | ||
| }); | ||
| endpoint = sub.endpoint; | ||
| topic = sub.topic; | ||
| this.session.update({ sub }); | ||
| } | ||
| else { | ||
| endpoint = sub.endpoint; | ||
| topic = sub.topic; | ||
| } | ||
| const client = new notification_1.SubscriptionClient({ | ||
| endpoint, | ||
| topic | ||
| }); | ||
| yield client.connect(); | ||
| yield client.subscribe(); | ||
| return client; | ||
| }); | ||
| } | ||
| get input() { | ||
| return { | ||
| prompt: promptly_1.prompt, | ||
| password: promptly_1.password, | ||
| confirm: promptly_1.confirm, | ||
| choose: promptly_1.choose | ||
| }; | ||
| } | ||
| } | ||
| exports.AbstractCommand = AbstractCommand; | ||
| //# sourceMappingURL=AbstractCommand.js.map |
| {"version":3,"file":"AbstractCommand.js","sourceRoot":"","sources":["../../src/commands/AbstractCommand.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,uCAA6D;AAE7D,mDAAgD;AAChD,0DAA6D;AAC7D,wCAA8D;AAC9D,oCAAoC;AAEpC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAE5C,MAAsB,eAAe;IAGjC,YAAsB,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;QAC1C,IAAI,CAAC,OAAO,GAAG,IAAI,6BAAa,CAAC,gBAAgB,CAAC,CAAC;IACvD,CAAC;IAMS,GAAG,CAAC,OAAe,EAAE,IAAa;QACxC,OAAO,CAAC,GAAG,CAAC,QAAQ,OAAO,EAAE,CAAC,CAAC;QAC/B,IAAI,IAAI,EAAE;YACN,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;SAC9C;IACL,CAAC;IAEe,cAAc;;YAC1B,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;YAEzD,IAAI,CAAC,WAAW,IAAI,CAAC,YAAY,EAAE;gBAC/B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;aACnD;YAED,MAAM,GAAG,GAAoB,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YAErE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;YAEpD,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,EAAE;gBACf,MAAM,EACF,sBAAsB,EAAE,EAAE,WAAW,EAAE,EAC1C,GAAG,MAAM,4BAAkB,CAAC;oBACzB,KAAK,EAAE,EAAE,YAAY,EAAE;iBAC1B,CAAC,CAAC;gBACH,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;oBAChB,WAAW;iBACd,CAAC,CAAC;gBACH,OAAO,WAAW,CAAC;aACtB;iBAAM;gBACH,OAAO,WAAW,CAAC;aACtB;QACL,CAAC;KAAA;IAEe,SAAS;;YACrB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAEhD,IAAI,QAAgB,CAAC;YACrB,IAAI,KAAa,CAAC;YAElB,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;YACnC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;YAEpD,IACI,CAAC,GAAG;gBACJ,CAAC,GAAG,CAAC,QAAQ;gBACb,CAAC,GAAG,CAAC,UAAU;gBACf,CAAC,GAAG,CAAC,KAAK;gBACV,GAAG,GAAG,GAAG,CAAC,UAAU;gBACpB,IAAI,CAAC,mEAAmE;cAC1E;gBACE,IAAI,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;gBACzC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,MAAM,sBAAY,CAAC;oBAC7C,KAAK,EAAE,EAAE,WAAW,EAAE;iBACzB,CAAC,CAAC;gBACH,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;gBACxB,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;gBAClB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;aAChC;iBAAM;gBACH,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;gBACxB,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;aACrB;YAED,MAAM,MAAM,GAAG,IAAI,iCAAkB,CAAC;gBAClC,QAAQ;gBACR,KAAK;aACR,CAAC,CAAC;YAEH,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;YACvB,MAAM,MAAM,CAAC,SAAS,EAAE,CAAC;YAEzB,OAAO,MAAM,CAAC;QAClB,CAAC;KAAA;IAED,IAAI,KAAK;QACL,OAAO;YACH,MAAM,EAAN,iBAAM;YACN,QAAQ,EAAR,mBAAQ;YACR,OAAO,EAAP,kBAAO;YACP,MAAM,EAAN,iBAAM;SACT,CAAC;IACN,CAAC;CACJ;AA5FD,0CA4FC"} |
| import { AbstractCommand } from "./AbstractCommand"; | ||
| import { Command } from "commander"; | ||
| export declare class ExecuteCommand extends AbstractCommand { | ||
| init(): Command; | ||
| handler(...args: any[]): Promise<void>; | ||
| private getRemotePackage; | ||
| } |
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const AbstractCommand_1 = require("./AbstractCommand"); | ||
| const helpers_1 = require("./helpers"); | ||
| const runner_1 = require("../vendors/runner"); | ||
| const graphql_1 = require("../graphql"); | ||
| const semver = require("semver"); | ||
| class ExecuteCommand extends AbstractCommand_1.AbstractCommand { | ||
| init() { | ||
| return this.program.command("execute [target]"); | ||
| } | ||
| handler(...args) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const [target] = args; | ||
| let pkg; | ||
| try { | ||
| pkg = helpers_1.readLocalPackageScript(target); | ||
| } | ||
| catch (err) { | ||
| // pass to remote execution. | ||
| pkg = yield this.getRemotePackage(target); | ||
| } | ||
| const script = new runner_1.Script(pkg); | ||
| const confirmMessage = `Execution ${script.getName()} requires superuser permission, would you like to proceed ?`; | ||
| if (script.requiresSuperUser()) { | ||
| const confirmed = yield this.input.confirm(confirmMessage); | ||
| if (confirmed === false) { | ||
| this.log("Execution cancelled."); | ||
| return Promise.resolve(); | ||
| } | ||
| } | ||
| const runner = new runner_1.LinuxRunner(script); | ||
| const res = yield runner.execute(); | ||
| if (res.exitCode !== 0) { | ||
| throw new Error(`Execution failed with exist-code: ${res.exitCode}.`); | ||
| } | ||
| else { | ||
| this.log("Execution was successful."); | ||
| } | ||
| }); | ||
| } | ||
| getRemotePackage(target) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| let name; | ||
| let namespace; | ||
| if (target.indexOf("/") !== -1) { | ||
| const [targetNamespace, targetName] = target.split("/"); | ||
| name = targetName; | ||
| namespace = targetNamespace; | ||
| } | ||
| else { | ||
| name = target; | ||
| namespace = undefined; | ||
| } | ||
| const response = yield graphql_1.getPackage({ | ||
| input: { name, namespace } | ||
| }); | ||
| const versions = response.package.scriptMetadata.map(({ version }) => version); | ||
| const [latest] = semver.rsort(versions); | ||
| this.log(`Execute latest version: ${latest}`); | ||
| const { script } = yield graphql_1.getScript({ | ||
| input: { name, namespace, version: latest.toString() } | ||
| }); | ||
| return { | ||
| name, | ||
| version: script.version, | ||
| execute: script.execute, | ||
| superuser: script.superuser, | ||
| platform: script.platform, | ||
| }; | ||
| }); | ||
| } | ||
| } | ||
| exports.ExecuteCommand = ExecuteCommand; | ||
| //# sourceMappingURL=ExecuteCommand.js.map |
| {"version":3,"file":"ExecuteCommand.js","sourceRoot":"","sources":["../../src/commands/ExecuteCommand.ts"],"names":[],"mappings":"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"} |
| import { IScriptOptions } from "../vendors/runner"; | ||
| export declare function readLocalPackageScript(target?: string): IScriptOptions; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const yaml = require("yaml"); | ||
| const path_1 = require("path"); | ||
| const fs_1 = require("fs"); | ||
| const PACKAGE_SCRIPT_FILE_NAME = "openscript.yml"; | ||
| function readLocalPackageScript(target) { | ||
| let cwd = process.cwd(); | ||
| if (target && typeof target === "string") { | ||
| cwd = path_1.resolve(path_1.join(cwd, target)); | ||
| } | ||
| let content = null; | ||
| if (!fs_1.existsSync(cwd)) { | ||
| throw new Error(`Failed to read ${PACKAGE_SCRIPT_FILE_NAME} file!`); | ||
| } | ||
| else if (fs_1.statSync(cwd).isDirectory()) { | ||
| content = fs_1.readFileSync(path_1.join(cwd, PACKAGE_SCRIPT_FILE_NAME)); | ||
| } | ||
| else { | ||
| content = fs_1.readFileSync(cwd); | ||
| } | ||
| // @todo: Validate package schema | ||
| return yaml.parse(content.toString()); | ||
| } | ||
| exports.readLocalPackageScript = readLocalPackageScript; | ||
| //# sourceMappingURL=helpers.js.map |
| {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/commands/helpers.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAC7B,+BAAqC;AACrC,2BAAwD;AAGxD,MAAM,wBAAwB,GAAG,gBAAgB,CAAC;AAElD,SAAgB,sBAAsB,CAAC,MAAe;IAClD,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAExB,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QACtC,GAAG,GAAG,cAAO,CAAC,WAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;KACpC;IAED,IAAI,OAAO,GAAW,IAAI,CAAC;IAC3B,IAAI,CAAC,eAAU,CAAC,GAAG,CAAC,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,kBAAkB,wBAAwB,QAAQ,CAAC,CAAC;KACvE;SAAM,IAAI,aAAQ,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE;QACpC,OAAO,GAAG,iBAAY,CAAC,WAAI,CAAC,GAAG,EAAE,wBAAwB,CAAC,CAAC,CAAC;KAC/D;SAAM;QACH,OAAO,GAAG,iBAAY,CAAC,GAAG,CAAC,CAAC;KAC/B;IAED,iCAAiC;IAEjC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAmB,CAAC;AAC5D,CAAC;AAnBD,wDAmBC"} |
| import { StatusCommand } from "./StatusCommand"; | ||
| declare const _default: (typeof StatusCommand)[]; | ||
| export default _default; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const LoginCommand_1 = require("./LoginCommand"); | ||
| const StatusCommand_1 = require("./StatusCommand"); | ||
| const SignUpCommand_1 = require("./SignUpCommand"); | ||
| const PublishCommand_1 = require("./PublishCommand"); | ||
| const ExecuteCommand_1 = require("./ExecuteCommand"); | ||
| exports.default = [ | ||
| LoginCommand_1.LoginCommand, | ||
| StatusCommand_1.StatusCommand, | ||
| SignUpCommand_1.SignUpCommand, | ||
| PublishCommand_1.PublishCommand, | ||
| ExecuteCommand_1.ExecuteCommand | ||
| ]; | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":";;AAAA,iDAA8C;AAC9C,mDAAgD;AAChD,mDAAgD;AAChD,qDAAkD;AAClD,qDAAkD;AAElD,kBAAe;IACX,2BAAY;IACZ,6BAAa;IACb,6BAAa;IACb,+BAAc;IACd,+BAAc;CACjB,CAAC"} |
| import { AbstractCommand } from "./AbstractCommand"; | ||
| import { Command } from "commander"; | ||
| export declare class LoginCommand extends AbstractCommand { | ||
| init(): Command; | ||
| handler(...args: any[]): Promise<void>; | ||
| private setNewPassword; | ||
| } |
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const AbstractCommand_1 = require("./AbstractCommand"); | ||
| const graphql_1 = require("../graphql"); | ||
| const globalTypes_1 = require("../codegen/globalTypes"); | ||
| class LoginCommand extends AbstractCommand_1.AbstractCommand { | ||
| init() { | ||
| return this.program.command("login").description("User login"); | ||
| } | ||
| handler(...args) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const username = yield this.input.prompt("Username (E-Mail): "); | ||
| const password = yield this.input.password("Password: "); | ||
| let { userAccessToken: { status, accessToken, session, refreshToken } } = yield graphql_1.getUserAccessToken({ | ||
| input: { | ||
| username, | ||
| password | ||
| } | ||
| }); | ||
| if (status === globalTypes_1.UserAccessStatus.NEW_PASSWORD_REQUIRED) { | ||
| accessToken = yield this.setNewPassword(username, session); | ||
| } | ||
| else if (status !== globalTypes_1.UserAccessStatus.LOGGED_IN) { | ||
| throw new Error("Unhandled user access status: " + status); | ||
| } | ||
| this.session.update({ | ||
| accessToken, | ||
| refreshToken | ||
| }); | ||
| this.log("Successfully logged in."); | ||
| }); | ||
| } | ||
| setNewPassword(username, session) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const password = yield this.input.password("Set new password: "); | ||
| const { userNewPassword: { accessToken, status } } = yield graphql_1.setUserNewPassword({ | ||
| input: { username, password, session } | ||
| }); | ||
| if (status === globalTypes_1.UserAccessStatus.LOGGED_IN) { | ||
| return accessToken; | ||
| } | ||
| else { | ||
| throw new Error("Unhandled user access status: " + status); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| exports.LoginCommand = LoginCommand; | ||
| //# sourceMappingURL=LoginCommand.js.map |
| {"version":3,"file":"LoginCommand.js","sourceRoot":"","sources":["../../src/commands/LoginCommand.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,uDAAoD;AACpD,wCAAoE;AACpE,wDAA0D;AAG1D,MAAa,YAAa,SAAQ,iCAAe;IAC7C,IAAI;QACA,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IACnE,CAAC;IAEK,OAAO,CAAC,GAAG,IAAI;;YACjB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;YAChE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YAEzD,IAAI,EACA,eAAe,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,EAClE,GAAG,MAAM,4BAAkB,CAAC;gBACzB,KAAK,EAAE;oBACH,QAAQ;oBACR,QAAQ;iBACX;aACJ,CAAC,CAAC;YAEH,IAAI,MAAM,KAAK,8BAAgB,CAAC,qBAAqB,EAAE;gBACnD,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;aAC9D;iBAAM,IAAI,MAAM,KAAK,8BAAgB,CAAC,SAAS,EAAE;gBAC9C,MAAM,IAAI,KAAK,CAAC,gCAAgC,GAAG,MAAM,CAAC,CAAC;aAC9D;YAED,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;gBAChB,WAAW;gBACX,YAAY;aACf,CAAC,CAAC;YAEH,IAAI,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;QACxC,CAAC;KAAA;IAEa,cAAc,CAAC,QAAgB,EAAE,OAAe;;YAC1D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;YACjE,MAAM,EACF,eAAe,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,EAC3C,GAAG,MAAM,4BAAkB,CAAC;gBACzB,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE;aACzC,CAAC,CAAC;YAEH,IAAI,MAAM,KAAK,8BAAgB,CAAC,SAAS,EAAE;gBACvC,OAAO,WAAW,CAAC;aACtB;iBAAM;gBACH,MAAM,IAAI,KAAK,CAAC,gCAAgC,GAAG,MAAM,CAAC,CAAC;aAC9D;QACL,CAAC;KAAA;CACJ;AA9CD,oCA8CC"} |
| import { AbstractCommand } from "./AbstractCommand"; | ||
| import { Command } from "commander"; | ||
| export declare class PublishCommand extends AbstractCommand { | ||
| init(): Command; | ||
| handler(...args: any[]): Promise<void>; | ||
| } |
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const AbstractCommand_1 = require("./AbstractCommand"); | ||
| const helpers_1 = require("./helpers"); | ||
| const graphql_1 = require("../graphql"); | ||
| class PublishCommand extends AbstractCommand_1.AbstractCommand { | ||
| init() { | ||
| return this.program.command("publish [target]"); | ||
| } | ||
| handler(...args) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const accessToken = yield this.getAccessToken(); | ||
| const { name, version, description, execute, superuser, platform = [] } = helpers_1.readLocalPackageScript(args[0]); | ||
| const client = yield this.subscribe(); | ||
| // @todo: validate package schema | ||
| const query = graphql_1.publish({ | ||
| input: { | ||
| accessToken, | ||
| name, | ||
| description, | ||
| version, | ||
| execute, | ||
| superuser, | ||
| platform, | ||
| } | ||
| }); | ||
| const listener = client.readResults("publish"); | ||
| const [result] = yield Promise.all([listener, query]); | ||
| yield client.close(); | ||
| if (result) { | ||
| this.log(`Script ${name}@${version} successfully published.`); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| exports.PublishCommand = PublishCommand; | ||
| //# sourceMappingURL=PublishCommand.js.map |
| {"version":3,"file":"PublishCommand.js","sourceRoot":"","sources":["../../src/commands/PublishCommand.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,uDAAoD;AAEpD,uCAAmD;AACnD,wCAAqC;AAErC,MAAa,cAAe,SAAQ,iCAAe;IAC/C,IAAI;QACA,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACpD,CAAC;IAEK,OAAO,CAAC,GAAG,IAAI;;YACjB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAEhD,MAAM,EACF,IAAI,EACJ,OAAO,EACP,WAAW,EACX,OAAO,EACP,SAAS,EACT,QAAQ,GAAG,EAAE,EAChB,GAAG,gCAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAEpC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;YAEtC,iCAAiC;YAEjC,MAAM,KAAK,GAAG,iBAAO,CAAC;gBAClB,KAAK,EAAE;oBACH,WAAW;oBACX,IAAI;oBACJ,WAAW;oBACX,OAAO;oBACP,OAAO;oBACP,SAAS;oBACT,QAAQ;iBACX;aACJ,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YAE/C,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;YAEtD,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;YAErB,IAAI,MAAM,EAAE;gBACR,IAAI,CAAC,GAAG,CAAC,UAAU,IAAI,IAAI,OAAO,0BAA0B,CAAC,CAAC;aACjE;QACL,CAAC;KAAA;CACJ;AA3CD,wCA2CC"} |
| interface IConfiguration { | ||
| accessToken?: string; | ||
| refreshToken?: string; | ||
| sub?: { | ||
| expiration?: number; | ||
| endpoint?: string; | ||
| topic?: string; | ||
| }; | ||
| } | ||
| export declare class SessionConfig { | ||
| private filename; | ||
| constructor(filename: string); | ||
| protected getConfigFilepath(): string; | ||
| protected readConfigObject(): IConfiguration; | ||
| protected saveConfigObject(configs: IConfiguration): void; | ||
| get(): IConfiguration; | ||
| update(update: IConfiguration): void; | ||
| } | ||
| export {}; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const fs_1 = require("fs"); | ||
| const path_1 = require("path"); | ||
| const os_1 = require("os"); | ||
| class SessionConfig { | ||
| constructor(filename) { | ||
| this.filename = filename; | ||
| } | ||
| getConfigFilepath() { | ||
| return path_1.resolve(path_1.join(os_1.homedir(), this.filename)); | ||
| } | ||
| readConfigObject() { | ||
| const filepath = this.getConfigFilepath(); | ||
| if (!fs_1.existsSync(filepath)) { | ||
| return {}; | ||
| } | ||
| if (!fs_1.statSync(filepath).isFile()) { | ||
| throw new Error(`${filepath} is not a file.`); | ||
| } | ||
| const content = fs_1.readFileSync(this.getConfigFilepath()).toString(); | ||
| try { | ||
| return JSON.parse(content); | ||
| } | ||
| catch ({ message }) { | ||
| throw new Error(`Invalid config file format: ${message}`); | ||
| } | ||
| } | ||
| saveConfigObject(configs) { | ||
| const filepath = this.getConfigFilepath(); | ||
| if (fs_1.existsSync(filepath)) { | ||
| fs_1.unlinkSync(filepath); | ||
| } | ||
| const content = JSON.stringify(configs, null, 4); | ||
| fs_1.writeFileSync(filepath, content); | ||
| } | ||
| get() { | ||
| return this.readConfigObject(); | ||
| } | ||
| update(update) { | ||
| const configs = this.readConfigObject(); | ||
| const newConfigs = Object.assign({}, configs, update); | ||
| this.saveConfigObject(newConfigs); | ||
| } | ||
| } | ||
| exports.SessionConfig = SessionConfig; | ||
| //# sourceMappingURL=SessionConfig.js.map |
| {"version":3,"file":"SessionConfig.js","sourceRoot":"","sources":["../../src/commands/SessionConfig.ts"],"names":[],"mappings":";;AAAA,2BAMY;AACZ,+BAAqC;AACrC,2BAA6B;AAY7B,MAAa,aAAa;IACtB,YAAoB,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;IAAG,CAAC;IAE9B,iBAAiB;QACvB,OAAO,cAAO,CAAC,WAAI,CAAC,YAAO,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACnD,CAAC;IAES,gBAAgB;QACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAE1C,IAAI,CAAC,eAAU,CAAC,QAAQ,CAAC,EAAE;YACvB,OAAO,EAAoB,CAAC;SAC/B;QAED,IAAI,CAAC,aAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9B,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,iBAAiB,CAAC,CAAC;SACjD;QACD,MAAM,OAAO,GAAG,iBAAY,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;QAClE,IAAI;YACA,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SAC9B;QAAC,OAAO,EAAE,OAAO,EAAE,EAAE;YAClB,MAAM,IAAI,KAAK,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAC;SAC7D;IACL,CAAC;IAES,gBAAgB,CAAC,OAAuB;QAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAE1C,IAAI,eAAU,CAAC,QAAQ,CAAC,EAAE;YACtB,eAAU,CAAC,QAAQ,CAAC,CAAC;SACxB;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACjD,kBAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,GAAG;QACC,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,MAAsB;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;CACJ;AA7CD,sCA6CC"} |
| import { AbstractCommand } from "./AbstractCommand"; | ||
| import { Command } from "commander"; | ||
| export declare class SignUpCommand extends AbstractCommand { | ||
| init(): Command; | ||
| handler(...args: any[]): Promise<void>; | ||
| } |
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const AbstractCommand_1 = require("./AbstractCommand"); | ||
| const graphql_1 = require("../graphql"); | ||
| const globalTypes_1 = require("../codegen/globalTypes"); | ||
| class SignUpCommand extends AbstractCommand_1.AbstractCommand { | ||
| init() { | ||
| return this.program | ||
| .command("signup") | ||
| .description("Create a new account."); | ||
| } | ||
| handler(...args) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const username = yield this.input.prompt("Username (E-Mail): "); | ||
| const password = yield this.input.password("Password: "); | ||
| const { userSignUp: { deliveryMedium, userConfirmed } } = yield graphql_1.userSignUp({ input: { username, password } }); | ||
| if (userConfirmed === true) { | ||
| this.log("Account created successfully."); | ||
| } | ||
| else if (userConfirmed === false && | ||
| deliveryMedium === globalTypes_1.UserDeliveryMedium.EMAIL) { | ||
| this.log(`A confirmation code has been sent to ${username}.`); | ||
| const confirmationCode = yield this.input.prompt("Enter verification code: "); | ||
| yield graphql_1.userConfirmSignUp({ | ||
| input: { username, confirmationCode } | ||
| }); | ||
| this.log("Account confirmed."); | ||
| } | ||
| else { | ||
| throw new Error("Unhandled signup status."); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| exports.SignUpCommand = SignUpCommand; | ||
| //# sourceMappingURL=SignUpCommand.js.map |
| {"version":3,"file":"SignUpCommand.js","sourceRoot":"","sources":["../../src/commands/SignUpCommand.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,uDAAoD;AACpD,wCAA2D;AAC3D,wDAA4D;AAG5D,MAAa,aAAc,SAAQ,iCAAe;IAC9C,IAAI;QACA,OAAO,IAAI,CAAC,OAAO;aACd,OAAO,CAAC,QAAQ,CAAC;aACjB,WAAW,CAAC,uBAAuB,CAAC,CAAC;IAC9C,CAAC;IAEK,OAAO,CAAC,GAAG,IAAI;;YACjB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;YAChE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YAEzD,MAAM,EACF,UAAU,EAAE,EAAE,cAAc,EAAE,aAAa,EAAE,EAChD,GAAG,MAAM,oBAAU,CAAC,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;YAExD,IAAI,aAAa,KAAK,IAAI,EAAE;gBACxB,IAAI,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;aAC7C;iBAAM,IACH,aAAa,KAAK,KAAK;gBACvB,cAAc,KAAK,gCAAkB,CAAC,KAAK,EAC7C;gBACE,IAAI,CAAC,GAAG,CAAC,wCAAwC,QAAQ,GAAG,CAAC,CAAC;gBAC9D,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAC5C,2BAA2B,CAC9B,CAAC;gBACF,MAAM,2BAAiB,CAAC;oBACpB,KAAK,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE;iBACxC,CAAC,CAAC;gBAEH,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;aAClC;iBAAM;gBACH,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;aAC/C;QACL,CAAC;KAAA;CACJ;AAlCD,sCAkCC"} |
| import { AbstractCommand } from "./AbstractCommand"; | ||
| import { Command } from "commander"; | ||
| export declare class StatusCommand extends AbstractCommand { | ||
| init(): Command; | ||
| handler(...args: any[]): Promise<void>; | ||
| } |
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const AbstractCommand_1 = require("./AbstractCommand"); | ||
| class StatusCommand extends AbstractCommand_1.AbstractCommand { | ||
| init() { | ||
| return this.program.command("status"); | ||
| } | ||
| handler(...args) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const { accessToken } = this.session.get(); | ||
| if (accessToken) { | ||
| this.log("Logged in with the accessToken: ", { accessToken }); | ||
| } | ||
| else { | ||
| this.log("No access session."); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| exports.StatusCommand = StatusCommand; | ||
| //# sourceMappingURL=StatusCommand.js.map |
| {"version":3,"file":"StatusCommand.js","sourceRoot":"","sources":["../../src/commands/StatusCommand.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,uDAAoD;AAGpD,MAAa,aAAc,SAAQ,iCAAe;IAC9C,IAAI;QACA,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAEK,OAAO,CAAC,GAAG,IAAI;;YACjB,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;YAE3C,IAAI,WAAW,EAAE;gBACb,IAAI,CAAC,GAAG,CAAC,kCAAkC,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;aACjE;iBAAM;gBACH,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;aAClC;QACL,CAAC;KAAA;CACJ;AAdD,sCAcC"} |
| declare const _default: { | ||
| endpoint: string; | ||
| }; | ||
| export default _default; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.default = { endpoint: "https://api-env-production.openscript.run/graphql" }; | ||
| //# sourceMappingURL=config.js.map |
| {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;AAAA,kBAAe,EAAE,QAAQ,EAAE,mDAAmD,EAAE,CAAC"} |
| import { PackageQueryInput, ScriptPlatformOS } from "./../../codegen/globalTypes"; | ||
| export interface getPackage_package_scriptMetadata_platform { | ||
| __typename: "ScriptPlatform"; | ||
| os: ScriptPlatformOS; | ||
| dist: string; | ||
| codename: string; | ||
| } | ||
| export interface getPackage_package_scriptMetadata { | ||
| __typename: "ScriptMetadata"; | ||
| version: string; | ||
| platform: (getPackage_package_scriptMetadata_platform | null)[] | null; | ||
| } | ||
| export interface getPackage_package { | ||
| __typename: "Package"; | ||
| name: string; | ||
| description: string | null; | ||
| scriptMetadata: (getPackage_package_scriptMetadata | null)[]; | ||
| } | ||
| export interface getPackage { | ||
| package: getPackage_package | null; | ||
| } | ||
| export interface getPackageVariables { | ||
| input: PackageQueryInput; | ||
| } |
| "use strict"; | ||
| /* tslint:disable */ | ||
| // This file was automatically generated and should not be edited. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //# sourceMappingURL=getPackage.js.map |
| {"version":3,"file":"getPackage.js","sourceRoot":"","sources":["../../../src/graphql/codegen/getPackage.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,kEAAkE"} |
| import { ScriptQueryInput, ScriptPlatformOS } from "./../../codegen/globalTypes"; | ||
| export interface getScript_script_platform { | ||
| __typename: "ScriptPlatform"; | ||
| os: ScriptPlatformOS; | ||
| dist: string; | ||
| codename: string; | ||
| } | ||
| export interface getScript_script { | ||
| __typename: "Script"; | ||
| version: string; | ||
| execute: (string | null)[]; | ||
| superuser: boolean; | ||
| platform: (getScript_script_platform | null)[] | null; | ||
| } | ||
| export interface getScript { | ||
| script: getScript_script | null; | ||
| } | ||
| export interface getScriptVariables { | ||
| input: ScriptQueryInput; | ||
| } |
| "use strict"; | ||
| /* tslint:disable */ | ||
| // This file was automatically generated and should not be edited. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //# sourceMappingURL=getScript.js.map |
| {"version":3,"file":"getScript.js","sourceRoot":"","sources":["../../../src/graphql/codegen/getScript.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,kEAAkE"} |
| import { UserAccessTokenQueryInput, UserAccessStatus } from "./../../codegen/globalTypes"; | ||
| export interface getUserAccessToken_userAccessToken { | ||
| __typename: "UserAccessResponse"; | ||
| accessToken: string | null; | ||
| session: string | null; | ||
| status: UserAccessStatus; | ||
| refreshToken: string | null; | ||
| } | ||
| export interface getUserAccessToken { | ||
| userAccessToken: getUserAccessToken_userAccessToken | null; | ||
| } | ||
| export interface getUserAccessTokenVariables { | ||
| input: UserAccessTokenQueryInput; | ||
| } |
| "use strict"; | ||
| /* tslint:disable */ | ||
| // This file was automatically generated and should not be edited. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //# sourceMappingURL=getUserAccessToken.js.map |
| {"version":3,"file":"getUserAccessToken.js","sourceRoot":"","sources":["../../../src/graphql/codegen/getUserAccessToken.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,kEAAkE"} |
| import { PublishMutationInput } from "./../../codegen/globalTypes"; | ||
| export interface publish { | ||
| publish: boolean; | ||
| } | ||
| export interface publishVariables { | ||
| input: PublishMutationInput; | ||
| } |
| "use strict"; | ||
| /* tslint:disable */ | ||
| // This file was automatically generated and should not be edited. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //# sourceMappingURL=publish.js.map |
| {"version":3,"file":"publish.js","sourceRoot":"","sources":["../../../src/graphql/codegen/publish.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,kEAAkE"} |
| import { UserRefreshAccessTokenInput, UserAccessStatus } from "./../../codegen/globalTypes"; | ||
| export interface refreshAccessToken_userRefreshAccessToken { | ||
| __typename: "UserAccessResponse"; | ||
| status: UserAccessStatus; | ||
| session: string | null; | ||
| accessToken: string | null; | ||
| refreshToken: string | null; | ||
| } | ||
| export interface refreshAccessToken { | ||
| userRefreshAccessToken: refreshAccessToken_userRefreshAccessToken | null; | ||
| } | ||
| export interface refreshAccessTokenVariables { | ||
| input: UserRefreshAccessTokenInput; | ||
| } |
| "use strict"; | ||
| /* tslint:disable */ | ||
| // This file was automatically generated and should not be edited. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //# sourceMappingURL=refreshAccessToken.js.map |
| {"version":3,"file":"refreshAccessToken.js","sourceRoot":"","sources":["../../../src/graphql/codegen/refreshAccessToken.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,kEAAkE"} |
| import { UserSetNewPasswordInput, UserAccessStatus } from "./../../codegen/globalTypes"; | ||
| export interface setUserPassword_userNewPassword { | ||
| __typename: "UserAccessResponse"; | ||
| status: UserAccessStatus; | ||
| accessToken: string | null; | ||
| } | ||
| export interface setUserPassword { | ||
| userNewPassword: setUserPassword_userNewPassword | null; | ||
| } | ||
| export interface setUserPasswordVariables { | ||
| input: UserSetNewPasswordInput; | ||
| } |
| "use strict"; | ||
| /* tslint:disable */ | ||
| // This file was automatically generated and should not be edited. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //# sourceMappingURL=setUserPassword.js.map |
| {"version":3,"file":"setUserPassword.js","sourceRoot":"","sources":["../../../src/graphql/codegen/setUserPassword.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,kEAAkE"} |
| import { SubscriptionQueryInput } from "./../../codegen/globalTypes"; | ||
| export interface subscription_subscription { | ||
| __typename: "Subscription"; | ||
| topic: string; | ||
| endpoint: string; | ||
| expiration: number; | ||
| } | ||
| export interface subscription { | ||
| subscription: subscription_subscription | null; | ||
| } | ||
| export interface subscriptionVariables { | ||
| input: SubscriptionQueryInput; | ||
| } |
| "use strict"; | ||
| /* tslint:disable */ | ||
| // This file was automatically generated and should not be edited. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //# sourceMappingURL=subscription.js.map |
| {"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../../src/graphql/codegen/subscription.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,kEAAkE"} |
| import { UserConfirmSignUpInput } from "./../../codegen/globalTypes"; | ||
| export interface userConfirmSignUp { | ||
| userConfirmSignUp: boolean | null; | ||
| } | ||
| export interface userConfirmSignUpVariables { | ||
| input: UserConfirmSignUpInput; | ||
| } |
| "use strict"; | ||
| /* tslint:disable */ | ||
| // This file was automatically generated and should not be edited. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //# sourceMappingURL=userConfirmSignUp.js.map |
| {"version":3,"file":"userConfirmSignUp.js","sourceRoot":"","sources":["../../../src/graphql/codegen/userConfirmSignUp.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,kEAAkE"} |
| import { UserSignUpMutationInput, UserDeliveryMedium } from "./../../codegen/globalTypes"; | ||
| export interface userSignUp_userSignUp { | ||
| __typename: "UserSignUpResponse"; | ||
| userConfirmed: boolean; | ||
| deliveryMedium: UserDeliveryMedium | null; | ||
| } | ||
| export interface userSignUp { | ||
| userSignUp: userSignUp_userSignUp | null; | ||
| } | ||
| export interface userSignUpVariables { | ||
| input: UserSignUpMutationInput; | ||
| } |
| "use strict"; | ||
| /* tslint:disable */ | ||
| // This file was automatically generated and should not be edited. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //# sourceMappingURL=userSignUp.js.map |
| {"version":3,"file":"userSignUp.js","sourceRoot":"","sources":["../../../src/graphql/codegen/userSignUp.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,kEAAkE"} |
| query getPackage($input: PackageQueryInput!) { | ||
| package(input: $input) { | ||
| name, | ||
| description, | ||
| scriptMetadata { | ||
| version, | ||
| platform { | ||
| os, | ||
| dist, | ||
| codename | ||
| } | ||
| } | ||
| } | ||
| } |
| query getScript($input: ScriptQueryInput!) { | ||
| script(input: $input) { | ||
| version, | ||
| execute, | ||
| superuser, | ||
| platform { | ||
| os | ||
| dist | ||
| codename | ||
| } | ||
| } | ||
| } |
| query getUserAccessToken($input:UserAccessTokenQueryInput!) { | ||
| userAccessToken(input: $input) { | ||
| accessToken, | ||
| session, | ||
| status, | ||
| refreshToken | ||
| } | ||
| } |
| export declare function executeQuery<T, V>(name: string, variables: V): Promise<T>; | ||
| export declare function executeMutation<T, V>(name: string, variables: V): Promise<any>; |
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const node_fetch_1 = require("node-fetch"); | ||
| const apollo_boost_1 = require("apollo-boost"); | ||
| const fs_1 = require("fs"); | ||
| const path_1 = require("path"); | ||
| const config_1 = require("../config"); | ||
| const client = new apollo_boost_1.default({ | ||
| uri: config_1.default.endpoint, | ||
| fetch: node_fetch_1.default, | ||
| onError: () => { } // Do not log | ||
| }); | ||
| function readGraphQLFile(name) { | ||
| const content = fs_1.readFileSync(path_1.resolve(path_1.join(__dirname, `${name}.graphql`))); | ||
| return apollo_boost_1.gql ` | ||
| ${content} | ||
| `; | ||
| } | ||
| function executeQuery(name, variables) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const query = readGraphQLFile(name); | ||
| const { data } = yield client.query({ query, variables }); | ||
| return data; | ||
| }); | ||
| } | ||
| exports.executeQuery = executeQuery; | ||
| function executeMutation(name, variables) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const mutation = readGraphQLFile(name); | ||
| const { data } = yield client.mutate({ mutation, variables }); | ||
| return data; | ||
| }); | ||
| } | ||
| exports.executeMutation = executeMutation; | ||
| //# sourceMappingURL=helpers.js.map |
| {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/graphql/helpers.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA+B;AAC/B,+CAAiD;AACjD,2BAAkC;AAClC,+BAAqC;AACrC,sCAA+B;AAE/B,MAAM,MAAM,GAAG,IAAI,sBAAY,CAAC;IAC5B,GAAG,EAAE,gBAAM,CAAC,QAAQ;IACpB,KAAK,EAAO,oBAAK;IACjB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,aAAa;CAClC,CAAC,CAAC;AAEH,SAAS,eAAe,CAAC,IAAY;IACjC,MAAM,OAAO,GAAG,iBAAY,CAAC,cAAO,CAAC,WAAI,CAAC,SAAS,EAAE,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAC1E,OAAO,kBAAG,CAAA;UACJ,OAAO;KACZ,CAAC;AACN,CAAC;AAED,SAAsB,YAAY,CAAO,IAAY,EAAE,SAAY;;QAC/D,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAChE,OAAO,IAAI,CAAC;IAChB,CAAC;CAAA;AAJD,oCAIC;AAED,SAAsB,eAAe,CAAO,IAAY,EAAE,SAAY;;QAClE,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC;IAChB,CAAC;CAAA;AAJD,0CAIC"} |
| import { getUserAccessTokenVariables, getUserAccessToken } from "./codegen/getUserAccessToken"; | ||
| import { setUserPasswordVariables, setUserPassword } from "./codegen/setUserPassword"; | ||
| import { userSignUp, userSignUpVariables } from "../graphql/codegen/userSignUp"; | ||
| import { userConfirmSignUp, userConfirmSignUpVariables } from "../graphql/codegen/userConfirmSignUp"; | ||
| import { publish, publishVariables } from "../graphql/codegen/publish"; | ||
| import { getPackage, getPackageVariables } from "../graphql/codegen/getPackage"; | ||
| import { getScript, getScriptVariables } from "../graphql/codegen/getScript"; | ||
| import { subscription, subscriptionVariables } from "../graphql/codegen/subscription"; | ||
| import { refreshAccessToken, refreshAccessTokenVariables } from "../graphql/codegen/refreshAccessToken"; | ||
| export declare function getUserAccessToken(variables: getUserAccessTokenVariables): Promise<getUserAccessToken>; | ||
| export declare function setUserNewPassword(variables: setUserPasswordVariables): Promise<setUserPassword>; | ||
| export declare function userSignUp(variables: userSignUpVariables): Promise<userSignUp>; | ||
| export declare function refreshAccessToken(variables: refreshAccessTokenVariables): Promise<refreshAccessToken>; | ||
| export declare function userConfirmSignUp(variables: userConfirmSignUpVariables): Promise<userConfirmSignUp>; | ||
| export declare function publish(variables: publishVariables): Promise<publish>; | ||
| export declare function getPackage(variables: getPackageVariables): Promise<getPackage>; | ||
| export declare function getScript(variables: getScriptVariables): Promise<getScript>; | ||
| export declare function subscription(variables: subscriptionVariables): Promise<subscription>; |
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const helpers_1 = require("./helpers"); | ||
| function getUserAccessToken(variables) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| return helpers_1.executeQuery("getUserAccessToken", variables); | ||
| }); | ||
| } | ||
| exports.getUserAccessToken = getUserAccessToken; | ||
| function setUserNewPassword(variables) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| return helpers_1.executeMutation("setUserNewPassword", variables); | ||
| }); | ||
| } | ||
| exports.setUserNewPassword = setUserNewPassword; | ||
| function userSignUp(variables) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| return helpers_1.executeMutation("userSignUp", variables); | ||
| }); | ||
| } | ||
| exports.userSignUp = userSignUp; | ||
| function refreshAccessToken(variables) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| return helpers_1.executeMutation("refreshAccessToken", variables); | ||
| }); | ||
| } | ||
| exports.refreshAccessToken = refreshAccessToken; | ||
| function userConfirmSignUp(variables) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| return helpers_1.executeMutation("userConfirmSignUp", variables); | ||
| }); | ||
| } | ||
| exports.userConfirmSignUp = userConfirmSignUp; | ||
| function publish(variables) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| return helpers_1.executeMutation("publish", variables); | ||
| }); | ||
| } | ||
| exports.publish = publish; | ||
| function getPackage(variables) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| return helpers_1.executeQuery("getPackage", variables); | ||
| }); | ||
| } | ||
| exports.getPackage = getPackage; | ||
| function getScript(variables) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| return helpers_1.executeQuery("getScript", variables); | ||
| }); | ||
| } | ||
| exports.getScript = getScript; | ||
| function subscription(variables) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| return helpers_1.executeQuery("subscription", variables); | ||
| }); | ||
| } | ||
| exports.subscription = subscription; | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graphql/index.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,uCAA0D;AA2B1D,SAAsB,kBAAkB,CACpC,SAAsC;;QAEtC,OAAO,sBAAY,CACf,oBAAoB,EACpB,SAAS,CACZ,CAAC;IACN,CAAC;CAAA;AAPD,gDAOC;AAED,SAAsB,kBAAkB,CACpC,SAAmC;;QAEnC,OAAO,yBAAe,CAClB,oBAAoB,EACpB,SAAS,CACZ,CAAC;IACN,CAAC;CAAA;AAPD,gDAOC;AAED,SAAsB,UAAU,CAC5B,SAA8B;;QAE9B,OAAO,yBAAe,CAClB,YAAY,EACZ,SAAS,CACZ,CAAC;IACN,CAAC;CAAA;AAPD,gCAOC;AAED,SAAsB,kBAAkB,CACpC,SAAsC;;QAEtC,OAAO,yBAAe,CAClB,oBAAoB,EACpB,SAAS,CACZ,CAAC;IACN,CAAC;CAAA;AAPD,gDAOC;AAED,SAAsB,iBAAiB,CACnC,SAAqC;;QAErC,OAAO,yBAAe,CAClB,mBAAmB,EACnB,SAAS,CACZ,CAAC;IACN,CAAC;CAAA;AAPD,8CAOC;AAED,SAAsB,OAAO,CAAC,SAA2B;;QACrD,OAAO,yBAAe,CAA4B,SAAS,EAAE,SAAS,CAAC,CAAC;IAC5E,CAAC;CAAA;AAFD,0BAEC;AAED,SAAsB,UAAU,CAC5B,SAA8B;;QAE9B,OAAO,sBAAY,CACf,YAAY,EACZ,SAAS,CACZ,CAAC;IACN,CAAC;CAAA;AAPD,gCAOC;AAED,SAAsB,SAAS,CAC3B,SAA6B;;QAE7B,OAAO,sBAAY,CAAgC,WAAW,EAAE,SAAS,CAAC,CAAC;IAC/E,CAAC;CAAA;AAJD,8BAIC;AAED,SAAsB,YAAY,CAC9B,SAAgC;;QAEhC,OAAO,sBAAY,CACf,cAAc,EACd,SAAS,CACZ,CAAC;IACN,CAAC;CAAA;AAPD,oCAOC"} |
| mutation publish($input: PublishMutationInput!) { | ||
| publish(input: $input) | ||
| } |
| mutation refreshAccessToken($input: UserRefreshAccessTokenInput!) { | ||
| userRefreshAccessToken(input: $input) { | ||
| status, | ||
| session, | ||
| accessToken, | ||
| refreshToken | ||
| } | ||
| } |
| mutation setUserPassword($input: UserSetNewPasswordInput!) { | ||
| userNewPassword(input: $input) { | ||
| status, accessToken | ||
| } | ||
| } |
| query subscription($input: SubscriptionQueryInput!) { | ||
| subscription(input:$input) { | ||
| topic | ||
| endpoint | ||
| expiration | ||
| } | ||
| } |
| mutation userConfirmSignUp($input:UserConfirmSignUpInput!) { | ||
| userConfirmSignUp(input: $input) | ||
| } |
| mutation userSignUp($input: UserSignUpMutationInput!) { | ||
| userSignUp(input: $input) { | ||
| userConfirmed, | ||
| deliveryMedium | ||
| } | ||
| } |
| #!/usr/bin/env node | ||
| export {}; |
| #!/usr/bin/env node | ||
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const commands_1 = require("./commands"); | ||
| const program = require("commander"); | ||
| function initProgram() { | ||
| return commands_1.default.reduce((program, CommandClass) => { | ||
| const command = new CommandClass(program); | ||
| command.init().action((...args) => __awaiter(this, void 0, void 0, function* () { | ||
| try { | ||
| yield command.handler(...args); | ||
| process.exit(0); | ||
| } | ||
| catch (err) { | ||
| console.error(err.message); | ||
| if (err.networkError) { | ||
| console.log(JSON.stringify(err.networkError, null, 4)); | ||
| } | ||
| else if (err.graphQlErrors) { | ||
| console.log(JSON.stringify(err.graphQlErrors, null, 4)); | ||
| } | ||
| process.exit(1); | ||
| } | ||
| })); | ||
| return program; | ||
| }, program); | ||
| } | ||
| initProgram().parse(process.argv); | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,yCAAkC;AAClC,qCAAqC;AAErC,SAAS,WAAW;IAChB,OAAO,kBAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE;QAC7C,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;QAE1C,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAO,GAAG,IAAI,EAAE,EAAE;YACpC,IAAI;gBACA,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;gBAC/B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACnB;YAAC,OAAO,GAAG,EAAE;gBACV,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAC3B,IAAI,GAAG,CAAC,YAAY,EAAE;oBAClB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;iBAC1D;qBAAM,IAAI,GAAG,CAAC,aAAa,EAAE;oBAC1B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;iBAC3D;gBACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACnB;QACL,CAAC,CAAA,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;IACnB,CAAC,EAAE,OAAO,CAAC,CAAC;AAChB,CAAC;AACD,WAAW,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"} |
| interface ISubscriptionOptions { | ||
| topic: string; | ||
| endpoint: string; | ||
| } | ||
| export declare class SubscriptionClient { | ||
| private options; | ||
| private client; | ||
| constructor(options: ISubscriptionOptions); | ||
| connect(): Promise<{}>; | ||
| close(): Promise<{}>; | ||
| subscribe(): Promise<{}>; | ||
| readResults(action: string): Promise<{}>; | ||
| } | ||
| export {}; |
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const mqtt = require("mqtt"); | ||
| class SubscriptionClient { | ||
| constructor(options) { | ||
| this.options = options; | ||
| } | ||
| connect() { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const { endpoint } = this.options; | ||
| this.client = mqtt.connect(endpoint, { | ||
| protocol: "wss" | ||
| }); | ||
| this.client.on("close", () => { | ||
| console.log("Subscription connection closed"); | ||
| }); | ||
| return new Promise(resolve => { | ||
| const self = this; | ||
| this.client.addListener("connect", function listener() { | ||
| self.client.removeListener("connect", listener); | ||
| resolve(); | ||
| }); | ||
| }); | ||
| }); | ||
| } | ||
| close() { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| return new Promise(resolve => { | ||
| this.client.end(false, () => { | ||
| resolve(); | ||
| }); | ||
| }); | ||
| }); | ||
| } | ||
| subscribe() { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| return new Promise((resolve, reject) => { | ||
| this.client.subscribe(this.options.topic, err => { | ||
| if (err) { | ||
| reject(err); | ||
| } | ||
| else { | ||
| resolve(); | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
| } | ||
| readResults(action) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| return new Promise((resolve, reject) => { | ||
| const self = this; | ||
| this.client.addListener("message", function listener(topic, message) { | ||
| const data = JSON.parse(message.toString()); | ||
| if (data.action !== action) { | ||
| return; | ||
| } | ||
| else if (data.error && data.error.Error) { | ||
| self.client.removeListener("message", listener); | ||
| reject(new Error(data.error.Error)); | ||
| } | ||
| else { | ||
| self.client.removeListener("message", listener); | ||
| resolve(data.result); | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
| } | ||
| } | ||
| exports.SubscriptionClient = SubscriptionClient; | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vendors/notification/index.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,6BAA6B;AAO7B,MAAa,kBAAkB;IAG3B,YAAoB,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;IAAG,CAAC;IAE/C,OAAO;;YACT,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;YAElC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CACtB,QAAQ,EACR;gBACI,QAAQ,EAAE,KAAK;aAClB,CACJ,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;gBACzB,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;YAClD,CAAC,CAAC,CAAC;YAEH,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;gBACzB,MAAM,IAAI,GAAG,IAAI,CAAC;gBAClB,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,SAAS,QAAQ;oBAChD,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;oBAChD,OAAO,EAAE,CAAC;gBACd,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;IACK,KAAK;;YACP,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;gBACzB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE;oBACxB,OAAO,EAAE,CAAC;gBACd,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;IACK,SAAS;;YACX,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACnC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;oBAC5C,IAAI,GAAG,EAAE;wBACL,MAAM,CAAC,GAAG,CAAC,CAAC;qBACf;yBAAM;wBACH,OAAO,EAAE,CAAC;qBACb;gBACL,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;IAEK,WAAW,CAAC,MAAc;;YAC5B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACnC,MAAM,IAAI,GAAG,IAAI,CAAC;gBAClB,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,SAAS,QAAQ,CAChD,KAAa,EACb,OAAkB;oBAElB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;oBAE5C,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;wBACxB,OAAO;qBACV;yBAAM,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;wBACvC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;wBAChD,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;qBACvC;yBAAM;wBACH,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;wBAChD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;qBACxB;gBACL,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;CACJ;AAnED,gDAmEC"} |
| import { LinuxRunner } from "./runners/LinuxRunner"; | ||
| import { Script, IScriptOptions } from "./Script"; | ||
| export { LinuxRunner, Script, IScriptOptions }; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const LinuxRunner_1 = require("./runners/LinuxRunner"); | ||
| exports.LinuxRunner = LinuxRunner_1.LinuxRunner; | ||
| const Script_1 = require("./Script"); | ||
| exports.Script = Script_1.Script; | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vendors/runner/index.ts"],"names":[],"mappings":";;AAAA,uDAAoD;AAG3C,sBAHA,yBAAW,CAGA;AAFpB,qCAAkD;AAE5B,iBAFb,eAAM,CAEa"} |
| import { Script } from "../Script"; | ||
| interface ITerminalEmulatorResult { | ||
| output: string; | ||
| exitCode: number; | ||
| } | ||
| export declare class LinuxRunner { | ||
| private script; | ||
| constructor(script: Script); | ||
| execute(): Promise<ITerminalEmulatorResult>; | ||
| private createExecutable; | ||
| private executeInTerminalEmulator; | ||
| } | ||
| export {}; |
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const readline = require("readline"); | ||
| const pty = require("node-pty"); | ||
| const fs_1 = require("fs"); | ||
| const path_1 = require("path"); | ||
| const CREATE_SCRIPT_PATH = "/tmp"; | ||
| const CREATE_SCRIPT_NAME = "openscript_executable.sh"; | ||
| class LinuxRunner { | ||
| constructor(script) { | ||
| this.script = script; | ||
| } | ||
| execute() { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const commands = this.script.getExecute(); | ||
| const executable = this.createExecutable(commands); | ||
| return yield this.executeInTerminalEmulator(executable); | ||
| }); | ||
| } | ||
| createExecutable(commands) { | ||
| const scriptFilePath = path_1.join(CREATE_SCRIPT_PATH, CREATE_SCRIPT_NAME); | ||
| const scriptContent = [ | ||
| "#!/usr/bin/env bash", | ||
| "set -e", | ||
| commands.join("\n") | ||
| ].join("\n"); | ||
| fs_1.writeFileSync(scriptFilePath, scriptContent); | ||
| fs_1.chmodSync(scriptFilePath, "0755"); | ||
| return scriptFilePath; | ||
| } | ||
| executeInTerminalEmulator(executable) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| let output = ""; | ||
| let executer = `${executable}`; | ||
| let args = []; | ||
| if (this.script.requiresSuperUser()) { | ||
| executer = `sudo`; | ||
| args = [executable]; | ||
| } | ||
| const terminal = pty.spawn(executer, args, { | ||
| name: "xterm-color", | ||
| cols: process.stdout.columns, | ||
| rows: process.stdout.rows, | ||
| cwd: process.cwd(), | ||
| env: {} | ||
| }); | ||
| /** | ||
| * Bind terminal output to current process output. | ||
| */ | ||
| terminal.on("data", data => { | ||
| output += data; | ||
| process.stdout.write(data); | ||
| }); | ||
| /** | ||
| * Bind current process key events to the new terminal. | ||
| */ | ||
| if (process.stdin.isPaused()) { | ||
| // promptly pauses input after reading stdin. | ||
| process.stdin.resume(); | ||
| } | ||
| readline.emitKeypressEvents(process.stdin); | ||
| process.stdin.setRawMode(true); | ||
| process.stdin.addListener("keypress", (str, key) => { | ||
| const { sequence } = key; | ||
| terminal.write(sequence); | ||
| }); | ||
| return new Promise(resolve => { | ||
| terminal.on("exit", code => { | ||
| process.stdin.removeAllListeners(); | ||
| terminal.kill(); | ||
| resolve({ | ||
| exitCode: code, | ||
| output | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
| } | ||
| } | ||
| exports.LinuxRunner = LinuxRunner; | ||
| //# sourceMappingURL=LinuxRunner.js.map |
| {"version":3,"file":"LinuxRunner.js","sourceRoot":"","sources":["../../../../src/vendors/runner/runners/LinuxRunner.ts"],"names":[],"mappings":"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"} |
| import { getScript_script_platform } from "../../graphql/codegen/getScript"; | ||
| export interface IScriptOptions { | ||
| name: string; | ||
| description?: string; | ||
| version: string; | ||
| superuser?: boolean; | ||
| execute: string[]; | ||
| platform: getScript_script_platform[]; | ||
| } | ||
| export declare class Script { | ||
| private options; | ||
| constructor(options: IScriptOptions); | ||
| getName(): string; | ||
| getDescription(): string; | ||
| getVersion(): string; | ||
| getExecute(): string[]; | ||
| getPlatform(): getScript_script_platform[]; | ||
| requiresSuperUser(): boolean; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| class Script { | ||
| constructor(options) { | ||
| this.options = options; | ||
| } | ||
| getName() { | ||
| return this.options.name; | ||
| } | ||
| getDescription() { | ||
| return this.options.description; | ||
| } | ||
| getVersion() { | ||
| return this.options.version; | ||
| } | ||
| getExecute() { | ||
| return this.options.execute; | ||
| } | ||
| getPlatform() { | ||
| return this.options.platform || null; | ||
| } | ||
| requiresSuperUser() { | ||
| return this.options.superuser || false; | ||
| } | ||
| } | ||
| exports.Script = Script; | ||
| //# sourceMappingURL=Script.js.map |
| {"version":3,"file":"Script.js","sourceRoot":"","sources":["../../../src/vendors/runner/Script.ts"],"names":[],"mappings":";;AAWA,MAAa,MAAM;IACf,YAAoB,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;IAE3C,CAAC;IAED,OAAO;QACH,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC7B,CAAC;IAED,cAAc;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;IACpC,CAAC;IAED,UAAU;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAChC,CAAC;IAED,UAAU;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAChC,CAAC;IAED,WAAW;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC;IACzC,CAAC;IAED,iBAAiB;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;IAC3C,CAAC;CACJ;AA5BD,wBA4BC"} |
Sorry, the diff of this file is too big to display
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
0
-100%147583
-28.74%22
83.33%14
27.27%3
-96.77%0
-100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed