@powerhousedao/reactor-api 1.29.26-dev.3 → 1.29.26-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/graphql/system/index.d.ts +12 -3
- package/dist/src/graphql/system/index.d.ts.map +1 -1
- package/dist/src/graphql/system/index.js +28 -9
- package/dist/src/graphql/system/index.js.map +1 -1
- package/dist/src/graphql/system/types.d.ts +1 -1
- package/dist/src/graphql/system/types.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Subgraph } from "#graphql/base/index.js";
|
|
2
|
-
import { type DriveInput } from "document-drive";
|
|
3
2
|
import { type SystemContext } from "./types.js";
|
|
4
3
|
export declare class SystemSubgraph extends Subgraph {
|
|
5
4
|
name: string;
|
|
@@ -9,9 +8,19 @@ export declare class SystemSubgraph extends Subgraph {
|
|
|
9
8
|
drives: () => Promise<string[]>;
|
|
10
9
|
};
|
|
11
10
|
Mutation: {
|
|
12
|
-
addDrive: (parent: unknown, args:
|
|
11
|
+
addDrive: (parent: unknown, args: {
|
|
12
|
+
name: string;
|
|
13
|
+
icon?: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
slug?: string;
|
|
13
16
|
preferredEditor?: string;
|
|
14
|
-
}, ctx: SystemContext) => Promise<
|
|
17
|
+
}, ctx: SystemContext) => Promise<{
|
|
18
|
+
id: string;
|
|
19
|
+
slug: string;
|
|
20
|
+
name: string;
|
|
21
|
+
icon: string | null;
|
|
22
|
+
preferredEditor?: string;
|
|
23
|
+
}>;
|
|
15
24
|
};
|
|
16
25
|
};
|
|
17
26
|
onSetup(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/graphql/system/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/graphql/system/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIlD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAIhD,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,IAAI,SAAY;IAEhB,QAAQ,iCAgCN;IAEF,SAAS;;;;;+BAQK,OAAO,QACT;gBACJ,IAAI,EAAE,MAAM,CAAC;gBACb,IAAI,CAAC,EAAE,MAAM,CAAC;gBACd,EAAE,CAAC,EAAE,MAAM,CAAC;gBACZ,IAAI,CAAC,EAAE,MAAM,CAAC;gBACd,eAAe,CAAC,EAAE,MAAM,CAAC;aAC1B,OACI,aAAa,KACjB,OAAO,CAAC;gBACT,EAAE,EAAE,MAAM,CAAC;gBACX,IAAI,EAAE,MAAM,CAAC;gBACb,IAAI,EAAE,MAAM,CAAC;gBACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;gBACpB,eAAe,CAAC,EAAE,MAAM,CAAC;aAC1B,CAAC;;MA+BJ;IAEI,OAAO;CAgBd"}
|
|
@@ -13,13 +13,24 @@ export class SystemSubgraph extends Subgraph {
|
|
|
13
13
|
|
|
14
14
|
type Mutation {
|
|
15
15
|
addDrive(
|
|
16
|
-
|
|
16
|
+
name: String!
|
|
17
|
+
icon: String
|
|
18
|
+
id: String
|
|
19
|
+
slug: String
|
|
17
20
|
preferredEditor: String
|
|
18
|
-
):
|
|
21
|
+
): AddDriveResult
|
|
19
22
|
setDriveIcon(id: String!, icon: String!): Boolean
|
|
20
23
|
setDriveName(id: String!, name: String!): Boolean
|
|
21
24
|
}
|
|
22
25
|
|
|
26
|
+
type AddDriveResult {
|
|
27
|
+
id: String!
|
|
28
|
+
slug: String!
|
|
29
|
+
name: String!
|
|
30
|
+
icon: String
|
|
31
|
+
preferredEditor: String
|
|
32
|
+
}
|
|
33
|
+
|
|
23
34
|
input DocumentDriveStateInput {
|
|
24
35
|
name: String
|
|
25
36
|
id: String
|
|
@@ -35,22 +46,30 @@ export class SystemSubgraph extends Subgraph {
|
|
|
35
46
|
},
|
|
36
47
|
Mutation: {
|
|
37
48
|
addDrive: async (parent, args, ctx) => {
|
|
38
|
-
logger.info("addDrive", JSON.stringify(args, null, 2));
|
|
39
49
|
try {
|
|
40
50
|
const isAdmin = ctx.isAdmin(ctx);
|
|
41
51
|
if (!isAdmin) {
|
|
42
52
|
throw new GraphQLError("Unauthorized");
|
|
43
53
|
}
|
|
54
|
+
const { name, icon, ...driveInput } = args;
|
|
44
55
|
const drive = await this.reactor.addDrive({
|
|
45
|
-
...
|
|
46
|
-
global:
|
|
47
|
-
local:
|
|
48
|
-
}
|
|
49
|
-
|
|
56
|
+
...driveInput,
|
|
57
|
+
global: { name, icon },
|
|
58
|
+
local: {},
|
|
59
|
+
});
|
|
60
|
+
const driveAdded = {
|
|
61
|
+
id: drive.id,
|
|
62
|
+
slug: drive.slug,
|
|
63
|
+
name: drive.state.global.name,
|
|
64
|
+
icon: drive.state.global.icon,
|
|
65
|
+
preferredEditor: drive.meta?.preferredEditor,
|
|
66
|
+
};
|
|
67
|
+
logger.info("Drive added", driveAdded);
|
|
68
|
+
return driveAdded;
|
|
50
69
|
}
|
|
51
70
|
catch (e) {
|
|
52
71
|
logger.error(e);
|
|
53
|
-
throw new Error(e);
|
|
72
|
+
throw e instanceof Error ? e : new Error(e);
|
|
54
73
|
}
|
|
55
74
|
},
|
|
56
75
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/graphql/system/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/graphql/system/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAA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AM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/graphql/system/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACxC,OAAO,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC;CACxC,CAAC"}
|