@pronto-tools-and-more/api 12.35.1
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +22 -0
- package/src/main.js +3 -0
- package/src/parts/Callback/Callback.js +1 -0
- package/src/parts/Command/Command.js +9 -0
- package/src/parts/CommandMap/CommandMap.js +5 -0
- package/src/parts/CommandState/CommandState.js +17 -0
- package/src/parts/ErrorCodes/ErrorCodes.js +2 -0
- package/src/parts/GetPostIds/GetPostIds.js +41 -0
- package/src/parts/GraphQlQueryAppSettings/GraphQlQueryAppSettings.js +42 -0
- package/src/parts/GraphQlQueryAuthors/GraphQlQueryAuthors.js +66 -0
- package/src/parts/GraphQlQueryCategories/GraphQlQueryCategories.js +66 -0
- package/src/parts/GraphQlQueryCollection/GraphQlQueryCollection.js +227 -0
- package/src/parts/GraphQlQueryCollections/GraphQlQueryCollections.js +227 -0
- package/src/parts/GraphQlQueryContent/GraphQlQueryContent.js +198 -0
- package/src/parts/GraphQlQueryDossier/GraphQlQueryDossier.js +221 -0
- package/src/parts/GraphQlQueryDossiers/GraphQlQueryDossiers.js +201 -0
- package/src/parts/GraphQlQueryIssues/GraphQlQueryIssues.js +202 -0
- package/src/parts/GraphQlQueryMenus/GraphQlQueryMenus.js +77 -0
- package/src/parts/GraphQlQueryPathSegment/GraphQlQueryPathSegment.js +57 -0
- package/src/parts/GraphQlQueryPathSegments/GraphQlQueryPathSegments.js +59 -0
- package/src/parts/GraphQlQueryTaxonomies/GraphQlQueryTaxonomies.js +66 -0
- package/src/parts/HandleApi/HandleApi.js +52 -0
- package/src/parts/HandleApiAppSettings/HandleApiAppSettings.js +41 -0
- package/src/parts/HandleApiArticle/HandleApiArticle.js +26 -0
- package/src/parts/HandleApiArticleByCategoryId/HandleApiArticleByCategoryId.js +97 -0
- package/src/parts/HandleApiAuthors/HandleApiAuthors.js +38 -0
- package/src/parts/HandleApiCategories/HandleApiCategories.js +38 -0
- package/src/parts/HandleApiCollection/HandleApiCollection.js +62 -0
- package/src/parts/HandleApiCollections/HandleApiCollections.js +52 -0
- package/src/parts/HandleApiDossier/HandleApiDossier.js +109 -0
- package/src/parts/HandleApiDossiers/HandleApiDossiers.js +39 -0
- package/src/parts/HandleApiIndex/HandleApiIndex.js +30 -0
- package/src/parts/HandleApiIssues/HandleApiIssues.js +39 -0
- package/src/parts/HandleApiMenus/HandleApiMenus.js +40 -0
- package/src/parts/HandleApiPostByName/HandleApiPostByName.js +63 -0
- package/src/parts/HandleIpc/HandleIpc.js +10 -0
- package/src/parts/HandleMessage/HandleMessage.js +27 -0
- package/src/parts/IpcChild/IpcChild.js +15 -0
- package/src/parts/IpcChildModule/IpcChildModule.js +25 -0
- package/src/parts/IpcChildType/IpcChildType.js +20 -0
- package/src/parts/JsonRpc/JsonRpc.js +1 -0
- package/src/parts/Listen/Listen.js +8 -0
- package/src/parts/Main/Main.js +8 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
import * as Callback from "../Callback/Callback.js";
|
2
|
+
import * as Command from "../Command/Command.js";
|
3
|
+
import * as JsonRpc from "../JsonRpc/JsonRpc.js";
|
4
|
+
|
5
|
+
const prepare = (error) => {
|
6
|
+
return error;
|
7
|
+
};
|
8
|
+
|
9
|
+
const requiresSocket = (method) => {
|
10
|
+
return false;
|
11
|
+
};
|
12
|
+
|
13
|
+
const logError = (error, prettyError) => {
|
14
|
+
console.error(error);
|
15
|
+
};
|
16
|
+
|
17
|
+
export const handleMessage = (event) => {
|
18
|
+
return JsonRpc.handleJsonRpcMessage(
|
19
|
+
event.target,
|
20
|
+
event.data,
|
21
|
+
Command.execute,
|
22
|
+
Callback.resolve,
|
23
|
+
prepare,
|
24
|
+
logError,
|
25
|
+
requiresSocket,
|
26
|
+
);
|
27
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import * as IpcChildModule from "../IpcChildModule/IpcChildModule.js";
|
2
|
+
|
3
|
+
export const listen = async ({ method, ...params }) => {
|
4
|
+
const module = await IpcChildModule.getModule(method);
|
5
|
+
// @ts-ignore
|
6
|
+
const rawIpc = await module.listen(params);
|
7
|
+
// @ts-ignore
|
8
|
+
if (module.signal) {
|
9
|
+
// @ts-ignore
|
10
|
+
module.signal(rawIpc);
|
11
|
+
}
|
12
|
+
// @ts-ignore
|
13
|
+
const ipc = module.wrap(rawIpc);
|
14
|
+
return ipc;
|
15
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import {
|
2
|
+
IpcChildWithElectronMessagePort,
|
3
|
+
IpcChildWithElectronUtilityProcess,
|
4
|
+
IpcChildWithNodeForkedProcess,
|
5
|
+
IpcChildWithNodeWorker,
|
6
|
+
IpcChildWithWebSocket,
|
7
|
+
} from "@lvce-editor/ipc";
|
8
|
+
import * as IpcChildType from "../IpcChildType/IpcChildType.js";
|
9
|
+
|
10
|
+
export const getModule = (method) => {
|
11
|
+
switch (method) {
|
12
|
+
case IpcChildType.NodeForkedProcess:
|
13
|
+
return IpcChildWithNodeForkedProcess;
|
14
|
+
case IpcChildType.NodeWorker:
|
15
|
+
return IpcChildWithNodeWorker;
|
16
|
+
case IpcChildType.ElectronUtilityProcess:
|
17
|
+
return IpcChildWithElectronUtilityProcess;
|
18
|
+
case IpcChildType.ElectronMessagePort:
|
19
|
+
return IpcChildWithElectronMessagePort;
|
20
|
+
case IpcChildType.WebSocket:
|
21
|
+
return IpcChildWithWebSocket;
|
22
|
+
default:
|
23
|
+
throw new Error("unexpected ipc type");
|
24
|
+
}
|
25
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
export const NodeWorker = 1;
|
2
|
+
export const NodeForkedProcess = 2;
|
3
|
+
export const ElectronUtilityProcess = 3;
|
4
|
+
export const ElectronMessagePort = 4;
|
5
|
+
const NodeMessagePort = 5;
|
6
|
+
export const WebSocket = 6;
|
7
|
+
|
8
|
+
export const Auto = () => {
|
9
|
+
const { argv } = process;
|
10
|
+
if (argv.includes("--ipc-type=node-worker")) {
|
11
|
+
return NodeWorker;
|
12
|
+
}
|
13
|
+
if (argv.includes("--ipc-type=node-forked-process")) {
|
14
|
+
return NodeForkedProcess;
|
15
|
+
}
|
16
|
+
if (argv.includes("--ipc-type=electron-utility-process")) {
|
17
|
+
return ElectronUtilityProcess;
|
18
|
+
}
|
19
|
+
throw new Error(`[shared-process] unknown ipc type`);
|
20
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "@lvce-editor/json-rpc";
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import * as HandleIpc from "../HandleIpc/HandleIpc.js";
|
2
|
+
import * as IpcChild from "../IpcChild/IpcChild.js";
|
3
|
+
import * as IpcChildType from "../IpcChildType/IpcChildType.js";
|
4
|
+
|
5
|
+
export const listen = async () => {
|
6
|
+
const ipc = await IpcChild.listen({ method: IpcChildType.Auto() });
|
7
|
+
HandleIpc.handleIpc(ipc);
|
8
|
+
};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import * as CommandMap from "../CommandMap/CommandMap.js";
|
2
|
+
import * as CommandState from "../CommandState/CommandState.js";
|
3
|
+
import * as Listen from "../Listen/Listen.js";
|
4
|
+
|
5
|
+
export const main = async () => {
|
6
|
+
CommandState.registerCommands(CommandMap.commandMap);
|
7
|
+
await Listen.listen();
|
8
|
+
};
|