SnowLuma v2.4.2 source snapshot
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
Publish MCP to npm / Build, test, and publish MCP (push) Waiting to run
Publish SDK to npm / Build, test, and publish SDK (push) Waiting to run
Sync action catalog to docs / sync (push) Waiting to run
Publish UI to npm / Build and publish UI (push) Waiting to run
Build and Release / preflight (push) Waiting to run
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
Publish MCP to npm / Build, test, and publish MCP (push) Waiting to run
Publish SDK to npm / Build, test, and publish SDK (push) Waiting to run
Sync action catalog to docs / sync (push) Waiting to run
Publish UI to npm / Build and publish UI (push) Waiting to run
Build and Release / preflight (push) Waiting to run
This commit is contained in:
commit
fa9c73363d
1367 files changed
+355735
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { defineAction, type RegisteredActionSpec } from '../../src/action-kit';
|
||||
import { ApiHandler, type ApiActionContext } from '../../src/api-handler';
|
||||
import { compileActionRegistry, RAW_ACTION_RESERVATIONS } from '../../src/actions';
|
||||
import type { ApiResponse, JsonObject } from '../../src/types';
|
||||
|
||||
type TestActionRun = (
|
||||
params: JsonObject,
|
||||
context: ApiActionContext,
|
||||
) => Promise<ApiResponse> | ApiResponse;
|
||||
|
||||
/** A test-only normal ActionSpec that still travels through the complete
|
||||
* compiled-registry constructor path. */
|
||||
export function testAction(name: string, run: TestActionRun): RegisteredActionSpec {
|
||||
return defineAction({
|
||||
name,
|
||||
params: {},
|
||||
run: (params, context) => run(params, context),
|
||||
});
|
||||
}
|
||||
|
||||
/** Construct an ApiHandler from an isolated but complete namespace. The raw
|
||||
* quick-operation reservation is mandatory, matching the production shape. */
|
||||
export function createCompiledTestHandler(
|
||||
context: ApiActionContext,
|
||||
specs: readonly RegisteredActionSpec[] = [],
|
||||
uin?: number,
|
||||
): ApiHandler {
|
||||
const registry = compileActionRegistry(
|
||||
[{ category: 'test', actions: specs }],
|
||||
RAW_ACTION_RESERVATIONS,
|
||||
);
|
||||
return new ApiHandler(context, uin, registry);
|
||||
}
|
||||
Reference in new issue
Block a user