You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@devbookhq/sdk

Package Overview
Dependencies
Maintainers
2
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devbookhq/sdk - npm Package Compare versions

Comparing version

to
2.3.11

8

dist/cjs/api/schema.gen.d.ts

@@ -163,2 +163,3 @@ /**

readonly 204: never;
readonly 400: components["responses"]["400"];
readonly 401: components["responses"]["401"];

@@ -197,3 +198,3 @@ readonly 500: components["responses"]["500"];

/** @enum {string} */
readonly Template: "Nodejs" | "Go" | "Bash" | "Python3" | "Java" | "Rust" | "Perl" | "PHP";
readonly Template: "Nodejs" | "Go" | "Bash" | "Python3";
/** @enum {string} */

@@ -209,3 +210,6 @@ readonly EnvironmentState: "Building" | "Failed" | "Done";

readonly NewSession: {
/** @description Option determining if the session is a shared persistent edit session */
/**
* @description Option determining if the session is a shared persistent edit session
* @default false
*/
readonly editEnabled?: boolean;

@@ -212,0 +216,0 @@ /** @description Identifier of a code snippet which which is the environment associated */

export { default as Session } from './session';
export type { SessionOpts, } from './session';
export { CodeSnippetExecState, OutType, } from './session/codeSnippet';
export type { CodeSnippetManager, CodeSnippetStateHandler, CodeSnippetStderrHandler, CodeSnippetStdoutHandler, CodeSnippetSubscriptionHandler, CodeSnippetSubscriptionHandlerType, OutResponse, OutStdoutResponse, OutStderrResponse, DepsErrorResponse, DepOutResponse, DepStdoutResponse, DepStderrResponse, OpenedPort, EnvVars } from './session/codeSnippet';
export type { CodeSnippetManager, CodeSnippetStateHandler, CodeSnippetStderrHandler, CodeSnippetStdoutHandler, CodeSnippetSubscriptionHandler, CodeSnippetSubscriptionHandlerType, OutResponse, OutStdoutResponse, OutStderrResponse, OpenedPort, EnvVars } from './session/codeSnippet';
export type { TerminalManager, TerminalSession, } from './session/terminal';
export { default as api } from './api';
export type { components, paths, } from './api';

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("rpc-websocket-client");require("cross-fetch/polyfill");var e=require("openapi-typescript-fetch");function i(s,e,i,t){return new(i||(i=Promise))((function(o,n){function r(s){try{c(t.next(s))}catch(s){n(s)}}function l(s){try{c(t.throw(s))}catch(s){n(s)}}function c(s){var e;s.done?o(s.value):(e=s.value,e instanceof i?e:new i((function(s){s(e)}))).then(r,l)}c((t=t.apply(s,e||[])).next())}))}var t,o;exports.CodeSnippetExecState=void 0,(t=exports.CodeSnippetExecState||(exports.CodeSnippetExecState={})).Running="Running",t.Stopped="Stopped",t.Loading="Loading",exports.OutType=void 0,(o=exports.OutType||(exports.OutType={})).Stdout="Stdout",o.Stderr="Stderr";const n=e.Fetcher.for();function r(s){return new Promise((e=>setTimeout(e,s)))}n.configure({baseUrl:"https://ondevbook.com"});class l{constructor(s,e=!1){this.logID=s,this.isEnabled=e}id(){return"function"==typeof this.logID?this.logID():this.logID}log(...s){this.isEnabled&&console.log(`[${this.id()}]`,...s)}error(...s){console.error(`[${this.id()} ERROR]`,...s)}}const c=n.path("/sessions").method("post").create({api_key:!0}),d=n.path("/sessions/{sessionID}/refresh").method("post").create({api_key:!0});exports.Session=class extends class{constructor(e){this.opts=e,this.isOpen=!1,this.rpc=new s.RpcWebSocketClient,this.subscribers=[],this.logger=new l("Session",e.debug),this.logger.log(`Session for code snippet "${e.id}" initialized`)}call(s,e){return i(this,void 0,void 0,(function*(){return this.rpc.call(s,e)}))}unsubscribe(s){return i(this,void 0,void 0,(function*(){const e=this.subscribers.find((e=>e.subscriptionID===s));e&&(yield this.call(`${e.method}_unsubscribe`,[null==e?void 0:e.subscriptionID]),this.subscribers=this.subscribers.filter((s=>s!==e)),this.logger.log(`Unsubscribed from "${e.method}"`))}))}subscribe(s,e,...t){return i(this,void 0,void 0,(function*(){const i=yield this.call(`${s}_subscribe`,t);if("string"!=typeof i)throw new Error(`Cannot subscribe to ${s} with params ${t}. Expected response to be a subscription ID, instead got ${JSON.stringify(i)}`);return this.subscribers.push({subscriptionID:i,handler:e,method:s}),this.logger.log(`Subscribed to "${s}_${t}" with id "${i}"`),i}))}getHostname(s){if(!this.isOpen||!this.session)throw new Error("Session is not active");const e=`${this.session.sessionID}-${this.session.clientID}.ondevbook.com`;return s?`${s}-${e}`:e}close(){var s,e,t;return i(this,void 0,void 0,(function*(){if(this.isOpen){this.logger.log("Closing",this.session),this.isOpen=!1,this.logger.log("Unsubscribing...");(yield Promise.allSettled(this.subscribers.map((s=>this.unsubscribe(s.subscriptionID))))).forEach((s=>{"rejected"===s.status&&this.logger.log(`Failed to unsubscribe: "${s.reason}"`)})),null===(s=this.rpc.ws)||void 0===s||s.close(),null===(t=null===(e=this.opts)||void 0===e?void 0:e.onClose)||void 0===t||t.call(e),this.logger.log("Disconected from the session")}}))}open(){return i(this,void 0,void 0,(function*(){if(this.isOpen||this.session)throw new Error("Session connect was already called");this.isOpen=!0;try{const s=yield c({codeSnippetID:this.opts.id,editEnabled:this.opts.editEnabled,api_key:this.opts.apiKey});this.session=s.data,this.logger.log("Aquired session:",this.session),this.refresh(this.session.sessionID)}catch(s){if(s instanceof c.Error){const e=s.getActualType();if(400===e.status)throw new Error(`Error creating session - (${e.status}) bad request: ${e.data.message}`);if(401===e.status)throw new Error(`Error creating session - (${e.status}) unauthenticated (you need to be authenticated to start an session with persistent edits): ${e.data.message}`);if(500===e.status)throw new Error(`Error creating session - (${e.status}) server error: ${e.data.message}`);throw s}}if(!this.session)throw new Error("Session is not defined");const s=`wss://${this.getHostname(8010)}/ws`;this.rpc.onError((s=>{this.logger.log("Error in WS session:",this.session,s)}));let e,t,o=!1;const n=new Promise(((s,i)=>{e=()=>{o||(o=!0,s())},t=()=>{o||(o=!0,i())}}));this.rpc.onOpen((()=>{this.logger.log("Connected to session:",this.session),null==e||e()})),this.rpc.onClose((e=>i(this,void 0,void 0,(function*(){if(this.logger.log("Closing WS connection to session:",this.session,e),this.isOpen){yield r(100),this.logger.log("Reconnecting to session:",this.session);try{yield this.rpc.connect(s),this.logger.log("Reconnected to session:",this.session)}catch(s){this.logger.log("Failed reconnecting to session:",this.session,s)}}else null==t||t()})))),this.rpc.onNotification.push(this.handleNotification.bind(this));try{this.logger.log("Connection to session:",this.session),yield this.rpc.connect(s)}catch(s){this.logger.log("Error connecting to session",this.session,s)}yield n}))}handleNotification(s){this.subscribers.filter((e=>{var i;return e.subscriptionID===(null===(i=s.params)||void 0===i?void 0:i.subscription)})).forEach((e=>{var i;return e.handler(null===(i=s.params)||void 0===i?void 0:i.result)}))}refresh(s){return i(this,void 0,void 0,(function*(){this.logger.log(`Started refreshing session "${s}"`);try{for(;;){if(!this.isOpen)return void this.logger.log("Cannot refresh session - it was closed",this.session);yield r(5e3);try{this.logger.log(`Refreshed session "${s}"`),yield d({sessionID:s,api_key:this.opts.apiKey})}catch(e){if(e instanceof d.Error){const i=e.getActualType();if(404===i.status)return void this.logger.error(`Error refreshing session - (${i.status}): ${i.data.message}`);this.logger.error(`Refreshing session "${s}" failed - (${i.status})`)}}}}finally{this.logger.log(`Stopped refreshing session "${s}"`),this.close()}}))}}{constructor(s){super(s),this.codeSnippetOpts=s.codeSnippet}open(){const s=Object.create(null,{open:{get:()=>super.open}});var e,t,o,n,r,l,c;return i(this,void 0,void 0,(function*(){yield s.open.call(this),yield Promise.all([(null===(e=this.codeSnippetOpts)||void 0===e?void 0:e.onStateChange)?this.subscribe("codeSnippet",this.codeSnippetOpts.onStateChange,"state"):Promise.resolve(),(null===(t=this.codeSnippetOpts)||void 0===t?void 0:t.onStderr)?this.subscribe("codeSnippet",this.codeSnippetOpts.onStderr,"stderr"):Promise.resolve(),(null===(o=this.codeSnippetOpts)||void 0===o?void 0:o.onStdout)?this.subscribe("codeSnippet",this.codeSnippetOpts.onStdout,"stdout"):Promise.resolve(),(null===(n=this.codeSnippetOpts)||void 0===n?void 0:n.onDepsStdout)?this.subscribe("codeSnippet",this.codeSnippetOpts.onDepsStdout,"depsStdout"):Promise.resolve(),(null===(r=this.codeSnippetOpts)||void 0===r?void 0:r.onDepsStderr)?this.subscribe("codeSnippet",this.codeSnippetOpts.onDepsStderr,"depsStderr"):Promise.resolve(),(null===(l=this.codeSnippetOpts)||void 0===l?void 0:l.onDepsChange)?this.subscribe("codeSnippet",this.codeSnippetOpts.onDepsChange,"depsChange"):Promise.resolve(),(null===(c=this.codeSnippetOpts)||void 0===c?void 0:c.onScanPorts)?this.subscribe("codeSnippet",this.codeSnippetOpts.onScanPorts,"scanOpenedPorts"):Promise.resolve()]),this.codeSnippet={run:(s,e={})=>i(this,void 0,void 0,(function*(){var i,t;if(!this.isOpen||!this.session)throw new Error("Session is not active");const o=yield this.call("codeSnippet_run",[s,e]);return null===(t=null===(i=this.codeSnippetOpts)||void 0===i?void 0:i.onStateChange)||void 0===t||t.call(i,o),this.logger.log("Started running code",s),o})),stop:()=>i(this,void 0,void 0,(function*(){var s,e;if(!this.isOpen||!this.session)throw new Error("Session is not active");const i=yield this.call("codeSnippet_stop");return null===(e=null===(s=this.codeSnippetOpts)||void 0===s?void 0:s.onStateChange)||void 0===e||e.call(s,i),this.logger.log("Stopped running code"),i})),listDeps:()=>i(this,void 0,void 0,(function*(){if(!this.isOpen||!this.session)throw new Error("Session is not active");this.logger.log("Started listing deps");const s=yield this.call("codeSnippet_deps");return this.logger.log("Stopped listing deps",s),s})),installDep:s=>i(this,void 0,void 0,(function*(){if(!this.isOpen||!this.session)throw new Error("Session is not active");this.logger.log("Started installing dependency",s);const e=yield this.call("codeSnippet_installDep",[s]);return this.logger.log("Stopped installing dependency",e),e})),uninstallDep:s=>i(this,void 0,void 0,(function*(){if(!this.isOpen||!this.session)throw new Error("Session is not active");this.logger.log("Started uninstalling dependency",s);const e=yield this.call("codeSnippet_uninstallDep",[s]);return this.logger.log("Stopped uninstalling dependency",e),e}))},this.terminal={createSession:(s,e,t)=>i(this,void 0,void 0,(function*(){try{const o=yield this.call("terminal_start",[t||"",e.cols,e.rows]);if("string"!=typeof o)throw new Error("Cannot initialize terminal");const n=yield this.subscribe("terminal",s,"onData",o);return{destroy:()=>i(this,void 0,void 0,(function*(){yield this.unsubscribe(n),yield this.call("terminal_destroy",[o])})),sendData:s=>i(this,void 0,void 0,(function*(){yield this.call("terminal_data",[o,s])})),resize:({cols:s,rows:e})=>i(this,void 0,void 0,(function*(){yield this.call("terminal_resize",[o,s,e])}))}}catch(s){throw this.logger.error(s),new Error("Error starting terminal session",s)}}))}}))}},exports.api=n;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("rpc-websocket-client");require("cross-fetch/polyfill");var t=require("openapi-typescript-fetch");function i(s,t,i,e){return new(i||(i=Promise))((function(o,n){function r(s){try{l(e.next(s))}catch(s){n(s)}}function c(s){try{l(e.throw(s))}catch(s){n(s)}}function l(s){var t;s.done?o(s.value):(t=s.value,t instanceof i?t:new i((function(s){s(t)}))).then(r,c)}l((e=e.apply(s,t||[])).next())}))}var e,o;exports.CodeSnippetExecState=void 0,(e=exports.CodeSnippetExecState||(exports.CodeSnippetExecState={})).Running="Running",e.Stopped="Stopped",e.Loading="Loading",exports.OutType=void 0,(o=exports.OutType||(exports.OutType={})).Stdout="Stdout",o.Stderr="Stderr";const n=t.Fetcher.for();function r(s){return new Promise((t=>setTimeout(t,s)))}n.configure({baseUrl:"https://ondevbook.com"});class c{constructor(s,t=!1){this.logID=s,this.isEnabled=t}id(){return"function"==typeof this.logID?this.logID():this.logID}log(...s){this.isEnabled&&console.log(`[${this.id()}]`,...s)}error(...s){console.error(`[${this.id()} ERROR]`,...s)}}const l=n.path("/sessions").method("post").create({api_key:!0}),h=n.path("/sessions/{sessionID}/refresh").method("post").create({api_key:!0});exports.Session=class extends class{constructor(t){this.opts=t,this.isOpen=!1,this.rpc=new s.RpcWebSocketClient,this.subscribers=[],this.logger=new c("Session",t.debug),this.logger.log(`Session for code snippet "${t.id}" initialized`)}call(s,t){return i(this,void 0,void 0,(function*(){return this.rpc.call(s,t)}))}unsubscribe(s){return i(this,void 0,void 0,(function*(){const t=this.subscribers.find((t=>t.subscriptionID===s));t&&(yield this.call(`${t.method}_unsubscribe`,[null==t?void 0:t.subscriptionID]),this.subscribers=this.subscribers.filter((s=>s!==t)),this.logger.log(`Unsubscribed from "${t.method}"`))}))}subscribe(s,t,...e){return i(this,void 0,void 0,(function*(){const i=yield this.call(`${s}_subscribe`,e);if("string"!=typeof i)throw new Error(`Cannot subscribe to ${s} with params ${e}. Expected response to be a subscription ID, instead got ${JSON.stringify(i)}`);return this.subscribers.push({subscriptionID:i,handler:t,method:s}),this.logger.log(`Subscribed to "${s}_${e}" with id "${i}"`),i}))}getHostname(s){if(!this.isOpen||!this.session)throw new Error("Session is not active");const t=`${this.session.sessionID}-${this.session.clientID}.ondevbook.com`;return s?`${s}-${t}`:t}close(){var s,t,e;return i(this,void 0,void 0,(function*(){if(this.isOpen){this.logger.log("Closing",this.session),this.isOpen=!1,this.logger.log("Unsubscribing...");(yield Promise.allSettled(this.subscribers.map((s=>this.unsubscribe(s.subscriptionID))))).forEach((s=>{"rejected"===s.status&&this.logger.log(`Failed to unsubscribe: "${s.reason}"`)})),null===(s=this.rpc.ws)||void 0===s||s.close(),null===(e=null===(t=this.opts)||void 0===t?void 0:t.onClose)||void 0===e||e.call(t),this.logger.log("Disconected from the session")}}))}open(){return i(this,void 0,void 0,(function*(){if(this.isOpen||this.session)throw new Error("Session connect was already called");this.isOpen=!0;try{const s=yield l({codeSnippetID:this.opts.id,editEnabled:this.opts.editEnabled,api_key:this.opts.apiKey});this.session=s.data,this.logger.log("Aquired session:",this.session),this.refresh(this.session.sessionID)}catch(s){if(s instanceof l.Error){const t=s.getActualType();if(400===t.status)throw new Error(`Error creating session - (${t.status}) bad request: ${t.data.message}`);if(401===t.status)throw new Error(`Error creating session - (${t.status}) unauthenticated (you need to be authenticated to start an session with persistent edits): ${t.data.message}`);if(500===t.status)throw new Error(`Error creating session - (${t.status}) server error: ${t.data.message}`);throw s}}if(!this.session)throw new Error("Session is not defined");const s=`wss://${this.getHostname(8010)}/ws`;this.rpc.onError((s=>{this.logger.log("Error in WS session:",this.session,s)}));let t,e,o=!1;const n=new Promise(((s,i)=>{t=()=>{o||(o=!0,s())},e=()=>{o||(o=!0,i())}}));this.rpc.onOpen((()=>{this.logger.log("Connected to session:",this.session),null==t||t()})),this.rpc.onClose((t=>i(this,void 0,void 0,(function*(){if(this.logger.log("Closing WS connection to session:",this.session,t),this.isOpen){yield r(100),this.logger.log("Reconnecting to session:",this.session);try{yield this.rpc.connect(s),this.logger.log("Reconnected to session:",this.session)}catch(s){this.logger.log("Failed reconnecting to session:",this.session,s)}}else null==e||e()})))),this.rpc.onNotification.push(this.handleNotification.bind(this));try{this.logger.log("Connection to session:",this.session),yield this.rpc.connect(s)}catch(s){this.logger.log("Error connecting to session",this.session,s)}yield n}))}handleNotification(s){this.subscribers.filter((t=>{var i;return t.subscriptionID===(null===(i=s.params)||void 0===i?void 0:i.subscription)})).forEach((t=>{var i;return t.handler(null===(i=s.params)||void 0===i?void 0:i.result)}))}refresh(s){return i(this,void 0,void 0,(function*(){this.logger.log(`Started refreshing session "${s}"`);try{for(;;){if(!this.isOpen)return void this.logger.log("Cannot refresh session - it was closed",this.session);yield r(5e3);try{this.logger.log(`Refreshed session "${s}"`),yield h({sessionID:s,api_key:this.opts.apiKey})}catch(t){if(t instanceof h.Error){const i=t.getActualType();if(404===i.status)return void this.logger.error(`Error refreshing session - (${i.status}): ${i.data.message}`);this.logger.error(`Refreshing session "${s}" failed - (${i.status})`)}}}}finally{this.logger.log(`Stopped refreshing session "${s}"`),this.close()}}))}}{constructor(s){super(s),this.codeSnippetOpts=s.codeSnippet}open(){const s=Object.create(null,{open:{get:()=>super.open}});var t,e,o,n;return i(this,void 0,void 0,(function*(){yield s.open.call(this),yield Promise.all([(null===(t=this.codeSnippetOpts)||void 0===t?void 0:t.onStateChange)?this.subscribe("codeSnippet",this.codeSnippetOpts.onStateChange,"state"):Promise.resolve(),(null===(e=this.codeSnippetOpts)||void 0===e?void 0:e.onStderr)?this.subscribe("codeSnippet",this.codeSnippetOpts.onStderr,"stderr"):Promise.resolve(),(null===(o=this.codeSnippetOpts)||void 0===o?void 0:o.onStdout)?this.subscribe("codeSnippet",this.codeSnippetOpts.onStdout,"stdout"):Promise.resolve(),(null===(n=this.codeSnippetOpts)||void 0===n?void 0:n.onScanPorts)?this.subscribe("codeSnippet",this.codeSnippetOpts.onScanPorts,"scanOpenedPorts"):Promise.resolve()]),this.codeSnippet={run:(s,t={})=>i(this,void 0,void 0,(function*(){var i,e;if(!this.isOpen||!this.session)throw new Error("Session is not active");const o=yield this.call("codeSnippet_run",[s,t]);return null===(e=null===(i=this.codeSnippetOpts)||void 0===i?void 0:i.onStateChange)||void 0===e||e.call(i,o),this.logger.log("Started running code",s),o})),stop:()=>i(this,void 0,void 0,(function*(){var s,t;if(!this.isOpen||!this.session)throw new Error("Session is not active");const i=yield this.call("codeSnippet_stop");return null===(t=null===(s=this.codeSnippetOpts)||void 0===s?void 0:s.onStateChange)||void 0===t||t.call(s,i),this.logger.log("Stopped running code"),i}))},this.terminal={createSession:(s,t,e)=>i(this,void 0,void 0,(function*(){try{const o=yield this.call("terminal_start",[e||"",t.cols,t.rows]);if("string"!=typeof o)throw new Error("Cannot initialize terminal");const n=yield this.subscribe("terminal",s,"onData",o);return{destroy:()=>i(this,void 0,void 0,(function*(){yield this.unsubscribe(n),yield this.call("terminal_destroy",[o])})),sendData:s=>i(this,void 0,void 0,(function*(){yield this.call("terminal_data",[o,s])})),resize:({cols:s,rows:t})=>i(this,void 0,void 0,(function*(){yield this.call("terminal_resize",[o,s,t])}))}}catch(s){throw this.logger.error(s),new Error("Error starting terminal session",s)}}))}}))}},exports.api=n;
//# sourceMappingURL=index.js.map

@@ -7,5 +7,2 @@ export declare const codeSnippetMethod = "codeSnippet";

}
export interface DepsErrorResponse {
error: string;
}
export declare enum OutType {

@@ -29,11 +26,2 @@ Stdout = "Stdout",

}
export interface DepOutResponse extends OutResponse {
dep: string;
}
export interface DepStdoutResponse extends DepOutResponse {
type: OutType.Stdout;
}
export interface DepStderrResponse extends DepOutResponse {
type: OutType.Stderr;
}
export interface OpenedPort {

@@ -47,7 +35,4 @@ State: string;

export declare type CodeSnippetStdoutHandler = (o: OutStdoutResponse) => void;
export declare type DepsStdoutHandler = (o: DepStdoutResponse) => void;
export declare type DepsStderrHandler = (o: DepStderrResponse) => void;
export declare type DepsChangeHandler = (deps: string[]) => void;
export declare type ScanOpenedPortsHandler = (ports: OpenedPort[]) => void;
export declare type CodeSnippetSubscriptionHandler = CodeSnippetStateHandler | CodeSnippetStderrHandler | CodeSnippetStdoutHandler | DepsStderrHandler | DepsStderrHandler | DepsChangeHandler | ScanOpenedPortsHandler;
export declare type CodeSnippetSubscriptionHandler = CodeSnippetStateHandler | CodeSnippetStderrHandler | CodeSnippetStdoutHandler | ScanOpenedPortsHandler;
export declare type CodeSnippetSubscriptionHandlerType = {

@@ -57,5 +42,2 @@ 'state': CodeSnippetStateHandler;

'stdout': CodeSnippetStdoutHandler;
'depsStdout': DepsStdoutHandler;
'depsStderr': DepsStderrHandler;
'depsChange': DepsChangeHandler;
'scanOpenedPorts': ScanOpenedPortsHandler;

@@ -66,5 +48,2 @@ };

readonly stop: () => Promise<CodeSnippetExecState>;
readonly listDeps: () => Promise<string[]>;
readonly installDep: (dep: string) => Promise<DepsErrorResponse>;
readonly uninstallDep: (dep: string) => Promise<DepsErrorResponse>;
}

@@ -1,2 +0,2 @@

import { CodeSnippetManager, CodeSnippetStateHandler, CodeSnippetStderrHandler, CodeSnippetStdoutHandler, DepsStdoutHandler, DepsStderrHandler, DepsChangeHandler, ScanOpenedPortsHandler } from './codeSnippet';
import { CodeSnippetManager, CodeSnippetStateHandler, CodeSnippetStderrHandler, CodeSnippetStdoutHandler, ScanOpenedPortsHandler } from './codeSnippet';
import { TerminalManager } from './terminal';

@@ -8,5 +8,2 @@ import SessionConnection, { SessionConnectionOpts } from './sessionConnection';

onStdout?: CodeSnippetStdoutHandler;
onDepsStdout?: DepsStdoutHandler;
onDepsStderr?: DepsStderrHandler;
onDepsChange?: DepsChangeHandler;
onScanPorts?: ScanOpenedPortsHandler;

@@ -13,0 +10,0 @@ }

@@ -163,2 +163,3 @@ /**

readonly 204: never;
readonly 400: components["responses"]["400"];
readonly 401: components["responses"]["401"];

@@ -197,3 +198,3 @@ readonly 500: components["responses"]["500"];

/** @enum {string} */
readonly Template: "Nodejs" | "Go" | "Bash" | "Python3" | "Java" | "Rust" | "Perl" | "PHP";
readonly Template: "Nodejs" | "Go" | "Bash" | "Python3";
/** @enum {string} */

@@ -209,3 +210,6 @@ readonly EnvironmentState: "Building" | "Failed" | "Done";

readonly NewSession: {
/** @description Option determining if the session is a shared persistent edit session */
/**
* @description Option determining if the session is a shared persistent edit session
* @default false
*/
readonly editEnabled?: boolean;

@@ -212,0 +216,0 @@ /** @description Identifier of a code snippet which which is the environment associated */

export { default as Session } from './session';
export type { SessionOpts, } from './session';
export { CodeSnippetExecState, OutType, } from './session/codeSnippet';
export type { CodeSnippetManager, CodeSnippetStateHandler, CodeSnippetStderrHandler, CodeSnippetStdoutHandler, CodeSnippetSubscriptionHandler, CodeSnippetSubscriptionHandlerType, OutResponse, OutStdoutResponse, OutStderrResponse, DepsErrorResponse, DepOutResponse, DepStdoutResponse, DepStderrResponse, OpenedPort, EnvVars } from './session/codeSnippet';
export type { CodeSnippetManager, CodeSnippetStateHandler, CodeSnippetStderrHandler, CodeSnippetStdoutHandler, CodeSnippetSubscriptionHandler, CodeSnippetSubscriptionHandlerType, OutResponse, OutStdoutResponse, OutStderrResponse, OpenedPort, EnvVars } from './session/codeSnippet';
export type { TerminalManager, TerminalSession, } from './session/terminal';
export { default as api } from './api';
export type { components, paths, } from './api';

@@ -1,2 +0,2 @@

import{RpcWebSocketClient as s}from"rpc-websocket-client";import"cross-fetch/polyfill";import{Fetcher as i}from"openapi-typescript-fetch";function t(s,i,t,e){return new(t||(t=Promise))((function(o,n){function r(s){try{c(e.next(s))}catch(s){n(s)}}function l(s){try{c(e.throw(s))}catch(s){n(s)}}function c(s){var i;s.done?o(s.value):(i=s.value,i instanceof t?i:new t((function(s){s(i)}))).then(r,l)}c((e=e.apply(s,i||[])).next())}))}var e,o;!function(s){s.Running="Running",s.Stopped="Stopped",s.Loading="Loading"}(e||(e={})),function(s){s.Stdout="Stdout",s.Stderr="Stderr"}(o||(o={}));const n=i.for();function r(s){return new Promise((i=>setTimeout(i,s)))}n.configure({baseUrl:"https://ondevbook.com"});class l{constructor(s,i=!1){this.logID=s,this.isEnabled=i}id(){return"function"==typeof this.logID?this.logID():this.logID}log(...s){this.isEnabled&&console.log(`[${this.id()}]`,...s)}error(...s){console.error(`[${this.id()} ERROR]`,...s)}}const c=n.path("/sessions").method("post").create({api_key:!0}),d=n.path("/sessions/{sessionID}/refresh").method("post").create({api_key:!0});class h extends class{constructor(i){this.opts=i,this.isOpen=!1,this.rpc=new s,this.subscribers=[],this.logger=new l("Session",i.debug),this.logger.log(`Session for code snippet "${i.id}" initialized`)}call(s,i){return t(this,void 0,void 0,(function*(){return this.rpc.call(s,i)}))}unsubscribe(s){return t(this,void 0,void 0,(function*(){const i=this.subscribers.find((i=>i.subscriptionID===s));i&&(yield this.call(`${i.method}_unsubscribe`,[null==i?void 0:i.subscriptionID]),this.subscribers=this.subscribers.filter((s=>s!==i)),this.logger.log(`Unsubscribed from "${i.method}"`))}))}subscribe(s,i,...e){return t(this,void 0,void 0,(function*(){const t=yield this.call(`${s}_subscribe`,e);if("string"!=typeof t)throw new Error(`Cannot subscribe to ${s} with params ${e}. Expected response to be a subscription ID, instead got ${JSON.stringify(t)}`);return this.subscribers.push({subscriptionID:t,handler:i,method:s}),this.logger.log(`Subscribed to "${s}_${e}" with id "${t}"`),t}))}getHostname(s){if(!this.isOpen||!this.session)throw new Error("Session is not active");const i=`${this.session.sessionID}-${this.session.clientID}.ondevbook.com`;return s?`${s}-${i}`:i}close(){var s,i,e;return t(this,void 0,void 0,(function*(){if(this.isOpen){this.logger.log("Closing",this.session),this.isOpen=!1,this.logger.log("Unsubscribing...");(yield Promise.allSettled(this.subscribers.map((s=>this.unsubscribe(s.subscriptionID))))).forEach((s=>{"rejected"===s.status&&this.logger.log(`Failed to unsubscribe: "${s.reason}"`)})),null===(s=this.rpc.ws)||void 0===s||s.close(),null===(e=null===(i=this.opts)||void 0===i?void 0:i.onClose)||void 0===e||e.call(i),this.logger.log("Disconected from the session")}}))}open(){return t(this,void 0,void 0,(function*(){if(this.isOpen||this.session)throw new Error("Session connect was already called");this.isOpen=!0;try{const s=yield c({codeSnippetID:this.opts.id,editEnabled:this.opts.editEnabled,api_key:this.opts.apiKey});this.session=s.data,this.logger.log("Aquired session:",this.session),this.refresh(this.session.sessionID)}catch(s){if(s instanceof c.Error){const i=s.getActualType();if(400===i.status)throw new Error(`Error creating session - (${i.status}) bad request: ${i.data.message}`);if(401===i.status)throw new Error(`Error creating session - (${i.status}) unauthenticated (you need to be authenticated to start an session with persistent edits): ${i.data.message}`);if(500===i.status)throw new Error(`Error creating session - (${i.status}) server error: ${i.data.message}`);throw s}}if(!this.session)throw new Error("Session is not defined");const s=`wss://${this.getHostname(8010)}/ws`;this.rpc.onError((s=>{this.logger.log("Error in WS session:",this.session,s)}));let i,e,o=!1;const n=new Promise(((s,t)=>{i=()=>{o||(o=!0,s())},e=()=>{o||(o=!0,t())}}));this.rpc.onOpen((()=>{this.logger.log("Connected to session:",this.session),null==i||i()})),this.rpc.onClose((i=>t(this,void 0,void 0,(function*(){if(this.logger.log("Closing WS connection to session:",this.session,i),this.isOpen){yield r(100),this.logger.log("Reconnecting to session:",this.session);try{yield this.rpc.connect(s),this.logger.log("Reconnected to session:",this.session)}catch(s){this.logger.log("Failed reconnecting to session:",this.session,s)}}else null==e||e()})))),this.rpc.onNotification.push(this.handleNotification.bind(this));try{this.logger.log("Connection to session:",this.session),yield this.rpc.connect(s)}catch(s){this.logger.log("Error connecting to session",this.session,s)}yield n}))}handleNotification(s){this.subscribers.filter((i=>{var t;return i.subscriptionID===(null===(t=s.params)||void 0===t?void 0:t.subscription)})).forEach((i=>{var t;return i.handler(null===(t=s.params)||void 0===t?void 0:t.result)}))}refresh(s){return t(this,void 0,void 0,(function*(){this.logger.log(`Started refreshing session "${s}"`);try{for(;;){if(!this.isOpen)return void this.logger.log("Cannot refresh session - it was closed",this.session);yield r(5e3);try{this.logger.log(`Refreshed session "${s}"`),yield d({sessionID:s,api_key:this.opts.apiKey})}catch(i){if(i instanceof d.Error){const t=i.getActualType();if(404===t.status)return void this.logger.error(`Error refreshing session - (${t.status}): ${t.data.message}`);this.logger.error(`Refreshing session "${s}" failed - (${t.status})`)}}}}finally{this.logger.log(`Stopped refreshing session "${s}"`),this.close()}}))}}{constructor(s){super(s),this.codeSnippetOpts=s.codeSnippet}open(){const s=Object.create(null,{open:{get:()=>super.open}});var i,e,o,n,r,l,c;return t(this,void 0,void 0,(function*(){yield s.open.call(this),yield Promise.all([(null===(i=this.codeSnippetOpts)||void 0===i?void 0:i.onStateChange)?this.subscribe("codeSnippet",this.codeSnippetOpts.onStateChange,"state"):Promise.resolve(),(null===(e=this.codeSnippetOpts)||void 0===e?void 0:e.onStderr)?this.subscribe("codeSnippet",this.codeSnippetOpts.onStderr,"stderr"):Promise.resolve(),(null===(o=this.codeSnippetOpts)||void 0===o?void 0:o.onStdout)?this.subscribe("codeSnippet",this.codeSnippetOpts.onStdout,"stdout"):Promise.resolve(),(null===(n=this.codeSnippetOpts)||void 0===n?void 0:n.onDepsStdout)?this.subscribe("codeSnippet",this.codeSnippetOpts.onDepsStdout,"depsStdout"):Promise.resolve(),(null===(r=this.codeSnippetOpts)||void 0===r?void 0:r.onDepsStderr)?this.subscribe("codeSnippet",this.codeSnippetOpts.onDepsStderr,"depsStderr"):Promise.resolve(),(null===(l=this.codeSnippetOpts)||void 0===l?void 0:l.onDepsChange)?this.subscribe("codeSnippet",this.codeSnippetOpts.onDepsChange,"depsChange"):Promise.resolve(),(null===(c=this.codeSnippetOpts)||void 0===c?void 0:c.onScanPorts)?this.subscribe("codeSnippet",this.codeSnippetOpts.onScanPorts,"scanOpenedPorts"):Promise.resolve()]),this.codeSnippet={run:(s,i={})=>t(this,void 0,void 0,(function*(){var t,e;if(!this.isOpen||!this.session)throw new Error("Session is not active");const o=yield this.call("codeSnippet_run",[s,i]);return null===(e=null===(t=this.codeSnippetOpts)||void 0===t?void 0:t.onStateChange)||void 0===e||e.call(t,o),this.logger.log("Started running code",s),o})),stop:()=>t(this,void 0,void 0,(function*(){var s,i;if(!this.isOpen||!this.session)throw new Error("Session is not active");const t=yield this.call("codeSnippet_stop");return null===(i=null===(s=this.codeSnippetOpts)||void 0===s?void 0:s.onStateChange)||void 0===i||i.call(s,t),this.logger.log("Stopped running code"),t})),listDeps:()=>t(this,void 0,void 0,(function*(){if(!this.isOpen||!this.session)throw new Error("Session is not active");this.logger.log("Started listing deps");const s=yield this.call("codeSnippet_deps");return this.logger.log("Stopped listing deps",s),s})),installDep:s=>t(this,void 0,void 0,(function*(){if(!this.isOpen||!this.session)throw new Error("Session is not active");this.logger.log("Started installing dependency",s);const i=yield this.call("codeSnippet_installDep",[s]);return this.logger.log("Stopped installing dependency",i),i})),uninstallDep:s=>t(this,void 0,void 0,(function*(){if(!this.isOpen||!this.session)throw new Error("Session is not active");this.logger.log("Started uninstalling dependency",s);const i=yield this.call("codeSnippet_uninstallDep",[s]);return this.logger.log("Stopped uninstalling dependency",i),i}))},this.terminal={createSession:(s,i,e)=>t(this,void 0,void 0,(function*(){try{const o=yield this.call("terminal_start",[e||"",i.cols,i.rows]);if("string"!=typeof o)throw new Error("Cannot initialize terminal");const n=yield this.subscribe("terminal",s,"onData",o);return{destroy:()=>t(this,void 0,void 0,(function*(){yield this.unsubscribe(n),yield this.call("terminal_destroy",[o])})),sendData:s=>t(this,void 0,void 0,(function*(){yield this.call("terminal_data",[o,s])})),resize:({cols:s,rows:i})=>t(this,void 0,void 0,(function*(){yield this.call("terminal_resize",[o,s,i])}))}}catch(s){throw this.logger.error(s),new Error("Error starting terminal session",s)}}))}}))}}export{e as CodeSnippetExecState,o as OutType,h as Session,n as api};
import{RpcWebSocketClient as s}from"rpc-websocket-client";import"cross-fetch/polyfill";import{Fetcher as i}from"openapi-typescript-fetch";function t(s,i,t,e){return new(t||(t=Promise))((function(o,n){function r(s){try{l(e.next(s))}catch(s){n(s)}}function c(s){try{l(e.throw(s))}catch(s){n(s)}}function l(s){var i;s.done?o(s.value):(i=s.value,i instanceof t?i:new t((function(s){s(i)}))).then(r,c)}l((e=e.apply(s,i||[])).next())}))}var e,o;!function(s){s.Running="Running",s.Stopped="Stopped",s.Loading="Loading"}(e||(e={})),function(s){s.Stdout="Stdout",s.Stderr="Stderr"}(o||(o={}));const n=i.for();function r(s){return new Promise((i=>setTimeout(i,s)))}n.configure({baseUrl:"https://ondevbook.com"});class c{constructor(s,i=!1){this.logID=s,this.isEnabled=i}id(){return"function"==typeof this.logID?this.logID():this.logID}log(...s){this.isEnabled&&console.log(`[${this.id()}]`,...s)}error(...s){console.error(`[${this.id()} ERROR]`,...s)}}const l=n.path("/sessions").method("post").create({api_key:!0}),h=n.path("/sessions/{sessionID}/refresh").method("post").create({api_key:!0});class d extends class{constructor(i){this.opts=i,this.isOpen=!1,this.rpc=new s,this.subscribers=[],this.logger=new c("Session",i.debug),this.logger.log(`Session for code snippet "${i.id}" initialized`)}call(s,i){return t(this,void 0,void 0,(function*(){return this.rpc.call(s,i)}))}unsubscribe(s){return t(this,void 0,void 0,(function*(){const i=this.subscribers.find((i=>i.subscriptionID===s));i&&(yield this.call(`${i.method}_unsubscribe`,[null==i?void 0:i.subscriptionID]),this.subscribers=this.subscribers.filter((s=>s!==i)),this.logger.log(`Unsubscribed from "${i.method}"`))}))}subscribe(s,i,...e){return t(this,void 0,void 0,(function*(){const t=yield this.call(`${s}_subscribe`,e);if("string"!=typeof t)throw new Error(`Cannot subscribe to ${s} with params ${e}. Expected response to be a subscription ID, instead got ${JSON.stringify(t)}`);return this.subscribers.push({subscriptionID:t,handler:i,method:s}),this.logger.log(`Subscribed to "${s}_${e}" with id "${t}"`),t}))}getHostname(s){if(!this.isOpen||!this.session)throw new Error("Session is not active");const i=`${this.session.sessionID}-${this.session.clientID}.ondevbook.com`;return s?`${s}-${i}`:i}close(){var s,i,e;return t(this,void 0,void 0,(function*(){if(this.isOpen){this.logger.log("Closing",this.session),this.isOpen=!1,this.logger.log("Unsubscribing...");(yield Promise.allSettled(this.subscribers.map((s=>this.unsubscribe(s.subscriptionID))))).forEach((s=>{"rejected"===s.status&&this.logger.log(`Failed to unsubscribe: "${s.reason}"`)})),null===(s=this.rpc.ws)||void 0===s||s.close(),null===(e=null===(i=this.opts)||void 0===i?void 0:i.onClose)||void 0===e||e.call(i),this.logger.log("Disconected from the session")}}))}open(){return t(this,void 0,void 0,(function*(){if(this.isOpen||this.session)throw new Error("Session connect was already called");this.isOpen=!0;try{const s=yield l({codeSnippetID:this.opts.id,editEnabled:this.opts.editEnabled,api_key:this.opts.apiKey});this.session=s.data,this.logger.log("Aquired session:",this.session),this.refresh(this.session.sessionID)}catch(s){if(s instanceof l.Error){const i=s.getActualType();if(400===i.status)throw new Error(`Error creating session - (${i.status}) bad request: ${i.data.message}`);if(401===i.status)throw new Error(`Error creating session - (${i.status}) unauthenticated (you need to be authenticated to start an session with persistent edits): ${i.data.message}`);if(500===i.status)throw new Error(`Error creating session - (${i.status}) server error: ${i.data.message}`);throw s}}if(!this.session)throw new Error("Session is not defined");const s=`wss://${this.getHostname(8010)}/ws`;this.rpc.onError((s=>{this.logger.log("Error in WS session:",this.session,s)}));let i,e,o=!1;const n=new Promise(((s,t)=>{i=()=>{o||(o=!0,s())},e=()=>{o||(o=!0,t())}}));this.rpc.onOpen((()=>{this.logger.log("Connected to session:",this.session),null==i||i()})),this.rpc.onClose((i=>t(this,void 0,void 0,(function*(){if(this.logger.log("Closing WS connection to session:",this.session,i),this.isOpen){yield r(100),this.logger.log("Reconnecting to session:",this.session);try{yield this.rpc.connect(s),this.logger.log("Reconnected to session:",this.session)}catch(s){this.logger.log("Failed reconnecting to session:",this.session,s)}}else null==e||e()})))),this.rpc.onNotification.push(this.handleNotification.bind(this));try{this.logger.log("Connection to session:",this.session),yield this.rpc.connect(s)}catch(s){this.logger.log("Error connecting to session",this.session,s)}yield n}))}handleNotification(s){this.subscribers.filter((i=>{var t;return i.subscriptionID===(null===(t=s.params)||void 0===t?void 0:t.subscription)})).forEach((i=>{var t;return i.handler(null===(t=s.params)||void 0===t?void 0:t.result)}))}refresh(s){return t(this,void 0,void 0,(function*(){this.logger.log(`Started refreshing session "${s}"`);try{for(;;){if(!this.isOpen)return void this.logger.log("Cannot refresh session - it was closed",this.session);yield r(5e3);try{this.logger.log(`Refreshed session "${s}"`),yield h({sessionID:s,api_key:this.opts.apiKey})}catch(i){if(i instanceof h.Error){const t=i.getActualType();if(404===t.status)return void this.logger.error(`Error refreshing session - (${t.status}): ${t.data.message}`);this.logger.error(`Refreshing session "${s}" failed - (${t.status})`)}}}}finally{this.logger.log(`Stopped refreshing session "${s}"`),this.close()}}))}}{constructor(s){super(s),this.codeSnippetOpts=s.codeSnippet}open(){const s=Object.create(null,{open:{get:()=>super.open}});var i,e,o,n;return t(this,void 0,void 0,(function*(){yield s.open.call(this),yield Promise.all([(null===(i=this.codeSnippetOpts)||void 0===i?void 0:i.onStateChange)?this.subscribe("codeSnippet",this.codeSnippetOpts.onStateChange,"state"):Promise.resolve(),(null===(e=this.codeSnippetOpts)||void 0===e?void 0:e.onStderr)?this.subscribe("codeSnippet",this.codeSnippetOpts.onStderr,"stderr"):Promise.resolve(),(null===(o=this.codeSnippetOpts)||void 0===o?void 0:o.onStdout)?this.subscribe("codeSnippet",this.codeSnippetOpts.onStdout,"stdout"):Promise.resolve(),(null===(n=this.codeSnippetOpts)||void 0===n?void 0:n.onScanPorts)?this.subscribe("codeSnippet",this.codeSnippetOpts.onScanPorts,"scanOpenedPorts"):Promise.resolve()]),this.codeSnippet={run:(s,i={})=>t(this,void 0,void 0,(function*(){var t,e;if(!this.isOpen||!this.session)throw new Error("Session is not active");const o=yield this.call("codeSnippet_run",[s,i]);return null===(e=null===(t=this.codeSnippetOpts)||void 0===t?void 0:t.onStateChange)||void 0===e||e.call(t,o),this.logger.log("Started running code",s),o})),stop:()=>t(this,void 0,void 0,(function*(){var s,i;if(!this.isOpen||!this.session)throw new Error("Session is not active");const t=yield this.call("codeSnippet_stop");return null===(i=null===(s=this.codeSnippetOpts)||void 0===s?void 0:s.onStateChange)||void 0===i||i.call(s,t),this.logger.log("Stopped running code"),t}))},this.terminal={createSession:(s,i,e)=>t(this,void 0,void 0,(function*(){try{const o=yield this.call("terminal_start",[e||"",i.cols,i.rows]);if("string"!=typeof o)throw new Error("Cannot initialize terminal");const n=yield this.subscribe("terminal",s,"onData",o);return{destroy:()=>t(this,void 0,void 0,(function*(){yield this.unsubscribe(n),yield this.call("terminal_destroy",[o])})),sendData:s=>t(this,void 0,void 0,(function*(){yield this.call("terminal_data",[o,s])})),resize:({cols:s,rows:i})=>t(this,void 0,void 0,(function*(){yield this.call("terminal_resize",[o,s,i])}))}}catch(s){throw this.logger.error(s),new Error("Error starting terminal session",s)}}))}}))}}export{e as CodeSnippetExecState,o as OutType,d as Session,n as api};
//# sourceMappingURL=index.js.map

@@ -7,5 +7,2 @@ export declare const codeSnippetMethod = "codeSnippet";

}
export interface DepsErrorResponse {
error: string;
}
export declare enum OutType {

@@ -29,11 +26,2 @@ Stdout = "Stdout",

}
export interface DepOutResponse extends OutResponse {
dep: string;
}
export interface DepStdoutResponse extends DepOutResponse {
type: OutType.Stdout;
}
export interface DepStderrResponse extends DepOutResponse {
type: OutType.Stderr;
}
export interface OpenedPort {

@@ -47,7 +35,4 @@ State: string;

export declare type CodeSnippetStdoutHandler = (o: OutStdoutResponse) => void;
export declare type DepsStdoutHandler = (o: DepStdoutResponse) => void;
export declare type DepsStderrHandler = (o: DepStderrResponse) => void;
export declare type DepsChangeHandler = (deps: string[]) => void;
export declare type ScanOpenedPortsHandler = (ports: OpenedPort[]) => void;
export declare type CodeSnippetSubscriptionHandler = CodeSnippetStateHandler | CodeSnippetStderrHandler | CodeSnippetStdoutHandler | DepsStderrHandler | DepsStderrHandler | DepsChangeHandler | ScanOpenedPortsHandler;
export declare type CodeSnippetSubscriptionHandler = CodeSnippetStateHandler | CodeSnippetStderrHandler | CodeSnippetStdoutHandler | ScanOpenedPortsHandler;
export declare type CodeSnippetSubscriptionHandlerType = {

@@ -57,5 +42,2 @@ 'state': CodeSnippetStateHandler;

'stdout': CodeSnippetStdoutHandler;
'depsStdout': DepsStdoutHandler;
'depsStderr': DepsStderrHandler;
'depsChange': DepsChangeHandler;
'scanOpenedPorts': ScanOpenedPortsHandler;

@@ -66,5 +48,2 @@ };

readonly stop: () => Promise<CodeSnippetExecState>;
readonly listDeps: () => Promise<string[]>;
readonly installDep: (dep: string) => Promise<DepsErrorResponse>;
readonly uninstallDep: (dep: string) => Promise<DepsErrorResponse>;
}

@@ -1,2 +0,2 @@

import { CodeSnippetManager, CodeSnippetStateHandler, CodeSnippetStderrHandler, CodeSnippetStdoutHandler, DepsStdoutHandler, DepsStderrHandler, DepsChangeHandler, ScanOpenedPortsHandler } from './codeSnippet';
import { CodeSnippetManager, CodeSnippetStateHandler, CodeSnippetStderrHandler, CodeSnippetStdoutHandler, ScanOpenedPortsHandler } from './codeSnippet';
import { TerminalManager } from './terminal';

@@ -8,5 +8,2 @@ import SessionConnection, { SessionConnectionOpts } from './sessionConnection';

onStdout?: CodeSnippetStdoutHandler;
onDepsStdout?: DepsStdoutHandler;
onDepsStderr?: DepsStderrHandler;
onDepsChange?: DepsChangeHandler;
onScanPorts?: ScanOpenedPortsHandler;

@@ -13,0 +10,0 @@ }

@@ -163,2 +163,3 @@ /**

readonly 204: never;
readonly 400: components["responses"]["400"];
readonly 401: components["responses"]["401"];

@@ -197,3 +198,3 @@ readonly 500: components["responses"]["500"];

/** @enum {string} */
readonly Template: "Nodejs" | "Go" | "Bash" | "Python3" | "Java" | "Rust" | "Perl" | "PHP";
readonly Template: "Nodejs" | "Go" | "Bash" | "Python3";
/** @enum {string} */

@@ -209,3 +210,6 @@ readonly EnvironmentState: "Building" | "Failed" | "Done";

readonly NewSession: {
/** @description Option determining if the session is a shared persistent edit session */
/**
* @description Option determining if the session is a shared persistent edit session
* @default false
*/
readonly editEnabled?: boolean;

@@ -212,0 +216,0 @@ /** @description Identifier of a code snippet which which is the environment associated */

export { default as Session } from './session';
export type { SessionOpts, } from './session';
export { CodeSnippetExecState, OutType, } from './session/codeSnippet';
export type { CodeSnippetManager, CodeSnippetStateHandler, CodeSnippetStderrHandler, CodeSnippetStdoutHandler, CodeSnippetSubscriptionHandler, CodeSnippetSubscriptionHandlerType, OutResponse, OutStdoutResponse, OutStderrResponse, DepsErrorResponse, DepOutResponse, DepStdoutResponse, DepStderrResponse, OpenedPort, EnvVars } from './session/codeSnippet';
export type { CodeSnippetManager, CodeSnippetStateHandler, CodeSnippetStderrHandler, CodeSnippetStdoutHandler, CodeSnippetSubscriptionHandler, CodeSnippetSubscriptionHandlerType, OutResponse, OutStdoutResponse, OutStderrResponse, OpenedPort, EnvVars } from './session/codeSnippet';
export type { TerminalManager, TerminalSession, } from './session/terminal';
export { default as api } from './api';
export type { components, paths, } from './api';

@@ -1,2 +0,2 @@

!function(s,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("rpc-websocket-client"),require("cross-fetch/polyfill"),require("openapi-typescript-fetch")):"function"==typeof define&&define.amd?define(["exports","rpc-websocket-client","cross-fetch/polyfill","openapi-typescript-fetch"],e):e((s="undefined"!=typeof globalThis?globalThis:s||self)["@devbookhq/sdk"]={},s.rpcWebsocketClient,null,s.openapiTypescriptFetch)}(this,(function(s,e,i,t){"use strict";function o(s,e,i,t){return new(i||(i=Promise))((function(o,n){function r(s){try{c(t.next(s))}catch(s){n(s)}}function l(s){try{c(t.throw(s))}catch(s){n(s)}}function c(s){var e;s.done?o(s.value):(e=s.value,e instanceof i?e:new i((function(s){s(e)}))).then(r,l)}c((t=t.apply(s,e||[])).next())}))}const n="codeSnippet";var r,l;s.CodeSnippetExecState=void 0,(r=s.CodeSnippetExecState||(s.CodeSnippetExecState={})).Running="Running",r.Stopped="Stopped",r.Loading="Loading",s.OutType=void 0,(l=s.OutType||(s.OutType={})).Stdout="Stdout",l.Stderr="Stderr";const c="terminal",d=t.Fetcher.for();function h(s){return new Promise((e=>setTimeout(e,s)))}d.configure({baseUrl:"https://ondevbook.com"});class p{constructor(s,e=!1){this.logID=s,this.isEnabled=e}id(){return"function"==typeof this.logID?this.logID():this.logID}log(...s){this.isEnabled&&console.log(`[${this.id()}]`,...s)}error(...s){console.error(`[${this.id()} ERROR]`,...s)}}const a=d.path("/sessions").method("post").create({api_key:!0}),u=d.path("/sessions/{sessionID}/refresh").method("post").create({api_key:!0});s.Session=class extends class{constructor(s){this.opts=s,this.isOpen=!1,this.rpc=new e.RpcWebSocketClient,this.subscribers=[],this.logger=new p("Session",s.debug),this.logger.log(`Session for code snippet "${s.id}" initialized`)}call(s,e){return o(this,void 0,void 0,(function*(){return this.rpc.call(s,e)}))}unsubscribe(s){return o(this,void 0,void 0,(function*(){const e=this.subscribers.find((e=>e.subscriptionID===s));e&&(yield this.call(`${e.method}_unsubscribe`,[null==e?void 0:e.subscriptionID]),this.subscribers=this.subscribers.filter((s=>s!==e)),this.logger.log(`Unsubscribed from "${e.method}"`))}))}subscribe(s,e,...i){return o(this,void 0,void 0,(function*(){const t=yield this.call(`${s}_subscribe`,i);if("string"!=typeof t)throw new Error(`Cannot subscribe to ${s} with params ${i}. Expected response to be a subscription ID, instead got ${JSON.stringify(t)}`);return this.subscribers.push({subscriptionID:t,handler:e,method:s}),this.logger.log(`Subscribed to "${s}_${i}" with id "${t}"`),t}))}getHostname(s){if(!this.isOpen||!this.session)throw new Error("Session is not active");const e=`${this.session.sessionID}-${this.session.clientID}.ondevbook.com`;return s?`${s}-${e}`:e}close(){var s,e,i;return o(this,void 0,void 0,(function*(){if(this.isOpen){this.logger.log("Closing",this.session),this.isOpen=!1,this.logger.log("Unsubscribing...");(yield Promise.allSettled(this.subscribers.map((s=>this.unsubscribe(s.subscriptionID))))).forEach((s=>{"rejected"===s.status&&this.logger.log(`Failed to unsubscribe: "${s.reason}"`)})),null===(s=this.rpc.ws)||void 0===s||s.close(),null===(i=null===(e=this.opts)||void 0===e?void 0:e.onClose)||void 0===i||i.call(e),this.logger.log("Disconected from the session")}}))}open(){return o(this,void 0,void 0,(function*(){if(this.isOpen||this.session)throw new Error("Session connect was already called");this.isOpen=!0;try{const s=yield a({codeSnippetID:this.opts.id,editEnabled:this.opts.editEnabled,api_key:this.opts.apiKey});this.session=s.data,this.logger.log("Aquired session:",this.session),this.refresh(this.session.sessionID)}catch(s){if(s instanceof a.Error){const e=s.getActualType();if(400===e.status)throw new Error(`Error creating session - (${e.status}) bad request: ${e.data.message}`);if(401===e.status)throw new Error(`Error creating session - (${e.status}) unauthenticated (you need to be authenticated to start an session with persistent edits): ${e.data.message}`);if(500===e.status)throw new Error(`Error creating session - (${e.status}) server error: ${e.data.message}`);throw s}}if(!this.session)throw new Error("Session is not defined");const s=`wss://${this.getHostname(8010)}/ws`;this.rpc.onError((s=>{this.logger.log("Error in WS session:",this.session,s)}));let e,i,t=!1;const n=new Promise(((s,o)=>{e=()=>{t||(t=!0,s())},i=()=>{t||(t=!0,o())}}));this.rpc.onOpen((()=>{this.logger.log("Connected to session:",this.session),null==e||e()})),this.rpc.onClose((e=>o(this,void 0,void 0,(function*(){if(this.logger.log("Closing WS connection to session:",this.session,e),this.isOpen){yield h(100),this.logger.log("Reconnecting to session:",this.session);try{yield this.rpc.connect(s),this.logger.log("Reconnected to session:",this.session)}catch(s){this.logger.log("Failed reconnecting to session:",this.session,s)}}else null==i||i()})))),this.rpc.onNotification.push(this.handleNotification.bind(this));try{this.logger.log("Connection to session:",this.session),yield this.rpc.connect(s)}catch(s){this.logger.log("Error connecting to session",this.session,s)}yield n}))}handleNotification(s){this.subscribers.filter((e=>{var i;return e.subscriptionID===(null===(i=s.params)||void 0===i?void 0:i.subscription)})).forEach((e=>{var i;return e.handler(null===(i=s.params)||void 0===i?void 0:i.result)}))}refresh(s){return o(this,void 0,void 0,(function*(){this.logger.log(`Started refreshing session "${s}"`);try{for(;;){if(!this.isOpen)return void this.logger.log("Cannot refresh session - it was closed",this.session);yield h(5e3);try{this.logger.log(`Refreshed session "${s}"`),yield u({sessionID:s,api_key:this.opts.apiKey})}catch(e){if(e instanceof u.Error){const i=e.getActualType();if(404===i.status)return void this.logger.error(`Error refreshing session - (${i.status}): ${i.data.message}`);this.logger.error(`Refreshing session "${s}" failed - (${i.status})`)}}}}finally{this.logger.log(`Stopped refreshing session "${s}"`),this.close()}}))}}{constructor(s){super(s),this.codeSnippetOpts=s.codeSnippet}open(){const s=Object.create(null,{open:{get:()=>super.open}});var e,i,t,r,l,d,h;return o(this,void 0,void 0,(function*(){yield s.open.call(this),yield Promise.all([(null===(e=this.codeSnippetOpts)||void 0===e?void 0:e.onStateChange)?this.subscribe(n,this.codeSnippetOpts.onStateChange,"state"):Promise.resolve(),(null===(i=this.codeSnippetOpts)||void 0===i?void 0:i.onStderr)?this.subscribe(n,this.codeSnippetOpts.onStderr,"stderr"):Promise.resolve(),(null===(t=this.codeSnippetOpts)||void 0===t?void 0:t.onStdout)?this.subscribe(n,this.codeSnippetOpts.onStdout,"stdout"):Promise.resolve(),(null===(r=this.codeSnippetOpts)||void 0===r?void 0:r.onDepsStdout)?this.subscribe(n,this.codeSnippetOpts.onDepsStdout,"depsStdout"):Promise.resolve(),(null===(l=this.codeSnippetOpts)||void 0===l?void 0:l.onDepsStderr)?this.subscribe(n,this.codeSnippetOpts.onDepsStderr,"depsStderr"):Promise.resolve(),(null===(d=this.codeSnippetOpts)||void 0===d?void 0:d.onDepsChange)?this.subscribe(n,this.codeSnippetOpts.onDepsChange,"depsChange"):Promise.resolve(),(null===(h=this.codeSnippetOpts)||void 0===h?void 0:h.onScanPorts)?this.subscribe(n,this.codeSnippetOpts.onScanPorts,"scanOpenedPorts"):Promise.resolve()]),this.codeSnippet={run:(s,e={})=>o(this,void 0,void 0,(function*(){var i,t;if(!this.isOpen||!this.session)throw new Error("Session is not active");const o=yield this.call("codeSnippet_run",[s,e]);return null===(t=null===(i=this.codeSnippetOpts)||void 0===i?void 0:i.onStateChange)||void 0===t||t.call(i,o),this.logger.log("Started running code",s),o})),stop:()=>o(this,void 0,void 0,(function*(){var s,e;if(!this.isOpen||!this.session)throw new Error("Session is not active");const i=yield this.call("codeSnippet_stop");return null===(e=null===(s=this.codeSnippetOpts)||void 0===s?void 0:s.onStateChange)||void 0===e||e.call(s,i),this.logger.log("Stopped running code"),i})),listDeps:()=>o(this,void 0,void 0,(function*(){if(!this.isOpen||!this.session)throw new Error("Session is not active");this.logger.log("Started listing deps");const s=yield this.call("codeSnippet_deps");return this.logger.log("Stopped listing deps",s),s})),installDep:s=>o(this,void 0,void 0,(function*(){if(!this.isOpen||!this.session)throw new Error("Session is not active");this.logger.log("Started installing dependency",s);const e=yield this.call("codeSnippet_installDep",[s]);return this.logger.log("Stopped installing dependency",e),e})),uninstallDep:s=>o(this,void 0,void 0,(function*(){if(!this.isOpen||!this.session)throw new Error("Session is not active");this.logger.log("Started uninstalling dependency",s);const e=yield this.call("codeSnippet_uninstallDep",[s]);return this.logger.log("Stopped uninstalling dependency",e),e}))},this.terminal={createSession:(s,e,i)=>o(this,void 0,void 0,(function*(){try{const t=yield this.call("terminal_start",[i||"",e.cols,e.rows]);if("string"!=typeof t)throw new Error("Cannot initialize terminal");const n=yield this.subscribe(c,s,"onData",t);return{destroy:()=>o(this,void 0,void 0,(function*(){yield this.unsubscribe(n),yield this.call("terminal_destroy",[t])})),sendData:s=>o(this,void 0,void 0,(function*(){yield this.call("terminal_data",[t,s])})),resize:({cols:s,rows:e})=>o(this,void 0,void 0,(function*(){yield this.call("terminal_resize",[t,s,e])}))}}catch(s){throw this.logger.error(s),new Error("Error starting terminal session",s)}}))}}))}},s.api=d,Object.defineProperty(s,"__esModule",{value:!0})}));
!function(s,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("rpc-websocket-client"),require("cross-fetch/polyfill"),require("openapi-typescript-fetch")):"function"==typeof define&&define.amd?define(["exports","rpc-websocket-client","cross-fetch/polyfill","openapi-typescript-fetch"],e):e((s="undefined"!=typeof globalThis?globalThis:s||self)["@devbookhq/sdk"]={},s.rpcWebsocketClient,null,s.openapiTypescriptFetch)}(this,(function(s,e,i,t){"use strict";function o(s,e,i,t){return new(i||(i=Promise))((function(o,n){function r(s){try{l(t.next(s))}catch(s){n(s)}}function c(s){try{l(t.throw(s))}catch(s){n(s)}}function l(s){var e;s.done?o(s.value):(e=s.value,e instanceof i?e:new i((function(s){s(e)}))).then(r,c)}l((t=t.apply(s,e||[])).next())}))}const n="codeSnippet";var r,c;s.CodeSnippetExecState=void 0,(r=s.CodeSnippetExecState||(s.CodeSnippetExecState={})).Running="Running",r.Stopped="Stopped",r.Loading="Loading",s.OutType=void 0,(c=s.OutType||(s.OutType={})).Stdout="Stdout",c.Stderr="Stderr";const l="terminal",h=t.Fetcher.for();function d(s){return new Promise((e=>setTimeout(e,s)))}h.configure({baseUrl:"https://ondevbook.com"});class a{constructor(s,e=!1){this.logID=s,this.isEnabled=e}id(){return"function"==typeof this.logID?this.logID():this.logID}log(...s){this.isEnabled&&console.log(`[${this.id()}]`,...s)}error(...s){console.error(`[${this.id()} ERROR]`,...s)}}const p=h.path("/sessions").method("post").create({api_key:!0}),u=h.path("/sessions/{sessionID}/refresh").method("post").create({api_key:!0});s.Session=class extends class{constructor(s){this.opts=s,this.isOpen=!1,this.rpc=new e.RpcWebSocketClient,this.subscribers=[],this.logger=new a("Session",s.debug),this.logger.log(`Session for code snippet "${s.id}" initialized`)}call(s,e){return o(this,void 0,void 0,(function*(){return this.rpc.call(s,e)}))}unsubscribe(s){return o(this,void 0,void 0,(function*(){const e=this.subscribers.find((e=>e.subscriptionID===s));e&&(yield this.call(`${e.method}_unsubscribe`,[null==e?void 0:e.subscriptionID]),this.subscribers=this.subscribers.filter((s=>s!==e)),this.logger.log(`Unsubscribed from "${e.method}"`))}))}subscribe(s,e,...i){return o(this,void 0,void 0,(function*(){const t=yield this.call(`${s}_subscribe`,i);if("string"!=typeof t)throw new Error(`Cannot subscribe to ${s} with params ${i}. Expected response to be a subscription ID, instead got ${JSON.stringify(t)}`);return this.subscribers.push({subscriptionID:t,handler:e,method:s}),this.logger.log(`Subscribed to "${s}_${i}" with id "${t}"`),t}))}getHostname(s){if(!this.isOpen||!this.session)throw new Error("Session is not active");const e=`${this.session.sessionID}-${this.session.clientID}.ondevbook.com`;return s?`${s}-${e}`:e}close(){var s,e,i;return o(this,void 0,void 0,(function*(){if(this.isOpen){this.logger.log("Closing",this.session),this.isOpen=!1,this.logger.log("Unsubscribing...");(yield Promise.allSettled(this.subscribers.map((s=>this.unsubscribe(s.subscriptionID))))).forEach((s=>{"rejected"===s.status&&this.logger.log(`Failed to unsubscribe: "${s.reason}"`)})),null===(s=this.rpc.ws)||void 0===s||s.close(),null===(i=null===(e=this.opts)||void 0===e?void 0:e.onClose)||void 0===i||i.call(e),this.logger.log("Disconected from the session")}}))}open(){return o(this,void 0,void 0,(function*(){if(this.isOpen||this.session)throw new Error("Session connect was already called");this.isOpen=!0;try{const s=yield p({codeSnippetID:this.opts.id,editEnabled:this.opts.editEnabled,api_key:this.opts.apiKey});this.session=s.data,this.logger.log("Aquired session:",this.session),this.refresh(this.session.sessionID)}catch(s){if(s instanceof p.Error){const e=s.getActualType();if(400===e.status)throw new Error(`Error creating session - (${e.status}) bad request: ${e.data.message}`);if(401===e.status)throw new Error(`Error creating session - (${e.status}) unauthenticated (you need to be authenticated to start an session with persistent edits): ${e.data.message}`);if(500===e.status)throw new Error(`Error creating session - (${e.status}) server error: ${e.data.message}`);throw s}}if(!this.session)throw new Error("Session is not defined");const s=`wss://${this.getHostname(8010)}/ws`;this.rpc.onError((s=>{this.logger.log("Error in WS session:",this.session,s)}));let e,i,t=!1;const n=new Promise(((s,o)=>{e=()=>{t||(t=!0,s())},i=()=>{t||(t=!0,o())}}));this.rpc.onOpen((()=>{this.logger.log("Connected to session:",this.session),null==e||e()})),this.rpc.onClose((e=>o(this,void 0,void 0,(function*(){if(this.logger.log("Closing WS connection to session:",this.session,e),this.isOpen){yield d(100),this.logger.log("Reconnecting to session:",this.session);try{yield this.rpc.connect(s),this.logger.log("Reconnected to session:",this.session)}catch(s){this.logger.log("Failed reconnecting to session:",this.session,s)}}else null==i||i()})))),this.rpc.onNotification.push(this.handleNotification.bind(this));try{this.logger.log("Connection to session:",this.session),yield this.rpc.connect(s)}catch(s){this.logger.log("Error connecting to session",this.session,s)}yield n}))}handleNotification(s){this.subscribers.filter((e=>{var i;return e.subscriptionID===(null===(i=s.params)||void 0===i?void 0:i.subscription)})).forEach((e=>{var i;return e.handler(null===(i=s.params)||void 0===i?void 0:i.result)}))}refresh(s){return o(this,void 0,void 0,(function*(){this.logger.log(`Started refreshing session "${s}"`);try{for(;;){if(!this.isOpen)return void this.logger.log("Cannot refresh session - it was closed",this.session);yield d(5e3);try{this.logger.log(`Refreshed session "${s}"`),yield u({sessionID:s,api_key:this.opts.apiKey})}catch(e){if(e instanceof u.Error){const i=e.getActualType();if(404===i.status)return void this.logger.error(`Error refreshing session - (${i.status}): ${i.data.message}`);this.logger.error(`Refreshing session "${s}" failed - (${i.status})`)}}}}finally{this.logger.log(`Stopped refreshing session "${s}"`),this.close()}}))}}{constructor(s){super(s),this.codeSnippetOpts=s.codeSnippet}open(){const s=Object.create(null,{open:{get:()=>super.open}});var e,i,t,r;return o(this,void 0,void 0,(function*(){yield s.open.call(this),yield Promise.all([(null===(e=this.codeSnippetOpts)||void 0===e?void 0:e.onStateChange)?this.subscribe(n,this.codeSnippetOpts.onStateChange,"state"):Promise.resolve(),(null===(i=this.codeSnippetOpts)||void 0===i?void 0:i.onStderr)?this.subscribe(n,this.codeSnippetOpts.onStderr,"stderr"):Promise.resolve(),(null===(t=this.codeSnippetOpts)||void 0===t?void 0:t.onStdout)?this.subscribe(n,this.codeSnippetOpts.onStdout,"stdout"):Promise.resolve(),(null===(r=this.codeSnippetOpts)||void 0===r?void 0:r.onScanPorts)?this.subscribe(n,this.codeSnippetOpts.onScanPorts,"scanOpenedPorts"):Promise.resolve()]),this.codeSnippet={run:(s,e={})=>o(this,void 0,void 0,(function*(){var i,t;if(!this.isOpen||!this.session)throw new Error("Session is not active");const o=yield this.call("codeSnippet_run",[s,e]);return null===(t=null===(i=this.codeSnippetOpts)||void 0===i?void 0:i.onStateChange)||void 0===t||t.call(i,o),this.logger.log("Started running code",s),o})),stop:()=>o(this,void 0,void 0,(function*(){var s,e;if(!this.isOpen||!this.session)throw new Error("Session is not active");const i=yield this.call("codeSnippet_stop");return null===(e=null===(s=this.codeSnippetOpts)||void 0===s?void 0:s.onStateChange)||void 0===e||e.call(s,i),this.logger.log("Stopped running code"),i}))},this.terminal={createSession:(s,e,i)=>o(this,void 0,void 0,(function*(){try{const t=yield this.call("terminal_start",[i||"",e.cols,e.rows]);if("string"!=typeof t)throw new Error("Cannot initialize terminal");const n=yield this.subscribe(l,s,"onData",t);return{destroy:()=>o(this,void 0,void 0,(function*(){yield this.unsubscribe(n),yield this.call("terminal_destroy",[t])})),sendData:s=>o(this,void 0,void 0,(function*(){yield this.call("terminal_data",[t,s])})),resize:({cols:s,rows:e})=>o(this,void 0,void 0,(function*(){yield this.call("terminal_resize",[t,s,e])}))}}catch(s){throw this.logger.error(s),new Error("Error starting terminal session",s)}}))}}))}},s.api=h,Object.defineProperty(s,"__esModule",{value:!0})}));
//# sourceMappingURL=index.js.map

@@ -7,5 +7,2 @@ export declare const codeSnippetMethod = "codeSnippet";

}
export interface DepsErrorResponse {
error: string;
}
export declare enum OutType {

@@ -29,11 +26,2 @@ Stdout = "Stdout",

}
export interface DepOutResponse extends OutResponse {
dep: string;
}
export interface DepStdoutResponse extends DepOutResponse {
type: OutType.Stdout;
}
export interface DepStderrResponse extends DepOutResponse {
type: OutType.Stderr;
}
export interface OpenedPort {

@@ -47,7 +35,4 @@ State: string;

export declare type CodeSnippetStdoutHandler = (o: OutStdoutResponse) => void;
export declare type DepsStdoutHandler = (o: DepStdoutResponse) => void;
export declare type DepsStderrHandler = (o: DepStderrResponse) => void;
export declare type DepsChangeHandler = (deps: string[]) => void;
export declare type ScanOpenedPortsHandler = (ports: OpenedPort[]) => void;
export declare type CodeSnippetSubscriptionHandler = CodeSnippetStateHandler | CodeSnippetStderrHandler | CodeSnippetStdoutHandler | DepsStderrHandler | DepsStderrHandler | DepsChangeHandler | ScanOpenedPortsHandler;
export declare type CodeSnippetSubscriptionHandler = CodeSnippetStateHandler | CodeSnippetStderrHandler | CodeSnippetStdoutHandler | ScanOpenedPortsHandler;
export declare type CodeSnippetSubscriptionHandlerType = {

@@ -57,5 +42,2 @@ 'state': CodeSnippetStateHandler;

'stdout': CodeSnippetStdoutHandler;
'depsStdout': DepsStdoutHandler;
'depsStderr': DepsStderrHandler;
'depsChange': DepsChangeHandler;
'scanOpenedPorts': ScanOpenedPortsHandler;

@@ -66,5 +48,2 @@ };

readonly stop: () => Promise<CodeSnippetExecState>;
readonly listDeps: () => Promise<string[]>;
readonly installDep: (dep: string) => Promise<DepsErrorResponse>;
readonly uninstallDep: (dep: string) => Promise<DepsErrorResponse>;
}

@@ -1,2 +0,2 @@

import { CodeSnippetManager, CodeSnippetStateHandler, CodeSnippetStderrHandler, CodeSnippetStdoutHandler, DepsStdoutHandler, DepsStderrHandler, DepsChangeHandler, ScanOpenedPortsHandler } from './codeSnippet';
import { CodeSnippetManager, CodeSnippetStateHandler, CodeSnippetStderrHandler, CodeSnippetStdoutHandler, ScanOpenedPortsHandler } from './codeSnippet';
import { TerminalManager } from './terminal';

@@ -8,5 +8,2 @@ import SessionConnection, { SessionConnectionOpts } from './sessionConnection';

onStdout?: CodeSnippetStdoutHandler;
onDepsStdout?: DepsStdoutHandler;
onDepsStderr?: DepsStderrHandler;
onDepsChange?: DepsChangeHandler;
onScanPorts?: ScanOpenedPortsHandler;

@@ -13,0 +10,0 @@ }

{
"name": "@devbookhq/sdk",
"version": "2.3.9",
"version": "2.3.11",
"description": "Devbook allows visitors of your docs to interact with and execute any code snippet or shell command in a private VM",

@@ -5,0 +5,0 @@ "homepage": "https://usedevbook.com",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet