@mathrunet/masamune 2.4.4 → 2.5.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 (146) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/functions/algolia.js +1 -1
  3. package/dist/functions/algolia.js.map +1 -1
  4. package/dist/functions/consumable_verify_android.js +2 -2
  5. package/dist/functions/consumable_verify_android.js.map +1 -1
  6. package/dist/functions/consumable_verify_ios.js +2 -2
  7. package/dist/functions/consumable_verify_ios.js.map +1 -1
  8. package/dist/functions/gmail.js +1 -1
  9. package/dist/functions/gmail.js.map +1 -1
  10. package/dist/functions/nonconsumable_verify_android.js +2 -2
  11. package/dist/functions/nonconsumable_verify_android.js.map +1 -1
  12. package/dist/functions/nonconsumable_verify_ios.js +2 -2
  13. package/dist/functions/nonconsumable_verify_ios.js.map +1 -1
  14. package/dist/functions/purchase_webhook_android.js +1 -1
  15. package/dist/functions/purchase_webhook_android.js.map +1 -1
  16. package/dist/functions/scheduler.js +9 -1
  17. package/dist/functions/scheduler.js.map +1 -1
  18. package/dist/functions/send_grid.js +1 -1
  19. package/dist/functions/send_grid.js.map +1 -1
  20. package/dist/functions/send_notification.js +29 -1
  21. package/dist/functions/send_notification.js.map +1 -1
  22. package/dist/functions/stripe.d.ts +1 -1
  23. package/dist/functions/stripe.js +3 -3
  24. package/dist/functions/stripe.js.map +1 -1
  25. package/dist/functions/stripe_webhook_secure.d.ts +1 -1
  26. package/dist/functions/stripe_webhook_secure.js +1 -1
  27. package/dist/functions/stripe_webhook_secure.js.map +1 -1
  28. package/dist/functions/subscription_verify_android.js +2 -2
  29. package/dist/functions/subscription_verify_android.js.map +1 -1
  30. package/dist/functions/subscription_verify_ios.js +2 -2
  31. package/dist/functions/subscription_verify_ios.js.map +1 -1
  32. package/dist/functions.d.ts +1 -1
  33. package/dist/functions.js +1 -1
  34. package/dist/functions.js.map +1 -1
  35. package/dist/index.d.ts +10 -10
  36. package/dist/index.js +9 -9
  37. package/dist/index.js.map +1 -1
  38. package/dist/lib/exntensions/string.extension.d.ts +179 -0
  39. package/dist/lib/exntensions/string.extension.js +190 -0
  40. package/dist/lib/exntensions/string.extension.js.map +1 -0
  41. package/dist/lib/functions/firestore.d.ts +15 -0
  42. package/dist/lib/functions/firestore.js +216 -0
  43. package/dist/lib/functions/firestore.js.map +1 -0
  44. package/dist/lib/functions/gmail.d.ts +39 -0
  45. package/dist/lib/functions/gmail.js +65 -0
  46. package/dist/lib/functions/gmail.js.map +1 -0
  47. package/dist/lib/functions/send_grid.d.ts +33 -0
  48. package/dist/lib/functions/send_grid.js +58 -0
  49. package/dist/lib/functions/send_grid.js.map +1 -0
  50. package/dist/lib/functions/send_notification.d.ts +87 -0
  51. package/dist/lib/functions/send_notification.js +270 -0
  52. package/dist/lib/functions/send_notification.js.map +1 -0
  53. package/dist/lib/functions/update_subscription.d.ts +83 -0
  54. package/dist/lib/functions/update_subscription.js +143 -0
  55. package/dist/lib/functions/update_subscription.js.map +1 -0
  56. package/dist/lib/functions/update_unlock.d.ts +13 -0
  57. package/dist/lib/functions/update_unlock.js +64 -0
  58. package/dist/lib/functions/update_unlock.js.map +1 -0
  59. package/dist/lib/functions/update_wallet.d.ts +19 -0
  60. package/dist/lib/functions/update_wallet.js +70 -0
  61. package/dist/lib/functions/update_wallet.js.map +1 -0
  62. package/dist/lib/functions/verify_android.d.ts +50 -0
  63. package/dist/lib/functions/verify_android.js +121 -0
  64. package/dist/lib/functions/verify_android.js.map +1 -0
  65. package/dist/lib/functions/verify_ios.d.ts +26 -0
  66. package/dist/lib/functions/verify_ios.js +110 -0
  67. package/dist/lib/functions/verify_ios.js.map +1 -0
  68. package/dist/lib/model_field_value/converters/firestore_basic_converter.d.ts +20 -0
  69. package/dist/lib/model_field_value/converters/firestore_basic_converter.js +25 -0
  70. package/dist/lib/model_field_value/converters/firestore_basic_converter.js.map +1 -0
  71. package/dist/lib/model_field_value/converters/firestore_enum_converter.d.ts +20 -0
  72. package/dist/lib/model_field_value/converters/firestore_enum_converter.js +25 -0
  73. package/dist/lib/model_field_value/converters/firestore_enum_converter.js.map +1 -0
  74. package/dist/lib/model_field_value/converters/firestore_model_command_base_converter.d.ts +20 -0
  75. package/dist/lib/model_field_value/converters/firestore_model_command_base_converter.js +38 -0
  76. package/dist/lib/model_field_value/converters/firestore_model_command_base_converter.js.map +1 -0
  77. package/dist/lib/model_field_value/converters/firestore_model_counter_converter.d.ts +20 -0
  78. package/dist/lib/model_field_value/converters/firestore_model_counter_converter.js +78 -0
  79. package/dist/lib/model_field_value/converters/firestore_model_counter_converter.js.map +1 -0
  80. package/dist/lib/model_field_value/converters/firestore_model_date_converter.d.ts +20 -0
  81. package/dist/lib/model_field_value/converters/firestore_model_date_converter.js +95 -0
  82. package/dist/lib/model_field_value/converters/firestore_model_date_converter.js.map +1 -0
  83. package/dist/lib/model_field_value/converters/firestore_model_geo_value_converter.d.ts +20 -0
  84. package/dist/lib/model_field_value/converters/firestore_model_geo_value_converter.js +77 -0
  85. package/dist/lib/model_field_value/converters/firestore_model_geo_value_converter.js.map +1 -0
  86. package/dist/lib/model_field_value/converters/firestore_model_image_uri_converter.d.ts +20 -0
  87. package/dist/lib/model_field_value/converters/firestore_model_image_uri_converter.js +74 -0
  88. package/dist/lib/model_field_value/converters/firestore_model_image_uri_converter.js.map +1 -0
  89. package/dist/lib/model_field_value/converters/firestore_model_locale_converter.d.ts +20 -0
  90. package/dist/lib/model_field_value/converters/firestore_model_locale_converter.js +74 -0
  91. package/dist/lib/model_field_value/converters/firestore_model_locale_converter.js.map +1 -0
  92. package/dist/lib/model_field_value/converters/firestore_model_localized_value_converter.d.ts +20 -0
  93. package/dist/lib/model_field_value/converters/firestore_model_localized_value_converter.js +36 -0
  94. package/dist/lib/model_field_value/converters/firestore_model_localized_value_converter.js.map +1 -0
  95. package/dist/lib/model_field_value/converters/firestore_model_ref_converter.d.ts +20 -0
  96. package/dist/lib/model_field_value/converters/firestore_model_ref_converter.js +60 -0
  97. package/dist/lib/model_field_value/converters/firestore_model_ref_converter.js.map +1 -0
  98. package/dist/lib/model_field_value/converters/firestore_model_search_converter.d.ts +20 -0
  99. package/dist/lib/model_field_value/converters/firestore_model_search_converter.js +36 -0
  100. package/dist/lib/model_field_value/converters/firestore_model_search_converter.js.map +1 -0
  101. package/dist/lib/model_field_value/converters/firestore_model_timestamp_converter.d.ts +20 -0
  102. package/dist/lib/model_field_value/converters/firestore_model_timestamp_converter.js +95 -0
  103. package/dist/lib/model_field_value/converters/firestore_model_timestamp_converter.js.map +1 -0
  104. package/dist/lib/model_field_value/converters/firestore_model_token_converter.d.ts +20 -0
  105. package/dist/lib/model_field_value/converters/firestore_model_token_converter.js +36 -0
  106. package/dist/lib/model_field_value/converters/firestore_model_token_converter.js.map +1 -0
  107. package/dist/lib/model_field_value/converters/firestore_model_uri_converter.d.ts +20 -0
  108. package/dist/lib/model_field_value/converters/firestore_model_uri_converter.js +74 -0
  109. package/dist/lib/model_field_value/converters/firestore_model_uri_converter.js.map +1 -0
  110. package/dist/lib/model_field_value/converters/firestore_model_video_uri_converter.d.ts +20 -0
  111. package/dist/lib/model_field_value/converters/firestore_model_video_uri_converter.js +74 -0
  112. package/dist/lib/model_field_value/converters/firestore_model_video_uri_converter.js.map +1 -0
  113. package/dist/lib/model_field_value/converters/firestore_null_converter.d.ts +20 -0
  114. package/dist/lib/model_field_value/converters/firestore_null_converter.js +25 -0
  115. package/dist/lib/model_field_value/converters/firestore_null_converter.js.map +1 -0
  116. package/dist/lib/model_field_value/default_firestore_model_field_value_converter.d.ts +8 -0
  117. package/dist/lib/model_field_value/default_firestore_model_field_value_converter.js +44 -0
  118. package/dist/lib/model_field_value/default_firestore_model_field_value_converter.js.map +1 -0
  119. package/dist/lib/model_field_value/firestore_model_field_value_converter.d.ts +140 -0
  120. package/dist/lib/model_field_value/firestore_model_field_value_converter.js +127 -0
  121. package/dist/lib/model_field_value/firestore_model_field_value_converter.js.map +1 -0
  122. package/dist/lib/model_field_value/model_field_value.d.ts +82 -0
  123. package/dist/lib/model_field_value/model_field_value.js +104 -0
  124. package/dist/lib/model_field_value/model_field_value.js.map +1 -0
  125. package/dist/lib/src/call_process_function_base.d.ts +39 -0
  126. package/dist/lib/src/call_process_function_base.js +69 -0
  127. package/dist/lib/src/call_process_function_base.js.map +1 -0
  128. package/dist/lib/src/functions_base.d.ts +195 -0
  129. package/dist/lib/src/functions_base.js +37 -0
  130. package/dist/lib/src/functions_base.js.map +1 -0
  131. package/dist/lib/src/functions_data.d.ts +10 -0
  132. package/dist/lib/src/functions_data.js +19 -0
  133. package/dist/lib/src/functions_data.js.map +1 -0
  134. package/dist/lib/src/request_process_function_base.d.ts +39 -0
  135. package/dist/lib/src/request_process_function_base.js +69 -0
  136. package/dist/lib/src/request_process_function_base.js.map +1 -0
  137. package/dist/lib/src/schedule_process_function_base.d.ts +33 -0
  138. package/dist/lib/src/schedule_process_function_base.js +70 -0
  139. package/dist/lib/src/schedule_process_function_base.js.map +1 -0
  140. package/dist/lib/src/sql_api_base.d.ts +185 -0
  141. package/dist/lib/src/sql_api_base.js +94 -0
  142. package/dist/lib/src/sql_api_base.js.map +1 -0
  143. package/dist/lib/utils.d.ts +21 -0
  144. package/dist/lib/utils.js +32 -1
  145. package/dist/lib/utils.js.map +1 -1
  146. package/package.json +1 -1
@@ -0,0 +1,216 @@
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.hasMatch = exports.where = void 0;
36
+ const admin = __importStar(require("firebase-admin"));
37
+ function where({ query, wheres, }) {
38
+ if (!wheres) {
39
+ return query;
40
+ }
41
+ for (let w of wheres) {
42
+ const type = w["type"];
43
+ const key = w["key"];
44
+ const value = w["key"];
45
+ if (type === undefined || key === undefined || type === null || key === null) {
46
+ continue;
47
+ }
48
+ switch (type) {
49
+ case "equalTo":
50
+ query = query.where(key, "==", value);
51
+ break;
52
+ case "notEqualTo":
53
+ query = query.where(key, "!=", value);
54
+ break;
55
+ case "lessThan":
56
+ query = query.where(key, "<", value);
57
+ break;
58
+ case "greaterThan":
59
+ query = query.where(key, ">", value);
60
+ break;
61
+ case "lessThanOrEqualTo":
62
+ query = query.where(key, "<=", value);
63
+ break;
64
+ case "greaterThanOrEqualTo":
65
+ query = query.where(key, ">=", value);
66
+ break;
67
+ case "arrayContains":
68
+ query = query.where(key, "array-contains", value);
69
+ break;
70
+ case "arrayContainsAny":
71
+ query = query.where(key, "array-contains-any", value);
72
+ break;
73
+ case "whereIn":
74
+ query = query.where(key, "in", value);
75
+ break;
76
+ case "whereNotIn":
77
+ query = query.where(key, "not-in", value);
78
+ break;
79
+ case "isNull":
80
+ query = query.where(key, "==", null);
81
+ break;
82
+ case "isNotNull":
83
+ query = query.where(key, "!=", null);
84
+ break;
85
+ default:
86
+ break;
87
+ }
88
+ }
89
+ return query;
90
+ }
91
+ exports.where = where;
92
+ function hasMatch(_a) {
93
+ return __awaiter(this, arguments, void 0, function* ({ data, conditions, }) {
94
+ if (!conditions) {
95
+ return true;
96
+ }
97
+ for (let c of conditions) {
98
+ const type = c["type"];
99
+ const key = c["key"];
100
+ const value = c["key"];
101
+ if (type === undefined || key === undefined || type === null || key === null) {
102
+ continue;
103
+ }
104
+ const source = data[key];
105
+ if (source instanceof admin.firestore.DocumentReference && _isObject(value)) {
106
+ const doc = yield source.get();
107
+ const data = doc.data();
108
+ const res = yield hasMatch({ data, conditions: [value] });
109
+ if (!res) {
110
+ return false;
111
+ }
112
+ continue;
113
+ }
114
+ switch (type) {
115
+ case "equalTo":
116
+ if (value === undefined || value === null) {
117
+ continue;
118
+ }
119
+ if (source !== value) {
120
+ return false;
121
+ }
122
+ break;
123
+ case "notEqualTo":
124
+ if (value === undefined || value === null) {
125
+ continue;
126
+ }
127
+ if (source === value) {
128
+ return false;
129
+ }
130
+ break;
131
+ case "lessThan":
132
+ if (value === undefined || value === null || typeof source !== "number" || typeof value !== "number") {
133
+ continue;
134
+ }
135
+ if (source >= value) {
136
+ return false;
137
+ }
138
+ break;
139
+ case "greaterThan":
140
+ if (value === undefined || value === null || typeof source !== "number" || typeof value !== "number") {
141
+ continue;
142
+ }
143
+ if (source <= value) {
144
+ return false;
145
+ }
146
+ break;
147
+ case "lessThanOrEqualTo":
148
+ if (value === undefined || value === null || typeof source !== "number" || typeof value !== "number") {
149
+ continue;
150
+ }
151
+ if (source > value) {
152
+ return false;
153
+ }
154
+ break;
155
+ case "greaterThanOrEqualTo":
156
+ if (value === undefined || value === null || typeof source !== "number" || typeof value !== "number") {
157
+ continue;
158
+ }
159
+ if (source < value) {
160
+ return false;
161
+ }
162
+ break;
163
+ case "arrayContains":
164
+ if (value === undefined || value === null || !Array.isArray(source)) {
165
+ continue;
166
+ }
167
+ if (!source.includes(value)) {
168
+ return false;
169
+ }
170
+ break;
171
+ case "arrayContainsAny":
172
+ if (value === undefined || value === null || !Array.isArray(source) || !Array.isArray(value)) {
173
+ continue;
174
+ }
175
+ if (!source.some(v => value.includes(v))) {
176
+ return false;
177
+ }
178
+ break;
179
+ case "whereIn":
180
+ if (value === undefined || value === null || !Array.isArray(value)) {
181
+ continue;
182
+ }
183
+ if (!value.includes(source)) {
184
+ return false;
185
+ }
186
+ break;
187
+ case "whereNotIn":
188
+ if (value === undefined || value === null || !Array.isArray(value)) {
189
+ continue;
190
+ }
191
+ if (value.includes(source)) {
192
+ return false;
193
+ }
194
+ break;
195
+ case "isNull":
196
+ if (source !== undefined && source !== null) {
197
+ return false;
198
+ }
199
+ break;
200
+ case "isNotNull":
201
+ if (!(source !== undefined && source !== null)) {
202
+ return false;
203
+ }
204
+ break;
205
+ default:
206
+ break;
207
+ }
208
+ }
209
+ return true;
210
+ });
211
+ }
212
+ exports.hasMatch = hasMatch;
213
+ function _isObject(obj) {
214
+ return typeof obj === "object" && obj !== null;
215
+ }
216
+ //# sourceMappingURL=firestore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firestore.js","sourceRoot":"","sources":["../../../src/lib/functions/firestore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AAExC,SAAgB,KAAK,CAAC,EAClB,KAAK,EACL,MAAM,GAIT;IACG,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,KAAK,IAAI,CAAC,IAAI,MAAM,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG,CAA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AS;oBACV,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;wBACjE,SAAS;oBACb,CAAC;oBACD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;wBAC1B,OAAO,KAAK,CAAC;oBACjB,CAAC;oBACD,MAAM;gBACV,KAAK,YAAY;oBACb,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;wBACjE,SAAS;oBACb,CAAC;oBACD,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;wBACzB,OAAO,KAAK,CAAC;oBACjB,CAAC;oBACD,MAAM;gBACV,KAAK,QAAQ;oBACT,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;wBAC1C,OAAO,KAAK,CAAC;oBACjB,CAAC;oBACD,MAAM;gBACV,KAAK,WAAW;oBACZ,IAAI,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,CAAC,EAAE,CAAC;wBAC7C,OAAO,KAAK,CAAC;oBACjB,CAAC;oBACD,MAAM;gBACV;oBACI,MAAM;YACd,CAAC;QAEL,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CAAA;AA5HD,4BA4HC;AAED,SAAS,SAAS,CAAC,GAAQ;IACvB,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,CAAC;AACnD,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Send email via Gmail.
3
+ *
4
+ * Gmailでメールを送信します。
5
+ *
6
+ * @param {string} process.env.MAIL_GMAIL_ID
7
+ * Gmail user ID. Follow the steps below to obtain a Gmail user ID.
8
+ * 1. Press your icon in the upper right corner of the Google top screen and open "Manage Google Account".
9
+ * 2. open "Security" on the left side of the screen and open "App Password
10
+ * GmailのユーザーID。下記の手順で取得します。
11
+ * 1. Googleのトップ画面の画面右上の自分のアイコンを押下し、「Google アカウントを管理」を開く
12
+ * 2. 画面左の「セキュリティ」を開き、「アプリ パスワード」を開く
13
+ *
14
+ * @param {string} process.env.MAIL_GMAIL_PASSWORD
15
+ * Gmail user password. Enter the password obtained in the above procedure.
16
+ * Gmailのユーザーパスワード。上記の手順で取得したパスワードを入力します。
17
+ *
18
+ * @param {string} from
19
+ * Sender's email address.
20
+ * 送信元メールアドレス。
21
+ *
22
+ * @param {string} to
23
+ * Email address to be sent to.
24
+ * 送信先メールアドレス。
25
+ *
26
+ * @param {string} title
27
+ * Email Title.
28
+ * メールタイトル。
29
+ *
30
+ * @param {string} content
31
+ * Email content.
32
+ * メール本文。
33
+ */
34
+ export declare function send({ from, to, title, content, }: {
35
+ from: string;
36
+ to: string;
37
+ title: string;
38
+ content: string;
39
+ }): Promise<void>;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.send = void 0;
13
+ const nodemailer_1 = require("nodemailer");
14
+ /**
15
+ * Send email via Gmail.
16
+ *
17
+ * Gmailでメールを送信します。
18
+ *
19
+ * @param {string} process.env.MAIL_GMAIL_ID
20
+ * Gmail user ID. Follow the steps below to obtain a Gmail user ID.
21
+ * 1. Press your icon in the upper right corner of the Google top screen and open "Manage Google Account".
22
+ * 2. open "Security" on the left side of the screen and open "App Password
23
+ * GmailのユーザーID。下記の手順で取得します。
24
+ * 1. Googleのトップ画面の画面右上の自分のアイコンを押下し、「Google アカウントを管理」を開く
25
+ * 2. 画面左の「セキュリティ」を開き、「アプリ パスワード」を開く
26
+ *
27
+ * @param {string} process.env.MAIL_GMAIL_PASSWORD
28
+ * Gmail user password. Enter the password obtained in the above procedure.
29
+ * Gmailのユーザーパスワード。上記の手順で取得したパスワードを入力します。
30
+ *
31
+ * @param {string} from
32
+ * Sender's email address.
33
+ * 送信元メールアドレス。
34
+ *
35
+ * @param {string} to
36
+ * Email address to be sent to.
37
+ * 送信先メールアドレス。
38
+ *
39
+ * @param {string} title
40
+ * Email Title.
41
+ * メールタイトル。
42
+ *
43
+ * @param {string} content
44
+ * Email content.
45
+ * メール本文。
46
+ */
47
+ function send(_a) {
48
+ return __awaiter(this, arguments, void 0, function* ({ from, to, title, content, }) {
49
+ const mailTransport = (0, nodemailer_1.createTransport)({
50
+ service: "gmail",
51
+ auth: {
52
+ user: process.env.MAIL_GMAIL_ID,
53
+ pass: process.env.MAIL_GMAIL_PASSWORD,
54
+ },
55
+ });
56
+ yield mailTransport.sendMail({
57
+ from: from,
58
+ to: to,
59
+ subject: title,
60
+ text: content,
61
+ });
62
+ });
63
+ }
64
+ exports.send = send;
65
+ //# sourceMappingURL=gmail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gmail.js","sourceRoot":"","sources":["../../../src/lib/functions/gmail.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA2C;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,SAAsB,IAAI;yDAAC,EACzB,IAAI,EACJ,EAAE,EACF,KAAK,EACL,OAAO,GAMR;QACC,MAAM,aAAa,GAAG,IAAA,4BAAe,EAAC;YACpC,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa;gBAC/B,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB;aACtC;SACF,CAAC,CAAC;QACH,MAAM,aAAa,CAAC,QAAQ,CAAC;YAC3B,IAAI,EAAE,IAAI;YACV,EAAE,EAAE,EAAE;YACN,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,OAAO;SACd,CAAC,CAAC;IACL,CAAC;CAAA;AAxBD,oBAwBC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Send mail through SendGrid.
3
+ *
4
+ * SendGridでメールを送信します。
5
+ *
6
+ * @param {string} process.env.MAIL_SENDGRID_APIKEY
7
+ * API key for SendGrid. Issue it according to the following procedure.
8
+ * https://mathru.notion.site/SendGrid-bb87b2ffa8174dbda944812f43856d6c
9
+ * SendGridのAPIキー。下記の手順で発行します。
10
+ * https://mathru.notion.site/SendGrid-bb87b2ffa8174dbda944812f43856d6c
11
+ *
12
+ * @param {string} from
13
+ * Sender's email address.
14
+ * 送信元メールアドレス。
15
+ *
16
+ * @param {string} to
17
+ * Email address to be sent to.
18
+ * 送信先メールアドレス。
19
+ *
20
+ * @param {string} title
21
+ * Email Title.
22
+ * メールタイトル。
23
+ *
24
+ * @param {string} content
25
+ * Email content.
26
+ * メール本文。
27
+ */
28
+ export declare function send({ from, to, title, content, }: {
29
+ from: string;
30
+ to: string;
31
+ title: string;
32
+ content: string;
33
+ }): Promise<void>;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.send = void 0;
16
+ const mail_1 = __importDefault(require("@sendgrid/mail"));
17
+ /**
18
+ * Send mail through SendGrid.
19
+ *
20
+ * SendGridでメールを送信します。
21
+ *
22
+ * @param {string} process.env.MAIL_SENDGRID_APIKEY
23
+ * API key for SendGrid. Issue it according to the following procedure.
24
+ * https://mathru.notion.site/SendGrid-bb87b2ffa8174dbda944812f43856d6c
25
+ * SendGridのAPIキー。下記の手順で発行します。
26
+ * https://mathru.notion.site/SendGrid-bb87b2ffa8174dbda944812f43856d6c
27
+ *
28
+ * @param {string} from
29
+ * Sender's email address.
30
+ * 送信元メールアドレス。
31
+ *
32
+ * @param {string} to
33
+ * Email address to be sent to.
34
+ * 送信先メールアドレス。
35
+ *
36
+ * @param {string} title
37
+ * Email Title.
38
+ * メールタイトル。
39
+ *
40
+ * @param {string} content
41
+ * Email content.
42
+ * メール本文。
43
+ */
44
+ function send(_a) {
45
+ return __awaiter(this, arguments, void 0, function* ({ from, to, title, content, }) {
46
+ var _b;
47
+ mail_1.default.setApiKey((_b = process.env.MAIL_SENDGRID_APIKEY) !== null && _b !== void 0 ? _b : "");
48
+ const msg = {
49
+ to: to,
50
+ from: from,
51
+ subject: title,
52
+ text: content,
53
+ };
54
+ yield mail_1.default.send(msg);
55
+ });
56
+ }
57
+ exports.send = send;
58
+ //# sourceMappingURL=send_grid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send_grid.js","sourceRoot":"","sources":["../../../src/lib/functions/send_grid.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,0DAAsC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAsB,IAAI;yDAAC,EACzB,IAAI,EACJ,EAAE,EACF,KAAK,EACL,OAAO,GAMR;;QACC,cAAQ,CAAC,SAAS,CAAC,MAAA,OAAO,CAAC,GAAG,CAAC,oBAAoB,mCAAI,EAAE,CAAC,CAAC;QAC3D,MAAM,GAAG,GAAG;YACV,EAAE,EAAE,EAAE;YACN,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,OAAO;SACd,CAAC;QACF,MAAM,cAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CAAA;AAnBD,oBAmBC"}
@@ -0,0 +1,87 @@
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
+ * @param badgeCount
37
+ * Specifies the badge count of the notification.
38
+ *
39
+ * 通知のバッジカウントを指定します。
40
+ *
41
+ * @param sound
42
+ * Specifies the sound of the notification.
43
+ *
44
+ * 通知のサウンドを指定します。
45
+ *
46
+ * @param targetCollectionPath
47
+ * Specifies the path of the collection to be notified.
48
+ *
49
+ * 通知対象のコレクションのパスを指定します。
50
+ *
51
+ * @param targetTokenFieldKey
52
+ * Specifies the key of the field used to retrieve the token to be notified.
53
+ *
54
+ * 通知対象のトークンを取得する際のフィールドのキーを指定します。
55
+ *
56
+ * @param targetWhere
57
+ * Specify the conditions for retrieving the collections to be notified.
58
+ *
59
+ * 通知対象のコレクションを取得する際の条件を指定します。
60
+ *
61
+ * @param targetConditions
62
+ * Specify the conditions under which data is to be notified.
63
+ *
64
+ * データを通知対象とする条件を指定します。
65
+ */
66
+ export declare function sendNotification({ title, body, data, channelId, token, topic, badgeCount, sound, targetCollectionPath, targetTokenFieldKey, targetWhere, targetConditions, }: {
67
+ title: string;
68
+ body: string;
69
+ channelId?: string | undefined | null;
70
+ data?: {
71
+ [key: string]: string;
72
+ } | undefined;
73
+ token?: string | string[] | undefined | null;
74
+ topic?: string | undefined | null;
75
+ badgeCount?: number | undefined | null;
76
+ sound?: string | undefined | null;
77
+ targetCollectionPath?: string | undefined | null;
78
+ targetTokenFieldKey?: string | undefined | null;
79
+ targetWhere?: {
80
+ [key: string]: string;
81
+ }[] | undefined;
82
+ targetConditions?: {
83
+ [key: string]: string;
84
+ }[] | undefined;
85
+ }): Promise<{
86
+ [key: string]: any;
87
+ }>;