@qpqjs/actionprocessor-web 0.0.0-stage → 0.2.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/README.md +30 -2
- package/lib/commonjs/actionProcessor/core/config/getConfigGetParameterActionProcessor.d.ts +1 -0
- package/lib/commonjs/actionProcessor/core/config/getConfigGetParameterActionProcessor.js +26 -0
- package/lib/commonjs/actionProcessor/core/config/getConfigGetParameterActionProcessor.js.map +1 -0
- package/lib/commonjs/actionProcessor/core/config/getConfigGetParametersActionProcessor.d.ts +1 -0
- package/lib/commonjs/actionProcessor/core/config/getConfigGetParametersActionProcessor.js +30 -0
- package/lib/commonjs/actionProcessor/core/config/getConfigGetParametersActionProcessor.js.map +1 -0
- package/lib/commonjs/actionProcessor/core/config/getConfigSetParameterActionProcessor.d.ts +1 -0
- package/lib/commonjs/actionProcessor/core/config/getConfigSetParameterActionProcessor.js +30 -0
- package/lib/commonjs/actionProcessor/core/config/getConfigSetParameterActionProcessor.js.map +1 -0
- package/lib/commonjs/actionProcessor/core/config/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/config/index.js +20 -0
- package/lib/commonjs/actionProcessor/core/config/index.js.map +1 -0
- package/lib/commonjs/actionProcessor/core/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/core/index.js +18 -0
- package/lib/commonjs/actionProcessor/core/index.js.map +1 -0
- package/lib/commonjs/actionProcessor/index.d.ts +3 -0
- package/lib/commonjs/actionProcessor/index.js +20 -0
- package/lib/commonjs/actionProcessor/index.js.map +1 -0
- package/lib/commonjs/actionProcessor/web/api/createApiRequestActionProcessor.d.ts +7 -0
- package/lib/commonjs/actionProcessor/web/api/createApiRequestActionProcessor.js +53 -0
- package/lib/commonjs/actionProcessor/web/api/createApiRequestActionProcessor.js.map +1 -0
- package/lib/commonjs/actionProcessor/web/api/index.d.ts +1 -0
- package/lib/commonjs/actionProcessor/web/api/index.js +18 -0
- package/lib/commonjs/actionProcessor/web/api/index.js.map +1 -0
- package/lib/commonjs/actionProcessor/web/index.d.ts +3 -0
- package/lib/commonjs/actionProcessor/web/index.js +35 -0
- package/lib/commonjs/actionProcessor/web/index.js.map +1 -0
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.d.ts +1 -0
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.js +23 -0
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.js.map +1 -0
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.d.ts +1 -0
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.js +33 -0
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.js.map +1 -0
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.d.ts +1 -0
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.js +35 -0
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.js.map +1 -0
- package/lib/commonjs/actionProcessor/web/queryParams/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/web/queryParams/index.js +20 -0
- package/lib/commonjs/actionProcessor/web/queryParams/index.js.map +1 -0
- package/lib/commonjs/actionProcessor/web/window/getWindowGetLocationActionProcessor.d.ts +1 -0
- package/lib/commonjs/actionProcessor/web/window/getWindowGetLocationActionProcessor.js +23 -0
- package/lib/commonjs/actionProcessor/web/window/getWindowGetLocationActionProcessor.js.map +1 -0
- package/lib/commonjs/actionProcessor/web/window/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/web/window/index.js +18 -0
- package/lib/commonjs/actionProcessor/web/window/index.js.map +1 -0
- package/lib/commonjs/actionProcessor/webserver/index.d.ts +2 -0
- package/lib/commonjs/actionProcessor/webserver/index.js +18 -0
- package/lib/commonjs/actionProcessor/webserver/index.js.map +1 -0
- package/lib/commonjs/getWebActionProcessors.d.ts +2 -0
- package/lib/commonjs/getWebActionProcessors.js +21 -0
- package/lib/commonjs/getWebActionProcessors.js.map +1 -0
- package/lib/commonjs/index.d.ts +2 -0
- package/lib/commonjs/index.js +19 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/esm/actionProcessor/core/config/getConfigGetParameterActionProcessor.d.ts +1 -0
- package/lib/esm/actionProcessor/core/config/getConfigGetParameterActionProcessor.js +14 -0
- package/lib/esm/actionProcessor/core/config/getConfigGetParameterActionProcessor.js.map +1 -0
- package/lib/esm/actionProcessor/core/config/getConfigGetParametersActionProcessor.d.ts +1 -0
- package/lib/esm/actionProcessor/core/config/getConfigGetParametersActionProcessor.js +18 -0
- package/lib/esm/actionProcessor/core/config/getConfigGetParametersActionProcessor.js.map +1 -0
- package/lib/esm/actionProcessor/core/config/getConfigSetParameterActionProcessor.d.ts +1 -0
- package/lib/esm/actionProcessor/core/config/getConfigSetParameterActionProcessor.js +18 -0
- package/lib/esm/actionProcessor/core/config/getConfigSetParameterActionProcessor.js.map +1 -0
- package/lib/esm/actionProcessor/core/config/index.d.ts +2 -0
- package/lib/esm/actionProcessor/core/config/index.js +9 -0
- package/lib/esm/actionProcessor/core/config/index.js.map +1 -0
- package/lib/esm/actionProcessor/core/index.d.ts +2 -0
- package/lib/esm/actionProcessor/core/index.js +5 -0
- package/lib/esm/actionProcessor/core/index.js.map +1 -0
- package/lib/esm/actionProcessor/index.d.ts +3 -0
- package/lib/esm/actionProcessor/index.js +4 -0
- package/lib/esm/actionProcessor/index.js.map +1 -0
- package/lib/esm/actionProcessor/web/api/createApiRequestActionProcessor.d.ts +7 -0
- package/lib/esm/actionProcessor/web/api/createApiRequestActionProcessor.js +40 -0
- package/lib/esm/actionProcessor/web/api/createApiRequestActionProcessor.js.map +1 -0
- package/lib/esm/actionProcessor/web/api/index.d.ts +1 -0
- package/lib/esm/actionProcessor/web/api/index.js +2 -0
- package/lib/esm/actionProcessor/web/api/index.js.map +1 -0
- package/lib/esm/actionProcessor/web/index.d.ts +3 -0
- package/lib/esm/actionProcessor/web/index.js +10 -0
- package/lib/esm/actionProcessor/web/index.js.map +1 -0
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.d.ts +1 -0
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.js +11 -0
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.js.map +1 -0
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.d.ts +1 -0
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.js +21 -0
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.js.map +1 -0
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.d.ts +1 -0
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.js +23 -0
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.js.map +1 -0
- package/lib/esm/actionProcessor/web/queryParams/index.d.ts +2 -0
- package/lib/esm/actionProcessor/web/queryParams/index.js +9 -0
- package/lib/esm/actionProcessor/web/queryParams/index.js.map +1 -0
- package/lib/esm/actionProcessor/web/window/getWindowGetLocationActionProcessor.d.ts +1 -0
- package/lib/esm/actionProcessor/web/window/getWindowGetLocationActionProcessor.js +11 -0
- package/lib/esm/actionProcessor/web/window/getWindowGetLocationActionProcessor.js.map +1 -0
- package/lib/esm/actionProcessor/web/window/index.d.ts +2 -0
- package/lib/esm/actionProcessor/web/window/index.js +5 -0
- package/lib/esm/actionProcessor/web/window/index.js.map +1 -0
- package/lib/esm/actionProcessor/webserver/index.d.ts +2 -0
- package/lib/esm/actionProcessor/webserver/index.js +5 -0
- package/lib/esm/actionProcessor/webserver/index.js.map +1 -0
- package/lib/esm/getWebActionProcessors.d.ts +2 -0
- package/lib/esm/getWebActionProcessors.js +13 -0
- package/lib/esm/getWebActionProcessors.js.map +1 -0
- package/lib/esm/index.d.ts +2 -0
- package/lib/esm/index.js +3 -0
- package/lib/esm/index.js.map +1 -0
- package/package.json +45 -3
package/README.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @qpqjs/actionprocessor-web
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The browser runtime for [quidproquo](https://github.com/qpqjs/quidproquo).
|
|
4
|
+
|
|
5
|
+
A qpq story yields actions, and a **processor** is the function that actually carries one out. This package supplies the processors a story needs when it runs in the browser, so the same story code can run on the client and the server.
|
|
6
|
+
|
|
7
|
+
You do not usually install this yourself. It arrives as a dependency of `@qpqjs/web-react`.
|
|
8
|
+
|
|
9
|
+
## What it implements
|
|
10
|
+
|
|
11
|
+
- **Web actions**: window and location access, query parameter reads and writes
|
|
12
|
+
- **Api actions**: calling your qpq service apis from the client, with the same typed requesters the backend uses
|
|
13
|
+
- **Config**: reading client-side config values
|
|
14
|
+
|
|
15
|
+
Everything platform-neutral (dates, guids, http, logging) comes from `@qpqjs/actionprocessor-js`.
|
|
16
|
+
|
|
17
|
+
## The point of it
|
|
18
|
+
|
|
19
|
+
A frontend story and a backend story are the same kind of thing. Shared validation, shared calculations, and shared workflow logic can live in one place and run on whichever side needs them, because both sides resolve their actions through a runtime rather than calling APIs directly.
|
|
20
|
+
|
|
21
|
+
## Status
|
|
22
|
+
|
|
23
|
+
Pre-1.0. The whole `@qpqjs/*` family releases in lockstep, so versions that share a number were built and tested together. Expect APIs to move between releases, and pin your versions.
|
|
24
|
+
|
|
25
|
+
## Documentation
|
|
26
|
+
|
|
27
|
+
[docs.quidproquojs.com](https://docs.quidproquojs.com)
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
MIT. See [LICENSE](https://github.com/qpqjs/quidproquo/blob/main/LICENSE).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getConfigGetParameterActionProcessor: import("@qpqjs/core").ActionProcessorListResolver;
|
|
@@ -0,0 +1,26 @@
|
|
|
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.getConfigGetParameterActionProcessor = void 0;
|
|
13
|
+
const core_1 = require("@qpqjs/core");
|
|
14
|
+
const getProcessConfigGetParameter = (qpqConfig) => {
|
|
15
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ parameterName }) {
|
|
16
|
+
// window.localStorage (not the bare global): Node exposes a non-functional
|
|
17
|
+
// localStorage global that shadows jsdom's in tests.
|
|
18
|
+
const parameterValue = window.localStorage.getItem(parameterName);
|
|
19
|
+
if (parameterValue === null) {
|
|
20
|
+
return (0, core_1.actionResultError)(core_1.ErrorTypeEnum.NotFound, `Parameter '${parameterName}' not found in Local Storage`);
|
|
21
|
+
}
|
|
22
|
+
return (0, core_1.actionResult)(parameterValue);
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
exports.getConfigGetParameterActionProcessor = (0, core_1.createActionProcessor)(core_1.askConfigGetParameter, getProcessConfigGetParameter);
|
|
26
|
+
//# sourceMappingURL=getConfigGetParameterActionProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getConfigGetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParameterActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAoJ;AAEpJ,MAAM,4BAA4B,GAAG,CAAC,SAAoB,EAA8C,EAAE;IACxG,OAAO,KAA0B,EAAE,4CAArB,EAAE,aAAa,EAAE;QAC7B,2EAA2E;QAC3E,qDAAqD;QACrD,MAAM,cAAc,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAElE,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;YAC5B,OAAO,IAAA,wBAAiB,EAAC,oBAAa,CAAC,QAAQ,EAAE,cAAc,aAAa,8BAA8B,CAAC,CAAC;QAC9G,CAAC;QAED,OAAO,IAAA,mBAAY,EAAC,cAAc,CAAC,CAAC;IACtC,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,oCAAoC,GAAG,IAAA,4BAAqB,EAAC,4BAAqB,EAAE,4BAA4B,CAAC,CAAC","sourcesContent":["import { actionResult, actionResultError, askConfigGetParameter, createActionProcessor, ErrorTypeEnum, ProcessorFor, QPQConfig } from '@qpqjs/core';\n\nconst getProcessConfigGetParameter = (qpqConfig: QPQConfig): ProcessorFor<typeof askConfigGetParameter> => {\n return async ({ parameterName }) => {\n // window.localStorage (not the bare global): Node exposes a non-functional\n // localStorage global that shadows jsdom's in tests.\n const parameterValue = window.localStorage.getItem(parameterName);\n\n if (parameterValue === null) {\n return actionResultError(ErrorTypeEnum.NotFound, `Parameter '${parameterName}' not found in Local Storage`);\n }\n\n return actionResult(parameterValue);\n };\n};\n\nexport const getConfigGetParameterActionProcessor = createActionProcessor(askConfigGetParameter, getProcessConfigGetParameter);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getConfigGetParametersActionProcessor: import("@qpqjs/core").ActionProcessorListResolver;
|
|
@@ -0,0 +1,30 @@
|
|
|
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.getConfigGetParametersActionProcessor = void 0;
|
|
13
|
+
const core_1 = require("@qpqjs/core");
|
|
14
|
+
const getProcessConfigGetParameters = (qpqConfig) => {
|
|
15
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ parameterNames }) {
|
|
16
|
+
// window.localStorage (not the bare global): Node exposes a non-functional
|
|
17
|
+
// localStorage global that shadows jsdom's in tests.
|
|
18
|
+
const parameterValues = parameterNames.map((name) => ({
|
|
19
|
+
name,
|
|
20
|
+
value: window.localStorage.getItem(name),
|
|
21
|
+
}));
|
|
22
|
+
const missingNames = parameterValues.filter((param) => param.value === null).map((param) => param.name);
|
|
23
|
+
if (missingNames.length > 0) {
|
|
24
|
+
return (0, core_1.actionResultError)(core_1.ErrorTypeEnum.NotFound, `Parameters not found in Local Storage: ${missingNames.join(', ')}`);
|
|
25
|
+
}
|
|
26
|
+
return (0, core_1.actionResult)(parameterValues.map((param) => param.value));
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
exports.getConfigGetParametersActionProcessor = (0, core_1.createActionProcessor)(core_1.askConfigGetParameters, getProcessConfigGetParameters);
|
|
30
|
+
//# sourceMappingURL=getConfigGetParametersActionProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getConfigGetParametersActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParametersActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAqJ;AAErJ,MAAM,6BAA6B,GAAG,CAAC,SAAoB,EAA+C,EAAE;IAC1G,OAAO,KAA2B,EAAE,4CAAtB,EAAE,cAAc,EAAE;QAC9B,2EAA2E;QAC3E,qDAAqD;QACrD,MAAM,eAAe,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACpD,IAAI;YACJ,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC;SACzC,CAAC,CAAC,CAAC;QAEJ,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxG,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAA,wBAAiB,EAAC,oBAAa,CAAC,QAAQ,EAAE,0CAA0C,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxH,CAAC;QAED,OAAO,IAAA,mBAAY,EAAC,eAAe,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAe,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,qCAAqC,GAAG,IAAA,4BAAqB,EAAC,6BAAsB,EAAE,6BAA6B,CAAC,CAAC","sourcesContent":["import { actionResult, actionResultError, askConfigGetParameters, createActionProcessor, ErrorTypeEnum, ProcessorFor, QPQConfig } from '@qpqjs/core';\n\nconst getProcessConfigGetParameters = (qpqConfig: QPQConfig): ProcessorFor<typeof askConfigGetParameters> => {\n return async ({ parameterNames }) => {\n // window.localStorage (not the bare global): Node exposes a non-functional\n // localStorage global that shadows jsdom's in tests.\n const parameterValues = parameterNames.map((name) => ({\n name,\n value: window.localStorage.getItem(name),\n }));\n\n const missingNames = parameterValues.filter((param) => param.value === null).map((param) => param.name);\n if (missingNames.length > 0) {\n return actionResultError(ErrorTypeEnum.NotFound, `Parameters not found in Local Storage: ${missingNames.join(', ')}`);\n }\n\n return actionResult(parameterValues.map((param) => param.value as string));\n };\n};\n\nexport const getConfigGetParametersActionProcessor = createActionProcessor(askConfigGetParameters, getProcessConfigGetParameters);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getConfigSetParameterActionProcessor: import("@qpqjs/core").ActionProcessorListResolver;
|
|
@@ -0,0 +1,30 @@
|
|
|
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.getConfigSetParameterActionProcessor = void 0;
|
|
13
|
+
const core_1 = require("@qpqjs/core");
|
|
14
|
+
const getProcessConfigSetParameter = (qpqConfig) => {
|
|
15
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ parameterName, parameterValue }) {
|
|
16
|
+
try {
|
|
17
|
+
// window.localStorage (not the bare global): Node exposes a non-functional
|
|
18
|
+
// localStorage global that shadows jsdom's in tests.
|
|
19
|
+
window.localStorage.setItem(parameterName, parameterValue);
|
|
20
|
+
return (0, core_1.actionResult)(void 0);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return (0, core_1.actionResultErrorFromCaughtError)(error, {
|
|
24
|
+
QuotaExceededError: () => (0, core_1.actionResultError)(core_1.askConfigSetParameter.errorType.QuotaExceeded, `Local Storage quota exceeded saving parameter '${parameterName}'.`),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
exports.getConfigSetParameterActionProcessor = (0, core_1.createActionProcessor)(core_1.askConfigSetParameter, getProcessConfigSetParameter);
|
|
30
|
+
//# sourceMappingURL=getConfigSetParameterActionProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getConfigSetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigSetParameterActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAQqB;AAErB,MAAM,4BAA4B,GAAG,CAAC,SAAoB,EAA8C,EAAE;IACxG,OAAO,KAA0C,EAAE,4CAArC,EAAE,aAAa,EAAE,cAAc,EAAE;QAC7C,IAAI,CAAC;YACH,2EAA2E;YAC3E,qDAAqD;YACrD,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;YAE3D,OAAO,IAAA,mBAAY,EAAC,KAAK,CAAC,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,IAAA,uCAAgC,EAAC,KAAK,EAAE;gBAC7C,kBAAkB,EAAE,GAAG,EAAE,CACvB,IAAA,wBAAiB,EAAC,4BAAqB,CAAC,SAAS,CAAC,aAAa,EAAE,kDAAkD,aAAa,IAAI,CAAC;aACxI,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,oCAAoC,GAAG,IAAA,4BAAqB,EAAC,4BAAqB,EAAE,4BAA4B,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n askConfigSetParameter,\n createActionProcessor,\n ProcessorFor,\n QPQConfig,\n} from '@qpqjs/core';\n\nconst getProcessConfigSetParameter = (qpqConfig: QPQConfig): ProcessorFor<typeof askConfigSetParameter> => {\n return async ({ parameterName, parameterValue }) => {\n try {\n // window.localStorage (not the bare global): Node exposes a non-functional\n // localStorage global that shadows jsdom's in tests.\n window.localStorage.setItem(parameterName, parameterValue);\n\n return actionResult(void 0);\n } catch (error: unknown) {\n return actionResultErrorFromCaughtError(error, {\n QuotaExceededError: () =>\n actionResultError(askConfigSetParameter.errorType.QuotaExceeded, `Local Storage quota exceeded saving parameter '${parameterName}'.`),\n });\n }\n };\n};\n\nexport const getConfigSetParameterActionProcessor = createActionProcessor(askConfigSetParameter, getProcessConfigSetParameter);\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
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.getConfigActionProcessor = void 0;
|
|
13
|
+
const getConfigGetParameterActionProcessor_1 = require("./getConfigGetParameterActionProcessor");
|
|
14
|
+
const getConfigGetParametersActionProcessor_1 = require("./getConfigGetParametersActionProcessor");
|
|
15
|
+
const getConfigSetParameterActionProcessor_1 = require("./getConfigSetParameterActionProcessor");
|
|
16
|
+
const getConfigActionProcessor = (qpqConfig, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
return (Object.assign(Object.assign(Object.assign({}, (yield (0, getConfigGetParameterActionProcessor_1.getConfigGetParameterActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getConfigGetParametersActionProcessor_1.getConfigGetParametersActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getConfigSetParameterActionProcessor_1.getConfigSetParameterActionProcessor)(qpqConfig, dynamicModuleLoader))));
|
|
18
|
+
});
|
|
19
|
+
exports.getConfigActionProcessor = getConfigActionProcessor;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,iGAA8F;AAC9F,mGAAgG;AAChG,iGAA8F;AAEvF,MAAM,wBAAwB,GAAgC,CACnE,SAAoB,EACpB,mBAAwC,EACV,EAAE;IAAC,OAAA,+CAC9B,CAAC,MAAM,IAAA,2EAAoC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAC5E,CAAC,MAAM,IAAA,6EAAqC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAC7E,CAAC,MAAM,IAAA,2EAAoC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,EAC/E,CAAA;EAAA,CAAC;AAPU,QAAA,wBAAwB,4BAOlC","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, DynamicModuleLoader, QPQConfig } from '@qpqjs/core';\n\nimport { getConfigGetParameterActionProcessor } from './getConfigGetParameterActionProcessor';\nimport { getConfigGetParametersActionProcessor } from './getConfigGetParametersActionProcessor';\nimport { getConfigSetParameterActionProcessor } from './getConfigSetParameterActionProcessor';\n\nexport const getConfigActionProcessor: ActionProcessorListResolver = async (\n qpqConfig: QPQConfig,\n dynamicModuleLoader: DynamicModuleLoader,\n): Promise<ActionProcessorList> => ({\n ...(await getConfigGetParameterActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getConfigGetParametersActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getConfigSetParameterActionProcessor(qpqConfig, dynamicModuleLoader)),\n});\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
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.getCoreActionProcessor = void 0;
|
|
13
|
+
const config_1 = require("./config");
|
|
14
|
+
const getCoreActionProcessor = (qpqConfig, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
return (Object.assign({}, (yield (0, config_1.getConfigActionProcessor)(qpqConfig, dynamicModuleLoader))));
|
|
16
|
+
});
|
|
17
|
+
exports.getCoreActionProcessor = getCoreActionProcessor;
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actionProcessor/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,qCAAoD;AAE7C,MAAM,sBAAsB,GAAgC,CACjE,SAAoB,EACpB,mBAAwC,EACV,EAAE;IAAC,OAAA,mBAC9B,CAAC,MAAM,IAAA,iCAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,EACnE,CAAA;EAAA,CAAC;AALU,QAAA,sBAAsB,0BAKhC","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, DynamicModuleLoader, QPQConfig } from '@qpqjs/core';\n\nimport { getConfigActionProcessor } from './config';\n\nexport const getCoreActionProcessor: ActionProcessorListResolver = async (\n qpqConfig: QPQConfig,\n dynamicModuleLoader: DynamicModuleLoader,\n): Promise<ActionProcessorList> => ({\n ...(await getConfigActionProcessor(qpqConfig, dynamicModuleLoader)),\n});\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./core"), exports);
|
|
18
|
+
__exportStar(require("./web"), exports);
|
|
19
|
+
__exportStar(require("./webserver"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actionProcessor/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,wCAAsB;AACtB,8CAA4B","sourcesContent":["export * from './core';\nexport * from './web';\nexport * from './webserver';\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionProcessorListResolver, Nullable } from '@qpqjs/core';
|
|
2
|
+
export type ApiRequestActionProcessorOptions = {
|
|
3
|
+
resolveServiceBaseUrl?: (service: string) => string;
|
|
4
|
+
getHeaders?: () => Nullable<Record<string, string>>;
|
|
5
|
+
};
|
|
6
|
+
export declare const createApiRequestActionProcessor: (options?: ApiRequestActionProcessorOptions) => ActionProcessorListResolver;
|
|
7
|
+
export declare const getApiRequestActionProcessor: ActionProcessorListResolver;
|
|
@@ -0,0 +1,53 @@
|
|
|
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 core_1 = require("@qpqjs/core");
|
|
14
|
+
const webserver_1 = require("@qpqjs/webserver");
|
|
15
|
+
const defaultResolveServiceBaseUrl = (_service) => {
|
|
16
|
+
const { protocol, hostname, port } = window.location;
|
|
17
|
+
return `${protocol}//api.${hostname}${port ? `:${port}` : ''}`;
|
|
18
|
+
};
|
|
19
|
+
const getProcessApiRequest = (options) => {
|
|
20
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ service, endpoint, method, body, params, headers, responseType }) {
|
|
21
|
+
var _b, _c;
|
|
22
|
+
const basePath = ((_b = options === null || options === void 0 ? void 0 : options.resolveServiceBaseUrl) !== null && _b !== void 0 ? _b : defaultResolveServiceBaseUrl)(service);
|
|
23
|
+
try {
|
|
24
|
+
const res = yield (0, 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, core_1.actionResult)(res);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
// Keyed on NetworkRequestError.code, which the mapper checks before the error name.
|
|
37
|
+
return (0, core_1.actionResultErrorFromCaughtError)(error, {
|
|
38
|
+
[webserver_1.NetworkRequestErrorCode.timeout]: () => (0, core_1.actionResultError)(webserver_1.askApiRequestBase.errorType.Timeout, 'Network request timed out'),
|
|
39
|
+
[webserver_1.NetworkRequestErrorCode.unsupportedMethod]: (error) => (0, core_1.actionResultError)(webserver_1.askApiRequestBase.errorType.UnsupportedMethod, error.message),
|
|
40
|
+
[webserver_1.NetworkRequestErrorCode.network]: (error) => (0, core_1.actionResultError)(webserver_1.askApiRequestBase.errorType.NetworkError, error.message),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const createApiRequestActionProcessor = (options) => () => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
return ({
|
|
47
|
+
[webserver_1.ApiActionType.Request]: getProcessApiRequest(options),
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
exports.createApiRequestActionProcessor = createApiRequestActionProcessor;
|
|
51
|
+
// Zero-config default registered in the standard web processors.
|
|
52
|
+
exports.getApiRequestActionProcessor = (0, exports.createApiRequestActionProcessor)();
|
|
53
|
+
//# sourceMappingURL=createApiRequestActionProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createApiRequestActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/api/createApiRequestActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAQqB;AACrB,gDAAoH;AAYpH,MAAM,4BAA4B,GAAG,CAAC,QAAgB,EAAU,EAAE;IAChE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC;IACrD,OAAO,GAAG,QAAQ,SAAS,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACjE,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,OAA0C,EAA0C,EAAE;IAClH,OAAO,KAA2E,EAAE,4CAAtE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE;;QAC9E,MAAM,QAAQ,GAAG,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,qBAAqB,mCAAI,4BAA4B,CAAC,CAAC,OAAO,CAAC,CAAC;QAE3F,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,IAAA,iCAAqB,EAAC;gBACtC,GAAG,EAAE,QAAQ;gBACb,QAAQ;gBACR,MAAM;gBACN,IAAI;gBACJ,MAAM;gBACN,YAAY;gBACZ,OAAO,kCACF,OAAO,GACP,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,uDAAI,CAC3B;aACF,CAAC,CAAC;YAEH,OAAO,IAAA,mBAAY,EAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,oFAAoF;YACpF,OAAO,IAAA,uCAAgC,EAAC,KAAK,EAAE;gBAC7C,CAAC,mCAAuB,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,IAAA,wBAAiB,EAAC,6BAAiB,CAAC,SAAS,CAAC,OAAO,EAAE,2BAA2B,CAAC;gBAC5H,CAAC,mCAAuB,CAAC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,wBAAiB,EAAC,6BAAiB,CAAC,SAAS,CAAC,iBAAiB,EAAE,KAAK,CAAC,OAAO,CAAC;gBACvI,CAAC,mCAAuB,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,wBAAiB,EAAC,6BAAiB,CAAC,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC;aACzH,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,+BAA+B,GAC1C,CAAC,OAA0C,EAA+B,EAAE,CAC5E,GAAuC,EAAE;IAAC,OAAA,CAAC;QACzC,CAAC,yBAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC;KACvD,CAAC,CAAA;EAAA,CAAC;AAJQ,QAAA,+BAA+B,mCAIvC;AAEL,iEAAiE;AACpD,QAAA,4BAA4B,GAAgC,IAAA,uCAA+B,GAAE,CAAC","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n Nullable,\n ProcessorFor,\n} from '@qpqjs/core';\nimport { ApiActionType, askApiRequestBase, NetworkRequestErrorCode, preformNetworkRequest } from '@qpqjs/webserver';\n\nexport type ApiRequestActionProcessorOptions = {\n // Resolve the base url for a given service. The default ignores the service name\n // and targets api.<currentHost>, the single-backend case that covers most apps.\n resolveServiceBaseUrl?: (service: string) => string;\n\n // Provide headers to attach to every request, e.g. auth (any scheme), tracing,\n // tenant ids. Merged into (and overriding) the per-call headers. Default: none.\n getHeaders?: () => Nullable<Record<string, string>>;\n};\n\nconst defaultResolveServiceBaseUrl = (_service: string): string => {\n const { protocol, hostname, port } = window.location;\n return `${protocol}//api.${hostname}${port ? `:${port}` : ''}`;\n};\n\nconst getProcessApiRequest = (options?: ApiRequestActionProcessorOptions): ProcessorFor<typeof askApiRequestBase> => {\n return async ({ service, endpoint, method, body, params, headers, responseType }) => {\n const basePath = (options?.resolveServiceBaseUrl ?? defaultResolveServiceBaseUrl)(service);\n\n try {\n const res = await preformNetworkRequest({\n url: endpoint,\n basePath,\n method,\n body,\n params,\n responseType,\n headers: {\n ...headers,\n ...options?.getHeaders?.(),\n },\n });\n\n return actionResult(res);\n } catch (error: unknown) {\n // Keyed on NetworkRequestError.code, which the mapper checks before the error name.\n return actionResultErrorFromCaughtError(error, {\n [NetworkRequestErrorCode.timeout]: () => actionResultError(askApiRequestBase.errorType.Timeout, 'Network request timed out'),\n [NetworkRequestErrorCode.unsupportedMethod]: (error) => actionResultError(askApiRequestBase.errorType.UnsupportedMethod, error.message),\n [NetworkRequestErrorCode.network]: (error) => actionResultError(askApiRequestBase.errorType.NetworkError, error.message),\n });\n }\n };\n};\n\nexport const createApiRequestActionProcessor =\n (options?: ApiRequestActionProcessorOptions): ActionProcessorListResolver =>\n async (): Promise<ActionProcessorList> => ({\n [ApiActionType.Request]: getProcessApiRequest(options),\n });\n\n// Zero-config default registered in the standard web processors.\nexport const getApiRequestActionProcessor: ActionProcessorListResolver = createApiRequestActionProcessor();\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createApiRequestActionProcessor';
|
|
@@ -0,0 +1,18 @@
|
|
|
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);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oEAAkD","sourcesContent":["export * from './createApiRequestActionProcessor';\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.getWebActionProcessor = void 0;
|
|
27
|
+
const api_1 = require("./api");
|
|
28
|
+
const queryParams_1 = require("./queryParams");
|
|
29
|
+
const window_1 = require("./window");
|
|
30
|
+
__exportStar(require("./api"), exports);
|
|
31
|
+
const getWebActionProcessor = (qpqConfig, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
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))));
|
|
33
|
+
});
|
|
34
|
+
exports.getWebActionProcessor = getWebActionProcessor;
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actionProcessor/web/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,+BAAqD;AACrD,+CAA8D;AAC9D,qCAAoD;AAEpD,wCAAsB;AAEf,MAAM,qBAAqB,GAAgC,CAChE,SAAoB,EACpB,mBAAwC,EACV,EAAE;IAAC,OAAA,+CAC9B,CAAC,MAAM,IAAA,kCAA4B,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GACpE,CAAC,MAAM,IAAA,2CAA6B,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GACrE,CAAC,MAAM,IAAA,iCAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,EACnE,CAAA;EAAA,CAAC;AAPU,QAAA,qBAAqB,yBAO/B","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, DynamicModuleLoader, QPQConfig } from '@qpqjs/core';\n\nimport { getApiRequestActionProcessor } from './api';\nimport { getQueryParamsActionProcessor } from './queryParams';\nimport { getWindowActionProcessor } from './window';\n\nexport * from './api';\n\nexport const getWebActionProcessor: ActionProcessorListResolver = async (\n qpqConfig: QPQConfig,\n dynamicModuleLoader: DynamicModuleLoader,\n): Promise<ActionProcessorList> => ({\n ...(await getApiRequestActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getQueryParamsActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getWindowActionProcessor(qpqConfig, dynamicModuleLoader)),\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getQueryParamsGetActionProcessor: import("@qpqjs/core").ActionProcessorListResolver;
|
|
@@ -0,0 +1,23 @@
|
|
|
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.getQueryParamsGetActionProcessor = void 0;
|
|
13
|
+
const core_1 = require("@qpqjs/core");
|
|
14
|
+
const web_1 = require("@qpqjs/web");
|
|
15
|
+
const getProcessQueryParamsGet = (qpqConfig) => {
|
|
16
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ key }) {
|
|
17
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
18
|
+
const values = urlParams.getAll(key);
|
|
19
|
+
return (0, core_1.actionResult)(values);
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
exports.getQueryParamsGetActionProcessor = (0, core_1.createActionProcessor)(web_1.askQueryParamsGet, getProcessQueryParamsGet);
|
|
23
|
+
//# sourceMappingURL=getQueryParamsGetActionProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getQueryParamsGetActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAA2F;AAC3F,oCAAsE;AAEtE,MAAM,wBAAwB,GAAG,CAAC,SAAoB,EAA0C,EAAE;IAChG,OAAO,KAAgB,EAAE,4CAAX,EAAE,GAAG,EAAE;QACnB,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC9D,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAErC,OAAO,IAAA,mBAAY,EAAC,MAAM,CAAC,CAAC;IAC9B,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,gCAAgC,GAAG,IAAA,4BAAqB,EAAC,uBAAiB,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, ProcessorFor, QPQConfig } from '@qpqjs/core';\nimport { askQueryParamsGet, QueryParamsActionType } from '@qpqjs/web';\n\nconst getProcessQueryParamsGet = (qpqConfig: QPQConfig): ProcessorFor<typeof askQueryParamsGet> => {\n return async ({ key }) => {\n const urlParams = new URLSearchParams(window.location.search);\n const values = urlParams.getAll(key);\n\n return actionResult(values);\n };\n};\n\nexport const getQueryParamsGetActionProcessor = createActionProcessor(askQueryParamsGet, getProcessQueryParamsGet);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getQueryParamsGetAllActionProcessor: import("@qpqjs/core").ActionProcessorListResolver;
|
|
@@ -0,0 +1,33 @@
|
|
|
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.getQueryParamsGetAllActionProcessor = void 0;
|
|
13
|
+
const core_1 = require("@qpqjs/core");
|
|
14
|
+
const web_1 = require("@qpqjs/web");
|
|
15
|
+
const getProcessQueryParamsGetAll = (qpqConfig) => {
|
|
16
|
+
return () => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
18
|
+
const paramsObject = {};
|
|
19
|
+
urlParams.forEach((value, key) => {
|
|
20
|
+
// Keys come from the url. `__proto__` cannot be an own entry of a plain object (assigning
|
|
21
|
+
// it swaps the prototype), so it is dropped; any other inherited name (`toString`,
|
|
22
|
+
// `constructor`) is shadowed as an own entry rather than read off Object.prototype.
|
|
23
|
+
if (key === '__proto__') {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const existing = Object.prototype.hasOwnProperty.call(paramsObject, key) ? paramsObject[key] : [];
|
|
27
|
+
paramsObject[key] = [...existing, value];
|
|
28
|
+
});
|
|
29
|
+
return (0, core_1.actionResult)(paramsObject);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
exports.getQueryParamsGetAllActionProcessor = (0, core_1.createActionProcessor)(web_1.askQueryParamsGetAll, getProcessQueryParamsGetAll);
|
|
33
|
+
//# sourceMappingURL=getQueryParamsGetAllActionProcessor.js.map
|
package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getQueryParamsGetAllActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAA2F;AAC3F,oCAAyE;AAEzE,MAAM,2BAA2B,GAAG,CAAC,SAAoB,EAA6C,EAAE;IACtG,OAAO,GAAS,EAAE;QAChB,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC9D,MAAM,YAAY,GAA6B,EAAE,CAAC;QAElD,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC/B,0FAA0F;YAC1F,mFAAmF;YACnF,oFAAoF;YACpF,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;gBACxB,OAAO;YACT,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAClG,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;QAEH,OAAO,IAAA,mBAAY,EAAC,YAAY,CAAC,CAAC;IACpC,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,mCAAmC,GAAG,IAAA,4BAAqB,EAAC,0BAAoB,EAAE,2BAA2B,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, ProcessorFor, QPQConfig } from '@qpqjs/core';\nimport { askQueryParamsGetAll, QueryParamsActionType } from '@qpqjs/web';\n\nconst getProcessQueryParamsGetAll = (qpqConfig: QPQConfig): ProcessorFor<typeof askQueryParamsGetAll> => {\n return async () => {\n const urlParams = new URLSearchParams(window.location.search);\n const paramsObject: Record<string, string[]> = {};\n\n urlParams.forEach((value, key) => {\n // Keys come from the url. `__proto__` cannot be an own entry of a plain object (assigning\n // it swaps the prototype), so it is dropped; any other inherited name (`toString`,\n // `constructor`) is shadowed as an own entry rather than read off Object.prototype.\n if (key === '__proto__') {\n return;\n }\n const existing = Object.prototype.hasOwnProperty.call(paramsObject, key) ? paramsObject[key] : [];\n paramsObject[key] = [...existing, value];\n });\n\n return actionResult(paramsObject);\n };\n};\n\nexport const getQueryParamsGetAllActionProcessor = createActionProcessor(askQueryParamsGetAll, getProcessQueryParamsGetAll);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getQueryParamsSetActionProcessor: import("@qpqjs/core").ActionProcessorListResolver;
|
|
@@ -0,0 +1,35 @@
|
|
|
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.getQueryParamsSetActionProcessor = void 0;
|
|
13
|
+
const core_1 = require("@qpqjs/core");
|
|
14
|
+
const web_1 = require("@qpqjs/web");
|
|
15
|
+
const getProcessQueryParamsSet = (qpqConfig) => {
|
|
16
|
+
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ key, values, createHistoryEntry }) {
|
|
17
|
+
const url = new URL(window.location.href);
|
|
18
|
+
const urlParams = new URLSearchParams(url.search);
|
|
19
|
+
// Replace every existing value for the key; no values means remove it.
|
|
20
|
+
urlParams.delete(key);
|
|
21
|
+
values.forEach((value) => urlParams.append(key, value));
|
|
22
|
+
// Only the query changes: keep the hash, and drop the '?' when no params remain.
|
|
23
|
+
const search = urlParams.toString();
|
|
24
|
+
const newUrl = `${url.pathname}${search ? `?${search}` : ''}${url.hash}`;
|
|
25
|
+
if (createHistoryEntry) {
|
|
26
|
+
window.history.pushState(null, '', newUrl);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
window.history.replaceState(null, '', newUrl);
|
|
30
|
+
}
|
|
31
|
+
return (0, core_1.actionResult)(void 0);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
exports.getQueryParamsSetActionProcessor = (0, core_1.createActionProcessor)(web_1.askQueryParamsSet, getProcessQueryParamsSet);
|
|
35
|
+
//# sourceMappingURL=getQueryParamsSetActionProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getQueryParamsSetActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAA2F;AAC3F,oCAAsE;AAEtE,MAAM,wBAAwB,GAAG,CAAC,SAAoB,EAA0C,EAAE;IAChG,OAAO,KAA4C,EAAE,4CAAvC,EAAE,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE;QAC/C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1C,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAElD,uEAAuE;QACvE,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACtB,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;QAExD,iFAAiF;QACjF,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QAEzE,IAAI,kBAAkB,EAAE,CAAC;YACvB,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;QAC7C,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;QAChD,CAAC;QAED,OAAO,IAAA,mBAAY,EAAC,KAAK,CAAC,CAAC,CAAC;IAC9B,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,gCAAgC,GAAG,IAAA,4BAAqB,EAAC,uBAAiB,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, ProcessorFor, QPQConfig } from '@qpqjs/core';\nimport { askQueryParamsSet, QueryParamsActionType } from '@qpqjs/web';\n\nconst getProcessQueryParamsSet = (qpqConfig: QPQConfig): ProcessorFor<typeof askQueryParamsSet> => {\n return async ({ key, values, createHistoryEntry }) => {\n const url = new URL(window.location.href);\n const urlParams = new URLSearchParams(url.search);\n\n // Replace every existing value for the key; no values means remove it.\n urlParams.delete(key);\n values.forEach((value) => urlParams.append(key, value));\n\n // Only the query changes: keep the hash, and drop the '?' when no params remain.\n const search = urlParams.toString();\n const newUrl = `${url.pathname}${search ? `?${search}` : ''}${url.hash}`;\n\n if (createHistoryEntry) {\n window.history.pushState(null, '', newUrl);\n } else {\n window.history.replaceState(null, '', newUrl);\n }\n\n return actionResult(void 0);\n };\n};\n\nexport const getQueryParamsSetActionProcessor = createActionProcessor(askQueryParamsSet, getProcessQueryParamsSet);\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
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.getQueryParamsActionProcessor = void 0;
|
|
13
|
+
const getQueryParamsGetActionProcessor_1 = require("./getQueryParamsGetActionProcessor");
|
|
14
|
+
const getQueryParamsGetAllActionProcessor_1 = require("./getQueryParamsGetAllActionProcessor");
|
|
15
|
+
const getQueryParamsSetActionProcessor_1 = require("./getQueryParamsSetActionProcessor");
|
|
16
|
+
const getQueryParamsActionProcessor = (qpqConfig, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
return (Object.assign(Object.assign(Object.assign({}, (yield (0, getQueryParamsGetActionProcessor_1.getQueryParamsGetActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getQueryParamsGetAllActionProcessor_1.getQueryParamsGetAllActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, getQueryParamsSetActionProcessor_1.getQueryParamsSetActionProcessor)(qpqConfig, dynamicModuleLoader))));
|
|
18
|
+
});
|
|
19
|
+
exports.getQueryParamsActionProcessor = getQueryParamsActionProcessor;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yFAAsF;AACtF,+FAA4F;AAC5F,yFAAsF;AAE/E,MAAM,6BAA6B,GAAgC,CACxE,SAAoB,EACpB,mBAAwC,EACV,EAAE;IAAC,OAAA,+CAC9B,CAAC,MAAM,IAAA,mEAAgC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GACxE,CAAC,MAAM,IAAA,yEAAmC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAC3E,CAAC,MAAM,IAAA,mEAAgC,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,EAC3E,CAAA;EAAA,CAAC;AAPU,QAAA,6BAA6B,iCAOvC","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, DynamicModuleLoader, QPQConfig } from '@qpqjs/core';\n\nimport { getQueryParamsGetActionProcessor } from './getQueryParamsGetActionProcessor';\nimport { getQueryParamsGetAllActionProcessor } from './getQueryParamsGetAllActionProcessor';\nimport { getQueryParamsSetActionProcessor } from './getQueryParamsSetActionProcessor';\n\nexport const getQueryParamsActionProcessor: ActionProcessorListResolver = async (\n qpqConfig: QPQConfig,\n dynamicModuleLoader: DynamicModuleLoader,\n): Promise<ActionProcessorList> => ({\n ...(await getQueryParamsGetActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getQueryParamsGetAllActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getQueryParamsSetActionProcessor(qpqConfig, dynamicModuleLoader)),\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getWindowGetLocationActionProcessor: import("@qpqjs/core").ActionProcessorListResolver;
|
|
@@ -0,0 +1,23 @@
|
|
|
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.getWindowGetLocationActionProcessor = void 0;
|
|
13
|
+
const core_1 = require("@qpqjs/core");
|
|
14
|
+
const web_1 = require("@qpqjs/web");
|
|
15
|
+
const getProcessWindowGetLocation = (qpqConfig) => {
|
|
16
|
+
return () => __awaiter(void 0, void 0, void 0, function* () {
|
|
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, core_1.actionResult)({ href, origin, protocol, host, hostname, port, pathname, search, hash });
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
exports.getWindowGetLocationActionProcessor = (0, core_1.createActionProcessor)(web_1.askWindowGetLocation, getProcessWindowGetLocation);
|
|
23
|
+
//# sourceMappingURL=getWindowGetLocationActionProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getWindowGetLocationActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/window/getWindowGetLocationActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAA2F;AAC3F,oCAAoE;AAEpE,MAAM,2BAA2B,GAAG,CAAC,SAAoB,EAA6C,EAAE;IACtG,OAAO,GAAS,EAAE;QAChB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC;QAEjG,oEAAoE;QACpE,OAAO,IAAA,mBAAY,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAChG,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,mCAAmC,GAAG,IAAA,4BAAqB,EAAC,0BAAoB,EAAE,2BAA2B,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, ProcessorFor, QPQConfig } from '@qpqjs/core';\nimport { askWindowGetLocation, WindowActionType } from '@qpqjs/web';\n\nconst getProcessWindowGetLocation = (qpqConfig: QPQConfig): ProcessorFor<typeof askWindowGetLocation> => {\n return async () => {\n const { href, origin, protocol, host, hostname, port, pathname, search, hash } = window.location;\n\n // Return a plain serializable copy, never the live Location object.\n return actionResult({ href, origin, protocol, host, hostname, port, pathname, search, hash });\n };\n};\n\nexport const getWindowGetLocationActionProcessor = createActionProcessor(askWindowGetLocation, getProcessWindowGetLocation);\n"]}
|