@seeka-labs/cli-apps 1.1.18 → 1.1.23

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 (60) hide show
  1. package/LICENSE +19 -19
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/init-templates/aws-lambda/.example.gitignore +48 -48
  5. package/dist/init-templates/aws-lambda/.nvmrc +1 -0
  6. package/dist/init-templates/aws-lambda/README.md +76 -76
  7. package/dist/init-templates/aws-lambda/jest.config.js +4 -4
  8. package/dist/init-templates/aws-lambda/package.json +54 -54
  9. package/dist/init-templates/aws-lambda/src/index.test.ts +6 -6
  10. package/dist/init-templates/aws-lambda/src/lib/logging/index.ts +87 -87
  11. package/dist/init-templates/aws-lambda/src/lib/state/redis/index.ts +64 -64
  12. package/dist/init-templates/aws-lambda/src/lib/state/seeka/installations.ts +66 -66
  13. package/dist/init-templates/aws-lambda/src/routes/seekaAppWebhook.ts +193 -193
  14. package/dist/init-templates/azure-function/.example.gitignore +47 -47
  15. package/dist/init-templates/azure-function/.gitlab-ci.yml +24 -24
  16. package/dist/init-templates/azure-function/.nvmrc +1 -0
  17. package/dist/init-templates/azure-function/README.md +107 -107
  18. package/dist/init-templates/azure-function/jest.config.js +4 -4
  19. package/dist/init-templates/azure-function/package.json +48 -48
  20. package/dist/init-templates/azure-function/scripts/dev-queue-setup.js +29 -29
  21. package/dist/init-templates/azure-function/src/functions/healthCheck.ts +13 -13
  22. package/dist/init-templates/azure-function/src/functions/pollingExample.ts +39 -39
  23. package/dist/init-templates/azure-function/src/functions/queueExample.ts +66 -66
  24. package/dist/init-templates/azure-function/src/functions/seekaAppWebhook.ts +236 -236
  25. package/dist/init-templates/azure-function/src/index.test.ts +6 -6
  26. package/dist/init-templates/azure-function/src/lib/browser/index.ts +54 -54
  27. package/dist/init-templates/azure-function/src/lib/browser/models/index.ts +6 -6
  28. package/dist/init-templates/azure-function/src/lib/jobs/index.ts +95 -95
  29. package/dist/init-templates/azure-function/src/lib/logging/index.ts +92 -92
  30. package/dist/init-templates/azure-function/src/lib/state/redis/index.ts +64 -64
  31. package/dist/init-templates/azure-function/src/lib/state/seeka/installations.ts +66 -66
  32. package/dist/init-templates/azure-function/tsconfig.json +1 -1
  33. package/dist/init-templates/browser/.editorconfig +14 -14
  34. package/dist/init-templates/browser/.eslintrc.cjs +1 -1
  35. package/dist/init-templates/browser/.yarnrc +1 -1
  36. package/dist/init-templates/browser/jest.config.js +11 -11
  37. package/dist/init-templates/browser/package.json +11 -12
  38. package/dist/init-templates/browser/scripts/esbuild/build-browser-plugin.mjs +110 -110
  39. package/dist/init-templates/browser/scripts/esbuild/plugins/importAsGlobals.mjs +38 -38
  40. package/dist/init-templates/browser/src/browser.ts +12 -12
  41. package/dist/init-templates/browser/src/plugin/index.test.ts +6 -6
  42. package/dist/init-templates/browser/src/plugin/index.ts +49 -49
  43. package/dist/init-templates/browser/tsconfig.json +34 -34
  44. package/dist/init-templates/netlify-function/.env.example +17 -17
  45. package/dist/init-templates/netlify-function/.example.gitignore +36 -36
  46. package/dist/init-templates/netlify-function/.nvmrc +1 -0
  47. package/dist/init-templates/netlify-function/.vscode/launch.json +44 -44
  48. package/dist/init-templates/netlify-function/README.md +61 -61
  49. package/dist/init-templates/netlify-function/jest.config.js +4 -4
  50. package/dist/init-templates/netlify-function/netlify.toml +6 -6
  51. package/dist/init-templates/netlify-function/package.json +1 -1
  52. package/dist/init-templates/netlify-function/src/api/example-job-background/index.ts +51 -51
  53. package/dist/init-templates/netlify-function/src/api/polling-example-job-scheduled/index.ts +45 -45
  54. package/dist/init-templates/netlify-function/src/api/seeka-app-webhook/index.ts +216 -216
  55. package/dist/init-templates/netlify-function/src/index.test.ts +6 -6
  56. package/dist/init-templates/netlify-function/src/lib/jobs/index.ts +67 -67
  57. package/dist/init-templates/netlify-function/src/lib/logging/index.ts +90 -90
  58. package/dist/init-templates/netlify-function/src/lib/state/redis/index.ts +64 -64
  59. package/dist/init-templates/netlify-function/src/lib/state/seeka/installations.ts +66 -66
  60. package/package.json +5 -5
@@ -1,48 +1,48 @@
1
- bin
2
- obj
3
- csx
4
- .vs
5
- edge
6
- Publish
7
-
8
- *.user
9
- *.suo
10
- *.cscfg
11
- *.Cache
12
- project.lock.json
13
-
14
- /packages
15
- /TestResults
16
-
17
- /tools/NuGet.exe
18
- /App_Data
19
- /secrets
20
- /data
21
- .secrets
22
- appsettings.json
23
- local.settings.json
24
-
25
- node_modules
26
- dist
27
-
28
- # Local python packages
29
- .python_packages/
30
-
31
- # Python Environments
32
- .env
33
- .venv
34
- env/
35
- venv/
36
- ENV/
37
- env.bak/
38
- venv.bak/
39
-
40
- # Byte-compiled / optimized / DLL files
41
- __pycache__/
42
- *.py[cod]
43
- *$py.class
44
-
45
- # Azurite artifacts
46
- __blobstorage__
47
- __queuestorage__
1
+ bin
2
+ obj
3
+ csx
4
+ .vs
5
+ edge
6
+ Publish
7
+
8
+ *.user
9
+ *.suo
10
+ *.cscfg
11
+ *.Cache
12
+ project.lock.json
13
+
14
+ /packages
15
+ /TestResults
16
+
17
+ /tools/NuGet.exe
18
+ /App_Data
19
+ /secrets
20
+ /data
21
+ .secrets
22
+ appsettings.json
23
+ local.settings.json
24
+
25
+ node_modules
26
+ dist
27
+
28
+ # Local python packages
29
+ .python_packages/
30
+
31
+ # Python Environments
32
+ .env
33
+ .venv
34
+ env/
35
+ venv/
36
+ ENV/
37
+ env.bak/
38
+ venv.bak/
39
+
40
+ # Byte-compiled / optimized / DLL files
41
+ __pycache__/
42
+ *.py[cod]
43
+ *$py.class
44
+
45
+ # Azurite artifacts
46
+ __blobstorage__
47
+ __queuestorage__
48
48
  __azurite_db*__.json
@@ -1,5 +1,5 @@
1
1
  stages:
2
- - deploy
2
+ - deploy
3
3
 
4
4
  variables:
5
5
  AZURE_FUNC_RESOURCE_NAME: seeka-app-example-name
@@ -7,32 +7,32 @@ variables:
7
7
 
8
8
  workflow:
9
9
  rules:
10
- - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
11
- when: never
12
- - if: '$CI_COMMIT_BRANCH == "main" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
13
- when: always
14
- - if: '$CI_COMMIT_BRANCH == "staging" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
15
- when: always
10
+ - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
11
+ when: never
12
+ - if: '$CI_COMMIT_BRANCH == "main" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
13
+ when: always
14
+ - if: '$CI_COMMIT_BRANCH == "staging" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
15
+ when: always
16
16
 
17
17
  deploy:
18
18
  stage: deploy
19
- image: node:18-bullseye
19
+ image: node:20-bullseye
20
20
  before_script:
21
- - echo "installing azure cli"
22
- - curl -sL https://aka.ms/InstallAzureCLIDeb | bash
23
- - az --version
24
- - echo "logging in to azure"
25
- - az login --service-principal --username "$AZURE_SERVICEPRINCIPAL_CLIENTID" --password "$AZURE_SERVICEPRINCIPAL_SECRET" --tenant "$AZURE_TENANT_ID"
26
- - az account set --subscription "$AZURE_SUBSCRIPTION_ID"
21
+ - echo "installing azure cli"
22
+ - curl -sL https://aka.ms/InstallAzureCLIDeb | bash
23
+ - az --version
24
+ - echo "logging in to azure"
25
+ - az login --service-principal --username "$AZURE_SERVICEPRINCIPAL_CLIENTID" --password "$AZURE_SERVICEPRINCIPAL_SECRET" --tenant "$AZURE_TENANT_ID"
26
+ - az account set --subscription "$AZURE_SUBSCRIPTION_ID"
27
27
  script:
28
- - echo "deploying azure func $AZURE_FUNC_RESOURCE_NAME to slot $AZURE_FUNC_SLOT from branch $CI_COMMIT_BRANCH"
29
- - yarn install --production=false
30
- # START: component:browser
31
- - cd src/browser
32
- - yarn install --production=false
33
- - cd ../../
34
- # END: component:browser
35
- - yarn run clean && yarn run build && yarn func azure functionapp publish $AZURE_FUNC_RESOURCE_NAME --no-build --javascript
28
+ - echo "deploying azure func $AZURE_FUNC_RESOURCE_NAME to slot $AZURE_FUNC_SLOT from branch $CI_COMMIT_BRANCH"
29
+ - yarn install --production=false
30
+ # START: component:browser
31
+ - cd src/browser
32
+ - yarn install --production=false
33
+ - cd ../../
34
+ # END: component:browser
35
+ - yarn run clean && yarn run build && yarn func azure functionapp publish $AZURE_FUNC_RESOURCE_NAME --no-build --javascript
36
36
  only:
37
- - main
38
- - staging
37
+ - main
38
+ - staging
@@ -1,108 +1,108 @@
1
- # Seeka app - Azure functions
2
-
3
- ## Development
4
-
5
- - See [Configure your environment](https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-typescript?pivots=nodejs-model-v4#configure-your-environment) for dependencies
6
- - For emulating Azure storage queues, blobs and tables: `docker run --name azurite -p 10000:10000 -p 10001:10001 -p 10002:10002 --detach mcr.microsoft.com/azure-storage/azurite`
7
- - Set `AzureWebJobsStorage` setting in local.settings.json to `UseDevelopmentStorage=true`
8
- - If not using WSL:
9
- `UseDevelopmentStorage=true`
10
- - If using WSL, the following may be required to allow your app to reach Azure storage emulator:
11
-
12
- Replace `MY-MACHINE-NAME` with your hostname. Below connection string allows running Azurite on your host machine and lets WSL connect to it
13
- `DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://MY-MACHINE-NAME.local:10000/devstoreaccount1;QueueEndpoint=http://MY-MACHINE-NAME.local:10001/devstoreaccount1;TableEndpoint=http://MY-MACHINE-NAME.local:10002/devstoreaccount1;`
14
- - Install Azure Storage explorer and create your queues (see `./src/lib/jobs/index.ts` for `queueNames`). Azure Storage explorer can be used to view your queue items.
15
- - `yarn install`
16
- - `yarn dev`
17
-
18
- ### Debugging
19
- Supports VSCode debugging via the debugger and utilisation of breakpoints.
20
- This is only tested on Linux but may work on Windows.
21
- If using Windows then use WSL with an Ubuntu distro for support of attaching the VS code debugger
22
-
23
- ### Live urls
24
- You can expose your app locally to the internet via Ngrok to test your app before deploying.
25
-
26
- #### Setup
27
- 1. Sign up for a Ngrok account
28
- 2. Get your auth token
29
- 3. `yarn ngrok config add-authtoken [auth token here]` replacing `[auth token]` with the auth token retrieved from your Ngrok dashboard
30
-
31
- #### Running
32
- 1. `yarn start` OR start debugging in VSCode
33
- 2. In separate terminal window run `yarn tunnel` and observe the log entry that starts with `Live url exposed`.
34
- 3. Input the URL into your Seeka app configuration as the "Webook URL" via the Seeka UI.
35
-
36
- ## Included sample functions
37
- ### Seeka app webhook
38
- `src/functions/seekaAppWebhook.ts`
39
-
40
- Handles inbound webhooks sent from Seeka to your app.
41
-
42
- ### Queue example
43
- `src/functions/queueExample.ts`
44
-
45
- Handles taking a message and placing it on an Azure storage queue for later processing. This concept can be used to offload long running operations based on data sent to your app from Seeka and can help to ensure Azure Function time execution limits are respected.
46
-
47
- ### Polling example
48
- `src/functions/pollingExample.ts`
49
-
50
- Handles scheduled invoking of a function. This concept can be used to "fan out" long running operations based on data sent to your app from Seeka and can help to ensure Azure Function time execution limits are respected by splitting long running operations into smaller, less time consuming parts.
51
-
52
- ## Invoking functions
53
- ### Development environment
54
- Scheduled / timer function: `curl -i -d '{"input": null}' -H "Content-Type: application/json" -X POST http://localhost:7072/admin/functions/pollingExample`
55
-
56
- ### Azure cloud
57
- Scheduled / timer function: `curl -i -d '{"input": null}' -H "Content-Type: application/json" -H "x-functions-key: <key from azure portal>" -X POST https://seeka-app-example-name.azurewebsites.net/admin/functions/pollingExample`
58
-
59
- See [this doc](https://learn.microsoft.com/en-us/azure/azure-functions/functions-manually-run-non-http?tabs=azure-portal#get-the-master-key) on how to get the functions (master) key
60
-
61
- ## Logging
62
- Centralised logging handled by [Winston](https://www.npmjs.com/package/winston). Winston is installed in this template and is also used in the Seeka SDK NPM packages.
63
-
64
- [Seq](https://datalust.co/seq) Winston transport is installed in this template (optional).
65
-
66
- To configure Seq options, see `_SEQ_` environment variables.
67
-
68
- To install Seq on your development machine
69
- 1. Run `docker run --name seq -d --restart=always -e ACCEPT_EULA=Y -p 5341:80 datalust/seq:2024.2`
70
- 2. Update your `LOGGING_SEQ_SERVERURL` environment variable to `http://localhost:5341` or `http://[YOUR MACHINE NAME].local:5341` if using WSL.
71
-
72
- If creating an API key for Seq, only permission that is required is `Ingest`.
73
-
74
- ## State management
75
- Installations of your app and other state required for your app to function is stored in Redis. Another state provider can be swapped out for Redis, see `src/lib/state/seeka/installations.ts` for the file that manages the state of the installations.
76
-
77
- ### Upstash (optional)
78
- If you dont want to use Upstash for Redis then the connection strings in `.env` can be swapped with your Redis instance.
79
-
80
- > If using Upstash then create a database before following the below guide to deploying your AWS lambda function.
81
-
82
- > When choosing region - use a region that is closest to the Azure region that your function app is hosted in to reduce latency between the function and the Redis database.
83
-
84
- ## Deployment
85
- This project comes ready to deploy for free to Azure functions with database backed by Redis hosted by Upstash and queues, blobs and tables backed by Azure Storage.
86
-
87
- 1. Create Azure function app via the portal with below settings
88
- - Function app name: seeka-app-example-name
89
- - Code or container image: Code
90
- - Runtime stack: Node.js
91
- - Version: 18 LTS
92
- - Region: Closest region to where your upstash "master / write" database is located
93
- - Operating system: linux
94
- - Hosting: Consumption
95
- - Enable public access: On
96
- 2. Set environment variables of the Azure web app - reference local.settings.json "Values"
97
- 3. If your app receives calls directly from the browser (eg. your browser app plugin) then CORS needs to be enabled for all origins from within the settings of the Function app in Azure portal.
98
- 3. `yarn deploy`
99
-
100
- ### Continuous delivery
101
- This template includes a GitLab CD pipeline that can be used to trigger deployments of your app when changes are pushed to your Git repository.
102
-
103
- ### Configuring queues
104
- See [this article](https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue?tabs=isolated-process%2Cextensionv5%2Cextensionv3&pivots=programming-language-typescript#host-json) on settings that are settable in the `host.json` file.
105
-
106
- ## References
107
- - https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite
1
+ # Seeka app - Azure functions
2
+
3
+ ## Development
4
+
5
+ - See [Configure your environment](https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-typescript?pivots=nodejs-model-v4#configure-your-environment) for dependencies
6
+ - For emulating Azure storage queues, blobs and tables: `docker run --name azurite -p 10000:10000 -p 10001:10001 -p 10002:10002 --detach mcr.microsoft.com/azure-storage/azurite`
7
+ - Set `AzureWebJobsStorage` setting in local.settings.json to `UseDevelopmentStorage=true`
8
+ - If not using WSL:
9
+ `UseDevelopmentStorage=true`
10
+ - If using WSL, the following may be required to allow your app to reach Azure storage emulator:
11
+
12
+ Replace `MY-MACHINE-NAME` with your hostname. Below connection string allows running Azurite on your host machine and lets WSL connect to it
13
+ `DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://MY-MACHINE-NAME.local:10000/devstoreaccount1;QueueEndpoint=http://MY-MACHINE-NAME.local:10001/devstoreaccount1;TableEndpoint=http://MY-MACHINE-NAME.local:10002/devstoreaccount1;`
14
+ - Install Azure Storage explorer and create your queues (see `./src/lib/jobs/index.ts` for `queueNames`). Azure Storage explorer can be used to view your queue items.
15
+ - `yarn install`
16
+ - `yarn dev`
17
+
18
+ ### Debugging
19
+ Supports VSCode debugging via the debugger and utilisation of breakpoints.
20
+ This is only tested on Linux but may work on Windows.
21
+ If using Windows then use WSL with an Ubuntu distro for support of attaching the VS code debugger
22
+
23
+ ### Live urls
24
+ You can expose your app locally to the internet via Ngrok to test your app before deploying.
25
+
26
+ #### Setup
27
+ 1. Sign up for a Ngrok account
28
+ 2. Get your auth token
29
+ 3. `yarn ngrok config add-authtoken [auth token here]` replacing `[auth token]` with the auth token retrieved from your Ngrok dashboard
30
+
31
+ #### Running
32
+ 1. `yarn start` OR start debugging in VSCode
33
+ 2. In separate terminal window run `yarn tunnel` and observe the log entry that starts with `Live url exposed`.
34
+ 3. Input the URL into your Seeka app configuration as the "Webook URL" via the Seeka UI.
35
+
36
+ ## Included sample functions
37
+ ### Seeka app webhook
38
+ `src/functions/seekaAppWebhook.ts`
39
+
40
+ Handles inbound webhooks sent from Seeka to your app.
41
+
42
+ ### Queue example
43
+ `src/functions/queueExample.ts`
44
+
45
+ Handles taking a message and placing it on an Azure storage queue for later processing. This concept can be used to offload long running operations based on data sent to your app from Seeka and can help to ensure Azure Function time execution limits are respected.
46
+
47
+ ### Polling example
48
+ `src/functions/pollingExample.ts`
49
+
50
+ Handles scheduled invoking of a function. This concept can be used to "fan out" long running operations based on data sent to your app from Seeka and can help to ensure Azure Function time execution limits are respected by splitting long running operations into smaller, less time consuming parts.
51
+
52
+ ## Invoking functions
53
+ ### Development environment
54
+ Scheduled / timer function: `curl -i -d '{"input": null}' -H "Content-Type: application/json" -X POST http://localhost:7072/admin/functions/pollingExample`
55
+
56
+ ### Azure cloud
57
+ Scheduled / timer function: `curl -i -d '{"input": null}' -H "Content-Type: application/json" -H "x-functions-key: <key from azure portal>" -X POST https://seeka-app-example-name.azurewebsites.net/admin/functions/pollingExample`
58
+
59
+ See [this doc](https://learn.microsoft.com/en-us/azure/azure-functions/functions-manually-run-non-http?tabs=azure-portal#get-the-master-key) on how to get the functions (master) key
60
+
61
+ ## Logging
62
+ Centralised logging handled by [Winston](https://www.npmjs.com/package/winston). Winston is installed in this template and is also used in the Seeka SDK NPM packages.
63
+
64
+ [Seq](https://datalust.co/seq) Winston transport is installed in this template (optional).
65
+
66
+ To configure Seq options, see `_SEQ_` environment variables.
67
+
68
+ To install Seq on your development machine
69
+ 1. Run `docker run --name seq -d --restart=always -e ACCEPT_EULA=Y -p 5341:80 datalust/seq:2024.2`
70
+ 2. Update your `LOGGING_SEQ_SERVERURL` environment variable to `http://localhost:5341` or `http://[YOUR MACHINE NAME].local:5341` if using WSL.
71
+
72
+ If creating an API key for Seq, only permission that is required is `Ingest`.
73
+
74
+ ## State management
75
+ Installations of your app and other state required for your app to function is stored in Redis. Another state provider can be swapped out for Redis, see `src/lib/state/seeka/installations.ts` for the file that manages the state of the installations.
76
+
77
+ ### Upstash (optional)
78
+ If you dont want to use Upstash for Redis then the connection strings in `.env` can be swapped with your Redis instance.
79
+
80
+ > If using Upstash then create a database before following the below guide to deploying your AWS lambda function.
81
+
82
+ > When choosing region - use a region that is closest to the Azure region that your function app is hosted in to reduce latency between the function and the Redis database.
83
+
84
+ ## Deployment
85
+ This project comes ready to deploy for free to Azure functions with database backed by Redis hosted by Upstash and queues, blobs and tables backed by Azure Storage.
86
+
87
+ 1. Create Azure function app via the portal with below settings
88
+ - Function app name: seeka-app-example-name
89
+ - Code or container image: Code
90
+ - Runtime stack: Node.js
91
+ - Version: 20
92
+ - Region: Closest region to where your upstash "master / write" database is located
93
+ - Operating system: linux
94
+ - Hosting: Consumption
95
+ - Enable public access: On
96
+ 2. Set environment variables of the Azure web app - reference local.settings.json "Values"
97
+ 3. If your app receives calls directly from the browser (eg. your browser app plugin) then CORS needs to be enabled for all origins from within the settings of the Function app in Azure portal.
98
+ 3. `yarn deploy`
99
+
100
+ ### Continuous delivery
101
+ This template includes a GitLab CD pipeline that can be used to trigger deployments of your app when changes are pushed to your Git repository.
102
+
103
+ ### Configuring queues
104
+ See [this article](https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue?tabs=isolated-process%2Cextensionv5%2Cextensionv3&pivots=programming-language-typescript#host-json) on settings that are settable in the `host.json` file.
105
+
106
+ ## References
107
+ - https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite
108
108
  - https://learn.microsoft.com/en-us/azure/storage/queues/storage-quickstart-queues-nodejs?tabs=connection-string%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli
@@ -1,5 +1,5 @@
1
- /** @type {import('ts-jest').JestConfigWithTsJest} */
2
- module.exports = {
3
- preset: 'ts-jest',
4
- testEnvironment: 'node',
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
2
+ module.exports = {
3
+ preset: 'ts-jest',
4
+ testEnvironment: 'node',
5
5
  };
@@ -1,49 +1,49 @@
1
- {
2
- "name": "seeka-app-example-name",
3
- "version": "0.0.1",
4
- "description": "Seeka example app for hosting on Azure serverless functions",
5
- "author": "Seeka <platform@seeka.co>",
6
- "license": "MIT",
7
- "main": "dist/src/functions/*.js",
8
- "private": true,
9
- "engines": {
10
- "node": ">=18.14.0"
11
- },
12
- "scripts": {
13
- "lint": "eslint",
14
- "build": "<packageManagerRunPrefix> clean && tsc",
15
- "watch": "tsc -w",
16
- "test": "<packageManagerRunPrefix> jest",
17
- "clean": "<packageManagerRunPrefix> rimraf dist",
18
- "prestart": "<packageManagerRunPrefix> clean && <packageManagerRunPrefix> build",
19
- "dev": "<packageManagerRunPrefix> build && func start --port 7072",
20
- "tunnel": "node scripts/ngrok.js seeka-app-example-name-localdev",
21
- "deploy": "<packageManagerRunPrefix> clean && <packageManagerRunPrefix> build && func azure functionapp publish seeka-app-example-name --no-build --javascript",
22
- "dev:queue:create": "node scripts/dev-queue-setup.js sample-queue-name"
23
- },
24
- "dependencies": {
25
- "@azure/functions": "^4.5.1",
26
- "@azure/storage-queue": "^12.24.0",
27
- "@datalust/winston-seq": "^2.0.0",
28
- "@seeka-labs/sdk-apps-server": "^1.1.7",
29
- "axios": "^1.7.7",
30
- "lodash-es": "^4.17.21",
31
- "openid-client": "^5.6.4",
32
- "redis": "^4.6.12",
33
- "winston": "^3.11.0"
34
- },
35
- "devDependencies": {
36
- "@jest/globals": "^29.7.0",
37
- "@types/lodash-es": "^4.17.12",
38
- "@types/node": "^18",
39
- "@typescript-eslint/eslint-plugin": "^6.19.1",
40
- "@typescript-eslint/parser": "^6.19.1",
41
- "azure-functions-core-tools": "^4.x",
42
- "eslint": "^8",
43
- "jest": "^29.7.0",
44
- "ts-jest": "^29.1.5",
45
- "ngrok": "^5.0.0-beta.2",
46
- "rimraf": "^5.0.0",
47
- "typescript": "^4.1.6"
48
- }
1
+ {
2
+ "name": "seeka-app-example-name",
3
+ "version": "0.0.1",
4
+ "description": "Seeka example app for hosting on Azure serverless functions",
5
+ "author": "Seeka <platform@seeka.co>",
6
+ "license": "MIT",
7
+ "main": "dist/src/functions/*.js",
8
+ "private": true,
9
+ "engines": {
10
+ "node": ">=20"
11
+ },
12
+ "scripts": {
13
+ "lint": "eslint",
14
+ "build": "<packageManagerRunPrefix> clean && tsc",
15
+ "watch": "tsc -w",
16
+ "test": "<packageManagerRunPrefix> jest",
17
+ "clean": "<packageManagerRunPrefix> rimraf dist",
18
+ "prestart": "<packageManagerRunPrefix> clean && <packageManagerRunPrefix> build",
19
+ "dev": "<packageManagerRunPrefix> build && func start --port 7072",
20
+ "tunnel": "node scripts/ngrok.js seeka-app-example-name-localdev",
21
+ "deploy": "<packageManagerRunPrefix> clean && <packageManagerRunPrefix> build && func azure functionapp publish seeka-app-example-name --no-build --javascript",
22
+ "dev:queue:create": "node scripts/dev-queue-setup.js sample-queue-name"
23
+ },
24
+ "dependencies": {
25
+ "@azure/functions": "^4.6.0",
26
+ "@azure/storage-queue": "^12.25.0",
27
+ "@datalust/winston-seq": "^2.0.0",
28
+ "@seeka-labs/sdk-apps-server": "^1.1.18",
29
+ "axios": "^1.7.8",
30
+ "lodash-es": "^4.17.21",
31
+ "openid-client": "^5.7.1",
32
+ "redis": "^4.7.0",
33
+ "winston": "^3.17.0"
34
+ },
35
+ "devDependencies": {
36
+ "@jest/globals": "^29.7.0",
37
+ "@types/lodash-es": "^4.17.12",
38
+ "@types/node": "^20",
39
+ "@typescript-eslint/eslint-plugin": "^8.16.0",
40
+ "@typescript-eslint/parser": "^8.16.0",
41
+ "azure-functions-core-tools": "^4.x",
42
+ "eslint": "^9",
43
+ "jest": "^29.7.0",
44
+ "ts-jest": "^29.2.5",
45
+ "ngrok": "^5.0.0-beta.2",
46
+ "rimraf": "^5.0.0",
47
+ "typescript": "^5.7.2"
48
+ }
49
49
  }
@@ -1,30 +1,30 @@
1
- /* eslint-disable @typescript-eslint/no-var-requires */
2
- /* eslint-disable no-undef */
3
- const { QueueClient } = require("@azure/storage-queue");
4
-
5
- (async function () {
6
- // https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio%2Cqueue-storage#azure-sdks
7
- // Dev / emulator / azurite
8
- var client = new QueueClient(
9
- `UseDevelopmentStorage=true`, process.argv[2]
10
- );
11
- const res = await client.createIfNotExists();
12
- if (res.succeeded) {
13
- console.log("Queue created");
14
- }
15
- else {
16
- console.log("Queue already exists");
17
- }
18
-
19
- // // https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue-trigger?tabs=python-v2%2Cisolated-process%2Cnodejs-v4%2Cextensionv5&pivots=programming-language-typescript#poison-messages
20
- var poisonClient = new QueueClient(
21
- `UseDevelopmentStorage=true`, `${process.argv[2]}-poison`
22
- );
23
- const resPoison = await poisonClient.createIfNotExists();
24
- if (resPoison.succeeded) {
25
- console.log("Poison queue created");
26
- }
27
- else {
28
- console.log("Poison queue already exists");
29
- }
1
+ /* eslint-disable @typescript-eslint/no-var-requires */
2
+ /* eslint-disable no-undef */
3
+ const { QueueClient } = require("@azure/storage-queue");
4
+
5
+ (async function () {
6
+ // https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio%2Cqueue-storage#azure-sdks
7
+ // Dev / emulator / azurite
8
+ var client = new QueueClient(
9
+ `UseDevelopmentStorage=true`, process.argv[2]
10
+ );
11
+ const res = await client.createIfNotExists();
12
+ if (res.succeeded) {
13
+ console.log("Queue created");
14
+ }
15
+ else {
16
+ console.log("Queue already exists");
17
+ }
18
+
19
+ // // https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue-trigger?tabs=python-v2%2Cisolated-process%2Cnodejs-v4%2Cextensionv5&pivots=programming-language-typescript#poison-messages
20
+ var poisonClient = new QueueClient(
21
+ `UseDevelopmentStorage=true`, `${process.argv[2]}-poison`
22
+ );
23
+ const resPoison = await poisonClient.createIfNotExists();
24
+ if (resPoison.succeeded) {
25
+ console.log("Poison queue created");
26
+ }
27
+ else {
28
+ console.log("Poison queue already exists");
29
+ }
30
30
  })();
@@ -1,14 +1,14 @@
1
- import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions';
2
-
3
- app.http('healthCheck', {
4
- methods: ['GET', 'HEAD'],
5
- authLevel: 'anonymous',
6
- route: 'health',
7
- handler: healthCheck
8
- });
9
-
10
- export async function healthCheck(req: HttpRequest, context: InvocationContext): Promise<HttpResponseInit> {
11
- return {
12
- status: 200
13
- }
1
+ import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions';
2
+
3
+ app.http('healthCheck', {
4
+ methods: ['GET', 'HEAD'],
5
+ authLevel: 'anonymous',
6
+ route: 'health',
7
+ handler: healthCheck
8
+ });
9
+
10
+ export async function healthCheck(req: HttpRequest, context: InvocationContext): Promise<HttpResponseInit> {
11
+ return {
12
+ status: 200
13
+ }
14
14
  }