1
0

Support for env-specific plug space primitives

This commit is contained in:
Zef Hemel 2023-11-15 16:13:44 +01:00
parent 663a15fe33
commit 694448a99b
2 changed files with 6 additions and 2 deletions

View File

@ -48,8 +48,11 @@ export class PlugSpacePrimitives implements SpacePrimitives {
async fetchFileList(): Promise<FileMeta[]> {
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);

View File

@ -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;