0.5.0: typecheck against regenerated models
listQuests no longer takes a body, battle-pass track is a union, scenario run status has no unknown_run. This ships loginWithCustom and quest metric helpers that never reached the registry after the v0.4.0 publish job failed.
This commit is contained in:
@@ -1,5 +1,15 @@
|
||||
# Changelog
|
||||
|
||||
## 0.5.0
|
||||
|
||||
- `client.auth.loginWithCustom({ customData, region?, language?, nickname? })`
|
||||
— custom webhook auth, same token + runtime start as `loginWithDevice`.
|
||||
- `QuestMetrics.purchaseOffer` / `purchaseItem` helpers for the shop purchase
|
||||
metric format.
|
||||
- Typecheck against regenerated models: `listQuests` no longer takes a body,
|
||||
battle-pass `track` is `'free' | 'premium'`, scenario run status has no
|
||||
`unknown_run`.
|
||||
|
||||
## 0.4.0
|
||||
|
||||
- Fixed `BattlePassLevelSession.level` reading node data key `level` — the
|
||||
|
||||
@@ -52,7 +52,7 @@ client.dispose();
|
||||
|
||||
| Area | Access |
|
||||
|---|---|
|
||||
| Auth | `client.auth.loginWithDevice()`, `client.auth.logout()`, `client.auth.isAuthenticated`, `client.auth.onAuthStateChange(cb)` |
|
||||
| Auth | `client.auth.loginWithDevice()`, `client.auth.loginWithCustom({ customData })`, `client.auth.logout()`, `client.auth.isAuthenticated`, `client.auth.onAuthStateChange(cb)` |
|
||||
| Player / wallets | `client.player` (observable) |
|
||||
| Inventory | `client.inventory` (observable, catalog-merged) |
|
||||
| Catalog | `client.catalog` (observable) |
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@rudder/js-sdk",
|
||||
"version": "0.1.0",
|
||||
"version": "0.5.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@rudder/js-sdk",
|
||||
"version": "0.1.0",
|
||||
"version": "0.5.0",
|
||||
"devDependencies": {
|
||||
"@types/node": "^26.1.1",
|
||||
"jsdom": "^29.1.1",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@rudder/js-sdk",
|
||||
"version": "0.4.0",
|
||||
"version": "0.5.0",
|
||||
"publishConfig": {
|
||||
"registry": "https://hub.rudder.build/api/packages/rudder/npm/"
|
||||
},
|
||||
|
||||
@@ -79,7 +79,7 @@ export interface QuestEffect {
|
||||
export interface BattlePassEffect {
|
||||
getProgress(): Promise<GetBattlePassProgressResponse>;
|
||||
addXp(source: string, amount: number): Promise<AddBattlePassXpResponse>;
|
||||
claimReward(level: number, track?: string): Promise<ClaimBattlePassRewardResponse>;
|
||||
claimReward(level: number, track?: 'free' | 'premium'): Promise<ClaimBattlePassRewardResponse>;
|
||||
purchasePremium(): Promise<PurchaseBattlePassPremiumResponse>;
|
||||
levelUp(): Promise<void>;
|
||||
end(): Promise<void>;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* QuestMetrics — builders for the quest metric strings known to the platform.
|
||||
*
|
||||
* Purchase metrics are reported automatically by the shop purchase fan-out,
|
||||
* so these helpers exist mainly to name the format instead of hardcoding it.
|
||||
* Any other metric is a custom string reported via
|
||||
* Purchase metrics are reported automatically server-side by the shop
|
||||
* purchase fan-out, so these helpers exist mainly to name the format
|
||||
* instead of hardcoding it. Any other metric is a custom string reported via
|
||||
* {@link QuestsService.reportProgress}.
|
||||
*/
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export class QuestsService {
|
||||
|
||||
/** Lists the player's quests with per-objective progress and rewards. */
|
||||
async list(): Promise<Quest[]> {
|
||||
const response = await api.listQuests(this.ctx, {});
|
||||
const response = await api.listQuests(this.ctx);
|
||||
return response.quests ?? [];
|
||||
}
|
||||
|
||||
|
||||
@@ -136,8 +136,9 @@ export class ScenarioService<TConfig extends RemoteConfigShape = RemoteConfigSha
|
||||
|
||||
try {
|
||||
const response = await api.getScenarioRun(this.ctx, { runId: saved.runId });
|
||||
const status: string | undefined = response?.status;
|
||||
|
||||
if (response?.status === 'unknown_run' || response?.status === 'expired') {
|
||||
if (status === 'unknown_run' || status === 'expired') {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -466,8 +467,9 @@ export class ScenarioService<TConfig extends RemoteConfigShape = RemoteConfigSha
|
||||
let reconciled = false;
|
||||
try {
|
||||
const reconcile = await api.getScenarioRun(this.ctx, { runId: run.runId });
|
||||
const reconcileStatus: string | undefined = reconcile?.status;
|
||||
|
||||
if (reconcile?.status === 'unknown_run' || reconcile?.status === 'expired') {
|
||||
if (reconcileStatus === 'unknown_run' || reconcileStatus === 'expired') {
|
||||
this.runs.delete(run.runId);
|
||||
await this.persist();
|
||||
reconciled = true;
|
||||
|
||||
@@ -278,7 +278,7 @@ export class BattlePassSession {
|
||||
}
|
||||
|
||||
/** Claims a tier reward at a reached level. */
|
||||
claimReward(level: number, track?: string): Promise<ClaimBattlePassRewardResponse> {
|
||||
claimReward(level: number, track?: 'free' | 'premium'): Promise<ClaimBattlePassRewardResponse> {
|
||||
const { scenarioId, nodeId, runId } = this.ids();
|
||||
return this.battlePass.claimReward({ scenarioId, nodeId, level, track, runId });
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ interface GameRemoteConfig extends Record<string, unknown> {
|
||||
missing_declared: string;
|
||||
}
|
||||
|
||||
function cfg(key: string, value: string, valueType: string, active = true): RemoteConfig {
|
||||
function cfg(key: string, value: string, valueType: NonNullable<RemoteConfig['valueType']>, active = true): RemoteConfig {
|
||||
return { key, value, valueType, active };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user