@holochain/conductor-api
Advanced tools
Comparing version 0.1.1 to 0.2.0
/// <reference types="node" /> | ||
import { Requester } from "./common"; | ||
import { HoloHash, AgentPubKey, MembraneProof, DnaProperties, InstalledAppId, CellId, CellNick, InstalledAppInfo, SlotId } from "./types"; | ||
export declare type ActivateAppRequest = { | ||
installed_app_id: InstalledAppId; | ||
}; | ||
export declare type ActivateAppResponse = InstalledAppInfo; | ||
export declare type AttachAppInterfaceRequest = { | ||
@@ -14,2 +10,4 @@ port: number; | ||
}; | ||
export declare type ActivateAppRequest = EnableAppRequest; | ||
export declare type ActivateAppResponse = EnableAppResponse; | ||
export declare type DeactivateAppRequest = { | ||
@@ -19,2 +17,17 @@ installed_app_id: InstalledAppId; | ||
export declare type DeactivateAppResponse = null; | ||
export declare type EnableAppRequest = { | ||
installed_app_id: InstalledAppId; | ||
}; | ||
export declare type EnableAppResponse = { | ||
app: InstalledAppInfo; | ||
errors: Array<[CellId, String]>; | ||
}; | ||
export declare type DisableAppRequest = { | ||
installed_app_id: InstalledAppId; | ||
}; | ||
export declare type DisableAppResponse = null; | ||
export declare type StartAppRequest = { | ||
installed_app_id: InstalledAppId; | ||
}; | ||
export declare type StartAppResponse = Boolean; | ||
export declare type DumpStateRequest = { | ||
@@ -119,4 +132,7 @@ cell_id: CellId; | ||
export declare enum AppStatusFilter { | ||
Active = "active", | ||
Inactive = "inactive" | ||
Enabled = "enabled", | ||
Disabled = "disabled", | ||
Running = "running", | ||
Stopped = "stopped", | ||
Paused = "paused" | ||
} | ||
@@ -139,5 +155,8 @@ export declare type ListAppsRequest = { | ||
export interface AdminApi { | ||
attachAppInterface: Requester<AttachAppInterfaceRequest, AttachAppInterfaceResponse>; | ||
activateApp: Requester<ActivateAppRequest, ActivateAppResponse>; | ||
attachAppInterface: Requester<AttachAppInterfaceRequest, AttachAppInterfaceResponse>; | ||
deactivateApp: Requester<DeactivateAppRequest, DeactivateAppResponse>; | ||
enableApp: Requester<EnableAppRequest, EnableAppResponse>; | ||
disableApp: Requester<DisableAppRequest, DisableAppResponse>; | ||
startApp: Requester<StartAppRequest, StartAppResponse>; | ||
dumpState: Requester<DumpStateRequest, DumpStateResponse>; | ||
@@ -144,0 +163,0 @@ generateAgentPubKey: Requester<GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse>; |
export var AppStatusFilter; | ||
(function (AppStatusFilter) { | ||
AppStatusFilter["Active"] = "active"; | ||
AppStatusFilter["Inactive"] = "inactive"; | ||
AppStatusFilter["Enabled"] = "enabled"; | ||
AppStatusFilter["Disabled"] = "disabled"; | ||
AppStatusFilter["Running"] = "running"; | ||
AppStatusFilter["Stopped"] = "stopped"; | ||
AppStatusFilter["Paused"] = "paused"; | ||
})(AppStatusFilter || (AppStatusFilter = {})); | ||
; | ||
//# sourceMappingURL=admin.js.map |
@@ -23,8 +23,22 @@ /// <reference types="node" /> | ||
}; | ||
export declare type InstalledAppStatus = { | ||
inactive: { | ||
reason: DeactivationReason; | ||
export declare type PausedAppReason = { | ||
error: string; | ||
}; | ||
export declare type DisabledAppReason = { | ||
never_started: null; | ||
} | { | ||
user: null; | ||
} | { | ||
error: string; | ||
}; | ||
export declare type InstalledAppInfoStatus = { | ||
paused: { | ||
reason: PausedAppReason; | ||
}; | ||
} | { | ||
active: null; | ||
disabled: { | ||
reason: DisabledAppReason; | ||
}; | ||
} | { | ||
running: null; | ||
}; | ||
@@ -34,5 +48,5 @@ export declare type InstalledAppInfo = { | ||
cell_data: Array<InstalledCell>; | ||
status: InstalledAppStatus; | ||
status: InstalledAppInfoStatus; | ||
}; | ||
export declare type MembraneProof = Buffer; | ||
export declare const fakeAgentPubKey: (x: any) => Buffer; |
@@ -1,4 +0,4 @@ | ||
export const fakeAgentPubKey = (x) => Buffer.from([0x84, 0x20, 0x24].concat('000000000000000000000000000000000000' | ||
.split('') | ||
export const fakeAgentPubKey = (x) => Buffer.from([0x84, 0x20, 0x24].concat("000000000000000000000000000000000000" | ||
.split("") | ||
.map((x) => parseInt(x, 10)))); | ||
//# sourceMappingURL=types.js.map |
@@ -26,5 +26,8 @@ /** | ||
_requester: <ReqO, ReqI, ResI, ResO>(tag: string, transformer?: Transformer<ReqO, ReqI, ResI, ResO> | undefined) => (req: ReqO, timeout?: number | undefined) => Promise<ResO>; | ||
attachAppInterface: Requester<Api.AttachAppInterfaceRequest, Api.AttachAppInterfaceResponse>; | ||
activateApp: Requester<Api.ActivateAppRequest, Api.ActivateAppResponse>; | ||
attachAppInterface: Requester<Api.AttachAppInterfaceRequest, Api.AttachAppInterfaceResponse>; | ||
deactivateApp: Requester<Api.DeactivateAppRequest, Api.DeactivateAppResponse>; | ||
enableApp: Requester<Api.EnableAppRequest, Api.EnableAppResponse>; | ||
disableApp: Requester<Api.DisableAppRequest, Api.DisableAppResponse>; | ||
startApp: Requester<Api.StartAppRequest, Api.StartAppResponse>; | ||
dumpState: Requester<Api.DumpStateRequest, Api.DumpStateResponse>; | ||
@@ -31,0 +34,0 @@ generateAgentPubKey: Requester<Api.GenerateAgentPubKeyRequest, Api.GenerateAgentPubKeyResponse>; |
@@ -35,5 +35,10 @@ /** | ||
// which this class implements | ||
this.attachAppInterface = this._requester('attach_app_interface'); | ||
// Deprecated | ||
this.activateApp = this._requester('activate_app'); | ||
this.attachAppInterface = this._requester('attach_app_interface'); | ||
// Deprecated | ||
this.deactivateApp = this._requester('deactivate_app'); | ||
this.enableApp = this._requester('enable_app'); | ||
this.disableApp = this._requester('disable_app'); | ||
this.startApp = this._requester('start_app'); | ||
this.dumpState = this._requester('dump_state', dumpStateTransform); | ||
@@ -47,2 +52,3 @@ this.generateAgentPubKey = this._requester('generate_agent_pub_key'); | ||
this.listCellIds = this._requester('list_cell_ids'); | ||
// Deprecated | ||
this.listActiveApps = this._requester('list_active_apps'); | ||
@@ -67,3 +73,3 @@ this.listApps = this._requester('list_apps', listAppsTransform); | ||
if (req.status_filter) { | ||
args.status_filter = req.status_filter === Api.AppStatusFilter.Active ? { Active: null } : { Inactive: null }; | ||
args.status_filter = getAppStatusInApiForm(req.status_filter); | ||
} | ||
@@ -80,2 +86,26 @@ return args; | ||
}; | ||
function getAppStatusInApiForm(status_filter) { | ||
switch (status_filter) { | ||
case Api.AppStatusFilter.Running: | ||
return { | ||
Running: null | ||
}; | ||
case Api.AppStatusFilter.Enabled: | ||
return { | ||
Enabled: null | ||
}; | ||
case Api.AppStatusFilter.Paused: | ||
return { | ||
Paused: null | ||
}; | ||
case Api.AppStatusFilter.Disabled: | ||
return { | ||
Disabled: null | ||
}; | ||
case Api.AppStatusFilter.Stopped: | ||
return { | ||
Stopped: null | ||
}; | ||
} | ||
} | ||
//# sourceMappingURL=admin.js.map |
/// <reference types="node" /> | ||
import { Requester } from "./common"; | ||
import { HoloHash, AgentPubKey, MembraneProof, DnaProperties, InstalledAppId, CellId, CellNick, InstalledAppInfo, SlotId } from "./types"; | ||
export declare type ActivateAppRequest = { | ||
installed_app_id: InstalledAppId; | ||
}; | ||
export declare type ActivateAppResponse = InstalledAppInfo; | ||
export declare type AttachAppInterfaceRequest = { | ||
@@ -14,2 +10,4 @@ port: number; | ||
}; | ||
export declare type ActivateAppRequest = EnableAppRequest; | ||
export declare type ActivateAppResponse = EnableAppResponse; | ||
export declare type DeactivateAppRequest = { | ||
@@ -19,2 +17,17 @@ installed_app_id: InstalledAppId; | ||
export declare type DeactivateAppResponse = null; | ||
export declare type EnableAppRequest = { | ||
installed_app_id: InstalledAppId; | ||
}; | ||
export declare type EnableAppResponse = { | ||
app: InstalledAppInfo; | ||
errors: Array<[CellId, String]>; | ||
}; | ||
export declare type DisableAppRequest = { | ||
installed_app_id: InstalledAppId; | ||
}; | ||
export declare type DisableAppResponse = null; | ||
export declare type StartAppRequest = { | ||
installed_app_id: InstalledAppId; | ||
}; | ||
export declare type StartAppResponse = Boolean; | ||
export declare type DumpStateRequest = { | ||
@@ -119,4 +132,7 @@ cell_id: CellId; | ||
export declare enum AppStatusFilter { | ||
Active = "active", | ||
Inactive = "inactive" | ||
Enabled = "enabled", | ||
Disabled = "disabled", | ||
Running = "running", | ||
Stopped = "stopped", | ||
Paused = "paused" | ||
} | ||
@@ -139,5 +155,8 @@ export declare type ListAppsRequest = { | ||
export interface AdminApi { | ||
attachAppInterface: Requester<AttachAppInterfaceRequest, AttachAppInterfaceResponse>; | ||
activateApp: Requester<ActivateAppRequest, ActivateAppResponse>; | ||
attachAppInterface: Requester<AttachAppInterfaceRequest, AttachAppInterfaceResponse>; | ||
deactivateApp: Requester<DeactivateAppRequest, DeactivateAppResponse>; | ||
enableApp: Requester<EnableAppRequest, EnableAppResponse>; | ||
disableApp: Requester<DisableAppRequest, DisableAppResponse>; | ||
startApp: Requester<StartAppRequest, StartAppResponse>; | ||
dumpState: Requester<DumpStateRequest, DumpStateResponse>; | ||
@@ -144,0 +163,0 @@ generateAgentPubKey: Requester<GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse>; |
@@ -6,6 +6,8 @@ "use strict"; | ||
(function (AppStatusFilter) { | ||
AppStatusFilter["Active"] = "active"; | ||
AppStatusFilter["Inactive"] = "inactive"; | ||
AppStatusFilter["Enabled"] = "enabled"; | ||
AppStatusFilter["Disabled"] = "disabled"; | ||
AppStatusFilter["Running"] = "running"; | ||
AppStatusFilter["Stopped"] = "stopped"; | ||
AppStatusFilter["Paused"] = "paused"; | ||
})(AppStatusFilter = exports.AppStatusFilter || (exports.AppStatusFilter = {})); | ||
; | ||
//# sourceMappingURL=admin.js.map |
@@ -23,8 +23,22 @@ /// <reference types="node" /> | ||
}; | ||
export declare type InstalledAppStatus = { | ||
inactive: { | ||
reason: DeactivationReason; | ||
export declare type PausedAppReason = { | ||
error: string; | ||
}; | ||
export declare type DisabledAppReason = { | ||
never_started: null; | ||
} | { | ||
user: null; | ||
} | { | ||
error: string; | ||
}; | ||
export declare type InstalledAppInfoStatus = { | ||
paused: { | ||
reason: PausedAppReason; | ||
}; | ||
} | { | ||
active: null; | ||
disabled: { | ||
reason: DisabledAppReason; | ||
}; | ||
} | { | ||
running: null; | ||
}; | ||
@@ -34,5 +48,5 @@ export declare type InstalledAppInfo = { | ||
cell_data: Array<InstalledCell>; | ||
status: InstalledAppStatus; | ||
status: InstalledAppInfoStatus; | ||
}; | ||
export declare type MembraneProof = Buffer; | ||
export declare const fakeAgentPubKey: (x: any) => Buffer; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fakeAgentPubKey = void 0; | ||
exports.fakeAgentPubKey = (x) => Buffer.from([0x84, 0x20, 0x24].concat('000000000000000000000000000000000000' | ||
.split('') | ||
exports.fakeAgentPubKey = (x) => Buffer.from([0x84, 0x20, 0x24].concat("000000000000000000000000000000000000" | ||
.split("") | ||
.map((x) => parseInt(x, 10)))); | ||
//# sourceMappingURL=types.js.map |
@@ -26,5 +26,8 @@ /** | ||
_requester: <ReqO, ReqI, ResI, ResO>(tag: string, transformer?: Transformer<ReqO, ReqI, ResI, ResO> | undefined) => (req: ReqO, timeout?: number | undefined) => Promise<ResO>; | ||
attachAppInterface: Requester<Api.AttachAppInterfaceRequest, Api.AttachAppInterfaceResponse>; | ||
activateApp: Requester<Api.ActivateAppRequest, Api.ActivateAppResponse>; | ||
attachAppInterface: Requester<Api.AttachAppInterfaceRequest, Api.AttachAppInterfaceResponse>; | ||
deactivateApp: Requester<Api.DeactivateAppRequest, Api.DeactivateAppResponse>; | ||
enableApp: Requester<Api.EnableAppRequest, Api.EnableAppResponse>; | ||
disableApp: Requester<Api.DisableAppRequest, Api.DisableAppResponse>; | ||
startApp: Requester<Api.StartAppRequest, Api.StartAppResponse>; | ||
dumpState: Requester<Api.DumpStateRequest, Api.DumpStateResponse>; | ||
@@ -31,0 +34,0 @@ generateAgentPubKey: Requester<Api.GenerateAgentPubKeyRequest, Api.GenerateAgentPubKeyResponse>; |
@@ -57,5 +57,10 @@ "use strict"; | ||
// which this class implements | ||
this.attachAppInterface = this._requester('attach_app_interface'); | ||
// Deprecated | ||
this.activateApp = this._requester('activate_app'); | ||
this.attachAppInterface = this._requester('attach_app_interface'); | ||
// Deprecated | ||
this.deactivateApp = this._requester('deactivate_app'); | ||
this.enableApp = this._requester('enable_app'); | ||
this.disableApp = this._requester('disable_app'); | ||
this.startApp = this._requester('start_app'); | ||
this.dumpState = this._requester('dump_state', dumpStateTransform); | ||
@@ -69,2 +74,3 @@ this.generateAgentPubKey = this._requester('generate_agent_pub_key'); | ||
this.listCellIds = this._requester('list_cell_ids'); | ||
// Deprecated | ||
this.listActiveApps = this._requester('list_active_apps'); | ||
@@ -90,3 +96,3 @@ this.listApps = this._requester('list_apps', listAppsTransform); | ||
if (req.status_filter) { | ||
args.status_filter = req.status_filter === Api.AppStatusFilter.Active ? { Active: null } : { Inactive: null }; | ||
args.status_filter = getAppStatusInApiForm(req.status_filter); | ||
} | ||
@@ -103,2 +109,26 @@ return args; | ||
}; | ||
function getAppStatusInApiForm(status_filter) { | ||
switch (status_filter) { | ||
case Api.AppStatusFilter.Running: | ||
return { | ||
Running: null | ||
}; | ||
case Api.AppStatusFilter.Enabled: | ||
return { | ||
Enabled: null | ||
}; | ||
case Api.AppStatusFilter.Paused: | ||
return { | ||
Paused: null | ||
}; | ||
case Api.AppStatusFilter.Disabled: | ||
return { | ||
Disabled: null | ||
}; | ||
case Api.AppStatusFilter.Stopped: | ||
return { | ||
Stopped: null | ||
}; | ||
} | ||
} | ||
//# sourceMappingURL=admin.js.map |
{ | ||
"name": "@holochain/conductor-api", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"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": "rm -rf ./lib ./dist && tsc -d && tsc --outDir lib.es --module es2015", | ||
"dev": "rm -rf ./lib && tsc -d -w", | ||
"doc": "typedoc", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "npm test", | ||
"prepublishOnly": "echo 'test'", | ||
"test": "npm run test:raw | tap-diff", | ||
@@ -25,0 +25,0 @@ "test:raw": "RUST_LOG=error RUST_BACKTRACE=1 ts-node test", |
@@ -63,4 +63,4 @@ # holochain/conductor-api | ||
This version of `holochain-conductor-api` is currently working with | ||
- `holochain/holochain` at commit: [c6e501eceae06f381c80ed50ea7bb971f8d1edcc](https://github.com/holochain/holochain/commit/c6e501eceae06f381c80ed50ea7bb971f8d1edcc) | ||
- hdk version 0.0.100 from crates.io | ||
- `holochain/holochain` at commit: [c5dbdf28825927106bc32d186dd54f20d35df468](https://github.com/holochain/holochain/commit/c5dbdf28825927106bc32d186dd54f20d35df468) | ||
- hdk version 0.0.101 from crates.io | ||
@@ -67,0 +67,0 @@ If updating this code, please make changes to the git `rev/sha` in 2 places: |
@@ -1,167 +0,190 @@ | ||
import { Requester } from "./common" | ||
import { HoloHash, AgentPubKey, MembraneProof, DnaProperties, InstalledAppId, CellId, CellNick, InstalledAppInfo, SlotId } from "./types" | ||
import { Requester } from "./common"; | ||
import { | ||
HoloHash, | ||
AgentPubKey, | ||
MembraneProof, | ||
DnaProperties, | ||
InstalledAppId, | ||
CellId, | ||
CellNick, | ||
InstalledAppInfo, | ||
SlotId, | ||
} from "./types"; | ||
export type ActivateAppRequest = { installed_app_id: InstalledAppId } | ||
export type ActivateAppResponse = InstalledAppInfo | ||
export type AttachAppInterfaceRequest = { port: number }; | ||
export type AttachAppInterfaceResponse = { port: number }; | ||
export type AttachAppInterfaceRequest = { port: number } | ||
export type AttachAppInterfaceResponse = { port: number } | ||
// Deprecated | ||
export type ActivateAppRequest = EnableAppRequest; | ||
// Deprecated | ||
export type ActivateAppResponse = EnableAppResponse; | ||
export type DeactivateAppRequest = { installed_app_id: InstalledAppId } | ||
export type DeactivateAppResponse = null | ||
// Deprecated | ||
export type DeactivateAppRequest = { installed_app_id: InstalledAppId }; | ||
// Deprecated | ||
export type DeactivateAppResponse = null; | ||
export type DumpStateRequest = { cell_id: CellId } | ||
export type DumpStateResponse = any | ||
export type EnableAppRequest = { installed_app_id: InstalledAppId }; | ||
export type EnableAppResponse = { | ||
app: InstalledAppInfo; | ||
errors: Array<[CellId, String]>; | ||
}; | ||
export type GenerateAgentPubKeyRequest = void | ||
export type GenerateAgentPubKeyResponse = AgentPubKey | ||
export type DisableAppRequest = { installed_app_id: InstalledAppId }; | ||
export type DisableAppResponse = null; | ||
export type StartAppRequest = { installed_app_id: InstalledAppId }; | ||
export type StartAppResponse = Boolean; | ||
export type DumpStateRequest = { cell_id: CellId }; | ||
export type DumpStateResponse = any; | ||
export type GenerateAgentPubKeyRequest = void; | ||
export type GenerateAgentPubKeyResponse = AgentPubKey; | ||
export type RegisterDnaRequest = { | ||
uid?: string, | ||
properties?: DnaProperties, | ||
} & DnaSource | ||
uid?: string; | ||
properties?: DnaProperties; | ||
} & DnaSource; | ||
export type RegisterDnaResponse = HoloHash | ||
export type RegisterDnaResponse = HoloHash; | ||
export type InstallAppRequest = { | ||
installed_app_id: InstalledAppId, | ||
agent_key: AgentPubKey, | ||
dnas: Array<InstallAppDnaPayload>, | ||
} | ||
export type InstallAppResponse = InstalledAppInfo | ||
installed_app_id: InstalledAppId; | ||
agent_key: AgentPubKey; | ||
dnas: Array<InstallAppDnaPayload>; | ||
}; | ||
export type InstallAppResponse = InstalledAppInfo; | ||
export type CreateCloneCellRequest = { | ||
/// Properties to override when installing this Dna | ||
properties?: DnaProperties, | ||
/// The DNA to clone | ||
dna_hash: HoloHash, | ||
/// The Agent key with which to create this Cell | ||
/// (TODO: should this be derived from the App?) | ||
agent_key: AgentPubKey, | ||
/// The App with which to associate the newly created Cell | ||
installed_app_id: InstalledAppId, | ||
/// Properties to override when installing this Dna | ||
properties?: DnaProperties; | ||
/// The DNA to clone | ||
dna_hash: HoloHash; | ||
/// The Agent key with which to create this Cell | ||
/// (TODO: should this be derived from the App?) | ||
agent_key: AgentPubKey; | ||
/// The App with which to associate the newly created Cell | ||
installed_app_id: InstalledAppId; | ||
/// The SlotId under which to create this clone | ||
/// (needed to track cloning permissions and `clone_count`) | ||
slot_id: SlotId, | ||
/// Proof-of-membership, if required by this DNA | ||
membrane_proof?: MembraneProof | ||
} | ||
export type CreateCloneCellResponse = CellId | ||
/// The SlotId under which to create this clone | ||
/// (needed to track cloning permissions and `clone_count`) | ||
slot_id: SlotId; | ||
/// Proof-of-membership, if required by this DNA | ||
membrane_proof?: MembraneProof; | ||
}; | ||
export type CreateCloneCellResponse = CellId; | ||
export type ResourceBytes = Buffer | ||
export type ResourceMap = {[key: string]: ResourceBytes} | ||
export type ResourceBytes = Buffer; | ||
export type ResourceMap = { [key: string]: ResourceBytes }; | ||
export type CellProvisioning = | ||
{ | ||
/// Always create a new Cell when installing this App | ||
create: {deferred: boolean}, | ||
} | { | ||
/// Always create a new Cell when installing the App, | ||
/// and use a unique UID to ensure a distinct DHT network | ||
create_clone: {deferred: boolean}, | ||
} | { | ||
/// Require that a Cell is already installed which matches the DNA version | ||
/// spec, and which has an Agent that's associated with this App's agent | ||
/// via DPKI. If no such Cell exists, *app installation fails*. | ||
use_existing: {deferred: boolean}, | ||
} | { | ||
/// Try `UseExisting`, and if that fails, fallback to `Create` | ||
create_if_no_exists: {deferred: boolean} | ||
} | { | ||
/// Disallow provisioning altogether. In this case, we expect | ||
/// `clone_limit > 0`: otherwise, no Cells will ever be created. | ||
disabled: {} | ||
| { | ||
/// Always create a new Cell when installing this App | ||
create: { deferred: boolean }; | ||
} | ||
| { | ||
/// Always create a new Cell when installing the App, | ||
/// and use a unique UID to ensure a distinct DHT network | ||
create_clone: { deferred: boolean }; | ||
} | ||
| { | ||
/// Require that a Cell is already installed which matches the DNA version | ||
/// spec, and which has an Agent that's associated with this App's agent | ||
/// via DPKI. If no such Cell exists, *app installation fails*. | ||
use_existing: { deferred: boolean }; | ||
} | ||
| { | ||
/// Try `UseExisting`, and if that fails, fallback to `Create` | ||
create_if_no_exists: { deferred: boolean }; | ||
} | ||
| { | ||
/// Disallow provisioning altogether. In this case, we expect | ||
/// `clone_limit > 0`: otherwise, no Cells will ever be created. | ||
disabled: {}; | ||
}; | ||
export type HoloHashB64 = string; | ||
export type DnaVersionSpec = Array<HoloHashB64> | ||
export type DnaVersionSpec = Array<HoloHashB64>; | ||
export type DnaVersionFlexible = | ||
{ | ||
singleton: HoloHashB64 | ||
| { | ||
singleton: HoloHashB64; | ||
} | ||
| | ||
{ | ||
multiple: DnaVersionSpec | ||
} | ||
| { | ||
multiple: DnaVersionSpec; | ||
}; | ||
export type AppSlotDnaManifest = { | ||
location?: Location, | ||
properties?: DnaProperties, | ||
uid?: string, | ||
version?: DnaVersionFlexible, | ||
} | ||
location?: Location; | ||
properties?: DnaProperties; | ||
uid?: string; | ||
version?: DnaVersionFlexible; | ||
}; | ||
export type AppSlotManifest = { | ||
id: SlotId, | ||
provisioning?: CellProvisioning, | ||
dna: AppSlotDnaManifest, | ||
} | ||
id: SlotId; | ||
provisioning?: CellProvisioning; | ||
dna: AppSlotDnaManifest; | ||
}; | ||
export type AppManifest = { | ||
/// Currently one "1" is supported | ||
manifest_version: string; | ||
/// Currently one "1" is supported | ||
manifest_version: string; | ||
name: string, | ||
description?: string, | ||
slots: Array<AppSlotManifest>, | ||
} | ||
export type AppBundle = | ||
{ | ||
manifest: AppManifest, | ||
name: string; | ||
description?: string; | ||
slots: Array<AppSlotManifest>; | ||
}; | ||
export type AppBundle = { | ||
manifest: AppManifest; | ||
/// The full or partial resource data. Each entry must correspond to one | ||
/// of the Bundled Locations specified by the Manifest. Bundled Locations | ||
/// are always relative paths (relative to the root_dir). | ||
resources: ResourceMap, | ||
} | ||
/// The full or partial resource data. Each entry must correspond to one | ||
/// of the Bundled Locations specified by the Manifest. Bundled Locations | ||
/// are always relative paths (relative to the root_dir). | ||
resources: ResourceMap; | ||
}; | ||
export type AppBundleSource = | ||
{bundle: AppBundle} | ||
| | ||
{path: string} | ||
export type AppBundleSource = { bundle: AppBundle } | { path: string }; | ||
export type Uid = string; | ||
export type InstallAppBundleRequest = { | ||
/// The agent to use when creating Cells for this App. | ||
agent_key: AgentPubKey; | ||
/// The agent to use when creating Cells for this App. | ||
agent_key: AgentPubKey, | ||
/// The unique identifier for an installed app in this conductor. | ||
/// If not specified, it will be derived from the app name in the bundle manifest. | ||
installed_app_id?: InstalledAppId; | ||
/// The unique identifier for an installed app in this conductor. | ||
/// If not specified, it will be derived from the app name in the bundle manifest. | ||
installed_app_id?: InstalledAppId, | ||
/// Include proof-of-membrane-membership data for cells that require it, | ||
/// keyed by the CellNick specified in the app bundle manifest. | ||
membrane_proofs: { [key: string]: MembraneProof }; | ||
/// Include proof-of-membrane-membership data for cells that require it, | ||
/// keyed by the CellNick specified in the app bundle manifest. | ||
membrane_proofs: {[key: string]: MembraneProof}, | ||
/// Optional global UID override. If set will override the UID value for all DNAs in the bundle. | ||
uid?: Uid; | ||
} & AppBundleSource; /// The unique identifier for an installed app in this conductor. | ||
/// Optional global UID override. If set will override the UID value for all DNAs in the bundle. | ||
uid?: Uid, | ||
} & | ||
/// The unique identifier for an installed app in this conductor. | ||
AppBundleSource | ||
export type InstallAppBundleResponse = InstalledAppInfo; | ||
export type ListDnasRequest = void; | ||
export type ListDnasResponse = Array<string>; | ||
export type InstallAppBundleResponse = InstalledAppInfo | ||
export type ListCellIdsRequest = void; | ||
export type ListCellIdsResponse = Array<CellId>; | ||
export type ListDnasRequest = void | ||
export type ListDnasResponse = Array<string> | ||
export type ListActiveAppsRequest = void; | ||
export type ListActiveAppsResponse = Array<InstalledAppId>; | ||
export type ListCellIdsRequest = void | ||
export type ListCellIdsResponse = Array<CellId> | ||
export type ListActiveAppsRequest = void | ||
export type ListActiveAppsResponse = Array<InstalledAppId> | ||
export enum AppStatusFilter { | ||
Active = 'active', | ||
Inactive = 'inactive' | ||
Enabled = "enabled", | ||
Disabled = "disabled", | ||
Running = "running", | ||
Stopped = "stopped", | ||
Paused = "paused", | ||
} | ||
export type ListAppsRequest = { | ||
status_filter?: AppStatusFilter; | ||
}; | ||
export type ListAppsRequest = { | ||
status_filter?: AppStatusFilter; | ||
} | ||
export type ListAppsResponse = Array<InstalledAppInfo> | ||
export type ListAppsResponse = Array<InstalledAppInfo>; | ||
export type ListAppInterfacesRequest = void | ||
export type ListAppInterfacesResponse = Array<number> | ||
export type ListAppInterfacesRequest = void; | ||
export type ListAppInterfacesResponse = Array<number>; | ||
// this type is meant to be opaque | ||
export type AgentInfoSigned = any | ||
export type AgentInfoSigned = any; | ||
/*{ | ||
@@ -173,86 +196,107 @@ agent: any, | ||
export type RequestAgentInfoRequest = { cell_id: CellId|null } | ||
export type RequestAgentInfoResponse = Array<AgentInfoSigned> | ||
export type AddAgentInfoRequest = { agent_infos: Array<AgentInfoSigned> } | ||
export type AddAgentInfoResponse = any | ||
export type RequestAgentInfoRequest = { cell_id: CellId | null }; | ||
export type RequestAgentInfoResponse = Array<AgentInfoSigned>; | ||
export type AddAgentInfoRequest = { agent_infos: Array<AgentInfoSigned> }; | ||
export type AddAgentInfoResponse = any; | ||
export interface AdminApi { | ||
activateApp: Requester<ActivateAppRequest, ActivateAppResponse> | ||
attachAppInterface: Requester<AttachAppInterfaceRequest, AttachAppInterfaceResponse> | ||
deactivateApp: Requester<DeactivateAppRequest, DeactivateAppResponse> | ||
dumpState: Requester<DumpStateRequest, DumpStateResponse> | ||
generateAgentPubKey: Requester<GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse> | ||
registerDna: Requester<RegisterDnaRequest, RegisterDnaResponse> | ||
installApp: Requester<InstallAppRequest, InstallAppResponse> | ||
createCloneCell: Requester<CreateCloneCellRequest, CreateCloneCellResponse> | ||
installAppBundle: Requester<InstallAppBundleRequest, InstallAppBundleResponse> | ||
listDnas: Requester<ListDnasRequest, ListDnasResponse> | ||
listCellIds: Requester<ListCellIdsRequest, ListCellIdsResponse> | ||
listActiveApps: Requester<ListActiveAppsRequest, ListActiveAppsResponse> | ||
listApps: Requester<ListAppsRequest, ListAppsResponse> | ||
listAppInterfaces: Requester<ListAppInterfacesRequest, ListAppInterfacesResponse> | ||
requestAgentInfo: Requester<RequestAgentInfoRequest, RequestAgentInfoResponse> | ||
addAgentInfo: Requester<AddAgentInfoRequest, AddAgentInfoResponse> | ||
attachAppInterface: Requester< | ||
AttachAppInterfaceRequest, | ||
AttachAppInterfaceResponse | ||
>; | ||
// Deprecated | ||
activateApp: Requester<ActivateAppRequest, ActivateAppResponse>; | ||
// Deprecated | ||
deactivateApp: Requester<DeactivateAppRequest, DeactivateAppResponse>; | ||
enableApp: Requester<EnableAppRequest, EnableAppResponse>; | ||
disableApp: Requester<DisableAppRequest, DisableAppResponse>; | ||
startApp: Requester<StartAppRequest, StartAppResponse>; | ||
dumpState: Requester<DumpStateRequest, DumpStateResponse>; | ||
generateAgentPubKey: Requester< | ||
GenerateAgentPubKeyRequest, | ||
GenerateAgentPubKeyResponse | ||
>; | ||
registerDna: Requester<RegisterDnaRequest, RegisterDnaResponse>; | ||
installApp: Requester<InstallAppRequest, InstallAppResponse>; | ||
createCloneCell: Requester<CreateCloneCellRequest, CreateCloneCellResponse>; | ||
installAppBundle: Requester< | ||
InstallAppBundleRequest, | ||
InstallAppBundleResponse | ||
>; | ||
listDnas: Requester<ListDnasRequest, ListDnasResponse>; | ||
listCellIds: Requester<ListCellIdsRequest, ListCellIdsResponse>; | ||
// Deprecated | ||
listActiveApps: Requester<ListActiveAppsRequest, ListActiveAppsResponse>; | ||
listApps: Requester<ListAppsRequest, ListAppsResponse>; | ||
listAppInterfaces: Requester< | ||
ListAppInterfacesRequest, | ||
ListAppInterfacesResponse | ||
>; | ||
requestAgentInfo: Requester< | ||
RequestAgentInfoRequest, | ||
RequestAgentInfoResponse | ||
>; | ||
addAgentInfo: Requester<AddAgentInfoRequest, AddAgentInfoResponse>; | ||
} | ||
export type InstallAppDnaPayload = { | ||
hash: HoloHash | ||
nick: CellNick, | ||
properties?: DnaProperties, | ||
membrane_proof?: MembraneProof | ||
} | ||
hash: HoloHash; | ||
nick: CellNick; | ||
properties?: DnaProperties; | ||
membrane_proof?: MembraneProof; | ||
}; | ||
export type ZomeLocation = { | ||
/// Expect file to be part of this bundle | ||
bundled: string; | ||
} | { | ||
/// Get file from local filesystem (not bundled) | ||
path: string; | ||
} | { | ||
/// Get file from URL | ||
url: string; | ||
} | ||
export type ZomeLocation = | ||
| { | ||
/// Expect file to be part of this bundle | ||
bundled: string; | ||
} | ||
| { | ||
/// Get file from local filesystem (not bundled) | ||
path: string; | ||
} | ||
| { | ||
/// Get file from URL | ||
url: string; | ||
}; | ||
export type ZomeManifest = { | ||
name: string, | ||
hash?: string, | ||
} & ZomeLocation | ||
name: string; | ||
hash?: string; | ||
} & ZomeLocation; | ||
export type DnaManifest = { | ||
/// Currently one "1" is supported | ||
manifest_version: string; | ||
/// Currently one "1" is supported | ||
manifest_version: string; | ||
/// The friendly "name" of a Holochain DNA. | ||
name: string, | ||
/// The friendly "name" of a Holochain DNA. | ||
name: string; | ||
/// A UID for uniquifying this Dna. | ||
// TODO: consider Vec<u8> instead (https://github.com/holochain/holochain/pull/86#discussion_r412689085) | ||
uid?: string, | ||
/// A UID for uniquifying this Dna. | ||
// TODO: consider Vec<u8> instead (https://github.com/holochain/holochain/pull/86#discussion_r412689085) | ||
uid?: string; | ||
/// Any arbitrary application properties can be included in this object. | ||
properties?: DnaProperties, | ||
/// Any arbitrary application properties can be included in this object. | ||
properties?: DnaProperties; | ||
/// An array of zomes associated with your DNA. | ||
/// The order is significant: it determines initialization order. | ||
zomes: Array<ZomeManifest>, | ||
} | ||
/// An array of zomes associated with your DNA. | ||
/// The order is significant: it determines initialization order. | ||
zomes: Array<ZomeManifest>; | ||
}; | ||
export type DnaBundle = { | ||
manifest: DnaManifest; | ||
resources: ResourceMap; | ||
} | ||
manifest: DnaManifest; | ||
resources: ResourceMap; | ||
}; | ||
export type DnaSource = | ||
{ | ||
hash: HoloHash | ||
} | ||
| | ||
{ | ||
path: string | ||
} | ||
| | ||
{ | ||
bundle: DnaBundle | ||
}; | ||
| { | ||
hash: HoloHash; | ||
} | ||
| { | ||
path: string; | ||
} | ||
| { | ||
bundle: DnaBundle; | ||
}; | ||
@@ -259,0 +303,0 @@ export interface HoloHashed<T> { |
@@ -1,25 +0,49 @@ | ||
export type HoloHash = Buffer // length 39 | ||
export type AgentPubKey = HoloHash | ||
export type InstalledAppId = string | ||
export type CapSecret = Buffer | ||
export type CellId = [HoloHash, AgentPubKey] | ||
export type CellNick = string | ||
export type DnaProperties = any | ||
export type HoloHash = Buffer; // length 39 | ||
export type AgentPubKey = HoloHash; | ||
export type InstalledAppId = string; | ||
export type CapSecret = Buffer; | ||
export type CellId = [HoloHash, AgentPubKey]; | ||
export type CellNick = string; | ||
export type DnaProperties = any; | ||
export type SlotId = string; | ||
export type InstalledCell = { | ||
cell_id: CellId, | ||
cell_nick: CellNick, | ||
} | ||
cell_id: CellId; | ||
cell_nick: CellNick; | ||
}; | ||
export type DeactivationReason = { never_activated: null } | { normal: null } | { quarantined: { error: string} } | ||
export type InstalledAppStatus = | ||
{inactive : {reason: DeactivationReason}} | {active: null} | ||
export type DeactivationReason = | ||
| { never_activated: null } | ||
| { normal: null } | ||
| { quarantined: { error: string } }; | ||
export type PausedAppReason = { | ||
error: string; | ||
}; | ||
export type DisabledAppReason = | ||
| { | ||
never_started: null; | ||
} | ||
| { user: null } | ||
| { error: string }; | ||
export type InstalledAppInfoStatus = | ||
| { | ||
paused: { reason: PausedAppReason }; | ||
} | ||
| { | ||
disabled: { | ||
reason: DisabledAppReason; | ||
}; | ||
} | ||
| { | ||
running: null; | ||
}; | ||
export type InstalledAppInfo = { | ||
installed_app_id: InstalledAppId, | ||
cell_data: Array<InstalledCell> | ||
status: InstalledAppStatus, | ||
} | ||
export type MembraneProof = Buffer | ||
installed_app_id: InstalledAppId; | ||
cell_data: Array<InstalledCell>; | ||
status: InstalledAppInfoStatus; | ||
}; | ||
export type MembraneProof = Buffer; | ||
@@ -29,6 +53,6 @@ export const fakeAgentPubKey = (x: any) => | ||
[0x84, 0x20, 0x24].concat( | ||
'000000000000000000000000000000000000' | ||
.split('') | ||
"000000000000000000000000000000000000" | ||
.split("") | ||
.map((x) => parseInt(x, 10)) | ||
) | ||
) | ||
); |
@@ -47,8 +47,16 @@ /** | ||
// which this class implements | ||
attachAppInterface: Requester<Api.AttachAppInterfaceRequest, Api.AttachAppInterfaceResponse> | ||
= this._requester('attach_app_interface') | ||
// Deprecated | ||
activateApp: Requester<Api.ActivateAppRequest, Api.ActivateAppResponse> | ||
= this._requester('activate_app') | ||
attachAppInterface: Requester<Api.AttachAppInterfaceRequest, Api.AttachAppInterfaceResponse> | ||
= this._requester('attach_app_interface') | ||
// Deprecated | ||
deactivateApp: Requester<Api.DeactivateAppRequest, Api.DeactivateAppResponse> | ||
= this._requester('deactivate_app') | ||
enableApp: Requester<Api.EnableAppRequest, Api.EnableAppResponse> | ||
= this._requester('enable_app') | ||
disableApp: Requester<Api.DisableAppRequest, Api.DisableAppResponse> | ||
= this._requester('disable_app') | ||
startApp: Requester<Api.StartAppRequest, Api.StartAppResponse> | ||
= this._requester('start_app') | ||
dumpState: Requester<Api.DumpStateRequest, Api.DumpStateResponse> | ||
@@ -70,2 +78,3 @@ = this._requester('dump_state', dumpStateTransform) | ||
= this._requester('list_cell_ids') | ||
// Deprecated | ||
listActiveApps: Requester<Api.ListActiveAppsRequest, Api.ListActiveAppsResponse> | ||
@@ -84,3 +93,8 @@ = this._requester('list_active_apps') | ||
interface InternalListAppsRequest { | ||
status_filter?: {Active: null} | {Inactive: null} | ||
status_filter?: | ||
{Running: null} | ||
| {Enabled: null} | ||
| {Paused: null} | ||
| {Disabled: null} | ||
| {Stopped: null} | ||
} | ||
@@ -93,3 +107,3 @@ | ||
if (req.status_filter) { | ||
args.status_filter = req.status_filter === Api.AppStatusFilter.Active ? { Active: null } : { Inactive: null }; | ||
args.status_filter = getAppStatusInApiForm(req.status_filter) | ||
} | ||
@@ -102,3 +116,2 @@ | ||
const dumpStateTransform: Transformer<Api.DumpStateRequest, Api.DumpStateRequest, string, Api.DumpStateResponse> = { | ||
@@ -110,1 +123,26 @@ input: (req) => req, | ||
} | ||
function getAppStatusInApiForm(status_filter: Api.AppStatusFilter) { | ||
switch (status_filter) { | ||
case Api.AppStatusFilter.Running: | ||
return { | ||
Running: null | ||
} | ||
case Api.AppStatusFilter.Enabled: | ||
return { | ||
Enabled: null | ||
} | ||
case Api.AppStatusFilter.Paused: | ||
return { | ||
Paused: null | ||
} | ||
case Api.AppStatusFilter.Disabled: | ||
return { | ||
Disabled: null | ||
} | ||
case Api.AppStatusFilter.Stopped: | ||
return { | ||
Stopped: null | ||
} | ||
} | ||
} |
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
112776
2292
65