@seeka-labs/cli-apps 2.2.5 → 3.2.3

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 (72) hide show
  1. package/dist/index.js +46919 -35
  2. package/dist/index.js.map +4 -4
  3. package/dist/init-template/.gitlab-ci.yml +29 -8
  4. package/dist/init-template/.nvmrc +1 -0
  5. package/dist/init-template/README.md +18 -3
  6. package/dist/init-template/app/{server-azure-function/.eslintrc.cjs → .eslintrc.cjs} +2 -0
  7. package/dist/init-template/app/browser/README.md +1 -1
  8. package/dist/init-template/app/browser/package.json +22 -24
  9. package/dist/init-template/app/browser/scripts/esbuild/build-browser-plugin.mjs +14 -6
  10. package/dist/init-template/app/browser/src/browser.ts +6 -6
  11. package/dist/init-template/app/browser/src/plugin/index.ts +57 -44
  12. package/dist/init-template/app/browser/tsconfig.json +1 -2
  13. package/dist/init-template/app/lib/package.json +46 -0
  14. package/dist/init-template/app/lib/src/index.ts +4 -0
  15. package/dist/init-template/app/lib/src/models/index.ts +29 -0
  16. package/dist/init-template/app/lib/src/validation/index.ts +14 -0
  17. package/dist/init-template/app/lib/tsconfig.json +22 -0
  18. package/dist/init-template/app/server-azurefunc/.eslintrc.cjs +4 -0
  19. package/dist/init-template/app/{server-azure-function → server-azurefunc}/.funcignore +0 -3
  20. package/dist/init-template/app/{server-azure-function → server-azurefunc}/README.md +3 -3
  21. package/dist/init-template/app/{server-azure-function → server-azurefunc}/host.json +11 -0
  22. package/dist/init-template/app/server-azurefunc/package.json +69 -0
  23. package/dist/init-template/app/server-azurefunc/scripts/dev-queue-setup.js +18 -0
  24. package/dist/init-template/app/{server-azure-function → server-azurefunc}/scripts/ngrok.js +4 -1
  25. package/dist/init-template/app/server-azurefunc/src/app/api/router.ts +14 -0
  26. package/dist/init-template/app/server-azurefunc/src/app/api/routes/getInstallationSettings.ts +13 -0
  27. package/dist/init-template/app/server-azurefunc/src/app/api/routes/setInstallationSettings.ts +35 -0
  28. package/dist/init-template/app/server-azurefunc/src/app/jobs/index.ts +61 -0
  29. package/dist/init-template/app/server-azurefunc/src/app/logging/index.ts +4 -0
  30. package/dist/init-template/app/server-azurefunc/src/app/models/index.ts +12 -0
  31. package/dist/init-template/app/server-azurefunc/src/app/services/activites.ts +8 -0
  32. package/dist/init-template/app/{server-azure-function → server-azurefunc}/src/functions/healthCheck.ts +7 -1
  33. package/dist/init-template/app/server-azurefunc/src/functions/seekaAppWebhook.ts +201 -0
  34. package/dist/init-template/app/server-azurefunc/src/functions/trackActivityQueueHandler.ts +48 -0
  35. package/dist/init-template/app/server-azurefunc/src/functions/ui.ts +46 -0
  36. package/dist/init-template/app/{server-azure-function/local.settings.example.json → server-azurefunc/template.settings.json} +18 -10
  37. package/dist/init-template/app/{server-azure-function → server-azurefunc}/tsconfig.json +8 -2
  38. package/dist/init-template/app/ui/.env +9 -0
  39. package/dist/init-template/app/ui/README.md +40 -0
  40. package/dist/init-template/app/ui/index.html +21 -0
  41. package/dist/init-template/app/ui/package.json +72 -0
  42. package/dist/init-template/app/ui/public/favicon.ico +0 -0
  43. package/dist/init-template/app/ui/scripts/copy-output.mjs +30 -0
  44. package/dist/init-template/app/ui/src/App.tsx +72 -0
  45. package/dist/init-template/app/ui/src/assets/app-icon.svg +1 -0
  46. package/dist/init-template/app/ui/src/components/setup/steps/complete/index.tsx +32 -0
  47. package/dist/init-template/app/ui/src/components/setup/steps/first/index.tsx +27 -0
  48. package/dist/init-template/app/ui/src/components/setup/steps/index.tsx +22 -0
  49. package/dist/init-template/app/ui/src/components/setup/steps/second/index.tsx +29 -0
  50. package/dist/init-template/app/ui/src/index.tsx +45 -0
  51. package/dist/init-template/app/ui/src/routes/home/index.tsx +21 -0
  52. package/dist/init-template/app/ui/src/vite-env.d.ts +13 -0
  53. package/dist/init-template/app/ui/tsconfig.json +35 -0
  54. package/dist/init-template/app/ui/tsconfig.node.json +10 -0
  55. package/dist/init-template/app/ui/vite.config.mts +48 -0
  56. package/dist/init-template/package.json +19 -11
  57. package/dist/init-template/tsconfig.json +5 -6
  58. package/package.json +13 -4
  59. package/dist/init-template/app/browser/jest.config.js +0 -11
  60. package/dist/init-template/app/browser/src/plugin/index.test.ts +0 -6
  61. package/dist/init-template/app/server-azure-function/.nvmrc +0 -1
  62. package/dist/init-template/app/server-azure-function/package.json +0 -51
  63. package/dist/init-template/app/server-azure-function/src/functions/pollingExample.ts +0 -39
  64. package/dist/init-template/app/server-azure-function/src/functions/queueExample.ts +0 -67
  65. package/dist/init-template/app/server-azure-function/src/functions/seekaAppWebhook.ts +0 -236
  66. package/dist/init-template/app/server-azure-function/src/lib/browser/index.ts +0 -55
  67. package/dist/init-template/app/server-azure-function/src/lib/jobs/index.ts +0 -96
  68. package/dist/init-template/app/server-azure-function/src/lib/logging/index.ts +0 -93
  69. package/dist/init-template/app/server-azure-function/src/lib/models/index.ts +0 -7
  70. package/dist/init-template/app/server-azure-function/src/lib/services/index.ts +0 -41
  71. package/dist/init-template/app/server-azure-function/src/lib/state/redis/index.ts +0 -96
  72. package/dist/init-template/app/server-azure-function/src/lib/state/seeka/installations.ts +0 -65
@@ -2,8 +2,13 @@ stages:
2
2
  - deploy
3
3
 
4
4
  variables:
5
- AZURE_FUNC_RESOURCE_NAME: seeka-app-example-name
5
+ AZURE_FUNC_RESOURCE_NAME: example-app-name
6
6
  CI_DEBUG_TRACE: "true"
7
+ NODE_OPTIONS: --max-old-space-size=8192
8
+ VITE_RELEASE_TAG: "$CI_COMMIT_SHORT_SHA"
9
+ VITE_BASE_URL: "/example-app-name-app/"
10
+ VITE_URLS_SEEKA_API_CORE: "https://api.seeka.services"
11
+ VITE_URLS_SEEKA_APP_CORE_ORIGIN: "https://seeka.app"
7
12
 
8
13
  workflow:
9
14
  rules:
@@ -11,27 +16,43 @@ workflow:
11
16
  when: never
12
17
  - if: '$CI_COMMIT_BRANCH == "main" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
13
18
  variables:
14
- # AZURE_FUNC_SLOT: ""
15
- # AZURE_FUNC_SLOT: "production"?????
16
19
  HOSTING_REGION_NAME: auea
17
20
  HOSTING_ENV_NAME: prod
18
21
  when: always
19
22
  - if: '$CI_COMMIT_BRANCH == "staging" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
20
23
  variables:
21
- # AZURE_FUNC_SLOT: staging
22
24
  HOSTING_REGION_NAME: auea
23
25
  HOSTING_ENV_NAME: stag
24
26
  when: always
25
27
 
26
- deploy:
28
+ azure_func:
29
+ cache:
30
+ policy: pull-push
31
+ key: npmCache_app_example-app-name_$CI_COMMIT_BRANCH
32
+ untracked: false
33
+ paths:
34
+ - node_modules/
35
+ - app/server/node_modules/
36
+ - .yarn/cache
37
+ - .yarn/install-state.gz
27
38
  stage: deploy
28
- image: node:20
39
+ image: node:22
40
+ artifacts:
41
+ when: on_success
42
+ exclude:
43
+ - .git/**/*
44
+ - .git/
45
+ paths:
46
+ - app/*/build/**
47
+ - app/*/dist/**
29
48
  environment:
30
49
  name: $HOSTING_REGION_NAME/$HOSTING_ENV_NAME/apps
31
50
  before_script:
32
51
  - echo "installing azure cli"
33
52
  - curl -sL https://aka.ms/InstallAzureCLIDeb | bash
34
53
  - az --version
54
+ - echo "installing Azure Functions Core Tools"
55
+ - npm install -g azure-functions-core-tools@4 --unsafe-perm true
35
56
  - echo "logging in to azure"
36
57
  - az login --service-principal --username "$AZURE_SERVICEPRINCIPAL_CLIENTID" --password "$AZURE_SERVICEPRINCIPAL_SECRET" --tenant "$AZURE_TENANT_ID"
37
58
  - az account set --subscription "$AZURE_SUBSCRIPTION_ID"
@@ -40,8 +61,8 @@ deploy:
40
61
  - echo "deploying azure func $AZURE_FUNC_RESOURCE_NAME to slot $AZURE_FUNC_SLOT from branch $CI_COMMIT_BRANCH"
41
62
  - yarn install --immutable
42
63
  - yarn clean && yarn build
43
- - cd app/server-azure-function
44
- - yarn func azure functionapp publish $AZURE_FUNC_RESOURCE_NAME --no-build --javascript
64
+ - cd app/server
65
+ - func azure functionapp publish $AZURE_FUNC_RESOURCE_NAME --no-build --javascript
45
66
  only:
46
67
  - main
47
68
  - staging
@@ -0,0 +1 @@
1
+ 22
@@ -1,7 +1,22 @@
1
- # Seeka app
1
+ # @example-org-name/example-app-name
2
+
3
+ ## Local dev
4
+
5
+ - server + ui
6
+ - `clear && yarn dev`
7
+ - separate terminal `clear && yarn dev:server`
8
+ - separate terminal `clear && yarn dev:ui`
9
+ - separate terminal `clear && yarn watch:server`
10
+ - separate terminal `yarn tunnel`
11
+ - server only
12
+ - `clear && yarn dev`
13
+ - separate terminal `clear && yarn dev:server`
14
+ - separate terminal `clear && yarn watch:server`
15
+ - separate terminal `yarn tunnel`
2
16
 
3
17
  # updating all deps
18
+
4
19
  ```
5
20
  cd repo root
6
- npx npm-check-updates@latest -i --target minor --workspaces && npx npm-check-updates@latest -i --target latest --workspaces
7
- ```
21
+ npx npm-check-updates@latest -i --workspaces --target minor && npx npm-check-updates@latest -i --workspaces --target minor --dep peer && npx npm-check-updates@latest -i --workspaces --target latest && npx npm-check-updates@latest -i --workspaces --target latest --dep peer
22
+ ```
@@ -7,5 +7,7 @@ module.exports = {
7
7
  rules: {
8
8
  "@typescript-eslint/no-unused-vars": "warn",
9
9
  "@typescript-eslint/no-empty-function": "warn",
10
+ "@typescript-eslint/no-empty-object-type": "warn",
11
+ "@typescript-eslint/no-explicit-any": "warn"
10
12
  }
11
13
  };
@@ -1 +1 @@
1
- # `@seeka-labs/seeka-app-example-name-browser`
1
+ # `@example-org-name/example-app-name-browser`
@@ -1,39 +1,37 @@
1
1
  {
2
- "name": "@seeka-app-example-name/browser",
3
- "version": "2.2.1",
4
- "description": "Seeka browser app seeka-app-example-name-browser",
2
+ "name": "@example-org-name/example-app-name-browser",
3
+ "version": "3.2.3",
4
+ "description": "Seeka app browser plugin example-app-name",
5
5
  "author": "Seeka company <support@seeka.co>",
6
+ "private": true,
6
7
  "license": "MIT",
7
8
  "files": [
8
9
  "dist/"
9
10
  ],
10
11
  "scripts": {
11
12
  "lint": "eslint --fix src/ --ext .ts",
12
- "test:ci": "jest --collectCoverage --coverageDirectory=\"./coverage\" --ci --reporters=default --reporters=jest-junit --watchAll=false",
13
- "test": "jest --watch",
13
+ "typecheck": "tsc --noEmit",
14
14
  "clean": "rimraf dist build package",
15
- "build": "yarn clean && node ./scripts/esbuild/build-browser-plugin.mjs seeka-app-example-name SampleAppConvergeSdkPlugin",
16
- "build:dev": "yarn clean && node ./scripts/esbuild/build-browser-plugin.mjs seeka-app-example-name SampleAppConvergeSdkPlugin dev",
17
- "watch": "yarn clean && node ./scripts/esbuild/build-browser-plugin.mjs seeka-app-example-name SampleAppConvergeSdkPlugin dev watch"
15
+ "build": "yarn clean && node ./scripts/esbuild/build-browser-plugin.mjs seeka-browser-plugin ExampleAppAppConvergeSdkPlugin",
16
+ "build:dev": "yarn clean && node ./scripts/esbuild/build-browser-plugin.mjs seeka-browser-plugin ExampleAppAppConvergeSdkPlugin dev",
17
+ "watch": "yarn clean && node ./scripts/esbuild/build-browser-plugin.mjs seeka-browser-plugin ExampleAppAppConvergeSdkPlugin dev watch"
18
18
  },
19
19
  "dependencies": {
20
- "@seeka-labs/converge": "^1.8.64"
20
+ "@example-org-name/example-app-name-lib": "^3.2.3",
21
+ "@seeka-labs/converge": "^1"
21
22
  },
22
23
  "devDependencies": {
23
- "@jest/globals": "^29.7.0",
24
- "@jgoz/esbuild-plugin-typecheck": "^4.0.3",
25
- "@types/jest": "^29.5.14",
26
- "@types/lodash-es": "^4.17.12",
27
- "@typescript-eslint/eslint-plugin": "^8.32.1",
28
- "@typescript-eslint/parser": "^8.32.1",
29
- "esbuild": "^0.25.5",
24
+ "@jgoz/esbuild-plugin-typecheck": "^4",
25
+ "@types/lodash-es": "^4",
26
+ "@types/node": "^22",
27
+ "@typescript-eslint/eslint-plugin": "^8",
28
+ "@typescript-eslint/parser": "^8",
29
+ "esbuild": "^0",
30
30
  "eslint": "^9",
31
- "eslint-plugin-unused-imports": "^4.1.4",
32
- "jest": "^29.7.0",
33
- "jest-junit": "^16.0.0",
34
- "rimraf": "^6.0.1",
35
- "ts-jest": "^29.3.4",
36
- "typescript": "^5.8.3",
37
- "watch": "^1.0.2"
38
- }
31
+ "eslint-plugin-unused-imports": "^4",
32
+ "rimraf": "^6",
33
+ "typescript": "^5",
34
+ "watch": "^1"
35
+ },
36
+ "gitHead": "7bdfa73d8fd888cf89d5469f161dd4109172f39a"
39
37
  }
@@ -40,12 +40,20 @@ const opts = {
40
40
 
41
41
  const postBuild = () => {
42
42
  // Copy outfile to ../dist/src/browser
43
- if (!existsSync(resolve('../server-azure-function/dist/src/browser'))) {
44
- mkdirSync(resolve('../server-azure-function/dist/src/browser'), {
45
- recursive: true,
46
- });
47
- }
48
- copyFileSync(resolve(opts.outfile), resolve('../server-azure-function/dist/src/browser', `${pluginName}.min.js`))
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
+ })
49
57
  }
50
58
 
51
59
  if (watchBuild) {
@@ -1,12 +1,12 @@
1
- import type { ISampleAppBrowserSdkPluginConfig } from '../../server-azure-function/src/lib/models';
2
- import { SampleAppConvergeSdkPlugin } from "./plugin";
1
+ import { ExampleAppAppBrowserSdkPluginConfig } from "@example-org-name/example-app-name-lib";
2
+ import { ExampleAppAppConvergeSdkPlugin } from "./plugin";
3
3
 
4
4
  declare global {
5
5
  interface Window {
6
- SampleAppConvergeSdkPlugin: (pluginConfig: ISampleAppBrowserSdkPluginConfig) => SampleAppConvergeSdkPlugin;
6
+ ExampleAppAppConvergeSdkPlugin: (pluginConfig: ExampleAppAppBrowserSdkPluginConfig) => ExampleAppAppConvergeSdkPlugin;
7
7
  }
8
8
  }
9
9
 
10
- (window as Window).SampleAppConvergeSdkPlugin = (pluginConfig: ISampleAppBrowserSdkPluginConfig) => {
11
- return new SampleAppConvergeSdkPlugin(pluginConfig);
12
- };
10
+ (window as Window).ExampleAppAppConvergeSdkPlugin = (pluginConfig: ExampleAppAppBrowserSdkPluginConfig) => {
11
+ return new ExampleAppAppConvergeSdkPlugin(pluginConfig);
12
+ };
@@ -1,48 +1,61 @@
1
-
2
1
  import {
3
- ConvergeSdk,
4
- IConvergePlugin
2
+ ConvergeSdk,
3
+ type IActivityCommonProps,
4
+ type IActivityMetadataProps,
5
+ type IConvergePlugin,
6
+ type PersonIdentifiers,
7
+ TrackingActivityNames
5
8
  } from '@seeka-labs/converge';
6
9
 
7
- import type { ISampleAppBrowserSdkPluginConfig } from '../../../server-azure-function/src/lib/models';
8
- import { version } from '../../package.json';
9
-
10
- // const checkSdkAndPluginVersion = (expectedVersion: string, sdk: ConvergeSdk, pluginName: string): void => {
11
- // let runtimeVersion = sdk.config.runtime.ver as string;
12
- // runtimeVersion = runtimeVersion.replace('^', '');
13
- // expectedVersion = expectedVersion.replace('^', '');
14
-
15
- // if (expectedVersion !== runtimeVersion) {
16
- // sdk.debug.warn(`The expected SDK version of ${expectedVersion} for the ${pluginName} plugin does not match the current installlation runtime of ${runtimeVersion}`);
17
- // }
18
- // }
19
-
20
- export class SampleAppConvergeSdkPlugin implements IConvergePlugin<ISampleAppBrowserSdkPluginConfig> {
21
- constructor(pluginConfig: ISampleAppBrowserSdkPluginConfig) {
22
- this.type = "seeka-app-example-name";
23
- // this.name = this.type + "-" + pluginConfig.siteId;
24
- this.name = this.type;
25
- this.version = version;
26
- this.sdk = {} as ConvergeSdk;
27
- this.config = pluginConfig || {};
28
- }
29
- sdk: ConvergeSdk;
30
-
31
- privacyConfig = {
32
- // TODO
33
- requiresIabPurposes: []
34
- }
35
-
36
- name: string;
37
- type: string;
38
- version: string;
39
- config: ISampleAppBrowserSdkPluginConfig;
40
-
41
- async init(_params: any): Promise<void> {
42
- // checkSdkAndPluginVersion(dependencies['@seeka-labs/converge'], this.sdk, this.name)
43
- }
44
-
45
- isLoaded(): boolean {
46
- return true;
47
- }
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 = "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
+ }
48
61
  }
@@ -21,8 +21,7 @@
21
21
  "experimentalDecorators": true,
22
22
  "sourceMap": true,
23
23
  "types": [
24
- "node",
25
- "jest"
24
+ "node"
26
25
  ],
27
26
  "lib": [
28
27
  "ES6",
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@example-org-name/example-app-name-lib",
3
+ "version": "3.2.3",
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
+ "jsonwebtoken": "^9",
23
+ "lodash-es": "^4",
24
+ "memory-cache": "^0",
25
+ "openid-client": "^6",
26
+ "rimraf": "^6",
27
+ "typescript": "^5",
28
+ "undici": "^7",
29
+ "winston": "^3",
30
+ "zod": "^4"
31
+ },
32
+ "peerDependencies": {
33
+ "@seeka-labs/sdk-apps-core": "^3",
34
+ "@seeka-labs/sdk-apps-server": "^3",
35
+ "jsonwebtoken": "^9",
36
+ "lodash-es": "^4",
37
+ "undici": "^7",
38
+ "zod": "^4"
39
+ },
40
+ "scripts": {
41
+ "clean": "rimraf build package dist",
42
+ "typecheck": "tsc --noEmit",
43
+ "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",
44
+ "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"
45
+ }
46
+ }
@@ -0,0 +1,4 @@
1
+
2
+ export * from './models';
3
+ export * from './validation';
4
+
@@ -0,0 +1,29 @@
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>
@@ -0,0 +1,14 @@
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
+ }
@@ -0,0 +1,22 @@
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
+ }
@@ -0,0 +1,4 @@
1
+ /* eslint-env node */
2
+ module.exports = {
3
+ extends: ['../.eslintrc.cjs']
4
+ };
@@ -7,16 +7,13 @@ README.md
7
7
  tsconfig.json
8
8
  .eslintrc.cjs
9
9
 
10
- node_modules/@jest/globals/
11
10
  node_modules/@types/
12
11
  node_modules/@typescript-eslint/eslint-plugin/
13
12
  node_modules/@typescript-eslint/parser/
14
13
  node_modules/azure-functions-core-tools/
15
14
  node_modules/eslint/
16
- node_modules/jest/
17
15
  node_modules/ngrok/
18
16
  node_modules/rimraf/
19
- node_modules/ts-jest/
20
17
  node_modules/typescript/
21
18
 
22
19
  .gitignore
@@ -33,7 +33,7 @@ You can expose your app locally to the internet via Ngrok to test your app befor
33
33
  2. In separate terminal window run `yarn tunnel` and observe the log entry that starts with `Live url exposed`.
34
34
  3. Input the URL into your Seeka app configuration as the "Webook URL" via the Seeka UI.
35
35
 
36
- ## Included sample functions
36
+ ## Included example functions
37
37
  ### Seeka app webhook
38
38
  `src/functions/seekaAppWebhook.ts`
39
39
 
@@ -54,7 +54,7 @@ Handles scheduled invoking of a function. This concept can be used to "fan out"
54
54
  Scheduled / timer function: `curl -i -d '{"input": null}' -H "Content-Type: application/json" -X POST http://localhost:7072/admin/functions/pollingExample`
55
55
 
56
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`
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
58
 
59
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
60
 
@@ -85,7 +85,7 @@ If you dont want to use Upstash for Redis then the connection strings in `.env`
85
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
86
 
87
87
  1. Create Azure function app via the portal with below settings
88
- - Function app name: seeka-app-example-name
88
+ - Function app name: example-app-name
89
89
  - Code or container image: Code
90
90
  - Runtime stack: Node.js
91
91
  - Version: 18 LTS
@@ -8,6 +8,17 @@
8
8
  }
9
9
  }
10
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
+ },
11
22
  "functionTimeout": "00:10:00",
12
23
  "extensionBundle": {
13
24
  "id": "Microsoft.Azure.Functions.ExtensionBundle",
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@example-org-name/example-app-name-server-azurefunc",
3
+ "version": "3.2.3",
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": "tsc",
16
+ "watch": "yarn clean && tsc -w",
17
+ "clean": "rimraf dist",
18
+ "prestart": "yarn clean && yarn build",
19
+ "dev": "func start --port 7072",
20
+ "tunnel": "ngrok http 7072 --hostname=example-app-name-localdev.au.ngrok.io --region au --log=stdout --log-format=term",
21
+ "tunnel:old": "node scripts/ngrok.js example-app-name-localdev",
22
+ "deploy": "func azure functionapp publish example-app-name --no-build --javascript",
23
+ "dev:queue:create": "node scripts/dev-queue-setup.js activity-track-queue && node scripts/dev-queue-setup.js activity-track-queue-poison"
24
+ },
25
+ "dependencies": {
26
+ "@azure/functions": "^4",
27
+ "@azure/storage-queue": "^12",
28
+ "@example-org-name/example-app-name-lib": "workspace:*",
29
+ "@opentelemetry/api": "^1",
30
+ "@opentelemetry/exporter-logs-otlp-proto": "^0",
31
+ "@opentelemetry/exporter-trace-otlp-proto": "^0",
32
+ "@opentelemetry/instrumentation-grpc": "^0",
33
+ "@opentelemetry/instrumentation-http": "^0",
34
+ "@opentelemetry/instrumentation-ioredis": "^0",
35
+ "@opentelemetry/instrumentation-net": "^0",
36
+ "@opentelemetry/instrumentation-undici": "^0",
37
+ "@opentelemetry/instrumentation-winston": "^0",
38
+ "@opentelemetry/sdk-node": "^0",
39
+ "@opentelemetry/sdk-trace-node": "^2",
40
+ "@opentelemetry/winston-transport": "^0",
41
+ "@redis/client": "^5",
42
+ "@redis/json": "^5",
43
+ "@seeka-labs/sdk-apps-core": "../../workspace:* || ^3",
44
+ "@seeka-labs/sdk-apps-server": "../../workspace:* || ^3",
45
+ "@seeka-labs/sdk-apps-server-host": "../../workspace:* || ^3",
46
+ "@seeka-labs/sdk-apps-server-telemetry-core": "../../workspace:* || ^3",
47
+ "@seeka-labs/sdk-apps-server-telemetry-logging": "../../workspace:* || ^3",
48
+ "axios": "^1",
49
+ "jsonwebtoken": "^9",
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
+ "ngrok": "^5.0.0-beta.2",
66
+ "rimraf": "^6",
67
+ "typescript": "^5"
68
+ }
69
+ }
@@ -0,0 +1,18 @@
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
+ })();
@@ -2,6 +2,9 @@
2
2
  // eslint-disable-next-line @typescript-eslint/no-var-requires
3
3
  const ngrok = require('ngrok');
4
4
  (async function () {
5
+ await ngrok.disconnect(process.argv[2]); // stops all
6
+ await ngrok.kill(); // kills ngrok process
7
+
5
8
  const url = await ngrok.connect({
6
9
  proto: 'http',
7
10
  web_addr: 'localhost:4040',
@@ -23,6 +26,6 @@ const ngrok = require('ngrok');
23
26
  console.info(`Use this URL in your Seeka app configuration for testing`)
24
27
  console.log('')
25
28
  console.log('------------------------------------------')
26
- console.log('')
29
+ console.log('http://127.0.0.1:4040/inspect/http')
27
30
  console.log('')
28
31
  })();