@mpgd/game-services 0.33.1 → 0.34.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/dist/admob-ssv.js +6 -26
- package/dist/app-store-verifier-conformance.d.ts +37 -1
- package/dist/app-store-verifier-conformance.js +199 -1
- package/dist/app-store-verifier.d.ts +57 -4
- package/dist/app-store-verifier.js +106 -4
- package/dist/base64.d.ts +10 -0
- package/dist/base64.js +35 -0
- package/dist/google-play-publisher-client.js +24 -1
- package/dist/google-play-rtdn.d.ts +248 -0
- package/dist/google-play-rtdn.js +594 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/notifications/client.d.ts +19 -1
- package/dist/notifications/client.js +24 -2
- package/dist/notifications/text.d.ts +5 -1
- package/dist/notifications/text.js +11 -2
- package/package.json +9 -5
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { assertNotificationConsentRecord, assertNotificationDeliveryProviderEntry, assertNotificationNotice, isNotificationErrorCode, NotificationError, } from '@mpgd/platform/notifications';
|
|
2
2
|
import { GameServicesHeaderResolutionError, resolveGameServicesRequestHeaders, } from '../request-headers.js';
|
|
3
|
+
import { describeError } from './text.js';
|
|
3
4
|
/**
|
|
4
5
|
* The game-services notifications client: the notifications runtime's
|
|
5
6
|
* backend (`NotificationRuntimeBackend` from
|
|
@@ -342,14 +343,35 @@ export function createGameServicesNotificationsClient(input) {
|
|
|
342
343
|
|| !Object.values(targets).every((provider) => typeof provider === 'string')) {
|
|
343
344
|
throw contractBroken('/providers', 200, 'the registry is not { protocolVersion, providers, targets }');
|
|
344
345
|
}
|
|
346
|
+
// One entry the client cannot read does not break the others: it is
|
|
347
|
+
// left out of `providers` and listed in `unreadable`.
|
|
348
|
+
const readable = [];
|
|
349
|
+
const unreadable = [];
|
|
350
|
+
for (const entry of providers) {
|
|
351
|
+
try {
|
|
352
|
+
readable.push(assertNotificationDeliveryProviderEntry(entry));
|
|
353
|
+
}
|
|
354
|
+
catch (error) {
|
|
355
|
+
const id = typeof entry === 'object' && entry !== null && !Array.isArray(entry)
|
|
356
|
+
? entry['provider']
|
|
357
|
+
: undefined;
|
|
358
|
+
unreadable.push({
|
|
359
|
+
...(typeof id === 'string' && id.length > 0 ? { provider: id } : {}),
|
|
360
|
+
issue: describeError(error).slice(0, unreadableIssueLength),
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
}
|
|
345
364
|
return {
|
|
346
365
|
protocolVersion,
|
|
347
|
-
providers:
|
|
366
|
+
providers: readable,
|
|
348
367
|
targets: { ...targets },
|
|
368
|
+
...(unreadable.length === 0 ? {} : { unreadable }),
|
|
349
369
|
};
|
|
350
370
|
},
|
|
351
371
|
};
|
|
352
372
|
}
|
|
373
|
+
/** The longest `issue` an unreadable registry entry carries. */
|
|
374
|
+
const unreadableIssueLength = 512;
|
|
353
375
|
function globalFetch() {
|
|
354
376
|
const fetcher = globalThis.fetch;
|
|
355
377
|
if (fetcher === undefined) {
|
|
@@ -386,7 +408,7 @@ function checked(route, read) {
|
|
|
386
408
|
return read();
|
|
387
409
|
}
|
|
388
410
|
catch (error) {
|
|
389
|
-
throw contractBroken(route, 200,
|
|
411
|
+
throw contractBroken(route, 200, describeError(error));
|
|
390
412
|
}
|
|
391
413
|
}
|
|
392
414
|
function errorOf(route, response, body) {
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* An error's message for another error's text; never the error's other
|
|
3
|
+
* fields. Never throws: a getter or `toString` that throws, or a `Proxy`
|
|
4
|
+
* whose traps throw, reads as a failure that cannot be read.
|
|
5
|
+
*/
|
|
2
6
|
export declare function describeError(error: unknown): string;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* An error's message for another error's text; never the error's other
|
|
3
|
+
* fields. Never throws: a getter or `toString` that throws, or a `Proxy`
|
|
4
|
+
* whose traps throw, reads as a failure that cannot be read.
|
|
5
|
+
*/
|
|
2
6
|
export function describeError(error) {
|
|
3
|
-
|
|
7
|
+
try {
|
|
8
|
+
return error instanceof Error ? error.message : String(error);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return 'a failure that cannot be read';
|
|
12
|
+
}
|
|
4
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpgd/game-services",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "Client, contract, server, store, and test helpers for authoritative mpgd game services.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -121,6 +121,10 @@
|
|
|
121
121
|
"types": "./dist/google-play-publisher-client.d.ts",
|
|
122
122
|
"default": "./dist/google-play-publisher-client.js"
|
|
123
123
|
},
|
|
124
|
+
"./google-play-rtdn": {
|
|
125
|
+
"types": "./dist/google-play-rtdn.d.ts",
|
|
126
|
+
"default": "./dist/google-play-rtdn.js"
|
|
127
|
+
},
|
|
124
128
|
"./guest-session": {
|
|
125
129
|
"types": "./dist/guest-session.d.ts",
|
|
126
130
|
"default": "./dist/guest-session.js"
|
|
@@ -231,9 +235,9 @@
|
|
|
231
235
|
"@orpc/client": "2.0.0-beta.46",
|
|
232
236
|
"@orpc/contract": "2.0.0-beta.46",
|
|
233
237
|
"@orpc/server": "2.0.0-beta.46",
|
|
234
|
-
"@mpgd/analytics": "0.5.
|
|
235
|
-
"@mpgd/
|
|
236
|
-
"@mpgd/
|
|
238
|
+
"@mpgd/analytics": "0.5.9",
|
|
239
|
+
"@mpgd/catalog": "0.15.1",
|
|
240
|
+
"@mpgd/platform": "0.35.1"
|
|
237
241
|
},
|
|
238
242
|
"peerDependencies": {
|
|
239
243
|
"@apple/app-store-server-library": "^3.1.0"
|
|
@@ -262,7 +266,7 @@
|
|
|
262
266
|
"fix": "ttsc fix",
|
|
263
267
|
"build": "cd ../.. && node tools/run-ttsx.mjs tools/package/build-packages.ts @mpgd/game-services",
|
|
264
268
|
"test:packed-transport": "pnpm build && node test/runtime-transport-package-import.mjs && node test/reward-evidence-import.mjs",
|
|
265
|
-
"test:unit": "cd ../.. && node tools/run-ttsx.mjs packages/game-services/src/client.test.ts && node tools/run-ttsx.mjs packages/game-services/src/client-progress.test.ts && node tools/run-ttsx.mjs packages/game-services/src/runtime.test.ts && node tools/run-ttsx.mjs packages/game-services/src/runtime-session.test.ts && node tools/run-ttsx.mjs packages/game-services/src/types.test.ts && node tools/run-ttsx.mjs packages/game-services/src/server.test.ts && node tools/run-ttsx.mjs packages/game-services/src/orpc-error-compat.test.ts && node tools/run-ttsx.mjs packages/game-services/src/google-play-purchase.test.ts && node tools/run-ttsx.mjs packages/game-services/src/google-play-publisher-client.test.ts && node tools/run-ttsx.mjs packages/game-services/src/google-play-store-server.test.ts && node tools/run-ttsx.mjs packages/game-services/src/microsoft-store-purchase.test.ts && node tools/run-ttsx.mjs packages/game-services/src/microsoft-store-identity.test.ts && node tools/run-ttsx.mjs packages/game-services/src/platform-order.test.ts && node tools/run-ttsx.mjs packages/game-services/src/progress-link.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notification-delivery.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/service.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/service-conformance.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/client.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/client-conformance.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/scheduler.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/fcm.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/store-conformance.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/ait-functional-delivery.test.ts && node tools/run-ttsx.mjs packages/game-services/src/admob-ssv.test.ts && node tools/run-ttsx.mjs packages/game-services/src/app-store-verifier.test.ts && node tools/run-ttsx.mjs packages/game-services/src/app-store-server-notifications.test.ts && node tools/run-ttsx.mjs packages/game-services/src/apps-in-toss-evidence-verification-conformance.test.ts && node tools/run-ttsx.mjs packages/game-services/src/apps-in-toss-partner-api.test.ts && node tools/run-ttsx.mjs packages/game-services/src/verified-leaderboard.test.ts && node tools/run-ttsx.mjs packages/game-services/src/verified-leaderboard-conformance.test.ts && node tools/run-ttsx.mjs packages/game-services/src/verified-leaderboard-durability-conformance.test.ts && node tools/run-ttsx.mjs packages/game-services/src/verified-leaderboard-transport.test.ts && node tools/run-ttsx.mjs packages/game-services/src/guest-session.test.ts && node tools/run-ttsx.mjs packages/game-services/src/development-session.test.ts && node tools/run-ttsx.mjs packages/game-services/src/client-reward-evidence.test.ts && node tools/run-ttsx.mjs packages/game-services/src/ad-reward-verifier-registry.test.ts && node tools/run-ttsx.mjs packages/game-services/src/oneplay-reward.test.ts && node tools/run-ttsx.mjs packages/game-services/src/oneplay-purchase.test.ts && node tools/run-ttsx.mjs packages/game-services/src/commerce-registry-routing.test.ts && node tools/run-ttsx.mjs packages/game-services/src/commerce-registry-server.test.ts && node tools/run-ttsx.mjs packages/game-services/src/commerce-ledger-revocation.test.ts && node tools/run-ttsx.mjs packages/game-services/src/purchase-sharing.test.ts && node tools/run-ttsx.mjs packages/game-services/src/apps-in-toss-anonymous-auth.test.ts && node tools/run-ttsx.mjs packages/game-services/src/account-deletion.test.ts",
|
|
269
|
+
"test:unit": "cd ../.. && node tools/run-ttsx.mjs packages/game-services/src/client.test.ts && node tools/run-ttsx.mjs packages/game-services/src/client-progress.test.ts && node tools/run-ttsx.mjs packages/game-services/src/runtime.test.ts && node tools/run-ttsx.mjs packages/game-services/src/runtime-session.test.ts && node tools/run-ttsx.mjs packages/game-services/src/types.test.ts && node tools/run-ttsx.mjs packages/game-services/src/server.test.ts && node tools/run-ttsx.mjs packages/game-services/src/orpc-error-compat.test.ts && node tools/run-ttsx.mjs packages/game-services/src/google-play-purchase.test.ts && node tools/run-ttsx.mjs packages/game-services/src/google-play-publisher-client.test.ts && node tools/run-ttsx.mjs packages/game-services/src/google-play-store-server.test.ts && node tools/run-ttsx.mjs packages/game-services/src/google-play-rtdn.test.ts && node tools/run-ttsx.mjs packages/game-services/src/base64.test.ts && node tools/run-ttsx.mjs packages/game-services/src/microsoft-store-purchase.test.ts && node tools/run-ttsx.mjs packages/game-services/src/microsoft-store-identity.test.ts && node tools/run-ttsx.mjs packages/game-services/src/platform-order.test.ts && node tools/run-ttsx.mjs packages/game-services/src/progress-link.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notification-delivery.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/service.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/service-conformance.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/client.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/client-conformance.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/scheduler.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/fcm.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/store-conformance.test.ts && node tools/run-ttsx.mjs packages/game-services/src/notifications/ait-functional-delivery.test.ts && node tools/run-ttsx.mjs packages/game-services/src/admob-ssv.test.ts && node tools/run-ttsx.mjs packages/game-services/src/app-store-verifier.test.ts && node tools/run-ttsx.mjs packages/game-services/src/app-store-revocation-registry.test.ts && node tools/run-ttsx.mjs packages/game-services/src/app-store-server-notifications.test.ts && node tools/run-ttsx.mjs packages/game-services/src/apps-in-toss-evidence-verification-conformance.test.ts && node tools/run-ttsx.mjs packages/game-services/src/apps-in-toss-partner-api.test.ts && node tools/run-ttsx.mjs packages/game-services/src/verified-leaderboard.test.ts && node tools/run-ttsx.mjs packages/game-services/src/verified-leaderboard-conformance.test.ts && node tools/run-ttsx.mjs packages/game-services/src/verified-leaderboard-durability-conformance.test.ts && node tools/run-ttsx.mjs packages/game-services/src/verified-leaderboard-transport.test.ts && node tools/run-ttsx.mjs packages/game-services/src/guest-session.test.ts && node tools/run-ttsx.mjs packages/game-services/src/development-session.test.ts && node tools/run-ttsx.mjs packages/game-services/src/client-reward-evidence.test.ts && node tools/run-ttsx.mjs packages/game-services/src/ad-reward-verifier-registry.test.ts && node tools/run-ttsx.mjs packages/game-services/src/oneplay-reward.test.ts && node tools/run-ttsx.mjs packages/game-services/src/oneplay-purchase.test.ts && node tools/run-ttsx.mjs packages/game-services/src/commerce-registry-routing.test.ts && node tools/run-ttsx.mjs packages/game-services/src/commerce-registry-server.test.ts && node tools/run-ttsx.mjs packages/game-services/src/commerce-ledger-revocation.test.ts && node tools/run-ttsx.mjs packages/game-services/src/purchase-sharing.test.ts && node tools/run-ttsx.mjs packages/game-services/src/apps-in-toss-anonymous-auth.test.ts && node tools/run-ttsx.mjs packages/game-services/src/account-deletion.test.ts",
|
|
266
270
|
"test:recovery": "cd ../.. && node tools/run-ttsx.mjs packages/game-services/src/monetization-recovery.test.ts && node tools/run-ttsx.mjs packages/game-services/src/app-store-recovery.test.ts && node tools/run-ttsx.mjs packages/game-services/src/commerce-reconciler.test.ts && node tools/run-ttsx.mjs packages/game-services/src/commerce-reconciler-conformance.test.ts",
|
|
267
271
|
"test": "pnpm test:unit && pnpm test:app-store-server && pnpm test:recovery && pnpm test:packed-transport",
|
|
268
272
|
"test:app-store-server": "vitest run"
|