@mpgd/adapter-capacitor 0.7.4 → 0.7.5
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/dist/providers.js +22 -2
- package/package.json +6 -6
package/dist/providers.js
CHANGED
|
@@ -233,7 +233,8 @@ function isValidProviderData(method, value) {
|
|
|
233
233
|
&& value.authoritativeGrant.ledgerEntryId.length > 0
|
|
234
234
|
&& (value.authoritativeGrant.alreadyProcessed === undefined
|
|
235
235
|
|| typeof value.authoritativeGrant.alreadyProcessed === 'boolean')))
|
|
236
|
-
&& (value.evidence === undefined || isEvidence(value.evidence))
|
|
236
|
+
&& (value.evidence === undefined || isEvidence(value.evidence))
|
|
237
|
+
&& (value.diagnostic === undefined || isCommerceDiagnostic(value.diagnostic));
|
|
237
238
|
case 'commerce.restore':
|
|
238
239
|
return isRecord(value)
|
|
239
240
|
&& Array.isArray(value.restoredEntitlements)
|
|
@@ -245,7 +246,10 @@ function isValidProviderData(method, value) {
|
|
|
245
246
|
&& ['granted', 'refunded'].includes(settlement.status)
|
|
246
247
|
&& (settlement.ledgerEntryId === undefined || isString(settlement.ledgerEntryId))
|
|
247
248
|
&& (settlement.alreadyProcessed === undefined
|
|
248
|
-
|| typeof settlement.alreadyProcessed === 'boolean')
|
|
249
|
+
|| typeof settlement.alreadyProcessed === 'boolean')
|
|
250
|
+
&& (settlement.idempotencyKey === undefined
|
|
251
|
+
|| isIdempotencyKey(settlement.idempotencyKey)))))
|
|
252
|
+
&& (value.diagnostic === undefined || isCommerceDiagnostic(value.diagnostic));
|
|
249
253
|
case 'commerce.getEntitlements':
|
|
250
254
|
return Array.isArray(value) && value.every(isEntitlement);
|
|
251
255
|
case 'ads.preload':
|
|
@@ -304,6 +308,22 @@ function isEntitlement(value) {
|
|
|
304
308
|
&& isString(value.grantedAt)
|
|
305
309
|
&& (value.expiresAt === undefined || isString(value.expiresAt));
|
|
306
310
|
}
|
|
311
|
+
/** Mirrors the stable, non-sensitive code format of `PlatformOperationError`. */
|
|
312
|
+
function isDiagnosticCode(value) {
|
|
313
|
+
return isString(value) && value.length <= 128 && /^[A-Z][A-Z0-9_:-]*$/u.test(value);
|
|
314
|
+
}
|
|
315
|
+
function isCommerceDiagnostic(value) {
|
|
316
|
+
return isRecord(value)
|
|
317
|
+
&& isDiagnosticCode(value.code)
|
|
318
|
+
&& typeof value.retryable === 'boolean'
|
|
319
|
+
&& (value.providerCode === undefined || isDiagnosticCode(value.providerCode));
|
|
320
|
+
}
|
|
321
|
+
function isIdempotencyKey(value) {
|
|
322
|
+
return isString(value)
|
|
323
|
+
&& value.length > 0
|
|
324
|
+
&& value.length <= 256
|
|
325
|
+
&& !/[\p{Cc}\p{Cf}]/u.test(value);
|
|
326
|
+
}
|
|
307
327
|
function isEvidence(value) {
|
|
308
328
|
return isRecord(value)
|
|
309
329
|
&& isString(value.schema)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpgd/adapter-capacitor",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "Capacitor platform adapter for mpgd Android and iOS shells.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@capacitor/app": "8.1.1",
|
|
46
|
-
"@mpgd/bridge": "0.11.0",
|
|
47
46
|
"@mpgd/capacitor-game-services": "0.6.1",
|
|
48
|
-
"@mpgd/
|
|
49
|
-
"@mpgd/
|
|
50
|
-
"@mpgd/
|
|
47
|
+
"@mpgd/bridge": "0.11.0",
|
|
48
|
+
"@mpgd/platform": "0.18.0",
|
|
49
|
+
"@mpgd/game-services": "0.19.1",
|
|
50
|
+
"@mpgd/target-config": "0.21.1"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@apple/app-store-server-library": "^3.1.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"ttsc": "0.30.4",
|
|
70
70
|
"typescript": "7.0.2",
|
|
71
71
|
"vitest": "^4.0.0",
|
|
72
|
-
"@mpgd/game-runtime": "0.6.
|
|
72
|
+
"@mpgd/game-runtime": "0.6.1"
|
|
73
73
|
},
|
|
74
74
|
"main": "./dist/index.js",
|
|
75
75
|
"types": "./dist/index.d.ts",
|