@mathrunet/masamune 2.6.2 → 2.6.3
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 +9 -0
- package/dist/lib/functions/firestore.js +14 -5
- package/dist/lib/functions/firestore.js.map +1 -1
- package/dist/lib/functions/send_notification.js +1 -1
- package/package.json +1 -1
- package/dist/converter/firestore_basic_converter.d.ts +0 -20
- package/dist/converter/firestore_basic_converter.js +0 -25
- package/dist/converter/firestore_basic_converter.js.map +0 -1
- package/dist/converter/firestore_enum_converter.d.ts +0 -20
- package/dist/converter/firestore_enum_converter.js +0 -25
- package/dist/converter/firestore_enum_converter.js.map +0 -1
- package/dist/converter/firestore_model_command_base_converter.d.ts +0 -20
- package/dist/converter/firestore_model_command_base_converter.js +0 -38
- package/dist/converter/firestore_model_command_base_converter.js.map +0 -1
- package/dist/converter/firestore_model_counter_converter.d.ts +0 -20
- package/dist/converter/firestore_model_counter_converter.js +0 -78
- package/dist/converter/firestore_model_counter_converter.js.map +0 -1
- package/dist/converter/firestore_model_date_converter.d.ts +0 -20
- package/dist/converter/firestore_model_date_converter.js +0 -95
- package/dist/converter/firestore_model_date_converter.js.map +0 -1
- package/dist/converter/firestore_model_geo_value_converter.d.ts +0 -20
- package/dist/converter/firestore_model_geo_value_converter.js +0 -77
- package/dist/converter/firestore_model_geo_value_converter.js.map +0 -1
- package/dist/converter/firestore_model_image_uri_converter.d.ts +0 -20
- package/dist/converter/firestore_model_image_uri_converter.js +0 -74
- package/dist/converter/firestore_model_image_uri_converter.js.map +0 -1
- package/dist/converter/firestore_model_locale_converter.d.ts +0 -20
- package/dist/converter/firestore_model_locale_converter.js +0 -74
- package/dist/converter/firestore_model_locale_converter.js.map +0 -1
- package/dist/converter/firestore_model_localized_value_converter.d.ts +0 -20
- package/dist/converter/firestore_model_localized_value_converter.js +0 -36
- package/dist/converter/firestore_model_localized_value_converter.js.map +0 -1
- package/dist/converter/firestore_model_ref_converter.d.ts +0 -20
- package/dist/converter/firestore_model_ref_converter.js +0 -60
- package/dist/converter/firestore_model_ref_converter.js.map +0 -1
- package/dist/converter/firestore_model_search_converter.d.ts +0 -20
- package/dist/converter/firestore_model_search_converter.js +0 -36
- package/dist/converter/firestore_model_search_converter.js.map +0 -1
- package/dist/converter/firestore_model_timestamp_converter.d.ts +0 -20
- package/dist/converter/firestore_model_timestamp_converter.js +0 -95
- package/dist/converter/firestore_model_timestamp_converter.js.map +0 -1
- package/dist/converter/firestore_model_token_converter.d.ts +0 -20
- package/dist/converter/firestore_model_token_converter.js +0 -36
- package/dist/converter/firestore_model_token_converter.js.map +0 -1
- package/dist/converter/firestore_model_uri_converter.d.ts +0 -20
- package/dist/converter/firestore_model_uri_converter.js +0 -74
- package/dist/converter/firestore_model_uri_converter.js.map +0 -1
- package/dist/converter/firestore_model_video_uri_converter.d.ts +0 -20
- package/dist/converter/firestore_model_video_uri_converter.js +0 -74
- package/dist/converter/firestore_model_video_uri_converter.js.map +0 -1
- package/dist/converter/firestore_null_converter.d.ts +0 -20
- package/dist/converter/firestore_null_converter.js +0 -25
- package/dist/converter/firestore_null_converter.js.map +0 -1
- package/dist/exntension/string.extension.d.ts +0 -179
- package/dist/exntension/string.extension.js +0 -190
- package/dist/exntension/string.extension.js.map +0 -1
- package/dist/functions/notification.d.ts +0 -1
- package/dist/functions/notification.js +0 -111
- package/dist/functions/notification.js.map +0 -1
- package/dist/functions/send_notification_schedule.d.ts +0 -1
- package/dist/functions/send_notification_schedule.js +0 -86
- package/dist/functions/send_notification_schedule.js.map +0 -1
- package/dist/functions/stripe_hook.d.ts +0 -1
- package/dist/functions/stripe_hook.js +0 -573
- package/dist/functions/stripe_hook.js.map +0 -1
- package/dist/functions/stripe_hook_connect.d.ts +0 -1
- package/dist/functions/stripe_hook_connect.js +0 -140
- package/dist/functions/stripe_hook_connect.js.map +0 -1
- package/dist/functions/stripe_hook_secure.d.ts +0 -1
- package/dist/functions/stripe_hook_secure.js +0 -150
- package/dist/functions/stripe_hook_secure.js.map +0 -1
- package/dist/lib/call_process_function_base.d.ts +0 -39
- package/dist/lib/call_process_function_base.js +0 -69
- package/dist/lib/call_process_function_base.js.map +0 -1
- package/dist/lib/default_firestore_model_field_value_converter.d.ts +0 -8
- package/dist/lib/default_firestore_model_field_value_converter.js +0 -44
- package/dist/lib/default_firestore_model_field_value_converter.js.map +0 -1
- package/dist/lib/firestore_model_field_value_converter.d.ts +0 -140
- package/dist/lib/firestore_model_field_value_converter.js +0 -127
- package/dist/lib/firestore_model_field_value_converter.js.map +0 -1
- package/dist/lib/functions_base.d.ts +0 -195
- package/dist/lib/functions_base.js +0 -37
- package/dist/lib/functions_base.js.map +0 -1
- package/dist/lib/functions_data.d.ts +0 -10
- package/dist/lib/functions_data.js +0 -19
- package/dist/lib/functions_data.js.map +0 -1
- package/dist/lib/gmail.d.ts +0 -39
- package/dist/lib/gmail.js +0 -65
- package/dist/lib/gmail.js.map +0 -1
- package/dist/lib/model_field_value.d.ts +0 -82
- package/dist/lib/model_field_value.js +0 -104
- package/dist/lib/model_field_value.js.map +0 -1
- package/dist/lib/request_process_function_base.d.ts +0 -39
- package/dist/lib/request_process_function_base.js +0 -69
- package/dist/lib/request_process_function_base.js.map +0 -1
- package/dist/lib/schedule_process_function_base.d.ts +0 -33
- package/dist/lib/schedule_process_function_base.js +0 -70
- package/dist/lib/schedule_process_function_base.js.map +0 -1
- package/dist/lib/send_gmail.d.ts +0 -34
- package/dist/lib/send_gmail.js +0 -90
- package/dist/lib/send_gmail.js.map +0 -1
- package/dist/lib/send_grid.d.ts +0 -33
- package/dist/lib/send_grid.js +0 -58
- package/dist/lib/send_grid.js.map +0 -1
- package/dist/lib/send_notification.d.ts +0 -59
- package/dist/lib/send_notification.js +0 -216
- package/dist/lib/send_notification.js.map +0 -1
- package/dist/lib/sql_api_base.d.ts +0 -185
- package/dist/lib/sql_api_base.js +0 -94
- package/dist/lib/sql_api_base.js.map +0 -1
- package/dist/lib/update_subscription.d.ts +0 -83
- package/dist/lib/update_subscription.js +0 -143
- package/dist/lib/update_subscription.js.map +0 -1
- package/dist/lib/update_unlock.d.ts +0 -13
- package/dist/lib/update_unlock.js +0 -64
- package/dist/lib/update_unlock.js.map +0 -1
- package/dist/lib/update_wallet.d.ts +0 -19
- package/dist/lib/update_wallet.js +0 -70
- package/dist/lib/update_wallet.js.map +0 -1
- package/dist/lib/verify_android.d.ts +0 -50
- package/dist/lib/verify_android.js +0 -121
- package/dist/lib/verify_android.js.map +0 -1
- package/dist/lib/verify_ios.d.ts +0 -26
- package/dist/lib/verify_ios.js +0 -110
- package/dist/lib/verify_ios.js.map +0 -1
- package/dist/src/functions/notification.d.ts +0 -1
- package/dist/src/functions/notification.js +0 -111
- package/dist/src/functions/notification.js.map +0 -1
- package/dist/src/functions.d.ts +0 -14
- package/dist/src/functions.js +0 -41
- package/dist/src/functions.js.map +0 -1
- package/dist/src/index.d.ts +0 -13
- package/dist/src/index.js +0 -51
- package/dist/src/index.js.map +0 -1
- package/dist/src/lib/functions_data.d.ts +0 -25
- package/dist/src/lib/functions_data.js +0 -31
- package/dist/src/lib/functions_data.js.map +0 -1
|
@@ -1,140 +0,0 @@
|
|
|
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) => 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_hook_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M,EAAE;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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,150 +0,0 @@
|
|
|
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) => 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_hook_secure.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stripe_hook_secure.js","sourceRoot":"","sources":["../../src/functions/stripe_hook_secure.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgD;AAChD,+CAAiC;AACjC,sDAAwC;AACxC,oDAAsC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,MAAM,CAAC,OAAO,GAAG,CAAC,OAAiB,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,KAAK,CAAC,SAAS,CAClF,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;QAC9B,IAAI,CAAC,K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AAE;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"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import * as functions from "firebase-functions/v2";
|
|
2
|
-
import { FunctionsBase, HttpFunctionsOptions } from "./functions_base";
|
|
3
|
-
export { CallableRequest } from "firebase-functions/v2/https";
|
|
4
|
-
/**
|
|
5
|
-
* Base class for defining the data of Functions for executing the Call method of Functions.
|
|
6
|
-
*
|
|
7
|
-
* FunctionsのCallメソッド実行用のFunctionのデータを定義するためのベースクラス。
|
|
8
|
-
*/
|
|
9
|
-
export declare abstract class CallProcessFunctionBase extends FunctionsBase {
|
|
10
|
-
/**
|
|
11
|
-
* Base class for defining the data of Functions for executing the Call method of Functions.
|
|
12
|
-
*
|
|
13
|
-
* FunctionsのCallメソッド実行用のFunctionのデータを定義するためのベースクラス。
|
|
14
|
-
*/
|
|
15
|
-
constructor(options?: HttpFunctionsOptions);
|
|
16
|
-
/**
|
|
17
|
-
* Specify the actual contents of the process.
|
|
18
|
-
*
|
|
19
|
-
* 実際の処理の中身を指定します。
|
|
20
|
-
*
|
|
21
|
-
* @param {any} query
|
|
22
|
-
* Query passed to Functions.
|
|
23
|
-
*
|
|
24
|
-
* Functionsに渡されたクエリ。
|
|
25
|
-
*
|
|
26
|
-
* @returns {{ [key: string]: any }}
|
|
27
|
-
* Return value of the process.
|
|
28
|
-
*
|
|
29
|
-
* 処理の戻り値。
|
|
30
|
-
*/
|
|
31
|
-
abstract process(query: functions.https.CallableRequest<any>): Promise<{
|
|
32
|
-
[key: string]: any;
|
|
33
|
-
}>;
|
|
34
|
-
abstract id: string;
|
|
35
|
-
data: {
|
|
36
|
-
[key: string]: string;
|
|
37
|
-
};
|
|
38
|
-
build(regions: string[]): Function;
|
|
39
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
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.CallProcessFunctionBase = void 0;
|
|
36
|
-
const functions = __importStar(require("firebase-functions/v2"));
|
|
37
|
-
const functions_base_1 = require("./functions_base");
|
|
38
|
-
/**
|
|
39
|
-
* Base class for defining the data of Functions for executing the Call method of Functions.
|
|
40
|
-
*
|
|
41
|
-
* FunctionsのCallメソッド実行用のFunctionのデータを定義するためのベースクラス。
|
|
42
|
-
*/
|
|
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
|
-
constructor(options = {}) {
|
|
50
|
-
super({ options: options });
|
|
51
|
-
this.data = {};
|
|
52
|
-
}
|
|
53
|
-
build(regions) {
|
|
54
|
-
var _a;
|
|
55
|
-
const options = this.options;
|
|
56
|
-
return functions.https.onCall({
|
|
57
|
-
region: (_a = options === null || options === void 0 ? void 0 : options.region) !== null && _a !== void 0 ? _a : regions,
|
|
58
|
-
timeoutSeconds: options === null || options === void 0 ? void 0 : options.timeoutSeconds,
|
|
59
|
-
memory: options === null || options === void 0 ? void 0 : options.memory,
|
|
60
|
-
minInstances: options === null || options === void 0 ? void 0 : options.minInstances,
|
|
61
|
-
concurrency: options === null || options === void 0 ? void 0 : options.concurrency,
|
|
62
|
-
maxInstances: options === null || options === void 0 ? void 0 : options.maxInstances,
|
|
63
|
-
}, (query) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
return this.process(query);
|
|
65
|
-
}));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.CallProcessFunctionBase = CallProcessFunctionBase;
|
|
69
|
-
//# sourceMappingURL=call_process_function_base.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"call_process_function_base.js","sourceRoot":"","sources":["../../src/lib/call_process_function_base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAmD;AACnD,qDAAyF;AAGzF;;;;GAIG;AACH,MAAsB,uBAAwB,SAAQ,8BAAa;IAC/D;;;;OAIG;IACH,YAAY,UAAgC,EAAE;QAC1C,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAqBhC,SAAI,GAA8B,EAAE,CAAC;IApBrC,CAAC;IAqBD,KAAK,CAAC,OAAiB;;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAkD,CAAC;QACxE,OAAO,SAAS,CAAC,KAAK,CAAC,MAAM,CACzB;YACI,MAAM,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,mCAAI,OAAO;YAClC,cAAc,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc;YACvC,MAAM,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM;YACvB,YAAY,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY;YACnC,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW;YACjC,YAAY,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY;SACtC,EACD,CAAO,KAAK,EAAE,EAAE;YACZ,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAA,CACJ,CAAC;IACN,CAAC;CACJ;AA7CD,0DA6CC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FirestoreModelFieldValueConverter } from "./firestore_model_field_value_converter";
|
|
2
|
-
/**
|
|
3
|
-
* List of converters for converting Firestore values.
|
|
4
|
-
*
|
|
5
|
-
* Firestoreの値を変換するためのコンバーター一覧。
|
|
6
|
-
*/
|
|
7
|
-
declare const defaultConverters: FirestoreModelFieldValueConverter[];
|
|
8
|
-
export { defaultConverters };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultConverters = void 0;
|
|
4
|
-
const firestore_model_command_base_converter_1 = require("../converter/firestore_model_command_base_converter");
|
|
5
|
-
const firestore_model_counter_converter_1 = require("../converter/firestore_model_counter_converter");
|
|
6
|
-
const firestore_model_timestamp_converter_1 = require("../converter/firestore_model_timestamp_converter");
|
|
7
|
-
const firestore_model_date_converter_1 = require("../converter/firestore_model_date_converter");
|
|
8
|
-
const firestore_model_locale_converter_1 = require("../converter/firestore_model_locale_converter");
|
|
9
|
-
const firestore_model_localized_value_converter_1 = require("../converter/firestore_model_localized_value_converter");
|
|
10
|
-
const firestore_model_uri_converter_1 = require("../converter/firestore_model_uri_converter");
|
|
11
|
-
const firestore_model_image_uri_converter_1 = require("../converter/firestore_model_image_uri_converter");
|
|
12
|
-
const firestore_basic_converter_1 = require("../converter/firestore_basic_converter");
|
|
13
|
-
const firestore_enum_converter_1 = require("../converter/firestore_enum_converter");
|
|
14
|
-
const firestore_model_geo_value_converter_1 = require("../converter/firestore_model_geo_value_converter");
|
|
15
|
-
const firestore_model_ref_converter_1 = require("../converter/firestore_model_ref_converter");
|
|
16
|
-
const firestore_model_search_converter_1 = require("../converter/firestore_model_search_converter");
|
|
17
|
-
const firestore_model_token_converter_1 = require("../converter/firestore_model_token_converter");
|
|
18
|
-
const firestore_model_video_uri_converter_1 = require("../converter/firestore_model_video_uri_converter");
|
|
19
|
-
const firestore_null_converter_1 = require("../converter/firestore_null_converter");
|
|
20
|
-
/**
|
|
21
|
-
* List of converters for converting Firestore values.
|
|
22
|
-
*
|
|
23
|
-
* Firestoreの値を変換するためのコンバーター一覧。
|
|
24
|
-
*/
|
|
25
|
-
const defaultConverters = [
|
|
26
|
-
new firestore_model_command_base_converter_1.FirestoreModelCommandBaseConverter(),
|
|
27
|
-
new firestore_model_counter_converter_1.FirestoreModelCounterConverter(),
|
|
28
|
-
new firestore_model_timestamp_converter_1.FirestoreModelTimestampConverter(),
|
|
29
|
-
new firestore_model_date_converter_1.FirestoreModelDateConverter(),
|
|
30
|
-
new firestore_model_locale_converter_1.FirestoreModelLocaleConverter(),
|
|
31
|
-
new firestore_model_localized_value_converter_1.FirestoreModelLocalizedValueConverter(),
|
|
32
|
-
new firestore_model_uri_converter_1.FirestoreModelUriConverter(),
|
|
33
|
-
new firestore_model_image_uri_converter_1.FirestoreModelImageUriConverter(),
|
|
34
|
-
new firestore_model_video_uri_converter_1.FirestoreModelVideoUriConverter(),
|
|
35
|
-
new firestore_model_search_converter_1.FirestoreModelSearchConverter(),
|
|
36
|
-
new firestore_model_token_converter_1.FirestoreModelTokenConverter(),
|
|
37
|
-
new firestore_model_geo_value_converter_1.FirestoreModelGeoValueConverter(),
|
|
38
|
-
new firestore_model_ref_converter_1.FirestoreModelRefConverter(),
|
|
39
|
-
new firestore_enum_converter_1.FirestoreEnumConverter(),
|
|
40
|
-
new firestore_null_converter_1.FirestoreNullConverter(),
|
|
41
|
-
new firestore_basic_converter_1.FirestoreBasicConverter(),
|
|
42
|
-
];
|
|
43
|
-
exports.defaultConverters = defaultConverters;
|
|
44
|
-
//# sourceMappingURL=default_firestore_model_field_value_converter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default_firestore_model_field_value_converter.js","sourceRoot":"","sources":["../../src/lib/default_firestore_model_field_value_converter.ts"],"names":[],"mappings":";;;AACA,gHAAyG;AACzG,sGAAgG;AAChG,0GAAoG;AACpG,gGAA0F;AAC1F,oGAA8F;AAC9F,sHAA+G;AAC/G,8FAAwF;AACxF,0GAAmG;AACnG,sFAAiF;AACjF,oFAA+E;AAC/E,0GAAmG;AACnG,8FAAwF;AACxF,oGAA8F;AAC9F,kGAA4F;AAC5F,0GAAmG;AACnG,oFAA+E;AAE/E;;;;GAIG;AACH,MAAM,iBAAiB,GAAwC;IAC3D,IAAI,2EAAkC,EAAE;IACxC,IAAI,kEAA8B,EAAE;IACpC,IAAI,sEAAgC,EAAE;IACtC,IAAI,4DAA2B,EAAE;IACjC,IAAI,gEAA6B,EAAE;IACnC,IAAI,iFAAqC,EAAE;IAC3C,IAAI,0DAA0B,EAAE;IAChC,IAAI,qEAA+B,EAAE;IACrC,IAAI,qEAA+B,EAAE;IACrC,IAAI,gEAA6B,EAAE;IACnC,IAAI,8DAA4B,EAAE;IAClC,IAAI,qEAA+B,EAAE;IACrC,IAAI,0DAA0B,EAAE;IAChC,IAAI,iDAAsB,EAAE;IAC5B,IAAI,iDAAsB,EAAE;IAC5B,IAAI,mDAAuB,EAAE;CAChC,CAAC;AACO,8CAAiB"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { DocumentReference, Timestamp } from "firebase-admin/firestore";
|
|
2
|
-
/**
|
|
3
|
-
* Base class for converting [ModelFieldValue] for use in Firestore.
|
|
4
|
-
*
|
|
5
|
-
* Firestoreで利用するための[ModelFieldValue]の変換を行うベースクラス。
|
|
6
|
-
*/
|
|
7
|
-
export declare abstract class FirestoreModelFieldValueConverter {
|
|
8
|
-
/**
|
|
9
|
-
* Base class for converting [ModelFieldValue] for use in Firestore.
|
|
10
|
-
*
|
|
11
|
-
* Firestoreで利用するための[ModelFieldValue]の変換を行うベースクラス。
|
|
12
|
-
*/
|
|
13
|
-
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* The type of [ModelFieldValue] that can be converted.
|
|
16
|
-
*
|
|
17
|
-
* 変換可能な[ModelFieldValue]の型。
|
|
18
|
-
*/
|
|
19
|
-
abstract type: string;
|
|
20
|
-
/**
|
|
21
|
-
* Convert from Firestore manageable type to [ModelFieldValue].
|
|
22
|
-
*
|
|
23
|
-
* Generate and return a [DynamicMap] value from [key] and [value]. [original] is passed the [DynamicMap] before conversion.
|
|
24
|
-
*
|
|
25
|
-
* Return [Null] if there are no changes.
|
|
26
|
-
*
|
|
27
|
-
* [FirestoreModelAdapterBase] is passed to [adapter].
|
|
28
|
-
*
|
|
29
|
-
* Firestoreで管理可能な型から[ModelFieldValue]に変換します。
|
|
30
|
-
*
|
|
31
|
-
* [key]と[value]から[DynamicMap]の値を生成して返してください。[original]は変換前の[DynamicMap]を渡します。
|
|
32
|
-
*
|
|
33
|
-
* 変更がない場合は[Null]を返してください。
|
|
34
|
-
*
|
|
35
|
-
* [adapter]に[FirestoreModelAdapterBase]が渡されます。
|
|
36
|
-
*/
|
|
37
|
-
abstract convertFrom(key: string, value: any, original: {
|
|
38
|
-
[field: string]: any;
|
|
39
|
-
}): {
|
|
40
|
-
[field: string]: any;
|
|
41
|
-
} | null;
|
|
42
|
-
/**
|
|
43
|
-
* Generate a header for ModelFieldValue.
|
|
44
|
-
*
|
|
45
|
-
* ModelFieldValue用のヘッダーを生成します。
|
|
46
|
-
*
|
|
47
|
-
* @returns { { [field: string]: any } }
|
|
48
|
-
* Header for ModelFieldValue.
|
|
49
|
-
*
|
|
50
|
-
* ModelFieldValue用のヘッダー。
|
|
51
|
-
*/
|
|
52
|
-
header(): {
|
|
53
|
-
[field: string]: any;
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Class for generating values for `ModelFieldValue` for Firestore.
|
|
58
|
-
*
|
|
59
|
-
* Firestore用の`ModelFieldValue`用の値を生成するためのクラス。
|
|
60
|
-
*/
|
|
61
|
-
export declare class FirestoreModelFieldValue {
|
|
62
|
-
/**
|
|
63
|
-
* Generate data for `ModelRef`.
|
|
64
|
-
*
|
|
65
|
-
* `ModelRef`用のデータを生成します。
|
|
66
|
-
*
|
|
67
|
-
* @param {string} key
|
|
68
|
-
* Data key.
|
|
69
|
-
*
|
|
70
|
-
* データのキー。
|
|
71
|
-
*
|
|
72
|
-
* @param {DocumentReference} ref
|
|
73
|
-
* Document reference data.
|
|
74
|
-
*
|
|
75
|
-
* ドキュメントのリファレンスデータ。
|
|
76
|
-
*
|
|
77
|
-
* @returns { [key: string]: any }
|
|
78
|
-
* Data for `ModelRef`.
|
|
79
|
-
*
|
|
80
|
-
* `ModelRef`用のデータ。
|
|
81
|
-
*/
|
|
82
|
-
static documentReferenceToModelRef({ key, ref, }: {
|
|
83
|
-
key: string;
|
|
84
|
-
ref: DocumentReference;
|
|
85
|
-
}): {
|
|
86
|
-
[key: string]: any;
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* Generate data for `ModelTimestamp`.
|
|
90
|
-
*
|
|
91
|
-
* `ModelTimestamp`用のデータを生成します。
|
|
92
|
-
*
|
|
93
|
-
* @param {string} key
|
|
94
|
-
* Data key.
|
|
95
|
-
*
|
|
96
|
-
* データのキー。
|
|
97
|
-
*
|
|
98
|
-
* @param {Timestamp} timestamp
|
|
99
|
-
* Time stamp data.
|
|
100
|
-
*
|
|
101
|
-
* タイムスタンプデータ。
|
|
102
|
-
*
|
|
103
|
-
* @returns { [key: string]: any }
|
|
104
|
-
* Data for `ModelTimestamp`.
|
|
105
|
-
*
|
|
106
|
-
* `ModelTimestamp`用のデータ。
|
|
107
|
-
*/
|
|
108
|
-
static timestampToModelTimestamp({ key, timestamp, }: {
|
|
109
|
-
key: string;
|
|
110
|
-
timestamp: Timestamp;
|
|
111
|
-
}): {
|
|
112
|
-
[key: string]: any;
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Generate data for `ModelGeoValue`.
|
|
116
|
-
*
|
|
117
|
-
* `ModelGeoValue`用のデータを生成します。
|
|
118
|
-
*
|
|
119
|
-
* @param {string} key
|
|
120
|
-
* Data key.
|
|
121
|
-
*
|
|
122
|
-
* データのキー。
|
|
123
|
-
*
|
|
124
|
-
* @param {Timestamp} timestamp
|
|
125
|
-
* Time stamp data.
|
|
126
|
-
*
|
|
127
|
-
* タイムスタンプデータ。
|
|
128
|
-
*
|
|
129
|
-
* @returns { [key: string]: any }
|
|
130
|
-
* Data for `ModelGeoValue`.
|
|
131
|
-
*
|
|
132
|
-
* `ModelGeoValue`用のデータ。
|
|
133
|
-
*/
|
|
134
|
-
static geoPointToModelGeoValue({ key, timestamp, }: {
|
|
135
|
-
key: string;
|
|
136
|
-
timestamp: Timestamp;
|
|
137
|
-
}): {
|
|
138
|
-
[key: string]: any;
|
|
139
|
-
};
|
|
140
|
-
}
|