feat: modules and resources domains, drop removed domains, regenerated models
This commit is contained in:
@@ -2,16 +2,11 @@
|
||||
// reach the admin API for wallet grants / player inspection.
|
||||
|
||||
import { RudderClient } from '../../../src/client/RudderClient.js';
|
||||
import type { RemoteConfigShape } from '../../../src/state/RemoteConfigState.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';
|
||||
|
||||
type RuntimeOptions = {
|
||||
loginEvent?: string | null;
|
||||
};
|
||||
|
||||
/** Loads the seed artifact; RUDDER_E2E_* env vars override file values. */
|
||||
export function loadArtifact(): SeedArtifact {
|
||||
const file = readArtifact();
|
||||
@@ -44,25 +39,22 @@ export function createInMemoryTokenStore(): TokenStore {
|
||||
};
|
||||
}
|
||||
|
||||
/** A client with no auth yet (in-memory tokens, no IndexedDB persistence). */
|
||||
export function makeProdClient<TConfig extends RemoteConfigShape = RemoteConfigShape>(
|
||||
/** A client with no auth yet (in-memory tokens). */
|
||||
export function makeProdClient(
|
||||
artifact: SeedArtifact = loadArtifact(),
|
||||
runtime: RuntimeOptions = { loginEvent: null },
|
||||
): RudderClient<TConfig> {
|
||||
return new RudderClient<TConfig>({
|
||||
): RudderClient {
|
||||
return new RudderClient({
|
||||
baseUrl: artifact.baseUrl,
|
||||
projectKey: artifact.projectKey,
|
||||
tokenStore: createInMemoryTokenStore(),
|
||||
runtime,
|
||||
});
|
||||
}
|
||||
|
||||
/** A device-authenticated client. In Node each call mints a fresh player (ephemeral device id). */
|
||||
export async function freshPlayer<TConfig extends RemoteConfigShape = RemoteConfigShape>(
|
||||
export async function freshPlayer(
|
||||
artifact: SeedArtifact = loadArtifact(),
|
||||
runtime?: RuntimeOptions,
|
||||
): Promise<RudderClient<TConfig>> {
|
||||
const client = makeProdClient<TConfig>(artifact, runtime);
|
||||
): Promise<RudderClient> {
|
||||
const client = makeProdClient(artifact);
|
||||
await client.auth.loginWithDevice({ region: 'en', language: 'en' });
|
||||
return client;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user