635n45ult2 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/.devcontainer/devcontainer.json +4 -0
  2. package/.devcontainer/setup.sh +11 -0
  3. package/.dockerignore +2 -0
  4. package/.github/CONTRIBUTING.md +52 -0
  5. package/.github/FUNDING.yml +3 -0
  6. package/.github/ISSUE_TEMPLATE/bug_report.yml +59 -0
  7. package/.github/ISSUE_TEMPLATE/config.yml +5 -0
  8. package/.github/ISSUE_TEMPLATE/feature_request.yml +43 -0
  9. package/.github/dependabot.yml +17 -0
  10. package/.github/workflows/codeql.yml +76 -0
  11. package/.github/workflows/publish_docs.yml +25 -0
  12. package/.github/workflows/test.yml +78 -0
  13. package/.nvmrc +1 -0
  14. package/.prettierignore +1 -0
  15. package/.prettierrc +1 -0
  16. package/.vscode/launch.json +42 -0
  17. package/CODE_OF_CONDUCT.md +76 -0
  18. package/Dockerfile +17 -0
  19. package/LICENSE +21 -0
  20. package/README.md +3 -0
  21. package/SECURITY.md +5 -0
  22. package/__tests__/actions/cacheTest.ts +58 -0
  23. package/__tests__/actions/randomNumber.ts +26 -0
  24. package/__tests__/actions/recursiveAction.ts +16 -0
  25. package/__tests__/actions/sleepTest.ts +24 -0
  26. package/__tests__/actions/status.ts +17 -0
  27. package/__tests__/actions/swagger.ts +76 -0
  28. package/__tests__/actions/validationTest.ts +63 -0
  29. package/__tests__/cli/cli.ts +126 -0
  30. package/__tests__/core/api.ts +632 -0
  31. package/__tests__/core/cache.ts +400 -0
  32. package/__tests__/core/chatRoom.ts +589 -0
  33. package/__tests__/core/cli.ts +349 -0
  34. package/__tests__/core/cluster.ts +132 -0
  35. package/__tests__/core/config.ts +78 -0
  36. package/__tests__/core/errors.ts +112 -0
  37. package/__tests__/core/log.ts +23 -0
  38. package/__tests__/core/middleware.ts +427 -0
  39. package/__tests__/core/plugins/partialPlugin.ts +94 -0
  40. package/__tests__/core/plugins/withPlugin.ts +88 -0
  41. package/__tests__/core/plugins/withoutPlugin.ts +81 -0
  42. package/__tests__/core/process.ts +42 -0
  43. package/__tests__/core/specHelper.ts +330 -0
  44. package/__tests__/core/staticFile/compression.ts +99 -0
  45. package/__tests__/core/staticFile/staticFile.ts +180 -0
  46. package/__tests__/core/tasks/customQueueFunction.ts +67 -0
  47. package/__tests__/core/tasks/fullWorkerFlow.ts +199 -0
  48. package/__tests__/core/tasks/tasks.ts +605 -0
  49. package/__tests__/integration/browser.ts +133 -0
  50. package/__tests__/integration/ioredis-mock.ts +194 -0
  51. package/__tests__/integration/sendBuffer.ts +97 -0
  52. package/__tests__/integration/sendFile.ts +24 -0
  53. package/__tests__/integration/sharedFingerprint.ts +82 -0
  54. package/__tests__/integration/taskFlow.ts +110 -0
  55. package/__tests__/jest.ts +5 -0
  56. package/__tests__/modules/action.ts +103 -0
  57. package/__tests__/modules/config.ts +19 -0
  58. package/__tests__/modules/utils/ensureNoTsHeaderOrSpecFiles.ts +24 -0
  59. package/__tests__/servers/web/allowedRequestHosts.ts +88 -0
  60. package/__tests__/servers/web/enableMultiples.ts +83 -0
  61. package/__tests__/servers/web/fileUpload.ts +79 -0
  62. package/__tests__/servers/web/jsonp.ts +57 -0
  63. package/__tests__/servers/web/nonMultiples.ts +83 -0
  64. package/__tests__/servers/web/rawBody.ts +208 -0
  65. package/__tests__/servers/web/returnErrorCodes.ts +55 -0
  66. package/__tests__/servers/web/routes/deepRoutes.ts +96 -0
  67. package/__tests__/servers/web/routes/routes.ts +579 -0
  68. package/__tests__/servers/web/routes/veryDeepRoutes.ts +92 -0
  69. package/__tests__/servers/web/web.ts +1031 -0
  70. package/__tests__/servers/websocket.ts +795 -0
  71. package/__tests__/tasks/runAction.ts +37 -0
  72. package/__tests__/template.ts.example +20 -0
  73. package/__tests__/testCliCommands/hello.ts +44 -0
  74. package/__tests__/testPlugin/public/plugin.html +1 -0
  75. package/__tests__/testPlugin/src/actions/pluginAction.ts +14 -0
  76. package/__tests__/testPlugin/src/bin/hello.ts +22 -0
  77. package/__tests__/testPlugin/src/initializers/pluginInitializer.ts +17 -0
  78. package/__tests__/testPlugin/src/tasks/pluginTask.ts +15 -0
  79. package/__tests__/testPlugin/tsconfig.json +10 -0
  80. package/__tests__/utils/utils.ts +492 -0
  81. package/app.json +23 -0
  82. package/bin/deploy-docs +39 -0
  83. package/client/ActionheroWebsocketClient.js +277 -0
  84. package/docker-compose.yml +73 -0
  85. package/package.json +24 -0
  86. package/public/chat.html +194 -0
  87. package/public/css/cosmo.css +12 -0
  88. package/public/favicon.ico +0 -0
  89. package/public/index.html +115 -0
  90. package/public/javascript/.gitkeep +0 -0
  91. package/public/linkedSession.html +80 -0
  92. package/public/logo/actionhero-small.png +0 -0
  93. package/public/logo/actionhero.png +0 -0
  94. package/public/pixel.gif +0 -0
  95. package/public/simple.html +2 -0
  96. package/public/swagger.html +32 -0
  97. package/public/websocketLoadTest.html +322 -0
  98. package/src/actions/cacheTest.ts +58 -0
  99. package/src/actions/createChatRoom.ts +20 -0
  100. package/src/actions/randomNumber.ts +17 -0
  101. package/src/actions/recursiveAction.ts +13 -0
  102. package/src/actions/sendFile.ts +12 -0
  103. package/src/actions/sleepTest.ts +40 -0
  104. package/src/actions/status.ts +73 -0
  105. package/src/actions/swagger.ts +155 -0
  106. package/src/actions/validationTest.ts +36 -0
  107. package/src/bin/actionhero.ts +225 -0
  108. package/src/bin/methods/actions/list.ts +30 -0
  109. package/src/bin/methods/console.ts +26 -0
  110. package/src/bin/methods/generate/action.ts +58 -0
  111. package/src/bin/methods/generate/cli.ts +51 -0
  112. package/src/bin/methods/generate/initializer.ts +54 -0
  113. package/src/bin/methods/generate/plugin.ts +57 -0
  114. package/src/bin/methods/generate/server.ts +38 -0
  115. package/src/bin/methods/generate/task.ts +68 -0
  116. package/src/bin/methods/generate.ts +176 -0
  117. package/src/bin/methods/task/enqueue.ts +35 -0
  118. package/src/classes/action.ts +98 -0
  119. package/src/classes/actionProcessor.ts +463 -0
  120. package/src/classes/api.ts +51 -0
  121. package/src/classes/cli.ts +67 -0
  122. package/src/classes/config.ts +15 -0
  123. package/src/classes/connection.ts +321 -0
  124. package/src/classes/exceptionReporter.ts +9 -0
  125. package/src/classes/initializer.ts +59 -0
  126. package/src/classes/initializers.ts +5 -0
  127. package/src/classes/input.ts +9 -0
  128. package/src/classes/inputs.ts +34 -0
  129. package/src/classes/process/actionheroVersion.ts +15 -0
  130. package/src/classes/process/env.ts +16 -0
  131. package/src/classes/process/id.ts +34 -0
  132. package/src/classes/process/pid.ts +32 -0
  133. package/src/classes/process/projectRoot.ts +16 -0
  134. package/src/classes/process/typescript.ts +47 -0
  135. package/src/classes/process.ts +479 -0
  136. package/src/classes/server.ts +251 -0
  137. package/src/classes/task.ts +87 -0
  138. package/src/config/api.ts +107 -0
  139. package/src/config/errors.ts +162 -0
  140. package/src/config/logger.ts +113 -0
  141. package/src/config/plugins.ts +37 -0
  142. package/src/config/redis.ts +78 -0
  143. package/src/config/routes.ts +44 -0
  144. package/src/config/tasks.ts +84 -0
  145. package/src/config/web.ts +136 -0
  146. package/src/config/websocket.ts +62 -0
  147. package/src/index.ts +46 -0
  148. package/src/initializers/actions.ts +125 -0
  149. package/src/initializers/chatRoom.ts +214 -0
  150. package/src/initializers/connections.ts +124 -0
  151. package/src/initializers/exceptions.ts +155 -0
  152. package/src/initializers/params.ts +52 -0
  153. package/src/initializers/redis.ts +191 -0
  154. package/src/initializers/resque.ts +248 -0
  155. package/src/initializers/routes.ts +229 -0
  156. package/src/initializers/servers.ts +134 -0
  157. package/src/initializers/specHelper.ts +195 -0
  158. package/src/initializers/staticFile.ts +253 -0
  159. package/src/initializers/tasks.ts +188 -0
  160. package/src/modules/action.ts +89 -0
  161. package/src/modules/cache.ts +326 -0
  162. package/src/modules/chatRoom.ts +321 -0
  163. package/src/modules/config.ts +246 -0
  164. package/src/modules/log.ts +62 -0
  165. package/src/modules/redis.ts +93 -0
  166. package/src/modules/route.ts +59 -0
  167. package/src/modules/specHelper.ts +182 -0
  168. package/src/modules/task.ts +527 -0
  169. package/src/modules/utils/argv.ts +3 -0
  170. package/src/modules/utils/arrayStartingMatch.ts +21 -0
  171. package/src/modules/utils/arrayUnique.ts +15 -0
  172. package/src/modules/utils/collapseObjectToArray.ts +33 -0
  173. package/src/modules/utils/deepCopy.ts +3 -0
  174. package/src/modules/utils/ensureNoTsHeaderOrSpecFiles.ts +19 -0
  175. package/src/modules/utils/eventLoopDelay.ts +34 -0
  176. package/src/modules/utils/fileUtils.ts +119 -0
  177. package/src/modules/utils/filterObjectForLogging.ts +51 -0
  178. package/src/modules/utils/filterResponseForLogging.ts +53 -0
  179. package/src/modules/utils/getExternalIPAddress.ts +17 -0
  180. package/src/modules/utils/hashMerge.ts +63 -0
  181. package/src/modules/utils/isPlainObject.ts +45 -0
  182. package/src/modules/utils/isRunning.ts +7 -0
  183. package/src/modules/utils/parseCookies.ts +20 -0
  184. package/src/modules/utils/parseHeadersForClientAddress.ts +53 -0
  185. package/src/modules/utils/parseIPv6URI.ts +24 -0
  186. package/src/modules/utils/replaceDistWithSrc.ts +9 -0
  187. package/src/modules/utils/safeGlob.ts +6 -0
  188. package/src/modules/utils/sleep.ts +8 -0
  189. package/src/modules/utils/sortGlobalMiddleware.ts +17 -0
  190. package/src/modules/utils/sourceRelativeLinkPath.ts +29 -0
  191. package/src/modules/utils.ts +66 -0
  192. package/src/server.ts +20 -0
  193. package/src/servers/web.ts +894 -0
  194. package/src/servers/websocket.ts +304 -0
  195. package/src/tasks/runAction.ts +29 -0
  196. package/tea.yaml +9 -0
  197. package/templates/README.md.template +17 -0
  198. package/templates/action.ts.template +15 -0
  199. package/templates/boot.js.template +9 -0
  200. package/templates/cli.ts.template +15 -0
  201. package/templates/gitignore.template +23 -0
  202. package/templates/initializer.ts.template +17 -0
  203. package/templates/package-plugin.json.template +12 -0
  204. package/templates/package.json.template +45 -0
  205. package/templates/projectMap.txt +39 -0
  206. package/templates/projectServer.ts.template +20 -0
  207. package/templates/server.ts.template +37 -0
  208. package/templates/task.ts.template +16 -0
  209. package/templates/test/action.ts.template +13 -0
  210. package/templates/test/task.ts.template +20 -0
  211. package/tsconfig.json +11 -0
@@ -0,0 +1,4 @@
1
+ {
2
+ "appPort": 8080,
3
+ "postCreateCommand": "/bin/bash ./.devcontainer/setup.sh",
4
+ }
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env bash
2
+
3
+ echo "--- CONFIURING CODESPACE ---"
4
+
5
+ # configure node
6
+ nvm install v16
7
+ npm install
8
+
9
+ # configure redis
10
+ sudo apt-get install redis-tools -y
11
+ docker run -p 6379:6379 --name redis -d redis
package/.dockerignore ADDED
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ dist
@@ -0,0 +1,52 @@
1
+ # Contributing to Actionhero
2
+
3
+ First, **THANK YOU**.
4
+
5
+ Actionhero would not be the success it is today without the contributions of [many people](https://github.com/actionhero/actionhero/graphs/contributors). Actionhero is a community-led open source project. Thank you for taking the time to help out this open source project, and create something we can all use!
6
+
7
+ ## The Actionhero community
8
+
9
+ Before you begin your contribution, please let us know in the Actionhero Slack team, which is available at https://slack.actionherojs.com. There are community members who can help you, and you may want to team up with another community member. This also helps ensure that more than one person isn't working on the same thing.
10
+
11
+ By engaging the with Actionhero community or contributing to this or related projects, you agree to our [Code of Conduct](https://github.com/actionhero/actionhero/blob/master/CODE_OF_CONDUCT.md).
12
+
13
+ ## Pull Requests
14
+
15
+ All changes to Actionhero should be sent in as [Pull Requests](https://help.github.com/articles/about-pull-requests) to our [Github Project](https://github.com/actionhero/actionhero). Changes by any other method will be instantly rejected. GitHub allows us to coordinate and communicate in a single place. Pull requests also allow us to run our test suite against all new code to ensure that things still work the way they are supposed to after your change.
16
+
17
+ ## Testing
18
+
19
+ Actionhero is a large project with lost of different servers and tools. We don't expect you to know about everything, that's why we have a robust test suite. This allows us to ensure that no matter who makes a change, Actionhero will continue to work the way it is supposed to.
20
+
21
+ With that in mind, all new features to Actionhero must also include additions to the test suite to ensure that in the future, we can maintain your work. When writing tests, write the smallest test that ensures that your work is tested. IE: if you write a new initializer, you probably can test the method directly and you don't need an action test or an integration test.
22
+
23
+ **Every contribution to the codebase should have an associated test**
24
+
25
+ Be sure that your changes pass the test suite! Run `npm test` to run the full test suite.
26
+ You will need redis and node.js installed. We also have an integration which relies on chromedriver (an automated chrome browser). You can install this on OSX via `brew install chromedriver` No other external dependencies are needed.
27
+
28
+ If you need help writing tests, please ask for help in the [slack team](http://slack.actionherojs.com)
29
+
30
+ ## Linting
31
+
32
+ We use [prettier.js](https://prettier.io/) to manage our lint rules. We run `prettier` as part of our test suite, and your contributions must pass. Prettier is _very_ opinionated and inflexible such that we cannot inject our own opinions. There are no eslint/jshint files to manage in this project.
33
+
34
+ ## Documentation
35
+
36
+ If your contribution adds a new feature of modifies an existing behavior, document your changes using [Typedoc](https://typedoc.org/). We use Typedoc to automatically document Actionhero, and build [https://docs.actionherojs.com](docs.actionherojs.com) on every push to the master branch or merge of your Pull Request. There are many plugins to help you with this, and are built into editors like VSCode.
37
+
38
+ If you are documenting code, inline JSdocs are preferred. The only exceptions are tutorials, which are stand-alone markdown files in the `./tutorials` directory of the [www.actionherojs.com project](https://github.com/actionhero/www.actionherojs.com). An example of a newly documented method would be:
39
+
40
+ ```js
41
+ /**
42
+ Sleep with a Promise.
43
+ `time` is the number of ms to sleep.
44
+ */
45
+ api.utils.sleep = (time: number) => {
46
+ return new Promise((resolve) => {
47
+ setTimeout(resolve, time);
48
+ });
49
+ };
50
+ ```
51
+
52
+ The "marketing" www.actionherojs.com site [is built via this project separately](https://github.com/actionhero/www.actionherojs.com).
@@ -0,0 +1,3 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [evantahler]
@@ -0,0 +1,59 @@
1
+ name: 🐞 Bug report
2
+ description: Create a bug report to help us improve Actionhero
3
+ title: "[Bug]: "
4
+ labels: [bug]
5
+
6
+ body:
7
+ - type: checkboxes
8
+ attributes:
9
+ label: Is there an existing issue for this?
10
+ description: Please search to see if an issue already exists for the bug you encountered.
11
+ options:
12
+ - label: I have searched the existing issues
13
+ required: true
14
+
15
+ - type: textarea
16
+ attributes:
17
+ label: Current Behavior
18
+ description: A concise description of what you're experiencing. Please include specific steps or a sample project to reproduce the error you are seeing.
19
+ placeholder: |
20
+ When I do <X>, <Y> happens and I see the error message attached below:
21
+ ```...```
22
+ validations:
23
+ required: true
24
+
25
+ - type: textarea
26
+ attributes:
27
+ label: Expected Behavior
28
+ description: A concise description of what you expected to happen.
29
+ placeholder: When I do <X>, <Z> should happen instead.
30
+ validations:
31
+ required: false
32
+
33
+ - type: textarea
34
+ attributes:
35
+ label: Stack Trace
36
+ description: If applicable, add the full stack trace you see along with the error.
37
+ placeholder: If applicable, add the full stack trace you see along with the error.
38
+ render: markdown
39
+ validations:
40
+ required: false
41
+
42
+ - type: textarea
43
+ attributes:
44
+ label: Environment
45
+ description: |
46
+ - OS: [e.g. OSX, Docker + Ubuntu 18, etc]
47
+ - Browser [e.g. chrome, safari]
48
+ - Actionhero Version [e.g. 1.2.3]
49
+ - Node.js Version [e.g. 1.2.3]
50
+ validations:
51
+ required: true
52
+
53
+ - type: textarea
54
+ attributes:
55
+ label: Additional context
56
+ description: |
57
+ Links? Screenshots? References? Anything that will give us more context about the issue you are encountering!
58
+ validations:
59
+ required: false
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Ask a question
4
+ url: https://github.com/actionhero/actionhero/discussions
5
+ about: Ask questions and discuss with other community members
@@ -0,0 +1,43 @@
1
+ name: 🚀 Feature request
2
+ description: Suggest an idea for Actionhero
3
+ title: "[Feature]: "
4
+ labels: [enhancement]
5
+
6
+ body:
7
+ - type: checkboxes
8
+ attributes:
9
+ label: Is there an existing issue for this?
10
+ description: Please search to see if an issue related to this feature request already exists.
11
+ options:
12
+ - label: I have searched the existing issues
13
+ required: true
14
+
15
+ - type: textarea
16
+ attributes:
17
+ label: Is your feature request related to a problem? Please describe.
18
+ description: A concise description of the problem you are facing or the motivetion behind this feature request.
19
+ placeholder: I faced a problem due to which ...
20
+ validations:
21
+ required: true
22
+
23
+ - type: textarea
24
+ attributes:
25
+ label: Describe the solution you'd like.
26
+ description: A concise description of the solution for the issue.
27
+ validations:
28
+ required: false
29
+
30
+ - type: textarea
31
+ attributes:
32
+ label: Describe an alternate solution.
33
+ description: Is there any other approack to solve the problem?
34
+ validations:
35
+ required: false
36
+
37
+ - type: textarea
38
+ attributes:
39
+ label: Additional context
40
+ description: |
41
+ Links? Screenshots? References? Anything that will give us more context about what you would like to see!
42
+ validations:
43
+ required: false
@@ -0,0 +1,17 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "npm" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ open-pull-requests-limit: 999
11
+ schedule:
12
+ interval: "weekly"
13
+ - package-ecosystem: "github-actions"
14
+ directory: "/"
15
+ open-pull-requests-limit: 999
16
+ schedule:
17
+ interval: "weekly"
@@ -0,0 +1,76 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ "main" ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ "main" ]
20
+ schedule:
21
+ - cron: '25 17 * * 0'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'javascript' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Use only 'java' to analyze code written in Java, Kotlin or both
38
+ # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
39
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
40
+
41
+ steps:
42
+ - name: Checkout repository
43
+ uses: actions/checkout@v4
44
+
45
+ # Initializes the CodeQL tools for scanning.
46
+ - name: Initialize CodeQL
47
+ uses: github/codeql-action/init@v3
48
+ with:
49
+ languages: ${{ matrix.language }}
50
+ # If you wish to specify custom queries, you can do so here or in a config file.
51
+ # By default, queries listed here will override any specified in a config file.
52
+ # Prefix the list here with "+" to use these queries and those in the config file.
53
+
54
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
55
+ # queries: security-extended,security-and-quality
56
+
57
+
58
+ # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
59
+ # If this step fails, then you should remove it and run the build manually (see below)
60
+ - name: Autobuild
61
+ uses: github/codeql-action/autobuild@v3
62
+
63
+ # ℹ️ Command-line programs to run using the OS shell.
64
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
65
+
66
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
67
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
68
+
69
+ # - run: |
70
+ # echo "Run, Build Application using script"
71
+ # ./location_of_script_within_repo/buildscript.sh
72
+
73
+ - name: Perform CodeQL Analysis
74
+ uses: github/codeql-action/analyze@v3
75
+ with:
76
+ category: "/language:${{matrix.language}}"
@@ -0,0 +1,25 @@
1
+ name: Publish Docs
2
+ on:
3
+ push:
4
+ branches: [main]
5
+
6
+ jobs:
7
+ publish_docs:
8
+ runs-on: ubuntu-latest
9
+ container:
10
+ image: node
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - name: Use Node.js 20.x
14
+ uses: actions/setup-node@v4.0.2
15
+ with:
16
+ node-version: 20.x
17
+ - run: npm ci
18
+ - run: ./bin/deploy-docs
19
+ - name: Push changes
20
+ uses: ad-m/github-push-action@master
21
+ with:
22
+ github_token: ${{ secrets.GITHUB_TOKEN }}
23
+ branch: gh-pages
24
+ directory: gh-pages
25
+ force: true
@@ -0,0 +1,78 @@
1
+ name: Test
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ pull_request:
7
+ branches:
8
+ - main
9
+ merge_group:
10
+ branches:
11
+ - main
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ jobs:
17
+ lint:
18
+ runs-on: ubuntu-latest
19
+ container:
20
+ image: node
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - name: Use Node.js 20.x
24
+ uses: actions/setup-node@v4.0.2
25
+ with:
26
+ node-version: 20.x
27
+ - run: npm ci
28
+ - run: npm run lint
29
+
30
+ docs:
31
+ runs-on: ubuntu-latest
32
+ container:
33
+ image: node
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+ - name: Use Node.js 20.x
37
+ uses: actions/setup-node@v4.0.2
38
+ with:
39
+ node-version: 20.x
40
+ - run: npm ci
41
+ - run: npm run docs
42
+
43
+ test:
44
+ runs-on: ubuntu-latest
45
+ container:
46
+ image: node
47
+ options: --network-alias main
48
+
49
+ services:
50
+ redis:
51
+ image: redis
52
+
53
+ strategy:
54
+ fail-fast: false
55
+ matrix:
56
+ node-version: [16.x, 18.x, 20.x]
57
+
58
+ steps:
59
+ - uses: actions/checkout@v4
60
+ - name: Use Node.js ${{ matrix.node-version }}
61
+ uses: actions/setup-node@v4.0.2
62
+ with:
63
+ node-version: ${{ matrix.node-version }}
64
+ - run: npm ci
65
+ - name: install puppeteer dependencies
66
+ run: apt-get update && apt-get install -y libgtk2.0-0 libgtk-3-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb libgbm-dev
67
+ - run: ./node_modules/.bin/jest --ci
68
+ env:
69
+ REDIS_HOST: redis
70
+ maxMemoryAlloted: 10000
71
+
72
+ complete:
73
+ permissions:
74
+ contents: none
75
+ runs-on: ubuntu-latest
76
+ needs: [lint, docs, test]
77
+ steps:
78
+ - run: echo "Done!"
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v20
@@ -0,0 +1 @@
1
+ __tests__/testPlugin/*
package/.prettierrc ADDED
@@ -0,0 +1 @@
1
+ {}
@@ -0,0 +1,42 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "type": "node",
6
+ "request": "attach",
7
+ "name": "Actionhero Debugger (attach)",
8
+ "protocol": "inspector",
9
+ "port": 9229,
10
+ "restart": true,
11
+ "localRoot": "${workspaceFolder}",
12
+ "outFiles": ["${workspaceRoot}/dist/**/*.js"],
13
+ "sourceMaps": true,
14
+ "remoteRoot": "."
15
+ },
16
+
17
+ {
18
+ "type": "node",
19
+ "request": "launch",
20
+ "name": "Actionhero Debugger (launch)",
21
+ "program": "${workspaceFolder}/src/server.ts",
22
+ "preLaunchTask": "tsc: build - tsconfig.json",
23
+ "outFiles": ["${workspaceFolder}/dist/**/*.js"],
24
+ "outputCapture": "std"
25
+ },
26
+
27
+ {
28
+ "name": "Debug Jest Tests",
29
+ "type": "node",
30
+ "request": "launch",
31
+ "runtimeArgs": [
32
+ "--inspect-brk",
33
+ "${workspaceRoot}/node_modules/.bin/jest",
34
+ "--runInBand",
35
+ "${workspaceRoot}/__tests__"
36
+ ],
37
+ "console": "integratedTerminal",
38
+ "internalConsoleOptions": "neverOpen",
39
+ "port": 9229
40
+ }
41
+ ]
42
+ }
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ - Using welcoming and inclusive language
18
+ - Being respectful of differing viewpoints and experiences
19
+ - Gracefully accepting constructive criticism
20
+ - Focusing on what is best for the community
21
+ - Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ - The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ - Trolling, insulting/derogatory comments, and personal or political attacks
28
+ - Public or private harassment
29
+ - Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ - Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at help@actionherojs.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
package/Dockerfile ADDED
@@ -0,0 +1,17 @@
1
+ FROM node:alpine
2
+ LABEL maintainer="admin@actionherojs.com"
3
+
4
+ ENV PORT=8080
5
+
6
+ WORKDIR /actionhero
7
+
8
+ # needed for tests
9
+ RUN apk add chromium
10
+
11
+ COPY package*.json ./
12
+ COPY . .
13
+ RUN npm install
14
+ RUN npm run prepare
15
+
16
+ CMD ["node", "./dist/server.js"]
17
+ EXPOSE $PORT
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Kafir!
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # koberious
2
+
3
+ ```sudo fallocate -l 10G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile && echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab```
package/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ # Security Policy
2
+
3
+ ## Reporting a Vulnerability
4
+
5
+ If you have found a security issue, please email hello [at] actionherojs.com. Do not post a Github Issue so we can properly patch the issue before disclosing publicly.
@@ -0,0 +1,58 @@
1
+ import { Process, specHelper } from "./../../src/index";
2
+ import { CacheTest } from "../../src/actions/cacheTest";
3
+
4
+ describe("Action: Cache", () => {
5
+ const actionhero = new Process();
6
+ beforeAll(async () => await actionhero.start());
7
+ afterAll(async () => await actionhero.stop());
8
+
9
+ test("fails with no params", async () => {
10
+ const { error } = await specHelper.runAction<CacheTest>("cacheTest", {});
11
+ expect(error).toEqual("Error: key is a required parameter for this action");
12
+ });
13
+
14
+ test("fails with just key", async () => {
15
+ const { error } = await specHelper.runAction<CacheTest>("cacheTest", {
16
+ key: "test key",
17
+ });
18
+ expect(error).toEqual(
19
+ "Error: value is a required parameter for this action",
20
+ );
21
+ });
22
+
23
+ test("fails with just value", async () => {
24
+ const { error } = await specHelper.runAction<CacheTest>("cacheTest", {
25
+ value: "abc123",
26
+ });
27
+ expect(error).toEqual("Error: key is a required parameter for this action");
28
+ });
29
+
30
+ test("fails with gibberish param", async () => {
31
+ const { error } = await specHelper.runAction<CacheTest>("cacheTest", {
32
+ thingy: "abc123",
33
+ });
34
+ expect(error).toEqual("Error: key is a required parameter for this action");
35
+ });
36
+
37
+ test("fails with value shorter than 2 letters", async () => {
38
+ const { error } = await specHelper.runAction<CacheTest>("cacheTest", {
39
+ key: "abc123",
40
+ value: "v",
41
+ });
42
+ expect(error).toEqual("Error: inputs should be at least 3 letters long");
43
+ });
44
+
45
+ test("works with correct params", async () => {
46
+ const { cacheTestResults, error } = await specHelper.runAction<CacheTest>(
47
+ "cacheTest",
48
+ {
49
+ key: "testKey",
50
+ value: "abc123",
51
+ },
52
+ );
53
+ expect(error).toBeFalsy();
54
+ expect(cacheTestResults.saveResp).toEqual(true);
55
+ expect(cacheTestResults.loadResp.value).toEqual("abc123");
56
+ expect(cacheTestResults.deleteResp).toEqual(true);
57
+ });
58
+ });
@@ -0,0 +1,26 @@
1
+ import { Process, specHelper } from "./../../src/index";
2
+ import { RandomNumber } from "../../src/actions/randomNumber";
3
+
4
+ describe("Action: randomNumber", () => {
5
+ const actionhero = new Process();
6
+ beforeAll(async () => await actionhero.start());
7
+ afterAll(async () => await actionhero.stop());
8
+
9
+ let firstNumber: number;
10
+
11
+ test("generates random numbers", async () => {
12
+ const { randomNumber } =
13
+ await specHelper.runAction<RandomNumber>("randomNumber");
14
+ expect(randomNumber).toBeGreaterThan(0);
15
+ expect(randomNumber).toBeLessThan(1);
16
+ firstNumber = randomNumber;
17
+ });
18
+
19
+ test("is unique / random", async () => {
20
+ const { randomNumber } =
21
+ await specHelper.runAction<RandomNumber>("randomNumber");
22
+ expect(randomNumber).toBeGreaterThan(0);
23
+ expect(randomNumber).toBeLessThan(1);
24
+ expect(randomNumber).not.toEqual(firstNumber);
25
+ });
26
+ });