UNPKG

@mathrunet/masamune

Version:

Manages packages for the server portion (NodeJS) of the Masamune framework.

78 lines 3.1 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.notification = notification; const send_notification_1 = require("../functions/send_notification"); /** * Processes scheduler commands for notification. * * 通知用のスケジューラーコマンドを処理します。 * * @param params * Private parameters. * * プライベートパラメーター。 * * @param doc * Document data. * * ドキュメントデータ。 * * @param firestoreInstance * Firestore instance. * * Firestoreインスタンス。 * * @returns * Response. All data will be overwritten into the document. * * レスポンス。データがすべてドキュメントに上書きされます。 */ function notification(_a) { return __awaiter(this, arguments, void 0, function* ({ doc, firestoreInstance, params, }) { const title = params["title"]; const body = params["text"]; const channelId = params["channel"]; const data = params["data"]; const badgeCount = params["badgeCount"]; const sound = params["sound"]; const targetToken = params["targetToken"]; const targetTopic = params["targetTopic"]; const targetCollectionPath = params["targetCollectionPath"]; const targetDocumentPath = params["targetDocumentPath"]; const targetTokenField = params["targetTokenField"]; const targetWheres = params["targetWheres"]; const targetConditions = params["targetConditions"]; const responseTokenList = params["responseTokenList"]; const res = yield (0, send_notification_1.sendNotification)({ title: title, body: body, channelId: channelId, data: data, badgeCount: badgeCount, sound: sound, targetToken: targetToken, targetTopic: targetTopic, targetCollectionPath: targetCollectionPath, targetDocumentPath: targetDocumentPath, targetTokenField: targetTokenField, targetWheres: targetWheres, targetConditions: targetConditions, responseTokenList: responseTokenList, firestoreInstance: firestoreInstance, }); if (responseTokenList) { return { results: JSON.stringify(res.results) }; } return {}; }); } //# sourceMappingURL=notification.js.map