quidproquo-actionprocessor-node 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.
Files changed (110) hide show
  1. package/README.md +15 -97
  2. package/lib/commonjs/actionProcessor/core/dynamicFunctions/getDynamicFunctionsExecuteActionProcessor.d.ts +1 -2
  3. package/lib/commonjs/actionProcessor/core/dynamicFunctions/getDynamicFunctionsExecuteActionProcessor.js +1 -6
  4. package/lib/commonjs/actionProcessor/core/dynamicFunctions/getDynamicFunctionsExecuteActionProcessor.js.map +1 -1
  5. package/lib/commonjs/actionProcessor/core/index.js +1 -1
  6. package/lib/commonjs/actionProcessor/core/index.js.map +1 -1
  7. package/lib/commonjs/actionProcessor/core/inlineFunction/getInlineFunctionExecuteActionProcessor.d.ts +1 -2
  8. package/lib/commonjs/actionProcessor/core/inlineFunction/getInlineFunctionExecuteActionProcessor.js +1 -6
  9. package/lib/commonjs/actionProcessor/core/inlineFunction/getInlineFunctionExecuteActionProcessor.js.map +1 -1
  10. package/lib/commonjs/actionProcessor/core/stream/getStreamCloseActionProcessor.d.ts +1 -2
  11. package/lib/commonjs/actionProcessor/core/stream/getStreamCloseActionProcessor.js +1 -6
  12. package/lib/commonjs/actionProcessor/core/stream/getStreamCloseActionProcessor.js.map +1 -1
  13. package/lib/commonjs/actionProcessor/core/stream/getStreamReadActionProcessor.d.ts +1 -2
  14. package/lib/commonjs/actionProcessor/core/stream/getStreamReadActionProcessor.js +1 -6
  15. package/lib/commonjs/actionProcessor/core/stream/getStreamReadActionProcessor.js.map +1 -1
  16. package/lib/commonjs/dynamicActionProcessor/file/getFileDeleteActionProcessor.d.ts +1 -2
  17. package/lib/commonjs/dynamicActionProcessor/file/getFileDeleteActionProcessor.js +3 -7
  18. package/lib/commonjs/dynamicActionProcessor/file/getFileDeleteActionProcessor.js.map +1 -1
  19. package/lib/commonjs/dynamicActionProcessor/file/getFileExistsActionProcessor.d.ts +1 -2
  20. package/lib/commonjs/dynamicActionProcessor/file/getFileExistsActionProcessor.js +3 -7
  21. package/lib/commonjs/dynamicActionProcessor/file/getFileExistsActionProcessor.js.map +1 -1
  22. package/lib/commonjs/dynamicActionProcessor/file/getFileGenerateTemporarySecureUrlActionProcessor.d.ts +1 -2
  23. package/lib/commonjs/dynamicActionProcessor/file/getFileGenerateTemporarySecureUrlActionProcessor.js +3 -7
  24. package/lib/commonjs/dynamicActionProcessor/file/getFileGenerateTemporarySecureUrlActionProcessor.js.map +1 -1
  25. package/lib/commonjs/dynamicActionProcessor/file/getFileGenerateTemporaryUploadSecureUrlActionProcessor.d.ts +1 -2
  26. package/lib/commonjs/dynamicActionProcessor/file/getFileGenerateTemporaryUploadSecureUrlActionProcessor.js +3 -7
  27. package/lib/commonjs/dynamicActionProcessor/file/getFileGenerateTemporaryUploadSecureUrlActionProcessor.js.map +1 -1
  28. package/lib/commonjs/dynamicActionProcessor/file/getFileIsColdStorageActionProcessor.d.ts +1 -2
  29. package/lib/commonjs/dynamicActionProcessor/file/getFileIsColdStorageActionProcessor.js +1 -5
  30. package/lib/commonjs/dynamicActionProcessor/file/getFileIsColdStorageActionProcessor.js.map +1 -1
  31. package/lib/commonjs/dynamicActionProcessor/file/getFileListDirectoryActionProcessor.d.ts +1 -2
  32. package/lib/commonjs/dynamicActionProcessor/file/getFileListDirectoryActionProcessor.js +5 -9
  33. package/lib/commonjs/dynamicActionProcessor/file/getFileListDirectoryActionProcessor.js.map +1 -1
  34. package/lib/commonjs/dynamicActionProcessor/file/getFileReadBinaryContentsActionProcessor.d.ts +1 -2
  35. package/lib/commonjs/dynamicActionProcessor/file/getFileReadBinaryContentsActionProcessor.js +3 -7
  36. package/lib/commonjs/dynamicActionProcessor/file/getFileReadBinaryContentsActionProcessor.js.map +1 -1
  37. package/lib/commonjs/dynamicActionProcessor/file/getFileReadObjectJsonActionProcessor.d.ts +1 -2
  38. package/lib/commonjs/dynamicActionProcessor/file/getFileReadObjectJsonActionProcessor.js +4 -8
  39. package/lib/commonjs/dynamicActionProcessor/file/getFileReadObjectJsonActionProcessor.js.map +1 -1
  40. package/lib/commonjs/dynamicActionProcessor/file/getFileReadTextContentsActionProcessor.d.ts +1 -2
  41. package/lib/commonjs/dynamicActionProcessor/file/getFileReadTextContentsActionProcessor.js +3 -7
  42. package/lib/commonjs/dynamicActionProcessor/file/getFileReadTextContentsActionProcessor.js.map +1 -1
  43. package/lib/commonjs/dynamicActionProcessor/file/getFileStreamOpenActionProcessor.d.ts +1 -2
  44. package/lib/commonjs/dynamicActionProcessor/file/getFileStreamOpenActionProcessor.js +3 -7
  45. package/lib/commonjs/dynamicActionProcessor/file/getFileStreamOpenActionProcessor.js.map +1 -1
  46. package/lib/commonjs/dynamicActionProcessor/file/getFileWriteBinaryContentsActionProcessor.d.ts +1 -2
  47. package/lib/commonjs/dynamicActionProcessor/file/getFileWriteBinaryContentsActionProcessor.js +3 -7
  48. package/lib/commonjs/dynamicActionProcessor/file/getFileWriteBinaryContentsActionProcessor.js.map +1 -1
  49. package/lib/commonjs/dynamicActionProcessor/file/getFileWriteObjectJsonActionProcessor.d.ts +1 -2
  50. package/lib/commonjs/dynamicActionProcessor/file/getFileWriteObjectJsonActionProcessor.js +3 -7
  51. package/lib/commonjs/dynamicActionProcessor/file/getFileWriteObjectJsonActionProcessor.js.map +1 -1
  52. package/lib/commonjs/dynamicActionProcessor/file/getFileWriteTextContentsActionProcessor.d.ts +1 -2
  53. package/lib/commonjs/dynamicActionProcessor/file/getFileWriteTextContentsActionProcessor.js +3 -7
  54. package/lib/commonjs/dynamicActionProcessor/file/getFileWriteTextContentsActionProcessor.js.map +1 -1
  55. package/lib/commonjs/traceStoryExecution/getSystemTraceStoryActionProcessor.js.map +1 -1
  56. package/lib/esm/actionProcessor/core/dynamicFunctions/getDynamicFunctionsExecuteActionProcessor.d.ts +1 -2
  57. package/lib/esm/actionProcessor/core/dynamicFunctions/getDynamicFunctionsExecuteActionProcessor.js +2 -4
  58. package/lib/esm/actionProcessor/core/dynamicFunctions/getDynamicFunctionsExecuteActionProcessor.js.map +1 -1
  59. package/lib/esm/actionProcessor/core/index.js +1 -1
  60. package/lib/esm/actionProcessor/core/index.js.map +1 -1
  61. package/lib/esm/actionProcessor/core/inlineFunction/getInlineFunctionExecuteActionProcessor.d.ts +1 -2
  62. package/lib/esm/actionProcessor/core/inlineFunction/getInlineFunctionExecuteActionProcessor.js +2 -4
  63. package/lib/esm/actionProcessor/core/inlineFunction/getInlineFunctionExecuteActionProcessor.js.map +1 -1
  64. package/lib/esm/actionProcessor/core/stream/getStreamCloseActionProcessor.d.ts +1 -2
  65. package/lib/esm/actionProcessor/core/stream/getStreamCloseActionProcessor.js +2 -4
  66. package/lib/esm/actionProcessor/core/stream/getStreamCloseActionProcessor.js.map +1 -1
  67. package/lib/esm/actionProcessor/core/stream/getStreamReadActionProcessor.d.ts +1 -2
  68. package/lib/esm/actionProcessor/core/stream/getStreamReadActionProcessor.js +2 -4
  69. package/lib/esm/actionProcessor/core/stream/getStreamReadActionProcessor.js.map +1 -1
  70. package/lib/esm/dynamicActionProcessor/file/getFileDeleteActionProcessor.d.ts +1 -2
  71. package/lib/esm/dynamicActionProcessor/file/getFileDeleteActionProcessor.js +4 -6
  72. package/lib/esm/dynamicActionProcessor/file/getFileDeleteActionProcessor.js.map +1 -1
  73. package/lib/esm/dynamicActionProcessor/file/getFileExistsActionProcessor.d.ts +1 -2
  74. package/lib/esm/dynamicActionProcessor/file/getFileExistsActionProcessor.js +4 -6
  75. package/lib/esm/dynamicActionProcessor/file/getFileExistsActionProcessor.js.map +1 -1
  76. package/lib/esm/dynamicActionProcessor/file/getFileGenerateTemporarySecureUrlActionProcessor.d.ts +1 -2
  77. package/lib/esm/dynamicActionProcessor/file/getFileGenerateTemporarySecureUrlActionProcessor.js +4 -6
  78. package/lib/esm/dynamicActionProcessor/file/getFileGenerateTemporarySecureUrlActionProcessor.js.map +1 -1
  79. package/lib/esm/dynamicActionProcessor/file/getFileGenerateTemporaryUploadSecureUrlActionProcessor.d.ts +1 -2
  80. package/lib/esm/dynamicActionProcessor/file/getFileGenerateTemporaryUploadSecureUrlActionProcessor.js +4 -6
  81. package/lib/esm/dynamicActionProcessor/file/getFileGenerateTemporaryUploadSecureUrlActionProcessor.js.map +1 -1
  82. package/lib/esm/dynamicActionProcessor/file/getFileIsColdStorageActionProcessor.d.ts +1 -2
  83. package/lib/esm/dynamicActionProcessor/file/getFileIsColdStorageActionProcessor.js +2 -4
  84. package/lib/esm/dynamicActionProcessor/file/getFileIsColdStorageActionProcessor.js.map +1 -1
  85. package/lib/esm/dynamicActionProcessor/file/getFileListDirectoryActionProcessor.d.ts +1 -2
  86. package/lib/esm/dynamicActionProcessor/file/getFileListDirectoryActionProcessor.js +6 -8
  87. package/lib/esm/dynamicActionProcessor/file/getFileListDirectoryActionProcessor.js.map +1 -1
  88. package/lib/esm/dynamicActionProcessor/file/getFileReadBinaryContentsActionProcessor.d.ts +1 -2
  89. package/lib/esm/dynamicActionProcessor/file/getFileReadBinaryContentsActionProcessor.js +4 -6
  90. package/lib/esm/dynamicActionProcessor/file/getFileReadBinaryContentsActionProcessor.js.map +1 -1
  91. package/lib/esm/dynamicActionProcessor/file/getFileReadObjectJsonActionProcessor.d.ts +1 -2
  92. package/lib/esm/dynamicActionProcessor/file/getFileReadObjectJsonActionProcessor.js +5 -7
  93. package/lib/esm/dynamicActionProcessor/file/getFileReadObjectJsonActionProcessor.js.map +1 -1
  94. package/lib/esm/dynamicActionProcessor/file/getFileReadTextContentsActionProcessor.d.ts +1 -2
  95. package/lib/esm/dynamicActionProcessor/file/getFileReadTextContentsActionProcessor.js +4 -6
  96. package/lib/esm/dynamicActionProcessor/file/getFileReadTextContentsActionProcessor.js.map +1 -1
  97. package/lib/esm/dynamicActionProcessor/file/getFileStreamOpenActionProcessor.d.ts +1 -2
  98. package/lib/esm/dynamicActionProcessor/file/getFileStreamOpenActionProcessor.js +4 -6
  99. package/lib/esm/dynamicActionProcessor/file/getFileStreamOpenActionProcessor.js.map +1 -1
  100. package/lib/esm/dynamicActionProcessor/file/getFileWriteBinaryContentsActionProcessor.d.ts +1 -2
  101. package/lib/esm/dynamicActionProcessor/file/getFileWriteBinaryContentsActionProcessor.js +4 -6
  102. package/lib/esm/dynamicActionProcessor/file/getFileWriteBinaryContentsActionProcessor.js.map +1 -1
  103. package/lib/esm/dynamicActionProcessor/file/getFileWriteObjectJsonActionProcessor.d.ts +1 -2
  104. package/lib/esm/dynamicActionProcessor/file/getFileWriteObjectJsonActionProcessor.js +4 -6
  105. package/lib/esm/dynamicActionProcessor/file/getFileWriteObjectJsonActionProcessor.js.map +1 -1
  106. package/lib/esm/dynamicActionProcessor/file/getFileWriteTextContentsActionProcessor.d.ts +1 -2
  107. package/lib/esm/dynamicActionProcessor/file/getFileWriteTextContentsActionProcessor.js +4 -6
  108. package/lib/esm/dynamicActionProcessor/file/getFileWriteTextContentsActionProcessor.js.map +1 -1
  109. package/lib/esm/traceStoryExecution/getSystemTraceStoryActionProcessor.js.map +1 -1
  110. package/package.json +11 -9
@@ -1 +1 @@
1
- {"version":3,"file":"getFileReadTextContentsActionProcessor.js","sourceRoot":"","sources":["../../../../src/dynamicActionProcessor/file/getFileReadTextContentsActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,iBAAiB,EACjB,gCAAgC,EAChC,cAAc,EAEd,iCAAiC,GAElC,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,8BAA8B,GAAG,CAAC,SAAoB,EAAE,MAAyB,EAAuC,EAAE;IAC9H,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE;QAC1C,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YAC5E,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACpD,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,gCAAgC,CAAC,KAAK,EAAE;gBAC7C,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,iCAAiC,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC;gBAC9G,MAAM,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,iCAAiC,CAAC,YAAY,EAAE,mBAAmB,QAAQ,EAAE,CAAC,EAAE,eAAe;aAChI,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sCAAsC,GACjD,CAAC,MAAyB,EAA+B,EAAE,CAC3D,KAAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC7D,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,8BAA8B,CAAC,SAAS,EAAE,MAAM,CAAC;CACrF,CAAC,CAAC","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n FileActionType,\n FileReadTextContentsActionProcessor,\n FileReadTextContentsErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport * as fs from 'fs/promises';\n\nimport { FileStorageConfig } from './types';\nimport { resolveFilePath } from './utils';\n\nconst getProcessFileReadTextContents = (qpqConfig: QPQConfig, config: FileStorageConfig): FileReadTextContentsActionProcessor => {\n return async ({ drive, filepath, scope }) => {\n try {\n const fullPath = resolveFilePath(config, qpqConfig, drive, filepath, scope);\n const content = await fs.readFile(fullPath, 'utf8');\n return actionResult(content);\n } catch (error: unknown) {\n return actionResultErrorFromCaughtError(error, {\n InvalidScopeError: (error) => actionResultError(FileReadTextContentsErrorTypeEnum.InvalidScope, error.message),\n ENOENT: () => actionResultError(FileReadTextContentsErrorTypeEnum.FileNotFound, `File not found: ${filepath}`), // node fs code\n });\n }\n };\n};\n\nexport const getFileReadTextContentsActionProcessor =\n (config: FileStorageConfig): ActionProcessorListResolver =>\n async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [FileActionType.ReadTextContents]: getProcessFileReadTextContents(qpqConfig, config),\n });\n"]}
1
+ {"version":3,"file":"getFileReadTextContentsActionProcessor.js","sourceRoot":"","sources":["../../../../src/dynamicActionProcessor/file/getFileReadTextContentsActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,gCAAgC,EAChC,uBAAuB,EACvB,qBAAqB,GAItB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,8BAA8B,GAAG,CAAC,SAAoB,EAAE,MAAyB,EAAgD,EAAE;IACvI,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE;QAC1C,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YAC5E,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACpD,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,gCAAgC,CAAC,KAAK,EAAE;gBAC7C,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,uBAAuB,CAAC,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC;gBAC9G,MAAM,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,uBAAuB,CAAC,SAAS,CAAC,YAAY,EAAE,mBAAmB,QAAQ,EAAE,CAAC,EAAE,eAAe;aAChI,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,MAAyB,EAAE,EAAE,CAClF,qBAAqB,CAAC,uBAAuB,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,8BAA8B,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n askFileReadTextContents,\n createActionProcessor,\n FileActionType,\n ProcessorFor,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport * as fs from 'fs/promises';\n\nimport { FileStorageConfig } from './types';\nimport { resolveFilePath } from './utils';\n\nconst getProcessFileReadTextContents = (qpqConfig: QPQConfig, config: FileStorageConfig): ProcessorFor<typeof askFileReadTextContents> => {\n return async ({ drive, filepath, scope }) => {\n try {\n const fullPath = resolveFilePath(config, qpqConfig, drive, filepath, scope);\n const content = await fs.readFile(fullPath, 'utf8');\n return actionResult(content);\n } catch (error: unknown) {\n return actionResultErrorFromCaughtError(error, {\n InvalidScopeError: (error) => actionResultError(askFileReadTextContents.errorType.InvalidScope, error.message),\n ENOENT: () => actionResultError(askFileReadTextContents.errorType.FileNotFound, `File not found: ${filepath}`), // node fs code\n });\n }\n };\n};\n\nexport const getFileReadTextContentsActionProcessor = (config: FileStorageConfig) =>\n createActionProcessor(askFileReadTextContents, (qpqConfig) => getProcessFileReadTextContents(qpqConfig, config));\n"]}
@@ -1,3 +1,2 @@
1
- import { ActionProcessorListResolver } from 'quidproquo-core';
2
1
  import { FileStorageConfig } from './types';
3
- export declare const getFileStreamOpenActionProcessor: (config: FileStorageConfig) => ActionProcessorListResolver;
2
+ export declare const getFileStreamOpenActionProcessor: (config: FileStorageConfig) => import("quidproquo-core").ActionProcessorListResolver;
@@ -1,4 +1,4 @@
1
- import { actionResult, actionResultError, actionResultErrorFromCaughtError, FileActionType, FileStreamOpenErrorTypeEnum, } from 'quidproquo-core';
1
+ import { actionResult, actionResultError, actionResultErrorFromCaughtError, askFileStreamOpenBase, createActionProcessor, } from 'quidproquo-core';
2
2
  import { randomUUID } from 'crypto';
3
3
  import * as fs from 'fs';
4
4
  import { resolveFilePath } from './utils';
@@ -27,13 +27,11 @@ const getProcessFileStreamOpen = (qpqConfig, config) => {
27
27
  }
28
28
  catch (error) {
29
29
  return actionResultErrorFromCaughtError(error, {
30
- InvalidScopeError: (error) => actionResultError(FileStreamOpenErrorTypeEnum.InvalidScope, error.message),
31
- ENOENT: () => actionResultError(FileStreamOpenErrorTypeEnum.FileNotFound, `File not found: ${filepath}`), // node fs code
30
+ InvalidScopeError: (error) => actionResultError(askFileStreamOpenBase.errorType.InvalidScope, error.message),
31
+ ENOENT: () => actionResultError(askFileStreamOpenBase.errorType.FileNotFound, `File not found: ${filepath}`), // node fs code
32
32
  });
33
33
  }
34
34
  };
35
35
  };
36
- export const getFileStreamOpenActionProcessor = (config) => async (qpqConfig) => ({
37
- [FileActionType.StreamOpen]: getProcessFileStreamOpen(qpqConfig, config),
38
- });
36
+ export const getFileStreamOpenActionProcessor = (config) => createActionProcessor(askFileStreamOpenBase, (qpqConfig) => getProcessFileStreamOpen(qpqConfig, config));
39
37
  //# sourceMappingURL=getFileStreamOpenActionProcessor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getFileStreamOpenActionProcessor.js","sourceRoot":"","sources":["../../../../src/dynamicActionProcessor/file/getFileStreamOpenActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,iBAAiB,EACjB,gCAAgC,EAChC,cAAc,EAEd,2BAA2B,GAE5B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI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E,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC;YACnH,MAAM,QAAQ,GAAG,QAAQ,UAAU,EAAE,EAAE,CAAC;YAExC,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;YAC5F,cAAc,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAE5C,OAAO,YAAY,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,gCAAgC,CAAC,KAAK,EAAE;gBAC7C,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,2BAA2B,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC;gBACxG,MAAM,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,2BAA2B,CAAC,YAAY,EAAE,mBAAmB,QAAQ,EAAE,CAAC,EAAE,eAAe;aAC1H,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAC3C,CAAC,MAAyB,EAA+B,EAAE,CAC3D,KAAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC7D,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE,wBAAwB,CAAC,SAAS,EAAE,MAAM,CAAC;CACzE,CAAC,CAAC","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n FileActionType,\n FileStreamOpenActionProcessor,\n FileStreamOpenErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport { randomUUID } from 'crypto';\nimport * as fs from 'fs';\nimport { Readable } from 'stream';\n\nimport { FileStorageConfig } from './types';\nimport { resolveFilePath } from './utils';\n\nasync function* textStreamIterator(stream: Readable): AsyncIterableIterator<string> {\n for await (const chunk of stream) {\n yield typeof chunk === 'string' ? chunk : (chunk as Buffer).toString('utf8');\n }\n}\n\nasync function* binaryStreamIterator(stream: Readable): AsyncIterableIterator<string> {\n for await (const chunk of stream) {\n const buffer = typeof chunk === 'string' ? Buffer.from(chunk) : (chunk as Buffer);\n yield buffer.toString('base64');\n }\n}\n\nconst getProcessFileStreamOpen = (qpqConfig: QPQConfig, config: FileStorageConfig): FileStreamOpenActionProcessor => {\n return async (\n { drive, filepath, encoding, chunkSize, scope },\n session,\n actionProcessors,\n logger,\n updateSession,\n dynamicModuleLoader,\n streamRegistry,\n ) => {\n try {\n const fullPath = resolveFilePath(config, qpqConfig, drive, filepath, scope);\n const isText = encoding === 'text';\n const highWaterMark = chunkSize ?? 65536;\n const readStream = fs.createReadStream(fullPath, isText ? { encoding: 'utf8', highWaterMark } : { highWaterMark });\n const streamId = `file-${randomUUID()}`;\n\n const iterator = isText ? textStreamIterator(readStream) : binaryStreamIterator(readStream);\n streamRegistry.register(streamId, iterator);\n\n return actionResult({ id: streamId, encoding });\n } catch (error: unknown) {\n return actionResultErrorFromCaughtError(error, {\n InvalidScopeError: (error) => actionResultError(FileStreamOpenErrorTypeEnum.InvalidScope, error.message),\n ENOENT: () => actionResultError(FileStreamOpenErrorTypeEnum.FileNotFound, `File not found: ${filepath}`), // node fs code\n });\n }\n };\n};\n\nexport const getFileStreamOpenActionProcessor =\n (config: FileStorageConfig): ActionProcessorListResolver =>\n async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [FileActionType.StreamOpen]: getProcessFileStreamOpen(qpqConfig, config),\n });\n"]}
1
+ {"version":3,"file":"getFileStreamOpenActionProcessor.js","sourceRoot":"","sources":["../../../../src/dynamicActionProcessor/file/getFileStreamOpenActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,gCAAgC,EAChC,qBA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AC;YACzC,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC;YACnH,MAAM,QAAQ,GAAG,QAAQ,UAAU,EAAE,EAAE,CAAC;YAExC,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;YAC5F,cAAc,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAE5C,OAAO,YAAY,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,gCAAgC,CAAC,KAAK,EAAE;gBAC7C,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC;gBAC5G,MAAM,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,SAAS,CAAC,YAAY,EAAE,mBAAmB,QAAQ,EAAE,CAAC,EAAE,eAAe;aAC9H,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,MAAyB,EAAE,EAAE,CAC5E,qBAAqB,CAAC,qBAAqB,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,wBAAwB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n askFileStreamOpenBase,\n createActionProcessor,\n FileActionType,\n ProcessorFor,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport { randomUUID } from 'crypto';\nimport * as fs from 'fs';\nimport { Readable } from 'stream';\n\nimport { FileStorageConfig } from './types';\nimport { resolveFilePath } from './utils';\n\nasync function* textStreamIterator(stream: Readable): AsyncIterableIterator<string> {\n for await (const chunk of stream) {\n yield typeof chunk === 'string' ? chunk : (chunk as Buffer).toString('utf8');\n }\n}\n\nasync function* binaryStreamIterator(stream: Readable): AsyncIterableIterator<string> {\n for await (const chunk of stream) {\n const buffer = typeof chunk === 'string' ? Buffer.from(chunk) : (chunk as Buffer);\n yield buffer.toString('base64');\n }\n}\n\nconst getProcessFileStreamOpen = (qpqConfig: QPQConfig, config: FileStorageConfig): ProcessorFor<typeof askFileStreamOpenBase> => {\n return async (\n { drive, filepath, encoding, chunkSize, scope },\n session,\n actionProcessors,\n logger,\n updateSession,\n dynamicModuleLoader,\n streamRegistry,\n ) => {\n try {\n const fullPath = resolveFilePath(config, qpqConfig, drive, filepath, scope);\n const isText = encoding === 'text';\n const highWaterMark = chunkSize ?? 65536;\n const readStream = fs.createReadStream(fullPath, isText ? { encoding: 'utf8', highWaterMark } : { highWaterMark });\n const streamId = `file-${randomUUID()}`;\n\n const iterator = isText ? textStreamIterator(readStream) : binaryStreamIterator(readStream);\n streamRegistry.register(streamId, iterator);\n\n return actionResult({ id: streamId, encoding });\n } catch (error: unknown) {\n return actionResultErrorFromCaughtError(error, {\n InvalidScopeError: (error) => actionResultError(askFileStreamOpenBase.errorType.InvalidScope, error.message),\n ENOENT: () => actionResultError(askFileStreamOpenBase.errorType.FileNotFound, `File not found: ${filepath}`), // node fs code\n });\n }\n };\n};\n\nexport const getFileStreamOpenActionProcessor = (config: FileStorageConfig) =>\n createActionProcessor(askFileStreamOpenBase, (qpqConfig) => getProcessFileStreamOpen(qpqConfig, config));\n"]}
@@ -1,3 +1,2 @@
1
- import { ActionProcessorListResolver } from 'quidproquo-core';
2
1
  import { FileStorageConfig } from './types';
3
- export declare const getFileWriteBinaryContentsActionProcessor: (config: FileStorageConfig) => ActionProcessorListResolver;
2
+ export declare const getFileWriteBinaryContentsActionProcessor: (config: FileStorageConfig) => import("quidproquo-core").ActionProcessorListResolver;
@@ -1,4 +1,4 @@
1
- import { actionResult, actionResultError, actionResultErrorFromCaughtError, FileActionType, FileWriteBinaryContentsErrorTypeEnum, } from 'quidproquo-core';
1
+ import { actionResult, actionResultError, actionResultErrorFromCaughtError, askFileWriteBinaryContents, createActionProcessor, } from 'quidproquo-core';
2
2
  import * as fs from 'fs/promises';
3
3
  import { ensureParentDirectoryExists, resolveFilePath } from './utils';
4
4
  const getProcessFileWriteBinaryContents = (config) => (qpqConfig) => {
@@ -19,13 +19,11 @@ const getProcessFileWriteBinaryContents = (config) => (qpqConfig) => {
19
19
  }
20
20
  catch (error) {
21
21
  return actionResultErrorFromCaughtError(error, {
22
- InvalidScopeError: (error) => actionResultError(FileWriteBinaryContentsErrorTypeEnum.InvalidScope, error.message),
23
- EACCES: () => actionResultError(FileWriteBinaryContentsErrorTypeEnum.AccessDenied, `Access denied writing file: ${filepath}`), // node fs code
22
+ InvalidScopeError: (error) => actionResultError(askFileWriteBinaryContents.errorType.InvalidScope, error.message),
23
+ EACCES: () => actionResultError(askFileWriteBinaryContents.errorType.AccessDenied, `Access denied writing file: ${filepath}`), // node fs code
24
24
  });
25
25
  }
26
26
  };
27
27
  };
28
- export const getFileWriteBinaryContentsActionProcessor = (config) => async (qpqConfig) => ({
29
- [FileActionType.WriteBinaryContents]: getProcessFileWriteBinaryContents(config)(qpqConfig),
30
- });
28
+ export const getFileWriteBinaryContentsActionProcessor = (config) => createActionProcessor(askFileWriteBinaryContents, (qpqConfig) => getProcessFileWriteBinaryContents(config)(qpqConfig));
31
29
  //# sourceMappingURL=getFileWriteBinaryContentsActionProcessor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getFileWriteBinaryContentsActionProcessor.js","sourceRoot":"","sources":["../../../../src/dynamicActionProcessor/file/getFileWriteBinaryContentsActionProcessor.ts"],"names":[],"mappings":"AAAA,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K,CAAC,OAAO,CAAC;gBACjH,MAAM,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,oCAAoC,CAAC,YAAY,EAAE,+BAA+B,QAAQ,EAAE,CAAC,EAAE,eAAe;aAC/I,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,yCAAyC,GACpD,CAAC,MAAyB,EAA+B,EAAE,CAC3D,KAAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC7D,CAAC,cAAc,CAAC,mBAAmB,CAAC,EAAE,iCAAiC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC;CAC3F,CAAC,CAAC","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n FileActionType,\n FileWriteBinaryContentsActionProcessor,\n FileWriteBinaryContentsErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport * as fs from 'fs/promises';\n\nimport { FileStorageConfig } from './types';\nimport { ensureParentDirectoryExists, resolveFilePath } from './utils';\n\nconst getProcessFileWriteBinaryContents =\n (config: FileStorageConfig) =>\n (qpqConfig: QPQConfig): FileWriteBinaryContentsActionProcessor => {\n return async ({ drive, filepath, data, scope }) => {\n try {\n const fullPath = resolveFilePath(config, qpqConfig, drive, filepath, scope);\n await ensureParentDirectoryExists(fullPath);\n\n // Convert QPQBinaryData to Buffer\n const buffer = Buffer.from(data.base64Data, 'base64');\n await fs.writeFile(fullPath, buffer);\n\n if (data.mimetype || data.contentDisposition) {\n await fs.writeFile(\n `${fullPath}.qpqmeta.json`,\n JSON.stringify({\n mimetype: data.mimetype,\n contentDisposition: data.contentDisposition,\n }),\n );\n }\n\n return actionResult(void 0);\n } catch (error: unknown) {\n return actionResultErrorFromCaughtError(error, {\n InvalidScopeError: (error) => actionResultError(FileWriteBinaryContentsErrorTypeEnum.InvalidScope, error.message),\n EACCES: () => actionResultError(FileWriteBinaryContentsErrorTypeEnum.AccessDenied, `Access denied writing file: ${filepath}`), // node fs code\n });\n }\n };\n };\n\nexport const getFileWriteBinaryContentsActionProcessor =\n (config: FileStorageConfig): ActionProcessorListResolver =>\n async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [FileActionType.WriteBinaryContents]: getProcessFileWriteBinaryContents(config)(qpqConfig),\n });\n"]}
1
+ {"version":3,"file":"getFileWriteBinaryContentsActionProcessor.js","sourceRoot":"","sources":["../../../../src/dynamicActionProcessor/file/getFileWriteBinaryContentsActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,gCAAgC,EAChC,0BAA0B,EAC1B,qBAAqB,GAItB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,iCAAiC,GACrC,CAAC,MAAyB,EAAE,EAAE,CAC9B,CAAC,SAAoB,EAAmD,EAAE;IACxE,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;QAChD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YAC5E,MAAM,2BAA2B,CAAC,QAAQ,CAAC,CAAC;YAE5C,kCAAkC;YAClC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YACtD,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAErC,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBAC7C,MAAM,EAAE,CAAC,SAAS,CAChB,GAAG,QAAQ,eAAe,EAC1B,IAAI,CAAC,SAAS,CAAC;oBACb,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;iBAC5C,CAAC,CACH,CAAC;YACJ,CAAC;YAED,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,gCAAgC,CAAC,KAAK,EAAE;gBAC7C,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC;gBACjH,MAAM,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,SAAS,CAAC,YAAY,EAAE,+BAA+B,QAAQ,EAAE,CAAC,EAAE,eAAe;aAC/I,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAC,MAAyB,EAAE,EAAE,CACrF,qBAAqB,CAAC,0BAA0B,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,iCAAiC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n askFileWriteBinaryContents,\n createActionProcessor,\n FileActionType,\n ProcessorFor,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport * as fs from 'fs/promises';\n\nimport { FileStorageConfig } from './types';\nimport { ensureParentDirectoryExists, resolveFilePath } from './utils';\n\nconst getProcessFileWriteBinaryContents =\n (config: FileStorageConfig) =>\n (qpqConfig: QPQConfig): ProcessorFor<typeof askFileWriteBinaryContents> => {\n return async ({ drive, filepath, data, scope }) => {\n try {\n const fullPath = resolveFilePath(config, qpqConfig, drive, filepath, scope);\n await ensureParentDirectoryExists(fullPath);\n\n // Convert QPQBinaryData to Buffer\n const buffer = Buffer.from(data.base64Data, 'base64');\n await fs.writeFile(fullPath, buffer);\n\n if (data.mimetype || data.contentDisposition) {\n await fs.writeFile(\n `${fullPath}.qpqmeta.json`,\n JSON.stringify({\n mimetype: data.mimetype,\n contentDisposition: data.contentDisposition,\n }),\n );\n }\n\n return actionResult(void 0);\n } catch (error: unknown) {\n return actionResultErrorFromCaughtError(error, {\n InvalidScopeError: (error) => actionResultError(askFileWriteBinaryContents.errorType.InvalidScope, error.message),\n EACCES: () => actionResultError(askFileWriteBinaryContents.errorType.AccessDenied, `Access denied writing file: ${filepath}`), // node fs code\n });\n }\n };\n };\n\nexport const getFileWriteBinaryContentsActionProcessor = (config: FileStorageConfig) =>\n createActionProcessor(askFileWriteBinaryContents, (qpqConfig) => getProcessFileWriteBinaryContents(config)(qpqConfig));\n"]}
@@ -1,3 +1,2 @@
1
- import { ActionProcessorListResolver } from 'quidproquo-core';
2
1
  import { FileStorageConfig } from './types';
3
- export declare const getFileWriteObjectJsonActionProcessor: (config: FileStorageConfig) => ActionProcessorListResolver;
2
+ export declare const getFileWriteObjectJsonActionProcessor: (config: FileStorageConfig) => import("quidproquo-core").ActionProcessorListResolver;
@@ -1,4 +1,4 @@
1
- import { actionResult, actionResultError, actionResultErrorFromCaughtError, FileActionType, FileWriteObjectJsonErrorTypeEnum, } from 'quidproquo-core';
1
+ import { actionResult, actionResultError, actionResultErrorFromCaughtError, askFileWriteObjectJsonBase, createActionProcessor, } from 'quidproquo-core';
2
2
  import * as fs from 'fs/promises';
3
3
  import { ensureParentDirectoryExists, resolveFilePath } from './utils';
4
4
  const getProcessFileWriteObjectJson = (config) => (qpqConfig) => {
@@ -12,13 +12,11 @@ const getProcessFileWriteObjectJson = (config) => (qpqConfig) => {
12
12
  }
13
13
  catch (error) {
14
14
  return actionResultErrorFromCaughtError(error, {
15
- InvalidScopeError: (error) => actionResultError(FileWriteObjectJsonErrorTypeEnum.InvalidScope, error.message),
16
- EACCES: () => actionResultError(FileWriteObjectJsonErrorTypeEnum.AccessDenied, `Access denied writing file: ${filepath}`), // node fs code
15
+ InvalidScopeError: (error) => actionResultError(askFileWriteObjectJsonBase.errorType.InvalidScope, error.message),
16
+ EACCES: () => actionResultError(askFileWriteObjectJsonBase.errorType.AccessDenied, `Access denied writing file: ${filepath}`), // node fs code
17
17
  });
18
18
  }
19
19
  };
20
20
  };
21
- export const getFileWriteObjectJsonActionProcessor = (config) => async (qpqConfig) => ({
22
- [FileActionType.WriteObjectJson]: getProcessFileWriteObjectJson(config)(qpqConfig),
23
- });
21
+ export const getFileWriteObjectJsonActionProcessor = (config) => createActionProcessor(askFileWriteObjectJsonBase, (qpqConfig) => getProcessFileWriteObjectJson(config)(qpqConfig));
24
22
  //# sourceMappingURL=getFileWriteObjectJsonActionProcessor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getFileWriteObjectJsonActionProcessor.js","sourceRoot":"","sources":["../../../../src/dynamicActionProcessor/file/getFileWriteObjectJsonActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,iBAAiB,EACjB,gCAAgC,EAChC,cAAc,EAEd,gCAAgC,GAEjC,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,6BAA6B,GACjC,CAAC,MAAyB,EAAE,EAAE,CAC9B,CAAC,SAAoB,EAA2C,EAAE;IAChE,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;QAChD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YAC5E,MAAM,2BAA2B,CAAC,QAAQ,CAAC,CAAC;YAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YACjD,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;YACjD,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,gCAAgC,CAAC,KAAK,EAAE;gBAC7C,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,gCAAgC,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC;gBAC7G,MAAM,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,gCAAgC,CAAC,YAAY,EAAE,+BAA+B,QAAQ,EAAE,CAAC,EAAE,eAAe;aAC3I,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,qCAAqC,GAChD,CAAC,MAAyB,EAA+B,EAAE,CAC3D,KAAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC7D,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,6BAA6B,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC;CACnF,CAAC,CAAC","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n FileActionType,\n FileWriteObjectJsonActionProcessor,\n FileWriteObjectJsonErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport * as fs from 'fs/promises';\n\nimport { FileStorageConfig } from './types';\nimport { ensureParentDirectoryExists, resolveFilePath } from './utils';\n\nconst getProcessFileWriteObjectJson =\n (config: FileStorageConfig) =>\n (qpqConfig: QPQConfig): FileWriteObjectJsonActionProcessor<any> => {\n return async ({ drive, filepath, data, scope }) => {\n try {\n const fullPath = resolveFilePath(config, qpqConfig, drive, filepath, scope);\n await ensureParentDirectoryExists(fullPath);\n const jsonString = JSON.stringify(data, null, 2);\n await fs.writeFile(fullPath, jsonString, 'utf8');\n return actionResult(void 0);\n } catch (error: unknown) {\n return actionResultErrorFromCaughtError(error, {\n InvalidScopeError: (error) => actionResultError(FileWriteObjectJsonErrorTypeEnum.InvalidScope, error.message),\n EACCES: () => actionResultError(FileWriteObjectJsonErrorTypeEnum.AccessDenied, `Access denied writing file: ${filepath}`), // node fs code\n });\n }\n };\n };\n\nexport const getFileWriteObjectJsonActionProcessor =\n (config: FileStorageConfig): ActionProcessorListResolver =>\n async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [FileActionType.WriteObjectJson]: getProcessFileWriteObjectJson(config)(qpqConfig),\n });\n"]}
1
+ {"version":3,"file":"getFileWriteObjectJsonActionProcessor.js","sourceRoot":"","sources":["../../../../src/dynamicActionProcessor/file/getFileWriteObjectJsonActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,gCAAgC,EAChC,0BAA0B,EAC1B,qBAAqB,GAItB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,6BAA6B,GACjC,CAAC,MAAyB,EAAE,EAAE,CAC9B,CAAC,SAAoB,EAAmD,EAAE;IACxE,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;QAChD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YAC5E,MAAM,2BAA2B,CAAC,QAAQ,CAAC,CAAC;YAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YACjD,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;YACjD,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,gCAAgC,CAAC,KAAK,EAAE;gBAC7C,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC;gBACjH,MAAM,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,SAAS,CAAC,YAAY,EAAE,+BAA+B,QAAQ,EAAE,CAAC,EAAE,eAAe;aAC/I,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,MAAyB,EAAE,EAAE,CACjF,qBAAqB,CAAC,0BAA0B,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,6BAA6B,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n askFileWriteObjectJsonBase,\n createActionProcessor,\n FileActionType,\n ProcessorFor,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport * as fs from 'fs/promises';\n\nimport { FileStorageConfig } from './types';\nimport { ensureParentDirectoryExists, resolveFilePath } from './utils';\n\nconst getProcessFileWriteObjectJson =\n (config: FileStorageConfig) =>\n (qpqConfig: QPQConfig): ProcessorFor<typeof askFileWriteObjectJsonBase> => {\n return async ({ drive, filepath, data, scope }) => {\n try {\n const fullPath = resolveFilePath(config, qpqConfig, drive, filepath, scope);\n await ensureParentDirectoryExists(fullPath);\n const jsonString = JSON.stringify(data, null, 2);\n await fs.writeFile(fullPath, jsonString, 'utf8');\n return actionResult(void 0);\n } catch (error: unknown) {\n return actionResultErrorFromCaughtError(error, {\n InvalidScopeError: (error) => actionResultError(askFileWriteObjectJsonBase.errorType.InvalidScope, error.message),\n EACCES: () => actionResultError(askFileWriteObjectJsonBase.errorType.AccessDenied, `Access denied writing file: ${filepath}`), // node fs code\n });\n }\n };\n };\n\nexport const getFileWriteObjectJsonActionProcessor = (config: FileStorageConfig) =>\n createActionProcessor(askFileWriteObjectJsonBase, (qpqConfig) => getProcessFileWriteObjectJson(config)(qpqConfig));\n"]}
@@ -1,3 +1,2 @@
1
- import { ActionProcessorListResolver } from 'quidproquo-core';
2
1
  import { FileStorageConfig } from './types';
3
- export declare const getFileWriteTextContentsActionProcessor: (config: FileStorageConfig) => ActionProcessorListResolver;
2
+ export declare const getFileWriteTextContentsActionProcessor: (config: FileStorageConfig) => import("quidproquo-core").ActionProcessorListResolver;
@@ -1,4 +1,4 @@
1
- import { actionResult, actionResultError, actionResultErrorFromCaughtError, FileActionType, FileWriteTextContentsErrorTypeEnum, } from 'quidproquo-core';
1
+ import { actionResult, actionResultError, actionResultErrorFromCaughtError, askFileWriteTextContents, createActionProcessor, } from 'quidproquo-core';
2
2
  import * as fs from 'fs/promises';
3
3
  import { ensureParentDirectoryExists, resolveFilePath } from './utils';
4
4
  const getProcessFileWriteTextContents = (qpqConfig, config) => {
@@ -11,13 +11,11 @@ const getProcessFileWriteTextContents = (qpqConfig, config) => {
11
11
  }
12
12
  catch (error) {
13
13
  return actionResultErrorFromCaughtError(error, {
14
- InvalidScopeError: (error) => actionResultError(FileWriteTextContentsErrorTypeEnum.InvalidScope, error.message),
15
- EACCES: () => actionResultError(FileWriteTextContentsErrorTypeEnum.AccessDenied, `Access denied writing file: ${filepath}`), // node fs code
14
+ InvalidScopeError: (error) => actionResultError(askFileWriteTextContents.errorType.InvalidScope, error.message),
15
+ EACCES: () => actionResultError(askFileWriteTextContents.errorType.AccessDenied, `Access denied writing file: ${filepath}`), // node fs code
16
16
  });
17
17
  }
18
18
  };
19
19
  };
20
- export const getFileWriteTextContentsActionProcessor = (config) => async (qpqConfig) => ({
21
- [FileActionType.WriteTextContents]: getProcessFileWriteTextContents(qpqConfig, config),
22
- });
20
+ export const getFileWriteTextContentsActionProcessor = (config) => createActionProcessor(askFileWriteTextContents, (qpqConfig) => getProcessFileWriteTextContents(qpqConfig, config));
23
21
  //# sourceMappingURL=getFileWriteTextContentsActionProcessor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getFileWriteTextContentsActionProcessor.js","sourceRoot":"","sources":["../../../../src/dynamicActionProcessor/file/getFileWriteTextContentsActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,iBAAiB,EACjB,gCAAgC,EAChC,cAAc,EAEd,kCAAkC,GAEnC,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,+BAA+B,GAAG,CAAC,SAAoB,EAAE,MAAyB,EAAwC,EAAE;IAChI,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;QAChD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YAC5E,MAAM,2BAA2B,CAAC,QAAQ,CAAC,CAAC;YAC5C,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;YAC3C,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,gCAAgC,CAAC,KAAK,EAAE;gBAC7C,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,kCAAkC,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC;gBAC/G,MAAM,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,kCAAkC,CAAC,YAAY,EAAE,+BAA+B,QAAQ,EAAE,CAAC,EAAE,eAAe;aAC7I,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uCAAuC,GAClD,CAAC,MAAyB,EAA+B,EAAE,CAC3D,KAAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC7D,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,+BAA+B,CAAC,SAAS,EAAE,MAAM,CAAC;CACvF,CAAC,CAAC","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n FileActionType,\n FileWriteTextContentsActionProcessor,\n FileWriteTextContentsErrorTypeEnum,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport * as fs from 'fs/promises';\n\nimport { FileStorageConfig } from './types';\nimport { ensureParentDirectoryExists, resolveFilePath } from './utils';\n\nconst getProcessFileWriteTextContents = (qpqConfig: QPQConfig, config: FileStorageConfig): FileWriteTextContentsActionProcessor => {\n return async ({ drive, filepath, data, scope }) => {\n try {\n const fullPath = resolveFilePath(config, qpqConfig, drive, filepath, scope);\n await ensureParentDirectoryExists(fullPath);\n await fs.writeFile(fullPath, data, 'utf8');\n return actionResult(void 0);\n } catch (error: unknown) {\n return actionResultErrorFromCaughtError(error, {\n InvalidScopeError: (error) => actionResultError(FileWriteTextContentsErrorTypeEnum.InvalidScope, error.message),\n EACCES: () => actionResultError(FileWriteTextContentsErrorTypeEnum.AccessDenied, `Access denied writing file: ${filepath}`), // node fs code\n });\n }\n };\n};\n\nexport const getFileWriteTextContentsActionProcessor =\n (config: FileStorageConfig): ActionProcessorListResolver =>\n async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [FileActionType.WriteTextContents]: getProcessFileWriteTextContents(qpqConfig, config),\n });\n"]}
1
+ {"version":3,"file":"getFileWriteTextContentsAction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nF,qBAAqB,CAAC,wBAAwB,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,+BAA+B,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import {\n actionResult,\n actionResultError,\n actionResultErrorFromCaughtError,\n askFileWriteTextContents,\n createActionProcessor,\n FileActionType,\n ProcessorFor,\n QPQConfig,\n} from 'quidproquo-core';\n\nimport * as fs from 'fs/promises';\n\nimport { FileStorageConfig } from './types';\nimport { ensureParentDirectoryExists, resolveFilePath } from './utils';\n\nconst getProcessFileWriteTextContents = (qpqConfig: QPQConfig, config: FileStorageConfig): ProcessorFor<typeof askFileWriteTextContents> => {\n return async ({ drive, filepath, data, scope }) => {\n try {\n const fullPath = resolveFilePath(config, qpqConfig, drive, filepath, scope);\n await ensureParentDirectoryExists(fullPath);\n await fs.writeFile(fullPath, data, 'utf8');\n return actionResult(void 0);\n } catch (error: unknown) {\n return actionResultErrorFromCaughtError(error, {\n InvalidScopeError: (error) => actionResultError(askFileWriteTextContents.errorType.InvalidScope, error.message),\n EACCES: () => actionResultError(askFileWriteTextContents.errorType.AccessDenied, `Access denied writing file: ${filepath}`), // node fs code\n });\n }\n };\n};\n\nexport const getFileWriteTextContentsActionProcessor = (config: FileStorageConfig) =>\n createActionProcessor(askFileWriteTextContents, (qpqConfig) => getProcessFileWriteTextContents(qpqConfig, config));\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getSystemTraceStoryActionProcessor.js","sourceRoot":"","sources":["../../../src/traceStoryExecution/getSystemTraceStoryActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,iBAAiB,EAEjB,aAAa,EAMb,gBAAgB,GAGjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAS5D,qFAAqF;AACrF,wFAAwF;AACxF,yFAAyF;AACzF,yFAAyF;AACzF,MAAM,oBAAoB,GAAG,CAC3B,SAAoB,EACpB,qB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AAK,EAAE,SAAoB,EAAgC,EAAE,CAAC,CAAC;IAC7D,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,oBAAoB,CAAC,SAAS,EAAE,qBAAqB,EAAE,qBAAqB,CAAC;CAC7G,CAAC,CAAC","sourcesContent":["import {\n ActionProcessorList,\n ActionProcessorListResolver,\n actionResult,\n actionResultError,\n DynamicModuleLoader,\n ErrorTypeEnum,\n QPQConfig,\n QpqFunctionRuntime,\n QpqLogger,\n StorySession,\n StorySessionUpdater,\n SystemActionType,\n SystemTraceStoryActionPayload,\n SystemTraceStoryActionProcessor,\n} from 'quidproquo-core';\n\nimport { traceStoryExecution } from './traceStoryExecution';\n\n// Resolves extra own-code markers (see resolveSourceMaps.filterOwnCodeLocations) for the\n// story being traced. Opt-in: lambda's federated remotes stay on the plain \"not\n// node_modules\" heuristic that already works for them; hosts whose bundle layout defeats\n// that heuristic (the dev server bundles every hosted service plus the whole framework\n// into one script) pass a resolver to narrow onlyOwnCode to the traced service.\nexport type OwnCodeMarkersResolver = (qpqFunctionRuntimeInfo: QpqFunctionRuntime | undefined, qpqConfig: QPQConfig) => string[] | undefined;\n\n// Shared System::TraceStory processor for node runtimes (lambda and the dev server).\n// Loads the recorded story's real code through the runtime's dynamicModuleLoader (which\n// federates on lambda), then replays it under the tracer. defaultScriptPatterns lets the\n// host add environment-specific scripts to trace (e.g. the lambda federated code cache).\nconst getProcessTraceStory = (\n qpqConfig: QPQConfig,\n defaultScriptPatterns: string[],\n resolveOwnCodeMarkers?: OwnCodeMarkersResolver,\n): SystemTraceStoryActionProcessor => {\n return async (\n payload: SystemTraceStoryActionPayload,\n session: StorySession,\n actionProcessors: ActionProcessorList,\n logger: QpqLogger,\n updateSession: StorySessionUpdater,\n dynamicModuleLoader: DynamicModuleLoader,\n ) => {\n const { storyResult, scriptPatterns, onlyOwnCode } = payload;\n\n if (!storyResult.qpqFunctionRuntimeInfo) {\n return actionResultError(\n ErrorTypeEnum.BadRequest,\n `Story [${storyResult.correlation}] has no qpqFunctionRuntimeInfo - cannot locate its code to trace`,\n );\n }\n\n const story = await dynamicModuleLoader(storyResult.qpqFunctionRuntimeInfo);\n if (!story) {\n return actionResultError(ErrorTypeEnum.NotFound, `Unable to dynamically load story for [${storyResult.correlation}]`);\n }\n\n try {\n const { trace } = await traceStoryExecution(storyResult, story, {\n scriptPatterns: [...defaultScriptPatterns, ...(scriptPatterns || [])],\n onlyOwnCode,\n ownCodeMarkers: resolveOwnCodeMarkers?.(storyResult.qpqFunctionRuntimeInfo, qpqConfig),\n });\n\n return actionResult(trace);\n } catch (error) {\n return actionResultError(ErrorTypeEnum.GenericError, `Trace failed for [${storyResult.correlation}]: ${(error as Error).message}`);\n }\n };\n};\n\nexport const getSystemTraceStoryActionProcessor =\n (defaultScriptPatterns: string[] = [], resolveOwnCodeMarkers?: OwnCodeMarkersResolver): ActionProcessorListResolver =>\n async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [SystemActionType.TraceStory]: getProcessTraceStory(qpqConfig, defaultScriptPatterns, resolveOwnCodeMarkers),\n });\n"]}
1
+ {"version":3,"file":"getSystemTraceStoryActionProcessor.js","sourceRoot":"","sources":["../../../src/traceStoryExecution/getSystemTraceStoryActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EACZ,iBAAiB,EAIjB,aAAa,EAOb,gBAAgB,GAEjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAS5D,qFAAqF;AACrF,wFAAwF;AACxF,yFAAyF;AACzF,yFAAyF;AACzF,MAAM,oBAAoB,GAAG,CAC3B,SAAoB,EACpB,qBAA+B,EAC/B,qBAA8C,EACV,EAAE;IACtC,OAAO,KAAK,EACV,OAAsC,EACtC,OAAqB,EACrB,gBAAqC,EACrC,MAAiB,EACjB,aAAkC,EAClC,mBAAwC,EACxC,EAAE;QACF,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EA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ActionProcessorListResolver,\n actionResult,\n actionResultError,\n askTraceStory,\n createActionProcessor,\n DynamicModuleLoader,\n ErrorTypeEnum,\n ProcessorFor,\n QPQConfig,\n QpqFunctionRuntime,\n QpqLogger,\n StorySession,\n StorySessionUpdater,\n SystemActionType,\n SystemTraceStoryActionPayload,\n} from 'quidproquo-core';\n\nimport { traceStoryExecution } from './traceStoryExecution';\n\n// Resolves extra own-code markers (see resolveSourceMaps.filterOwnCodeLocations) for the\n// story being traced. Opt-in: lambda's federated remotes stay on the plain \"not\n// node_modules\" heuristic that already works for them; hosts whose bundle layout defeats\n// that heuristic (the dev server bundles every hosted service plus the whole framework\n// into one script) pass a resolver to narrow onlyOwnCode to the traced service.\nexport type OwnCodeMarkersResolver = (qpqFunctionRuntimeInfo: QpqFunctionRuntime | undefined, qpqConfig: QPQConfig) => string[] | undefined;\n\n// Shared System::TraceStory processor for node runtimes (lambda and the dev server).\n// Loads the recorded story's real code through the runtime's dynamicModuleLoader (which\n// federates on lambda), then replays it under the tracer. defaultScriptPatterns lets the\n// host add environment-specific scripts to trace (e.g. the lambda federated code cache).\nconst getProcessTraceStory = (\n qpqConfig: QPQConfig,\n defaultScriptPatterns: string[],\n resolveOwnCodeMarkers?: OwnCodeMarkersResolver,\n): ProcessorFor<typeof askTraceStory> => {\n return async (\n payload: SystemTraceStoryActionPayload,\n session: StorySession,\n actionProcessors: ActionProcessorList,\n logger: QpqLogger,\n updateSession: StorySessionUpdater,\n dynamicModuleLoader: DynamicModuleLoader,\n ) => {\n const { storyResult, scriptPatterns, onlyOwnCode } = payload;\n\n if (!storyResult.qpqFunctionRuntimeInfo) {\n return actionResultError(\n ErrorTypeEnum.BadRequest,\n `Story [${storyResult.correlation}] has no qpqFunctionRuntimeInfo - cannot locate its code to trace`,\n );\n }\n\n const story = await dynamicModuleLoader(storyResult.qpqFunctionRuntimeInfo);\n if (!story) {\n return actionResultError(ErrorTypeEnum.NotFound, `Unable to dynamically load story for [${storyResult.correlation}]`);\n }\n\n try {\n const { trace } = await traceStoryExecution(storyResult, story, {\n scriptPatterns: [...defaultScriptPatterns, ...(scriptPatterns || [])],\n onlyOwnCode,\n ownCodeMarkers: resolveOwnCodeMarkers?.(storyResult.qpqFunctionRuntimeInfo, qpqConfig),\n });\n\n return actionResult(trace);\n } catch (error) {\n return actionResultError(ErrorTypeEnum.GenericError, `Trace failed for [${storyResult.correlation}]: ${(error as Error).message}`);\n }\n };\n};\n\nexport const getSystemTraceStoryActionProcessor =\n (defaultScriptPatterns: string[] = [], resolveOwnCodeMarkers?: OwnCodeMarkersResolver): ActionProcessorListResolver =>\n async (qpqConfig: QPQConfig): Promise<ActionProcessorList> => ({\n [SystemActionType.TraceStory]: getProcessTraceStory(qpqConfig, defaultScriptPatterns, resolveOwnCodeMarkers),\n });\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-actionprocessor-node",
3
- "version": "0.1.15",
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": "echo \"Error: no test specified\" && exit 1",
14
17
  "clean": "npx rimraf lib && npx rimraf node_modules",
@@ -22,27 +25,26 @@
22
25
  },
23
26
  "repository": {
24
27
  "type": "git",
25
- "url": "git+https://github.com/joe-coady/quidproquo.git"
28
+ "url": "git+https://github.com/qpqjs/quidproquo.git"
26
29
  },
27
30
  "keywords": [],
28
31
  "author": "",
29
32
  "license": "MIT",
30
33
  "bugs": {
31
- "url": "https://github.com/joe-coady/quidproquo/issues"
34
+ "url": "https://github.com/qpqjs/quidproquo/issues"
32
35
  },
33
- "homepage": "https://github.com/joe-coady/quidproquo#readme",
36
+ "homepage": "https://github.com/qpqjs/quidproquo#readme",
34
37
  "dependencies": {
35
- "@anthropic-ai/sdk": "^0.19.1",
36
38
  "@jridgewell/trace-mapping": "^0.3.25",
37
- "quidproquo-actionprocessor-js": "0.1.15",
38
- "quidproquo-core": "0.1.15",
39
- "quidproquo-webserver": "0.1.15",
39
+ "quidproquo-actionprocessor-js": "0.1.17",
40
+ "quidproquo-core": "0.1.17",
41
+ "quidproquo-webserver": "0.1.17",
40
42
  "uuidv7": "^1.0.1"
41
43
  },
42
44
  "devDependencies": {
43
45
  "@jridgewell/gen-mapping": "^0.3.13",
44
46
  "@types/node": "^22.13.13",
45
- "quidproquo-tsconfig": "0.1.15",
47
+ "quidproquo-tsconfig": "0.1.17",
46
48
  "typescript": "^5.8.2"
47
49
  }
48
50
  }