quidproquo-actionprocessor-web 0.1.15 → 0.1.17
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 +15 -96
- package/lib/commonjs/actionProcessor/core/config/getConfigGetParameterActionProcessor.d.ts +1 -2
- package/lib/commonjs/actionProcessor/core/config/getConfigGetParameterActionProcessor.js +1 -6
- package/lib/commonjs/actionProcessor/core/config/getConfigGetParameterActionProcessor.js.map +1 -1
- package/lib/commonjs/actionProcessor/core/config/getConfigGetParametersActionProcessor.d.ts +1 -2
- package/lib/commonjs/actionProcessor/core/config/getConfigGetParametersActionProcessor.js +1 -6
- package/lib/commonjs/actionProcessor/core/config/getConfigGetParametersActionProcessor.js.map +1 -1
- package/lib/commonjs/actionProcessor/core/config/getConfigSetParameterActionProcessor.d.ts +1 -2
- package/lib/commonjs/actionProcessor/core/config/getConfigSetParameterActionProcessor.js +2 -7
- package/lib/commonjs/actionProcessor/core/config/getConfigSetParameterActionProcessor.js.map +1 -1
- package/lib/commonjs/actionProcessor/web/api/createApiRequestActionProcessor.js +0 -2
- package/lib/commonjs/actionProcessor/web/api/createApiRequestActionProcessor.js.map +1 -1
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.d.ts +1 -2
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.js +1 -6
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.js.map +1 -1
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.d.ts +1 -2
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.js +1 -6
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.js.map +1 -1
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.d.ts +1 -2
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.js +1 -6
- package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.js.map +1 -1
- package/lib/commonjs/actionProcessor/web/window/getWindowGetLocationActionProcessor.d.ts +1 -2
- package/lib/commonjs/actionProcessor/web/window/getWindowGetLocationActionProcessor.js +1 -6
- package/lib/commonjs/actionProcessor/web/window/getWindowGetLocationActionProcessor.js.map +1 -1
- package/lib/esm/actionProcessor/core/config/getConfigGetParameterActionProcessor.d.ts +1 -2
- package/lib/esm/actionProcessor/core/config/getConfigGetParameterActionProcessor.js +2 -4
- package/lib/esm/actionProcessor/core/config/getConfigGetParameterActionProcessor.js.map +1 -1
- package/lib/esm/actionProcessor/core/config/getConfigGetParametersActionProcessor.d.ts +1 -2
- package/lib/esm/actionProcessor/core/config/getConfigGetParametersActionProcessor.js +2 -4
- package/lib/esm/actionProcessor/core/config/getConfigGetParametersActionProcessor.js.map +1 -1
- package/lib/esm/actionProcessor/core/config/getConfigSetParameterActionProcessor.d.ts +1 -2
- package/lib/esm/actionProcessor/core/config/getConfigSetParameterActionProcessor.js +3 -5
- package/lib/esm/actionProcessor/core/config/getConfigSetParameterActionProcessor.js.map +1 -1
- package/lib/esm/actionProcessor/web/api/createApiRequestActionProcessor.js +0 -2
- package/lib/esm/actionProcessor/web/api/createApiRequestActionProcessor.js.map +1 -1
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.d.ts +1 -2
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.js +3 -5
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.js.map +1 -1
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.d.ts +1 -2
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.js +3 -5
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.js.map +1 -1
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.d.ts +1 -2
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.js +3 -5
- package/lib/esm/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.js.map +1 -1
- package/lib/esm/actionProcessor/web/window/getWindowGetLocationActionProcessor.d.ts +1 -2
- package/lib/esm/actionProcessor/web/window/getWindowGetLocationActionProcessor.js +3 -5
- package/lib/esm/actionProcessor/web/window/getWindowGetLocationActionProcessor.js.map +1 -1
- package/package.json +12 -9
package/README.md
CHANGED
|
@@ -1,112 +1,31 @@
|
|
|
1
1
|
# quidproquo-actionprocessor-web
|
|
2
2
|
|
|
3
|
-
The
|
|
4
|
-
integrate common functionality into your Node.js-based applications.
|
|
3
|
+
The browser runtime for [quidproquo](https://github.com/qpqjs/quidproquo).
|
|
5
4
|
|
|
6
|
-
|
|
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.
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
operations, error handling, event processing, GUID generation, logging, math operations, network requests, platform-specific functionality (e.g.,
|
|
10
|
-
delays), and system-level actions.
|
|
7
|
+
You do not usually install this yourself. It arrives as a dependency of `quidproquo-web-react`.
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
meet your specific requirements.
|
|
9
|
+
## What it implements
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
with support for unit, integration, and end-to-end testing.
|
|
15
|
+
Everything platform-neutral (dates, guids, http, logging) comes from `quidproquo-actionprocessor-js`.
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
platform-agnostic, allowing you to potentially use these action processors in other environments as well.
|
|
17
|
+
## The point of it
|
|
23
18
|
|
|
24
|
-
|
|
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.
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
package manager, such as npm or yarn:
|
|
21
|
+
## Status
|
|
28
22
|
|
|
29
|
-
|
|
30
|
-
npm install quidproquo-actionprocessor-web
|
|
31
|
-
```
|
|
23
|
+
Pre-1.0. The whole `quidproquo-*` 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.
|
|
32
24
|
|
|
33
|
-
|
|
34
|
-
set of action processors that you can import and use in your code.
|
|
25
|
+
## Documentation
|
|
35
26
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
The `quidproquo-actionprocessor-web` library provides the following action processors:
|
|
39
|
-
|
|
40
|
-
1. **Date/Time Action Processors**:
|
|
41
|
-
|
|
42
|
-
- `DateNowActionProcessor`: Retrieves the current date and time as an ISO string.
|
|
43
|
-
|
|
44
|
-
2. **Error Action Processors**:
|
|
45
|
-
|
|
46
|
-
- `ErrorThrowErrorActionProcessor`: Throws a custom error with a specified type, text, and stack trace.
|
|
47
|
-
|
|
48
|
-
3. **Event Action Processors**:
|
|
49
|
-
|
|
50
|
-
- (No event-specific action processors are currently implemented)
|
|
51
|
-
|
|
52
|
-
4. **GUID Action Processors**:
|
|
53
|
-
|
|
54
|
-
- `GuidNewActionProcessor`: Generates a new UUID.
|
|
55
|
-
|
|
56
|
-
5. **Logging Action Processors**:
|
|
57
|
-
|
|
58
|
-
- `LogCreateActionProcessor`: Logs a message with a specified log level and optional data.
|
|
59
|
-
|
|
60
|
-
6. **Math Action Processors**:
|
|
61
|
-
|
|
62
|
-
- `MathRandomNumberActionProcessor`: Generates a random number.
|
|
63
|
-
|
|
64
|
-
7. **Network Action Processors**:
|
|
65
|
-
|
|
66
|
-
- `NetworkRequestActionProcessor`: Performs an HTTP request with various options (method, headers, body, etc.).
|
|
67
|
-
|
|
68
|
-
8. **Platform Action Processors**:
|
|
69
|
-
|
|
70
|
-
- `PlatformDelayActionProcessor`: Delays the execution for a specified number of milliseconds.
|
|
71
|
-
|
|
72
|
-
9. **System Action Processors**:
|
|
73
|
-
|
|
74
|
-
- `SystemBatchActionProcessor`: Executes a batch of actions and returns the results.
|
|
75
|
-
|
|
76
|
-
10. **User Directory Action Processors**:
|
|
77
|
-
|
|
78
|
-
- (No user directory-specific action processors are currently implemented)
|
|
79
|
-
|
|
80
|
-
## Usage
|
|
81
|
-
|
|
82
|
-
To use the action processors provided by `quidproquo-actionprocessor-web`, you can import them into your `quidproquo`-based application and integrate
|
|
83
|
-
them with your action processor configuration. Here's an example of how you might use the `DateNowActionProcessor`:
|
|
84
|
-
|
|
85
|
-
```typescript
|
|
86
|
-
import { DateNowActionProcessor, actionResult, DateActionType } from 'quidproquo-actionprocessor-web';
|
|
87
|
-
|
|
88
|
-
const processDateNow: DateNowActionProcessor = async () => {
|
|
89
|
-
return actionResult(new Date().toISOString());
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export default {
|
|
93
|
-
[DateActionType.Now]: processDateNow,
|
|
94
|
-
};
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
In this example, we define a `DateNowActionProcessor` function that returns the current date and time as an ISO string. We then export this processor
|
|
98
|
-
under the `DateActionType.Now` action type, which can be used in our `quidproquo`-based application.
|
|
99
|
-
|
|
100
|
-
## Contribution and Development
|
|
101
|
-
|
|
102
|
-
If you'd like to contribute to the development of `quidproquo-actionprocessor-web`, please refer to the
|
|
103
|
-
[contributing guidelines](https://github.com/joe-coady/quidproquo/blob/main/CONTRIBUTING.md) for more information.
|
|
27
|
+
[docs.quidproquojs.com](https://docs.quidproquojs.com)
|
|
104
28
|
|
|
105
29
|
## License
|
|
106
30
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
## Warning: Not for Production
|
|
110
|
-
|
|
111
|
-
**This project is currently under active development and should not be used in production environments. The APIs and functionality are subject to
|
|
112
|
-
change without notice.**
|
|
31
|
+
MIT. See [LICENSE](https://github.com/qpqjs/quidproquo/blob/main/LICENSE).
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getConfigGetParameterActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
export declare const getConfigGetParameterActionProcessor: import("quidproquo-core").ActionProcessorListResolver;
|
|
@@ -22,10 +22,5 @@ const getProcessConfigGetParameter = (qpqConfig) => {
|
|
|
22
22
|
return (0, quidproquo_core_1.actionResult)(parameterValue);
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
|
-
|
|
26
|
-
return ({
|
|
27
|
-
[quidproquo_core_1.ConfigActionType.GetParameter]: getProcessConfigGetParameter(qpqConfig),
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
exports.getConfigGetParameterActionProcessor = getConfigGetParameterActionProcessor;
|
|
25
|
+
exports.getConfigGetParameterActionProcessor = (0, quidproquo_core_1.createActionProcessor)(quidproquo_core_1.askConfigGetParameter, getProcessConfigGetParameter);
|
|
31
26
|
//# sourceMappingURL=getConfigGetParameterActionProcessor.js.map
|
package/lib/commonjs/actionProcessor/core/config/getConfigGetParameterActionProcessor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConfigGetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParameterActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"getConfigGetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParameterActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAQyB;AAEzB,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,mCAAiB,EAAC,+BAAa,CAAC,QAAQ,EAAE,cAAc,aAAa,8BAA8B,CAAC,CAAC;QAC9G,CAAC;QAED,OAAO,IAAA,8BAAY,EAAC,cAAc,CAAC,CAAC;IACtC,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,oCAAoC,GAAG,IAAA,uCAAqB,EAAC,uCAAqB,EAAE,4BAA4B,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n actionResultError,\n askConfigGetParameter,\n createActionProcessor,\n ErrorTypeEnum,\n ProcessorFor,\n QPQConfig,\n} from 'quidproquo-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"]}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getConfigGetParametersActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
export declare const getConfigGetParametersActionProcessor: import("quidproquo-core").ActionProcessorListResolver;
|
|
@@ -26,10 +26,5 @@ const getProcessConfigGetParameters = (qpqConfig) => {
|
|
|
26
26
|
return (0, quidproquo_core_1.actionResult)(parameterValues.map((param) => param.value));
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
|
-
|
|
30
|
-
return ({
|
|
31
|
-
[quidproquo_core_1.ConfigActionType.GetParameters]: getProcessConfigGetParameters(qpqConfig),
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
exports.getConfigGetParametersActionProcessor = getConfigGetParametersActionProcessor;
|
|
29
|
+
exports.getConfigGetParametersActionProcessor = (0, quidproquo_core_1.createActionProcessor)(quidproquo_core_1.askConfigGetParameters, getProcessConfigGetParameters);
|
|
35
30
|
//# sourceMappingURL=getConfigGetParametersActionProcessor.js.map
|
package/lib/commonjs/actionProcessor/core/config/getConfigGetParametersActionProcessor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConfigGetParametersActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParametersActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"getConfigGetParametersActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParametersActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAQyB;AAEzB,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,mCAAiB,EAAC,+BAAa,CAAC,QAAQ,EAAE,0CAA0C,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxH,CAAC;QAED,OAAO,IAAA,8BAAY,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,uCAAqB,EAAC,wCAAsB,EAAE,6BAA6B,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n actionResultError,\n askConfigGetParameters,\n createActionProcessor,\n ErrorTypeEnum,\n ProcessorFor,\n QPQConfig,\n} from 'quidproquo-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"]}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getConfigSetParameterActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
export declare const getConfigSetParameterActionProcessor: import("quidproquo-core").ActionProcessorListResolver;
|
|
@@ -21,15 +21,10 @@ const getProcessConfigSetParameter = (qpqConfig) => {
|
|
|
21
21
|
}
|
|
22
22
|
catch (error) {
|
|
23
23
|
return (0, quidproquo_core_1.actionResultErrorFromCaughtError)(error, {
|
|
24
|
-
QuotaExceededError: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.
|
|
24
|
+
QuotaExceededError: () => (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.askConfigSetParameter.errorType.QuotaExceeded, `Local Storage quota exceeded saving parameter '${parameterName}'.`),
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
|
-
|
|
30
|
-
return ({
|
|
31
|
-
[quidproquo_core_1.ConfigActionType.SetParameter]: getProcessConfigSetParameter(qpqConfig),
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
exports.getConfigSetParameterActionProcessor = getConfigSetParameterActionProcessor;
|
|
29
|
+
exports.getConfigSetParameterActionProcessor = (0, quidproquo_core_1.createActionProcessor)(quidproquo_core_1.askConfigSetParameter, getProcessConfigSetParameter);
|
|
35
30
|
//# sourceMappingURL=getConfigSetParameterActionProcessor.js.map
|
package/lib/commonjs/actionProcessor/core/config/getConfigSetParameterActionProcessor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConfigSetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigSetParameterActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"getConfigSetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigSetParameterActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAQyB;AAEzB,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,8BAAY,EAAC,KAAK,CAAC,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,IAAA,kDAAgC,EAAC,KAAK,EAAE;gBAC7C,kBAAkB,EAAE,GAAG,EAAE,CACvB,IAAA,mCAAiB,EAAC,uCAAqB,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,uCAAqB,EAAC,uCAAqB,EAAE,4BAA4B,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n askConfigSetParameter,\n createActionProcessor,\n ProcessorFor,\n QPQConfig,\n} from 'quidproquo-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"]}
|
|
@@ -16,8 +16,6 @@ const defaultResolveServiceBaseUrl = (_service) => {
|
|
|
16
16
|
const { protocol, hostname, port } = window.location;
|
|
17
17
|
return `${protocol}//api.${hostname}${port ? `:${port}` : ''}`;
|
|
18
18
|
};
|
|
19
|
-
// any/any: the processor serves every ApiRequestAction<T> regardless of body/response
|
|
20
|
-
// type, and T is contravariant in the action, so no single unknown-based signature fits.
|
|
21
19
|
const getProcessApiRequest = (options) => {
|
|
22
20
|
return (_a) => __awaiter(void 0, [_a], void 0, function* ({ service, endpoint, method, body, params, headers, responseType }) {
|
|
23
21
|
var _b, _c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createApiRequestActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/api/createApiRequestActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"createApiRequestActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/api/createApiRequestActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAyH;AACzH,+DAA+F;AAY/F,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,MAAM,GAAG,GAAG,MAAM,IAAA,4CAAqB,EAAC;YACtC,GAAG,EAAE,QAAQ;YACb,QAAQ;YACR,MAAM;YACN,IAAI;YACJ,MAAM;YACN,YAAY;YACZ,OAAO,kCACF,OAAO,GACP,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,uDAAI,CAC3B;SACF,CAAC,CAAC;QAEH,OAAO,IAAA,8BAAY,EAAC,GAAG,CAAC,CAAC;IAC3B,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,+BAA+B,GAC1C,CAAC,OAA0C,EAA+B,EAAE,CAC5E,GAAuC,EAAE;IAAC,OAAA,CAAC;QACzC,CAAC,oCAAa,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 { ActionProcessorList, ActionProcessorListResolver, actionResult, Nullable, ProcessorFor } from 'quidproquo-core';\nimport { ApiActionType, askApiRequestBase, preformNetworkRequest } from 'quidproquo-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 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 };\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"]}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getQueryParamsGetActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
export declare const getQueryParamsGetActionProcessor: import("quidproquo-core").ActionProcessorListResolver;
|
|
@@ -19,10 +19,5 @@ const getProcessQueryParamsGet = (qpqConfig) => {
|
|
|
19
19
|
return (0, quidproquo_core_1.actionResult)(values);
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
return ({
|
|
24
|
-
[quidproquo_web_1.QueryParamsActionType.Get]: getProcessQueryParamsGet(qpqConfig),
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
exports.getQueryParamsGetActionProcessor = getQueryParamsGetActionProcessor;
|
|
22
|
+
exports.getQueryParamsGetActionProcessor = (0, quidproquo_core_1.createActionProcessor)(quidproquo_web_1.askQueryParamsGet, getProcessQueryParamsGet);
|
|
28
23
|
//# sourceMappingURL=getQueryParamsGetActionProcessor.js.map
|
package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getQueryParamsGetActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"getQueryParamsGetActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA+F;AAC/F,mDAA0E;AAE1E,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,8BAAY,EAAC,MAAM,CAAC,CAAC;IAC9B,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,gCAAgC,GAAG,IAAA,uCAAqB,EAAC,kCAAiB,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, ProcessorFor, QPQConfig } from 'quidproquo-core';\nimport { askQueryParamsGet, QueryParamsActionType } from 'quidproquo-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"]}
|
package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getQueryParamsGetAllActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
export declare const getQueryParamsGetAllActionProcessor: import("quidproquo-core").ActionProcessorListResolver;
|
|
@@ -23,10 +23,5 @@ const getProcessQueryParamsGetAll = (qpqConfig) => {
|
|
|
23
23
|
return (0, quidproquo_core_1.actionResult)(paramsObject);
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
-
|
|
27
|
-
return ({
|
|
28
|
-
[quidproquo_web_1.QueryParamsActionType.GetAll]: getProcessQueryParamsGetAll(qpqConfig),
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
exports.getQueryParamsGetAllActionProcessor = getQueryParamsGetAllActionProcessor;
|
|
26
|
+
exports.getQueryParamsGetAllActionProcessor = (0, quidproquo_core_1.createActionProcessor)(quidproquo_web_1.askQueryParamsGetAll, getProcessQueryParamsGetAll);
|
|
32
27
|
//# sourceMappingURL=getQueryParamsGetAllActionProcessor.js.map
|
package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getQueryParamsGetAllActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"getQueryParamsGetAllActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA+F;AAC/F,mDAA6E;AAE7E,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,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAA,YAAY,CAAC,GAAG,CAAC,mCAAI,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEH,OAAO,IAAA,8BAAY,EAAC,YAAY,CAAC,CAAC;IACpC,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,mCAAmC,GAAG,IAAA,uCAAqB,EAAC,qCAAoB,EAAE,2BAA2B,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, ProcessorFor, QPQConfig } from 'quidproquo-core';\nimport { askQueryParamsGetAll, QueryParamsActionType } from 'quidproquo-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 paramsObject[key] = [...(paramsObject[key] ?? []), value];\n });\n\n return actionResult(paramsObject);\n };\n};\n\nexport const getQueryParamsGetAllActionProcessor = createActionProcessor(askQueryParamsGetAll, getProcessQueryParamsGetAll);\n"]}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getQueryParamsSetActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
export declare const getQueryParamsSetActionProcessor: import("quidproquo-core").ActionProcessorListResolver;
|
|
@@ -31,10 +31,5 @@ const getProcessQueryParamsSet = (qpqConfig) => {
|
|
|
31
31
|
return (0, quidproquo_core_1.actionResult)(void 0);
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
return ({
|
|
36
|
-
[quidproquo_web_1.QueryParamsActionType.Set]: getProcessQueryParamsSet(qpqConfig),
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
exports.getQueryParamsSetActionProcessor = getQueryParamsSetActionProcessor;
|
|
34
|
+
exports.getQueryParamsSetActionProcessor = (0, quidproquo_core_1.createActionProcessor)(quidproquo_web_1.askQueryParamsSet, getProcessQueryParamsSet);
|
|
40
35
|
//# sourceMappingURL=getQueryParamsSetActionProcessor.js.map
|
package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getQueryParamsSetActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"getQueryParamsSetActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA+F;AAC/F,mDAA0E;AAE1E,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,8BAAY,EAAC,KAAK,CAAC,CAAC,CAAC;IAC9B,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,gCAAgC,GAAG,IAAA,uCAAqB,EAAC,kCAAiB,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, ProcessorFor, QPQConfig } from 'quidproquo-core';\nimport { askQueryParamsSet, QueryParamsActionType } from 'quidproquo-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"]}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getWindowGetLocationActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
export declare const getWindowGetLocationActionProcessor: import("quidproquo-core").ActionProcessorListResolver;
|
|
@@ -19,10 +19,5 @@ const getProcessWindowGetLocation = (qpqConfig) => {
|
|
|
19
19
|
return (0, quidproquo_core_1.actionResult)({ href, origin, protocol, host, hostname, port, pathname, search, hash });
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
return ({
|
|
24
|
-
[quidproquo_web_1.WindowActionType.GetLocation]: getProcessWindowGetLocation(qpqConfig),
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
exports.getWindowGetLocationActionProcessor = getWindowGetLocationActionProcessor;
|
|
22
|
+
exports.getWindowGetLocationActionProcessor = (0, quidproquo_core_1.createActionProcessor)(quidproquo_web_1.askWindowGetLocation, getProcessWindowGetLocation);
|
|
28
23
|
//# sourceMappingURL=getWindowGetLocationActionProcessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWindowGetLocationActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/window/getWindowGetLocationActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"getWindowGetLocationActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/window/getWindowGetLocationActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA+F;AAC/F,mDAAwE;AAExE,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,8BAAY,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,uCAAqB,EAAC,qCAAoB,EAAE,2BAA2B,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, ProcessorFor, QPQConfig } from 'quidproquo-core';\nimport { askWindowGetLocation, WindowActionType } from 'quidproquo-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"]}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getConfigGetParameterActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
export declare const getConfigGetParameterActionProcessor: import("quidproquo-core").ActionProcessorListResolver;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { actionResult, actionResultError,
|
|
1
|
+
import { actionResult, actionResultError, askConfigGetParameter, createActionProcessor, ErrorTypeEnum, } from 'quidproquo-core';
|
|
2
2
|
const getProcessConfigGetParameter = (qpqConfig) => {
|
|
3
3
|
return async ({ parameterName }) => {
|
|
4
4
|
// window.localStorage (not the bare global): Node exposes a non-functional
|
|
@@ -10,7 +10,5 @@ const getProcessConfigGetParameter = (qpqConfig) => {
|
|
|
10
10
|
return actionResult(parameterValue);
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
export const getConfigGetParameterActionProcessor =
|
|
14
|
-
[ConfigActionType.GetParameter]: getProcessConfigGetParameter(qpqConfig),
|
|
15
|
-
});
|
|
13
|
+
export const getConfigGetParameterActionProcessor = createActionProcessor(askConfigGetParameter, getProcessConfigGetParameter);
|
|
16
14
|
//# sourceMappingURL=getConfigGetParameterActionProcessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConfigGetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParameterActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"getConfigGetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParameterActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,GAGd,MAAM,iBAAiB,CAAC;AAEzB,MAAM,4BAA4B,GAAG,CAAC,SAAoB,EAA8C,EAAE;IACxG,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE;QACjC,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,iBAAiB,CAAC,aAAa,CAAC,QAAQ,EAAE,cAAc,aAAa,8BAA8B,CAAC,CAAC;QAC9G,CAAC;QAED,OAAO,YAAY,CAAC,cAAc,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAG,qBAAqB,CAAC,qBAAqB,EAAE,4BAA4B,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n actionResultError,\n askConfigGetParameter,\n createActionProcessor,\n ErrorTypeEnum,\n ProcessorFor,\n QPQConfig,\n} from 'quidproquo-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"]}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getConfigGetParametersActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
export declare const getConfigGetParametersActionProcessor: import("quidproquo-core").ActionProcessorListResolver;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { actionResult, actionResultError,
|
|
1
|
+
import { actionResult, actionResultError, askConfigGetParameters, createActionProcessor, ErrorTypeEnum, } from 'quidproquo-core';
|
|
2
2
|
const getProcessConfigGetParameters = (qpqConfig) => {
|
|
3
3
|
return async ({ parameterNames }) => {
|
|
4
4
|
// window.localStorage (not the bare global): Node exposes a non-functional
|
|
@@ -14,7 +14,5 @@ const getProcessConfigGetParameters = (qpqConfig) => {
|
|
|
14
14
|
return actionResult(parameterValues.map((param) => param.value));
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
export const getConfigGetParametersActionProcessor =
|
|
18
|
-
[ConfigActionType.GetParameters]: getProcessConfigGetParameters(qpqConfig),
|
|
19
|
-
});
|
|
17
|
+
export const getConfigGetParametersActionProcessor = createActionProcessor(askConfigGetParameters, getProcessConfigGetParameters);
|
|
20
18
|
//# sourceMappingURL=getConfigGetParametersActionProcessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConfigGetParametersActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParametersActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"getConfigGetParametersActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParametersActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,GAGd,MAAM,iBAAiB,CAAC;AAEzB,MAAM,6BAA6B,GAAG,CAAC,SAAoB,EAA+C,EAAE;IAC1G,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE;QAClC,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,iBAAiB,CAAC,aAAa,CAAC,QAAQ,EAAE,0CAA0C,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxH,CAAC;QAED,OAAO,YAAY,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAe,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qCAAqC,GAAG,qBAAqB,CAAC,sBAAsB,EAAE,6BAA6B,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n actionResultError,\n askConfigGetParameters,\n createActionProcessor,\n ErrorTypeEnum,\n ProcessorFor,\n QPQConfig,\n} from 'quidproquo-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"]}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getConfigSetParameterActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
export declare const getConfigSetParameterActionProcessor: import("quidproquo-core").ActionProcessorListResolver;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { actionResult, actionResultError, actionResultErrorFromCaughtError,
|
|
1
|
+
import { actionResult, actionResultError, actionResultErrorFromCaughtError, askConfigSetParameter, createActionProcessor, } from 'quidproquo-core';
|
|
2
2
|
const getProcessConfigSetParameter = (qpqConfig) => {
|
|
3
3
|
return async ({ parameterName, parameterValue }) => {
|
|
4
4
|
try {
|
|
@@ -9,12 +9,10 @@ const getProcessConfigSetParameter = (qpqConfig) => {
|
|
|
9
9
|
}
|
|
10
10
|
catch (error) {
|
|
11
11
|
return actionResultErrorFromCaughtError(error, {
|
|
12
|
-
QuotaExceededError: () => actionResultError(
|
|
12
|
+
QuotaExceededError: () => actionResultError(askConfigSetParameter.errorType.QuotaExceeded, `Local Storage quota exceeded saving parameter '${parameterName}'.`),
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
export const getConfigSetParameterActionProcessor =
|
|
18
|
-
[ConfigActionType.SetParameter]: getProcessConfigSetParameter(qpqConfig),
|
|
19
|
-
});
|
|
17
|
+
export const getConfigSetParameterActionProcessor = createActionProcessor(askConfigSetParameter, getProcessConfigSetParameter);
|
|
20
18
|
//# sourceMappingURL=getConfigSetParameterActionProcessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConfigSetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigSetParameterActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"getConfigSetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigSetParameterActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,gCAAgC,EAChC,qBAAqB,EACrB,qBAAqB,GAGtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,4BAA4B,GAAG,CAAC,SAAoB,EAA8C,EAAE;IACxG,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,cAAc,EAAE,EAAE,EAAE;QACjD,IAAI,CAAC;YACH,2EAA2E;YAC3E,qDAAqD;YACrD,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;YAE3D,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,gCAAgC,CAAC,KAAK,EAAE;gBAC7C,kBAAkB,EAAE,GAAG,EAAE,CACvB,iBAAiB,CAAC,qBAAqB,CAAC,SAAS,CAAC,aAAa,EAAE,kDAAkD,aAAa,IAAI,CAAC;aACxI,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAG,qBAAqB,CAAC,qBAAqB,EAAE,4BAA4B,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n askConfigSetParameter,\n createActionProcessor,\n ProcessorFor,\n QPQConfig,\n} from 'quidproquo-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"]}
|
|
@@ -4,8 +4,6 @@ const defaultResolveServiceBaseUrl = (_service) => {
|
|
|
4
4
|
const { protocol, hostname, port } = window.location;
|
|
5
5
|
return `${protocol}//api.${hostname}${port ? `:${port}` : ''}`;
|
|
6
6
|
};
|
|
7
|
-
// any/any: the processor serves every ApiRequestAction<T> regardless of body/response
|
|
8
|
-
// type, and T is contravariant in the action, so no single unknown-based signature fits.
|
|
9
7
|
const getProcessApiRequest = (options) => {
|
|
10
8
|
return async ({ service, endpoint, method, body, params, headers, responseType }) => {
|
|
11
9
|
const basePath = (options?.resolveServiceBaseUrl ?? defaultResolveServiceBaseUrl)(service);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createApiRequestActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/api/createApiRequestActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,YAAY,
|
|
1
|
+
{"version":3,"file":"createApiRequestActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/api/createApiRequestActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,YAAY,EAA0B,MAAM,iBAAiB,CAAC;AACzH,OAAO,EAAE,aAAa,EAAqB,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAY/F,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,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE;QAClF,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,qBAAqB,IAAI,4BAA4B,CAAC,CAAC,OAAO,CAAC,CAAC;QAE3F,MAAM,GAAG,GAAG,MAAM,qBAAqB,CAAC;YACtC,GAAG,EAAE,QAAQ;YACb,QAAQ;YACR,MAAM;YACN,IAAI;YACJ,MAAM;YACN,YAAY;YACZ,OAAO,EAAE;gBACP,GAAG,OAAO;gBACV,GAAG,OAAO,EAAE,UAAU,EAAE,EAAE;aAC3B;SACF,CAAC,CAAC;QAEH,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAC1C,CAAC,OAA0C,EAA+B,EAAE,CAC5E,KAAK,IAAkC,EAAE,CAAC,CAAC;IACzC,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC;CACvD,CAAC,CAAC;AAEL,iEAAiE;AACjE,MAAM,CAAC,MAAM,4BAA4B,GAAgC,+BAA+B,EAAE,CAAC","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, actionResult, Nullable, ProcessorFor } from 'quidproquo-core';\nimport { ApiActionType, askApiRequestBase, preformNetworkRequest } from 'quidproquo-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 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 };\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"]}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getQueryParamsGetActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
export declare const getQueryParamsGetActionProcessor: import("quidproquo-core").ActionProcessorListResolver;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { actionResult } from 'quidproquo-core';
|
|
2
|
-
import {
|
|
1
|
+
import { actionResult, createActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { askQueryParamsGet } from 'quidproquo-web';
|
|
3
3
|
const getProcessQueryParamsGet = (qpqConfig) => {
|
|
4
4
|
return async ({ key }) => {
|
|
5
5
|
const urlParams = new URLSearchParams(window.location.search);
|
|
@@ -7,7 +7,5 @@ const getProcessQueryParamsGet = (qpqConfig) => {
|
|
|
7
7
|
return actionResult(values);
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
export const getQueryParamsGetActionProcessor =
|
|
11
|
-
[QueryParamsActionType.Get]: getProcessQueryParamsGet(qpqConfig),
|
|
12
|
-
});
|
|
10
|
+
export const getQueryParamsGetActionProcessor = createActionProcessor(askQueryParamsGet, getProcessQueryParamsGet);
|
|
13
11
|
//# sourceMappingURL=getQueryParamsGetActionProcessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getQueryParamsGetActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"getQueryParamsGetActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsGetActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAA2B,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAyB,MAAM,gBAAgB,CAAC;AAE1E,MAAM,wBAAwB,GAAG,CAAC,SAAoB,EAA0C,EAAE;IAChG,OAAO,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;QACvB,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,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAG,qBAAqB,CAAC,iBAAiB,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, ProcessorFor, QPQConfig } from 'quidproquo-core';\nimport { askQueryParamsGet, QueryParamsActionType } from 'quidproquo-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"]}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getQueryParamsGetAllActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
export declare const getQueryParamsGetAllActionProcessor: import("quidproquo-core").ActionProcessorListResolver;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { actionResult } from 'quidproquo-core';
|
|
2
|
-
import {
|
|
1
|
+
import { actionResult, createActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { askQueryParamsGetAll } from 'quidproquo-web';
|
|
3
3
|
const getProcessQueryParamsGetAll = (qpqConfig) => {
|
|
4
4
|
return async () => {
|
|
5
5
|
const urlParams = new URLSearchParams(window.location.search);
|
|
@@ -10,7 +10,5 @@ const getProcessQueryParamsGetAll = (qpqConfig) => {
|
|
|
10
10
|
return actionResult(paramsObject);
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
export const getQueryParamsGetAllActionProcessor =
|
|
14
|
-
[QueryParamsActionType.GetAll]: getProcessQueryParamsGetAll(qpqConfig),
|
|
15
|
-
});
|
|
13
|
+
export const getQueryParamsGetAllActionProcessor = createActionProcessor(askQueryParamsGetAll, getProcessQueryParamsGetAll);
|
|
16
14
|
//# sourceMappingURL=getQueryParamsGetAllActionProcessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getQueryParamsGetAllActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"getQueryParamsGetAllActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAA2B,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,oBAAoB,EAAyB,MAAM,gBAAgB,CAAC;AAE7E,MAAM,2BAA2B,GAAG,CAAC,SAAoB,EAA6C,EAAE;IACtG,OAAO,KAAK,IAAI,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,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEH,OAAO,YAAY,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mCAAmC,GAAG,qBAAqB,CAAC,oBAAoB,EAAE,2BAA2B,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, ProcessorFor, QPQConfig } from 'quidproquo-core';\nimport { askQueryParamsGetAll, QueryParamsActionType } from 'quidproquo-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 paramsObject[key] = [...(paramsObject[key] ?? []), value];\n });\n\n return actionResult(paramsObject);\n };\n};\n\nexport const getQueryParamsGetAllActionProcessor = createActionProcessor(askQueryParamsGetAll, getProcessQueryParamsGetAll);\n"]}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getQueryParamsSetActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
export declare const getQueryParamsSetActionProcessor: import("quidproquo-core").ActionProcessorListResolver;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { actionResult } from 'quidproquo-core';
|
|
2
|
-
import {
|
|
1
|
+
import { actionResult, createActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { askQueryParamsSet } from 'quidproquo-web';
|
|
3
3
|
const getProcessQueryParamsSet = (qpqConfig) => {
|
|
4
4
|
return async ({ key, values, createHistoryEntry }) => {
|
|
5
5
|
const url = new URL(window.location.href);
|
|
@@ -19,7 +19,5 @@ const getProcessQueryParamsSet = (qpqConfig) => {
|
|
|
19
19
|
return actionResult(void 0);
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
export const getQueryParamsSetActionProcessor =
|
|
23
|
-
[QueryParamsActionType.Set]: getProcessQueryParamsSet(qpqConfig),
|
|
24
|
-
});
|
|
22
|
+
export const getQueryParamsSetActionProcessor = createActionProcessor(askQueryParamsSet, getProcessQueryParamsSet);
|
|
25
23
|
//# sourceMappingURL=getQueryParamsSetActionProcessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getQueryParamsSetActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"getQueryParamsSetActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAA2B,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAyB,MAAM,gBAAgB,CAAC;AAE1E,MAAM,wBAAwB,GAAG,CAAC,SAAoB,EAA0C,EAAE;IAChG,OAAO,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE;QACnD,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,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAG,qBAAqB,CAAC,iBAAiB,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, ProcessorFor, QPQConfig } from 'quidproquo-core';\nimport { askQueryParamsSet, QueryParamsActionType } from 'quidproquo-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"]}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getWindowGetLocationActionProcessor: ActionProcessorListResolver;
|
|
1
|
+
export declare const getWindowGetLocationActionProcessor: import("quidproquo-core").ActionProcessorListResolver;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { actionResult } from 'quidproquo-core';
|
|
2
|
-
import {
|
|
1
|
+
import { actionResult, createActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { askWindowGetLocation } from 'quidproquo-web';
|
|
3
3
|
const getProcessWindowGetLocation = (qpqConfig) => {
|
|
4
4
|
return async () => {
|
|
5
5
|
const { href, origin, protocol, host, hostname, port, pathname, search, hash } = window.location;
|
|
@@ -7,7 +7,5 @@ const getProcessWindowGetLocation = (qpqConfig) => {
|
|
|
7
7
|
return actionResult({ href, origin, protocol, host, hostname, port, pathname, search, hash });
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
export const getWindowGetLocationActionProcessor =
|
|
11
|
-
[WindowActionType.GetLocation]: getProcessWindowGetLocation(qpqConfig),
|
|
12
|
-
});
|
|
10
|
+
export const getWindowGetLocationActionProcessor = createActionProcessor(askWindowGetLocation, getProcessWindowGetLocation);
|
|
13
11
|
//# sourceMappingURL=getWindowGetLocationActionProcessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWindowGetLocationActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/window/getWindowGetLocationActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"getWindowGetLocationActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/window/getWindowGetLocationActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAA2B,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,oBAAoB,EAAoB,MAAM,gBAAgB,CAAC;AAExE,MAAM,2BAA2B,GAAG,CAAC,SAAoB,EAA6C,EAAE;IACtG,OAAO,KAAK,IAAI,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,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAChG,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mCAAmC,GAAG,qBAAqB,CAAC,oBAAoB,EAAE,2BAA2B,CAAC,CAAC","sourcesContent":["import { actionResult, createActionProcessor, ProcessorFor, QPQConfig } from 'quidproquo-core';\nimport { askWindowGetLocation, WindowActionType } from 'quidproquo-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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-actionprocessor-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"lib/**/*"
|
|
11
11
|
],
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
12
15
|
"scripts": {
|
|
13
16
|
"test": "vitest run",
|
|
14
17
|
"test:watch": "vitest",
|
|
@@ -23,23 +26,23 @@
|
|
|
23
26
|
},
|
|
24
27
|
"repository": {
|
|
25
28
|
"type": "git",
|
|
26
|
-
"url": "git+https://github.com/
|
|
29
|
+
"url": "git+https://github.com/qpqjs/quidproquo.git"
|
|
27
30
|
},
|
|
28
31
|
"keywords": [],
|
|
29
32
|
"author": "",
|
|
30
33
|
"license": "MIT",
|
|
31
34
|
"bugs": {
|
|
32
|
-
"url": "https://github.com/
|
|
35
|
+
"url": "https://github.com/qpqjs/quidproquo/issues"
|
|
33
36
|
},
|
|
34
|
-
"homepage": "https://github.com/
|
|
37
|
+
"homepage": "https://github.com/qpqjs/quidproquo#readme",
|
|
35
38
|
"dependencies": {
|
|
36
|
-
"quidproquo-actionprocessor-js": "0.1.
|
|
37
|
-
"quidproquo-core": "0.1.
|
|
38
|
-
"quidproquo-web": "0.1.
|
|
39
|
-
"quidproquo-webserver": "0.1.
|
|
39
|
+
"quidproquo-actionprocessor-js": "0.1.17",
|
|
40
|
+
"quidproquo-core": "0.1.17",
|
|
41
|
+
"quidproquo-web": "0.1.17",
|
|
42
|
+
"quidproquo-webserver": "0.1.17"
|
|
40
43
|
},
|
|
41
44
|
"devDependencies": {
|
|
42
|
-
"quidproquo-tsconfig": "0.1.
|
|
45
|
+
"quidproquo-tsconfig": "0.1.17",
|
|
43
46
|
"typescript": "^5.8.2"
|
|
44
47
|
}
|
|
45
48
|
}
|