From 694448a99b5164c6617b65391349e5e884e87b8f Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Wed, 15 Nov 2023 16:13:44 +0100 Subject: [PATCH] Support for env-specific plug space primitives --- common/spaces/plug_space_primitives.ts | 7 +++++-- web/client.ts | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/spaces/plug_space_primitives.ts b/common/spaces/plug_space_primitives.ts index 169f020..fa63c95 100644 --- a/common/spaces/plug_space_primitives.ts +++ b/common/spaces/plug_space_primitives.ts @@ -48,8 +48,11 @@ export class PlugSpacePrimitives implements SpacePrimitives { async fetchFileList(): Promise { const allFiles: FileMeta[] = []; - for (const { plug, name, operation } of this.hook.spaceFunctions) { - if (operation === "listFiles") { + for (const { plug, name, operation, env } of this.hook.spaceFunctions) { + if ( + operation === "listFiles" && (!this.env || (env && env === this.env)) + ) { + console.log("Going to run this", this.env, env, name, operation); try { for (const pm of await plug.invoke(name, [])) { allFiles.push(pm); diff --git a/web/client.ts b/web/client.ts index 4d572cd..9663ca3 100644 --- a/web/client.ts +++ b/web/client.ts @@ -343,6 +343,7 @@ export class Client { this.plugSpaceRemotePrimitives = new PlugSpacePrimitives( this.remoteSpacePrimitives, this.system.namespaceHook, + this.syncMode ? undefined : "client", ); let fileFilterFn: (s: string) => boolean = () => true;