@mathrunet/masamune 0.2.0 → 0.4.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 +27 -0
- package/dist/functions/gmail.d.ts +1 -0
- package/dist/functions/gmail.js +89 -0
- package/dist/functions/gmail.js.map +1 -0
- package/dist/functions/send_grid.d.ts +1 -0
- package/dist/functions/send_grid.js +83 -0
- package/dist/functions/send_grid.js.map +1 -0
- package/dist/functions/stripe.d.ts +1 -0
- package/dist/functions/stripe.js +1172 -0
- package/dist/functions/stripe.js.map +1 -0
- package/dist/functions/stripe_hook.d.ts +1 -0
- package/dist/functions/stripe_hook.js +574 -0
- package/dist/functions/stripe_hook.js.map +1 -0
- package/dist/functions/stripe_hook_connect.d.ts +1 -0
- package/dist/functions/stripe_hook_connect.js +140 -0
- package/dist/functions/stripe_hook_connect.js.map +1 -0
- package/dist/functions/stripe_hook_secure.d.ts +1 -0
- package/dist/functions/stripe_hook_secure.js +146 -0
- package/dist/functions/stripe_hook_secure.js.map +1 -0
- package/dist/functions.d.ts +68 -0
- package/dist/functions.js +68 -0
- package/dist/functions.js.map +1 -1
- package/dist/lib/gmail.d.ts +34 -0
- package/dist/lib/gmail.js +90 -0
- package/dist/lib/gmail.js.map +1 -0
- package/dist/lib/send_gmail.d.ts +34 -0
- package/dist/lib/send_gmail.js +90 -0
- package/dist/lib/send_gmail.js.map +1 -0
- package/dist/lib/send_grid.d.ts +28 -0
- package/dist/lib/send_grid.js +79 -0
- package/dist/lib/send_grid.js.map +1 -0
- package/dist/lib/utils.d.ts +56 -0
- package/dist/lib/utils.js +124 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +14 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
# [0.4.0](https://github.com/mathrunet/node_masamune/compare/v0.3.0...v0.4.0) (2023-05-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### chore
|
|
5
|
+
|
|
6
|
+
* command was added. ([bff8928](https://github.com/mathrunet/node_masamune/commit/bff8928505d5e411e061dcc45051463a7381e1b9))
|
|
7
|
+
* Fixed a bug in the command. ([fef7d3c](https://github.com/mathrunet/node_masamune/commit/fef7d3c59b10e0e912920be9802389ebd45759fe))
|
|
8
|
+
|
|
9
|
+
### feat
|
|
10
|
+
|
|
11
|
+
* Added Functions for sending mail. ([7efe881](https://github.com/mathrunet/node_masamune/commit/7efe881e3481ebd6f651c5a1c1127a4d8399c9b8))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# [0.3.0](https://github.com/mathrunet/node_masamune/compare/v0.2.0...v0.3.0) (2023-05-26)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### feat
|
|
19
|
+
|
|
20
|
+
* Added a series of Stripe features. ([4d430b7](https://github.com/mathrunet/node_masamune/commit/4d430b7df07e363c452877fcd21cc043d309ff6c))
|
|
21
|
+
|
|
22
|
+
### fix
|
|
23
|
+
|
|
24
|
+
* Package modifications. ([94807d9](https://github.com/mathrunet/node_masamune/commit/94807d976e18ea7a4e7c42453b9dd6147c21d289))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
1
28
|
# [0.2.0](https://github.com/mathrunet/node_masamune/compare/v0.1.7...v0.2.0) (2023-04-18)
|
|
2
29
|
|
|
3
30
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
const functions = __importStar(require("firebase-functions"));
|
|
36
|
+
const gmail = __importStar(require("../lib/gmail"));
|
|
37
|
+
/**
|
|
38
|
+
* Send email via Gmail.
|
|
39
|
+
*
|
|
40
|
+
* Gmailでメールを送信します。
|
|
41
|
+
*
|
|
42
|
+
* @param {string} purchase.mail.gmail.id
|
|
43
|
+
* Gmail user ID. Follow the steps below to obtain a Gmail user ID.
|
|
44
|
+
* 1. Press your icon in the upper right corner of the Google top screen and open "Manage Google Account".
|
|
45
|
+
* 2. open "Security" on the left side of the screen and open "App Password
|
|
46
|
+
* GmailのユーザーID。下記の手順で取得します。
|
|
47
|
+
* 1. Googleのトップ画面の画面右上の自分のアイコンを押下し、「Google アカウントを管理」を開く
|
|
48
|
+
* 2. 画面左の「セキュリティ」を開き、「アプリ パスワード」を開く
|
|
49
|
+
*
|
|
50
|
+
* @param {string} purchase.mail.gmail.password
|
|
51
|
+
* Gmail user password. Enter the password obtained in the above procedure.
|
|
52
|
+
* Gmailのユーザーパスワード。上記の手順で取得したパスワードを入力します。
|
|
53
|
+
*
|
|
54
|
+
* @param {string} from
|
|
55
|
+
* Sender's email address.
|
|
56
|
+
* 送信元メールアドレス。
|
|
57
|
+
*
|
|
58
|
+
* @param {string} to
|
|
59
|
+
* Email address to be sent to.
|
|
60
|
+
* 送信先メールアドレス。
|
|
61
|
+
*
|
|
62
|
+
* @param {string} title
|
|
63
|
+
* Email Title.
|
|
64
|
+
* メールタイトル。
|
|
65
|
+
*
|
|
66
|
+
* @param {string} content
|
|
67
|
+
* Email content.
|
|
68
|
+
* メール本文。
|
|
69
|
+
*/
|
|
70
|
+
module.exports = (regions) => functions.region(...regions).https.onCall((query) => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
+
try {
|
|
72
|
+
const from = query.from;
|
|
73
|
+
const to = query.to;
|
|
74
|
+
const title = query.title;
|
|
75
|
+
const content = query.content;
|
|
76
|
+
if (!from || !to || !title || !content) {
|
|
77
|
+
throw new functions.https.HttpsError("invalid-argument", "Query parameter is invalid.");
|
|
78
|
+
}
|
|
79
|
+
yield gmail.send(from, to, title, content);
|
|
80
|
+
return {
|
|
81
|
+
success: true,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
console.log(err);
|
|
86
|
+
throw err;
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
//# sourceMappingURL=gmail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gmail.js","sourceRoot":"","sources":["../../src/functions/gmail.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgD;AAChD,oDAAsC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,OAAO,GAAG,CAAC,OAAiB,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAC7E,CAAO,KAAK,EAAE,EAAE;IACZ,IAAI;QACA,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;QACpB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC1B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE;YACpC,MAAM,IAAI,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,EAAE,6BAA6B,CAAC,CAAC;SAC3F;QACD,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO;YACH,OAAO,EAAE,IAAI;SAChB,CAAC;KACL;IAAC,OAAO,GAAG,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjB,MAAM,GAAG,CAAC;KACb;AACL,CAAC,CAAA,CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
const functions = __importStar(require("firebase-functions"));
|
|
36
|
+
const sendgrid = __importStar(require("../lib/send_grid"));
|
|
37
|
+
/**
|
|
38
|
+
* Send mail through SendGrid.
|
|
39
|
+
*
|
|
40
|
+
* SendGridでメールを送信します。
|
|
41
|
+
*
|
|
42
|
+
* @param {string} purchase.mail.sendgrid.api_key
|
|
43
|
+
* API key for SendGrid. Issue it according to the following procedure.
|
|
44
|
+
* https://mathru.notion.site/SendGrid-bb87b2ffa8174dbda944812f43856d6c
|
|
45
|
+
* SendGridのAPIキー。下記の手順で発行します。
|
|
46
|
+
* https://mathru.notion.site/SendGrid-bb87b2ffa8174dbda944812f43856d6c
|
|
47
|
+
*
|
|
48
|
+
* @param {string} from
|
|
49
|
+
* Sender's email address.
|
|
50
|
+
* 送信元メールアドレス。
|
|
51
|
+
*
|
|
52
|
+
* @param {string} to
|
|
53
|
+
* Email address to be sent to.
|
|
54
|
+
* 送信先メールアドレス。
|
|
55
|
+
*
|
|
56
|
+
* @param {string} title
|
|
57
|
+
* Email Title.
|
|
58
|
+
* メールタイトル。
|
|
59
|
+
*
|
|
60
|
+
* @param {string} content
|
|
61
|
+
* Email content.
|
|
62
|
+
* メール本文。
|
|
63
|
+
*/
|
|
64
|
+
module.exports = (regions) => functions.region(...regions).https.onCall((query) => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
+
try {
|
|
66
|
+
const from = query.from;
|
|
67
|
+
const to = query.to;
|
|
68
|
+
const title = query.title;
|
|
69
|
+
const content = query.content;
|
|
70
|
+
if (!from || !to || !title || !content) {
|
|
71
|
+
throw new functions.https.HttpsError("invalid-argument", "Query parameter is invalid.");
|
|
72
|
+
}
|
|
73
|
+
yield sendgrid.send(from, to, title, content);
|
|
74
|
+
return {
|
|
75
|
+
success: true,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
console.error(err);
|
|
80
|
+
throw err;
|
|
81
|
+
}
|
|
82
|
+
}));
|
|
83
|
+
//# sourceMappingURL=send_grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send_grid.js","sourceRoot":"","sources":["../../src/functions/send_grid.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgD;AAChD,2DAA6C;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,OAAO,GAAG,CAAC,OAAiB,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAC7E,CAAO,KAAK,EAAE,EAAE;IACZ,IAAI;QACA,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;QACpB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC1B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE;YACpC,MAAM,IAAI,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,EAAE,6BAA6B,CAAC,CAAC;SAC3F;QACD,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC9C,OAAO;YACH,OAAO,EAAE,IAAI;SAChB,CAAC;KACL;IAAC,OAAO,GAAG,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,MAAM,GAAG,CAAC;KACb;AACL,CAAC,CAAA,CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|