@seeka-labs/cli-apps 3.8.10 → 3.9.1

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 (71) hide show
  1. package/dist/index.cjs +821 -612
  2. package/dist/init-template.zip +0 -0
  3. package/package.json +3 -2
  4. package/dist/ai-context/common/README.md +0 -110
  5. package/dist/ai-context/common/architecture/overview.md +0 -140
  6. package/dist/ai-context/common/guides/common-patterns.md +0 -471
  7. package/dist/ai-context/common/guides/data-flow.md +0 -455
  8. package/dist/ai-context/common/guides/getting-started.md +0 -349
  9. package/dist/ai-context/common/guides/testing.md +0 -592
  10. package/dist/ai-context/common/reference/cli-commands.md +0 -231
  11. package/dist/ai-context/common/reference/config-schema.md +0 -345
  12. package/dist/ai-context/common/reference/sdk-api.md +0 -445
  13. package/dist/ai-context/public/architecture/app-structure.md +0 -385
  14. package/dist/index.cjs.map +0 -7
  15. package/dist/init-template/.github/workflows/deploy-azurefunc.yml +0 -198
  16. package/dist/init-template/.gitlab-ci.yml +0 -67
  17. package/dist/init-template/.nvmrc +0 -1
  18. package/dist/init-template/AGENTS.md +0 -99
  19. package/dist/init-template/README.azurefunc.md +0 -238
  20. package/dist/init-template/app/.eslintrc.cjs +0 -13
  21. package/dist/init-template/app/browser/README.md +0 -1
  22. package/dist/init-template/app/browser/package.json +0 -36
  23. package/dist/init-template/app/browser/scripts/esbuild/build-browser-plugin.mjs +0 -130
  24. package/dist/init-template/app/browser/scripts/esbuild/plugins/importAsGlobals.mjs +0 -39
  25. package/dist/init-template/app/browser/src/browser.ts +0 -12
  26. package/dist/init-template/app/browser/src/plugin/index.ts +0 -61
  27. package/dist/init-template/app/browser/tsconfig.json +0 -34
  28. package/dist/init-template/app/lib/package.json +0 -46
  29. package/dist/init-template/app/lib/src/index.ts +0 -4
  30. package/dist/init-template/app/lib/src/models/index.ts +0 -29
  31. package/dist/init-template/app/lib/src/validation/index.ts +0 -14
  32. package/dist/init-template/app/lib/tsconfig.json +0 -22
  33. package/dist/init-template/app/server-azurefunc/.eslintrc.cjs +0 -4
  34. package/dist/init-template/app/server-azurefunc/.funcignore +0 -20
  35. package/dist/init-template/app/server-azurefunc/README.md +0 -105
  36. package/dist/init-template/app/server-azurefunc/host.json +0 -31
  37. package/dist/init-template/app/server-azurefunc/local.settings.template.json +0 -30
  38. package/dist/init-template/app/server-azurefunc/package.json +0 -68
  39. package/dist/init-template/app/server-azurefunc/scripts/build.mjs +0 -67
  40. package/dist/init-template/app/server-azurefunc/scripts/dev-queue-setup.js +0 -55
  41. package/dist/init-template/app/server-azurefunc/src/app/api/router.ts +0 -15
  42. package/dist/init-template/app/server-azurefunc/src/app/api/routes/getInstallationSettings.ts +0 -13
  43. package/dist/init-template/app/server-azurefunc/src/app/api/routes/setInstallationSettings.ts +0 -35
  44. package/dist/init-template/app/server-azurefunc/src/app/jobs/index.ts +0 -61
  45. package/dist/init-template/app/server-azurefunc/src/app/logging/index.ts +0 -4
  46. package/dist/init-template/app/server-azurefunc/src/app/models/index.ts +0 -12
  47. package/dist/init-template/app/server-azurefunc/src/app/services/activites.ts +0 -8
  48. package/dist/init-template/app/server-azurefunc/src/functions/healthCheck.ts +0 -19
  49. package/dist/init-template/app/server-azurefunc/src/functions/seekaAppWebhook.ts +0 -204
  50. package/dist/init-template/app/server-azurefunc/src/functions/trackActivityQueueHandler.ts +0 -48
  51. package/dist/init-template/app/server-azurefunc/src/functions/ui.ts +0 -49
  52. package/dist/init-template/app/server-azurefunc/tsconfig.json +0 -24
  53. package/dist/init-template/app/ui/README.md +0 -40
  54. package/dist/init-template/app/ui/index.html +0 -21
  55. package/dist/init-template/app/ui/package.json +0 -72
  56. package/dist/init-template/app/ui/public/favicon.ico +0 -0
  57. package/dist/init-template/app/ui/scripts/copy-output.mjs +0 -30
  58. package/dist/init-template/app/ui/src/App.tsx +0 -72
  59. package/dist/init-template/app/ui/src/assets/app-icon.svg +0 -1
  60. package/dist/init-template/app/ui/src/components/setup/steps/complete/index.tsx +0 -32
  61. package/dist/init-template/app/ui/src/components/setup/steps/first/index.tsx +0 -27
  62. package/dist/init-template/app/ui/src/components/setup/steps/index.tsx +0 -22
  63. package/dist/init-template/app/ui/src/components/setup/steps/second/index.tsx +0 -38
  64. package/dist/init-template/app/ui/src/index.tsx +0 -45
  65. package/dist/init-template/app/ui/src/routes/home/index.tsx +0 -21
  66. package/dist/init-template/app/ui/src/vite-env.d.ts +0 -13
  67. package/dist/init-template/app/ui/tsconfig.json +0 -35
  68. package/dist/init-template/app/ui/tsconfig.node.json +0 -10
  69. package/dist/init-template/app/ui/vite.config.mts +0 -48
  70. package/dist/init-template/package.json +0 -46
  71. package/dist/init-template/tsconfig.json +0 -24
@@ -1,130 +0,0 @@
1
- import { typecheckPlugin } from '@jgoz/esbuild-plugin-typecheck';
2
- import { build, context, version } from 'esbuild';
3
- import { copyFileSync, existsSync, mkdirSync } from 'fs';
4
- import { resolve } from 'path';
5
- import * as watch from 'watch';
6
- import { importAsGlobals } from './plugins/importAsGlobals.mjs';
7
-
8
- console.log('esbuild version:', version);
9
-
10
- if (process.argv.length < 3) {
11
- throw new Error('Missing arg');
12
- }
13
-
14
- const pluginName = process.argv[2];
15
-
16
- const mode = process.argv.length > 4 ? process.argv[4] : 'prod';
17
- const watchBuild = process.argv.length > 5 ? process.argv[5] == 'watch' : false;
18
-
19
- console.log('mode:', mode);
20
- console.log('watchBuild:', process.argv[4]);
21
-
22
- const opts = {
23
- entryPoints: ['src/browser.ts'],
24
- bundle: true,
25
- metafile: true,
26
- minify: mode === 'dev' ? false : true,
27
- format: 'iife',
28
- platform: 'browser',
29
- //sourcemap: 'external',
30
- sourcemap: mode === 'dev' ? true : false,
31
- external: ['@seeka-labs/converge'],
32
- outfile: `dist/${pluginName}.min.js`,
33
- plugins: [
34
- importAsGlobals({
35
- "@seeka-labs/converge": "SeekaConvergeCore"
36
- }),
37
- typecheckPlugin()
38
- ]
39
- }
40
-
41
- const postBuild = () => {
42
- // Copy outfile to ../dist/src/browser
43
- const serverDirNames = ['server-azurefunc']
44
-
45
- serverDirNames.forEach(dirName => {
46
- if (existsSync(resolve(`../${dirName}`))) {
47
-
48
- if (!existsSync(resolve(`../${dirName}/dist/src/browser`))) {
49
- mkdirSync(resolve(`../${dirName}/dist/src/browser`), {
50
- recursive: true,
51
- });
52
- }
53
-
54
- copyFileSync(resolve(opts.outfile), resolve(`../${dirName}/dist/src/browser`, `${pluginName}.min.js`))
55
- }
56
- })
57
- }
58
-
59
- if (watchBuild) {
60
- const ctx = await context(opts);
61
-
62
- async function buildWatch() {
63
- await ctx.rebuild();
64
- postBuild();
65
- console.log('build succeeded');
66
- }
67
-
68
- await buildWatch();
69
-
70
- // Start watch
71
- let monitorInstance;
72
- watch.createMonitor(resolve('./src'), function (monitor) {
73
- console.log('watching ./src, press any key to exit');
74
- monitorInstance = monitor;
75
-
76
- monitor.on("created", async function (f, stat) {
77
- console.log('rebuilding due to file created', f)
78
- try {
79
- await buildWatch();
80
- }
81
- catch (e) {
82
- console.error(e);
83
- }
84
- })
85
- monitor.on("changed", async function (f, curr, prev) {
86
- console.log('rebuilding due to file changed', f)
87
- try {
88
- await buildWatch();
89
- }
90
- catch (e) {
91
- console.error(e);
92
- }
93
- })
94
- monitor.on("removed", async function (f, stat) {
95
- console.log('rebuilding due to file deleted', f)
96
- try {
97
- await buildWatch();
98
- }
99
- catch (e) {
100
- console.error(e);
101
- }
102
- })
103
- })
104
-
105
- // Support stopping
106
- const stopWatch = () => {
107
- console.log('Stopping watch...');
108
- try {
109
- monitorInstance?.stop();
110
- }
111
- finally {
112
- process.exit();
113
- }
114
- };
115
-
116
- process.on('SIGINT', stopWatch);
117
- process.on('SIGTERM', stopWatch);
118
-
119
- const stdin = process.stdin;
120
- if (stdin?.isTTY && typeof stdin.setRawMode === 'function') {
121
- stdin.setRawMode(true);
122
- stdin.resume();
123
- stdin.setEncoding('utf8');
124
- stdin.on('data', stopWatch);
125
- }
126
- }
127
- else {
128
- await build(opts);
129
- postBuild();
130
- }
@@ -1,39 +0,0 @@
1
- export function importAsGlobals(mapping) {
2
- // https://github.com/evanw/esbuild/issues/337
3
- // https://stackoverflow.com/a/3561711/153718
4
- const escRe = (s) => s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
5
- const filter = new RegExp(
6
- Object.keys(mapping)
7
- .map((mod) => `^${escRe(mod)}$`)
8
- .join("|"),
9
- );
10
-
11
- return {
12
- name: "global-imports",
13
- setup(build) {
14
- build.onResolve({ filter }, (args) => {
15
- if (!mapping[args.path]) {
16
- throw new Error("Unknown global: " + args.path);
17
- }
18
- return {
19
- path: args.path,
20
- namespace: "external-global",
21
- };
22
- });
23
-
24
- build.onLoad(
25
- {
26
- filter,
27
- namespace: "external-global",
28
- },
29
- async (args) => {
30
- const global = mapping[args.path];
31
- return {
32
- contents: `module.exports = ${global};`,
33
- loader: "js",
34
- };
35
- },
36
- );
37
- },
38
- };
39
- }
@@ -1,12 +0,0 @@
1
- import { ExampleAppAppBrowserSdkPluginConfig } from "@example-org-name/example-app-name-lib";
2
- import { ExampleAppAppConvergeSdkPlugin } from "./plugin";
3
-
4
- declare global {
5
- interface Window {
6
- ExampleAppAppConvergeSdkPlugin: (pluginConfig: ExampleAppAppBrowserSdkPluginConfig) => ExampleAppAppConvergeSdkPlugin;
7
- }
8
- }
9
-
10
- (window as Window).ExampleAppAppConvergeSdkPlugin = (pluginConfig: ExampleAppAppBrowserSdkPluginConfig) => {
11
- return new ExampleAppAppConvergeSdkPlugin(pluginConfig);
12
- };
@@ -1,61 +0,0 @@
1
- import {
2
- ConvergeSdk,
3
- type IActivityCommonProps,
4
- type IActivityMetadataProps,
5
- type IConvergePlugin,
6
- type PersonIdentifiers,
7
- TrackingActivityNames
8
- } from '@seeka-labs/converge';
9
-
10
- import type {ExampleAppAppBrowserSdkPluginConfig} from '@example-org-name/example-app-name-lib';
11
-
12
- import {version} from '../../package.json';
13
-
14
- export class ExampleAppAppConvergeSdkPlugin implements IConvergePlugin<ExampleAppAppBrowserSdkPluginConfig> {
15
- constructor(pluginConfig: ExampleAppAppBrowserSdkPluginConfig) {
16
- this.type = "seeka-app-example-app-name";
17
- this.name = this.type + "-" + pluginConfig.appInstallId;
18
- this.version = version;
19
- this.sdk = {} as ConvergeSdk;
20
- this.config = pluginConfig || {};
21
- }
22
-
23
- sdk: ConvergeSdk;
24
-
25
- privacyConfig = {
26
- // TODO
27
- requiresIabPurposes: []
28
- }
29
-
30
- name: string;
31
- type: string;
32
- version: string;
33
- config: ExampleAppAppBrowserSdkPluginConfig;
34
-
35
- async beforeInit(): Promise<void> {
36
-
37
- }
38
-
39
- async activity(name: TrackingActivityNames, props?: IActivityCommonProps, metadata?: IActivityMetadataProps): Promise<void> {
40
- this.sdk.debug.log(`ExampleApp - Listened to activity ${name} that was fired by Seeka with props`, {props, metadata});
41
- }
42
-
43
- async collectIdentifiers(): Promise<PersonIdentifiers | undefined> {
44
- const data = {
45
- google: {
46
- gclid: [] as string[]
47
- }
48
- };
49
-
50
- this.sdk.debug.verbose('ExampleApp - collected identifiers', data);
51
-
52
- return data;
53
- }
54
-
55
- async init(_params: any): Promise<void> {
56
- }
57
-
58
- isLoaded(): boolean {
59
- return true;
60
- }
61
- }
@@ -1,34 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "allowJs": false,
4
- "target": "ESNext",
5
- "module": "ESNext",
6
- "resolveJsonModule": true,
7
- "moduleResolution": "node",
8
- "noEmit": true,
9
- "strict": true,
10
- "noImplicitAny": false,
11
- "strictNullChecks": true,
12
- "strictFunctionTypes": true,
13
- "noUnusedLocals": false,
14
- "noUnusedParameters": false,
15
- "noImplicitReturns": true,
16
- "noFallthroughCasesInSwitch": true,
17
- "importHelpers": true,
18
- "skipLibCheck": true,
19
- "esModuleInterop": true,
20
- "allowSyntheticDefaultImports": true,
21
- "experimentalDecorators": true,
22
- "sourceMap": true,
23
- "types": [
24
- "node"
25
- ],
26
- "lib": [
27
- "ES6",
28
- "DOM"
29
- ]
30
- },
31
- "include": [
32
- "src/browser.ts",
33
- ]
34
- }
@@ -1,46 +0,0 @@
1
- {
2
- "name": "@example-org-name/example-app-name-lib",
3
- "version": "3.8.10",
4
- "description": "Seeka app library for example-app-name",
5
- "author": "Seeka <administrator@seeka.co>",
6
- "license": "MIT",
7
- "private": true,
8
- "files": [
9
- "dist/"
10
- ],
11
- "types": "./dist/lib/types/index.d.ts",
12
- "source": "src/index.ts",
13
- "main": "./dist/lib/example-app-name-lib.module.js",
14
- "module": "./dist/lib/example-app-name-lib.module.js",
15
- "devDependencies": {
16
- "@seeka-labs/sdk-apps-core": "../../../workspace:* || ^3",
17
- "@seeka-labs/sdk-apps-server": "../../../workspace:* || ^3",
18
- "@types/lodash-es": "^4",
19
- "@types/node": "^22",
20
- "axios": "^1",
21
- "esbuild": "^0",
22
- "lodash-es": "^4",
23
- "memory-cache": "^0",
24
- "openid-client": "^6",
25
- "rimraf": "^6",
26
- "typescript": "^5",
27
- "undici": "^7",
28
- "winston": "^3",
29
- "zod": "^4"
30
- },
31
- "peerDependencies": {
32
- "@seeka-labs/sdk-apps-core": "^3",
33
- "@seeka-labs/sdk-apps-server": "^3",
34
- "axios": "^1",
35
- "lodash-es": "^4",
36
- "undici": "^7",
37
- "zod": "^4"
38
- },
39
- "scripts": {
40
- "clean": "rimraf build package dist",
41
- "typecheck": "tsc --noEmit",
42
- "build": "yarn esbuild src/index.ts --outfile=dist/lib/example-app-name-lib.module.js --bundle --analyze --platform=node --format=esm --packages=external --minify && yarn tsc --emitDeclarationOnly",
43
- "dev": "yarn esbuild src/index.ts --outfile=dist/lib/example-app-name-lib.module.js --bundle --analyze --platform=node --format=esm --packages=external --sourcemap && yarn tsc --emitDeclarationOnly",
44
- "watch": "yarn esbuild src/index.ts --outfile=dist/lib/example-app-name-lib.module.js --bundle --platform=node --format=esm --packages=external --sourcemap --watch"
45
- }
46
- }
@@ -1,4 +0,0 @@
1
-
2
- export * from './models';
3
- export * from './validation';
4
-
@@ -1,29 +0,0 @@
1
- import { SeekaAppUiClientInitConfig} from '@seeka-labs/sdk-apps-core'
2
- import {SeekaAppInstallContext} from "@seeka-labs/sdk-apps-core";
3
-
4
- export interface ExampleAppAppBrowserSdkPluginConfig {
5
- appId: string
6
- appInstallId: string
7
- appUrl: string
8
- installationSettings: {
9
- browserPluginAppSetting1?: string | null
10
- }
11
- }
12
-
13
- export type ExampleAppAppInstallSettings = {
14
- exampleInstallSetting1?: string | null
15
- exampleInstallSetting2?: number | null
16
- browserPluginAppSetting1?: string | null
17
- }
18
-
19
- export type ExampleAppAppUiClientInitState = {
20
- exampleInstallSetting1?: string | null
21
- }
22
-
23
- export interface ExampleAppAppInstallState {
24
- installationSettings?: ExampleAppAppInstallSettings
25
- }
26
-
27
- export type ExampleAppAppInstallContext = SeekaAppInstallContext<ExampleAppAppInstallState>
28
-
29
- export type ExampleAppAppUiClientInitConfig = SeekaAppUiClientInitConfig<ExampleAppAppUiClientInitState>
@@ -1,14 +0,0 @@
1
- import type {Logger} from "winston";
2
- import {ExampleAppAppInstallSettings} from "../models";
3
-
4
- // TODO: Use Zod
5
- export const validateInstallationSettings = async (installSettings: ExampleAppAppInstallSettings, logger: Logger): Promise<string | null> => {
6
- // Returning an error message string here will block the installation request or settings update request by the user installing the app
7
-
8
- if(!installSettings) return null;
9
-
10
- if(installSettings.exampleInstallSetting2 && installSettings.exampleInstallSetting2 < 2) return 'Example install setting 2 must be greater than 2';
11
-
12
-
13
- return null;
14
- }
@@ -1,22 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "module": "ESNext",
5
- "lib": ["ESNext"],
6
- "declarationDir": "./dist/lib/types",
7
- "declarationMap": true,
8
- "allowJs": true,
9
- "skipLibCheck": true,
10
- "esModuleInterop": true,
11
- "allowSyntheticDefaultImports": true,
12
- "strict": true,
13
- "forceConsistentCasingInFileNames": true,
14
- "noFallthroughCasesInSwitch": true,
15
- "removeComments": true,
16
- "moduleResolution": "node",
17
- "resolveJsonModule": true,
18
- "isolatedModules": true,
19
- "declaration": true
20
- },
21
- "include": ["src"]
22
- }
@@ -1,4 +0,0 @@
1
- /* eslint-env node */
2
- module.exports = {
3
- extends: ['../.eslintrc.cjs']
4
- };
@@ -1,20 +0,0 @@
1
- *.ts
2
- local.settings.json
3
- test
4
- scripts/
5
- src/
6
- README.md
7
- tsconfig.json
8
- .eslintrc.cjs
9
- .yarn
10
-
11
- node_modules/@types/
12
- node_modules/@typescript-eslint/eslint-plugin/
13
- node_modules/@typescript-eslint/parser/
14
- node_modules/azure-functions-core-tools/
15
- node_modules/eslint/
16
- node_modules/ngrok/
17
- node_modules/rimraf/
18
- node_modules/typescript/
19
-
20
- .gitignore
@@ -1,105 +0,0 @@
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 example 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://example-app-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: example-app-name
89
- - Code or container image: Code
90
- - Runtime stack: Node.js
91
- - Version: 22 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
- ## References
104
- - https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite
105
- - 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,31 +0,0 @@
1
- {
2
- "version": "2.0",
3
- "logging": {
4
- "applicationInsights": {
5
- "samplingSettings": {
6
- "isEnabled": true,
7
- "excludedTypes": "Request"
8
- }
9
- }
10
- },
11
- "extensions": {
12
- "http": {
13
- "routePrefix": ""
14
- },
15
- "queues": {
16
- "batchSize": 32,
17
- "newBatchThreshold": 8,
18
- "maxDequeueCount": 1,
19
- "visibilityTimeout": "00:00:30"
20
- }
21
- },
22
- "functionTimeout": "00:10:00",
23
- "extensionBundle": {
24
- "id": "Microsoft.Azure.Functions.ExtensionBundle",
25
- "version": "[4.*, 5.0.0)"
26
- },
27
- "concurrency": {
28
- "dynamicConcurrencyEnabled": true,
29
- "snapshotPersistenceEnabled": true
30
- }
31
- }
@@ -1,30 +0,0 @@
1
- {
2
- "IsEncrypted": false,
3
- "Host": {
4
- "CORS": "*"
5
- },
6
- "Values": {
7
- "SEEKA_DEBUG_ENABLED": "true",
8
- "NODE_TLS_REJECT_UNAUTHORIZED": "0",
9
- "REDIS_CONNECTION_USER": "default",
10
- "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT": "",
11
- "OTEL_EXPORTER_OTLP_LOGS_HEADERS": "",
12
- "SEEKA_INGEST_URL": "",
13
- "SEEKA_ISSUER_URL": "",
14
- "SEEKA_APP_ID": "",
15
- "SEEKA_APP_SECRET": "",
16
- "REDIS_CONNECTION_HOST": "localhost",
17
- "REDIS_CONNECTION_PASSWORD": "",
18
- "SEEKA_TELEMETRY_URL": "",
19
- "REDIS_CONNECTION_PORT": "6379",
20
- "REDIS_CONNECTION_TLS": "false",
21
- "OTEL_LOG_LEVEL": "info",
22
- "LOGGING_LEVEL": "silly",
23
- "SELF_HOST_BASEURL": "",
24
- "APP_UI_BASE_PATH": "",
25
- "OTEL_TRACES_EXPORTER": "none",
26
- "OTEL_METRICS_EXPORTER": "none",
27
- "OTEL_LOGS_EXPORTER": "none",
28
- "OTEL_PROPAGATORS": "none"
29
- }
30
- }
@@ -1,68 +0,0 @@
1
- {
2
- "name": "@example-org-name/example-app-name-server-azurefunc",
3
- "version": "3.8.10",
4
- "description": "Seeka Azure Serverless function app example-app-name",
5
- "author": "Seeka <administrator@seeka.co>",
6
- "license": "MIT",
7
- "main": "dist/src/functions/*.js",
8
- "private": true,
9
- "engines": {
10
- "node": "^22"
11
- },
12
- "scripts": {
13
- "lint": "eslint",
14
- "typecheck": "tsc --noEmit",
15
- "build": "node ./scripts/build.mjs",
16
- "watch": "node ./scripts/build.mjs --watch",
17
- "clean": "rimraf dist",
18
- "prestart": "echo 'pre starting' && yarn build",
19
- "dev": "func start --port 7072",
20
- "tunnel": "ngrok http 7072 --hostname=seeka-app-example-app-name-localdev.au.ngrok.io --region au --log=stdout --log-format=term",
21
- "deploy": "func azure functionapp publish example-app-name --no-build --javascript",
22
- "dev:queue:create": "node scripts/dev-queue-setup.js activity-track-queue && node scripts/dev-queue-setup.js activity-track-queue-poison"
23
- },
24
- "dependencies": {
25
- "@azure/functions": "^4",
26
- "@azure/storage-queue": "^12",
27
- "@example-org-name/example-app-name-lib": "workspace:*",
28
- "@opentelemetry/api": "^1",
29
- "@opentelemetry/exporter-logs-otlp-proto": "^0",
30
- "@opentelemetry/exporter-trace-otlp-proto": "^0",
31
- "@opentelemetry/instrumentation-grpc": "^0",
32
- "@opentelemetry/instrumentation-http": "^0",
33
- "@opentelemetry/instrumentation-ioredis": "^0",
34
- "@opentelemetry/instrumentation-net": "^0",
35
- "@opentelemetry/instrumentation-undici": "^0",
36
- "@opentelemetry/instrumentation-winston": "^0",
37
- "@opentelemetry/sdk-node": "^0",
38
- "@opentelemetry/sdk-trace-node": "^2",
39
- "@opentelemetry/winston-transport": "^0",
40
- "@redis/client": "^5",
41
- "@redis/json": "^5",
42
- "@seeka-labs/sdk-apps-core": "../../../workspace:* || ^3",
43
- "@seeka-labs/sdk-apps-server": "../../../workspace:* || ^3",
44
- "@seeka-labs/sdk-apps-server-host": "../../../workspace:* || ^3",
45
- "@seeka-labs/sdk-apps-server-telemetry-core": "../../../workspace:* || ^3",
46
- "@seeka-labs/sdk-apps-server-telemetry-logging": "../../../workspace:* || ^3",
47
- "axios": "^1",
48
- "jsonwebtoken": "^9",
49
- "jwt-decode": "^4",
50
- "lodash-es": "^4",
51
- "memory-cache": "^0",
52
- "openid-client": "^6",
53
- "redis": "^5",
54
- "undici": "^7",
55
- "winston": "^3",
56
- "yup": "^1"
57
- },
58
- "devDependencies": {
59
- "@types/jsonwebtoken": "^9",
60
- "@types/lodash-es": "^4",
61
- "@types/node": "^22",
62
- "@typescript-eslint/eslint-plugin": "^8",
63
- "@typescript-eslint/parser": "^8",
64
- "eslint": "^9",
65
- "rimraf": "^6",
66
- "typescript": "^5"
67
- }
68
- }