dimcode-darwin-x64 0.1.0-alpha.16 → 0.1.0-alpha.17
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/bin/dimcode +2 -2
- package/default-plugins.json +0 -1
- package/package.json +1 -1
- package/plugins/scheduler/README.md +4 -9
- package/plugins/scheduler/data.ts +8 -29
- package/plugins/scheduler/settings.ts +0 -9
- package/plugins/workflow/README.md +22 -19
- package/plugins/workflow/store.ts +61 -18
- package/release-manifest.json +9 -26
- package/plugins/session-title/README.md +0 -76
- package/plugins/session-title/dim-plugin.json +0 -11
- package/plugins/session-title/index.ts +0 -13
- package/plugins/session-title/node_modules/.package-lock.json +0 -18
- package/plugins/session-title/node_modules/@arcships/rutis/README.md +0 -32
- package/plugins/session-title/node_modules/@arcships/rutis/package.json +0 -46
- package/plugins/session-title/node_modules/@arcships/rutis/src/advanced.d.ts +0 -90
- package/plugins/session-title/node_modules/@arcships/rutis/src/advanced.mjs +0 -32
- package/plugins/session-title/node_modules/@arcships/rutis/src/index.d.ts +0 -43
- package/plugins/session-title/node_modules/@arcships/rutis/src/index.mjs +0 -71
- package/plugins/session-title/node_modules/@arcships/rutis/src/testing.d.ts +0 -77
- package/plugins/session-title/node_modules/@arcships/rutis/src/testing.mjs +0 -350
- package/plugins/session-title/node_modules/@arcships/rutis/src/values.mjs +0 -261
- package/plugins/session-title/package-lock.json +0 -45
- package/plugins/session-title/package.json +0 -9
- package/plugins/session-title/part.ts +0 -172
- package/plugins/session-title/settings.ts +0 -49
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@arcships/rutis",
|
|
3
|
-
"version": "0.19.3",
|
|
4
|
-
"description": "Write rutis plugins in JavaScript or TypeScript: definePlugin, types and a test kit",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/arcships/rutis.git",
|
|
9
|
-
"directory": "node/rutis"
|
|
10
|
-
},
|
|
11
|
-
"homepage": "https://github.com/arcships/rutis/tree/main/docs/guide#readme",
|
|
12
|
-
"keywords": ["rutis", "plugin", "rutis-plugin"],
|
|
13
|
-
"type": "module",
|
|
14
|
-
"exports": {
|
|
15
|
-
".": {
|
|
16
|
-
"types": "./src/index.d.ts",
|
|
17
|
-
"default": "./src/index.mjs"
|
|
18
|
-
},
|
|
19
|
-
"./advanced": {
|
|
20
|
-
"types": "./src/advanced.d.ts",
|
|
21
|
-
"default": "./src/advanced.mjs"
|
|
22
|
-
},
|
|
23
|
-
"./testing": {
|
|
24
|
-
"types": "./src/testing.d.ts",
|
|
25
|
-
"default": "./src/testing.mjs"
|
|
26
|
-
},
|
|
27
|
-
"./package.json": "./package.json"
|
|
28
|
-
},
|
|
29
|
-
"files": [
|
|
30
|
-
"src"
|
|
31
|
-
],
|
|
32
|
-
"engines": {
|
|
33
|
-
"node": ">=22",
|
|
34
|
-
"bun": ">=1.4"
|
|
35
|
-
},
|
|
36
|
-
"publishConfig": {
|
|
37
|
-
"access": "public"
|
|
38
|
-
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"test": "node --test test/*.test.mjs"
|
|
41
|
-
},
|
|
42
|
-
"devDependencies": {
|
|
43
|
-
"@arcships/rutis-bun": "file:../../bun/rutis-bun",
|
|
44
|
-
"@arcships/rutis-runtime": "file:../rutis-runtime"
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
// What a plugin author rarely writes (#692): the plugin API version, the
|
|
2
|
-
// marks, the value constructors and the types of the events. `definePlugin`
|
|
3
|
-
// and `Context` are in `@arcships/rutis`.
|
|
4
|
-
import type { Plugin } from './index.js'
|
|
5
|
-
|
|
6
|
-
export type MethodKind = 'sync' | 'async'
|
|
7
|
-
|
|
8
|
-
/** Where a listener is, as the logical bus describes it (#464): what a filter sees. */
|
|
9
|
-
export interface ListenerDescriptor {
|
|
10
|
-
/** The event name (a prefix, for a Rust pattern listener). */
|
|
11
|
-
readonly name: string
|
|
12
|
-
/** A Rust pattern listener's prefix entry. */
|
|
13
|
-
readonly prefix: boolean
|
|
14
|
-
/** The plugin that registered it: its declared name (`PluginSpec.name`, a Cordis plugin's name), else its row's id. */
|
|
15
|
-
readonly plugin: string
|
|
16
|
-
/** Its row's id, the name the configuration gives the row (the copies a group's instances make share it); `null` for a plugin a mount loaded. */
|
|
17
|
-
readonly row: string | null
|
|
18
|
-
/** The runtime it runs in; `null` for the host's own Rust plugins. */
|
|
19
|
-
readonly runtime: string | null
|
|
20
|
-
/** The node it came from over a node link; `null` otherwise. */
|
|
21
|
-
readonly node: string | null
|
|
22
|
-
/** Its scope chain, outermost first; `[]` at the root. */
|
|
23
|
-
readonly scope: ReadonlyArray<{ readonly id: string, readonly group: string }>
|
|
24
|
-
/** A `global` listener is never filtered. */
|
|
25
|
-
readonly global: boolean
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface ListenerOptions {
|
|
29
|
-
/** Run before every listener of the name registered so far. */
|
|
30
|
-
prepend?: boolean
|
|
31
|
-
/** Not subject to emitters' filters. */
|
|
32
|
-
global?: boolean
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** A listener: the event's arguments, then, in a `waterfall`, `next` (the rest of the chain) last. */
|
|
36
|
-
export type Listener = (...args: any[]) => any
|
|
37
|
-
|
|
38
|
-
/** The five ways to emit. Each reaches every listener of the name on the root's flat bus, wherever the listener runs, by the same rules as if all were in this process. Emitting `rutis/*` throws `ReservedEvent`; `internal/*` is refused. */
|
|
39
|
-
export interface Emitter {
|
|
40
|
-
/** Start every listener in registration order; returns at once. A listener's failure is reported where it ran and reaches neither the emitter nor the other listeners. */
|
|
41
|
-
emit(name: string, ...args: any[]): void
|
|
42
|
-
/** Start every listener and wait for all. Failures reject with an `AggregateError` in registration order, even a single one. */
|
|
43
|
-
parallel(name: string, ...args: any[]): Promise<void>
|
|
44
|
-
/** Run the listeners one by one; resolves to the first result (not `undefined`, `null` or `false`), or `undefined`. An error stops and rejects. */
|
|
45
|
-
serial<T = any>(name: string, ...args: any[]): Promise<T | undefined>
|
|
46
|
-
/** Each listener gets `next` (no arguments) last and returns the result; not calling `next` vetoes the rest. Every argument is the event's; the end of the chain gives `undefined` (see `with` for a terminal). Returns the outermost listener's value as is (a Promise whenever a listener runs elsewhere: await it). Calling `next` twice, or after the end, gives a Promise rejected with `WaterfallNext`. */
|
|
47
|
-
waterfall: Waterfall
|
|
48
|
-
/** Synchronously, the first result as `serial`. An `async` listener, or one returning a Promise, fails it with `AsyncListener`. */
|
|
49
|
-
bail<T = any>(name: string, ...args: any[]): T | undefined
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface Waterfall {
|
|
53
|
-
<T = any>(name: string, ...args: any[]): T | Promise<T>
|
|
54
|
-
/** The same waterfall with a terminal: called with the event's arguments at the end of the chain, its value what the last `next` gives. */
|
|
55
|
-
with<T = any>(terminal: (...args: any[]) => any): <U = T>(name: string, ...args: any[]) => U | Promise<U>
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** The plugin API this SDK writes plugins against. */
|
|
59
|
-
export declare const PLUGIN_API: number
|
|
60
|
-
/** The mark on what `definePlugin` makes (`Symbol.for('rutis.leaf-plugin')`), across copies of this package. */
|
|
61
|
-
export declare const PLUGIN: unique symbol
|
|
62
|
-
/** Whether `value` is a plugin `definePlugin` made. */
|
|
63
|
-
export declare function isPlugin(value: unknown): value is Plugin
|
|
64
|
-
|
|
65
|
-
/** The mark on a value made by `datetime`, `date`, `time`, `decimal` or `uuid` (`Symbol.for('rutis.value')`). */
|
|
66
|
-
export declare const VALUE: unique symbol
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* A local date and time, date, time of day, decimal or UUID to send as that
|
|
70
|
-
* value (#308): JavaScript has no type for them. Received, they are strings
|
|
71
|
-
* (`value`'s text); a plain string is sent as a string.
|
|
72
|
-
*/
|
|
73
|
-
export interface TaggedValue<Tag extends 'datetime' | 'date' | 'time' | 'decimal' | 'uuid'> {
|
|
74
|
-
readonly [VALUE]: Tag
|
|
75
|
-
/** The value's text, as it crosses. */
|
|
76
|
-
readonly value: string
|
|
77
|
-
toString(): string
|
|
78
|
-
toJSON(): string
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/** A local date and time without a time zone: `'2026-10-15T14:30'`, `'2026-10-15T14:30:05.25'` (years 0001–9999, 0–9 fraction digits). Received as its text. */
|
|
82
|
-
export declare function datetime(text: string): TaggedValue<'datetime'>
|
|
83
|
-
/** A calendar date: `'2026-10-15'` (years 0001–9999). Received as its text. */
|
|
84
|
-
export declare function date(text: string): TaggedValue<'date'>
|
|
85
|
-
/** A time of day without a time zone: `'14:30'`, `'14:30:05.25'` (24-hour). Received as its text. */
|
|
86
|
-
export declare function time(text: string): TaggedValue<'time'>
|
|
87
|
-
/** A decimal number, trailing zeros kept: `'1.10'`, `'-12.3400'` (no exponent, at most 4300 digits). Received as its text. */
|
|
88
|
-
export declare function decimal(text: string | bigint): TaggedValue<'decimal'>
|
|
89
|
-
/** A UUID, `8-4-4-4-12` hex in either case; sent and received in lowercase. */
|
|
90
|
-
export declare function uuid(text: string): TaggedValue<'uuid'>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// The names a plugin author rarely writes (#692): the plugin API version,
|
|
2
|
-
// the marks the runtimes recognise plugins and values by, and the value
|
|
3
|
-
// constructors. `ctx` and `definePlugin` are in `@arcships/rutis`.
|
|
4
|
-
//
|
|
5
|
-
// import { datetime, decimal } from '@arcships/rutis/advanced'
|
|
6
|
-
// return { at: datetime('2026-10-15T14:30'), price: decimal('1.10') }
|
|
7
|
-
|
|
8
|
-
// The plugin API this SDK writes plugins against. A runtime refuses a plugin
|
|
9
|
-
// that needs a newer one, naming both.
|
|
10
|
-
// 2: ctx.on and ctx.emit (leaf events). A runtime that supports only 1
|
|
11
|
-
// refuses such a plugin at load instead of failing in apply.
|
|
12
|
-
// 3: the unified events of rutis 0.13 (#464): ctx.parallel, serial,
|
|
13
|
-
// waterfall, bail and filter, ctx.signal, and `prepend` / `global` on
|
|
14
|
-
// ctx.on. A runtime of 0.12 or older refuses such a plugin at load.
|
|
15
|
-
export const PLUGIN_API = 3
|
|
16
|
-
|
|
17
|
-
// Marks what definePlugin returns, across copies of this package.
|
|
18
|
-
export const PLUGIN = Symbol.for('rutis.leaf-plugin')
|
|
19
|
-
|
|
20
|
-
// Whether `value` is a plugin definePlugin made.
|
|
21
|
-
export const isPlugin = value => value?.[PLUGIN] === true
|
|
22
|
-
|
|
23
|
-
// Values JavaScript has no type for, to send as what they are (#308): a
|
|
24
|
-
// local date and time, a date, a time of day, a decimal, a UUID. Received,
|
|
25
|
-
// they are strings; a plain string is sent as a string.
|
|
26
|
-
//
|
|
27
|
-
// A Date, Uint8Array, Map, Set and bigint need no constructor: they cross
|
|
28
|
-
// as an instant, bytes, a map, a set and a big integer.
|
|
29
|
-
export { datetime, date, time, decimal, uuid } from './values.mjs'
|
|
30
|
-
// The mark on what they make, across copies of this package and in the
|
|
31
|
-
// runtimes: `Symbol.for('rutis.value')`.
|
|
32
|
-
export { MARK as VALUE } from './values.mjs'
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type * as advanced from './advanced.js'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* An error a listener threw arrives, through the host, as an `Error` of the
|
|
5
|
-
* same built-in class (`TypeError`, `RangeError`, …, `AggregateError`) or a
|
|
6
|
-
* plain `Error` with the thrower's `name`, `message` and `code`, never as
|
|
7
|
-
* the thrower's own class: match errors by `name`.
|
|
8
|
-
*/
|
|
9
|
-
export interface Context extends advanced.Emitter {
|
|
10
|
-
/** The service `name`, which the plugin declares in `inject`: the object itself when a plugin in the same process provides it, else a proxy whose methods are sync or async as declared. */
|
|
11
|
-
use<T = any>(name: string): T
|
|
12
|
-
/** Provide `value` as the service `name` until the plugin unloads, or until the returned function is called. It reaches rutis by itself: its methods are the object's functions (own and inherited, not `constructor`), `async` unless `provides` marks them `sync`. */
|
|
13
|
-
provide(name: string, value: unknown): () => unknown
|
|
14
|
-
/** Run `cleanup` when the plugin unloads. */
|
|
15
|
-
effect(cleanup: () => unknown): void
|
|
16
|
-
/** Aborted when the plugin unloads; its running listeners are then waited for (up to the host's shutdown deadline) before the cleanups run. */
|
|
17
|
-
readonly signal: AbortSignal
|
|
18
|
-
/** Listen to `name` on the host's logical bus: every event of that name, from any process or language (a scope is a descriptor). Registered with the host by itself; unregistered when the plugin unloads or the returned function is called. `rutis/*` (the host's framework events) can be listened to; `internal/*` cannot. */
|
|
19
|
-
on(name: string, listener: advanced.Listener, options?: advanced.ListenerOptions): () => void
|
|
20
|
-
/** The five ways to emit, delivered only to the listeners `keep` returns true for (`global` listeners are always delivered). `keep` runs in this process, once per candidate, before any listener runs. */
|
|
21
|
-
filter(keep: (listener: advanced.ListenerDescriptor) => unknown): advanced.Emitter
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface PluginSpec<C = any> {
|
|
25
|
-
/** Its name: what listener descriptors (`ListenerDescriptor.plugin`) call it. Without one, they call it by its row's id. */
|
|
26
|
-
name?: string
|
|
27
|
-
/** Services the plugin uses: rutis starts it once they are all available, and stops it when one goes. */
|
|
28
|
-
inject?: string[]
|
|
29
|
-
/** Optional: services it provides, with the kind of methods to call `sync` (the others are `async`). Without it, what `ctx.provide` provides still reaches rutis; with it, `rutis-host check` knows before the plugin runs. */
|
|
30
|
-
provides?: Record<string, Record<string, advanced.MethodKind>>
|
|
31
|
-
/** The JSON Schema of its config. */
|
|
32
|
-
config?: object
|
|
33
|
-
apply(ctx: Context, config: C): void | (() => unknown) | Promise<void | (() => unknown)>
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface Plugin<C = any> extends Readonly<Required<Pick<PluginSpec<C>, 'inject' | 'provides'>>>, Readonly<Omit<PluginSpec<C>, 'inject' | 'provides'>> {
|
|
37
|
-
/** The plugin API it was written against. */
|
|
38
|
-
readonly api: number
|
|
39
|
-
/** Always `true`: what it provides beyond `provides` reaches rutis by itself, known once it runs. */
|
|
40
|
-
readonly announces: boolean
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export declare function definePlugin<C = any>(spec: PluginSpec<C>): Plugin<C>
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// Write a rutis plugin in JavaScript or TypeScript. A plugin declares the
|
|
2
|
-
// services it uses (`inject`), and `apply(ctx, config)` uses and provides
|
|
3
|
-
// them through `ctx`; rutis decides when it starts, stops and restarts. The
|
|
4
|
-
// runtime that runs it is installed by the host (`@arcships/rutis-runtime`
|
|
5
|
-
// in Node, `@arcships/rutis-bun` in Bun), not by the plugin.
|
|
6
|
-
//
|
|
7
|
-
// export default definePlugin({
|
|
8
|
-
// inject: ['llm'],
|
|
9
|
-
// config: { type: 'object', properties: { city: { type: 'string' } } },
|
|
10
|
-
// apply(ctx, config) {
|
|
11
|
-
// ctx.provide('weather', new Weather(ctx.use('llm'), config.city))
|
|
12
|
-
// ctx.on('weather/ask', city => city === config.city ? 'sunny' : undefined)
|
|
13
|
-
// return () => {}
|
|
14
|
-
// },
|
|
15
|
-
// })
|
|
16
|
-
//
|
|
17
|
-
// Events cross every process and language on the host (#464): `ctx.on`
|
|
18
|
-
// listens to every event of the name on the flat bus, and
|
|
19
|
-
// `ctx.emit` / `parallel` / `serial` / `waterfall` / `bail` reach every
|
|
20
|
-
// listener, wherever it runs, as if all were in this process.
|
|
21
|
-
//
|
|
22
|
-
// What `ctx.provide` provides reaches rutis by itself: its methods are the
|
|
23
|
-
// object's functions (its own and its prototype chain's, not `constructor`),
|
|
24
|
-
// called as `async`. `provides` is optional: `{ weather: { unit: 'sync' } }`
|
|
25
|
-
// marks methods `sync` and tells `rutis-host check` what the plugin
|
|
26
|
-
// provides before it runs.
|
|
27
|
-
|
|
28
|
-
import { PLUGIN, PLUGIN_API } from './advanced.mjs'
|
|
29
|
-
|
|
30
|
-
// `config` is a JSON Schema object: the host fills its defaults and checks
|
|
31
|
-
// the config with it before `apply`. A Standard Schema object (schemastery,
|
|
32
|
-
// zod, …) was never applied: refused (config schema design §2.3).
|
|
33
|
-
function checkSchema(config) {
|
|
34
|
-
const standard = config?.['~standard']
|
|
35
|
-
if (standard !== undefined) {
|
|
36
|
-
throw new TypeError(`config of definePlugin should be a JSON Schema object, got ${standard?.vendor === 'schemastery' ? 'a schemastery Schema' : 'a Standard Schema'}`)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// The module that defined a plugin, as a file URL: the test tool
|
|
41
|
-
// (`@arcships/rutis/testing`) has a real runtime load the plugin from it.
|
|
42
|
-
const FILE = Symbol.for('rutis.plugin-file')
|
|
43
|
-
function definedIn() {
|
|
44
|
-
const prepare = Error.prepareStackTrace
|
|
45
|
-
try {
|
|
46
|
-
Error.prepareStackTrace = (_, sites) => sites
|
|
47
|
-
const holder = {}
|
|
48
|
-
Error.captureStackTrace(holder, definePlugin)
|
|
49
|
-
const file = holder.stack?.[0]?.getFileName?.()
|
|
50
|
-
return typeof file === 'string' ? file : undefined
|
|
51
|
-
} catch {
|
|
52
|
-
return undefined
|
|
53
|
-
} finally {
|
|
54
|
-
Error.prepareStackTrace = prepare
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function definePlugin(spec) {
|
|
59
|
-
if (typeof spec?.apply !== 'function') throw new TypeError('a plugin needs apply(ctx, config)')
|
|
60
|
-
checkSchema(spec.config)
|
|
61
|
-
const inject = spec.inject ?? []
|
|
62
|
-
if (!Array.isArray(inject) || inject.some(name => typeof name !== 'string')) throw new TypeError('inject must be a list of service names')
|
|
63
|
-
for (const [name, methods] of Object.entries(spec.provides ?? {})) {
|
|
64
|
-
for (const [method, kind] of Object.entries(methods ?? {})) {
|
|
65
|
-
if (kind !== 'sync' && kind !== 'async') throw new TypeError(`${name}.${method}: kind must be 'sync' or 'async'`)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// `announces`: what it provides beyond `provides` (all of it, without
|
|
69
|
-
// one) reaches rutis by itself, and is known once it runs.
|
|
70
|
-
return Object.freeze({ ...spec, inject, provides: spec.provides ?? {}, announces: true, api: PLUGIN_API, [PLUGIN]: true, [FILE]: definedIn() })
|
|
71
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from './index.js'
|
|
2
|
-
import type { Emitter, Listener, ListenerDescriptor, ListenerOptions } from './advanced.js'
|
|
3
|
-
|
|
4
|
-
/** What the test tool refuses: a load that fails (the row's line, as the host prints it), a plugin it cannot load. */
|
|
5
|
-
export declare class PluginTestError extends Error {}
|
|
6
|
-
|
|
7
|
-
/** The five ways to emit, with `filter`. */
|
|
8
|
-
export interface TestEmitter extends Emitter {
|
|
9
|
-
filter(keep: (listener: ListenerDescriptor) => unknown): Emitter
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/** A failure the host reported of a row: a listener failing in an `emit`, or a filter (protocol §5.6). */
|
|
13
|
-
export interface Reported {
|
|
14
|
-
/** The line the host prints. */
|
|
15
|
-
line: string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/** One loaded plugin: a row of the host. Its emitting methods emit as the test's plugin next to it. */
|
|
19
|
-
export interface Loaded extends TestEmitter {
|
|
20
|
-
/** The row's id on the host: its module's file name, `-2`, `-3`… when taken. */
|
|
21
|
-
readonly row: string
|
|
22
|
-
/** The host it is loaded on. */
|
|
23
|
-
readonly host: Host
|
|
24
|
-
/** The service `name` the plugin provides, as rutis sees it: its declared methods, or, undeclared, the object's methods, all async. */
|
|
25
|
-
service<T = any>(name: string): T
|
|
26
|
-
/** The methods rutis sees on the service `name`, with their kinds. */
|
|
27
|
-
methods(name: string): Record<string, 'sync' | 'async'>
|
|
28
|
-
/** The names of the services the plugin provides now. */
|
|
29
|
-
provided(): string[]
|
|
30
|
-
/** What the host reported of this row. */
|
|
31
|
-
reported(): Promise<Reported[]>
|
|
32
|
-
/**
|
|
33
|
-
* Listen to the event `name` as a plugin next to it does: the plugin's emissions of `name` reach `listener`, and so do the test's own.
|
|
34
|
-
* Its arguments and what it returns cross between processes. Returns the function that stops it; without it, it stops when the row unloads.
|
|
35
|
-
*/
|
|
36
|
-
on(name: string, listener: Listener, options?: ListenerOptions): () => void
|
|
37
|
-
/** Change the row's config, as a host does. */
|
|
38
|
-
update(config: unknown): Promise<void>
|
|
39
|
-
/** Unload the row as the host does (its listeners and services withdrawn, its `ctx.signal` aborted, its running listeners waited for, its cleanups run, latest first), then the test's services and listeners of it. */
|
|
40
|
-
unload(): Promise<void>
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface LoadOptions {
|
|
44
|
-
config?: unknown
|
|
45
|
-
/** The test's services the plugin injects, by name. */
|
|
46
|
-
services?: Record<string, unknown>
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface HostOptions {
|
|
50
|
-
/** The test's services, for every row that injects them. */
|
|
51
|
-
services?: Record<string, unknown>
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface RowOptions {
|
|
55
|
-
config?: unknown
|
|
56
|
-
/** The test's services for this row only. */
|
|
57
|
-
services?: Record<string, unknown>
|
|
58
|
-
/** The row's id (default: its module's file name, with `-2`, `-3`, … when taken). */
|
|
59
|
-
id?: string
|
|
60
|
-
/** As a row's `isolate`: the services it keeps to a scope of its own (`{ forecast: true }`), or a label. */
|
|
61
|
-
isolate?: Record<string, true | string>
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** Plugins on the host, sharing its bus; its emitting methods emit as the test's plugin. */
|
|
65
|
-
export interface Host extends TestEmitter {
|
|
66
|
-
load(plugin: Plugin | { default: Plugin }, options?: RowOptions): Promise<Loaded>
|
|
67
|
-
/** What the host reported of the rows here. */
|
|
68
|
-
reported(): Promise<Reported[]>
|
|
69
|
-
/** Unload every row, latest first, then withdraw the test's services. */
|
|
70
|
-
unload(): Promise<void>
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** Plugins on the real host of this test process (`rutis-host test`, in the real runtime), which must be their modules' default exports. */
|
|
74
|
-
export declare function host(options?: HostOptions): Host
|
|
75
|
-
|
|
76
|
-
/** Load `plugin` (or a module whose default export it is) on a `host()` of its own. */
|
|
77
|
-
export declare function load(plugin: Plugin | { default: Plugin }, options?: LoadOptions): Promise<Loaded>
|