@mpgd/platform 0.18.0 → 0.19.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/index.d.ts CHANGED
@@ -208,6 +208,45 @@ export interface LeaderboardAdapter {
208
208
  export type PlatformProviderAvailability = 'unsupported' | 'configuration-required' | 'action-required' | 'temporarily-unavailable' | 'available';
209
209
  /** Existing capabilities and integrations annotated by optional providers. */
210
210
  export type PlatformProviderFeature = 'nativeIap' | 'subscriptionIap' | 'rewardedAds' | 'interstitialAds' | 'bannerAds' | 'nativeLeaderboard' | 'identityUpgrade' | 'pushNotifications';
211
+ export type CommerceFinishOwner = 'client' | 'server' | 'host' | 'none';
212
+ export type CommerceEvidenceAuthority = 'client-token' | 'host-callback' | 'adapter-settled' | 'server-push';
213
+ export type CommerceAccountBindingPolicy = 'required' | 'optional' | 'host';
214
+ export interface CommercePurchaseCapabilities {
215
+ readonly consumable: boolean;
216
+ readonly durable: boolean;
217
+ readonly subscription: boolean;
218
+ readonly quantity: boolean;
219
+ }
220
+ export interface CommerceCatalogCapabilities {
221
+ readonly products: boolean;
222
+ readonly offers: boolean;
223
+ readonly localizedPrice: boolean;
224
+ }
225
+ export interface CommerceLifecycleCapabilities {
226
+ readonly availablePurchases: boolean;
227
+ readonly pending: boolean;
228
+ readonly restore: boolean;
229
+ readonly events: boolean;
230
+ /** Who finishes a granted purchase. */
231
+ readonly finish: CommerceFinishOwner;
232
+ }
233
+ export interface CommerceAuthorityCapabilities {
234
+ /** What the backend verifies to grant. */
235
+ readonly evidence: CommerceEvidenceAuthority;
236
+ readonly accountBinding: CommerceAccountBindingPolicy;
237
+ }
238
+ /**
239
+ * Commerce v2 capability declaration (`@mpgd/platform/commerce`). Declared
240
+ * here so the main entry stays free of validator imports; code branches on
241
+ * these declarations, never on a store id or target name.
242
+ */
243
+ export interface CommerceCapabilities {
244
+ readonly purchase: CommercePurchaseCapabilities;
245
+ readonly catalog: CommerceCatalogCapabilities;
246
+ readonly lifecycle: CommerceLifecycleCapabilities;
247
+ readonly authority: CommerceAuthorityCapabilities;
248
+ readonly availability: PlatformProviderAvailability;
249
+ }
211
250
  export interface PlatformCapabilities {
212
251
  readonly nativeIap: boolean;
213
252
  /** Optional for adapters published before subscription-specific support. */
@@ -227,6 +266,12 @@ export interface PlatformCapabilities {
227
266
  readonly localizedContent: boolean;
228
267
  /** Explains a false capability without claiming an unavailable SDK works. */
229
268
  readonly providerAvailability?: Readonly<Partial<Record<PlatformProviderFeature, PlatformProviderAvailability>>>;
269
+ /**
270
+ * Optional commerce v2 capability block. When present it must be a fresh
271
+ * object on every read with no unknown keys, and `nativeIap` and
272
+ * `subscriptionIap` must equal `deriveLegacyCommerceCapabilities(commerce)`.
273
+ */
274
+ readonly commerce?: CommerceCapabilities;
230
275
  }
231
276
  export interface PlayerIdentity {
232
277
  readonly playerId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpgd/platform",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Shared platform gateway, monetization, ads, leaderboard, identity, lifecycle, and storage contracts for mpgd games.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -44,12 +44,28 @@
44
44
  "./storage-conformance": {
45
45
  "types": "./dist/storage-conformance.d.ts",
46
46
  "default": "./dist/storage-conformance.js"
47
+ },
48
+ "./commerce": {
49
+ "types": "./dist/commerce.d.ts",
50
+ "default": "./dist/commerce.js"
51
+ },
52
+ "./commerce-vectors": {
53
+ "types": "./dist/commerce-vectors.d.ts",
54
+ "default": "./dist/commerce-vectors.js"
55
+ },
56
+ "./commerce-conformance": {
57
+ "types": "./dist/commerce-conformance.d.ts",
58
+ "default": "./dist/commerce-conformance.js"
47
59
  }
48
60
  },
49
61
  "files": [
50
62
  "dist"
51
63
  ],
64
+ "dependencies": {
65
+ "typia": "13.0.2"
66
+ },
52
67
  "devDependencies": {
68
+ "@ttsc/unplugin": "0.30.4",
53
69
  "ttsc": "0.30.4",
54
70
  "typescript": "7.0.2",
55
71
  "vitest": "^4.0.0"
@@ -64,6 +80,6 @@
64
80
  "lint": "ttsc --noEmit",
65
81
  "format": "ttsc format",
66
82
  "fix": "ttsc fix",
67
- "test": "vitest run && node test/capability-conformance-dist-import.mjs && node test/storage-conformance-dist-import.mjs && node test/ads-dist-import.mjs"
83
+ "test": "vitest run && node test/capability-conformance-dist-import.mjs && node test/storage-conformance-dist-import.mjs && node test/ads-dist-import.mjs && node test/commerce-dist-import.mjs && node test/commerce-conformance-dist-import.mjs && cd ../.. && node tools/run-ttsx.mjs packages/platform/test/commerce-derived-key-parity.ts"
68
84
  }
69
85
  }