@mathrunet/masamune 0.5.2 → 0.6.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 +22 -0
- package/dist/functions/agora_cloud_recording.js +1 -1
- package/dist/functions/agora_cloud_recording.js.map +1 -1
- package/dist/functions/agora_token.js +1 -1
- package/dist/functions/agora_token.js.map +1 -1
- package/dist/functions/android_auth_code.js +1 -1
- package/dist/functions/android_auth_code.js.map +1 -1
- package/dist/functions/android_token.js +1 -4
- package/dist/functions/android_token.js.map +1 -1
- package/dist/functions/consumable_verify_android.js +1 -1
- package/dist/functions/consumable_verify_android.js.map +1 -1
- package/dist/functions/consumable_verify_ios.js +1 -1
- 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 +1 -1
- package/dist/functions/nonconsumable_verify_android.js.map +1 -1
- package/dist/functions/nonconsumable_verify_ios.js +1 -1
- package/dist/functions/nonconsumable_verify_ios.js.map +1 -1
- package/dist/functions/openai_chat_gpt.js +1 -1
- package/dist/functions/openai_chat_gpt.js.map +1 -1
- package/dist/functions/{purchase_hook_android.js → purchase_webhook_android.js} +111 -108
- package/dist/functions/purchase_webhook_android.js.map +1 -0
- package/dist/functions/{purchase_hook_ios.js → purchase_webhook_ios.js} +3 -3
- package/dist/functions/purchase_webhook_ios.js.map +1 -0
- package/dist/functions/send_grid.js +1 -1
- package/dist/functions/send_grid.js.map +1 -1
- package/dist/functions/send_notification.js +1 -1
- package/dist/functions/send_notification.js.map +1 -1
- package/dist/functions/stripe.js +1 -1
- package/dist/functions/stripe.js.map +1 -1
- package/dist/functions/stripe_webhook.d.ts +1 -0
- package/dist/functions/stripe_webhook.js +573 -0
- package/dist/functions/stripe_webhook.js.map +1 -0
- package/dist/functions/stripe_webhook_connect.d.ts +1 -0
- package/dist/functions/stripe_webhook_connect.js +140 -0
- package/dist/functions/stripe_webhook_connect.js.map +1 -0
- package/dist/functions/stripe_webhook_secure.d.ts +1 -0
- package/dist/functions/stripe_webhook_secure.js +150 -0
- package/dist/functions/stripe_webhook_secure.js.map +1 -0
- 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 +13 -13
- package/dist/functions.js +13 -13
- package/dist/functions.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/functions_data.d.ts +6 -2
- package/dist/lib/functions_data.js.map +1 -1
- package/dist/lib/verify_android.js +0 -3
- package/dist/lib/verify_android.js.map +1 -1
- package/package.json +1 -1
- package/dist/functions/purchase_hook_android.js.map +0 -1
- package/dist/functions/purchase_hook_ios.js.map +0 -1
- /package/dist/functions/{purchase_hook_android.d.ts → purchase_webhook_android.d.ts} +0 -0
- /package/dist/functions/{purchase_hook_ios.d.ts → purchase_webhook_ios.d.ts} +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
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 stripe = __importStar(require("stripe"));
|
|
37
|
+
const admin = __importStar(require("firebase-admin"));
|
|
38
|
+
/**
|
|
39
|
+
* Receive and process webhooks for Stripe Connect.
|
|
40
|
+
* If you do not use Stripe Connect, do not configure it as a Webhook.
|
|
41
|
+
* Please register the URL when you deploy this in your Stripe webhook settings.
|
|
42
|
+
* Firestore integration is a must; please make Firestore available as well.
|
|
43
|
+
*
|
|
44
|
+
* Stripe Connect用のWebhookを受信して処理します。
|
|
45
|
+
* Stripe Connectを利用しない場合はWebhookとして設定しないでください。
|
|
46
|
+
* こちらをデプロイした際のURLをStripeのWebhook設定に登録してください。
|
|
47
|
+
* Firestoreとの連携が必須です。Firestoreも利用可能にしてください。
|
|
48
|
+
*
|
|
49
|
+
* @param {string} purchase.stripe.secret_key
|
|
50
|
+
* API key (secret key) to connect to Stripe.
|
|
51
|
+
* Log in to the following URL and create a project.
|
|
52
|
+
* After the project is created, the secret key can be copied.
|
|
53
|
+
*
|
|
54
|
+
* Stripeへ接続するためのAPIキー(シークレットキー)。
|
|
55
|
+
* 下記URLにログインし、プロジェクトを作成します。
|
|
56
|
+
* プロジェクト作成後、シークレットキーをコピーすることができます。
|
|
57
|
+
*
|
|
58
|
+
* Production environment
|
|
59
|
+
* https://dashboard.stripe.com/apikeys
|
|
60
|
+
* Development enveironment
|
|
61
|
+
* https://dashboard.stripe.com/test/apikeys
|
|
62
|
+
*
|
|
63
|
+
* @param {string} purchase.stripe.user_path
|
|
64
|
+
* Stripe user (customer) pass.
|
|
65
|
+
* Stripeのユーザー(カスタマー)用パス。
|
|
66
|
+
*
|
|
67
|
+
* @param {string} purchase.stripe.webhook_connect_secret
|
|
68
|
+
* Specify the **Signature Secret** after setting it up as a webhook.
|
|
69
|
+
* Webhookとして設定したあとの**署名シークレット**を指定します。
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
module.exports = (regions, topics) => functions.region(...regions).https.onRequest((req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
try {
|
|
74
|
+
const config = functions.config().purchase;
|
|
75
|
+
const stripeConfig = config.stripe;
|
|
76
|
+
const apiKey = stripeConfig.secret_key;
|
|
77
|
+
const stripeUserPath = stripeConfig.user_path;
|
|
78
|
+
const stripeWebhookConnectSecret = stripeConfig.webhook_connect_secret;
|
|
79
|
+
const firestoreInstance = admin.firestore();
|
|
80
|
+
const stripeClient = new stripe.Stripe(apiKey, {
|
|
81
|
+
apiVersion: "2022-11-15",
|
|
82
|
+
});
|
|
83
|
+
const signature = req.headers["stripe-signature"];
|
|
84
|
+
if (!signature) {
|
|
85
|
+
res.status(403).send(JSON.stringify({
|
|
86
|
+
"error": "Access denied.",
|
|
87
|
+
}));
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const event = stripeClient.webhooks.constructEvent(req.rawBody, signature, stripeWebhookConnectSecret);
|
|
91
|
+
switch (event.type) {
|
|
92
|
+
case "account.updated": {
|
|
93
|
+
const account = event.data.object;
|
|
94
|
+
const id = account["id"];
|
|
95
|
+
if (!id) {
|
|
96
|
+
res.status(404).send(JSON.stringify({
|
|
97
|
+
"error": "The account id is not found.",
|
|
98
|
+
}));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const col = yield firestoreInstance.collection(`${stripeUserPath}`).where("account", "==", id).get();
|
|
102
|
+
if (col.empty) {
|
|
103
|
+
res.status(404).send(JSON.stringify({
|
|
104
|
+
"error": "The account data is not found.",
|
|
105
|
+
}));
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const update = {};
|
|
109
|
+
if (account["capabilities"]) {
|
|
110
|
+
const capability = {};
|
|
111
|
+
if (account["capabilities"]["card_payments"]) {
|
|
112
|
+
capability["card_payments"] = true;
|
|
113
|
+
}
|
|
114
|
+
if (account["capabilities"]["transfers"]) {
|
|
115
|
+
capability["transfers"] = true;
|
|
116
|
+
}
|
|
117
|
+
update["capability"] = capability;
|
|
118
|
+
}
|
|
119
|
+
yield col.docs[0].ref.set(update, {
|
|
120
|
+
merge: true,
|
|
121
|
+
});
|
|
122
|
+
res.status(200).send(JSON.stringify({
|
|
123
|
+
"success": true,
|
|
124
|
+
}));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
default: {
|
|
128
|
+
res.status(404).send(JSON.stringify({
|
|
129
|
+
"error": `Event ${event.type} is not found.`,
|
|
130
|
+
}));
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
console.error(err);
|
|
137
|
+
throw err;
|
|
138
|
+
}
|
|
139
|
+
}));
|
|
140
|
+
//# sourceMappingURL=stripe_webhook_connect.js.map
|
|
@@ -0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AAE;oBAChC,KAAK,EAAE,IAAI;iBACZ,CAAC,CAAC;gBAEH,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;oBAClC,SAAS,EAAE,IAAI;iBAChB,CAAC,CAAC,CAAC;gBACJ,OAAO;aACR;YACD,OAAO,CAAC,CAAC;gBACP,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;oBAClC,OAAO,EAAE,SAAS,KAAK,CAAC,IAAI,gBAAgB;iBAC7C,CAAC,CAAC,CAAC;gBACJ,OAAO;aACR;SACA;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,MAAM,GAAG,CAAC;KACX;AACH,CAAC,CAAA,CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,150 @@
|
|
|
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 stripe = __importStar(require("stripe"));
|
|
37
|
+
const admin = __importStar(require("firebase-admin"));
|
|
38
|
+
const utils = __importStar(require("../lib/utils"));
|
|
39
|
+
/**
|
|
40
|
+
* Webhook for proper redirection when 3D Secure authentication is required.
|
|
41
|
+
* Please set here for [returnUrl].
|
|
42
|
+
*
|
|
43
|
+
* 3Dセキュア認証が必要な場合、適切なリダイレクトを行うためのWebhookです。
|
|
44
|
+
* [returnUrl]にこちらを設定してください。
|
|
45
|
+
*
|
|
46
|
+
* @param {string} purchase.stripe.secret_key
|
|
47
|
+
* API key (secret key) to connect to Stripe.
|
|
48
|
+
* Log in to the following URL and create a project.
|
|
49
|
+
* After the project is created, the secret key can be copied.
|
|
50
|
+
*
|
|
51
|
+
* Stripeへ接続するためのAPIキー(シークレットキー)。
|
|
52
|
+
* 下記URLにログインし、プロジェクトを作成します。
|
|
53
|
+
* プロジェクト作成後、シークレットキーをコピーすることができます。
|
|
54
|
+
*
|
|
55
|
+
* Production environment
|
|
56
|
+
* https://dashboard.stripe.com/apikeys
|
|
57
|
+
* Development enveironment
|
|
58
|
+
* https://dashboard.stripe.com/test/apikeys
|
|
59
|
+
*
|
|
60
|
+
* @param {string} purchase.stripe.user_path
|
|
61
|
+
* Stripe user (customer) pass.
|
|
62
|
+
* Stripeのユーザー(カスタマー)用パス。
|
|
63
|
+
*
|
|
64
|
+
* @param {string} purchase.stripe.purchase_path
|
|
65
|
+
* Path for purchase information to be placed under [purchase.stripe.user_path].
|
|
66
|
+
* [purchase.stripe.user_path]の下に配置する購入情報用パス。
|
|
67
|
+
*
|
|
68
|
+
* @param {string} userId
|
|
69
|
+
* [required]
|
|
70
|
+
* Specify the purchaser's user ID.
|
|
71
|
+
* 購入者のユーザーIDを指定します。
|
|
72
|
+
*
|
|
73
|
+
* @param {string} orderId
|
|
74
|
+
* [required]
|
|
75
|
+
* Specify the order ID. This will be the database key.
|
|
76
|
+
* 注文IDを指定します。これがデータベースのキーとなります。
|
|
77
|
+
*
|
|
78
|
+
* @param {string} successUrl
|
|
79
|
+
* [required]
|
|
80
|
+
* Specify the URL to redirect to upon success due to browser settings, etc.
|
|
81
|
+
* ブラウザの設定等による成功時のリダイレクト先URLを指定します。
|
|
82
|
+
*
|
|
83
|
+
* @param {string} failureUrl
|
|
84
|
+
* [required]
|
|
85
|
+
* Specify the URL to redirect to upon failure due to browser settings, etc.
|
|
86
|
+
* ブラウザの設定等による失敗時のリダイレクト先URLを指定します。
|
|
87
|
+
*
|
|
88
|
+
*/
|
|
89
|
+
module.exports = (regions, topics) => functions.region(...regions).https.onRequest((req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
|
+
try {
|
|
91
|
+
const config = functions.config().purchase;
|
|
92
|
+
const stripeConfig = config.stripe;
|
|
93
|
+
const apiKey = stripeConfig.secret_key;
|
|
94
|
+
const stripeUserPath = stripeConfig.user_path;
|
|
95
|
+
const stripePurchasePath = stripeConfig.purchase_path;
|
|
96
|
+
const firestoreInstance = admin.firestore();
|
|
97
|
+
const stripeClient = new stripe.Stripe(apiKey, {
|
|
98
|
+
apiVersion: "2022-11-15",
|
|
99
|
+
});
|
|
100
|
+
const token = req.query.token;
|
|
101
|
+
if (!token || typeof token !== "string") {
|
|
102
|
+
res.status(403).send(JSON.stringify({
|
|
103
|
+
"error": "Invalid parameters",
|
|
104
|
+
}));
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const param = JSON.parse(utils.decrypt({
|
|
108
|
+
encrypted: token,
|
|
109
|
+
key: apiKey.slice(0, 32),
|
|
110
|
+
ivKey: apiKey.slice(-16),
|
|
111
|
+
}));
|
|
112
|
+
if (!param["userId"] || !param["orderId"] || !param["successUrl"] || !param["failureUrl"]) {
|
|
113
|
+
res.status(403).send(JSON.stringify({
|
|
114
|
+
"error": "Invalid parameters",
|
|
115
|
+
}));
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const userId = param["userId"];
|
|
119
|
+
const orderId = param["orderId"];
|
|
120
|
+
const successUrl = param["successUrl"];
|
|
121
|
+
const failureUrl = param["failureUrl"];
|
|
122
|
+
const doc = yield firestoreInstance.doc(`${stripeUserPath}/${userId}/${stripePurchasePath}/${orderId}`).get();
|
|
123
|
+
const data = doc.data();
|
|
124
|
+
if (!data || !data["paymentId"]) {
|
|
125
|
+
res.status(404).send(JSON.stringify({
|
|
126
|
+
"error": "The purchase data is not found.",
|
|
127
|
+
}));
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const purchase = yield stripeClient.paymentIntents.retrieve(data["paymentId"]);
|
|
131
|
+
if (!purchase) {
|
|
132
|
+
res.status(404).send(JSON.stringify({
|
|
133
|
+
"error": "The purchase data is not found.",
|
|
134
|
+
}));
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const status = purchase.status;
|
|
138
|
+
if (status === "requires_capture" || status === "succeeded" || status === "processing") {
|
|
139
|
+
res.redirect(successUrl);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
res.redirect(failureUrl);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
console.error(err);
|
|
147
|
+
throw err;
|
|
148
|
+
}
|
|
149
|
+
}));
|
|
150
|
+
//# sourceMappingURL=stripe_webhook_secure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripe_webhook_secure.js","sourceRoot":"","sources":["../../src/functions/stripe_webhook_secure.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgD;AAChD,+CAAiC;AACjC,sDAAwC;AACxC,oDAAsC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,MAAM,CAAC,OAAO,GAAG,CAAC,OAAiB,EAAE,MAAiC,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,KAAK,CAAC,SAAS,CACrH,CAAO,GAAG,EAAE,GAAG,EAAE,EAAE;IACjB,IAAI;QACF,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC;QAC3C,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;QACnC,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC;QACvC,MAAM,cAAc,GAAG,YAAY,CAAC,SAAS,CAAC;QAC9C,MAAM,kBAAkB,GAAG,YAAY,CAAC,aAAa,CAAC;QACtD,MAAM,iBAAiB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC5C,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;YAC7C,UAAU,EAAE,YAAY;SACzB,CAAC,CAAC;QACH,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC;QAC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AC,WAAW,CAAC,EAAE;YAC/B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;gBAClC,OAAO,EAAE,iCAAiC;aAC3C,CAAC,CAAC,CAAC;YACJ,OAAO;SACR;QACD,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,cAAc,CAAC,QAAQ,CACzD,IAAI,CAAC,WAAW,CAAC,CAClB,CAAC;QACF,IAAI,CAAC,QAAQ,EAAE;YACb,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;gBAClC,OAAO,EAAE,iCAAiC;aAC3C,CAAC,CAAC,CAAC;YACJ,OAAO;SACR;QACD,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAC/B,IAAI,MAAM,KAAK,kBAAkB,IAAI,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,YAAY,EAAE;YACtF,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;SAC1B;aAAM;YACL,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;SAC1B;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,MAAM,GAAG,CAAC;KACX;AACH,CAAC,CAAA,CACF,CAAC"}
|
|
@@ -71,7 +71,7 @@ const subscriber = __importStar(require("../lib/update_subscription"));
|
|
|
71
71
|
* その後、認証情報からOAuth 2.0 クライアントIDを作成します。
|
|
72
72
|
* https://console.cloud.google.com/apis/credentials
|
|
73
73
|
*
|
|
74
|
-
* @param purchase.
|
|
74
|
+
* @param purchase.subscription_path
|
|
75
75
|
* Describes the path to the collection of subscriptions.
|
|
76
76
|
*
|
|
77
77
|
* サブスクリプションのコレクションのパスを記述します。
|
|
@@ -106,7 +106,7 @@ const subscriber = __importStar(require("../lib/update_subscription"));
|
|
|
106
106
|
*
|
|
107
107
|
* サブスクリプションを購入したユーザーのID。
|
|
108
108
|
*/
|
|
109
|
-
module.exports = (regions) => functions.region(...regions).https.onCall((query, context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
109
|
+
module.exports = (regions, topics) => functions.region(...regions).https.onCall((query, context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
110
110
|
var _a;
|
|
111
111
|
try {
|
|
112
112
|
/* ==== Android検証ここから ==== */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription_verify_android.js","sourceRoot":"","sources":["../../src/functions/subscription_verify_android.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgD;AAChD,gEAAkD;AAClD,uEAAyD;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,MAAM,CAAC,OAAO,GAAG,CAAC,OAAiB,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"subscription_verify_android.js","sourceRoot":"","sources":["../../src/functions/subscription_verify_android.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgD;AAChD,gEAAkD;AAClD,uEAAyD;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,MAAM,CAAC,OAAO,GAAG,CAAC,OAAiB,EAAE,MAAiC,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAChH,CAAO,KAAK,EAAE,OAAO,EAAE,EAAE;;IACrB,IAAI;QACA,6BAA6B;QAC7B,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YACf,MAAM,IAAI,SAAS,CAAC,KAAK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E,KAAK,CAAC,IAAI;YAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,QAAQ,EAAE,SAAS;YACnB,OAAO,EAAE,GAAG,CAAC,SAAS,CAAC;YACvB,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,KAAK,EAAE,KAAK,CAAC,aAAa;YAC1B,UAAU,EAAE,gBAAgB;SAC/B,CAAC,CAAC;QACH,gCAAgC;QAChC,OAAO,GAAG,CAAC;KACd;IAAC,OAAO,GAAG,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,MAAM,IAAI,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;KACrE;AACL,CAAC,CAAA,CACJ,CAAC"}
|
|
@@ -45,7 +45,7 @@ const subscriber = __importStar(require("../lib/update_subscription"));
|
|
|
45
45
|
*
|
|
46
46
|
* AppStoreのSharedSecret。AppStoreの[アプリ]->[App情報]->[App用共有シークレット]から取得します。
|
|
47
47
|
*
|
|
48
|
-
* @param purchase.
|
|
48
|
+
* @param purchase.subscription_path
|
|
49
49
|
* Describes the path to the collection of subscriptions.
|
|
50
50
|
*
|
|
51
51
|
* サブスクリプションのコレクションのパスを記述します。
|
|
@@ -75,7 +75,7 @@ const subscriber = __importStar(require("../lib/update_subscription"));
|
|
|
75
75
|
*
|
|
76
76
|
* サブスクリプションを購入したユーザーのID。
|
|
77
77
|
*/
|
|
78
|
-
module.exports = (regions) => functions.region(...regions).https.onCall((query, context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
+
module.exports = (regions, topics) => functions.region(...regions).https.onCall((query, context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
79
79
|
var _a;
|
|
80
80
|
try {
|
|
81
81
|
/* ==== IOS検証ここから ==== */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription_verify_ios.js","sourceRoot":"","sources":["../../src/functions/subscription_verify_ios.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgD;AAChD,4DAA8C;AAC9C,uEAAyD;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,OAAO,GAAG,CAAC,OAAiB,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"subscription_verify_ios.js","sourceRoot":"","sources":["../../src/functions/subscription_verify_ios.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgD;AAChD,4DAA8C;AAC9C,uEAAyD;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,OAAO,GAAG,CAAC,OAAiB,EAAE,MAAiC,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAChH,CAAO,KAAK,EAAE,OAAO,EAAE,EAAE;;IACrB,IAAI;QACA,yBAAyB;QACzB,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YACf,MAAM,IAAI,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;SAC9E;QACD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC;QAC3C,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC;YACjC,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,aAAa;SACrC,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC7B,IAAI,MAAM,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AE,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,yBAAyB,CAAC;YACzD,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,WAAW,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC;YACxC,KAAK,EAAE,KAAK,CAAC,WAAW;YACxB,UAAU,EAAE,gBAAgB;SAC/B,CAAC,CAAC;QACH,gCAAgC;QAChC,OAAO,GAAG,CAAC;KACd;IAAC,OAAO,GAAG,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,MAAM,IAAI,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;KACrE;AACL,CAAC,CAAA,CACJ,CAAC"}
|
package/dist/functions.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export declare const Functions: {
|
|
|
56
56
|
*
|
|
57
57
|
* Firestoreとの連携が必須です。Firestoreも利用可能にしてください。
|
|
58
58
|
*/
|
|
59
|
-
readonly
|
|
59
|
+
readonly stripeWebhook: data.FunctionsData;
|
|
60
60
|
/**
|
|
61
61
|
* Receive and process webhooks for Stripe Connect.
|
|
62
62
|
*
|
|
@@ -74,7 +74,7 @@ export declare const Functions: {
|
|
|
74
74
|
*
|
|
75
75
|
* Firestoreとの連携が必須です。Firestoreも利用可能にしてください。
|
|
76
76
|
*/
|
|
77
|
-
readonly
|
|
77
|
+
readonly stripeWebhookConnect: data.FunctionsData;
|
|
78
78
|
/**
|
|
79
79
|
* Webhook for proper redirection when 3D Secure authentication is required.
|
|
80
80
|
*
|
|
@@ -88,7 +88,7 @@ export declare const Functions: {
|
|
|
88
88
|
*
|
|
89
89
|
* [returnUrl]にこちらを設定してください。
|
|
90
90
|
*/
|
|
91
|
-
readonly
|
|
91
|
+
readonly stripeWebhookSecure: data.FunctionsData;
|
|
92
92
|
/**
|
|
93
93
|
* Send email via Gmail.
|
|
94
94
|
*
|
|
@@ -107,60 +107,60 @@ export declare const Functions: {
|
|
|
107
107
|
* [android_auth_code]からリダイレクトされた後、GoogleのAPIに接続するためのリフレッシュトークンを取得します。
|
|
108
108
|
* 必要情報を登録した後[android_auth_code]を実行してください。
|
|
109
109
|
*/
|
|
110
|
-
readonly
|
|
110
|
+
readonly androidAuthCode: data.FunctionsData;
|
|
111
111
|
/**
|
|
112
112
|
* After being redirected from [android_auth_code], you will get a refresh token to connect to Google's API. Applications Library System Users Volumes bin cores dev etc home opt private sbin tmp usr var Execute [android_auth_code] after registering the required information.
|
|
113
113
|
*
|
|
114
114
|
* [android_auth_code]からリダイレクトされた後、GoogleのAPIに接続するためのリフレッシュトークンを取得します。
|
|
115
115
|
* 必要情報を登録した後[android_auth_code]を実行してください。
|
|
116
116
|
*/
|
|
117
|
-
readonly
|
|
117
|
+
readonly androidToken: data.FunctionsData;
|
|
118
118
|
/**
|
|
119
119
|
* Performs a consumption-type in-app purchase. The value of the field in the document specified in [path] is added to [value].
|
|
120
120
|
*
|
|
121
121
|
* 消費型のアプリ内課金を行います。[path]に指定したドキュメント内のフィールドの値を[value]に加算します。
|
|
122
122
|
*/
|
|
123
|
-
readonly
|
|
123
|
+
readonly consumableVerifyAndroid: data.FunctionsData;
|
|
124
124
|
/**
|
|
125
125
|
* Performs a consumption-type in-app purchase. The value of the field in the document specified in [path] is added to [value].
|
|
126
126
|
*
|
|
127
127
|
* 消費型のアプリ内課金を行います。[path]に指定したドキュメント内のフィールドの値を[value]に加算します。
|
|
128
128
|
*/
|
|
129
|
-
readonly
|
|
129
|
+
readonly consumableVerifyIOS: data.FunctionsData;
|
|
130
130
|
/**
|
|
131
131
|
* Performs non-consumable in-app purchases. Unlock by setting the value of the field in the document specified in [path] to `true`.
|
|
132
132
|
*
|
|
133
133
|
* 非消費型のアプリ内課金を行います。[path]に指定したドキュメント内のフィールドの値を`true`にすることでアンロックを行います。
|
|
134
134
|
*/
|
|
135
|
-
readonly
|
|
135
|
+
readonly nonconsumableVerifyAndroid: data.FunctionsData;
|
|
136
136
|
/**
|
|
137
137
|
* Performs non-consumable in-app purchases. Unlock by setting the value of the field in the document specified in [path] to `true`.
|
|
138
138
|
*
|
|
139
139
|
* 非消費型のアプリ内課金を行います。[path]に指定したドキュメント内のフィールドの値を`true`にすることでアンロックを行います。
|
|
140
140
|
*/
|
|
141
|
-
readonly
|
|
141
|
+
readonly nonconsumableVerifyIOS: data.FunctionsData;
|
|
142
142
|
/**
|
|
143
143
|
* This is a webhook endpoint for Android. 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.
|
|
144
144
|
*
|
|
145
145
|
* Android用のWebhookのエンドポイントです。GCPのpub/subに`purchasing`のトピックを作成しプリンシパルに「google-play-developer-notifications@system.gserviceaccount.com」を設定することで通知を受け取ることができるようになります。
|
|
146
146
|
*/
|
|
147
|
-
readonly
|
|
147
|
+
readonly purchaseWebhookAndroid: data.FunctionsData;
|
|
148
148
|
/**
|
|
149
149
|
* Webhook endpoint for IOS, which allows you to receive notifications by setting the endpoint in AppStoreConnect's [App]->[App Information]->[App Store Server Notification].
|
|
150
150
|
*
|
|
151
151
|
* IOS用のWebhookのエンドポイントです。AppStoreConnectの[App]->[App情報]->[App Storeサーバ通知]にエンドポイントを設定することで通知を受け取ることができるようになります。
|
|
152
152
|
*/
|
|
153
|
-
readonly
|
|
153
|
+
readonly purchaseWebhookIOS: data.FunctionsData;
|
|
154
154
|
/**
|
|
155
155
|
* Verify subscriptions and add data.
|
|
156
156
|
*
|
|
157
157
|
* サブスクリプションの検証とデータの追加を行います。
|
|
158
158
|
*/
|
|
159
|
-
readonly
|
|
159
|
+
readonly subscriptionVerifyAndroid: data.FunctionsData;
|
|
160
160
|
/**
|
|
161
161
|
* Verify subscriptions and add data.
|
|
162
162
|
*
|
|
163
163
|
* サブスクリプションの検証とデータの追加を行います。
|
|
164
164
|
*/
|
|
165
|
-
readonly
|
|
165
|
+
readonly subscriptionVerifyIOS: data.FunctionsData;
|
|
166
166
|
};
|
package/dist/functions.js
CHANGED
|
@@ -82,7 +82,7 @@ exports.Functions = {
|
|
|
82
82
|
*
|
|
83
83
|
* Firestoreとの連携が必須です。Firestoreも利用可能にしてください。
|
|
84
84
|
*/
|
|
85
|
-
|
|
85
|
+
stripeWebhook: new data.FunctionsData("stripe_webhook", require("./functions/stripe_webhook")),
|
|
86
86
|
/**
|
|
87
87
|
* Receive and process webhooks for Stripe Connect.
|
|
88
88
|
*
|
|
@@ -100,7 +100,7 @@ exports.Functions = {
|
|
|
100
100
|
*
|
|
101
101
|
* Firestoreとの連携が必須です。Firestoreも利用可能にしてください。
|
|
102
102
|
*/
|
|
103
|
-
|
|
103
|
+
stripeWebhookConnect: new data.FunctionsData("stripe_webhook_connect", require("./functions/stripe_webhook_connect")),
|
|
104
104
|
/**
|
|
105
105
|
* Webhook for proper redirection when 3D Secure authentication is required.
|
|
106
106
|
*
|
|
@@ -114,7 +114,7 @@ exports.Functions = {
|
|
|
114
114
|
*
|
|
115
115
|
* [returnUrl]にこちらを設定してください。
|
|
116
116
|
*/
|
|
117
|
-
|
|
117
|
+
stripeWebhookSecure: new data.FunctionsData("stripe_webhook_secure", require("./functions/stripe_webhook_secure")),
|
|
118
118
|
/**
|
|
119
119
|
* Send email via Gmail.
|
|
120
120
|
*
|
|
@@ -133,61 +133,61 @@ exports.Functions = {
|
|
|
133
133
|
* [android_auth_code]からリダイレクトされた後、GoogleのAPIに接続するためのリフレッシュトークンを取得します。
|
|
134
134
|
* 必要情報を登録した後[android_auth_code]を実行してください。
|
|
135
135
|
*/
|
|
136
|
-
|
|
136
|
+
androidAuthCode: new data.FunctionsData("android_auth_code", require("./functions/android_auth_code")),
|
|
137
137
|
/**
|
|
138
138
|
* After being redirected from [android_auth_code], you will get a refresh token to connect to Google's API. Applications Library System Users Volumes bin cores dev etc home opt private sbin tmp usr var Execute [android_auth_code] after registering the required information.
|
|
139
139
|
*
|
|
140
140
|
* [android_auth_code]からリダイレクトされた後、GoogleのAPIに接続するためのリフレッシュトークンを取得します。
|
|
141
141
|
* 必要情報を登録した後[android_auth_code]を実行してください。
|
|
142
142
|
*/
|
|
143
|
-
|
|
143
|
+
androidToken: new data.FunctionsData("android_token", require("./functions/android_token")),
|
|
144
144
|
/**
|
|
145
145
|
* Performs a consumption-type in-app purchase. The value of the field in the document specified in [path] is added to [value].
|
|
146
146
|
*
|
|
147
147
|
* 消費型のアプリ内課金を行います。[path]に指定したドキュメント内のフィールドの値を[value]に加算します。
|
|
148
148
|
*/
|
|
149
|
-
|
|
149
|
+
consumableVerifyAndroid: new data.FunctionsData("consumable_verify_android", require("./functions/consumable_verify_android")),
|
|
150
150
|
/**
|
|
151
151
|
* Performs a consumption-type in-app purchase. The value of the field in the document specified in [path] is added to [value].
|
|
152
152
|
*
|
|
153
153
|
* 消費型のアプリ内課金を行います。[path]に指定したドキュメント内のフィールドの値を[value]に加算します。
|
|
154
154
|
*/
|
|
155
|
-
|
|
155
|
+
consumableVerifyIOS: new data.FunctionsData("consumable_verify_ios", require("./functions/consumable_verify_ios")),
|
|
156
156
|
/**
|
|
157
157
|
* Performs non-consumable in-app purchases. Unlock by setting the value of the field in the document specified in [path] to `true`.
|
|
158
158
|
*
|
|
159
159
|
* 非消費型のアプリ内課金を行います。[path]に指定したドキュメント内のフィールドの値を`true`にすることでアンロックを行います。
|
|
160
160
|
*/
|
|
161
|
-
|
|
161
|
+
nonconsumableVerifyAndroid: new data.FunctionsData("nonconsumable_verify_android", require("./functions/nonconsumable_verify_android")),
|
|
162
162
|
/**
|
|
163
163
|
* Performs non-consumable in-app purchases. Unlock by setting the value of the field in the document specified in [path] to `true`.
|
|
164
164
|
*
|
|
165
165
|
* 非消費型のアプリ内課金を行います。[path]に指定したドキュメント内のフィールドの値を`true`にすることでアンロックを行います。
|
|
166
166
|
*/
|
|
167
|
-
|
|
167
|
+
nonconsumableVerifyIOS: new data.FunctionsData("nonconsumable_verify_ios", require("./functions/nonconsumable_verify_ios")),
|
|
168
168
|
/**
|
|
169
169
|
* This is a webhook endpoint for Android. 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.
|
|
170
170
|
*
|
|
171
171
|
* Android用のWebhookのエンドポイントです。GCPのpub/subに`purchasing`のトピックを作成しプリンシパルに「google-play-developer-notifications@system.gserviceaccount.com」を設定することで通知を受け取ることができるようになります。
|
|
172
172
|
*/
|
|
173
|
-
|
|
173
|
+
purchaseWebhookAndroid: new data.FunctionsData("purchase_webhook_android", require("./functions/purchase_webhook_android")),
|
|
174
174
|
/**
|
|
175
175
|
* Webhook endpoint for IOS, which allows you to receive notifications by setting the endpoint in AppStoreConnect's [App]->[App Information]->[App Store Server Notification].
|
|
176
176
|
*
|
|
177
177
|
* IOS用のWebhookのエンドポイントです。AppStoreConnectの[App]->[App情報]->[App Storeサーバ通知]にエンドポイントを設定することで通知を受け取ることができるようになります。
|
|
178
178
|
*/
|
|
179
|
-
|
|
179
|
+
purchaseWebhookIOS: new data.FunctionsData("purchase_webhook_ios", require("./functions/purchase_webhook_ios")),
|
|
180
180
|
/**
|
|
181
181
|
* Verify subscriptions and add data.
|
|
182
182
|
*
|
|
183
183
|
* サブスクリプションの検証とデータの追加を行います。
|
|
184
184
|
*/
|
|
185
|
-
|
|
185
|
+
subscriptionVerifyAndroid: new data.FunctionsData("subscription_verify_android", require("./functions/subscription_verify_android")),
|
|
186
186
|
/**
|
|
187
187
|
* Verify subscriptions and add data.
|
|
188
188
|
*
|
|
189
189
|
* サブスクリプションの検証とデータの追加を行います。
|
|
190
190
|
*/
|
|
191
|
-
|
|
191
|
+
subscriptionVerifyIOS: new data.FunctionsData("subscription_verify_ios", require("./functions/subscription_verify_ios")),
|
|
192
192
|
};
|
|
193
193
|
//# sourceMappingURL=functions.js.map
|
package/dist/functions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA6C;AAE7C;;;;GAIG;AACU,QAAA,SAAS,GAAG;IACvB;;;;OAIG;IACH,gBAAgB,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,mBAAmB,EAAE,OAAO,CAAC,+BAA+B,CAAC,CAAC;IACvG;;;;OAIG;IACH,aAAa,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,iBAAiB,EAAE,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAChG;;;;OAIG;IACH,UAAU,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACrF;;;;;;;;OAQG;IACH,mBAAmB,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,uBAAuB,EAAE,OAAO,CAAC,mCAAmC,CAAC,CAAC;IAClH;;;;;;;;OAQG;IACH,MAAM,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACvE;;;;;;;;;;;;OAYG;IACH,
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA6C;AAE7C;;;;GAIG;AACU,QAAA,SAAS,GAAG;IACvB;;;;OAIG;IACH,gBAAgB,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,mBAAmB,EAAE,OAAO,CAAC,+BAA+B,CAAC,CAAC;IACvG;;;;OAIG;IACH,aAAa,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,iBAAiB,EAAE,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAChG;;;;OAIG;IACH,UAAU,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACrF;;;;;;;;OAQG;IACH,mBAAmB,EAAE,I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IG;IACH,0BAA0B,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,8BAA8B,EAAE,OAAO,CAAC,0CAA0C,CAAC,CAAC;IACvI;;;;OAIG;IACH,sBAAsB,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,0BAA0B,EAAE,OAAO,CAAC,sCAAsC,CAAC,CAAC;IAC3H;;;;OAIG;IACH,sBAAsB,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,0BAA0B,EAAE,OAAO,CAAC,sCAAsC,CAAC,CAAC;IAC3H;;;;OAIG;IACH,kBAAkB,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,sBAAsB,EAAE,OAAO,CAAC,kCAAkC,CAAC,CAAC;IAC/G;;;;OAIG;IACH,yBAAyB,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,6BAA6B,EAAE,OAAO,CAAC,yCAAyC,CAAC,CAAC;IACpI;;;;OAIG;IACH,qBAAqB,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,yBAAyB,EAAE,OAAO,CAAC,qCAAqC,CAAC,CAAC;CAChH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -21,5 +21,10 @@ export * from "./lib/functions_data";
|
|
|
21
21
|
* The elements defined in [Functions] are passed as an array. The passed method is deployed.
|
|
22
22
|
*
|
|
23
23
|
* [Functions]で定義された要素を配列として渡します。渡されたメソッドがデプロイされます。
|
|
24
|
+
*
|
|
25
|
+
* @param topic
|
|
26
|
+
* pub/subで用いるトピック名を指定します。通常は``
|
|
24
27
|
*/
|
|
25
|
-
export declare function deploy(exports: any, region: regions.Regions, deployFunctions: data.FunctionsData[]
|
|
28
|
+
export declare function deploy(exports: any, region: regions.Regions, deployFunctions: data.FunctionsData[], topic?: {
|
|
29
|
+
[key: string]: string;
|
|
30
|
+
}): void;
|
package/dist/index.js
CHANGED
|
@@ -49,12 +49,15 @@ __exportStar(require("./lib/functions_data"), exports);
|
|
|
49
49
|
* The elements defined in [Functions] are passed as an array. The passed method is deployed.
|
|
50
50
|
*
|
|
51
51
|
* [Functions]で定義された要素を配列として渡します。渡されたメソッドがデプロイされます。
|
|
52
|
+
*
|
|
53
|
+
* @param topic
|
|
54
|
+
* pub/subで用いるトピック名を指定します。通常は``
|
|
52
55
|
*/
|
|
53
|
-
function deploy(exports, region, deployFunctions) {
|
|
56
|
+
function deploy(exports, region, deployFunctions, topic = {}) {
|
|
54
57
|
admin.initializeApp();
|
|
55
58
|
for (const data of deployFunctions) {
|
|
56
59
|
if (!process.env.FUNCTION_NAME || process.env.FUNCTION_NAME === data.id) {
|
|
57
|
-
exports[data.id] = data.func(region);
|
|
60
|
+
exports[data.id] = data.func(region, topic);
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAAwC;AAExC,8CAA4B;AAC5B,uDAAqC;AAErC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAAwC;AAExC,8CAA4B;AAC5B,uDAAqC;AAErC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,MAAM,CAAC,OAAY,EAAE,MAAuB,EAAE,eAAqC,EAAE,QAAmC,EAAE;IACtI,KAAK,CAAC,aAAa,EAAE,CAAC;IACtB,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE;QAChC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,IAAI,CAAC,EAAE,EAAE;YACrE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SAC/C;KACJ;AACL,CAAC;AAPD,wBAOC"}
|