quidproquo-actionprocessor-web 0.0.262 → 0.1.0
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/lib/commonjs/actionProcessor/core/config/getConfigSetParameterActionProcessor.js +3 -1
- package/lib/commonjs/actionProcessor/web/api/createApiRequestActionProcessor.d.ts +7 -0
- package/lib/commonjs/actionProcessor/web/api/createApiRequestActionProcessor.js +43 -0
- package/lib/commonjs/actionProcessor/web/api/index.d.ts +1 -0
- package/lib/commonjs/actionProcessor/web/api/index.js +17 -0
- package/lib/commonjs/actionProcessor/web/index.d.ts +1 -0
- package/lib/commonjs/actionProcessor/web/index.js +18 -1
- package/lib/commonjs/actionProcessor/web/window/getWindowGetLocationActionProcessor.d.ts +2 -0
- package/lib/commonjs/actionProcessor/{webserver/dns/getDnsListActionProcessor.js → web/window/getWindowGetLocationActionProcessor.js} +9 -8
- package/lib/commonjs/actionProcessor/web/window/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/{webserver/dns → web/window}/index.js +5 -5
- package/lib/commonjs/actionProcessor/webserver/index.js +4 -4
- package/lib/esm/actionProcessor/core/config/getConfigSetParameterActionProcessor.js +4 -2
- package/lib/esm/actionProcessor/web/api/createApiRequestActionProcessor.d.ts +7 -0
- package/lib/esm/actionProcessor/web/api/createApiRequestActionProcessor.js +30 -0
- package/lib/esm/actionProcessor/web/api/index.d.ts +1 -0
- package/lib/esm/actionProcessor/web/api/index.js +1 -0
- package/lib/esm/actionProcessor/web/index.d.ts +1 -0
- package/lib/esm/actionProcessor/web/index.js +5 -0
- package/lib/esm/actionProcessor/web/window/getWindowGetLocationActionProcessor.d.ts +2 -0
- package/lib/esm/actionProcessor/web/window/getWindowGetLocationActionProcessor.js +12 -0
- package/lib/esm/actionProcessor/web/window/index.d.ts +2 -0
- package/lib/esm/actionProcessor/web/window/index.js +4 -0
- package/lib/esm/actionProcessor/webserver/index.js +4 -4
- package/package.json +6 -11
- package/lib/commonjs/actionProcessor/webserver/dns/getDnsListActionProcessor.d.ts +0 -2
- package/lib/commonjs/actionProcessor/webserver/dns/index.d.ts +0 -2
- package/lib/esm/actionProcessor/webserver/dns/getDnsListActionProcessor.d.ts +0 -2
- package/lib/esm/actionProcessor/webserver/dns/getDnsListActionProcessor.js +0 -11
- package/lib/esm/actionProcessor/webserver/dns/index.d.ts +0 -2
- package/lib/esm/actionProcessor/webserver/dns/index.js +0 -4
|
@@ -18,7 +18,9 @@ const getProcessConfigSetParameter = (qpqConfig) => {
|
|
|
18
18
|
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
19
19
|
}
|
|
20
20
|
catch (error) {
|
|
21
|
-
return (0, quidproquo_core_1.
|
|
21
|
+
return (0, quidproquo_core_1.actionResultErrorFromCaughtError)(error, {
|
|
22
|
+
QuotaExceededError: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ConfigSetParameterErrorTypeEnum.QuotaExceeded, `Local Storage quota exceeded saving parameter '${parameterName}'.`),
|
|
23
|
+
});
|
|
22
24
|
}
|
|
23
25
|
});
|
|
24
26
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
+
export interface ApiRequestActionProcessorOptions {
|
|
3
|
+
resolveServiceBaseUrl?: (service: string) => string;
|
|
4
|
+
getHeaders?: () => Record<string, string> | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare const createApiRequestActionProcessor: (options?: ApiRequestActionProcessorOptions) => ActionProcessorListResolver;
|
|
7
|
+
export declare const getApiRequestActionProcessor: ActionProcessorListResolver;
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
exports.getApiRequestActionProcessor = exports.createApiRequestActionProcessor = void 0;
|
|
13
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
14
|
+
const quidproquo_web_1 = require("quidproquo-web");
|
|
15
|
+
const quidproquo_webserver_1 = require("quidproquo-webserver");
|
|
16
|
+
const defaultResolveServiceBaseUrl = (_service) => {
|
|
17
|
+
const { protocol, hostname, port } = window.location;
|
|
18
|
+
return `${protocol}//api.${hostname}${port ? `:${port}` : ''}`;
|
|
19
|
+
};
|
|
20
|
+
const getProcessApiRequest = (options) => {
|
|
21
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ service, endpoint, method, body, params, headers, responseType }) {
|
|
22
|
+
var _b, _c;
|
|
23
|
+
const basePath = ((_b = options === null || options === void 0 ? void 0 : options.resolveServiceBaseUrl) !== null && _b !== void 0 ? _b : defaultResolveServiceBaseUrl)(service);
|
|
24
|
+
const res = yield (0, quidproquo_webserver_1.preformNetworkRequest)({
|
|
25
|
+
url: endpoint,
|
|
26
|
+
basePath,
|
|
27
|
+
method,
|
|
28
|
+
body,
|
|
29
|
+
params,
|
|
30
|
+
responseType,
|
|
31
|
+
headers: Object.assign(Object.assign({}, headers), (_c = options === null || options === void 0 ? void 0 : options.getHeaders) === null || _c === void 0 ? void 0 : _c.call(options)),
|
|
32
|
+
});
|
|
33
|
+
return (0, quidproquo_core_1.actionResult)(res);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const createApiRequestActionProcessor = (options) => () => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
+
return ({
|
|
38
|
+
[quidproquo_web_1.ApiActionType.Request]: getProcessApiRequest(options),
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
exports.createApiRequestActionProcessor = createApiRequestActionProcessor;
|
|
42
|
+
// Zero-config default registered in the standard web processors.
|
|
43
|
+
exports.getApiRequestActionProcessor = (0, exports.createApiRequestActionProcessor)();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createApiRequestActionProcessor';
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./createApiRequestActionProcessor"), exports);
|
|
@@ -1,4 +1,18 @@
|
|
|
1
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
|
+
};
|
|
2
16
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
17
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
18
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -10,8 +24,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
24
|
};
|
|
11
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
26
|
exports.getWebActionProcessor = void 0;
|
|
27
|
+
const api_1 = require("./api");
|
|
13
28
|
const queryParams_1 = require("./queryParams");
|
|
29
|
+
const window_1 = require("./window");
|
|
30
|
+
__exportStar(require("./api"), exports);
|
|
14
31
|
const getWebActionProcessor = (qpqConfig, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
-
return (Object.assign({}, (yield (0, queryParams_1.getQueryParamsActionProcessor)(qpqConfig, dynamicModuleLoader))));
|
|
32
|
+
return (Object.assign(Object.assign(Object.assign({}, (yield (0, api_1.getApiRequestActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, queryParams_1.getQueryParamsActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, window_1.getWindowActionProcessor)(qpqConfig, dynamicModuleLoader))));
|
|
16
33
|
});
|
|
17
34
|
exports.getWebActionProcessor = getWebActionProcessor;
|
|
@@ -9,18 +9,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.getWindowGetLocationActionProcessor = void 0;
|
|
13
13
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const quidproquo_web_1 = require("quidproquo-web");
|
|
15
|
+
const getProcessWindowGetLocation = (qpqConfig) => {
|
|
16
16
|
return () => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
const
|
|
18
|
-
|
|
17
|
+
const { href, origin, protocol, host, hostname, port, pathname, search, hash } = window.location;
|
|
18
|
+
// Return a plain serializable copy, never the live Location object.
|
|
19
|
+
return (0, quidproquo_core_1.actionResult)({ href, origin, protocol, host, hostname, port, pathname, search, hash });
|
|
19
20
|
});
|
|
20
21
|
};
|
|
21
|
-
const
|
|
22
|
+
const getWindowGetLocationActionProcessor = (qpqConfig) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
23
|
return ({
|
|
23
|
-
[
|
|
24
|
+
[quidproquo_web_1.WindowActionType.GetLocation]: getProcessWindowGetLocation(qpqConfig),
|
|
24
25
|
});
|
|
25
26
|
});
|
|
26
|
-
exports.
|
|
27
|
+
exports.getWindowGetLocationActionProcessor = getWindowGetLocationActionProcessor;
|
|
@@ -9,9 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
return (Object.assign({}, (yield (0,
|
|
12
|
+
exports.getWindowActionProcessor = void 0;
|
|
13
|
+
const getWindowGetLocationActionProcessor_1 = require("./getWindowGetLocationActionProcessor");
|
|
14
|
+
const getWindowActionProcessor = (qpqConfig, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
return (Object.assign({}, (yield (0, getWindowGetLocationActionProcessor_1.getWindowGetLocationActionProcessor)(qpqConfig, dynamicModuleLoader))));
|
|
16
16
|
});
|
|
17
|
-
exports.
|
|
17
|
+
exports.getWindowActionProcessor = getWindowActionProcessor;
|
|
@@ -10,8 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getWebserverActionProcessor = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
13
|
+
// Shared webserver processors (dns, ...) are owned by quidproquo-actionprocessor-js and
|
|
14
|
+
// spread in by getWebActionProcessors. This aggregator holds only web-specific webserver
|
|
15
|
+
// processors (none yet).
|
|
16
|
+
const getWebserverActionProcessor = (_qpqConfig, _dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () { return ({}); });
|
|
17
17
|
exports.getWebserverActionProcessor = getWebserverActionProcessor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { actionResult, actionResultError, ConfigActionType,
|
|
1
|
+
import { actionResult, actionResultError, actionResultErrorFromCaughtError, ConfigActionType, ConfigSetParameterErrorTypeEnum, } from 'quidproquo-core';
|
|
2
2
|
const getProcessConfigSetParameter = (qpqConfig) => {
|
|
3
3
|
return async ({ parameterName, parameterValue }) => {
|
|
4
4
|
try {
|
|
@@ -6,7 +6,9 @@ const getProcessConfigSetParameter = (qpqConfig) => {
|
|
|
6
6
|
return actionResult(void 0);
|
|
7
7
|
}
|
|
8
8
|
catch (error) {
|
|
9
|
-
return
|
|
9
|
+
return actionResultErrorFromCaughtError(error, {
|
|
10
|
+
QuotaExceededError: () => actionResultError(ConfigSetParameterErrorTypeEnum.QuotaExceeded, `Local Storage quota exceeded saving parameter '${parameterName}'.`),
|
|
11
|
+
});
|
|
10
12
|
}
|
|
11
13
|
};
|
|
12
14
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionProcessorListResolver } from 'quidproquo-core';
|
|
2
|
+
export interface ApiRequestActionProcessorOptions {
|
|
3
|
+
resolveServiceBaseUrl?: (service: string) => string;
|
|
4
|
+
getHeaders?: () => Record<string, string> | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare const createApiRequestActionProcessor: (options?: ApiRequestActionProcessorOptions) => ActionProcessorListResolver;
|
|
7
|
+
export declare const getApiRequestActionProcessor: ActionProcessorListResolver;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { actionResult } from 'quidproquo-core';
|
|
2
|
+
import { ApiActionType } from 'quidproquo-web';
|
|
3
|
+
import { preformNetworkRequest } from 'quidproquo-webserver';
|
|
4
|
+
const defaultResolveServiceBaseUrl = (_service) => {
|
|
5
|
+
const { protocol, hostname, port } = window.location;
|
|
6
|
+
return `${protocol}//api.${hostname}${port ? `:${port}` : ''}`;
|
|
7
|
+
};
|
|
8
|
+
const getProcessApiRequest = (options) => {
|
|
9
|
+
return async ({ service, endpoint, method, body, params, headers, responseType }) => {
|
|
10
|
+
const basePath = (options?.resolveServiceBaseUrl ?? defaultResolveServiceBaseUrl)(service);
|
|
11
|
+
const res = await preformNetworkRequest({
|
|
12
|
+
url: endpoint,
|
|
13
|
+
basePath,
|
|
14
|
+
method,
|
|
15
|
+
body,
|
|
16
|
+
params,
|
|
17
|
+
responseType,
|
|
18
|
+
headers: {
|
|
19
|
+
...headers,
|
|
20
|
+
...options?.getHeaders?.(),
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
return actionResult(res);
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export const createApiRequestActionProcessor = (options) => async () => ({
|
|
27
|
+
[ApiActionType.Request]: getProcessApiRequest(options),
|
|
28
|
+
});
|
|
29
|
+
// Zero-config default registered in the standard web processors.
|
|
30
|
+
export const getApiRequestActionProcessor = createApiRequestActionProcessor();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createApiRequestActionProcessor';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createApiRequestActionProcessor';
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import { getApiRequestActionProcessor } from './api';
|
|
1
2
|
import { getQueryParamsActionProcessor } from './queryParams';
|
|
3
|
+
import { getWindowActionProcessor } from './window';
|
|
4
|
+
export * from './api';
|
|
2
5
|
export const getWebActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
|
|
6
|
+
...(await getApiRequestActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
3
7
|
...(await getQueryParamsActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
8
|
+
...(await getWindowActionProcessor(qpqConfig, dynamicModuleLoader)),
|
|
4
9
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { actionResult } from 'quidproquo-core';
|
|
2
|
+
import { WindowActionType } from 'quidproquo-web';
|
|
3
|
+
const getProcessWindowGetLocation = (qpqConfig) => {
|
|
4
|
+
return async () => {
|
|
5
|
+
const { href, origin, protocol, host, hostname, port, pathname, search, hash } = window.location;
|
|
6
|
+
// Return a plain serializable copy, never the live Location object.
|
|
7
|
+
return actionResult({ href, origin, protocol, host, hostname, port, pathname, search, hash });
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export const getWindowGetLocationActionProcessor = async (qpqConfig) => ({
|
|
11
|
+
[WindowActionType.GetLocation]: getProcessWindowGetLocation(qpqConfig),
|
|
12
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
});
|
|
1
|
+
// Shared webserver processors (dns, ...) are owned by quidproquo-actionprocessor-js and
|
|
2
|
+
// spread in by getWebActionProcessors. This aggregator holds only web-specific webserver
|
|
3
|
+
// processors (none yet).
|
|
4
|
+
export const getWebserverActionProcessor = async (_qpqConfig, _dynamicModuleLoader) => ({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-actionprocessor-web",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -33,19 +33,14 @@
|
|
|
33
33
|
"homepage": "https://github.com/joe-coady/quidproquo#readme",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@anthropic-ai/sdk": "^0.19.1",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"quidproquo-
|
|
39
|
-
"quidproquo-
|
|
40
|
-
"quidproquo-web": "0.0.262",
|
|
41
|
-
"quidproquo-webserver": "0.0.262",
|
|
42
|
-
"uuid": "^9.0.0",
|
|
36
|
+
"quidproquo-actionprocessor-js": "0.1.0",
|
|
37
|
+
"quidproquo-core": "0.1.0",
|
|
38
|
+
"quidproquo-web": "0.1.0",
|
|
39
|
+
"quidproquo-webserver": "0.1.0",
|
|
43
40
|
"uuidv7": "^1.0.1"
|
|
44
41
|
},
|
|
45
42
|
"devDependencies": {
|
|
46
|
-
"
|
|
47
|
-
"@types/uuid": "^9.0.0",
|
|
48
|
-
"quidproquo-tsconfig": "0.0.262",
|
|
43
|
+
"quidproquo-tsconfig": "0.1.0",
|
|
49
44
|
"typescript": "^5.8.2"
|
|
50
45
|
}
|
|
51
46
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { actionResult } from 'quidproquo-core';
|
|
2
|
-
import { DnsActionType, qpqWebServerUtils } from 'quidproquo-webserver';
|
|
3
|
-
const getProcessDnsList = (qpqConfig) => {
|
|
4
|
-
return async () => {
|
|
5
|
-
const dnsList = qpqWebServerUtils.getDnsConfigs(qpqConfig).map((dc) => dc.dnsBase);
|
|
6
|
-
return actionResult(dnsList);
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export const getDnsListActionProcessor = async (qpqConfig) => ({
|
|
10
|
-
[DnsActionType.List]: getProcessDnsList(qpqConfig),
|
|
11
|
-
});
|