@mathrunet/masamune 1.10.3 → 2.0.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 (79) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE +19 -22
  3. package/dist/functions/agora_cloud_recording.js +48 -38
  4. package/dist/functions/agora_cloud_recording.js.map +1 -1
  5. package/dist/functions/agora_token.js +40 -30
  6. package/dist/functions/agora_token.js.map +1 -1
  7. package/dist/functions/android_auth_code.js +25 -15
  8. package/dist/functions/android_auth_code.js.map +1 -1
  9. package/dist/functions/android_token.js +46 -34
  10. package/dist/functions/android_token.js.map +1 -1
  11. package/dist/functions/consumable_verify_android.js +45 -35
  12. package/dist/functions/consumable_verify_android.js.map +1 -1
  13. package/dist/functions/consumable_verify_ios.js +39 -29
  14. package/dist/functions/consumable_verify_ios.js.map +1 -1
  15. package/dist/functions/geocoding.js +29 -19
  16. package/dist/functions/geocoding.js.map +1 -1
  17. package/dist/functions/gmail.js +36 -26
  18. package/dist/functions/gmail.js.map +1 -1
  19. package/dist/functions/nonconsumable_verify_android.js +44 -34
  20. package/dist/functions/nonconsumable_verify_android.js.map +1 -1
  21. package/dist/functions/nonconsumable_verify_ios.js +38 -28
  22. package/dist/functions/nonconsumable_verify_ios.js.map +1 -1
  23. package/dist/functions/openai_chat_gpt.js +39 -29
  24. package/dist/functions/openai_chat_gpt.js.map +1 -1
  25. package/dist/functions/purchase_webhook_android.js +26 -18
  26. package/dist/functions/purchase_webhook_android.js.map +1 -1
  27. package/dist/functions/purchase_webhook_ios.js +92 -78
  28. package/dist/functions/purchase_webhook_ios.js.map +1 -1
  29. package/dist/functions/scheduler.js +15 -9
  30. package/dist/functions/scheduler.js.map +1 -1
  31. package/dist/functions/send_grid.js +35 -25
  32. package/dist/functions/send_grid.js.map +1 -1
  33. package/dist/functions/send_notification.js +37 -24
  34. package/dist/functions/send_notification.js.map +1 -1
  35. package/dist/functions/stripe.js +866 -858
  36. package/dist/functions/stripe.js.map +1 -1
  37. package/dist/functions/stripe_webhook.js +370 -363
  38. package/dist/functions/stripe_webhook.js.map +1 -1
  39. package/dist/functions/stripe_webhook_connect.js +72 -63
  40. package/dist/functions/stripe_webhook_connect.js.map +1 -1
  41. package/dist/functions/stripe_webhook_secure.js +72 -63
  42. package/dist/functions/stripe_webhook_secure.js.map +1 -1
  43. package/dist/functions/subscription_verify_android.js +61 -52
  44. package/dist/functions/subscription_verify_android.js.map +1 -1
  45. package/dist/functions/subscription_verify_ios.js +59 -50
  46. package/dist/functions/subscription_verify_ios.js.map +1 -1
  47. package/dist/functions.d.ts +22 -68
  48. package/dist/functions.js +22 -22
  49. package/dist/functions.js.map +1 -1
  50. package/dist/index.js +1 -1
  51. package/dist/index.js.map +1 -1
  52. package/dist/lib/call_process_function_base.d.ts +2 -15
  53. package/dist/lib/call_process_function_base.js +13 -13
  54. package/dist/lib/call_process_function_base.js.map +1 -1
  55. package/dist/lib/functions_base.d.ts +97 -9
  56. package/dist/lib/functions_base.js +10 -7
  57. package/dist/lib/functions_base.js.map +1 -1
  58. package/dist/lib/functions_data.d.ts +2 -36
  59. package/dist/lib/functions_data.js +2 -29
  60. package/dist/lib/functions_data.js.map +1 -1
  61. package/dist/lib/gmail.d.ts +2 -2
  62. package/dist/lib/gmail.js +4 -29
  63. package/dist/lib/gmail.js.map +1 -1
  64. package/dist/lib/request_process_function_base.d.ts +4 -16
  65. package/dist/lib/request_process_function_base.js +13 -13
  66. package/dist/lib/request_process_function_base.js.map +1 -1
  67. package/dist/lib/schedule_process_function_base.d.ts +13 -11
  68. package/dist/lib/schedule_process_function_base.js +15 -9
  69. package/dist/lib/schedule_process_function_base.js.map +1 -1
  70. package/dist/lib/send_grid.d.ts +1 -1
  71. package/dist/lib/send_grid.js +3 -27
  72. package/dist/lib/send_grid.js.map +1 -1
  73. package/dist/lib/send_notification.js +1 -1
  74. package/dist/lib/send_notification.js.map +1 -1
  75. package/dist/lib/verify_android.js +1 -1
  76. package/dist/lib/verify_android.js.map +1 -1
  77. package/dist/lib/verify_ios.js +1 -1
  78. package/dist/lib/verify_ios.js.map +1 -1
  79. package/package.json +2 -2
@@ -33,7 +33,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
35
  exports.CallProcessFunctionBase = void 0;
36
- const functions = __importStar(require("firebase-functions"));
36
+ const functions = __importStar(require("firebase-functions/v2"));
37
37
  const functions_base_1 = require("./functions_base");
38
38
  /**
39
39
  * Base class for defining the data of Functions for executing the Call method of Functions.
@@ -41,21 +41,21 @@ const functions_base_1 = require("./functions_base");
41
41
  * FunctionsのCallメソッド実行用のFunctionのデータを定義するためのベースクラス。
42
42
  */
43
43
  class CallProcessFunctionBase extends functions_base_1.FunctionsBase {
44
- /**
45
- * Base class for defining the data of Functions for executing the Call method of Functions.
46
- *
47
- * FunctionsのCallメソッド実行用のFunctionのデータを定義するためのベースクラス。
48
- */
49
44
  constructor() {
50
- super();
45
+ super(...arguments);
51
46
  this.data = {};
52
47
  }
53
- build(regions, data) {
54
- return functions.runWith({
55
- timeoutSeconds: this.timeoutSeconds,
56
- }).region(...regions).https.onCall((query) => __awaiter(this, void 0, void 0, function* () {
57
- const config = functions.config();
58
- return this.process(query, config);
48
+ build(regions) {
49
+ var _a;
50
+ return functions.https.onCall({
51
+ region: regions,
52
+ timeoutSeconds: this.options.timeoutSeconds,
53
+ memory: this.options.memory,
54
+ minInstances: this.options.minInstances,
55
+ concurrency: this.options.concurrency,
56
+ maxInstances: (_a = this.options.maxInstances) !== null && _a !== void 0 ? _a : undefined,
57
+ }, (query) => __awaiter(this, void 0, void 0, function* () {
58
+ return this.process(query);
59
59
  }));
60
60
  }
61
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"call_process_function_base.js","sourceRoot":"","sources":["../../src/lib/call_process_function_base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgD;AAChD,qDAAiD;AAEjD;;;;GAIG;AACH,MAAsB,uBAAwB,SAAQ,8BAAa;IAC/D;;;;OAIG;IACH;QACI,KAAK,EAAE,CAAC;QAyBZ,SAAI,GAA8B,EAAE,CAAC;IAxBrC,CAAC;IAyBD,KAAK,CAAC,OAAiB,EAAE,IAA+B;QACpD,OAAO,SAAS,CAAC,OAAO,CAAC;YACrB,cAAc,EAAE,IAAI,CAAC,cAAc;SACtC,CAAC,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAO,KAAK,EAAE,EAAE;YAC/C,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACvC,CAAC,CAAA,CAAC,CAAC;IACP,CAAC;CACJ;AAzCD,0DAyCC"}
1
+ {"version":3,"file":"call_process_function_base.js","sourceRoot":"","sources":["../../src/lib/call_process_function_base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAmD;AACnD,qDAAiD;AAEjD;;;;GAIG;AACH,MAAsB,uBAAwB,SAAQ,8BAAa;IAAnE;;QAkBI,SAAI,GAA8B,EAAE,CAAC;IAgBzC,CAAC;IAfG,KAAK,CAAC,OAAiB;;QACnB,OAAO,SAAS,CAAC,KAAK,CAAC,MAAM,CACzB;YACI,MAAM,EAAE,OAAO;YACf,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc;YAC3C,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;YAC3B,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY;YACvC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;YACrC,YAAY,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,YAAY,mCAAI,SAAS;SACvD,EACD,CAAO,KAAK,EAAE,EAAE;YACZ,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAA,CACJ,CAAC;IACN,CAAC;CACJ;AAlCD,0DAkCC"}
@@ -1,3 +1,4 @@
1
+ import { MemoryOption } from "firebase-functions/v2";
1
2
  /**
2
3
  * Define Function data for FirebaseFunctions.
3
4
  *
@@ -17,34 +18,121 @@ export declare abstract class FunctionsBase {
17
18
  *
18
19
  * `build`にてFirebaseFunctionsを生成するためのコードを記述します。
19
20
  */
20
- constructor();
21
+ constructor({ id, func, data, options, }: {
22
+ id: string;
23
+ func: (region: string[], options: FunctionsOptions, data: {
24
+ [key: string]: string;
25
+ }) => Function;
26
+ data?: {
27
+ [key: string]: string;
28
+ };
29
+ options?: FunctionsOptions | undefined | null;
30
+ });
21
31
  /**
22
32
  * @param id
23
33
  * Describe the method names used in Functions.
24
34
  *
25
35
  * Functionsで利用されるメソッド名を記述します。
26
36
  */
27
- abstract id: string;
37
+ readonly id: string;
38
+ /**
39
+ * @param func
40
+ * Specify the actual contents of the process.
41
+ *
42
+ * 実際の処理の中身を指定します。
43
+ */
44
+ readonly func: (region: string[], options: FunctionsOptions, data: {
45
+ [key: string]: string;
46
+ }) => Function;
28
47
  /**
29
48
  * Specify the data to be passed to the process.
30
49
  *
31
50
  * 処理に渡すデータを指定します。
32
51
  */
33
- abstract data: {
52
+ readonly data: {
34
53
  [key: string]: string;
35
54
  };
36
55
  /**
37
- * Specifies the timeout period.
56
+ * Specify processing options.
38
57
  *
39
- * タイムアウト時間を指定します。
58
+ * 処理のオプションを指定します。
40
59
  */
41
- timeoutSeconds: number;
60
+ readonly options: FunctionsOptions;
42
61
  /**
43
62
  * Write code to generate FirebaseFunctions.
44
63
  *
45
64
  * FirebaseFunctionsを生成するためのコードを記述します。
46
65
  */
47
- abstract build(region: string[], data: {
48
- [key: string]: string;
49
- }): Function;
66
+ abstract build(region: string[]): Function;
67
+ }
68
+ /**
69
+ * Specifies the options for the process.
70
+ *
71
+ * 処理のオプションを指定します。
72
+ */
73
+ export interface SchedulerFunctionsOptions extends FunctionsOptions {
74
+ /**
75
+ * Specifies the schedule.
76
+ * * Cron format and AppEngine format are available.
77
+ * * For Cron format, specify as `5 11 * * *`.
78
+ * * For AppEngine format, specify as `every 1 minutes`.
79
+ *
80
+ * スケジュールを指定します。
81
+ * * Cron形式とAppEngine形式で指定可能です。
82
+ * * Cron形式の場合は、`5 11 * * *`のように指定します。
83
+ * * AppEngine形式の場合は、`every 1 minutes`のように指定します。
84
+ */
85
+ schedule?: string | undefined | null;
86
+ }
87
+ /**
88
+ * Specifies the options for the process.
89
+ *
90
+ * 処理のオプションを指定します。
91
+ */
92
+ export interface PubsubFunctionsOptions extends FunctionsOptions {
93
+ /**
94
+ * Specifies the topic.
95
+ * You can create a `purchasing` topic in GCP's pub/sub and set the principal to "google-play-developer-notifications@system.gserviceaccount.com" to receive notifications.
96
+ *
97
+ * トピックを指定します。
98
+ * GCPのpub/subに`purchasing`のトピックを作成しプリンシパルに「google-play-developer-notifications@system.gserviceaccount.com」を設定することで通知を受け取ることができるようになります。
99
+ */
100
+ topic?: string | undefined | null;
101
+ }
102
+ /**
103
+ * Specifies the options for the process.
104
+ *
105
+ * 処理のオプションを指定します。
106
+ */
107
+ export interface FunctionsOptions {
108
+ /**
109
+ * Specifies the timeout period.
110
+ *
111
+ * タイムアウト時間を指定します。
112
+ */
113
+ timeoutSeconds?: number | undefined;
114
+ /**
115
+ * Specifies the memory.
116
+ *
117
+ * メモリを指定します。
118
+ */
119
+ memory?: MemoryOption | undefined;
120
+ /**
121
+ * Specifies the minInstances.
122
+ *
123
+ * minInstancesを指定します。
124
+ */
125
+ minInstances?: number | undefined;
126
+ /**
127
+ * Specifies the maxInstances.
128
+ *
129
+ * maxInstancesを指定します。
130
+ */
131
+ maxInstances?: number | undefined | null;
132
+ /**
133
+ * Specifies the concurrency.
134
+ *
135
+ * concurrencyを指定します。
136
+ */
137
+ concurrency?: number | undefined;
50
138
  }
@@ -20,13 +20,16 @@ class FunctionsBase {
20
20
  *
21
21
  * `build`にてFirebaseFunctionsを生成するためのコードを記述します。
22
22
  */
23
- constructor() {
24
- /**
25
- * Specifies the timeout period.
26
- *
27
- * タイムアウト時間を指定します。
28
- */
29
- this.timeoutSeconds = 60;
23
+ constructor({ id, func, data = {}, options, }) {
24
+ this.id = id;
25
+ this.func = func;
26
+ this.data = data;
27
+ this.options = options !== null && options !== void 0 ? options : {
28
+ timeoutSeconds: 60,
29
+ memory: "256MiB",
30
+ minInstances: 0,
31
+ concurrency: 80,
32
+ };
30
33
  }
31
34
  }
32
35
  exports.FunctionsBase = FunctionsBase;
@@ -1 +1 @@
1
- {"version":3,"file":"functions_base.js","sourceRoot":"","sources":["../../src/lib/functions_base.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;GAQG;AACH,MAAsB,aAAa;IAC/B;;;;;;;;OAQG;IACH;QAiBA;;;;WAIG;QACH,mBAAc,GAAW,EAAE,CAAC;IAtBZ,CAAC;CA8BpB;AAxCD,sCAwCC"}
1
+ {"version":3,"file":"functions_base.js","sourceRoot":"","sources":["../../src/lib/functions_base.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;GAQG;AACH,MAAsB,aAAa;IAC/B;;;;;;;;OAQG;IACH,YAAY,EACR,EAAE,EACF,IAAI,EACJ,IAAI,GAAG,EAAE,EACT,OAAO,GAUV;QACG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI;YACtB,cAAc,EAAE,EAAE;YAClB,MAAM,EAAE,QAAQ;YAChB,YAAY,EAAE,CAAC;YACf,WAAW,EAAE,EAAE;SAClB,CAAC;IACN,CAAC;CA0CJ;AA5ED,sCA4EC"}
@@ -1,44 +1,10 @@
1
1
  import { FunctionsBase } from "./functions_base";
2
+ export { FunctionsOptions, SchedulerFunctionsOptions, PubsubFunctionsOptions } from "./functions_base";
2
3
  /**
3
4
  * Define Function data for FirebaseFunctions.
4
5
  *
5
6
  * FirebaseFunctions用のFunctionのデータを定義します。
6
7
  */
7
8
  export declare class FunctionsData extends FunctionsBase {
8
- readonly id: string;
9
- readonly func: (region: string[], timeoutSeconds: number, data: {
10
- [key: string]: string;
11
- }) => Function;
12
- readonly timeoutSeconds: number;
13
- readonly data: {
14
- [key: string]: string;
15
- };
16
- /**
17
- * Define Function data for FirebaseFunctions.
18
- *
19
- * FirebaseFunctions用のFunctionのデータを定義します。
20
- *
21
- * @param id
22
- * Describe the method names used in Functions.
23
- *
24
- * Functionsで利用されるメソッド名を記述します。
25
- *
26
- * @param func
27
- * Specify the actual contents of the process.
28
- *
29
- * 実際の処理の中身を指定します。
30
- *
31
- * @param data
32
- * Specify the data to be passed to the process.
33
- *
34
- * 処理に渡すデータを指定します。
35
- */
36
- constructor(id: string, func: (region: string[], timeoutSeconds: number, data: {
37
- [key: string]: string;
38
- }) => Function, timeoutSeconds?: number, data?: {
39
- [key: string]: string;
40
- });
41
- build(region: string[], data: {
42
- [key: string]: string;
43
- }): Function;
9
+ build(region: string[]): Function;
44
10
  }
@@ -8,35 +8,8 @@ const functions_base_1 = require("./functions_base");
8
8
  * FirebaseFunctions用のFunctionのデータを定義します。
9
9
  */
10
10
  class FunctionsData extends functions_base_1.FunctionsBase {
11
- /**
12
- * Define Function data for FirebaseFunctions.
13
- *
14
- * FirebaseFunctions用のFunctionのデータを定義します。
15
- *
16
- * @param id
17
- * Describe the method names used in Functions.
18
- *
19
- * Functionsで利用されるメソッド名を記述します。
20
- *
21
- * @param func
22
- * Specify the actual contents of the process.
23
- *
24
- * 実際の処理の中身を指定します。
25
- *
26
- * @param data
27
- * Specify the data to be passed to the process.
28
- *
29
- * 処理に渡すデータを指定します。
30
- */
31
- constructor(id, func, timeoutSeconds = 60, data = {}) {
32
- super();
33
- this.id = id;
34
- this.func = func;
35
- this.timeoutSeconds = timeoutSeconds;
36
- this.data = data;
37
- }
38
- build(region, data) {
39
- return this.func(region, this.timeoutSeconds, data);
11
+ build(region) {
12
+ return this.func(region, this.options, this.data);
40
13
  }
41
14
  }
42
15
  exports.FunctionsData = FunctionsData;
@@ -1 +1 @@
1
- {"version":3,"file":"functions_data.js","sourceRoot":"","sources":["../../src/lib/functions_data.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;AAEjD;;;;GAIG;AACH,MAAa,aAAc,SAAQ,8BAAa;IAC9C;;;;;;;;;;;;;;;;;;;OAmBG;IACH,YACW,EAAU,EACV,IAA6F,EAC7F,iBAAyB,EAAE,EAC3B,OAAkC,EAAE;QAE7C,KAAK,EAAE,CAAC;QALC,OAAE,GAAF,EAAE,CAAQ;QACV,SAAI,GAAJ,IAAI,CAAyF;QAC7F,mBAAc,GAAd,cAAc,CAAa;QAC3B,SAAI,GAAJ,IAAI,CAAgC;IAG/C,CAAC;IAED,KAAK,CACH,MAAgB,EAChB,IAAgC;QAEhC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;CACF;AApCD,sCAoCC"}
1
+ {"version":3,"file":"functions_data.js","sourceRoot":"","sources":["../../src/lib/functions_data.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;AAGjD;;;;GAIG;AACH,MAAa,aAAc,SAAQ,8BAAa;IAC9C,KAAK,CAAC,MAAgB;QACpB,OAAO,IAAI,CAAC,IAAI,CACd,MAAM,EACN,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,IAAI,CACV,CAAC;IACJ,CAAC;CACF;AARD,sCAQC"}
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Gmailでメールを送信します。
5
5
  *
6
- * @param {string} purchase.mail.gmail.id
6
+ * @param {string} process.env.MAIL_GMAIL_ID
7
7
  * Gmail user ID. Follow the steps below to obtain a Gmail user ID.
8
8
  * 1. Press your icon in the upper right corner of the Google top screen and open "Manage Google Account".
9
9
  * 2. open "Security" on the left side of the screen and open "App Password
@@ -11,7 +11,7 @@
11
11
  * 1. Googleのトップ画面の画面右上の自分のアイコンを押下し、「Google アカウントを管理」を開く
12
12
  * 2. 画面左の「セキュリティ」を開き、「アプリ パスワード」を開く
13
13
  *
14
- * @param {string} purchase.mail.gmail.password
14
+ * @param {string} process.env.MAIL_GMAIL_PASSWORD
15
15
  * Gmail user password. Enter the password obtained in the above procedure.
16
16
  * Gmailのユーザーパスワード。上記の手順で取得したパスワードを入力します。
17
17
  *
package/dist/lib/gmail.js CHANGED
@@ -1,27 +1,4 @@
1
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
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -34,13 +11,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
34
11
  Object.defineProperty(exports, "__esModule", { value: true });
35
12
  exports.send = void 0;
36
13
  const nodemailer_1 = require("nodemailer");
37
- const functions = __importStar(require("firebase-functions"));
38
14
  /**
39
15
  * Send email via Gmail.
40
16
  *
41
17
  * Gmailでメールを送信します。
42
18
  *
43
- * @param {string} purchase.mail.gmail.id
19
+ * @param {string} process.env.MAIL_GMAIL_ID
44
20
  * Gmail user ID. Follow the steps below to obtain a Gmail user ID.
45
21
  * 1. Press your icon in the upper right corner of the Google top screen and open "Manage Google Account".
46
22
  * 2. open "Security" on the left side of the screen and open "App Password
@@ -48,7 +24,7 @@ const functions = __importStar(require("firebase-functions"));
48
24
  * 1. Googleのトップ画面の画面右上の自分のアイコンを押下し、「Google アカウントを管理」を開く
49
25
  * 2. 画面左の「セキュリティ」を開き、「アプリ パスワード」を開く
50
26
  *
51
- * @param {string} purchase.mail.gmail.password
27
+ * @param {string} process.env.MAIL_GMAIL_PASSWORD
52
28
  * Gmail user password. Enter the password obtained in the above procedure.
53
29
  * Gmailのユーザーパスワード。上記の手順で取得したパスワードを入力します。
54
30
  *
@@ -70,12 +46,11 @@ const functions = __importStar(require("firebase-functions"));
70
46
  */
71
47
  function send({ from, to, title, content, }) {
72
48
  return __awaiter(this, void 0, void 0, function* () {
73
- const config = functions.config().mail;
74
49
  const mailTransport = (0, nodemailer_1.createTransport)({
75
50
  service: "gmail",
76
51
  auth: {
77
- user: config.gmail.id,
78
- pass: config.gmail.password,
52
+ user: process.env.MAIL_GMAIL_ID,
53
+ pass: process.env.MAIL_GMAIL_PASSWORD,
79
54
  },
80
55
  });
81
56
  yield mailTransport.sendMail({
@@ -1 +1 @@
1
- {"version":3,"file":"gmail.js","sourceRoot":"","sources":["../../src/lib/gmail.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA2C;AAC3C,8DAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,SAAsB,IAAI,CAAC,EACzB,IAAI,EACJ,EAAE,EACF,KAAK,EACL,OAAO,GAMR;;QACC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC;QACvC,MAAM,aAAa,GAAG,IAAA,4BAAe,EAAC;YACpC,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE;gBACJ,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE;gBACrB,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;aAC5B;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;AAzBD,oBAyBC"}
1
+ {"version":3,"file":"gmail.js","sourceRoot":"","sources":["../../src/lib/gmail.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA2C;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,SAAsB,IAAI,CAAC,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"}
@@ -1,17 +1,12 @@
1
- import * as functions from "firebase-functions";
1
+ import * as functions from "firebase-functions/v2";
2
2
  import { FunctionsBase } from "./functions_base";
3
+ import * as express from "express";
3
4
  /**
4
5
  * Base class for defining Function data for HTTP request execution.
5
6
  *
6
7
  * HTTPリクエスト実行用のFunctionのデータを定義するためのベースクラス。
7
8
  */
8
9
  export declare abstract class RequestProcessFunctionBase extends FunctionsBase {
9
- /**
10
- * Base class for defining Function data for HTTP request execution.
11
- *
12
- * HTTPリクエスト実行用のFunctionのデータを定義するためのベースクラス。
13
- */
14
- constructor();
15
10
  /**
16
11
  * Specify the actual contents of the process.
17
12
  *
@@ -26,17 +21,10 @@ export declare abstract class RequestProcessFunctionBase extends FunctionsBase {
26
21
  * Response passed to Functions.
27
22
  *
28
23
  * Functionsに渡されたResponse。
29
- *
30
- * @param options
31
- * Options passed to Functions.
32
- *
33
- * Functionsに渡されたオプション。
34
24
  */
35
- abstract process(reqest: functions.https.Request, response: functions.Response, options: Record<string, any>): Promise<void>;
25
+ abstract process(reqest: functions.https.Request, response: express.Response<any>): Promise<void>;
36
26
  data: {
37
27
  [key: string]: string;
38
28
  };
39
- build(regions: string[], data: {
40
- [key: string]: string;
41
- }): Function;
29
+ build(regions: string[]): Function;
42
30
  }
@@ -33,7 +33,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
35
  exports.RequestProcessFunctionBase = void 0;
36
- const functions = __importStar(require("firebase-functions"));
36
+ const functions = __importStar(require("firebase-functions/v2"));
37
37
  const functions_base_1 = require("./functions_base");
38
38
  /**
39
39
  * Base class for defining Function data for HTTP request execution.
@@ -41,21 +41,21 @@ const functions_base_1 = require("./functions_base");
41
41
  * HTTPリクエスト実行用のFunctionのデータを定義するためのベースクラス。
42
42
  */
43
43
  class RequestProcessFunctionBase extends functions_base_1.FunctionsBase {
44
- /**
45
- * Base class for defining Function data for HTTP request execution.
46
- *
47
- * HTTPリクエスト実行用のFunctionのデータを定義するためのベースクラス。
48
- */
49
44
  constructor() {
50
- super();
45
+ super(...arguments);
51
46
  this.data = {};
52
47
  }
53
- build(regions, data) {
54
- return functions.runWith({
55
- timeoutSeconds: this.timeoutSeconds,
56
- }).region(...regions).https.onRequest((req, res) => __awaiter(this, void 0, void 0, function* () {
57
- const config = functions.config();
58
- return this.process(req, res, config);
48
+ build(regions) {
49
+ var _a;
50
+ return functions.https.onRequest({
51
+ region: regions,
52
+ timeoutSeconds: this.options.timeoutSeconds,
53
+ memory: this.options.memory,
54
+ minInstances: this.options.minInstances,
55
+ concurrency: this.options.concurrency,
56
+ maxInstances: (_a = this.options.maxInstances) !== null && _a !== void 0 ? _a : undefined,
57
+ }, (req, res) => __awaiter(this, void 0, void 0, function* () {
58
+ return this.process(req, res);
59
59
  }));
60
60
  }
61
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"request_process_function_base.js","sourceRoot":"","sources":["../../src/lib/request_process_function_base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgD;AAChD,qDAAiD;AAEjD;;;;GAIG;AACH,MAAsB,0BAA2B,SAAQ,8BAAa;IAClE;;;;OAIG;IACH;QACI,KAAK,EAAE,CAAC;QAyBZ,SAAI,GAA8B,EAAE,CAAC;IAxBrC,CAAC;IAyBD,KAAK,CAAC,OAAiB,EAAE,IAA+B;QACpD,OAAO,SAAS,CAAC,OAAO,CAAC;YACrB,cAAc,EAAE,IAAI,CAAC,cAAc;SACtC,CAAC,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAO,GAAG,EAAE,GAAG,EAAE,EAAE;YACrD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QAC1C,CAAC,CAAA,CAAC,CAAC;IACP,CAAC;CACJ;AAzCD,gEAyCC"}
1
+ {"version":3,"file":"request_process_function_base.js","sourceRoot":"","sources":["../../src/lib/request_process_function_base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAmD;AACnD,qDAAiD;AAGjD;;;;GAIG;AACH,MAAsB,0BAA2B,SAAQ,8BAAa;IAAtE;;QAkBI,SAAI,GAA8B,EAAE,CAAC;IAgBzC,CAAC;IAfG,KAAK,CAAC,OAAiB;;QACnB,OAAO,SAAS,CAAC,KAAK,CAAC,SAAS,CAC5B;YACI,MAAM,EAAE,OAAO;YACf,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc;YAC3C,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;YAC3B,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY;YACvC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;YACrC,YAAY,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,YAAY,mCAAI,SAAS;SACvD,EACD,CAAO,GAAG,EAAE,GAAG,EAAE,EAAE;YACf,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAClC,CAAC,CAAA,CACJ,CAAC;IACN,CAAC;CACJ;AAlCD,gEAkCC"}
@@ -1,4 +1,4 @@
1
- import { FunctionsBase } from "./functions_base";
1
+ import { FunctionsBase, SchedulerFunctionsOptions } from "./functions_base";
2
2
  /**
3
3
  * Base class for defining the data of Functions for periodic scheduled execution.
4
4
  *
@@ -10,7 +10,16 @@ export declare abstract class ScheduleProcessFunctionBase extends FunctionsBase
10
10
  *
11
11
  * 定期スケジュール実行用のFunctionのデータを定義するためのベースクラス。
12
12
  */
13
- constructor();
13
+ constructor({ id, func, data, options, }: {
14
+ id: string;
15
+ func: (region: string[], options: SchedulerFunctionsOptions, data: {
16
+ [key: string]: string;
17
+ }) => Function;
18
+ data?: {
19
+ [key: string]: string;
20
+ };
21
+ options?: SchedulerFunctionsOptions | undefined | null;
22
+ });
14
23
  /**
15
24
  * Specify the schedule to execute the process in cron format.
16
25
  *
@@ -23,17 +32,10 @@ export declare abstract class ScheduleProcessFunctionBase extends FunctionsBase
23
32
  * Specify the actual contents of the process.
24
33
  *
25
34
  * 実際の処理の中身を指定します。
26
- *
27
- * @param options
28
- * Options passed to Functions.
29
- *
30
- * Functionsに渡されたオプション。
31
35
  */
32
- abstract process(options: Record<string, any>): Promise<void>;
36
+ abstract process(): Promise<void>;
33
37
  data: {
34
38
  [key: string]: string;
35
39
  };
36
- build(regions: string[], data: {
37
- [key: string]: string;
38
- }): Function;
40
+ build(regions: string[]): Function;
39
41
  }
@@ -33,7 +33,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
35
  exports.ScheduleProcessFunctionBase = void 0;
36
- const functions = __importStar(require("firebase-functions"));
36
+ const functions = __importStar(require("firebase-functions/v2"));
37
37
  const functions_base_1 = require("./functions_base");
38
38
  /**
39
39
  * Base class for defining the data of Functions for periodic scheduled execution.
@@ -46,16 +46,22 @@ class ScheduleProcessFunctionBase extends functions_base_1.FunctionsBase {
46
46
  *
47
47
  * 定期スケジュール実行用のFunctionのデータを定義するためのベースクラス。
48
48
  */
49
- constructor() {
50
- super();
49
+ constructor({ id, func, data = {}, options, }) {
50
+ super({ id: id, func: func, data: data, options: options });
51
51
  this.data = {};
52
52
  }
53
- build(regions, data) {
54
- return functions.runWith({
55
- timeoutSeconds: this.timeoutSeconds,
56
- }).region(...regions).pubsub.schedule(this.schedule).onRun((event) => __awaiter(this, void 0, void 0, function* () {
57
- const config = functions.config();
58
- return this.process(config);
53
+ build(regions) {
54
+ var _a, _b, _c;
55
+ return functions.scheduler.onSchedule({
56
+ schedule: (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.schedule) !== null && _b !== void 0 ? _b : this.schedule,
57
+ region: regions[0],
58
+ timeoutSeconds: this.options.timeoutSeconds,
59
+ memory: this.options.memory,
60
+ minInstances: this.options.minInstances,
61
+ concurrency: this.options.concurrency,
62
+ maxInstances: (_c = this.options.maxInstances) !== null && _c !== void 0 ? _c : undefined,
63
+ }, (event) => __awaiter(this, void 0, void 0, function* () {
64
+ return this.process();
59
65
  }));
60
66
  }
61
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"schedule_process_function_base.js","sourceRoot":"","sources":["../../src/lib/schedule_process_function_base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgD;AAChD,qDAAiD;AAEjD;;;;GAIG;AACH,MAAsB,2BAA4B,SAAQ,8BAAa;IACnE;;;;OAIG;IACH;QACI,KAAK,EAAE,CAAC;QAwBZ,SAAI,GAA8B,EAAE,CAAC;IAvBrC,CAAC;IAwBD,KAAK,CAAC,OAAiB,EAAE,IAA+B;QACpD,OAAO,SAAS,CAAC,OAAO,CAAC;YACrB,cAAc,EAAE,IAAI,CAAC,cAAc;SACtC,CAAC,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAO,KAAK,EAAE,EAAE;YACvE,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC,CAAA,CAAC,CAAC;IACP,CAAC;CACJ;AAxCD,kEAwCC"}
1
+ {"version":3,"file":"schedule_process_function_base.js","sourceRoot":"","sources":["../../src/lib/schedule_process_function_base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAmD;AACnD,qDAA8F;AAE9F;;;;GAIG;AACH,MAAsB,2BAA4B,SAAQ,8BAAa;IACnE;;;;OAIG;IACH,YAAY,EACR,EAAE,EACF,IAAI,EACJ,IAAI,GAAG,EAAE,EACT,OAAO,GAUV;QACG,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAmBhE,SAAI,GAA8B,EAAE,CAAC;IAlBrC,CAAC;IAmBD,KAAK,CAAC,OAAiB;;QACnB,OAAO,SAAS,CAAC,SAAS,CAAC,UAAU,CACjC;YACI,QAAQ,EAAE,MAAA,MAAC,IAAI,CAAC,OAAiD,0CAAE,QAAQ,mCAAI,IAAI,CAAC,QAAQ;YAC5F,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;YAClB,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc;YAC3C,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;YAC3B,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY;YACvC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;YACrC,YAAY,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,YAAY,mCAAI,SAAS;SACvD,EACD,CAAO,KAAK,EAAE,EAAE;YACZ,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;QAC1B,CAAC,CAAA,CACJ,CAAC;IACN,CAAC;CACJ;AAzDD,kEAyDC"}
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * SendGridでメールを送信します。
5
5
  *
6
- * @param {string} purchase.mail.sendgrid.api_key
6
+ * @param {string} process.env.MAIL_SENDGRID_APIKEY
7
7
  * API key for SendGrid. Issue it according to the following procedure.
8
8
  * https://mathru.notion.site/SendGrid-bb87b2ffa8174dbda944812f43856d6c
9
9
  * SendGridのAPIキー。下記の手順で発行します。
@@ -1,27 +1,4 @@
1
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
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -36,14 +13,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
13
  };
37
14
  Object.defineProperty(exports, "__esModule", { value: true });
38
15
  exports.send = void 0;
39
- const functions = __importStar(require("firebase-functions"));
40
16
  const mail_1 = __importDefault(require("@sendgrid/mail"));
41
17
  /**
42
18
  * Send mail through SendGrid.
43
19
  *
44
20
  * SendGridでメールを送信します。
45
21
  *
46
- * @param {string} purchase.mail.sendgrid.api_key
22
+ * @param {string} process.env.MAIL_SENDGRID_APIKEY
47
23
  * API key for SendGrid. Issue it according to the following procedure.
48
24
  * https://mathru.notion.site/SendGrid-bb87b2ffa8174dbda944812f43856d6c
49
25
  * SendGridのAPIキー。下記の手順で発行します。
@@ -66,9 +42,9 @@ const mail_1 = __importDefault(require("@sendgrid/mail"));
66
42
  * メール本文。
67
43
  */
68
44
  function send({ from, to, title, content, }) {
45
+ var _a;
69
46
  return __awaiter(this, void 0, void 0, function* () {
70
- const config = functions.config().mail;
71
- mail_1.default.setApiKey(config.sendgrid.api_key);
47
+ mail_1.default.setApiKey((_a = process.env.MAIL_SENDGRID_APIKEY) !== null && _a !== void 0 ? _a : "");
72
48
  const msg = {
73
49
  to: to,
74
50
  from: from,