@stoker-platform/system-functions 0.5.20 → 0.5.21
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GenerateGlobalConfig } from "@stoker-platform/types";
|
|
1
|
+
import { GenerateGlobalConfig, StokerCollection } from "@stoker-platform/types";
|
|
2
2
|
import { FirestoreEvent, QueryDocumentSnapshot } from "firebase-functions/v2/firestore";
|
|
3
3
|
export declare const messageNotifications: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, {
|
|
4
4
|
tenantId: string;
|
|
5
5
|
messageId: string;
|
|
6
|
-
}>, globalConfig: GenerateGlobalConfig) => Promise<void>;
|
|
6
|
+
}>, globalConfig: GenerateGlobalConfig, collection?: StokerCollection) => Promise<void>;
|
|
@@ -2,7 +2,7 @@ import { getOne, initializeStoker, sendMail, updateRecord, } from "@stoker-platf
|
|
|
2
2
|
import { join } from "path";
|
|
3
3
|
import { error as errorLogger, } from "firebase-functions/logger";
|
|
4
4
|
/* eslint-disable max-len */
|
|
5
|
-
export const messageNotifications = (event, globalConfig) => {
|
|
5
|
+
export const messageNotifications = (event, globalConfig, collection = "Users") => {
|
|
6
6
|
return (async () => {
|
|
7
7
|
const tenantId = event.params.tenantId;
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -11,7 +11,7 @@ export const messageNotifications = (event, globalConfig) => {
|
|
|
11
11
|
const appName = globalConfig("node").appName;
|
|
12
12
|
await initializeStoker("production", tenantId, join(process.cwd(), "lib", "system-custom", "main.js"), join(process.cwd(), "lib", "system-custom", "collections"), true);
|
|
13
13
|
const toId = Object.keys(doc.Recipient)[0];
|
|
14
|
-
const to = await getOne([
|
|
14
|
+
const to = await getOne([collection], toId);
|
|
15
15
|
const sender = Object.values(doc.Sender)[0].Name;
|
|
16
16
|
try {
|
|
17
17
|
await sendMail(to.Email, `${appName} - New Message`, `You have a new message from ${sender}:\n\n${doc.Subject}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageNotifications.js","sourceRoot":"","sources":["../src/messageNotifications.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,MAAM,EACN,gBAAgB,EAChB,QAAQ,EACR,YAAY,GACf,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"messageNotifications.js","sourceRoot":"","sources":["../src/messageNotifications.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,MAAM,EACN,gBAAgB,EAChB,QAAQ,EACR,YAAY,GACf,MAAM,8BAA8B,CAAC;AAWtC,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,EACH,KAAK,IAAI,WAAW,GACvB,MAAM,2BAA2B,CAAC;AAEnC,4BAA4B;AAE5B,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAChC,KAGE,EACF,YAAkC,EAClC,aAA+B,OAAO,EACxC,EAAE;IACA,OAAO,CAAC,KAAK,IAAI,EAAE;QACf,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,QAAkB,CAAC;QACjD,oEAAoE;QACpE,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAK,CAAC;QAC7B,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;QAE7C,MAAM,gBAAgB,CAClB,YAAY,EACZ,QAAQ,EACR,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,SAAS,CAAC,EACtD,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,CAAC,EAC1D,IAAI,CACP,CAAC;QAEF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,CAAC,UAAU,CAAC,EAAE,IAAI,CAAiB,CAAC;QAC5D,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAA8B,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAEzE,IAAI,CAAC;YACD,MAAM,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,OAAO,gBAAgB,EAAE,+BAA+B,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YACjH,MAAM,YAAY,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,cAAc,EAAE;gBAC/C,MAAM,EAAE,SAAS;aACpB,CAAC,CAAC;QACP,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,YAAY,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,cAAc,EAAE;gBAC/C,MAAM,EAAE,QAAQ;aACnB,CAAC,CAAC;YACH,WAAW,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;QACD,OAAO;IACX,CAAC,CAAC,EAAE,CAAC;AACT,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoker-platform/system-functions",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.21",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"main": "lib/main.js",
|
|
7
7
|
"types": "lib/main.d.ts",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"@genkit-ai/firebase": "^1.28.0",
|
|
20
20
|
"@genkit-ai/google-genai": "^1.28.0",
|
|
21
21
|
"@google-cloud/storage": "^7.19.0",
|
|
22
|
-
"@stoker-platform/node-client": "0.5.
|
|
23
|
-
"@stoker-platform/types": "0.5.
|
|
24
|
-
"@stoker-platform/utils": "0.5.
|
|
22
|
+
"@stoker-platform/node-client": "0.5.19",
|
|
23
|
+
"@stoker-platform/types": "0.5.9",
|
|
24
|
+
"@stoker-platform/utils": "0.5.13",
|
|
25
25
|
"dotenv": "^17.2.4",
|
|
26
26
|
"firebase-admin": "^13.6.1",
|
|
27
27
|
"firebase-functions": "^6.6.0",
|