@mathrunet/masamune 0.4.4 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/functions/android_auth_code.d.ts +1 -0
- package/dist/functions/android_auth_code.js +76 -0
- package/dist/functions/android_auth_code.js.map +1 -0
- package/dist/functions/android_token.d.ts +1 -0
- package/dist/functions/android_token.js +117 -0
- package/dist/functions/android_token.js.map +1 -0
- package/dist/functions/consumable_verify_android.d.ts +1 -0
- package/dist/functions/consumable_verify_android.js +132 -0
- package/dist/functions/consumable_verify_android.js.map +1 -0
- package/dist/functions/consumable_verify_ios.d.ts +1 -0
- package/dist/functions/consumable_verify_ios.js +92 -0
- package/dist/functions/consumable_verify_ios.js.map +1 -0
- package/dist/functions/gmail.js +8 -3
- package/dist/functions/gmail.js.map +1 -1
- package/dist/functions/nonconsumable_verify_android.d.ts +1 -0
- package/dist/functions/nonconsumable_verify_android.js +126 -0
- package/dist/functions/nonconsumable_verify_android.js.map +1 -0
- package/dist/functions/nonconsumable_verify_ios.d.ts +1 -0
- package/dist/functions/nonconsumable_verify_ios.js +86 -0
- package/dist/functions/nonconsumable_verify_ios.js.map +1 -0
- package/dist/functions/purchase_hook_android.d.ts +1 -0
- package/dist/functions/purchase_hook_android.js +237 -0
- package/dist/functions/purchase_hook_android.js.map +1 -0
- package/dist/functions/purchase_hook_ios.d.ts +1 -0
- package/dist/functions/purchase_hook_ios.js +135 -0
- package/dist/functions/purchase_hook_ios.js.map +1 -0
- package/dist/functions/send_grid.js +6 -1
- package/dist/functions/send_grid.js.map +1 -1
- package/dist/functions/stripe.js +46 -12
- package/dist/functions/stripe.js.map +1 -1
- package/dist/functions/stripe_hook_secure.js +5 -1
- package/dist/functions/stripe_hook_secure.js.map +1 -1
- package/dist/functions/subscription_verify_android.d.ts +1 -0
- package/dist/functions/subscription_verify_android.js +159 -0
- package/dist/functions/subscription_verify_android.js.map +1 -0
- package/dist/functions/subscription_verify_ios.d.ts +1 -0
- package/dist/functions/subscription_verify_ios.js +128 -0
- package/dist/functions/subscription_verify_ios.js.map +1 -0
- package/dist/functions.d.ts +62 -0
- package/dist/functions.js +62 -0
- package/dist/functions.js.map +1 -1
- package/dist/lib/gmail.d.ts +6 -1
- package/dist/lib/gmail.js +1 -1
- package/dist/lib/gmail.js.map +1 -1
- package/dist/lib/send_grid.d.ts +6 -1
- package/dist/lib/send_grid.js +1 -1
- package/dist/lib/send_grid.js.map +1 -1
- package/dist/lib/update_subscription.d.ts +83 -0
- package/dist/lib/update_subscription.js +142 -0
- package/dist/lib/update_subscription.js.map +1 -0
- package/dist/lib/update_unlock.d.ts +13 -0
- package/dist/lib/update_unlock.js +64 -0
- package/dist/lib/update_unlock.js.map +1 -0
- package/dist/lib/update_wallet.d.ts +19 -0
- package/dist/lib/update_wallet.js +70 -0
- package/dist/lib/update_wallet.js.map +1 -0
- package/dist/lib/utils.d.ts +10 -2
- package/dist/lib/utils.js +2 -2
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/verify_android.d.ts +56 -0
- package/dist/lib/verify_android.js +128 -0
- package/dist/lib/verify_android.js.map +1 -0
- package/dist/lib/verify_ios.d.ts +26 -0
- package/dist/lib/verify_ios.js +115 -0
- package/dist/lib/verify_ios.js.map +1 -0
- package/package.json +2 -1
package/dist/functions.js
CHANGED
|
@@ -127,5 +127,67 @@ exports.Functions = {
|
|
|
127
127
|
* SendGridでメールを送信します。
|
|
128
128
|
*/
|
|
129
129
|
sendGrid: new data.FunctionsData("send_grid", require("./functions/send_grid")),
|
|
130
|
+
/**
|
|
131
|
+
* 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.
|
|
132
|
+
*
|
|
133
|
+
* [android_auth_code]からリダイレクトされた後、GoogleのAPIに接続するためのリフレッシュトークンを取得します。
|
|
134
|
+
* 必要情報を登録した後[android_auth_code]を実行してください。
|
|
135
|
+
*/
|
|
136
|
+
android_auth_code: new data.FunctionsData("android_auth_code", require("./functions/android_auth_code")),
|
|
137
|
+
/**
|
|
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
|
+
*
|
|
140
|
+
* [android_auth_code]からリダイレクトされた後、GoogleのAPIに接続するためのリフレッシュトークンを取得します。
|
|
141
|
+
* 必要情報を登録した後[android_auth_code]を実行してください。
|
|
142
|
+
*/
|
|
143
|
+
android_token: new data.FunctionsData("android_token", require("./functions/android_token")),
|
|
144
|
+
/**
|
|
145
|
+
* Performs a consumption-type in-app purchase. The value of the field in the document specified in [path] is added to [value].
|
|
146
|
+
*
|
|
147
|
+
* 消費型のアプリ内課金を行います。[path]に指定したドキュメント内のフィールドの値を[value]に加算します。
|
|
148
|
+
*/
|
|
149
|
+
consumable_verify_android: new data.FunctionsData("consumable_verify_android", require("./functions/consumable_verify_android")),
|
|
150
|
+
/**
|
|
151
|
+
* Performs a consumption-type in-app purchase. The value of the field in the document specified in [path] is added to [value].
|
|
152
|
+
*
|
|
153
|
+
* 消費型のアプリ内課金を行います。[path]に指定したドキュメント内のフィールドの値を[value]に加算します。
|
|
154
|
+
*/
|
|
155
|
+
consumable_verify_ios: new data.FunctionsData("consumable_verify_ios", require("./functions/consumable_verify_ios")),
|
|
156
|
+
/**
|
|
157
|
+
* Performs non-consumable in-app purchases. Unlock by setting the value of the field in the document specified in [path] to `true`.
|
|
158
|
+
*
|
|
159
|
+
* 非消費型のアプリ内課金を行います。[path]に指定したドキュメント内のフィールドの値を`true`にすることでアンロックを行います。
|
|
160
|
+
*/
|
|
161
|
+
nonconsumable_verify_android: new data.FunctionsData("nonconsumable_verify_android", require("./functions/nonconsumable_verify_android")),
|
|
162
|
+
/**
|
|
163
|
+
* Performs non-consumable in-app purchases. Unlock by setting the value of the field in the document specified in [path] to `true`.
|
|
164
|
+
*
|
|
165
|
+
* 非消費型のアプリ内課金を行います。[path]に指定したドキュメント内のフィールドの値を`true`にすることでアンロックを行います。
|
|
166
|
+
*/
|
|
167
|
+
nonconsumable_verify_ios: new data.FunctionsData("nonconsumable_verify_ios", require("./functions/nonconsumable_verify_ios")),
|
|
168
|
+
/**
|
|
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
|
+
*
|
|
171
|
+
* Android用のWebhookのエンドポイントです。GCPのpub/subに`purchasing`のトピックを作成しプリンシパルに「google-play-developer-notifications@system.gserviceaccount.com」を設定することで通知を受け取ることができるようになります。
|
|
172
|
+
*/
|
|
173
|
+
purchase_hook_android: new data.FunctionsData("purchase_hook_android", require("./functions/purchase_hook_android")),
|
|
174
|
+
/**
|
|
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
|
+
*
|
|
177
|
+
* IOS用のWebhookのエンドポイントです。AppStoreConnectの[App]->[App情報]->[App Storeサーバ通知]にエンドポイントを設定することで通知を受け取ることができるようになります。
|
|
178
|
+
*/
|
|
179
|
+
purchase_hook_ios: new data.FunctionsData("purchase_hook_ios", require("./functions/purchase_hook_ios")),
|
|
180
|
+
/**
|
|
181
|
+
* Verify subscriptions and add data.
|
|
182
|
+
*
|
|
183
|
+
* サブスクリプションの検証とデータの追加を行います。
|
|
184
|
+
*/
|
|
185
|
+
subscription_verify_android: new data.FunctionsData("subscription_verify_android", require("./functions/subscription_verify_android")),
|
|
186
|
+
/**
|
|
187
|
+
* Verify subscriptions and add data.
|
|
188
|
+
*
|
|
189
|
+
* サブスクリプションの検証とデータの追加を行います。
|
|
190
|
+
*/
|
|
191
|
+
subscription_verify_ios: new data.FunctionsData("subscription_verify_ios", require("./functions/subscription_verify_ios")),
|
|
130
192
|
};
|
|
131
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,UAAU,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACrF;;;;;;;;;;;;;;;;OAgBG;IACH,iBAAiB,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,qBAAqB,EAAE,OAAO,CAAC,iCAAiC,CAAC,CAAC;IAC5G;;;;;;;;;;;;OAYG;IACH,gBAAgB,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,oBAAoB,EAAE,OAAO,CAAC,gCAAgC,CAAC,CAAC;IACzG;;;;OAIG;IACH,KAAK,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,mBAAmB,CAAC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AI,CAAC,aAAa,CAAC,yBAAyB,EAAE,OAAO,CAAC,qCAAqC,CAAC,CAAC;CAClH,CAAC"}
|
package/dist/lib/gmail.d.ts
CHANGED
|
@@ -31,4 +31,9 @@
|
|
|
31
31
|
* Email content.
|
|
32
32
|
* メール本文。
|
|
33
33
|
*/
|
|
34
|
-
export declare function send(from
|
|
34
|
+
export declare function send({ from, to, title, content, }: {
|
|
35
|
+
from: string;
|
|
36
|
+
to: string;
|
|
37
|
+
title: string;
|
|
38
|
+
content: string;
|
|
39
|
+
}): Promise<void>;
|
package/dist/lib/gmail.js
CHANGED
|
@@ -68,7 +68,7 @@ const functions = __importStar(require("firebase-functions"));
|
|
|
68
68
|
* Email content.
|
|
69
69
|
* メール本文。
|
|
70
70
|
*/
|
|
71
|
-
function send(from, to, title, content) {
|
|
71
|
+
function send({ from, to, title, content, }) {
|
|
72
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
73
|
const config = functions.config().mail;
|
|
74
74
|
const mailTransport = (0, nodemailer_1.createTransport)({
|
package/dist/lib/gmail.js.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/lib/send_grid.d.ts
CHANGED
|
@@ -25,4 +25,9 @@
|
|
|
25
25
|
* Email content.
|
|
26
26
|
* メール本文。
|
|
27
27
|
*/
|
|
28
|
-
export declare function send(from
|
|
28
|
+
export declare function send({ from, to, title, content, }: {
|
|
29
|
+
from: string;
|
|
30
|
+
to: string;
|
|
31
|
+
title: string;
|
|
32
|
+
content: string;
|
|
33
|
+
}): Promise<void>;
|
package/dist/lib/send_grid.js
CHANGED
|
@@ -62,7 +62,7 @@ const sendgrid = __importStar(require("@sendgrid/mail"));
|
|
|
62
62
|
* Email content.
|
|
63
63
|
* メール本文。
|
|
64
64
|
*/
|
|
65
|
-
function send(from, to, title, content) {
|
|
65
|
+
function send({ from, to, title, content, }) {
|
|
66
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
67
67
|
const config = functions.config().mail;
|
|
68
68
|
sendgrid.setApiKey(config.sendgrid.api_key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send_grid.js","sourceRoot":"","sources":["../../src/lib/send_grid.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgD;AAChD,yDAA2C;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAsB,IAAI,
|
|
1
|
+
{"version":3,"file":"send_grid.js","sourceRoot":"","sources":["../../src/lib/send_grid.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgD;AAChD,yDAA2C;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;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,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,GAAG,GAAG;YACV,EAAE,EAAE,EAAE;YACN,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,OAAO;SACd,CAAC;QACF,MAAM,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CAAA;AApBD,oBAoBC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Processes subscription updates.
|
|
3
|
+
*
|
|
4
|
+
* サブスクリプションのアップデート処理を行います。
|
|
5
|
+
*
|
|
6
|
+
* @param {String} targetCollectionPath
|
|
7
|
+
* Specify the path of the collection to be updated.
|
|
8
|
+
*
|
|
9
|
+
* アップデートを行うコレクションのパスを指定します。
|
|
10
|
+
*
|
|
11
|
+
* @param {String} targetDocumentId
|
|
12
|
+
* Specifies the ID of the document to be updated.
|
|
13
|
+
*
|
|
14
|
+
* アップデートを行うドキュメントのIDを指定します。
|
|
15
|
+
*
|
|
16
|
+
* @param {[key: string]: any} data
|
|
17
|
+
* Document data to be updated.
|
|
18
|
+
*
|
|
19
|
+
* 更新するドキュメントデータ。
|
|
20
|
+
*
|
|
21
|
+
* @param {[key: string]: any} additionalData
|
|
22
|
+
* Additional documentation data.
|
|
23
|
+
*
|
|
24
|
+
* 追加のドキュメントデータ。
|
|
25
|
+
*
|
|
26
|
+
* @param {String} userId
|
|
27
|
+
* ID of the user who purchased the subscription.
|
|
28
|
+
*
|
|
29
|
+
* サブスクリプションを購入したユーザーのID。
|
|
30
|
+
*
|
|
31
|
+
* @param {String} platform
|
|
32
|
+
* Subscription-based platform.
|
|
33
|
+
*
|
|
34
|
+
* サブスクリプションを利用するプラットフォーム。
|
|
35
|
+
*
|
|
36
|
+
* @param {String} orderId
|
|
37
|
+
* Subscription Order ID.
|
|
38
|
+
*
|
|
39
|
+
* サブスクリプションの注文ID。
|
|
40
|
+
*
|
|
41
|
+
* @param {String} productId Product ID.
|
|
42
|
+
* Subscription product ID.
|
|
43
|
+
*
|
|
44
|
+
* サブスクリプションのプロダクトID。
|
|
45
|
+
*
|
|
46
|
+
* @param {String} purchaseId
|
|
47
|
+
* Subscription purchase ID.
|
|
48
|
+
*
|
|
49
|
+
* サブスクリプションの購入ID。
|
|
50
|
+
*
|
|
51
|
+
* @param {String} packageName
|
|
52
|
+
* The package name of the application.
|
|
53
|
+
*
|
|
54
|
+
* アプリケーションのパッケージ名。
|
|
55
|
+
*
|
|
56
|
+
* @param {String} token
|
|
57
|
+
* Token issued at the time of purchase.
|
|
58
|
+
*
|
|
59
|
+
* 購入時に発行されたトークン。
|
|
60
|
+
*
|
|
61
|
+
* @param {number} expiryDate
|
|
62
|
+
* Subscription expiration date.
|
|
63
|
+
*
|
|
64
|
+
* サブスクリプションの有効期限。
|
|
65
|
+
*/
|
|
66
|
+
export declare function updateSubscription({ targetCollectionPath, targetDocumentId, data, additionalData, userId, platform, orderId, productId, purchaseId, packageName, token, expiryDate, }: {
|
|
67
|
+
targetCollectionPath: string;
|
|
68
|
+
targetDocumentId: string;
|
|
69
|
+
data: {
|
|
70
|
+
[key: string]: any;
|
|
71
|
+
};
|
|
72
|
+
additionalData: {
|
|
73
|
+
[key: string]: any;
|
|
74
|
+
};
|
|
75
|
+
userId: string;
|
|
76
|
+
platform: string;
|
|
77
|
+
orderId: string;
|
|
78
|
+
productId: string;
|
|
79
|
+
purchaseId: string;
|
|
80
|
+
packageName: string;
|
|
81
|
+
token: string;
|
|
82
|
+
expiryDate: number;
|
|
83
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,142 @@
|
|
|
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.updateSubscription = void 0;
|
|
36
|
+
const path = __importStar(require("path"));
|
|
37
|
+
const utils = __importStar(require("./utils"));
|
|
38
|
+
const admin = __importStar(require("firebase-admin"));
|
|
39
|
+
/**
|
|
40
|
+
* Processes subscription updates.
|
|
41
|
+
*
|
|
42
|
+
* サブスクリプションのアップデート処理を行います。
|
|
43
|
+
*
|
|
44
|
+
* @param {String} targetCollectionPath
|
|
45
|
+
* Specify the path of the collection to be updated.
|
|
46
|
+
*
|
|
47
|
+
* アップデートを行うコレクションのパスを指定します。
|
|
48
|
+
*
|
|
49
|
+
* @param {String} targetDocumentId
|
|
50
|
+
* Specifies the ID of the document to be updated.
|
|
51
|
+
*
|
|
52
|
+
* アップデートを行うドキュメントのIDを指定します。
|
|
53
|
+
*
|
|
54
|
+
* @param {[key: string]: any} data
|
|
55
|
+
* Document data to be updated.
|
|
56
|
+
*
|
|
57
|
+
* 更新するドキュメントデータ。
|
|
58
|
+
*
|
|
59
|
+
* @param {[key: string]: any} additionalData
|
|
60
|
+
* Additional documentation data.
|
|
61
|
+
*
|
|
62
|
+
* 追加のドキュメントデータ。
|
|
63
|
+
*
|
|
64
|
+
* @param {String} userId
|
|
65
|
+
* ID of the user who purchased the subscription.
|
|
66
|
+
*
|
|
67
|
+
* サブスクリプションを購入したユーザーのID。
|
|
68
|
+
*
|
|
69
|
+
* @param {String} platform
|
|
70
|
+
* Subscription-based platform.
|
|
71
|
+
*
|
|
72
|
+
* サブスクリプションを利用するプラットフォーム。
|
|
73
|
+
*
|
|
74
|
+
* @param {String} orderId
|
|
75
|
+
* Subscription Order ID.
|
|
76
|
+
*
|
|
77
|
+
* サブスクリプションの注文ID。
|
|
78
|
+
*
|
|
79
|
+
* @param {String} productId Product ID.
|
|
80
|
+
* Subscription product ID.
|
|
81
|
+
*
|
|
82
|
+
* サブスクリプションのプロダクトID。
|
|
83
|
+
*
|
|
84
|
+
* @param {String} purchaseId
|
|
85
|
+
* Subscription purchase ID.
|
|
86
|
+
*
|
|
87
|
+
* サブスクリプションの購入ID。
|
|
88
|
+
*
|
|
89
|
+
* @param {String} packageName
|
|
90
|
+
* The package name of the application.
|
|
91
|
+
*
|
|
92
|
+
* アプリケーションのパッケージ名。
|
|
93
|
+
*
|
|
94
|
+
* @param {String} token
|
|
95
|
+
* Token issued at the time of purchase.
|
|
96
|
+
*
|
|
97
|
+
* 購入時に発行されたトークン。
|
|
98
|
+
*
|
|
99
|
+
* @param {number} expiryDate
|
|
100
|
+
* Subscription expiration date.
|
|
101
|
+
*
|
|
102
|
+
* サブスクリプションの有効期限。
|
|
103
|
+
*/
|
|
104
|
+
function updateSubscription({ targetCollectionPath, targetDocumentId, data, additionalData, userId, platform, orderId, productId, purchaseId, packageName, token, expiryDate, }) {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
const update = {};
|
|
107
|
+
const firestoreInstance = admin.firestore();
|
|
108
|
+
for (const key in data) {
|
|
109
|
+
if (!data[key]) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
update[key] = utils.parse(data[key]);
|
|
113
|
+
}
|
|
114
|
+
if (additionalData) {
|
|
115
|
+
for (const key in additionalData) {
|
|
116
|
+
if (!additionalData[key]) {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
update[key] = utils.parse(additionalData[key]);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
targetCollectionPath = `${targetCollectionPath}/${targetDocumentId}`;
|
|
123
|
+
update["expired"] = false;
|
|
124
|
+
update["token"] = token;
|
|
125
|
+
update["platform"] = platform;
|
|
126
|
+
update["productId"] = productId;
|
|
127
|
+
update["purchaseId"] = purchaseId;
|
|
128
|
+
update["packageName"] = packageName;
|
|
129
|
+
update["expiredTime"] = expiryDate;
|
|
130
|
+
update["orderId"] = orderId;
|
|
131
|
+
if (userId) {
|
|
132
|
+
update["userId"] = userId;
|
|
133
|
+
}
|
|
134
|
+
update["@time"] = new Date();
|
|
135
|
+
update["@uid"] = path.basename(targetCollectionPath);
|
|
136
|
+
yield firestoreInstance.doc(targetCollectionPath).set(update, {
|
|
137
|
+
merge: true,
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
exports.updateSubscription = updateSubscription;
|
|
142
|
+
//# sourceMappingURL=update_subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update_subscription.js","sourceRoot":"","sources":["../../src/lib/update_subscription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,+CAAiC;AACjC,sDAAwC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,SAAsB,kBAAkB,CAAC,EACrC,oBAAoB,EACpB,gBAAgB,EAChB,IAAI,EACJ,cAAc,EACd,MAAM,EACN,QAAQ,EACR,OAAO,EACP,SAAS,EACT,UAAU,EACV,WAAW,EACX,KAAK,EACL,UAAU,GAcb;;QACG,MAAM,MAAM,GAA0B,EAAE,CAAC;QACzC,MAAM,iBAAiB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC5C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACpB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACZ,SAAS;aACZ;YACD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAE,IAAI,CAAC,GAAG,CAAC,CAAE,CAAC;SAC1C;QACD,IAAI,cAAc,EAAE;YAChB,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE;gBAC9B,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACtB,SAAS;iBACZ;gBACD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;aAClD;SACJ;QACD,oBAAoB,GAAG,GAAG,oBAAoB,IAAI,gBAAgB,EAAE,CAAC;QACrE,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;QAC1B,MAAM,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;QACxB,MAAM,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;QAC9B,MAAM,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;QAChC,MAAM,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;QAClC,MAAM,CAAC,aAAa,CAAC,GAAG,WAAW,CAAC;QACpC,MAAM,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC;QACnC,MAAM,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;QAC5B,IAAI,MAAM,EAAE;YACR,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;SAC7B;QACD,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;QAC7B,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAE,oBAAoB,CAAE,CAAC;QACvD,MAAM,iBAAiB,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE;YAC1D,KAAK,EAAE,IAAI;SACd,CAAC,CAAC;IACP,CAAC;CAAA;AA5DD,gDA4DC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unlock function. Unlock information is stored in the form of an overwrite of the user data.
|
|
3
|
+
*
|
|
4
|
+
* 機能をアンロックします。アンロックの情報はユーザーデータに上書きされる形で保存されます。
|
|
5
|
+
*
|
|
6
|
+
* @param {String} targetDocumentFieldPath
|
|
7
|
+
* The path, including the key, of the field in the document where the unlock information is to be stored.
|
|
8
|
+
*
|
|
9
|
+
* アンロック情報を保存するドキュメント内のフィールドのキーを含めたパス。
|
|
10
|
+
*/
|
|
11
|
+
export declare function updateUnlock({ targetDocumentFieldPath, }: {
|
|
12
|
+
targetDocumentFieldPath: string;
|
|
13
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,64 @@
|
|
|
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.updateUnlock = void 0;
|
|
36
|
+
const path = __importStar(require("path"));
|
|
37
|
+
const admin = __importStar(require("firebase-admin"));
|
|
38
|
+
/**
|
|
39
|
+
* Unlock function. Unlock information is stored in the form of an overwrite of the user data.
|
|
40
|
+
*
|
|
41
|
+
* 機能をアンロックします。アンロックの情報はユーザーデータに上書きされる形で保存されます。
|
|
42
|
+
*
|
|
43
|
+
* @param {String} targetDocumentFieldPath
|
|
44
|
+
* The path, including the key, of the field in the document where the unlock information is to be stored.
|
|
45
|
+
*
|
|
46
|
+
* アンロック情報を保存するドキュメント内のフィールドのキーを含めたパス。
|
|
47
|
+
*/
|
|
48
|
+
function updateUnlock({ targetDocumentFieldPath, }) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const update = {};
|
|
51
|
+
const key = path.basename(targetDocumentFieldPath);
|
|
52
|
+
const parent = targetDocumentFieldPath.replace(`/${key}`, "");
|
|
53
|
+
const uid = path.basename(parent);
|
|
54
|
+
const firestoreInstance = admin.firestore();
|
|
55
|
+
update[key] = true;
|
|
56
|
+
update["@uid"] = uid;
|
|
57
|
+
update["@time"] = new Date();
|
|
58
|
+
yield firestoreInstance.doc(parent).set(update, {
|
|
59
|
+
merge: true,
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
exports.updateUnlock = updateUnlock;
|
|
64
|
+
//# sourceMappingURL=update_unlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update_unlock.js","sourceRoot":"","sources":["../../src/lib/update_unlock.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,sDAAwC;AAExC;;;;;;;;;GASG;AACH,SAAsB,YAAY,CAAC,EAC/B,uBAAuB,GAG1B;;QACG,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,uBAAuB,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,iBAAiB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC5C,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;QACnB,MAAM,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;QACrB,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;QAC7B,MAAM,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE;YAC5C,KAAK,EAAE,IAAI;SACd,CAAC,CAAC;IACP,CAAC;CAAA;AAhBD,oCAgBC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The amount of money in the in-app wallet is added to the in-app wallet due to in-app purchases. In-app wallet information is stored in a form that overwrites user data.
|
|
3
|
+
*
|
|
4
|
+
* アプリ内課金によるアプリ内ウォレットの金額の加算を行います。アプリ内ウォレットの情報はユーザーデータに上書きされる形で保存されます。
|
|
5
|
+
*
|
|
6
|
+
* @param {String} targetDocumentFieldPath
|
|
7
|
+
* The path, including the key, of the field in the document that stores the in-app wallet information.
|
|
8
|
+
*
|
|
9
|
+
* アプリ内ウォレット情報を保存するドキュメント内のフィールドのキーを含めたパス。
|
|
10
|
+
*
|
|
11
|
+
* @param {number} value
|
|
12
|
+
* Value of the amount to be added.
|
|
13
|
+
*
|
|
14
|
+
* 加算する金額の値。
|
|
15
|
+
*/
|
|
16
|
+
export declare function updateWallet({ targetDocumentFieldPath, value, }: {
|
|
17
|
+
targetDocumentFieldPath: string;
|
|
18
|
+
value: number;
|
|
19
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,70 @@
|
|
|
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.updateWallet = void 0;
|
|
36
|
+
const path = __importStar(require("path"));
|
|
37
|
+
const admin = __importStar(require("firebase-admin"));
|
|
38
|
+
/**
|
|
39
|
+
* The amount of money in the in-app wallet is added to the in-app wallet due to in-app purchases. In-app wallet information is stored in a form that overwrites user data.
|
|
40
|
+
*
|
|
41
|
+
* アプリ内課金によるアプリ内ウォレットの金額の加算を行います。アプリ内ウォレットの情報はユーザーデータに上書きされる形で保存されます。
|
|
42
|
+
*
|
|
43
|
+
* @param {String} targetDocumentFieldPath
|
|
44
|
+
* The path, including the key, of the field in the document that stores the in-app wallet information.
|
|
45
|
+
*
|
|
46
|
+
* アプリ内ウォレット情報を保存するドキュメント内のフィールドのキーを含めたパス。
|
|
47
|
+
*
|
|
48
|
+
* @param {number} value
|
|
49
|
+
* Value of the amount to be added.
|
|
50
|
+
*
|
|
51
|
+
* 加算する金額の値。
|
|
52
|
+
*/
|
|
53
|
+
function updateWallet({ targetDocumentFieldPath, value, }) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const update = {};
|
|
56
|
+
const key = path.basename(targetDocumentFieldPath);
|
|
57
|
+
const parent = targetDocumentFieldPath.replace(`/${key}`, "");
|
|
58
|
+
const uid = path.basename(parent);
|
|
59
|
+
const firestoreInstance = admin.firestore();
|
|
60
|
+
const FieldValue = admin.firestore.FieldValue;
|
|
61
|
+
update[key] = FieldValue.increment(value);
|
|
62
|
+
update["@uid"] = uid;
|
|
63
|
+
update["@time"] = new Date();
|
|
64
|
+
yield firestoreInstance.doc(parent).set(update, {
|
|
65
|
+
merge: true,
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
exports.updateWallet = updateWallet;
|
|
70
|
+
//# sourceMappingURL=update_wallet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update_wallet.js","sourceRoot":"","sources":["../../src/lib/update_wallet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,sDAAwC;AAExC;;;;;;;;;;;;;;GAcG;AACH,SAAsB,YAAY,CAAC,EAC/B,uBAAuB,EACvB,KAAK,GAIR;;QACG,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAE,uBAAuB,CAAE,CAAC;QACrD,MAAM,MAAM,GAAG,uBAAuB,CAAC,OAAO,CAAE,IAAI,GAAG,EAAE,EAAE,EAAE,CAAE,CAAC;QAChE,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,iBAAiB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC5C,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC;QAC9C,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC1C,MAAM,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;QACrB,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;QAC7B,MAAM,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE;YAC5C,KAAK,EAAE,IAAI;SACd,CAAC,CAAC;IACP,CAAC;CAAA;AAnBD,oCAmBC"}
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -33,7 +33,11 @@ export declare function parse(value: string | number): string | number | boolean
|
|
|
33
33
|
* Encrypted string.
|
|
34
34
|
* 暗号化された文字列。
|
|
35
35
|
*/
|
|
36
|
-
export declare function encrypt(raw
|
|
36
|
+
export declare function encrypt({ raw, key, ivKey }: {
|
|
37
|
+
raw: string;
|
|
38
|
+
key: string;
|
|
39
|
+
ivKey: string;
|
|
40
|
+
}): string;
|
|
37
41
|
/**
|
|
38
42
|
* Decrypts a string.
|
|
39
43
|
* 文字列を復号化します。
|
|
@@ -53,4 +57,8 @@ export declare function encrypt(raw: string, key: string, ivKey: string): string
|
|
|
53
57
|
* Decrypted string.
|
|
54
58
|
* 復号化された文字列。
|
|
55
59
|
*/
|
|
56
|
-
export declare function decrypt(encrypted
|
|
60
|
+
export declare function decrypt({ encrypted, key, ivKey, }: {
|
|
61
|
+
encrypted: string;
|
|
62
|
+
key: string;
|
|
63
|
+
ivKey: string;
|
|
64
|
+
}): string;
|
package/dist/lib/utils.js
CHANGED
|
@@ -85,7 +85,7 @@ exports.parse = parse;
|
|
|
85
85
|
* Encrypted string.
|
|
86
86
|
* 暗号化された文字列。
|
|
87
87
|
*/
|
|
88
|
-
function encrypt(raw, key, ivKey) {
|
|
88
|
+
function encrypt({ raw, key, ivKey }) {
|
|
89
89
|
const iv = Buffer.from(ivKey);
|
|
90
90
|
const cipher = crypto.createCipheriv("aes-256-cbc", Buffer.from(key), iv);
|
|
91
91
|
let encrypted = cipher.update(raw);
|
|
@@ -112,7 +112,7 @@ exports.encrypt = encrypt;
|
|
|
112
112
|
* Decrypted string.
|
|
113
113
|
* 復号化された文字列。
|
|
114
114
|
*/
|
|
115
|
-
function decrypt(encrypted, key, ivKey) {
|
|
115
|
+
function decrypt({ encrypted, key, ivKey, }) {
|
|
116
116
|
const iv = Buffer.from(ivKey);
|
|
117
117
|
const encryptedText = Buffer.from(encrypted, "hex");
|
|
118
118
|
const decipher = crypto.createDecipheriv("aes-256-cbc", Buffer.from(key), iv);
|
package/dist/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAEjC;;;;;;;;;;;;;GAaG;AACH,SAAgB,KAAK,CAAC,KAAsB;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,IAAI,KAAK,KAAK,OAAO,EAAE;YACrB,OAAO,KAAK,CAAC;SACd;aAAM,IAAI,KAAK,KAAK,MAAM,EAAE;YAC3B,OAAO,IAAI,CAAC;SACb;aAAM,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE;YAC9C,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;YAC1B,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;gBACZ,OAAO,KAAK,CAAC;aACd;iBAAM;gBACL,OAAO,CAAC,CAAC;aACV;SACF;aAAM;YACL,OAAO,KAAK,CAAC;SACd;KACF;SAAM;QACL,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAnBD,sBAmBC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAEjC;;;;;;;;;;;;;GAaG;AACH,SAAgB,KAAK,CAAC,KAAsB;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,IAAI,KAAK,KAAK,OAAO,EAAE;YACrB,OAAO,KAAK,CAAC;SACd;aAAM,IAAI,KAAK,KAAK,MAAM,EAAE;YAC3B,OAAO,IAAI,CAAC;SACb;aAAM,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE;YAC9C,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,C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C,SAAS,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;AAC9B,CAAC;AAfD,0BAeC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Perform Android receipt verification.
|
|
3
|
+
*
|
|
4
|
+
* Android の受信確認を実行します。
|
|
5
|
+
*
|
|
6
|
+
* @param {String} type
|
|
7
|
+
* Item type(products or subscriptions)
|
|
8
|
+
*
|
|
9
|
+
* アイテムの種類(製品またはサブスクリプション)
|
|
10
|
+
*
|
|
11
|
+
* @param {String} clientId
|
|
12
|
+
* Google OAuth client ID.
|
|
13
|
+
*
|
|
14
|
+
* Google OAuth クライアントID。
|
|
15
|
+
*
|
|
16
|
+
* @param {String} clientSecret
|
|
17
|
+
* Google OAuth client secret.
|
|
18
|
+
*
|
|
19
|
+
* Google OAuth クライアントシークレット。
|
|
20
|
+
*
|
|
21
|
+
* @param {String} refreshToken
|
|
22
|
+
* Refresh token obtained by accessing [android_auth_code].
|
|
23
|
+
*
|
|
24
|
+
* [android_auth_code]にアクセスして取得したリフレッシュトークン。
|
|
25
|
+
*
|
|
26
|
+
* @param {String} packageName
|
|
27
|
+
* Application package name.
|
|
28
|
+
*
|
|
29
|
+
* アプリケーションのパッケージ名。
|
|
30
|
+
*
|
|
31
|
+
* @param {String} productId
|
|
32
|
+
* Item ID issued by Google Play.
|
|
33
|
+
*
|
|
34
|
+
* GooglePlayで発行されたアイテムID。
|
|
35
|
+
*
|
|
36
|
+
* @param {String} purchaseToken
|
|
37
|
+
* The purchase token issued at the time of purchase.
|
|
38
|
+
*
|
|
39
|
+
* 購入したときに発行された購入トークン。
|
|
40
|
+
*
|
|
41
|
+
* @return {Promise<{ [key: string]: any; }}
|
|
42
|
+
* Receipt information for the item.
|
|
43
|
+
*
|
|
44
|
+
* アイテムの受領情報。
|
|
45
|
+
*/
|
|
46
|
+
export declare function verifyAndroid({ type, clientId, clientSecret, refreshToken, packageName, productId, purchaseToken, }: {
|
|
47
|
+
type: string;
|
|
48
|
+
clientId: string;
|
|
49
|
+
clientSecret: string;
|
|
50
|
+
refreshToken: string;
|
|
51
|
+
packageName: string;
|
|
52
|
+
productId: string;
|
|
53
|
+
purchaseToken: string;
|
|
54
|
+
}): Promise<{
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
}>;
|