Skip to content

@my-swu/simulator-client


@my-swu/simulator-client / SystemResource

Interface: SystemResource

Defined in: packages/ts-sdk/src/resources/system.ts:24

System-level API methods.

Use these calls for lightweight reachability checks and operational status before starting match flows.

Example:

ts
import { 
createSimulatorClient
} from '@my-swu/simulator-client'
// Point this at the simulator HTTP origin for /health and /api routes. const
simulatorClient
=
createSimulatorClient
({
baseUrl
: 'http://127.0.0.1:4000',
}) // Health checks liveness; stats reports simulator coverage. const
health
= await
simulatorClient
.
system
.
health
()
const
stats
= await
simulatorClient
.
system
.
stats
()
console
.
log
(
health
.
status
,
stats
.
covered
)

Example

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

const health = await simulatorClient.system.health()
console.log(health.status)

See

https://simulator-sdk.my-swu.com/guide/http-client

Methods

health()

Example:

ts
import { 
createSimulatorClient
} from '@my-swu/simulator-client'
// Point this at the simulator HTTP origin for /health and /api routes. const
simulatorClient
=
createSimulatorClient
({
baseUrl
: 'http://127.0.0.1:4000',
}) // Health is the lightest server reachability check. const
health
= await
simulatorClient
.
system
.
health
()

health(): Promise<HealthResponse>

Defined in: packages/ts-sdk/src/resources/system.ts:42

Calls the simulator liveness probe.

Returns

Promise<HealthResponse>

Example

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

const health = await simulatorClient.system.health()
console.log(health.status)

See

https://simulator-sdk.my-swu.com/guide/http-client#health-checks


stats()

Example:

ts
import { 
createSimulatorClient
} from '@my-swu/simulator-client'
// Point this at the simulator HTTP origin for /health and /api routes. const
simulatorClient
=
createSimulatorClient
({
baseUrl
: 'http://127.0.0.1:4000',
}) // Stats expose coverage and runtime counters. const
stats
= await
simulatorClient
.
system
.
stats
()

stats(): Promise<StatsResponse>

Defined in: packages/ts-sdk/src/resources/system.ts:60

Returns engine coverage and runtime statistics.

Returns

Promise<StatsResponse>

Example

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

const stats = await simulatorClient.system.stats()
console.log(stats.covered)

See

https://simulator-sdk.my-swu.com/guide/client-api#system-resource

Released under the MIT License.