@seeka-labs/cli-apps 1.1.5 → 1.1.7
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.
- package/dist/index.js +33 -20
- package/dist/index.js.map +4 -4
- package/dist/init-templates/aws-lambda/.eslintrc.cjs +2 -1
- package/dist/init-templates/aws-lambda/src/lib/state/redis/index.ts +2 -1
- package/dist/init-templates/azure-function/.eslintrc.cjs +2 -1
- package/dist/init-templates/azure-function/package.json +2 -1
- package/dist/init-templates/azure-function/scripts/dev-queue-setup.js +18 -0
- package/dist/init-templates/azure-function/src/functions/queueExample.ts +2 -1
- package/dist/init-templates/azure-function/src/functions/seekaAppWebhook.ts +5 -0
- package/dist/init-templates/azure-function/src/lib/state/redis/index.ts +2 -1
- package/dist/init-templates/netlify-function/.eslintrc.cjs +4 -0
- package/dist/init-templates/netlify-function/src/lib/state/redis/index.ts +2 -1
- package/package.json +5 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createClient } from 'redis';
|
|
2
2
|
|
|
3
3
|
import { getLogger } from '../../logging';
|
|
4
|
+
import winston from 'winston';
|
|
4
5
|
|
|
5
6
|
const redisProtocol = process.env.REDIS_CONNECTION_TLS === 'true' ? 'rediss://' : 'redis://';
|
|
6
7
|
const redisConn = `${redisProtocol}${process.env.REDIS_CONNECTION_USER}:${process.env.REDIS_CONNECTION_PASSWORD}@${process.env.REDIS_CONNECTION_HOST}:${process.env.REDIS_CONNECTION_PORT}`;
|
|
@@ -8,7 +9,7 @@ const redisConn = `${redisProtocol}${process.env.REDIS_CONNECTION_USER}:${proces
|
|
|
8
9
|
const redisClient = createClient({
|
|
9
10
|
url: redisConn
|
|
10
11
|
})
|
|
11
|
-
.on('error', err => getLogger().error('Redis Client ', {
|
|
12
|
+
.on('error', (err: any) => getLogger().error('Redis Client ', { ex: winston.exceptions.getAllInfo(err) }));
|
|
12
13
|
|
|
13
14
|
export const connect = async () => {
|
|
14
15
|
await redisClient.connect();
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"prestart": "<packageManagerRunPrefix> clean && <packageManagerRunPrefix> build",
|
|
18
18
|
"dev": "func start --port 7072",
|
|
19
19
|
"tunnel": "node scripts/ngrok.js seeka-app-example-name-localdev",
|
|
20
|
-
"deploy": "<packageManagerRunPrefix> clean && <packageManagerRunPrefix> build && func azure functionapp publish seeka-app-example-name --no-build --javascript"
|
|
20
|
+
"deploy": "<packageManagerRunPrefix> clean && <packageManagerRunPrefix> build && func azure functionapp publish seeka-app-example-name --no-build --javascript",
|
|
21
|
+
"dev:queue:create": "node scripts/dev-queue-setup.js sample-queue-name"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
24
|
"@azure/functions": "^4.1.0",
|
|
@@ -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
|
+
})();
|
|
@@ -13,7 +13,8 @@ app.storageQueue('queueExample', {
|
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
export async function queueExample(queueItem: string, context: InvocationContext): Promise<void> {
|
|
16
|
-
const body = deserialiseQueuePayload<BackgroundJobRequestContext>(queueItem);
|
|
16
|
+
const body = typeof queueItem === 'string' ? deserialiseQueuePayload<BackgroundJobRequestContext>(queueItem) : queueItem as BackgroundJobRequestContext;
|
|
17
|
+
|
|
17
18
|
const logger = backgroundJobLogger(queueNames.queueItemExampleQueueName, body, context);
|
|
18
19
|
logger.profile(`queue.${queueNames.queueItemExampleQueueName}`)
|
|
19
20
|
|
|
@@ -9,7 +9,10 @@ import {
|
|
|
9
9
|
} from '@seeka-labs/sdk-apps-server';
|
|
10
10
|
|
|
11
11
|
import { queueNames, triggerBackgroundJob } from '../lib/jobs';
|
|
12
|
+
// START: component:browser
|
|
12
13
|
import { getSeekaBrowserPlugin } from '../lib/browser'
|
|
14
|
+
// END: component:browser
|
|
15
|
+
|
|
13
16
|
import { webhookLogger } from '../lib/logging';
|
|
14
17
|
import { startServices } from '../lib/services';
|
|
15
18
|
import {
|
|
@@ -115,6 +118,7 @@ export async function seekaAppWebhook(req: HttpRequest, context: InvocationConte
|
|
|
115
118
|
|
|
116
119
|
break;
|
|
117
120
|
}
|
|
121
|
+
// START: component:browser
|
|
118
122
|
case SeekaWebhookCallType.BrowserSdkPlugin: {
|
|
119
123
|
const plugin = await getSeekaBrowserPlugin(installation as SeekaAppInstallState, logger);
|
|
120
124
|
|
|
@@ -127,6 +131,7 @@ export async function seekaAppWebhook(req: HttpRequest, context: InvocationConte
|
|
|
127
131
|
}
|
|
128
132
|
}
|
|
129
133
|
}
|
|
134
|
+
// END: component:browser
|
|
130
135
|
}
|
|
131
136
|
}
|
|
132
137
|
catch (err) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createClient } from 'redis';
|
|
2
2
|
|
|
3
3
|
import { logger } from '../../logging';
|
|
4
|
+
import winston from 'winston';
|
|
4
5
|
|
|
5
6
|
const redisProtocol = process.env.REDIS_CONNECTION_TLS === 'true' ? 'rediss://' : 'redis://';
|
|
6
7
|
const redisConn = `${redisProtocol}${process.env.REDIS_CONNECTION_USER}:${process.env.REDIS_CONNECTION_PASSWORD}@${process.env.REDIS_CONNECTION_HOST}:${process.env.REDIS_CONNECTION_PORT}`;
|
|
@@ -8,7 +9,7 @@ const redisConn = `${redisProtocol}${process.env.REDIS_CONNECTION_USER}:${proces
|
|
|
8
9
|
const redisClient = createClient({
|
|
9
10
|
url: redisConn
|
|
10
11
|
})
|
|
11
|
-
.on('error', err => logger.error('Redis Client ', {
|
|
12
|
+
.on('error', (err: any) => logger.error('Redis Client ', { ex: winston.exceptions.getAllInfo(err) }));
|
|
12
13
|
|
|
13
14
|
export const connect = async () => {
|
|
14
15
|
await redisClient.connect();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createClient } from 'redis';
|
|
2
2
|
|
|
3
3
|
import { logger } from '@/lib/logging';
|
|
4
|
+
import winston from 'winston';
|
|
4
5
|
|
|
5
6
|
const redisProtocol = process.env.REDIS_CONNECTION_TLS === 'true' ? 'rediss://' : 'redis://';
|
|
6
7
|
const redisConn = `${redisProtocol}${process.env.REDIS_CONNECTION_USER}:${process.env.REDIS_CONNECTION_PASSWORD}@${process.env.REDIS_CONNECTION_HOST}:${process.env.REDIS_CONNECTION_PORT}`;
|
|
@@ -8,7 +9,7 @@ const redisConn = `${redisProtocol}${process.env.REDIS_CONNECTION_USER}:${proces
|
|
|
8
9
|
const redisClient = createClient({
|
|
9
10
|
url: redisConn
|
|
10
11
|
})
|
|
11
|
-
.on('error', err => logger.error('Redis Client ', {
|
|
12
|
+
.on('error', (err: any) => logger.error('Redis Client ', { ex: winston.exceptions.getAllInfo(err) }));
|
|
12
13
|
|
|
13
14
|
export const connect = async () => {
|
|
14
15
|
await redisClient.connect();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seeka-labs/cli-apps",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "Seeka - Apps CLI",
|
|
5
5
|
"author": "SEEKA <platform@seeka.co>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"build:templates": "node ./scripts/build-templates.js",
|
|
27
27
|
"watch": "tsc -w",
|
|
28
28
|
"clean": "yarn rimraf dist",
|
|
29
|
-
"dev": "yarn run clean && yarn build && rimraf seeka-app-test1 && node dist/index.js init seeka-app-test1 --template azure-function --email 'dev@seeka.co' --developer Seeka --noDependencies --browser --env 'SEEKA_APP_ID=123' 'SEEKA_APP_SECRET=345' --packageManager yarn",
|
|
29
|
+
"dev": "yarn run clean && yarn build && rimraf seeka-app-test1 && node dist/index.js init seeka-app-test1 --template azure-function --email 'dev@seeka.co' --developer Seeka --noDependencies --browser --npmUsername testy --npmPassword passworddd --env 'SEEKA_APP_ID=123' 'SEEKA_APP_SECRET=345' --packageManager yarn",
|
|
30
|
+
"dev:nobrowser": "yarn run clean && yarn build && rimraf seeka-app-test1 && node dist/index.js init seeka-app-test1 --template azure-function --email 'dev@seeka.co' --developer Seeka --noDependencies --env 'SEEKA_APP_ID=123' 'SEEKA_APP_SECRET=345' --packageManager yarn",
|
|
30
31
|
"dev:skipSubDir": "yarn run clean && yarn build && rimraf seeka-app-test1 && mkdir seeka-app-test1 && cd seeka-app-test1 && mkdir rootfolder && cd rootfolder && node ../../dist/index.js init seeka-app-test1 --template azure-function --skipSubDir --email 'dev@seeka.co' --developer Seeka --noDependencies --browser --env 'SEEKA_APP_ID=123' 'SEEKA_APP_SECRET=345' --packageManager yarn",
|
|
31
32
|
"dev:skipSubDir2": "yarn run clean && yarn build && cd seeka-app-test2 && node ../dist/index.js init seeka-app-test1 --template azure-function --skipSubDir --email 'dev@seeka.co' --developer Seeka --noDependencies --browser --env 'SEEKA_APP_ID=123' 'SEEKA_APP_SECRET=345' --packageManager yarn"
|
|
32
33
|
},
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
"@jest/globals": "^29.7.0",
|
|
35
36
|
"@types/cross-spawn": "^6.0.6",
|
|
36
37
|
"@types/jest": "^29.5.12",
|
|
38
|
+
"@types/lodash-es": "^4.17.12",
|
|
37
39
|
"@types/node": "^18.14.0",
|
|
38
40
|
"camelcase": "^8.0.0",
|
|
39
41
|
"commander": "^12.0.0",
|
|
@@ -45,6 +47,7 @@
|
|
|
45
47
|
},
|
|
46
48
|
"gitHead": "bd153ede29757d814a114f97953a587b62f0de18",
|
|
47
49
|
"dependencies": {
|
|
50
|
+
"lodash-es": "^4.17.21",
|
|
48
51
|
"source-map-support": "^0.5.21"
|
|
49
52
|
}
|
|
50
53
|
}
|