@seeka-labs/cli-apps 3.6.7 → 3.7.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.
@@ -0,0 +1,198 @@
1
+ name: Deploy Azure Function
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - staging
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ id-token: write
12
+ contents: read
13
+ actions: read
14
+
15
+ concurrency:
16
+ group: deploy-${{ github.ref }}
17
+ cancel-in-progress: false
18
+
19
+ jobs:
20
+ deploy:
21
+ runs-on: ubuntu-latest
22
+ environment: ${{ github.ref_name == 'main' && 'prod' || 'stag' }}
23
+ env:
24
+ # Use a project-local Yarn cache that we can persist between runs
25
+ YARN_ENABLE_GLOBAL_CACHE: "false"
26
+ YARN_CACHE_FOLDER: .yarn/cache
27
+
28
+ # Constants / computed
29
+ NODE_OPTIONS: --max-old-space-size=8192
30
+ DEPLOY_ENVIRONMENT_NAME: ${{ github.ref_name == 'main' && 'prod' || 'stag' }}
31
+
32
+ # Repo variable (plain text)
33
+ AZURE_FUNC_RESOURCE_NAME: ${{ vars.AZURE_FUNC_RESOURCE_NAME }}
34
+
35
+ # GitHub Environment variables (plain text)
36
+ AZURE_FUNC_SLOT_NAME: ${{ vars.AZURE_FUNC_SLOT_NAME }}
37
+ AZURE_FUNC_RESOURCE_GROUP_NAME: ${{ vars.AZURE_FUNC_RESOURCE_GROUP_NAME }}
38
+ VITE_BASE_URL: ${{ vars.VITE_BASE_URL }}
39
+ VITE_URLS_SEEKA_API_CORE: ${{ vars.VITE_URLS_SEEKA_API_CORE }}
40
+ VITE_URLS_SEEKA_APP_CORE_ORIGIN: ${{ vars.VITE_URLS_SEEKA_APP_CORE_ORIGIN }}
41
+ HOSTING_REGION_NAME: ${{ vars.HOSTING_REGION_NAME }}
42
+ HOSTING_ENV_NAME: ${{ vars.HOSTING_ENV_NAME }}
43
+ SEEKA_APP_SETTINGS: ${{ vars.SEEKA_APP_SETTINGS }}
44
+
45
+ # GitHub Environment secrets
46
+ SEEKA_APP_CFG_DATA_ENCRYPTION_KEY: ${{ secrets.SEEKA_APP_CFG_DATA_ENCRYPTION_KEY }}
47
+ SEEKA_APP_CFG_OTEL_EXPORTER_OTLP_LOGS_HEADERS: ${{ secrets.SEEKA_APP_CFG_OTEL_EXPORTER_OTLP_LOGS_HEADERS }}
48
+ SEEKA_APP_CFG_REDIS_CONNECTION_PASSWORD: ${{ secrets.SEEKA_APP_CFG_REDIS_CONNECTION_PASSWORD }}
49
+ SEEKA_APP_CFG_SEEKA_APP_SECRET: ${{ secrets.SEEKA_APP_CFG_SEEKA_APP_SECRET }}
50
+
51
+ steps:
52
+ - name: Checkout
53
+ uses: actions/checkout@v5
54
+ with:
55
+ fetch-depth: 0
56
+
57
+ - name: Install Azure CLI
58
+ run: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
59
+
60
+ - name: Azure login (OIDC)
61
+ uses: azure/login@v2
62
+ with:
63
+ client-id: ${{ vars.AZURE_CLIENT_ID_SEEKA_APP_DEPLOYMENT }}
64
+ tenant-id: ${{ vars.AZURE_TENANT_ID }}
65
+ subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
66
+ # enable-AzPSSession: true
67
+
68
+ - name: Enable Corepack
69
+ run: corepack enable
70
+
71
+ - name: Setup Node
72
+ uses: actions/setup-node@v6
73
+ with:
74
+ cache-dependency-path: 'yarn.lock'
75
+ node-version: 22
76
+ cache: yarn
77
+
78
+ - name: Restore Corepack/Yarn caches
79
+ uses: actions/cache@v5
80
+ with:
81
+ path: |
82
+ .corepack
83
+ .yarn/cache
84
+ node_modules
85
+ key: ${{ runner.os }}-npm-${{ hashFiles('yarn.lock') }}
86
+ restore-keys: |
87
+ ${{ runner.os }}-npm-
88
+
89
+ - name: Compute VITE_RELEASE_TAG
90
+ shell: bash
91
+ run: |
92
+ set -euo pipefail
93
+ echo "VITE_RELEASE_TAG=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
94
+
95
+ - name: Install dependencies
96
+ run: yarn install --immutable
97
+
98
+ - name: Build
99
+ run: yarn clean && yarn build
100
+
101
+ - name: Update Azure Function App settings
102
+ shell: bash
103
+ env:
104
+ GITHUB_TOKEN: ${{ github.token }}
105
+ run: |
106
+ set -euo pipefail
107
+
108
+ seeka_basesettings_json="$(jq -n \
109
+ --arg NODE_OPTIONS "$NODE_OPTIONS" \
110
+ --arg VITE_RELEASE_TAG "$VITE_RELEASE_TAG" \
111
+ --arg VITE_BASE_URL "$VITE_BASE_URL" \
112
+ --arg VITE_URLS_SEEKA_API_CORE "$VITE_URLS_SEEKA_API_CORE" \
113
+ --arg VITE_URLS_SEEKA_APP_CORE_ORIGIN "$VITE_URLS_SEEKA_APP_CORE_ORIGIN" \
114
+ --arg HOSTING_REGION_NAME "$HOSTING_REGION_NAME" \
115
+ --arg HOSTING_ENV_NAME "$HOSTING_ENV_NAME" \
116
+ '{
117
+ NODE_OPTIONS: $NODE_OPTIONS,
118
+ VITE_RELEASE_TAG: $VITE_RELEASE_TAG,
119
+ VITE_BASE_URL: $VITE_BASE_URL,
120
+ VITE_URLS_SEEKA_API_CORE: $VITE_URLS_SEEKA_API_CORE,
121
+ VITE_URLS_SEEKA_APP_CORE_ORIGIN: $VITE_URLS_SEEKA_APP_CORE_ORIGIN,
122
+ HOSTING_REGION_NAME: $HOSTING_REGION_NAME,
123
+ HOSTING_ENV_NAME: $HOSTING_ENV_NAME
124
+ }')"
125
+
126
+ seeka_appsettings_json="{}"
127
+ if [[ -n "${SEEKA_APP_SETTINGS:-}" ]]; then
128
+ seeka_appsettings_json="$(echo "$SEEKA_APP_SETTINGS" | jq -c '.')"
129
+ fi
130
+
131
+ # Read any explicitly-mapped SEEKA_APP_CFG_* environment variables
132
+ seeka_app_cfg_json="$(jq -n '{}')"
133
+ for name in $(compgen -e); do
134
+ if [[ "$name" == SEEKA_APP_CFG_* ]]; then
135
+ key="${name#SEEKA_APP_CFG_}"
136
+ value="${!name}"
137
+ seeka_app_cfg_json="$(jq -c --arg k "$key" --arg v "$value" '. + {($k): $v}' <<<"$seeka_app_cfg_json")"
138
+ fi
139
+ done
140
+
141
+ final_json="$(jq -c -s 'reduce .[] as $i ({}; . * $i)' \
142
+ <(echo "$seeka_basesettings_json") \
143
+ <(echo "$seeka_appsettings_json") \
144
+ <(echo "$seeka_app_cfg_json"))"
145
+
146
+ echo "$final_json" > appsettings.json
147
+
148
+ if [[ -n "${AZURE_FUNC_SLOT_NAME:-}" ]]; then
149
+ az functionapp config appsettings set \
150
+ --name "$AZURE_FUNC_RESOURCE_NAME" \
151
+ --slot "$AZURE_FUNC_SLOT_NAME" \
152
+ --resource-group "$AZURE_FUNC_RESOURCE_GROUP_NAME" \
153
+ --settings @appsettings.json \
154
+ 1>/dev/null
155
+ else
156
+ az functionapp config appsettings set \
157
+ --name "$AZURE_FUNC_RESOURCE_NAME" \
158
+ --resource-group "$AZURE_FUNC_RESOURCE_GROUP_NAME" \
159
+ --settings @appsettings.json \
160
+ 1>/dev/null
161
+ fi
162
+
163
+ - name: Populate app/server/node_modules for deployment
164
+ run: |
165
+ echo "nodeLinker: node-modules" > .yarnrc.yml
166
+ echo -n "nmHoistingLimits: workspaces" >> .yarnrc.yml
167
+ cd app/server
168
+ yarn workspaces focus --production
169
+
170
+ - name: Package Azure Function as zip
171
+ working-directory: app/server
172
+ run: |
173
+ zip -r ../function-app.zip dist node_modules host.json package.json
174
+
175
+ - name: Upload function app package as artifact
176
+ uses: actions/upload-artifact@v4
177
+ with:
178
+ name: function-app-package
179
+ path: app/function-app.zip
180
+ retention-days: 30
181
+
182
+ - name: Deploy Azure Function
183
+ shell: bash
184
+ run: |
185
+ if [[ -n "${AZURE_FUNC_SLOT_NAME:-}" ]]; then
186
+ az functionapp deployment source config-zip \
187
+ --src "app/function-app.zip" \
188
+ --build-remote false \
189
+ --name "$AZURE_FUNC_RESOURCE_NAME" \
190
+ --slot "$AZURE_FUNC_SLOT_NAME" \
191
+ --resource-group "$AZURE_FUNC_RESOURCE_GROUP_NAME"
192
+ else
193
+ az functionapp deployment source config-zip \
194
+ --src "app/function-app.zip" \
195
+ --build-remote false \
196
+ --name "$AZURE_FUNC_RESOURCE_NAME" \
197
+ --resource-group "$AZURE_FUNC_RESOURCE_GROUP_NAME"
198
+ fi
@@ -2,7 +2,7 @@ stages:
2
2
  - deploy
3
3
 
4
4
  variables:
5
- AZURE_FUNC_RESOURCE_NAME: example-app-name
5
+ AZURE_FUNC_RESOURCE_NAME: seeka-app-example-app-name
6
6
  CI_DEBUG_TRACE: "true"
7
7
  NODE_OPTIONS: --max-old-space-size=8192
8
8
  VITE_RELEASE_TAG: "$CI_COMMIT_SHORT_SHA"
@@ -57,7 +57,7 @@ azure_func:
57
57
  - az account set --subscription "$AZURE_SUBSCRIPTION_ID"
58
58
  - corepack enable
59
59
  script:
60
- - echo "deploying azure func $AZURE_FUNC_RESOURCE_NAME to slot $AZURE_FUNC_SLOT from branch $CI_COMMIT_BRANCH"
60
+ - echo "deploying azure func $AZURE_FUNC_RESOURCE_NAME to slot $AZURE_FUNC_SLOT_NAME from branch $CI_COMMIT_BRANCH"
61
61
  - yarn install --immutable
62
62
  - yarn clean && yarn build
63
63
  - cd app/server
@@ -25,3 +25,37 @@ yarn up "@seeka-labs/*" --mode=update-lockfile && yarn
25
25
  cd repo root
26
26
  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
27
27
  ```
28
+
29
+ ## Deploy (GitHub Actions)
30
+
31
+ This repo deploys to Azure Functions via `.github/workflows/deploy-azurefunc.yml` on pushes to `main` and `staging`.
32
+
33
+ ### Required GitHub secrets (for Azure OIDC)
34
+
35
+ Create an Azure federated credential for this repo/environment, then set:
36
+
37
+ - `AZURE_CLIENT_ID`
38
+ - `AZURE_TENANT_ID`
39
+ - `AZURE_SUBSCRIPTION_ID`
40
+
41
+ ### Required GitHub variables
42
+
43
+ Repository variable:
44
+
45
+ - `AZURE_FUNC_RESOURCE_NAME`
46
+
47
+ GitHub Environment variables (define in environments `prod` and `stag`):
48
+
49
+ - `AZURE_FUNC_SLOT_NAME`
50
+ - `VITE_BASE_URL`
51
+ - `VITE_URLS_SEEKA_API_CORE`
52
+ - `VITE_URLS_SEEKA_APP_CORE_ORIGIN`
53
+ - `HOSTING_REGION_NAME`
54
+ - `HOSTING_ENV_NAME`
55
+ - `SEEKA_APP_SETTINGS` (JSON object string like `{ "SETTING1": "production" }`)
56
+
57
+ ### GitHub action authenticating to Azure
58
+ - create app registration in entra called devops-github-seeka-developer-apps
59
+ - for service principal: resource group > IAM > add role assignment > Website contributor
60
+ - for service principal: subscription > IAM > add role assignment > Reader
61
+ - Assign federated identity to the service principal for GitHub actions at Certificates and Secrets > Federated Identity > Add credential > GitHub actions
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@example-org-name/example-app-name-browser",
3
- "version": "3.6.7",
3
+ "version": "3.7.0",
4
4
  "description": "Seeka app browser plugin example-app-name",
5
5
  "author": "Seeka company <support@seeka.co>",
6
6
  "private": true,
@@ -32,6 +32,5 @@
32
32
  "rimraf": "^6",
33
33
  "typescript": "^5",
34
34
  "watch": "^1"
35
- },
36
- "gitHead": "7bdfa73d8fd888cf89d5469f161dd4109172f39a"
35
+ }
37
36
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@example-org-name/example-app-name-lib",
3
- "version": "3.6.7",
3
+ "version": "3.7.0",
4
4
  "description": "Seeka app library for example-app-name",
5
5
  "author": "Seeka <administrator@seeka.co>",
6
6
  "license": "MIT",
@@ -1,14 +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;
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
14
  }
@@ -6,6 +6,7 @@ src/
6
6
  README.md
7
7
  tsconfig.json
8
8
  .eslintrc.cjs
9
+ .yarn
9
10
 
10
11
  node_modules/@types/
11
12
  node_modules/@typescript-eslint/eslint-plugin/
@@ -4,9 +4,6 @@
4
4
  "CORS": "*"
5
5
  },
6
6
  "Values": {
7
- "FUNCTIONS_WORKER_RUNTIME": "node",
8
- "FUNCTIONS_EXTENSION_VERSION": "~4",
9
- "AzureWebJobsFeatureFlags": "EnableWorkerIndexing",
10
7
  "SEEKA_DEBUG_ENABLED": "true",
11
8
  "NODE_TLS_REJECT_UNAUTHORIZED": "0",
12
9
  "REDIS_CONNECTION_USER": "default",
@@ -16,12 +13,11 @@
16
13
  "SEEKA_ISSUER_URL": "",
17
14
  "SEEKA_APP_ID": "",
18
15
  "SEEKA_APP_SECRET": "",
19
- "REDIS_CONNECTION_HOST": "",
16
+ "REDIS_CONNECTION_HOST": "localhost",
20
17
  "REDIS_CONNECTION_PASSWORD": "",
21
- "AzureWebJobsStorage": "",
22
18
  "SEEKA_TELEMETRY_URL": "",
23
19
  "REDIS_CONNECTION_PORT": "6379",
24
- "REDIS_CONNECTION_TLS": "true",
20
+ "REDIS_CONNECTION_TLS": "false",
25
21
  "OTEL_LOG_LEVEL": "info",
26
22
  "LOGGING_LEVEL": "silly",
27
23
  "SELF_HOST_BASEURL": "",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@example-org-name/example-app-name-server-azurefunc",
3
- "version": "3.6.7",
3
+ "version": "3.7.0",
4
4
  "description": "Seeka Azure Serverless function app example-app-name",
5
5
  "author": "Seeka <administrator@seeka.co>",
6
6
  "license": "MIT",
@@ -1,12 +1,12 @@
1
- 
2
- import {SeekaActivityAcceptedWebhookContent} from "@seeka-labs/sdk-apps-server";
3
- import { BackgroundJobRequestContext } from "@seeka-labs/sdk-apps-server-host";
4
-
5
- export type TrackExampleAppActivityQueueItem = BackgroundJobRequestContext<TrackSeekaExampleAppActivityPayload> & {
6
-
7
- }
8
-
9
- export type TrackSeekaExampleAppActivityPayload = {
10
- seekaActivity: SeekaActivityAcceptedWebhookContent
11
- }
12
-
1
+ 
2
+ import {SeekaActivityAcceptedWebhookContent} from "@seeka-labs/sdk-apps-server";
3
+ import { BackgroundJobRequestContext } from "@seeka-labs/sdk-apps-server-host";
4
+
5
+ export type TrackExampleAppActivityQueueItem = BackgroundJobRequestContext<TrackSeekaExampleAppActivityPayload> & {
6
+
7
+ }
8
+
9
+ export type TrackSeekaExampleAppActivityPayload = {
10
+ seekaActivity: SeekaActivityAcceptedWebhookContent
11
+ }
12
+
@@ -1,8 +1,8 @@
1
- 
2
- import {Logger} from "winston";
3
- import {TrackSeekaExampleAppActivityPayload} from "../models";
4
- import {SeekaAppInstallContext} from "@seeka-labs/sdk-apps-core";
5
-
6
- export const sendActivityToAnotherSoftware = async (payload: TrackSeekaExampleAppActivityPayload, installation: SeekaAppInstallContext<any>, causationId: string, correlationId: string, logger: Logger): Promise<void> => {
7
- // Anything
8
- }
1
+ 
2
+ import {Logger} from "winston";
3
+ import {TrackSeekaExampleAppActivityPayload} from "../models";
4
+ import {SeekaAppInstallContext} from "@seeka-labs/sdk-apps-core";
5
+
6
+ export const sendActivityToAnotherSoftware = async (payload: TrackSeekaExampleAppActivityPayload, installation: SeekaAppInstallContext<any>, causationId: string, correlationId: string, logger: Logger): Promise<void> => {
7
+ // Anything
8
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@example-org-name/example-app-name-ui",
3
- "version": "3.6.7",
3
+ "version": "3.7.0",
4
4
  "description": "Seeka app UI for example-app-name",
5
5
  "author": "Seeka <administrator@seeka.co>",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seeka-labs/cli-apps",
3
- "version": "3.6.7",
3
+ "version": "3.7.0",
4
4
  "description": "Seeka - Apps CLI",
5
5
  "author": "SEEKA <platform@seeka.co>",
6
6
  "license": "MIT",
@@ -50,7 +50,7 @@
50
50
  "extract-zip": "^2.0.1",
51
51
  "glob": "^13",
52
52
  "ignore": "^7",
53
- "inquirer": "^9.2.23",
53
+ "inquirer": "^13.2.0",
54
54
  "jest": "^30",
55
55
  "jsonpath-plus": "^10.3.0",
56
56
  "jszip": "^3.10.1",
@@ -58,6 +58,5 @@
58
58
  "source-map-support": "^0",
59
59
  "ts-jest": "^29",
60
60
  "typescript": "^5"
61
- },
62
- "gitHead": "23b0a7d1cbbc48db77f207bcecb87c9cce9b1a95"
61
+ }
63
62
  }
package/README.md DELETED
@@ -1 +0,0 @@
1
- # Seeka Apps CLI
@@ -1,7 +0,0 @@
1
- PORT=3000
2
- EXTEND_ESLINT=TRUE
3
- REACT_APP_RELEASE_TAG=dev
4
- VITE_BASE_URL=/app/
5
-
6
- PROD_VITE_URLS_SEEKA_API_CORE=https://api.seeka.services
7
- PROD_VITE_URLS_SEEKA_APP_CORE_ORIGIN=https://seeka.app