quidproquo-actionprocessor-web 0.1.11 → 0.1.12

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.
Files changed (31) hide show
  1. package/lib/commonjs/actionProcessor/core/config/getConfigGetParameterActionProcessor.js +3 -3
  2. package/lib/commonjs/actionProcessor/core/config/getConfigGetParameterActionProcessor.js.map +1 -1
  3. package/lib/commonjs/actionProcessor/core/config/getConfigGetParametersActionProcessor.js +6 -9
  4. package/lib/commonjs/actionProcessor/core/config/getConfigGetParametersActionProcessor.js.map +1 -1
  5. package/lib/commonjs/actionProcessor/core/config/getConfigSetParameterActionProcessor.js +3 -1
  6. package/lib/commonjs/actionProcessor/core/config/getConfigSetParameterActionProcessor.js.map +1 -1
  7. package/lib/commonjs/actionProcessor/web/api/createApiRequestActionProcessor.d.ts +4 -4
  8. package/lib/commonjs/actionProcessor/web/api/createApiRequestActionProcessor.js +3 -2
  9. package/lib/commonjs/actionProcessor/web/api/createApiRequestActionProcessor.js.map +1 -1
  10. package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.js +2 -6
  11. package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.js.map +1 -1
  12. package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.js +6 -9
  13. package/lib/commonjs/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.js.map +1 -1
  14. package/lib/commonjs/getWebActionProcessors.js +2 -0
  15. package/lib/commonjs/getWebActionProcessors.js.map +1 -1
  16. package/lib/esm/actionProcessor/core/config/getConfigGetParameterActionProcessor.js +3 -3
  17. package/lib/esm/actionProcessor/core/config/getConfigGetParameterActionProcessor.js.map +1 -1
  18. package/lib/esm/actionProcessor/core/config/getConfigGetParametersActionProcessor.js +6 -9
  19. package/lib/esm/actionProcessor/core/config/getConfigGetParametersActionProcessor.js.map +1 -1
  20. package/lib/esm/actionProcessor/core/config/getConfigSetParameterActionProcessor.js +3 -1
  21. package/lib/esm/actionProcessor/core/config/getConfigSetParameterActionProcessor.js.map +1 -1
  22. package/lib/esm/actionProcessor/web/api/createApiRequestActionProcessor.d.ts +4 -4
  23. package/lib/esm/actionProcessor/web/api/createApiRequestActionProcessor.js +3 -2
  24. package/lib/esm/actionProcessor/web/api/createApiRequestActionProcessor.js.map +1 -1
  25. package/lib/esm/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.js +1 -6
  26. package/lib/esm/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.js.map +1 -1
  27. package/lib/esm/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.js +6 -9
  28. package/lib/esm/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.js.map +1 -1
  29. package/lib/esm/getWebActionProcessors.js +2 -0
  30. package/lib/esm/getWebActionProcessors.js.map +1 -1
  31. package/package.json +8 -9
@@ -13,9 +13,9 @@ exports.getConfigGetParameterActionProcessor = void 0;
13
13
  const quidproquo_core_1 = require("quidproquo-core");
14
14
  const getProcessConfigGetParameter = (qpqConfig) => {
15
15
  return (_a) => __awaiter(void 0, [_a], void 0, function* ({ parameterName }) {
16
- // Read the value from Local Storage
17
- const parameterValue = localStorage.getItem(parameterName);
18
- // If the parameter doesn't exist, return an error
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
19
  if (parameterValue === null) {
20
20
  return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Parameter '${parameterName}' not found in Local Storage`);
21
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getConfigGetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParameterActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDASyB;AAEzB,MAAM,4BAA4B,GAAG,CAAC,SAAoB,EAAqC,EAAE;IAC/F,OAAO,KAA0B,EAAE,4CAArB,EAAE,aAAa,EAAE;QAC7B,oCAAoC;QACpC,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAE3D,kDAAkD;QAClD,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;AAEK,MAAM,oCAAoC,GAAgC,CAAO,SAAoB,EAAgC,EAAE;IAAC,OAAA,CAAC;QAC9I,CAAC,kCAAgB,CAAC,YAAY,CAAC,EAAE,4BAA4B,CAAC,SAAS,CAAC;KACzE,CAAC,CAAA;EAAA,CAAC;AAFU,QAAA,oCAAoC,wCAE9C","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n ConfigActionType,\n ConfigGetParameterActionProcessor,\n ErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nconst getProcessConfigGetParameter = (qpqConfig: QPQConfig): ConfigGetParameterActionProcessor => {\n return async ({ parameterName }) => {\n // Read the value from Local Storage\n const parameterValue = localStorage.getItem(parameterName);\n\n // If the parameter doesn't exist, return an error\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: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [ConfigActionType.GetParameter]: getProcessConfigGetParameter(qpqConfig),\n});\n"]}
1
+ {"version":3,"file":"getConfigGetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParameterActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDASyB;AAEzB,MAAM,4BAA4B,GAAG,CAAC,SAAoB,EAAqC,EAAE;IAC/F,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;AAEK,MAAM,oCAAoC,GAAgC,CAAO,SAAoB,EAAgC,EAAE;IAAC,OAAA,CAAC;QAC9I,CAAC,kCAAgB,CAAC,YAAY,CAAC,EAAE,4BAA4B,CAAC,SAAS,CAAC;KACzE,CAAC,CAAA;EAAA,CAAC;AAFU,QAAA,oCAAoC,wCAE9C","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n ConfigActionType,\n ConfigGetParameterActionProcessor,\n ErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nconst getProcessConfigGetParameter = (qpqConfig: QPQConfig): ConfigGetParameterActionProcessor => {\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: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [ConfigActionType.GetParameter]: getProcessConfigGetParameter(qpqConfig),\n});\n"]}
@@ -13,19 +13,16 @@ exports.getConfigGetParametersActionProcessor = void 0;
13
13
  const quidproquo_core_1 = require("quidproquo-core");
14
14
  const getProcessConfigGetParameters = (qpqConfig) => {
15
15
  return (_a) => __awaiter(void 0, [_a], void 0, function* ({ parameterNames }) {
16
- // Retrieve values from Local Storage for each parameter name
16
+ // window.localStorage (not the bare global): Node exposes a non-functional
17
+ // localStorage global that shadows jsdom's in tests.
17
18
  const parameterValues = parameterNames.map((name) => ({
18
19
  name,
19
- value: localStorage.getItem(name),
20
- found: localStorage.getItem(name) !== null, // Check if it exists
20
+ value: window.localStorage.getItem(name),
21
21
  }));
22
- // Find missing parameters
23
- const missingParameters = parameterValues.filter((param) => !param.found);
24
- // If any parameters are missing, return an error
25
- if (missingParameters.length > 0) {
26
- return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Parameters not found in Local Storage: ${missingParameters.map((param) => param.name).join(', ')}`);
22
+ const missingNames = parameterValues.filter((param) => param.value === null).map((param) => param.name);
23
+ if (missingNames.length > 0) {
24
+ return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotFound, `Parameters not found in Local Storage: ${missingNames.join(', ')}`);
27
25
  }
28
- // Return an array of values
29
26
  return (0, quidproquo_core_1.actionResult)(parameterValues.map((param) => param.value));
30
27
  });
31
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getConfigGetParametersActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParametersActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDASyB;AAEzB,MAAM,6BAA6B,GAAG,CAAC,SAAoB,EAAsC,EAAE;IACjG,OAAO,KAA2B,EAAE,4CAAtB,EAAE,cAAc,EAAE;QAC9B,6DAA6D;QAC7D,MAAM,eAAe,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACpD,IAAI;YACJ,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC;YACjC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,qBAAqB;SAClE,CAAC,CAAC,CAAC;QAEJ,0BAA0B;QAC1B,MAAM,iBAAiB,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE1E,iDAAiD;QACjD,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,IAAA,mCAAiB,EACtB,+BAAa,CAAC,QAAQ,EACtB,0CAA0C,iBAAiB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACpG,CAAC;QACJ,CAAC;QAED,4BAA4B;QAC5B,OAAO,IAAA,8BAAY,EAAC,eAAe,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACnE,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,qCAAqC,GAAgC,CAAO,SAAoB,EAAgC,EAAE;IAAC,OAAA,CAAC;QAC/I,CAAC,kCAAgB,CAAC,aAAa,CAAC,EAAE,6BAA6B,CAAC,SAAS,CAAC;KAC3E,CAAC,CAAA;EAAA,CAAC;AAFU,QAAA,qCAAqC,yCAE/C","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n ConfigActionType,\n ConfigGetParametersActionProcessor,\n ErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nconst getProcessConfigGetParameters = (qpqConfig: QPQConfig): ConfigGetParametersActionProcessor => {\n return async ({ parameterNames }) => {\n // Retrieve values from Local Storage for each parameter name\n const parameterValues = parameterNames.map((name) => ({\n name,\n value: localStorage.getItem(name),\n found: localStorage.getItem(name) !== null, // Check if it exists\n }));\n\n // Find missing parameters\n const missingParameters = parameterValues.filter((param) => !param.found);\n\n // If any parameters are missing, return an error\n if (missingParameters.length > 0) {\n return actionResultError(\n ErrorTypeEnum.NotFound,\n `Parameters not found in Local Storage: ${missingParameters.map((param) => param.name).join(', ')}`,\n );\n }\n\n // Return an array of values\n return actionResult(parameterValues.map((param) => param.value));\n };\n};\n\nexport const getConfigGetParametersActionProcessor: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [ConfigActionType.GetParameters]: getProcessConfigGetParameters(qpqConfig),\n});\n"]}
1
+ {"version":3,"file":"getConfigGetParametersActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParametersActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDASyB;AAEzB,MAAM,6BAA6B,GAAG,CAAC,SAAoB,EAAsC,EAAE;IACjG,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,KAAK,CAAC,CAAC,CAAC;IACnE,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,qCAAqC,GAAgC,CAAO,SAAoB,EAAgC,EAAE;IAAC,OAAA,CAAC;QAC/I,CAAC,kCAAgB,CAAC,aAAa,CAAC,EAAE,6BAA6B,CAAC,SAAS,CAAC;KAC3E,CAAC,CAAA;EAAA,CAAC;AAFU,QAAA,qCAAqC,yCAE/C","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n ConfigActionType,\n ConfigGetParametersActionProcessor,\n ErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nconst getProcessConfigGetParameters = (qpqConfig: QPQConfig): ConfigGetParametersActionProcessor => {\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));\n };\n};\n\nexport const getConfigGetParametersActionProcessor: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [ConfigActionType.GetParameters]: getProcessConfigGetParameters(qpqConfig),\n});\n"]}
@@ -14,7 +14,9 @@ const quidproquo_core_1 = require("quidproquo-core");
14
14
  const getProcessConfigSetParameter = (qpqConfig) => {
15
15
  return (_a) => __awaiter(void 0, [_a], void 0, function* ({ parameterName, parameterValue }) {
16
16
  try {
17
- localStorage.setItem(parameterName, parameterValue);
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);
18
20
  return (0, quidproquo_core_1.actionResult)(void 0);
19
21
  }
20
22
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"getConfigSetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigSetParameterActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAUyB;AAEzB,MAAM,4BAA4B,GAAG,CAAC,SAAoB,EAAqC,EAAE;IAC/F,OAAO,KAA0C,EAAE,4CAArC,EAAE,aAAa,EAAE,cAAc,EAAE;QAC7C,IAAI,CAAC;YACH,YAAY,CAAC,OAAO,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;YAEpD,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,iDAA+B,CAAC,aAAa,EAAE,kDAAkD,aAAa,IAAI,CAAC;aACxI,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,oCAAoC,GAAgC,CAAO,SAAoB,EAAgC,EAAE;IAAC,OAAA,CAAC;QAC9I,CAAC,kCAAgB,CAAC,YAAY,CAAC,EAAE,4BAA4B,CAAC,SAAS,CAAC;KACzE,CAAC,CAAA;EAAA,CAAC;AAFU,QAAA,oCAAoC,wCAE9C","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n ConfigActionType,\n ConfigSetParameterActionProcessor,\n ConfigSetParameterErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nconst getProcessConfigSetParameter = (qpqConfig: QPQConfig): ConfigSetParameterActionProcessor => {\n return async ({ parameterName, parameterValue }) => {\n try {\n localStorage.setItem(parameterName, parameterValue);\n\n return actionResult(void 0);\n } catch (error: unknown) {\n return actionResultErrorFromCaughtError(error, {\n QuotaExceededError: () =>\n actionResultError(ConfigSetParameterErrorTypeEnum.QuotaExceeded, `Local Storage quota exceeded saving parameter '${parameterName}'.`),\n });\n }\n };\n};\n\nexport const getConfigSetParameterActionProcessor: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [ConfigActionType.SetParameter]: getProcessConfigSetParameter(qpqConfig),\n});\n"]}
1
+ {"version":3,"file":"getConfigSetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigSetParameterActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAUyB;AAEzB,MAAM,4BAA4B,GAAG,CAAC,SAAoB,EAAqC,EAAE;IAC/F,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,iDAA+B,CAAC,aAAa,EAAE,kDAAkD,aAAa,IAAI,CAAC;aACxI,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,oCAAoC,GAAgC,CAAO,SAAoB,EAAgC,EAAE;IAAC,OAAA,CAAC;QAC9I,CAAC,kCAAgB,CAAC,YAAY,CAAC,EAAE,4BAA4B,CAAC,SAAS,CAAC;KACzE,CAAC,CAAA;EAAA,CAAC;AAFU,QAAA,oCAAoC,wCAE9C","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n ConfigActionType,\n ConfigSetParameterActionProcessor,\n ConfigSetParameterErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nconst getProcessConfigSetParameter = (qpqConfig: QPQConfig): ConfigSetParameterActionProcessor => {\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(ConfigSetParameterErrorTypeEnum.QuotaExceeded, `Local Storage quota exceeded saving parameter '${parameterName}'.`),\n });\n }\n };\n};\n\nexport const getConfigSetParameterActionProcessor: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [ConfigActionType.SetParameter]: getProcessConfigSetParameter(qpqConfig),\n});\n"]}
@@ -1,7 +1,7 @@
1
- import { ActionProcessorListResolver } from 'quidproquo-core';
2
- export interface ApiRequestActionProcessorOptions {
1
+ import { ActionProcessorListResolver, Nullable } from 'quidproquo-core';
2
+ export type ApiRequestActionProcessorOptions = {
3
3
  resolveServiceBaseUrl?: (service: string) => string;
4
- getHeaders?: () => Record<string, string> | undefined;
5
- }
4
+ getHeaders?: () => Nullable<Record<string, string>>;
5
+ };
6
6
  export declare const createApiRequestActionProcessor: (options?: ApiRequestActionProcessorOptions) => ActionProcessorListResolver;
7
7
  export declare const getApiRequestActionProcessor: ActionProcessorListResolver;
@@ -12,16 +12,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getApiRequestActionProcessor = exports.createApiRequestActionProcessor = void 0;
13
13
  const quidproquo_core_1 = require("quidproquo-core");
14
14
  const quidproquo_webserver_1 = require("quidproquo-webserver");
15
- const quidproquo_webserver_2 = require("quidproquo-webserver");
16
15
  const defaultResolveServiceBaseUrl = (_service) => {
17
16
  const { protocol, hostname, port } = window.location;
18
17
  return `${protocol}//api.${hostname}${port ? `:${port}` : ''}`;
19
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.
20
21
  const getProcessApiRequest = (options) => {
21
22
  return (_a) => __awaiter(void 0, [_a], void 0, function* ({ service, endpoint, method, body, params, headers, responseType }) {
22
23
  var _b, _c;
23
24
  const basePath = ((_b = options === null || options === void 0 ? void 0 : options.resolveServiceBaseUrl) !== null && _b !== void 0 ? _b : defaultResolveServiceBaseUrl)(service);
24
- const res = yield (0, quidproquo_webserver_2.preformNetworkRequest)({
25
+ const res = yield (0, quidproquo_webserver_1.preformNetworkRequest)({
25
26
  url: endpoint,
26
27
  basePath,
27
28
  method,
@@ -1 +1 @@
1
- {"version":3,"file":"createApiRequestActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/api/createApiRequestActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAiG;AACjG,+DAAgF;AAChF,+DAA6D;AAY7D,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,EAAuC,EAAE;IAC/G,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 } from 'quidproquo-core';\nimport { ApiActionType, ApiRequestActionProcessor } from 'quidproquo-webserver';\nimport { preformNetworkRequest } from 'quidproquo-webserver';\n\nexport interface 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?: () => Record<string, string> | undefined;\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): ApiRequestActionProcessor<any, any> => {\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
+ {"version":3,"file":"createApiRequestActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/api/createApiRequestActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA2G;AAC3G,+DAAuG;AAYvG,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,sFAAsF;AACtF,yFAAyF;AACzF,MAAM,oBAAoB,GAAG,CAAC,OAA0C,EAAuC,EAAE;IAC/G,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 } from 'quidproquo-core';\nimport { ApiActionType, ApiRequestActionProcessor, 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\n// any/any: the processor serves every ApiRequestAction<T> regardless of body/response\n// type, and T is contravariant in the action, so no single unknown-based signature fits.\nconst getProcessApiRequest = (options?: ApiRequestActionProcessorOptions): ApiRequestActionProcessor<any, any> => {\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"]}
@@ -17,12 +17,8 @@ const getProcessQueryParamsGetAll = (qpqConfig) => {
17
17
  const urlParams = new URLSearchParams(window.location.search);
18
18
  const paramsObject = {};
19
19
  urlParams.forEach((value, key) => {
20
- if (paramsObject[key]) {
21
- paramsObject[key] = [...paramsObject[key], value];
22
- }
23
- else {
24
- paramsObject[key] = [value];
25
- }
20
+ var _a;
21
+ paramsObject[key] = [...((_a = paramsObject[key]) !== null && _a !== void 0 ? _a : []), value];
26
22
  });
27
23
  return (0, quidproquo_core_1.actionResult)(paramsObject);
28
24
  });
@@ -1 +1 @@
1
- {"version":3,"file":"getQueryParamsGetAllActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA4G;AAC5G,mDAAyF;AAEzF,MAAM,2BAA2B,GAAG,CAAC,SAAoB,EAAoC,EAAE;IAC7F,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,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;gBACtB,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,GAAI,YAAY,CAAC,GAAG,CAAc,EAAE,KAAK,CAAC,CAAC;YAClE,CAAC;iBAAM,CAAC;gBACN,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,IAAA,8BAAY,EAAC,YAAY,CAAC,CAAC;IACpC,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,mCAAmC,GAAgC,CAAO,SAAoB,EAAgC,EAAE;IAAC,OAAA,CAAC;QAC7I,CAAC,sCAAqB,CAAC,MAAM,CAAC,EAAE,2BAA2B,CAAC,SAAS,CAAC;KACvE,CAAC,CAAA;EAAA,CAAC;AAFU,QAAA,mCAAmC,uCAE7C","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, actionResult, QPQConfig } from 'quidproquo-core';\nimport { QueryParamsActionType, QueryParamsGetAllActionProcessor } from 'quidproquo-web';\n\nconst getProcessQueryParamsGetAll = (qpqConfig: QPQConfig): QueryParamsGetAllActionProcessor => {\n return async () => {\n const urlParams = new URLSearchParams(window.location.search);\n const paramsObject: Record<string, string[]> = {};\n\n urlParams.forEach((value, key) => {\n if (paramsObject[key]) {\n paramsObject[key] = [...(paramsObject[key] as string[]), value];\n } else {\n paramsObject[key] = [value];\n }\n });\n\n return actionResult(paramsObject);\n };\n};\n\nexport const getQueryParamsGetAllActionProcessor: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [QueryParamsActionType.GetAll]: getProcessQueryParamsGetAll(qpqConfig),\n});\n"]}
1
+ {"version":3,"file":"getQueryParamsGetAllActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA4G;AAC5G,mDAAyF;AAEzF,MAAM,2BAA2B,GAAG,CAAC,SAAoB,EAAoC,EAAE;IAC7F,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;AAEK,MAAM,mCAAmC,GAAgC,CAAO,SAAoB,EAAgC,EAAE;IAAC,OAAA,CAAC;QAC7I,CAAC,sCAAqB,CAAC,MAAM,CAAC,EAAE,2BAA2B,CAAC,SAAS,CAAC;KACvE,CAAC,CAAA;EAAA,CAAC;AAFU,QAAA,mCAAmC,uCAE7C","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, actionResult, QPQConfig } from 'quidproquo-core';\nimport { QueryParamsActionType, QueryParamsGetAllActionProcessor } from 'quidproquo-web';\n\nconst getProcessQueryParamsGetAll = (qpqConfig: QPQConfig): QueryParamsGetAllActionProcessor => {\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: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [QueryParamsActionType.GetAll]: getProcessQueryParamsGetAll(qpqConfig),\n});\n"]}
@@ -16,15 +16,12 @@ const getProcessQueryParamsSet = (qpqConfig) => {
16
16
  return (_a) => __awaiter(void 0, [_a], void 0, function* ({ key, values, createHistoryEntry }) {
17
17
  const url = new URL(window.location.href);
18
18
  const urlParams = new URLSearchParams(url.search);
19
- // Ensure values is an array and remove key if empty
20
- if (values.length === 0) {
21
- urlParams.delete(key);
22
- }
23
- else {
24
- urlParams.delete(key);
25
- values.forEach((value) => urlParams.append(key, value));
26
- }
27
- const newUrl = `${url.pathname}?${urlParams.toString()}`;
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}`;
28
25
  if (createHistoryEntry) {
29
26
  window.history.pushState(null, '', newUrl);
30
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getQueryParamsSetActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA4G;AAC5G,mDAAsF;AAEtF,MAAM,wBAAwB,GAAG,CAAC,SAAoB,EAAiC,EAAE;IACvF,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,oDAAoD;QACpD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACtB,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;QAC1D,CAAC;QAED,MAAM,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,IAAI,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC;QAEzD,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;AAEK,MAAM,gCAAgC,GAAgC,CAAO,SAAoB,EAAgC,EAAE;IAAC,OAAA,CAAC;QAC1I,CAAC,sCAAqB,CAAC,GAAG,CAAC,EAAE,wBAAwB,CAAC,SAAS,CAAC;KACjE,CAAC,CAAA;EAAA,CAAC;AAFU,QAAA,gCAAgC,oCAE1C","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, actionResult, QPQConfig } from 'quidproquo-core';\nimport { QueryParamsActionType, QueryParamsSetActionProcessor } from 'quidproquo-web';\n\nconst getProcessQueryParamsSet = (qpqConfig: QPQConfig): QueryParamsSetActionProcessor => {\n return async ({ key, values, createHistoryEntry }) => {\n const url = new URL(window.location.href);\n const urlParams = new URLSearchParams(url.search);\n\n // Ensure values is an array and remove key if empty\n if (values.length === 0) {\n urlParams.delete(key);\n } else {\n urlParams.delete(key);\n values.forEach((value) => urlParams.append(key, value));\n }\n\n const newUrl = `${url.pathname}?${urlParams.toString()}`;\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: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [QueryParamsActionType.Set]: getProcessQueryParamsSet(qpqConfig),\n});\n"]}
1
+ {"version":3,"file":"getQueryParamsSetActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA4G;AAC5G,mDAAsF;AAEtF,MAAM,wBAAwB,GAAG,CAAC,SAAoB,EAAiC,EAAE;IACvF,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;AAEK,MAAM,gCAAgC,GAAgC,CAAO,SAAoB,EAAgC,EAAE;IAAC,OAAA,CAAC;QAC1I,CAAC,sCAAqB,CAAC,GAAG,CAAC,EAAE,wBAAwB,CAAC,SAAS,CAAC;KACjE,CAAC,CAAA;EAAA,CAAC;AAFU,QAAA,gCAAgC,oCAE1C","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, actionResult, QPQConfig } from 'quidproquo-core';\nimport { QueryParamsActionType, QueryParamsSetActionProcessor } from 'quidproquo-web';\n\nconst getProcessQueryParamsSet = (qpqConfig: QPQConfig): QueryParamsSetActionProcessor => {\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: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [QueryParamsActionType.Set]: getProcessQueryParamsSet(qpqConfig),\n});\n"]}
@@ -12,6 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getWebActionProcessors = void 0;
13
13
  const quidproquo_actionprocessor_js_1 = require("quidproquo-actionprocessor-js");
14
14
  const actionProcessor_1 = require("./actionProcessor");
15
+ // Later spreads win: the browser implementations below override the generic js
16
+ // processors for any action type both packages provide.
15
17
  const getWebActionProcessors = (qpqConfig, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
16
18
  return (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (yield (0, quidproquo_actionprocessor_js_1.getCoreActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, quidproquo_actionprocessor_js_1.getWebserverActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, actionProcessor_1.getCoreActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, actionProcessor_1.getWebserverActionProcessor)(qpqConfig, dynamicModuleLoader))), (yield (0, actionProcessor_1.getWebActionProcessor)(qpqConfig, dynamicModuleLoader))));
17
19
  });
@@ -1 +1 @@
1
- {"version":3,"file":"getWebActionProcessors.js","sourceRoot":"","sources":["../../src/getWebActionProcessors.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iFAGuC;AAGvC,uDAI2B;AAEpB,MAAM,sBAAsB,GAAgC,CACjE,SAAoB,EACpB,mBAAwC,EACV,EAAE;IAAC,OAAA,2EAC9B,CAAC,MAAM,IAAA,sDAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAChE,CAAC,MAAM,IAAA,2DAA6B,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAErE,CAAC,MAAM,IAAA,wCAAyB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GACjE,CAAC,MAAM,IAAA,6CAA8B,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAEtE,CAAC,MAAM,IAAA,uCAAqB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,EAChE,CAAA;EAAA,CAAC;AAXU,QAAA,sBAAsB,0BAWhC","sourcesContent":["import {\n getCoreActionProcessor as getJsCoreActionProcessor,\n getWebserverActionProcessor as getJsWebserverActionProcessor,\n} from 'quidproquo-actionprocessor-js';\nimport { ActionProcessorList, ActionProcessorListResolver, DynamicModuleLoader, QPQConfig } from 'quidproquo-core';\n\nimport {\n getCoreActionProcessor as getWebCoreActionProcessor,\n getWebActionProcessor,\n getWebserverActionProcessor as getWebWebserverActionProcessor,\n} from './actionProcessor';\n\nexport const getWebActionProcessors: ActionProcessorListResolver = async (\n qpqConfig: QPQConfig,\n dynamicModuleLoader: DynamicModuleLoader,\n): Promise<ActionProcessorList> => ({\n ...(await getJsCoreActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getJsWebserverActionProcessor(qpqConfig, dynamicModuleLoader)),\n\n ...(await getWebCoreActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getWebWebserverActionProcessor(qpqConfig, dynamicModuleLoader)),\n\n ...(await getWebActionProcessor(qpqConfig, dynamicModuleLoader)),\n});\n"]}
1
+ {"version":3,"file":"getWebActionProcessors.js","sourceRoot":"","sources":["../../src/getWebActionProcessors.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iFAGuC;AAGvC,uDAI2B;AAE3B,+EAA+E;AAC/E,wDAAwD;AACjD,MAAM,sBAAsB,GAAgC,CACjE,SAAoB,EACpB,mBAAwC,EACV,EAAE;IAAC,OAAA,2EAC9B,CAAC,MAAM,IAAA,sDAAwB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAChE,CAAC,MAAM,IAAA,2DAA6B,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAErE,CAAC,MAAM,IAAA,wCAAyB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GACjE,CAAC,MAAM,IAAA,6CAA8B,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,GAEtE,CAAC,MAAM,IAAA,uCAAqB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,EAChE,CAAA;EAAA,CAAC;AAXU,QAAA,sBAAsB,0BAWhC","sourcesContent":["import {\n getCoreActionProcessor as getJsCoreActionProcessor,\n getWebserverActionProcessor as getJsWebserverActionProcessor,\n} from 'quidproquo-actionprocessor-js';\nimport { ActionProcessorList, ActionProcessorListResolver, DynamicModuleLoader, QPQConfig } from 'quidproquo-core';\n\nimport {\n getCoreActionProcessor as getWebCoreActionProcessor,\n getWebActionProcessor,\n getWebserverActionProcessor as getWebWebserverActionProcessor,\n} from './actionProcessor';\n\n// Later spreads win: the browser implementations below override the generic js\n// processors for any action type both packages provide.\nexport const getWebActionProcessors: ActionProcessorListResolver = async (\n qpqConfig: QPQConfig,\n dynamicModuleLoader: DynamicModuleLoader,\n): Promise<ActionProcessorList> => ({\n ...(await getJsCoreActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getJsWebserverActionProcessor(qpqConfig, dynamicModuleLoader)),\n\n ...(await getWebCoreActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getWebWebserverActionProcessor(qpqConfig, dynamicModuleLoader)),\n\n ...(await getWebActionProcessor(qpqConfig, dynamicModuleLoader)),\n});\n"]}
@@ -1,9 +1,9 @@
1
1
  import { actionResult, actionResultError, ConfigActionType, ErrorTypeEnum, } from 'quidproquo-core';
2
2
  const getProcessConfigGetParameter = (qpqConfig) => {
3
3
  return async ({ parameterName }) => {
4
- // Read the value from Local Storage
5
- const parameterValue = localStorage.getItem(parameterName);
6
- // If the parameter doesn't exist, return an error
4
+ // window.localStorage (not the bare global): Node exposes a non-functional
5
+ // localStorage global that shadows jsdom's in tests.
6
+ const parameterValue = window.localStorage.getItem(parameterName);
7
7
  if (parameterValue === null) {
8
8
  return actionResultError(ErrorTypeEnum.NotFound, `Parameter '${parameterName}' not found in Local Storage`);
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getConfigGetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParameterActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAEhB,aAAa,GAEd,MAAM,iBAAiB,CAAC;AAEzB,MAAM,4BAA4B,GAAG,CAAC,SAAoB,EAAqC,EAAE;IAC/F,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE;QACjC,oCAAoC;QACpC,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAE3D,kDAAkD;QAClD,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,GAAgC,KAAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC9I,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,4BAA4B,CAAC,SAAS,CAAC;CACzE,CAAC,CAAC","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n ConfigActionType,\n ConfigGetParameterActionProcessor,\n ErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nconst getProcessConfigGetParameter = (qpqConfig: QPQConfig): ConfigGetParameterActionProcessor => {\n return async ({ parameterName }) => {\n // Read the value from Local Storage\n const parameterValue = localStorage.getItem(parameterName);\n\n // If the parameter doesn't exist, return an error\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: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [ConfigActionType.GetParameter]: getProcessConfigGetParameter(qpqConfig),\n});\n"]}
1
+ {"version":3,"file":"getConfigGetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParameterActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAEhB,aAAa,GAEd,MAAM,iBAAiB,CAAC;AAEzB,MAAM,4BAA4B,GAAG,CAAC,SAAoB,EAAqC,EAAE;IAC/F,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,GAAgC,KAAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC9I,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,4BAA4B,CAAC,SAAS,CAAC;CACzE,CAAC,CAAC","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n ConfigActionType,\n ConfigGetParameterActionProcessor,\n ErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nconst getProcessConfigGetParameter = (qpqConfig: QPQConfig): ConfigGetParameterActionProcessor => {\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: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [ConfigActionType.GetParameter]: getProcessConfigGetParameter(qpqConfig),\n});\n"]}
@@ -1,19 +1,16 @@
1
1
  import { actionResult, actionResultError, ConfigActionType, ErrorTypeEnum, } from 'quidproquo-core';
2
2
  const getProcessConfigGetParameters = (qpqConfig) => {
3
3
  return async ({ parameterNames }) => {
4
- // Retrieve values from Local Storage for each parameter name
4
+ // window.localStorage (not the bare global): Node exposes a non-functional
5
+ // localStorage global that shadows jsdom's in tests.
5
6
  const parameterValues = parameterNames.map((name) => ({
6
7
  name,
7
- value: localStorage.getItem(name),
8
- found: localStorage.getItem(name) !== null, // Check if it exists
8
+ value: window.localStorage.getItem(name),
9
9
  }));
10
- // Find missing parameters
11
- const missingParameters = parameterValues.filter((param) => !param.found);
12
- // If any parameters are missing, return an error
13
- if (missingParameters.length > 0) {
14
- return actionResultError(ErrorTypeEnum.NotFound, `Parameters not found in Local Storage: ${missingParameters.map((param) => param.name).join(', ')}`);
10
+ const missingNames = parameterValues.filter((param) => param.value === null).map((param) => param.name);
11
+ if (missingNames.length > 0) {
12
+ return actionResultError(ErrorTypeEnum.NotFound, `Parameters not found in Local Storage: ${missingNames.join(', ')}`);
15
13
  }
16
- // Return an array of values
17
14
  return actionResult(parameterValues.map((param) => param.value));
18
15
  };
19
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getConfigGetParametersActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParametersActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAEhB,aAAa,GAEd,MAAM,iBAAiB,CAAC;AAEzB,MAAM,6BAA6B,GAAG,CAAC,SAAoB,EAAsC,EAAE;IACjG,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE;QAClC,6DAA6D;QAC7D,MAAM,eAAe,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACpD,IAAI;YACJ,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC;YACjC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,qBAAqB;SAClE,CAAC,CAAC,CAAC;QAEJ,0BAA0B;QAC1B,MAAM,iBAAiB,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE1E,iDAAiD;QACjD,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,iBAAiB,CACtB,aAAa,CAAC,QAAQ,EACtB,0CAA0C,iBAAiB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACpG,CAAC;QACJ,CAAC;QAED,4BAA4B;QAC5B,OAAO,YAAY,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACnE,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qCAAqC,GAAgC,KAAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC/I,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,6BAA6B,CAAC,SAAS,CAAC;CAC3E,CAAC,CAAC","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n ConfigActionType,\n ConfigGetParametersActionProcessor,\n ErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nconst getProcessConfigGetParameters = (qpqConfig: QPQConfig): ConfigGetParametersActionProcessor => {\n return async ({ parameterNames }) => {\n // Retrieve values from Local Storage for each parameter name\n const parameterValues = parameterNames.map((name) => ({\n name,\n value: localStorage.getItem(name),\n found: localStorage.getItem(name) !== null, // Check if it exists\n }));\n\n // Find missing parameters\n const missingParameters = parameterValues.filter((param) => !param.found);\n\n // If any parameters are missing, return an error\n if (missingParameters.length > 0) {\n return actionResultError(\n ErrorTypeEnum.NotFound,\n `Parameters not found in Local Storage: ${missingParameters.map((param) => param.name).join(', ')}`,\n );\n }\n\n // Return an array of values\n return actionResult(parameterValues.map((param) => param.value));\n };\n};\n\nexport const getConfigGetParametersActionProcessor: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [ConfigActionType.GetParameters]: getProcessConfigGetParameters(qpqConfig),\n});\n"]}
1
+ {"version":3,"file":"getConfigGetParametersActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigGetParametersActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAEhB,aAAa,GAEd,MAAM,iBAAiB,CAAC;AAEzB,MAAM,6BAA6B,GAAG,CAAC,SAAoB,EAAsC,EAAE;IACjG,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,KAAK,CAAC,CAAC,CAAC;IACnE,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qCAAqC,GAAgC,KAAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC/I,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,6BAA6B,CAAC,SAAS,CAAC;CAC3E,CAAC,CAAC","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n ConfigActionType,\n ConfigGetParametersActionProcessor,\n ErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nconst getProcessConfigGetParameters = (qpqConfig: QPQConfig): ConfigGetParametersActionProcessor => {\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));\n };\n};\n\nexport const getConfigGetParametersActionProcessor: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [ConfigActionType.GetParameters]: getProcessConfigGetParameters(qpqConfig),\n});\n"]}
@@ -2,7 +2,9 @@ import { actionResult, actionResultError, actionResultErrorFromCaughtError, Conf
2
2
  const getProcessConfigSetParameter = (qpqConfig) => {
3
3
  return async ({ parameterName, parameterValue }) => {
4
4
  try {
5
- localStorage.setItem(parameterName, parameterValue);
5
+ // window.localStorage (not the bare global): Node exposes a non-functional
6
+ // localStorage global that shadows jsdom's in tests.
7
+ window.localStorage.setItem(parameterName, parameterValue);
6
8
  return actionResult(void 0);
7
9
  }
8
10
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"getConfigSetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigSetParameterActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,iBAAiB,EACjB,gCAAgC,EAChC,gBAAgB,EAEhB,+BAA+B,GAEhC,MAAM,iBAAiB,CAAC;AAEzB,MAAM,4BAA4B,GAAG,CAAC,SAAoB,EAAqC,EAAE;IAC/F,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,cAAc,EAAE,EAAE,EAAE;QACjD,IAAI,CAAC;YACH,YAAY,CAAC,OAAO,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;YAEpD,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,+BAA+B,CAAC,aAAa,EAAE,kDAAkD,aAAa,IAAI,CAAC;aACxI,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAgC,KAAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC9I,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,4BAA4B,CAAC,SAAS,CAAC;CACzE,CAAC,CAAC","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n ConfigActionType,\n ConfigSetParameterActionProcessor,\n ConfigSetParameterErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nconst getProcessConfigSetParameter = (qpqConfig: QPQConfig): ConfigSetParameterActionProcessor => {\n return async ({ parameterName, parameterValue }) => {\n try {\n localStorage.setItem(parameterName, parameterValue);\n\n return actionResult(void 0);\n } catch (error: unknown) {\n return actionResultErrorFromCaughtError(error, {\n QuotaExceededError: () =>\n actionResultError(ConfigSetParameterErrorTypeEnum.QuotaExceeded, `Local Storage quota exceeded saving parameter '${parameterName}'.`),\n });\n }\n };\n};\n\nexport const getConfigSetParameterActionProcessor: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [ConfigActionType.SetParameter]: getProcessConfigSetParameter(qpqConfig),\n});\n"]}
1
+ {"version":3,"file":"getConfigSetParameterActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/core/config/getConfigSetParameterActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,iBAAiB,EACjB,gCAAgC,EAChC,gBAAgB,EAEhB,+BAA+B,GAEhC,MAAM,iBAAiB,CAAC;AAEzB,MAAM,4BAA4B,GAAG,CAAC,SAAoB,EAAqC,EAAE;IAC/F,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,+BAA+B,CAAC,aAAa,EAAE,kDAAkD,aAAa,IAAI,CAAC;aACxI,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAgC,KAAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC9I,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,4BAA4B,CAAC,SAAS,CAAC;CACzE,CAAC,CAAC","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n ConfigActionType,\n ConfigSetParameterActionProcessor,\n ConfigSetParameterErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nconst getProcessConfigSetParameter = (qpqConfig: QPQConfig): ConfigSetParameterActionProcessor => {\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(ConfigSetParameterErrorTypeEnum.QuotaExceeded, `Local Storage quota exceeded saving parameter '${parameterName}'.`),\n });\n }\n };\n};\n\nexport const getConfigSetParameterActionProcessor: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [ConfigActionType.SetParameter]: getProcessConfigSetParameter(qpqConfig),\n});\n"]}
@@ -1,7 +1,7 @@
1
- import { ActionProcessorListResolver } from 'quidproquo-core';
2
- export interface ApiRequestActionProcessorOptions {
1
+ import { ActionProcessorListResolver, Nullable } from 'quidproquo-core';
2
+ export type ApiRequestActionProcessorOptions = {
3
3
  resolveServiceBaseUrl?: (service: string) => string;
4
- getHeaders?: () => Record<string, string> | undefined;
5
- }
4
+ getHeaders?: () => Nullable<Record<string, string>>;
5
+ };
6
6
  export declare const createApiRequestActionProcessor: (options?: ApiRequestActionProcessorOptions) => ActionProcessorListResolver;
7
7
  export declare const getApiRequestActionProcessor: ActionProcessorListResolver;
@@ -1,10 +1,11 @@
1
1
  import { actionResult } from 'quidproquo-core';
2
- import { ApiActionType } from 'quidproquo-webserver';
3
- import { preformNetworkRequest } from 'quidproquo-webserver';
2
+ import { ApiActionType, preformNetworkRequest } from 'quidproquo-webserver';
4
3
  const defaultResolveServiceBaseUrl = (_service) => {
5
4
  const { protocol, hostname, port } = window.location;
6
5
  return `${protocol}//api.${hostname}${port ? `:${port}` : ''}`;
7
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.
8
9
  const getProcessApiRequest = (options) => {
9
10
  return async ({ service, endpoint, method, body, params, headers, responseType }) => {
10
11
  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,EAAE,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAAE,aAAa,EAA6B,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAY7D,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,EAAuC,EAAE;IAC/G,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 } from 'quidproquo-core';\nimport { ApiActionType, ApiRequestActionProcessor } from 'quidproquo-webserver';\nimport { preformNetworkRequest } from 'quidproquo-webserver';\n\nexport interface 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?: () => Record<string, string> | undefined;\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): ApiRequestActionProcessor<any, any> => {\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
+ {"version":3,"file":"createApiRequestActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/api/createApiRequestActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,YAAY,EAAY,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EAAE,aAAa,EAA6B,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAYvG,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,sFAAsF;AACtF,yFAAyF;AACzF,MAAM,oBAAoB,GAAG,CAAC,OAA0C,EAAuC,EAAE;IAC/G,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 } from 'quidproquo-core';\nimport { ApiActionType, ApiRequestActionProcessor, 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\n// any/any: the processor serves every ApiRequestAction<T> regardless of body/response\n// type, and T is contravariant in the action, so no single unknown-based signature fits.\nconst getProcessApiRequest = (options?: ApiRequestActionProcessorOptions): ApiRequestActionProcessor<any, any> => {\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"]}
@@ -5,12 +5,7 @@ const getProcessQueryParamsGetAll = (qpqConfig) => {
5
5
  const urlParams = new URLSearchParams(window.location.search);
6
6
  const paramsObject = {};
7
7
  urlParams.forEach((value, key) => {
8
- if (paramsObject[key]) {
9
- paramsObject[key] = [...paramsObject[key], value];
10
- }
11
- else {
12
- paramsObject[key] = [value];
13
- }
8
+ paramsObject[key] = [...(paramsObject[key] ?? []), value];
14
9
  });
15
10
  return actionResult(paramsObject);
16
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getQueryParamsGetAllActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,YAAY,EAAa,MAAM,iBAAiB,CAAC;AAC5G,OAAO,EAAE,qBAAqB,EAAoC,MAAM,gBAAgB,CAAC;AAEzF,MAAM,2BAA2B,GAAG,CAAC,SAAoB,EAAoC,EAAE;IAC7F,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,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;gBACtB,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,GAAI,YAAY,CAAC,GAAG,CAAc,EAAE,KAAK,CAAC,CAAC;YAClE,CAAC;iBAAM,CAAC;gBACN,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,YAAY,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mCAAmC,GAAgC,KAAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC7I,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,2BAA2B,CAAC,SAAS,CAAC;CACvE,CAAC,CAAC","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, actionResult, QPQConfig } from 'quidproquo-core';\nimport { QueryParamsActionType, QueryParamsGetAllActionProcessor } from 'quidproquo-web';\n\nconst getProcessQueryParamsGetAll = (qpqConfig: QPQConfig): QueryParamsGetAllActionProcessor => {\n return async () => {\n const urlParams = new URLSearchParams(window.location.search);\n const paramsObject: Record<string, string[]> = {};\n\n urlParams.forEach((value, key) => {\n if (paramsObject[key]) {\n paramsObject[key] = [...(paramsObject[key] as string[]), value];\n } else {\n paramsObject[key] = [value];\n }\n });\n\n return actionResult(paramsObject);\n };\n};\n\nexport const getQueryParamsGetAllActionProcessor: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [QueryParamsActionType.GetAll]: getProcessQueryParamsGetAll(qpqConfig),\n});\n"]}
1
+ {"version":3,"file":"getQueryParamsGetAllActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsGetAllActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,YAAY,EAAa,MAAM,iBAAiB,CAAC;AAC5G,OAAO,EAAE,qBAAqB,EAAoC,MAAM,gBAAgB,CAAC;AAEzF,MAAM,2BAA2B,GAAG,CAAC,SAAoB,EAAoC,EAAE;IAC7F,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,GAAgC,KAAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC7I,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,2BAA2B,CAAC,SAAS,CAAC;CACvE,CAAC,CAAC","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, actionResult, QPQConfig } from 'quidproquo-core';\nimport { QueryParamsActionType, QueryParamsGetAllActionProcessor } from 'quidproquo-web';\n\nconst getProcessQueryParamsGetAll = (qpqConfig: QPQConfig): QueryParamsGetAllActionProcessor => {\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: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [QueryParamsActionType.GetAll]: getProcessQueryParamsGetAll(qpqConfig),\n});\n"]}
@@ -4,15 +4,12 @@ const getProcessQueryParamsSet = (qpqConfig) => {
4
4
  return async ({ key, values, createHistoryEntry }) => {
5
5
  const url = new URL(window.location.href);
6
6
  const urlParams = new URLSearchParams(url.search);
7
- // Ensure values is an array and remove key if empty
8
- if (values.length === 0) {
9
- urlParams.delete(key);
10
- }
11
- else {
12
- urlParams.delete(key);
13
- values.forEach((value) => urlParams.append(key, value));
14
- }
15
- const newUrl = `${url.pathname}?${urlParams.toString()}`;
7
+ // Replace every existing value for the key; no values means remove it.
8
+ urlParams.delete(key);
9
+ values.forEach((value) => urlParams.append(key, value));
10
+ // Only the query changes: keep the hash, and drop the '?' when no params remain.
11
+ const search = urlParams.toString();
12
+ const newUrl = `${url.pathname}${search ? `?${search}` : ''}${url.hash}`;
16
13
  if (createHistoryEntry) {
17
14
  window.history.pushState(null, '', newUrl);
18
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getQueryParamsSetActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,YAAY,EAAa,MAAM,iBAAiB,CAAC;AAC5G,OAAO,EAAE,qBAAqB,EAAiC,MAAM,gBAAgB,CAAC;AAEtF,MAAM,wBAAwB,GAAG,CAAC,SAAoB,EAAiC,EAAE;IACvF,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,oDAAoD;QACpD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACtB,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;QAC1D,CAAC;QAED,MAAM,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,IAAI,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC;QAEzD,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,GAAgC,KAAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC1I,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,wBAAwB,CAAC,SAAS,CAAC;CACjE,CAAC,CAAC","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, actionResult, QPQConfig } from 'quidproquo-core';\nimport { QueryParamsActionType, QueryParamsSetActionProcessor } from 'quidproquo-web';\n\nconst getProcessQueryParamsSet = (qpqConfig: QPQConfig): QueryParamsSetActionProcessor => {\n return async ({ key, values, createHistoryEntry }) => {\n const url = new URL(window.location.href);\n const urlParams = new URLSearchParams(url.search);\n\n // Ensure values is an array and remove key if empty\n if (values.length === 0) {\n urlParams.delete(key);\n } else {\n urlParams.delete(key);\n values.forEach((value) => urlParams.append(key, value));\n }\n\n const newUrl = `${url.pathname}?${urlParams.toString()}`;\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: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [QueryParamsActionType.Set]: getProcessQueryParamsSet(qpqConfig),\n});\n"]}
1
+ {"version":3,"file":"getQueryParamsSetActionProcessor.js","sourceRoot":"","sources":["../../../../../src/actionProcessor/web/queryParams/getQueryParamsSetActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,YAAY,EAAa,MAAM,iBAAiB,CAAC;AAC5G,OAAO,EAAE,qBAAqB,EAAiC,MAAM,gBAAgB,CAAC;AAEtF,MAAM,wBAAwB,GAAG,CAAC,SAAoB,EAAiC,EAAE;IACvF,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,GAAgC,KAAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC1I,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,wBAAwB,CAAC,SAAS,CAAC;CACjE,CAAC,CAAC","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, actionResult, QPQConfig } from 'quidproquo-core';\nimport { QueryParamsActionType, QueryParamsSetActionProcessor } from 'quidproquo-web';\n\nconst getProcessQueryParamsSet = (qpqConfig: QPQConfig): QueryParamsSetActionProcessor => {\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: ActionProcessorListResolver = async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [QueryParamsActionType.Set]: getProcessQueryParamsSet(qpqConfig),\n});\n"]}
@@ -1,5 +1,7 @@
1
1
  import { getCoreActionProcessor as getJsCoreActionProcessor, getWebserverActionProcessor as getJsWebserverActionProcessor, } from 'quidproquo-actionprocessor-js';
2
2
  import { getCoreActionProcessor as getWebCoreActionProcessor, getWebActionProcessor, getWebserverActionProcessor as getWebWebserverActionProcessor, } from './actionProcessor';
3
+ // Later spreads win: the browser implementations below override the generic js
4
+ // processors for any action type both packages provide.
3
5
  export const getWebActionProcessors = async (qpqConfig, dynamicModuleLoader) => ({
4
6
  ...(await getJsCoreActionProcessor(qpqConfig, dynamicModuleLoader)),
5
7
  ...(await getJsWebserverActionProcessor(qpqConfig, dynamicModuleLoader)),
@@ -1 +1 @@
1
- {"version":3,"file":"getWebActionProcessors.js","sourceRoot":"","sources":["../../src/getWebActionProcessors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,IAAI,wBAAwB,EAClD,2BAA2B,IAAI,6BAA6B,GAC7D,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EACL,sBAAsB,IAAI,yBAAyB,EACnD,qBAAqB,EACrB,2BAA2B,IAAI,8BAA8B,GAC9D,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,MAAM,sBAAsB,GAAgC,KAAK,EACtE,SAAoB,EACpB,mBAAwC,EACV,EAAE,CAAC,CAAC;IAClC,GAAG,CAAC,MAAM,wBAAwB,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;IACnE,GAAG,CAAC,MAAM,6BAA6B,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;IAExE,GAAG,CAAC,MAAM,yBAAyB,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;IACpE,GAAG,CAAC,MAAM,8BAA8B,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;IAEzE,GAAG,CAAC,MAAM,qBAAqB,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;CACjE,CAAC,CAAC","sourcesContent":["import {\n getCoreActionProcessor as getJsCoreActionProcessor,\n getWebserverActionProcessor as getJsWebserverActionProcessor,\n} from 'quidproquo-actionprocessor-js';\nimport { ActionProcessorList, ActionProcessorListResolver, DynamicModuleLoader, QPQConfig } from 'quidproquo-core';\n\nimport {\n getCoreActionProcessor as getWebCoreActionProcessor,\n getWebActionProcessor,\n getWebserverActionProcessor as getWebWebserverActionProcessor,\n} from './actionProcessor';\n\nexport const getWebActionProcessors: ActionProcessorListResolver = async (\n qpqConfig: QPQConfig,\n dynamicModuleLoader: DynamicModuleLoader,\n): Promise<ActionProcessorList> => ({\n ...(await getJsCoreActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getJsWebserverActionProcessor(qpqConfig, dynamicModuleLoader)),\n\n ...(await getWebCoreActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getWebWebserverActionProcessor(qpqConfig, dynamicModuleLoader)),\n\n ...(await getWebActionProcessor(qpqConfig, dynamicModuleLoader)),\n});\n"]}
1
+ {"version":3,"file":"getWebActionProcessors.js","sourceRoot":"","sources":["../../src/getWebActionProcessors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,IAAI,wBAAwB,EAClD,2BAA2B,IAAI,6BAA6B,GAC7D,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EACL,sBAAsB,IAAI,yBAAyB,EACnD,qBAAqB,EACrB,2BAA2B,IAAI,8BAA8B,GAC9D,MAAM,mBAAmB,CAAC;AAE3B,+EAA+E;AAC/E,wDAAwD;AACxD,MAAM,CAAC,MAAM,sBAAsB,GAAgC,KAAK,EACtE,SAAoB,EACpB,mBAAwC,EACV,EAAE,CAAC,CAAC;IAClC,GAAG,CAAC,MAAM,wBAAwB,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;IACnE,GAAG,CAAC,MAAM,6BAA6B,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;IAExE,GAAG,CAAC,MAAM,yBAAyB,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;IACpE,GAAG,CAAC,MAAM,8BAA8B,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;IAEzE,GAAG,CAAC,MAAM,qBAAqB,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;CACjE,CAAC,CAAC","sourcesContent":["import {\n getCoreActionProcessor as getJsCoreActionProcessor,\n getWebserverActionProcessor as getJsWebserverActionProcessor,\n} from 'quidproquo-actionprocessor-js';\nimport { ActionProcessorList, ActionProcessorListResolver, DynamicModuleLoader, QPQConfig } from 'quidproquo-core';\n\nimport {\n getCoreActionProcessor as getWebCoreActionProcessor,\n getWebActionProcessor,\n getWebserverActionProcessor as getWebWebserverActionProcessor,\n} from './actionProcessor';\n\n// Later spreads win: the browser implementations below override the generic js\n// processors for any action type both packages provide.\nexport const getWebActionProcessors: ActionProcessorListResolver = async (\n qpqConfig: QPQConfig,\n dynamicModuleLoader: DynamicModuleLoader,\n): Promise<ActionProcessorList> => ({\n ...(await getJsCoreActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getJsWebserverActionProcessor(qpqConfig, dynamicModuleLoader)),\n\n ...(await getWebCoreActionProcessor(qpqConfig, dynamicModuleLoader)),\n ...(await getWebWebserverActionProcessor(qpqConfig, dynamicModuleLoader)),\n\n ...(await getWebActionProcessor(qpqConfig, dynamicModuleLoader)),\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-actionprocessor-web",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -10,7 +10,8 @@
10
10
  "lib/**/*"
11
11
  ],
12
12
  "scripts": {
13
- "test": "echo \"Error: no test specified\" && exit 1",
13
+ "test": "vitest run",
14
+ "test:watch": "vitest",
14
15
  "clean": "npx rimraf lib && npx rimraf node_modules",
15
16
  "build": "npm run clean && npm run build:esm && npm run build:cjs",
16
17
  "watch": "tsc -p tsconfig.commonjs.json -w",
@@ -32,15 +33,13 @@
32
33
  },
33
34
  "homepage": "https://github.com/joe-coady/quidproquo#readme",
34
35
  "dependencies": {
35
- "@anthropic-ai/sdk": "^0.19.1",
36
- "quidproquo-actionprocessor-js": "0.1.11",
37
- "quidproquo-core": "0.1.11",
38
- "quidproquo-web": "0.1.11",
39
- "quidproquo-webserver": "0.1.11",
40
- "uuidv7": "^1.0.1"
36
+ "quidproquo-actionprocessor-js": "0.1.12",
37
+ "quidproquo-core": "0.1.12",
38
+ "quidproquo-web": "0.1.12",
39
+ "quidproquo-webserver": "0.1.12"
41
40
  },
42
41
  "devDependencies": {
43
- "quidproquo-tsconfig": "0.1.11",
42
+ "quidproquo-tsconfig": "0.1.12",
44
43
  "typescript": "^5.8.2"
45
44
  }
46
45
  }