@mathrunet/masamune 0.6.3 → 1.1.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/functions/agora_cloud_recording.js +1 -1
  3. package/dist/functions/agora_cloud_recording.js.map +1 -1
  4. package/dist/functions/agora_token.js +1 -1
  5. package/dist/functions/agora_token.js.map +1 -1
  6. package/dist/functions/android_auth_code.js +1 -1
  7. package/dist/functions/android_auth_code.js.map +1 -1
  8. package/dist/functions/android_token.js +1 -1
  9. package/dist/functions/android_token.js.map +1 -1
  10. package/dist/functions/consumable_verify_android.js +1 -1
  11. package/dist/functions/consumable_verify_android.js.map +1 -1
  12. package/dist/functions/consumable_verify_ios.js +1 -1
  13. package/dist/functions/consumable_verify_ios.js.map +1 -1
  14. package/dist/functions/gmail.js +1 -1
  15. package/dist/functions/gmail.js.map +1 -1
  16. package/dist/functions/nonconsumable_verify_android.js +1 -1
  17. package/dist/functions/nonconsumable_verify_android.js.map +1 -1
  18. package/dist/functions/nonconsumable_verify_ios.js +1 -1
  19. package/dist/functions/nonconsumable_verify_ios.js.map +1 -1
  20. package/dist/functions/openai_chat_gpt.js +1 -1
  21. package/dist/functions/openai_chat_gpt.js.map +1 -1
  22. package/dist/functions/purchase_webhook_android.js +2 -2
  23. package/dist/functions/purchase_webhook_android.js.map +1 -1
  24. package/dist/functions/purchase_webhook_ios.js +1 -1
  25. package/dist/functions/purchase_webhook_ios.js.map +1 -1
  26. package/dist/functions/send_grid.js +1 -1
  27. package/dist/functions/send_grid.js.map +1 -1
  28. package/dist/functions/send_notification.js +10 -51
  29. package/dist/functions/send_notification.js.map +1 -1
  30. package/dist/functions/send_notification_schedule.d.ts +1 -0
  31. package/dist/functions/send_notification_schedule.js +86 -0
  32. package/dist/functions/send_notification_schedule.js.map +1 -0
  33. package/dist/functions/stripe.js +1 -1
  34. package/dist/functions/stripe.js.map +1 -1
  35. package/dist/functions/stripe_webhook.js +1 -1
  36. package/dist/functions/stripe_webhook.js.map +1 -1
  37. package/dist/functions/stripe_webhook_connect.js +1 -1
  38. package/dist/functions/stripe_webhook_connect.js.map +1 -1
  39. package/dist/functions/stripe_webhook_secure.js +1 -1
  40. package/dist/functions/stripe_webhook_secure.js.map +1 -1
  41. package/dist/functions/subscription_verify_android.js +1 -1
  42. package/dist/functions/subscription_verify_android.js.map +1 -1
  43. package/dist/functions/subscription_verify_ios.js +1 -1
  44. package/dist/functions/subscription_verify_ios.js.map +1 -1
  45. package/dist/functions.d.ts +26 -20
  46. package/dist/functions.js +26 -20
  47. package/dist/functions.js.map +1 -1
  48. package/dist/index.d.ts +8 -7
  49. package/dist/index.js +10 -7
  50. package/dist/index.js.map +1 -1
  51. package/dist/lib/functions_base.d.ts +44 -0
  52. package/dist/lib/functions_base.js +26 -0
  53. package/dist/lib/functions_base.js.map +1 -0
  54. package/dist/lib/functions_data.d.ts +18 -4
  55. package/dist/lib/functions_data.js +13 -2
  56. package/dist/lib/functions_data.js.map +1 -1
  57. package/dist/lib/request_process_function_base.d.ts +42 -0
  58. package/dist/lib/request_process_function_base.js +61 -0
  59. package/dist/lib/request_process_function_base.js.map +1 -0
  60. package/dist/lib/schedule_process_function_base.d.ts +39 -0
  61. package/dist/lib/schedule_process_function_base.js +61 -0
  62. package/dist/lib/schedule_process_function_base.js.map +1 -0
  63. package/dist/lib/send_notification.d.ts +47 -0
  64. package/dist/lib/send_notification.js +135 -0
  65. package/dist/lib/send_notification.js.map +1 -0
  66. package/package.json +1 -1
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Define the process for PUSH notification.
3
+ *
4
+ * PUSH通知を行うための処理を定義します。
5
+ *
6
+ * @param title
7
+ * The title of the notice should be listed.
8
+ *
9
+ * 通知タイトルを記載します。
10
+ *
11
+ * @param body
12
+ * The contents of the notice will be described.
13
+ *
14
+ * 通知内容を記載します。
15
+ *
16
+ * @param channel_id
17
+ * Describe ChannelId for Android.
18
+ *
19
+ * Android向けのChannelIdを記載します。
20
+ *
21
+ * @param data
22
+ * Specify the data to be placed on the notification.
23
+ *
24
+ * 通知に乗せるデータを指定します。
25
+ *
26
+ * @param token
27
+ * Specifies the FCM token.
28
+ *
29
+ * FCMトークンを指定します。
30
+ *
31
+ * @param topic
32
+ * Specifies the topic of the FCM.
33
+ *
34
+ * FCMのトピックを指定します。
35
+ */
36
+ export declare function sendNotification({ title, body, data, channelId, token, topic, }: {
37
+ title: string;
38
+ body: string;
39
+ channelId: string | undefined;
40
+ data: {
41
+ [key: string]: string;
42
+ } | undefined;
43
+ token: string | undefined;
44
+ topic: string | undefined;
45
+ }): Promise<{
46
+ [key: string]: any;
47
+ }>;
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.sendNotification = void 0;
36
+ const functions = __importStar(require("firebase-functions"));
37
+ const admin = __importStar(require("firebase-admin"));
38
+ /**
39
+ * Define the process for PUSH notification.
40
+ *
41
+ * PUSH通知を行うための処理を定義します。
42
+ *
43
+ * @param title
44
+ * The title of the notice should be listed.
45
+ *
46
+ * 通知タイトルを記載します。
47
+ *
48
+ * @param body
49
+ * The contents of the notice will be described.
50
+ *
51
+ * 通知内容を記載します。
52
+ *
53
+ * @param channel_id
54
+ * Describe ChannelId for Android.
55
+ *
56
+ * Android向けのChannelIdを記載します。
57
+ *
58
+ * @param data
59
+ * Specify the data to be placed on the notification.
60
+ *
61
+ * 通知に乗せるデータを指定します。
62
+ *
63
+ * @param token
64
+ * Specifies the FCM token.
65
+ *
66
+ * FCMトークンを指定します。
67
+ *
68
+ * @param topic
69
+ * Specifies the topic of the FCM.
70
+ *
71
+ * FCMのトピックを指定します。
72
+ */
73
+ function sendNotification({ title, body, data, channelId, token, topic, }) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ try {
76
+ if (token === undefined && topic === undefined) {
77
+ throw new functions.https.HttpsError("invalid-argument", "Either [token] or [topic] must be specified.");
78
+ }
79
+ if (token !== undefined) {
80
+ const res = yield admin.messaging().send({
81
+ notification: {
82
+ title: title,
83
+ body: body,
84
+ },
85
+ android: {
86
+ priority: "high",
87
+ notification: {
88
+ title: title,
89
+ body: body,
90
+ clickAction: "FLUTTER_NOTIFICATION_CLICK",
91
+ channelId: channelId,
92
+ },
93
+ },
94
+ data: data,
95
+ token: token,
96
+ });
97
+ return {
98
+ success: true,
99
+ message_id: res,
100
+ };
101
+ }
102
+ else if (topic !== undefined) {
103
+ const res = yield admin.messaging().send({
104
+ notification: {
105
+ title: title,
106
+ body: body,
107
+ },
108
+ android: {
109
+ priority: "high",
110
+ notification: {
111
+ title: title,
112
+ body: body,
113
+ clickAction: "FLUTTER_NOTIFICATION_CLICK",
114
+ channelId: channelId,
115
+ },
116
+ },
117
+ data: data,
118
+ topic: topic,
119
+ });
120
+ return {
121
+ success: true,
122
+ message_id: res,
123
+ };
124
+ }
125
+ }
126
+ catch (err) {
127
+ throw err;
128
+ }
129
+ return {
130
+ success: true,
131
+ };
132
+ });
133
+ }
134
+ exports.sendNotification = sendNotification;
135
+ //# sourceMappingURL=send_notification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send_notification.js","sourceRoot":"","sources":["../../src/lib/send_notification.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgD;AAChD,sDAAwC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,SAAsB,gBAAgB,CAAC,EACnC,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,KAAK,EACL,KAAK,GAQJ;;QACD,IAAI;YACA,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,EAAE;gBAC5C,MAAM,IAAI,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,EAAE,8CAA8C,CAAC,CAAC;aAC5G;YACD,IAAI,KAAK,KAAK,SAAS,EAAE;gBACrB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,SAAS,EAAE,CAAC,IAAI,CACpC;oBACI,YAAY,EAAE;wBACV,KAAK,EAAE,KAAK;wBACZ,IAAI,EAAE,IAAI;qBACb;oBACD,OAAO,EAAE;wBACL,QAAQ,EAAE,MAAM;wBAChB,YAAY,EAAE;4BACV,KAAK,EAAE,KAAK;4BACZ,IAAI,EAAE,IAAI;4BACV,WAAW,EAAE,4BAA4B;4BACzC,SAAS,EAAE,SAAS;yBACvB;qBACJ;oBACD,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE,KAAK;iBACf,CACJ,CAAC;gBACF,OAAO;oBACH,OAAO,EAAE,IAAI;oBACb,UAAU,EAAE,GAAG;iBAClB,CAAC;aACL;iBAAM,IAAI,KAAK,KAAK,SAAS,EAAE;gBAC5B,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,SAAS,EAAE,CAAC,IAAI,CACpC;oBACI,YAAY,EAAE;wBACV,KAAK,EAAE,KAAK;wBACZ,IAAI,EAAE,IAAI;qBACb;oBACD,OAAO,EAAE;wBACL,QAAQ,EAAE,MAAM;wBAChB,YAAY,EAAE;4BACV,KAAK,EAAE,KAAK;4BACZ,IAAI,EAAE,IAAI;4BACV,WAAW,EAAE,4BAA4B;4BACzC,SAAS,EAAE,SAAS;yBACvB;qBACJ;oBACD,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE,KAAK;iBACf,CACJ,CAAC;gBACF,OAAO;oBACH,OAAO,EAAE,IAAI;oBACb,UAAU,EAAE,GAAG;iBAClB,CAAC;aACL;SACJ;QAAC,OAAO,GAAG,EAAE;YACV,MAAM,GAAG,CAAC;SACb;QACD,OAAO;YACH,OAAO,EAAE,IAAI;SAChB,CAAC;IAEN,CAAC;CAAA;AA3ED,4CA2EC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mathrunet/masamune",
3
- "version": "0.6.3",
3
+ "version": "1.1.0",
4
4
  "description": "Manages packages for the server portion (NodeJS) of the Masamune framework.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",