quidproquo-actionprocessor-node 0.0.37 → 0.0.38
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/package.json +1 -4
- package/src/actionProcessor/core/date/DateActionProcessor.ts +9 -0
- package/src/actionProcessor/core/error/ErrorActionProcessor.ts +17 -0
- package/src/actionProcessor/core/event/EventActionProcessor.ts +2 -0
- package/src/actionProcessor/core/guid/GuidActionProcessor.ts +11 -0
- package/src/actionProcessor/core/index.ts +21 -0
- package/src/actionProcessor/core/log/LogActionProcessor.ts +11 -0
- package/src/actionProcessor/core/math/MathActionProcessor.ts +9 -0
- package/src/actionProcessor/core/network/NetworkActionProcessor.ts +149 -0
- package/src/actionProcessor/core/platform/PlatformActionProcessor.ts +9 -0
- package/src/actionProcessor/core/system/SystemActionProcessor.ts +1 -0
- package/{lib/actionProcessor/index.d.ts → src/actionProcessor/index.ts} +0 -0
- package/src/actionProcessor/webserver/genericDataResource/GenericDataResourceActionProcessor.ts +1 -0
- package/src/actionProcessor/webserver/index.ts +5 -0
- package/{lib/index.d.ts → src/index.ts} +0 -0
- package/tsconfig.json +8 -0
- package/lib/actionProcessor/core/date/DateActionProcessor.d.ts +0 -5
- package/lib/actionProcessor/core/date/DateActionProcessor.js +0 -18
- package/lib/actionProcessor/core/error/ErrorActionProcessor.d.ts +0 -5
- package/lib/actionProcessor/core/error/ErrorActionProcessor.js +0 -18
- package/lib/actionProcessor/core/event/EventActionProcessor.d.ts +0 -2
- package/lib/actionProcessor/core/event/EventActionProcessor.js +0 -4
- package/lib/actionProcessor/core/guid/GuidActionProcessor.d.ts +0 -5
- package/lib/actionProcessor/core/guid/GuidActionProcessor.js +0 -19
- package/lib/actionProcessor/core/index.d.ts +0 -10
- package/lib/actionProcessor/core/index.js +0 -15
- package/lib/actionProcessor/core/log/LogActionProcessor.d.ts +0 -5
- package/lib/actionProcessor/core/log/LogActionProcessor.js +0 -19
- package/lib/actionProcessor/core/math/MathActionProcessor.d.ts +0 -5
- package/lib/actionProcessor/core/math/MathActionProcessor.js +0 -18
- package/lib/actionProcessor/core/network/NetworkActionProcessor.d.ts +0 -5
- package/lib/actionProcessor/core/network/NetworkActionProcessor.js +0 -114
- package/lib/actionProcessor/core/platform/PlatformActionProcessor.d.ts +0 -5
- package/lib/actionProcessor/core/platform/PlatformActionProcessor.js +0 -18
- package/lib/actionProcessor/core/system/SystemActionProcessor.d.ts +0 -2
- package/lib/actionProcessor/core/system/SystemActionProcessor.js +0 -3
- package/lib/actionProcessor/index.js +0 -10
- package/lib/actionProcessor/webserver/genericDataResource/GenericDataResourceActionProcessor.d.ts +0 -2
- package/lib/actionProcessor/webserver/genericDataResource/GenericDataResourceActionProcessor.js +0 -3
- package/lib/actionProcessor/webserver/index.d.ts +0 -2
- package/lib/actionProcessor/webserver/index.js +0 -7
- package/lib/index.js +0 -17
package/package.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-actionprocessor-node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.38",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.js",
|
|
7
|
-
"files": [
|
|
8
|
-
"lib/**/*"
|
|
9
|
-
],
|
|
10
7
|
"scripts": {
|
|
11
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
9
|
"clean": "npx rimraf lib",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DateNowActionProcessor, actionResult, DateActionType } from 'quidproquo-core';
|
|
2
|
+
|
|
3
|
+
const processDateNow: DateNowActionProcessor = async () => {
|
|
4
|
+
return actionResult(new Date().toISOString());
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
[DateActionType.Now]: processDateNow,
|
|
9
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ErrorActionType,
|
|
3
|
+
ErrorThrowErrorActionProcessor,
|
|
4
|
+
actionResultError,
|
|
5
|
+
} from 'quidproquo-core';
|
|
6
|
+
|
|
7
|
+
const processErrorThrowError: ErrorThrowErrorActionProcessor = async ({
|
|
8
|
+
errorStack,
|
|
9
|
+
errorText,
|
|
10
|
+
errorType,
|
|
11
|
+
}) => {
|
|
12
|
+
return actionResultError(errorType, errorText, errorStack);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
[ErrorActionType.ThrowError]: processErrorThrowError,
|
|
17
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { v4 as uuidV4 } from 'uuid';
|
|
2
|
+
|
|
3
|
+
import { GuidActionType, GuidNewActionProcessor, actionResult } from 'quidproquo-core';
|
|
4
|
+
|
|
5
|
+
const processGuidNew: GuidNewActionProcessor = async () => {
|
|
6
|
+
return actionResult(uuidV4());
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
[GuidActionType.New]: processGuidNew,
|
|
11
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import DateActionProcessor from './date/DateActionProcessor';
|
|
2
|
+
import ErrorActionProcessor from './error/ErrorActionProcessor';
|
|
3
|
+
import EventActionProcessor from './event/EventActionProcessor';
|
|
4
|
+
import GuidActionProcessor from './guid/GuidActionProcessor';
|
|
5
|
+
import LogActionProcessor from './log/LogActionProcessor';
|
|
6
|
+
import MathActionProcessor from './math/MathActionProcessor';
|
|
7
|
+
import NetworkActionProcessor from './network/NetworkActionProcessor';
|
|
8
|
+
import PlatformActionProcessor from './platform/PlatformActionProcessor';
|
|
9
|
+
import SystemActionProcessor from './system/SystemActionProcessor';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
...DateActionProcessor,
|
|
13
|
+
...ErrorActionProcessor,
|
|
14
|
+
...EventActionProcessor,
|
|
15
|
+
...GuidActionProcessor,
|
|
16
|
+
...LogActionProcessor,
|
|
17
|
+
...MathActionProcessor,
|
|
18
|
+
...NetworkActionProcessor,
|
|
19
|
+
...PlatformActionProcessor,
|
|
20
|
+
...SystemActionProcessor,
|
|
21
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LogCreateActionProcessor, actionResult, LogActionType } from 'quidproquo-core';
|
|
2
|
+
|
|
3
|
+
const processLogCreate: LogCreateActionProcessor = async ({ msg, logLevel, dataJson }) => {
|
|
4
|
+
console.log(`${logLevel}: ${msg} ${dataJson || ''}`);
|
|
5
|
+
|
|
6
|
+
return actionResult(void 0);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
[LogActionType.Create]: processLogCreate,
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MathActionType, MathRandomNumberActionProcessor, actionResult } from 'quidproquo-core';
|
|
2
|
+
|
|
3
|
+
const processMathRandomNumber: MathRandomNumberActionProcessor = async () => {
|
|
4
|
+
return actionResult(Math.random());
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
[MathActionType.RandomNumber]: processMathRandomNumber,
|
|
9
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NetworkRequestActionProcessor,
|
|
3
|
+
actionResult,
|
|
4
|
+
NetworkActionType,
|
|
5
|
+
HTTPMethod,
|
|
6
|
+
NetworkRequestActionPayload,
|
|
7
|
+
actionResultError,
|
|
8
|
+
ErrorTypeEnum,
|
|
9
|
+
} from 'quidproquo-core';
|
|
10
|
+
|
|
11
|
+
import axios, { AxiosResponse } from 'axios';
|
|
12
|
+
|
|
13
|
+
const axiosInstance = axios.create({
|
|
14
|
+
timeout: 10000,
|
|
15
|
+
headers: {
|
|
16
|
+
// Fixes: https://github.com/axios/axios/issues/5346
|
|
17
|
+
'Accept-Encoding': 'gzip,deflate,compress',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const processNetworkRequestGet = async (
|
|
22
|
+
payload: NetworkRequestActionPayload<any>,
|
|
23
|
+
): Promise<AxiosResponse<any, any>> => {
|
|
24
|
+
const response = await axiosInstance.get(payload.url, {
|
|
25
|
+
baseURL: payload.basePath,
|
|
26
|
+
headers: payload.headers,
|
|
27
|
+
params: payload.params,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
return response;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const processNetworkRequestPost = async (
|
|
34
|
+
payload: NetworkRequestActionPayload<any>,
|
|
35
|
+
): Promise<AxiosResponse<any, any>> => {
|
|
36
|
+
const response = await axiosInstance.post(payload.url, payload.body, {
|
|
37
|
+
baseURL: payload.basePath,
|
|
38
|
+
headers: payload.headers,
|
|
39
|
+
params: payload.params,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return response;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const processNetworkRequestDelete = async (
|
|
46
|
+
payload: NetworkRequestActionPayload<any>,
|
|
47
|
+
): Promise<AxiosResponse<any, any>> => {
|
|
48
|
+
const response = await axiosInstance.delete(payload.url, {
|
|
49
|
+
baseURL: payload.basePath,
|
|
50
|
+
headers: payload.headers,
|
|
51
|
+
params: payload.params,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return response;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const processNetworkRequestHead = async (
|
|
58
|
+
payload: NetworkRequestActionPayload<any>,
|
|
59
|
+
): Promise<AxiosResponse<any, any>> => {
|
|
60
|
+
const response = await axiosInstance.head(payload.url, {
|
|
61
|
+
baseURL: payload.basePath,
|
|
62
|
+
headers: payload.headers,
|
|
63
|
+
params: payload.params,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
return response;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const processNetworkRequestOptions = async (
|
|
70
|
+
payload: NetworkRequestActionPayload<any>,
|
|
71
|
+
): Promise<AxiosResponse<any, any>> => {
|
|
72
|
+
const response = await axiosInstance.options(payload.url, {
|
|
73
|
+
baseURL: payload.basePath,
|
|
74
|
+
headers: payload.headers,
|
|
75
|
+
params: payload.params,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
return response;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const processNetworkRequestPut = async (
|
|
82
|
+
payload: NetworkRequestActionPayload<any>,
|
|
83
|
+
): Promise<AxiosResponse<any, any>> => {
|
|
84
|
+
const response = await axiosInstance.put(payload.url, payload.body, {
|
|
85
|
+
baseURL: payload.basePath,
|
|
86
|
+
headers: payload.headers,
|
|
87
|
+
params: payload.params,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
return response;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const processNetworkRequestPatch = async (
|
|
94
|
+
payload: NetworkRequestActionPayload<any>,
|
|
95
|
+
): Promise<AxiosResponse<any, any>> => {
|
|
96
|
+
const response = await axiosInstance.patch(payload.url, payload.body, {
|
|
97
|
+
baseURL: payload.basePath,
|
|
98
|
+
headers: payload.headers,
|
|
99
|
+
params: payload.params,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
return response;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const processNetworkRequestConnect = async (
|
|
106
|
+
payload: NetworkRequestActionPayload<any>,
|
|
107
|
+
): Promise<AxiosResponse<any, any>> => {
|
|
108
|
+
throw new Error('Function not implemented.');
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const requestMethodMap: Record<
|
|
112
|
+
HTTPMethod,
|
|
113
|
+
(payload: NetworkRequestActionPayload<any>) => Promise<AxiosResponse<any, any>>
|
|
114
|
+
> = {
|
|
115
|
+
GET: processNetworkRequestGet,
|
|
116
|
+
POST: processNetworkRequestPost,
|
|
117
|
+
DELETE: processNetworkRequestDelete,
|
|
118
|
+
HEAD: processNetworkRequestHead,
|
|
119
|
+
OPTIONS: processNetworkRequestOptions,
|
|
120
|
+
PUT: processNetworkRequestPut,
|
|
121
|
+
PATCH: processNetworkRequestPatch,
|
|
122
|
+
CONNECT: processNetworkRequestConnect,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const processNetworkRequest: NetworkRequestActionProcessor<any, any> = async (payload) => {
|
|
126
|
+
const requestMethod = requestMethodMap[payload.method];
|
|
127
|
+
|
|
128
|
+
if (!requestMethod) {
|
|
129
|
+
return actionResultError(ErrorTypeEnum.NotImplemented, `${payload.method}: Not implemented`);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
try {
|
|
133
|
+
const response = await requestMethod(payload);
|
|
134
|
+
|
|
135
|
+
return actionResult({
|
|
136
|
+
headers: response.headers,
|
|
137
|
+
status: response.status,
|
|
138
|
+
statusText: response.statusText,
|
|
139
|
+
data: response.data,
|
|
140
|
+
});
|
|
141
|
+
} catch (err: any) {
|
|
142
|
+
console.log(err);
|
|
143
|
+
return actionResultError(ErrorTypeEnum.GenericError, err.stack);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export default {
|
|
148
|
+
[NetworkActionType.Request]: processNetworkRequest,
|
|
149
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PlatformActionType, PlatformDelayActionProcessor, actionResult } from 'quidproquo-core';
|
|
2
|
+
|
|
3
|
+
const processPlatformDelay: PlatformDelayActionProcessor = async ({ timeMs }) => {
|
|
4
|
+
return new Promise((resolve) => setTimeout(() => resolve(actionResult(undefined)), timeMs));
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
[PlatformActionType.Delay]: processPlatformDelay,
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {};
|
|
File without changes
|
package/src/actionProcessor/webserver/genericDataResource/GenericDataResourceActionProcessor.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {};
|
|
File without changes
|
package/tsconfig.json
ADDED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
-
const processDateNow = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
return (0, quidproquo_core_1.actionResult)(new Date().toISOString());
|
|
15
|
-
});
|
|
16
|
-
exports.default = {
|
|
17
|
-
[quidproquo_core_1.DateActionType.Now]: processDateNow,
|
|
18
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
-
const processErrorThrowError = ({ errorStack, errorText, errorType, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
return (0, quidproquo_core_1.actionResultError)(errorType, errorText, errorStack);
|
|
15
|
-
});
|
|
16
|
-
exports.default = {
|
|
17
|
-
[quidproquo_core_1.ErrorActionType.ThrowError]: processErrorThrowError,
|
|
18
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const uuid_1 = require("uuid");
|
|
13
|
-
const quidproquo_core_1 = require("quidproquo-core");
|
|
14
|
-
const processGuidNew = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
-
return (0, quidproquo_core_1.actionResult)((0, uuid_1.v4)());
|
|
16
|
-
});
|
|
17
|
-
exports.default = {
|
|
18
|
-
[quidproquo_core_1.GuidActionType.New]: processGuidNew,
|
|
19
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
"@quidproquo-core/Platform/Delay": import("quidproquo-core/lib").PlatformDelayActionProcessor;
|
|
3
|
-
"@quidproquo-core/Network/Request": import("quidproquo-core/lib").NetworkRequestActionProcessor<any, any>;
|
|
4
|
-
"@quidproquo-core/Math/RandomNumber": import("quidproquo-core/lib").MathRandomNumberActionProcessor;
|
|
5
|
-
"@quidproquo-core/Log/Create": import("quidproquo-core/lib").LogCreateActionProcessor;
|
|
6
|
-
"@quidproquo-core/Guid/New": import("quidproquo-core/lib").GuidNewActionProcessor;
|
|
7
|
-
"@quidproquo-core/error/ThrowError": import("quidproquo-core/lib").ErrorThrowErrorActionProcessor;
|
|
8
|
-
"@quidproquo-core/Date/Now": import("quidproquo-core/lib").DateNowActionProcessor;
|
|
9
|
-
};
|
|
10
|
-
export default _default;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const DateActionProcessor_1 = __importDefault(require("./date/DateActionProcessor"));
|
|
7
|
-
const ErrorActionProcessor_1 = __importDefault(require("./error/ErrorActionProcessor"));
|
|
8
|
-
const EventActionProcessor_1 = __importDefault(require("./event/EventActionProcessor"));
|
|
9
|
-
const GuidActionProcessor_1 = __importDefault(require("./guid/GuidActionProcessor"));
|
|
10
|
-
const LogActionProcessor_1 = __importDefault(require("./log/LogActionProcessor"));
|
|
11
|
-
const MathActionProcessor_1 = __importDefault(require("./math/MathActionProcessor"));
|
|
12
|
-
const NetworkActionProcessor_1 = __importDefault(require("./network/NetworkActionProcessor"));
|
|
13
|
-
const PlatformActionProcessor_1 = __importDefault(require("./platform/PlatformActionProcessor"));
|
|
14
|
-
const SystemActionProcessor_1 = __importDefault(require("./system/SystemActionProcessor"));
|
|
15
|
-
exports.default = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, DateActionProcessor_1.default), ErrorActionProcessor_1.default), EventActionProcessor_1.default), GuidActionProcessor_1.default), LogActionProcessor_1.default), MathActionProcessor_1.default), NetworkActionProcessor_1.default), PlatformActionProcessor_1.default), SystemActionProcessor_1.default);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
-
const processLogCreate = ({ msg, logLevel, dataJson }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
console.log(`${logLevel}: ${msg} ${dataJson || ''}`);
|
|
15
|
-
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
16
|
-
});
|
|
17
|
-
exports.default = {
|
|
18
|
-
[quidproquo_core_1.LogActionType.Create]: processLogCreate,
|
|
19
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
-
const processMathRandomNumber = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
return (0, quidproquo_core_1.actionResult)(Math.random());
|
|
15
|
-
});
|
|
16
|
-
exports.default = {
|
|
17
|
-
[quidproquo_core_1.MathActionType.RandomNumber]: processMathRandomNumber,
|
|
18
|
-
};
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const quidproquo_core_1 = require("quidproquo-core");
|
|
16
|
-
const axios_1 = __importDefault(require("axios"));
|
|
17
|
-
const axiosInstance = axios_1.default.create({
|
|
18
|
-
timeout: 10000,
|
|
19
|
-
headers: {
|
|
20
|
-
// Fixes: https://github.com/axios/axios/issues/5346
|
|
21
|
-
'Accept-Encoding': 'gzip,deflate,compress',
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
const processNetworkRequestGet = (payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
-
const response = yield axiosInstance.get(payload.url, {
|
|
26
|
-
baseURL: payload.basePath,
|
|
27
|
-
headers: payload.headers,
|
|
28
|
-
params: payload.params,
|
|
29
|
-
});
|
|
30
|
-
return response;
|
|
31
|
-
});
|
|
32
|
-
const processNetworkRequestPost = (payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
-
const response = yield axiosInstance.post(payload.url, payload.body, {
|
|
34
|
-
baseURL: payload.basePath,
|
|
35
|
-
headers: payload.headers,
|
|
36
|
-
params: payload.params,
|
|
37
|
-
});
|
|
38
|
-
return response;
|
|
39
|
-
});
|
|
40
|
-
const processNetworkRequestDelete = (payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
-
const response = yield axiosInstance.delete(payload.url, {
|
|
42
|
-
baseURL: payload.basePath,
|
|
43
|
-
headers: payload.headers,
|
|
44
|
-
params: payload.params,
|
|
45
|
-
});
|
|
46
|
-
return response;
|
|
47
|
-
});
|
|
48
|
-
const processNetworkRequestHead = (payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
-
const response = yield axiosInstance.head(payload.url, {
|
|
50
|
-
baseURL: payload.basePath,
|
|
51
|
-
headers: payload.headers,
|
|
52
|
-
params: payload.params,
|
|
53
|
-
});
|
|
54
|
-
return response;
|
|
55
|
-
});
|
|
56
|
-
const processNetworkRequestOptions = (payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
-
const response = yield axiosInstance.options(payload.url, {
|
|
58
|
-
baseURL: payload.basePath,
|
|
59
|
-
headers: payload.headers,
|
|
60
|
-
params: payload.params,
|
|
61
|
-
});
|
|
62
|
-
return response;
|
|
63
|
-
});
|
|
64
|
-
const processNetworkRequestPut = (payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
-
const response = yield axiosInstance.put(payload.url, payload.body, {
|
|
66
|
-
baseURL: payload.basePath,
|
|
67
|
-
headers: payload.headers,
|
|
68
|
-
params: payload.params,
|
|
69
|
-
});
|
|
70
|
-
return response;
|
|
71
|
-
});
|
|
72
|
-
const processNetworkRequestPatch = (payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
-
const response = yield axiosInstance.patch(payload.url, payload.body, {
|
|
74
|
-
baseURL: payload.basePath,
|
|
75
|
-
headers: payload.headers,
|
|
76
|
-
params: payload.params,
|
|
77
|
-
});
|
|
78
|
-
return response;
|
|
79
|
-
});
|
|
80
|
-
const processNetworkRequestConnect = (payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
|
-
throw new Error('Function not implemented.');
|
|
82
|
-
});
|
|
83
|
-
const requestMethodMap = {
|
|
84
|
-
GET: processNetworkRequestGet,
|
|
85
|
-
POST: processNetworkRequestPost,
|
|
86
|
-
DELETE: processNetworkRequestDelete,
|
|
87
|
-
HEAD: processNetworkRequestHead,
|
|
88
|
-
OPTIONS: processNetworkRequestOptions,
|
|
89
|
-
PUT: processNetworkRequestPut,
|
|
90
|
-
PATCH: processNetworkRequestPatch,
|
|
91
|
-
CONNECT: processNetworkRequestConnect,
|
|
92
|
-
};
|
|
93
|
-
const processNetworkRequest = (payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
-
const requestMethod = requestMethodMap[payload.method];
|
|
95
|
-
if (!requestMethod) {
|
|
96
|
-
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotImplemented, `${payload.method}: Not implemented`);
|
|
97
|
-
}
|
|
98
|
-
try {
|
|
99
|
-
const response = yield requestMethod(payload);
|
|
100
|
-
return (0, quidproquo_core_1.actionResult)({
|
|
101
|
-
headers: response.headers,
|
|
102
|
-
status: response.status,
|
|
103
|
-
statusText: response.statusText,
|
|
104
|
-
data: response.data,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
catch (err) {
|
|
108
|
-
console.log(err);
|
|
109
|
-
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, err.stack);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
exports.default = {
|
|
113
|
-
[quidproquo_core_1.NetworkActionType.Request]: processNetworkRequest,
|
|
114
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const quidproquo_core_1 = require("quidproquo-core");
|
|
13
|
-
const processPlatformDelay = ({ timeMs }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
return new Promise((resolve) => setTimeout(() => resolve((0, quidproquo_core_1.actionResult)(undefined)), timeMs));
|
|
15
|
-
});
|
|
16
|
-
exports.default = {
|
|
17
|
-
[quidproquo_core_1.PlatformActionType.Delay]: processPlatformDelay,
|
|
18
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.webserverActionProcessor = exports.coreActionProcessor = void 0;
|
|
7
|
-
var core_1 = require("./core");
|
|
8
|
-
Object.defineProperty(exports, "coreActionProcessor", { enumerable: true, get: function () { return __importDefault(core_1).default; } });
|
|
9
|
-
var webserver_1 = require("./webserver");
|
|
10
|
-
Object.defineProperty(exports, "webserverActionProcessor", { enumerable: true, get: function () { return __importDefault(webserver_1).default; } });
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const GenericDataResourceActionProcessor_1 = __importDefault(require("./genericDataResource/GenericDataResourceActionProcessor"));
|
|
7
|
-
exports.default = Object.assign({}, GenericDataResourceActionProcessor_1.default);
|
package/lib/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./actionProcessor"), exports);
|