Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@holochain/conductor-api

Package Overview
Dependencies
Maintainers
13
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@holochain/conductor-api - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

lib.es/environments/launcher.d.ts

5

lib.es/api/admin.d.ts

@@ -48,2 +48,6 @@ /// <reference types="node" />

export declare type InstallAppResponse = InstalledAppInfo;
export declare type UninstallAppRequest = {
installed_app_id: InstalledAppId;
};
export declare type UninstallAppResponse = null;
export declare type CreateCloneCellRequest = {

@@ -163,2 +167,3 @@ properties?: DnaProperties;

installApp: Requester<InstallAppRequest, InstallAppResponse>;
uninstallApp: Requester<UninstallAppRequest, UninstallAppResponse>;
createCloneCell: Requester<CreateCloneCellRequest, CreateCloneCellResponse>;

@@ -165,0 +170,0 @@ installAppBundle: Requester<InstallAppBundleRequest, InstallAppBundleResponse>;

1

lib.es/websocket/admin.d.ts

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

installApp: Requester<Api.InstallAppRequest, Api.InstallAppResponse>;
uninstallApp: Requester<Api.UninstallAppRequest, Api.UninstallAppResponse>;
installAppBundle: Requester<Api.InstallAppBundleRequest, Api.InstallAppBundleResponse>;

@@ -38,0 +39,0 @@ createCloneCell: Requester<Api.CreateCloneCellRequest, Api.CreateCloneCellResponse>;

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

import { requesterTransformer } from '../api/common';
import { getLauncherEnvironment } from '../environments/launcher';
export class AdminWebsocket {

@@ -48,2 +49,3 @@ constructor(client, defaultTimeout) {

this.installApp = this._requester('install_app');
this.uninstallApp = this._requester('uninstall_app');
this.installAppBundle = this._requester('install_app_bundle');

@@ -64,2 +66,7 @@ this.createCloneCell = this._requester('create_clone_cell');

return __awaiter(this, void 0, void 0, function* () {
// Check if we are in the launcher's environment, and if so, redirect the url to connect to
const env = yield getLauncherEnvironment();
if (env) {
url = `ws://localhost:${env.ADMIN_INTERFACE_PORT}`;
}
const wsClient = yield WsClient.connect(url);

@@ -66,0 +73,0 @@ return new AdminWebsocket(wsClient, defaultTimeout);

3

lib.es/websocket/app.d.ts

@@ -5,5 +5,6 @@ import { AppApi, AppInfoRequest, AppInfoResponse, CallZomeRequestGeneric, CallZomeResponseGeneric, AppSignalCb } from '../api/app';

export declare class AppWebsocket implements AppApi {
protected overrideInstalledAppId?: string | undefined;
client: WsClient;
defaultTimeout: number;
constructor(client: WsClient, defaultTimeout?: number);
constructor(client: WsClient, defaultTimeout?: number, overrideInstalledAppId?: string | undefined);
static connect(url: string, defaultTimeout?: number, signalCb?: AppSignalCb): Promise<AppWebsocket>;

@@ -10,0 +11,0 @@ _requester: <ReqO, ReqI, ResI, ResO>(tag: string, transformer?: Transformer<ReqO, ReqI, ResI, ResO> | undefined) => (req: ReqO, timeout?: number | undefined) => Promise<ResO>;

@@ -31,6 +31,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import { requesterTransformer } from '../api/common';
import { getLauncherEnvironment } from '../environments/launcher';
export class AppWebsocket {
constructor(client, defaultTimeout) {
constructor(client, defaultTimeout, overrideInstalledAppId) {
this.overrideInstalledAppId = overrideInstalledAppId;
this._requester = (tag, transformer) => requesterTransformer((req, timeout) => promiseTimeout(this.client.request(req), tag, timeout || this.defaultTimeout).then(catchError), tag, transformer);
this.appInfo = this._requester('app_info');
this.appInfo = this._requester('app_info', appInfoTransform(this.overrideInstalledAppId));
this.callZome = this._requester('zome_call_invocation', callZomeTransform);

@@ -42,4 +44,9 @@ this.client = client;

return __awaiter(this, void 0, void 0, function* () {
// Check if we are in the launcher's environment, and if so, redirect the url to connect to
const env = yield getLauncherEnvironment();
if (env) {
url = `ws://localhost:${env.APP_INTERFACE_PORT}`;
}
const wsClient = yield WsClient.connect(url, signalCb);
return new AppWebsocket(wsClient, defaultTimeout);
return new AppWebsocket(wsClient, defaultTimeout, env ? env.INSTALLED_APP_ID : undefined);
});

@@ -56,2 +63,15 @@ }

};
const appInfoTransform = (overrideInstalledAppId) => ({
input: (req) => {
if (overrideInstalledAppId) {
return {
installed_app_id: overrideInstalledAppId
};
}
return req;
},
output: (res) => {
return res;
}
});
//# sourceMappingURL=app.js.map

@@ -48,2 +48,6 @@ /// <reference types="node" />

export declare type InstallAppResponse = InstalledAppInfo;
export declare type UninstallAppRequest = {
installed_app_id: InstalledAppId;
};
export declare type UninstallAppResponse = null;
export declare type CreateCloneCellRequest = {

@@ -163,2 +167,3 @@ properties?: DnaProperties;

installApp: Requester<InstallAppRequest, InstallAppResponse>;
uninstallApp: Requester<UninstallAppRequest, UninstallAppResponse>;
createCloneCell: Requester<CreateCloneCellRequest, CreateCloneCellResponse>;

@@ -165,0 +170,0 @@ installAppBundle: Requester<InstallAppBundleRequest, InstallAppBundleResponse>;

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

installApp: Requester<Api.InstallAppRequest, Api.InstallAppResponse>;
uninstallApp: Requester<Api.UninstallAppRequest, Api.UninstallAppResponse>;
installAppBundle: Requester<Api.InstallAppBundleRequest, Api.InstallAppBundleResponse>;

@@ -38,0 +39,0 @@ createCloneCell: Requester<Api.CreateCloneCellRequest, Api.CreateCloneCellResponse>;

@@ -52,2 +52,3 @@ "use strict";

const common_2 = require("../api/common");
const launcher_1 = require("../environments/launcher");
class AdminWebsocket {

@@ -70,2 +71,3 @@ constructor(client, defaultTimeout) {

this.installApp = this._requester('install_app');
this.uninstallApp = this._requester('uninstall_app');
this.installAppBundle = this._requester('install_app_bundle');

@@ -86,2 +88,7 @@ this.createCloneCell = this._requester('create_clone_cell');

return __awaiter(this, void 0, void 0, function* () {
// Check if we are in the launcher's environment, and if so, redirect the url to connect to
const env = yield launcher_1.getLauncherEnvironment();
if (env) {
url = `ws://localhost:${env.ADMIN_INTERFACE_PORT}`;
}
const wsClient = yield client_1.WsClient.connect(url);

@@ -88,0 +95,0 @@ return new AdminWebsocket(wsClient, defaultTimeout);

@@ -5,5 +5,6 @@ import { AppApi, AppInfoRequest, AppInfoResponse, CallZomeRequestGeneric, CallZomeResponseGeneric, AppSignalCb } from '../api/app';

export declare class AppWebsocket implements AppApi {
protected overrideInstalledAppId?: string | undefined;
client: WsClient;
defaultTimeout: number;
constructor(client: WsClient, defaultTimeout?: number);
constructor(client: WsClient, defaultTimeout?: number, overrideInstalledAppId?: string | undefined);
static connect(url: string, defaultTimeout?: number, signalCb?: AppSignalCb): Promise<AppWebsocket>;

@@ -10,0 +11,0 @@ _requester: <ReqO, ReqI, ResI, ResO>(tag: string, transformer?: Transformer<ReqO, ReqI, ResI, ResO> | undefined) => (req: ReqO, timeout?: number | undefined) => Promise<ResO>;

@@ -34,6 +34,8 @@ "use strict";

const common_2 = require("../api/common");
const launcher_1 = require("../environments/launcher");
class AppWebsocket {
constructor(client, defaultTimeout) {
constructor(client, defaultTimeout, overrideInstalledAppId) {
this.overrideInstalledAppId = overrideInstalledAppId;
this._requester = (tag, transformer) => common_2.requesterTransformer((req, timeout) => common_1.promiseTimeout(this.client.request(req), tag, timeout || this.defaultTimeout).then(common_1.catchError), tag, transformer);
this.appInfo = this._requester('app_info');
this.appInfo = this._requester('app_info', appInfoTransform(this.overrideInstalledAppId));
this.callZome = this._requester('zome_call_invocation', callZomeTransform);

@@ -45,4 +47,9 @@ this.client = client;

return __awaiter(this, void 0, void 0, function* () {
// Check if we are in the launcher's environment, and if so, redirect the url to connect to
const env = yield launcher_1.getLauncherEnvironment();
if (env) {
url = `ws://localhost:${env.APP_INTERFACE_PORT}`;
}
const wsClient = yield client_1.WsClient.connect(url, signalCb);
return new AppWebsocket(wsClient, defaultTimeout);
return new AppWebsocket(wsClient, defaultTimeout, env ? env.INSTALLED_APP_ID : undefined);
});

@@ -60,2 +67,15 @@ }

};
const appInfoTransform = (overrideInstalledAppId) => ({
input: (req) => {
if (overrideInstalledAppId) {
return {
installed_app_id: overrideInstalledAppId
};
}
return req;
},
output: (res) => {
return res;
}
});
//# sourceMappingURL=app.js.map
{
"name": "@holochain/conductor-api",
"version": "0.2.0",
"version": "0.2.1",
"description": "Encode/decode messages to/from the Holochain Conductor API over Websocket",

@@ -18,7 +18,7 @@ "repository": {

"scripts": {
"build": "rm -rf ./lib ./dist && tsc -d && tsc --outDir lib.es --module es2015",
"dev": "rm -rf ./lib && tsc -d -w",
"build": "rimraf ./lib ./dist && tsc -d && tsc --outDir lib.es --module es2015",
"dev": "rimraf ./lib && tsc -d -w",
"doc": "typedoc",
"prepare": "npm run build",
"prepublishOnly": "echo 'test'",
"prepublishOnly": "npm test",
"test": "npm run test:raw | tap-diff",

@@ -32,5 +32,6 @@ "test:raw": "RUST_LOG=error RUST_BACKTRACE=1 ts-node test",

"@types/ws": "^7.2.4",
"cross-fetch": "^3.1.4",
"isomorphic-ws": "^4.0.1",
"nanoid": "^3.1.9",
"ws": "^7.3.0"
"ws": "^7.4.6"
},

@@ -41,3 +42,4 @@ "devDependencies": {

"js-yaml": "^3.14.0",
"tap-diff": "^0.1.1",
"rimraf": "^3.0.2",
"@detools/tap-diff": "^0.2.2",
"tape": "^5.0",

@@ -44,0 +46,0 @@ "ts-node": "^8.10.2",

@@ -63,4 +63,4 @@ # holochain/conductor-api

This version of `holochain-conductor-api` is currently working with
- `holochain/holochain` at commit: [c5dbdf28825927106bc32d186dd54f20d35df468](https://github.com/holochain/holochain/commit/c5dbdf28825927106bc32d186dd54f20d35df468)
- hdk version 0.0.101 from crates.io
- `holochain/holochain` at commit: [221f3424a919224dcf1950d1059e8b88aba08f7b](https://github.com/holochain/holochain/commit/221f3424a919224dcf1950d1059e8b88aba08f7b)
- hdk version 0.0.107 from crates.io

@@ -67,0 +67,0 @@ If updating this code, please make changes to the git `rev/sha` in 2 places:

@@ -59,2 +59,7 @@ import { Requester } from "./common";

export type UninstallAppRequest = {
installed_app_id: InstalledAppId;
};
export type UninstallAppResponse = null;
export type CreateCloneCellRequest = {

@@ -221,2 +226,3 @@ /// Properties to override when installing this Dna

installApp: Requester<InstallAppRequest, InstallAppResponse>;
uninstallApp: Requester<UninstallAppRequest, UninstallAppResponse>;
createCloneCell: Requester<CreateCloneCellRequest, CreateCloneCellResponse>;

@@ -223,0 +229,0 @@ installAppBundle: Requester<

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

import {ListAppInterfacesRequest} from "../api/admin";
import { getLauncherEnvironment } from '../environments/launcher';

@@ -35,2 +36,9 @@ export class AdminWebsocket implements Api.AdminApi {

static async connect(url: string, defaultTimeout?: number): Promise<AdminWebsocket> {
// Check if we are in the launcher's environment, and if so, redirect the url to connect to
const env = await getLauncherEnvironment()
if (env) {
url = `ws://localhost:${env.ADMIN_INTERFACE_PORT}`
}
const wsClient = await WsClient.connect(url)

@@ -71,2 +79,4 @@ return new AdminWebsocket(wsClient, defaultTimeout)

= this._requester('install_app')
uninstallApp: Requester<Api.UninstallAppRequest, Api.UninstallAppResponse>
= this._requester('uninstall_app')
installAppBundle: Requester<Api.InstallAppBundleRequest, Api.InstallAppBundleResponse>

@@ -94,5 +104,5 @@ = this._requester('install_app_bundle')

interface InternalListAppsRequest {
status_filter?:
{Running: null}
| {Enabled: null}
status_filter?:
{Running: null}
| {Enabled: null}
| {Paused: null}

@@ -146,2 +156,2 @@ | {Disabled: null}

}
}
}

@@ -24,2 +24,4 @@ /**

import { Transformer, requesterTransformer, Requester } from '../api/common'
import { getLauncherEnvironment } from '../environments/launcher';
import { InstalledAppId } from '../api/types';

@@ -30,3 +32,3 @@ export class AppWebsocket implements AppApi {

constructor(client: WsClient, defaultTimeout?: number) {
constructor(client: WsClient, defaultTimeout?: number, protected overrideInstalledAppId?: InstalledAppId) {
this.client = client

@@ -37,4 +39,11 @@ this.defaultTimeout = defaultTimeout === undefined ? DEFAULT_TIMEOUT : defaultTimeout

static async connect(url: string, defaultTimeout?: number, signalCb?: AppSignalCb): Promise<AppWebsocket> {
// Check if we are in the launcher's environment, and if so, redirect the url to connect to
const env = await getLauncherEnvironment()
if (env) {
url = `ws://localhost:${env.APP_INTERFACE_PORT}`
}
const wsClient = await WsClient.connect(url, signalCb)
return new AppWebsocket(wsClient, defaultTimeout)
return new AppWebsocket(wsClient, defaultTimeout, env ? env.INSTALLED_APP_ID: undefined)
}

@@ -50,3 +59,3 @@

appInfo: Requester<AppInfoRequest, AppInfoResponse>
= this._requester('app_info')
= this._requester('app_info', appInfoTransform(this.overrideInstalledAppId))
callZome: Requester<CallZomeRequestGeneric<any>, CallZomeResponseGeneric<any>>

@@ -67,1 +76,16 @@ = this._requester('zome_call_invocation', callZomeTransform)

}
const appInfoTransform = (overrideInstalledAppId?: InstalledAppId): Transformer<AppInfoRequest, AppInfoRequest, AppInfoResponse, AppInfoResponse> => ({
input: (req: AppInfoRequest): AppInfoRequest => {
if (overrideInstalledAppId) {
return {
installed_app_id: overrideInstalledAppId
};
}
return req
},
output: (res: AppInfoResponse): AppInfoResponse => {
return res
}
})

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc