@mathrunet/masamune 2.4.3 → 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.
- package/CHANGELOG.md +18 -0
- package/dist/functions/agora_token.js +26 -11
- package/dist/functions/agora_token.js.map +1 -1
- package/dist/functions/algolia.js +1 -1
- package/dist/functions/algolia.js.map +1 -1
- package/dist/functions/consumable_verify_android.js +2 -2
- package/dist/functions/consumable_verify_android.js.map +1 -1
- package/dist/functions/consumable_verify_ios.js +2 -2
- package/dist/functions/consumable_verify_ios.js.map +1 -1
- package/dist/functions/gmail.js +1 -1
- package/dist/functions/gmail.js.map +1 -1
- package/dist/functions/nonconsumable_verify_android.js +2 -2
- package/dist/functions/nonconsumable_verify_android.js.map +1 -1
- package/dist/functions/nonconsumable_verify_ios.js +2 -2
- package/dist/functions/nonconsumable_verify_ios.js.map +1 -1
- package/dist/functions/purchase_webhook_android.js +1 -1
- package/dist/functions/purchase_webhook_android.js.map +1 -1
- package/dist/functions/scheduler.js +9 -1
- package/dist/functions/scheduler.js.map +1 -1
- package/dist/functions/send_grid.js +1 -1
- package/dist/functions/send_grid.js.map +1 -1
- package/dist/functions/send_notification.js +29 -1
- package/dist/functions/send_notification.js.map +1 -1
- package/dist/functions/stripe.d.ts +1 -1
- package/dist/functions/stripe.js +3 -3
- package/dist/functions/stripe.js.map +1 -1
- package/dist/functions/stripe_webhook_secure.d.ts +1 -1
- package/dist/functions/stripe_webhook_secure.js +1 -1
- package/dist/functions/stripe_webhook_secure.js.map +1 -1
- package/dist/functions/subscription_verify_android.js +2 -2
- package/dist/functions/subscription_verify_android.js.map +1 -1
- package/dist/functions/subscription_verify_ios.js +2 -2
- package/dist/functions/subscription_verify_ios.js.map +1 -1
- package/dist/functions.d.ts +1 -1
- package/dist/functions.js +1 -1
- package/dist/functions.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/lib/exntensions/string.extension.d.ts +179 -0
- package/dist/lib/exntensions/string.extension.js +190 -0
- package/dist/lib/exntensions/string.extension.js.map +1 -0
- package/dist/lib/functions/firestore.d.ts +15 -0
- package/dist/lib/functions/firestore.js +216 -0
- package/dist/lib/functions/firestore.js.map +1 -0
- package/dist/lib/functions/gmail.d.ts +39 -0
- package/dist/lib/functions/gmail.js +65 -0
- package/dist/lib/functions/gmail.js.map +1 -0
- package/dist/lib/functions/send_grid.d.ts +33 -0
- package/dist/lib/functions/send_grid.js +58 -0
- package/dist/lib/functions/send_grid.js.map +1 -0
- package/dist/lib/functions/send_notification.d.ts +87 -0
- package/dist/lib/functions/send_notification.js +270 -0
- package/dist/lib/functions/send_notification.js.map +1 -0
- package/dist/lib/functions/update_subscription.d.ts +83 -0
- package/dist/lib/functions/update_subscription.js +143 -0
- package/dist/lib/functions/update_subscription.js.map +1 -0
- package/dist/lib/functions/update_unlock.d.ts +13 -0
- package/dist/lib/functions/update_unlock.js +64 -0
- package/dist/lib/functions/update_unlock.js.map +1 -0
- package/dist/lib/functions/update_wallet.d.ts +19 -0
- package/dist/lib/functions/update_wallet.js +70 -0
- package/dist/lib/functions/update_wallet.js.map +1 -0
- package/dist/lib/functions/verify_android.d.ts +50 -0
- package/dist/lib/functions/verify_android.js +121 -0
- package/dist/lib/functions/verify_android.js.map +1 -0
- package/dist/lib/functions/verify_ios.d.ts +26 -0
- package/dist/lib/functions/verify_ios.js +110 -0
- package/dist/lib/functions/verify_ios.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_basic_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_basic_converter.js +25 -0
- package/dist/lib/model_field_value/converters/firestore_basic_converter.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_enum_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_enum_converter.js +25 -0
- package/dist/lib/model_field_value/converters/firestore_enum_converter.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_model_command_base_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_model_command_base_converter.js +38 -0
- package/dist/lib/model_field_value/converters/firestore_model_command_base_converter.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_model_counter_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_model_counter_converter.js +78 -0
- package/dist/lib/model_field_value/converters/firestore_model_counter_converter.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_model_date_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_model_date_converter.js +95 -0
- package/dist/lib/model_field_value/converters/firestore_model_date_converter.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_model_geo_value_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_model_geo_value_converter.js +77 -0
- package/dist/lib/model_field_value/converters/firestore_model_geo_value_converter.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_model_image_uri_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_model_image_uri_converter.js +74 -0
- package/dist/lib/model_field_value/converters/firestore_model_image_uri_converter.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_model_locale_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_model_locale_converter.js +74 -0
- package/dist/lib/model_field_value/converters/firestore_model_locale_converter.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_model_localized_value_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_model_localized_value_converter.js +36 -0
- package/dist/lib/model_field_value/converters/firestore_model_localized_value_converter.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_model_ref_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_model_ref_converter.js +60 -0
- package/dist/lib/model_field_value/converters/firestore_model_ref_converter.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_model_search_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_model_search_converter.js +36 -0
- package/dist/lib/model_field_value/converters/firestore_model_search_converter.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_model_timestamp_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_model_timestamp_converter.js +95 -0
- package/dist/lib/model_field_value/converters/firestore_model_timestamp_converter.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_model_token_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_model_token_converter.js +36 -0
- package/dist/lib/model_field_value/converters/firestore_model_token_converter.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_model_uri_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_model_uri_converter.js +74 -0
- package/dist/lib/model_field_value/converters/firestore_model_uri_converter.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_model_video_uri_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_model_video_uri_converter.js +74 -0
- package/dist/lib/model_field_value/converters/firestore_model_video_uri_converter.js.map +1 -0
- package/dist/lib/model_field_value/converters/firestore_null_converter.d.ts +20 -0
- package/dist/lib/model_field_value/converters/firestore_null_converter.js +25 -0
- package/dist/lib/model_field_value/converters/firestore_null_converter.js.map +1 -0
- package/dist/lib/model_field_value/default_firestore_model_field_value_converter.d.ts +8 -0
- package/dist/lib/model_field_value/default_firestore_model_field_value_converter.js +44 -0
- package/dist/lib/model_field_value/default_firestore_model_field_value_converter.js.map +1 -0
- package/dist/lib/model_field_value/firestore_model_field_value_converter.d.ts +140 -0
- package/dist/lib/model_field_value/firestore_model_field_value_converter.js +127 -0
- package/dist/lib/model_field_value/firestore_model_field_value_converter.js.map +1 -0
- package/dist/lib/model_field_value/model_field_value.d.ts +82 -0
- package/dist/lib/model_field_value/model_field_value.js +104 -0
- package/dist/lib/model_field_value/model_field_value.js.map +1 -0
- package/dist/lib/src/call_process_function_base.d.ts +39 -0
- package/dist/lib/src/call_process_function_base.js +69 -0
- package/dist/lib/src/call_process_function_base.js.map +1 -0
- package/dist/lib/src/functions_base.d.ts +195 -0
- package/dist/lib/src/functions_base.js +37 -0
- package/dist/lib/src/functions_base.js.map +1 -0
- package/dist/lib/src/functions_data.d.ts +10 -0
- package/dist/lib/src/functions_data.js +19 -0
- package/dist/lib/src/functions_data.js.map +1 -0
- package/dist/lib/src/request_process_function_base.d.ts +39 -0
- package/dist/lib/src/request_process_function_base.js +69 -0
- package/dist/lib/src/request_process_function_base.js.map +1 -0
- package/dist/lib/src/schedule_process_function_base.d.ts +33 -0
- package/dist/lib/src/schedule_process_function_base.js +70 -0
- package/dist/lib/src/schedule_process_function_base.js.map +1 -0
- package/dist/lib/src/sql_api_base.d.ts +185 -0
- package/dist/lib/src/sql_api_base.js +94 -0
- package/dist/lib/src/sql_api_base.js.map +1 -0
- package/dist/lib/utils.d.ts +21 -0
- package/dist/lib/utils.js +32 -1
- package/dist/lib/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,190 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const crypto = __importStar(require("crypto"));
|
|
27
|
+
String.prototype.encrypt = function ({ key, ivKey }) {
|
|
28
|
+
const raw = this.valueOf();
|
|
29
|
+
const iv = Buffer.from(ivKey);
|
|
30
|
+
const cipher = crypto.createCipheriv("aes-256-cbc", Buffer.from(key), iv);
|
|
31
|
+
let encrypted = cipher.update(raw);
|
|
32
|
+
encrypted = Buffer.concat([encrypted, cipher.final()]);
|
|
33
|
+
return encrypted.toString("hex");
|
|
34
|
+
};
|
|
35
|
+
String.prototype.decrypt = function ({ key, ivKey }) {
|
|
36
|
+
const encrypted = this.valueOf();
|
|
37
|
+
const iv = Buffer.from(ivKey);
|
|
38
|
+
const encryptedText = Buffer.from(encrypted, "hex");
|
|
39
|
+
const decipher = crypto.createDecipheriv("aes-256-cbc", Buffer.from(key), iv);
|
|
40
|
+
let decrypted = decipher.update(encryptedText);
|
|
41
|
+
decrypted = Buffer.concat([decrypted, decipher.final()]);
|
|
42
|
+
return decrypted.toString();
|
|
43
|
+
};
|
|
44
|
+
String.prototype.toZenkakuNumericAndAlphabet = function () {
|
|
45
|
+
return this.valueOf().replace(/[A-Za-z0-9]/g, (s) => {
|
|
46
|
+
return String.fromCharCode(s.charCodeAt(0) + 65248);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
String.prototype.toHankakuNumericAndAlphabet = function () {
|
|
50
|
+
return this.valueOf().replace(/[A-Za-z0-9]/g, (s) => {
|
|
51
|
+
return String.fromCharCode(s.charCodeAt(0) - 65248);
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
String.prototype.toHiragana = function () {
|
|
55
|
+
return this.valueOf().replace(/[\u30a1-\u30f6]/g, (s) => {
|
|
56
|
+
return String.fromCharCode(s.charCodeAt(0) - 0x60);
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
String.prototype.toKatakana = function () {
|
|
60
|
+
return this.valueOf().replace(/[\u3041-\u3096]/g, (s) => {
|
|
61
|
+
return String.fromCharCode(s.charCodeAt(0) + 0x60);
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
String.prototype.toZenkakuKatakana = function () {
|
|
65
|
+
let text = this.valueOf();
|
|
66
|
+
text = text.replace(/[ウカ-トハ-ホ]゙/g, (s) => {
|
|
67
|
+
var _a;
|
|
68
|
+
const dakuten = {
|
|
69
|
+
'ヴ': 'ヴ',
|
|
70
|
+
'ガ': 'ガ',
|
|
71
|
+
'ギ': 'ギ',
|
|
72
|
+
'グ': 'グ',
|
|
73
|
+
'ゲ': 'ゲ',
|
|
74
|
+
'ゴ': 'ゴ',
|
|
75
|
+
'ザ': 'ザ',
|
|
76
|
+
'ジ': 'ジ',
|
|
77
|
+
'ズ': 'ズ',
|
|
78
|
+
'ゼ': 'ゼ',
|
|
79
|
+
'ゾ': 'ゾ',
|
|
80
|
+
'ダ': 'ダ',
|
|
81
|
+
'ヂ': 'ヂ',
|
|
82
|
+
'ヅ': 'ヅ',
|
|
83
|
+
'デ': 'デ',
|
|
84
|
+
'ド': 'ド',
|
|
85
|
+
'バ': 'バ',
|
|
86
|
+
'ビ': 'ビ',
|
|
87
|
+
'ブ': 'ブ',
|
|
88
|
+
'ベ': 'ベ',
|
|
89
|
+
'ボ': 'ボ',
|
|
90
|
+
};
|
|
91
|
+
return (_a = dakuten[s]) !== null && _a !== void 0 ? _a : s;
|
|
92
|
+
});
|
|
93
|
+
text = text.replace(/[ハ-ホ]゚/g, (s) => {
|
|
94
|
+
var _a;
|
|
95
|
+
const handakuten = {
|
|
96
|
+
'パ': 'パ',
|
|
97
|
+
'ピ': 'ピ',
|
|
98
|
+
'プ': 'プ',
|
|
99
|
+
'ペ': 'ペ',
|
|
100
|
+
'ポ': 'ポ',
|
|
101
|
+
};
|
|
102
|
+
return (_a = handakuten[s]) !== null && _a !== void 0 ? _a : s;
|
|
103
|
+
});
|
|
104
|
+
text = text.replace(/[ヲ-ンー]/g, (s) => {
|
|
105
|
+
var _a;
|
|
106
|
+
const other = {
|
|
107
|
+
'ア': 'ア',
|
|
108
|
+
'イ': 'イ',
|
|
109
|
+
'ウ': 'ウ',
|
|
110
|
+
'エ': 'エ',
|
|
111
|
+
'オ': 'オ',
|
|
112
|
+
'ァ': 'ァ',
|
|
113
|
+
'ィ': 'ィ',
|
|
114
|
+
'ゥ': 'ゥ',
|
|
115
|
+
'ェ': 'ェ',
|
|
116
|
+
'ォ': 'ォ',
|
|
117
|
+
'カ': 'カ',
|
|
118
|
+
'キ': 'キ',
|
|
119
|
+
'ク': 'ク',
|
|
120
|
+
'ケ': 'ケ',
|
|
121
|
+
'コ': 'コ',
|
|
122
|
+
'サ': 'サ',
|
|
123
|
+
'シ': 'シ',
|
|
124
|
+
'ス': 'ス',
|
|
125
|
+
'セ': 'セ',
|
|
126
|
+
'ソ': 'ソ',
|
|
127
|
+
'タ': 'タ',
|
|
128
|
+
'チ': 'チ',
|
|
129
|
+
'ツ': 'ツ',
|
|
130
|
+
'テ': 'テ',
|
|
131
|
+
'ト': 'ト',
|
|
132
|
+
'ナ': 'ナ',
|
|
133
|
+
'ニ': 'ニ',
|
|
134
|
+
'ヌ': 'ヌ',
|
|
135
|
+
'ネ': 'ネ',
|
|
136
|
+
'ノ': 'ノ',
|
|
137
|
+
'ハ': 'ハ',
|
|
138
|
+
'ヒ': 'ヒ',
|
|
139
|
+
'フ': 'フ',
|
|
140
|
+
'ヘ': 'ヘ',
|
|
141
|
+
'ホ': 'ホ',
|
|
142
|
+
'マ': 'マ',
|
|
143
|
+
'ミ': 'ミ',
|
|
144
|
+
'ム': 'ム',
|
|
145
|
+
'メ': 'メ',
|
|
146
|
+
'モ': 'モ',
|
|
147
|
+
'ヤ': 'ヤ',
|
|
148
|
+
'ユ': 'ユ',
|
|
149
|
+
'ヨ': 'ヨ',
|
|
150
|
+
'ラ': 'ラ',
|
|
151
|
+
'リ': 'リ',
|
|
152
|
+
'ル': 'ル',
|
|
153
|
+
'レ': 'レ',
|
|
154
|
+
'ロ': 'ロ',
|
|
155
|
+
'ワ': 'ワ',
|
|
156
|
+
'ヲ': 'ヲ',
|
|
157
|
+
'ン': 'ン',
|
|
158
|
+
'ッ': 'ッ',
|
|
159
|
+
'ャ': 'ャ',
|
|
160
|
+
'ュ': 'ュ',
|
|
161
|
+
'ョ': 'ョ',
|
|
162
|
+
'ー': 'ー',
|
|
163
|
+
};
|
|
164
|
+
return (_a = other[s]) !== null && _a !== void 0 ? _a : s;
|
|
165
|
+
});
|
|
166
|
+
return text;
|
|
167
|
+
};
|
|
168
|
+
String.prototype.splitByCharacter = function () {
|
|
169
|
+
return this.valueOf().split("");
|
|
170
|
+
};
|
|
171
|
+
String.prototype.splitByBigram = function () {
|
|
172
|
+
const text = this.valueOf();
|
|
173
|
+
const result = [];
|
|
174
|
+
for (let i = 0; i < text.length - 1; i++) {
|
|
175
|
+
result.push(text.substring(i, Math.min(i + 2, text.length)));
|
|
176
|
+
}
|
|
177
|
+
return result;
|
|
178
|
+
};
|
|
179
|
+
String.prototype.splitByCharacterAndBigram = function () {
|
|
180
|
+
return [...this.splitByCharacter(), ...this.splitByBigram()];
|
|
181
|
+
};
|
|
182
|
+
String.prototype.splitByTrigram = function () {
|
|
183
|
+
const text = this.valueOf();
|
|
184
|
+
const result = [];
|
|
185
|
+
for (let i = 0; i < text.length - 2; i++) {
|
|
186
|
+
result.push(text.substring(i, Math.min(i + 3, text.length)));
|
|
187
|
+
}
|
|
188
|
+
return result;
|
|
189
|
+
};
|
|
190
|
+
//# sourceMappingURL=string.extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.extension.js","sourceRoot":"","sources":["../../../src/lib/exntensions/string.extension.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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,0 +1,15 @@
|
|
|
1
|
+
import * as admin from "firebase-admin";
|
|
2
|
+
export declare function where({ query, wheres, }: {
|
|
3
|
+
query: admin.firestore.Query<admin.firestore.DocumentData, admin.firestore.DocumentData>;
|
|
4
|
+
wheres: {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}[] | undefined;
|
|
7
|
+
}): admin.firestore.Query<admin.firestore.DocumentData, admin.firestore.DocumentData>;
|
|
8
|
+
export declare function hasMatch({ data, conditions, }: {
|
|
9
|
+
data: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
12
|
+
conditions: {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}[] | undefined;
|
|
15
|
+
}): Promise<boolean>;
|
|
@@ -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,CAAC,CAAC,MAAM,CAA8B,CAAC;QAC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AS,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"}
|