chore: remove effects leftovers, dead SyncedState.set, add modules/resources skill refs

This commit is contained in:
edmand46
2026-09-17 14:15:37 +03:00
parent 4ab406c5cd
commit 34c53bbb68
14 changed files with 89 additions and 208 deletions
+1 -42
View File
@@ -1,9 +1,7 @@
// Test-side helpers: load the seed artifact, build SDK clients against prod, and
// reach the admin API for wallet grants / player inspection.
// Test-side helpers: load the seed artifact and build SDK clients against prod.
import { RudderClient } from '../../../src/client/RudderClient.js';
import type { TokenStore } from '../../../src/token/TokenStore.js';
import { createAdminClient, type AdminClient } from './adminClient.js';
import { readArtifact } from './artifact.js';
import type { SeedArtifact } from './types.js';
@@ -58,42 +56,3 @@ export async function freshPlayer(
await client.auth.loginWithDevice({ region: 'en', language: 'en' });
return client;
}
/** Admin (operator) API client authenticated with the seeded operator token. */
export function adminApi(artifact: SeedArtifact = loadArtifact()): AdminClient {
const api = createAdminClient(artifact.baseUrl);
api.setToken(artifact.adminToken);
return api;
}
/** Credits a player's wallet through the admin batch endpoint. */
export async function grantCurrency(
artifact: SeedArtifact,
playerId: string,
currencyCode: string,
amount: number,
): Promise<void> {
await adminApi(artifact).post(
`/platform/v1/projects/${artifact.projectId}/players/wallet/adjust?environment=${artifact.environment}`,
{ items: [{ playerId, currencyCode, amount, reason: 'e2e grant' }] },
);
}
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
/** Retries a read until ok(result) holds — absorbs release/cache reload lag. */
export async function withReadRetry<T>(
fn: () => Promise<T>,
ok: (value: T) => boolean,
tries = 8,
gapMs = 1500,
): Promise<T> {
let last = await fn();
if (ok(last)) return last;
for (let i = 1; i < tries; i++) {
await sleep(gapMs);
last = await fn();
if (ok(last)) return last;
}
return last;
}