@meetploy/types 1.9.0 → 1.10.0
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/dist/db.d.ts +11 -11
- package/dist/index.d.ts +2 -2
- package/dist/ploy.d.ts +2 -2
- package/dist/workflow.d.ts +4 -0
- package/globals.d.ts +4 -4
- package/package.json +1 -1
package/dist/db.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface DBResultMeta {
|
|
2
2
|
duration: number;
|
|
3
3
|
rows_read: number;
|
|
4
4
|
rows_written: number;
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface DBResult<T = unknown> {
|
|
7
7
|
results: T[];
|
|
8
8
|
success: boolean;
|
|
9
|
-
meta:
|
|
9
|
+
meta: DBResultMeta;
|
|
10
10
|
}
|
|
11
|
-
export interface
|
|
12
|
-
bind: (...values: unknown[]) =>
|
|
13
|
-
run: <T = unknown>() => Promise<
|
|
14
|
-
all: <T = unknown>() => Promise<
|
|
11
|
+
export interface DBPreparedStatement {
|
|
12
|
+
bind: (...values: unknown[]) => DBPreparedStatement;
|
|
13
|
+
run: <T = unknown>() => Promise<DBResult<T>>;
|
|
14
|
+
all: <T = unknown>() => Promise<DBResult<T>>;
|
|
15
15
|
first: <T = unknown>(colName?: string) => Promise<T | null>;
|
|
16
16
|
raw: <T = unknown>(options?: {
|
|
17
17
|
columnNames?: boolean;
|
|
18
18
|
}) => Promise<T[][]>;
|
|
19
19
|
}
|
|
20
|
-
export interface
|
|
21
|
-
prepare: (query: string) =>
|
|
20
|
+
export interface Database {
|
|
21
|
+
prepare: (query: string) => DBPreparedStatement;
|
|
22
22
|
dump: () => Promise<ArrayBuffer>;
|
|
23
|
-
exec: (query: string) => Promise<
|
|
24
|
-
batch: <T = unknown>(statements:
|
|
23
|
+
exec: (query: string) => Promise<DBResult>;
|
|
24
|
+
batch: <T = unknown>(statements: DBPreparedStatement[]) => Promise<DBResult<T>[]>;
|
|
25
25
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { Database, DBPreparedStatement, DBResult, DBResultMeta, } from "./db.js";
|
|
2
2
|
export type { QueueBinding, QueueBatchMessage, QueueMessageEvent, QueueSendOptions, QueueSendResult, QueueSendBatchResult, } from "./queue.js";
|
|
3
|
-
export type { WorkflowBinding, WorkflowContext, WorkflowExecution, WorkflowExecutionStatus, WorkflowHandler, WorkflowStep, WorkflowStepOptions, WorkflowTriggerResult, } from "./workflow.js";
|
|
3
|
+
export type { WorkflowBinding, WorkflowContext, WorkflowExecution, WorkflowExecutionStatus, WorkflowHandler, WorkflowHandlerConfig, WorkflowStep, WorkflowStepOptions, WorkflowTriggerResult, } from "./workflow.js";
|
|
4
4
|
export type { TimerHandler, ExecutionContext, FetchHandler, MessageHandler, Ploy, PloyHandler, WorkflowHandlers, } from "./ploy.js";
|
|
5
5
|
export type { TimerBinding, TimerEvent, TimerOptions } from "./timer.js";
|
|
6
6
|
export type { CacheBinding } from "./cache.js";
|
package/dist/ploy.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { QueueMessageEvent } from "./queue.js";
|
|
2
2
|
import type { ScheduledHandler } from "./scheduled.js";
|
|
3
3
|
import type { TimerEvent } from "./timer.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { WorkflowHandlerConfig } from "./workflow.js";
|
|
5
5
|
export type FetchHandler<TEnv = unknown> = (request: Request, env: TEnv, ctx: ExecutionContext) => Response | Promise<Response>;
|
|
6
6
|
export type MessageHandler<TEnv = unknown> = (event: QueueMessageEvent, env: TEnv, ctx: ExecutionContext) => void | Promise<void>;
|
|
7
7
|
export type TimerHandler<TEnv = unknown> = (event: TimerEvent, env: TEnv, ctx: ExecutionContext) => void | Promise<void>;
|
|
@@ -9,7 +9,7 @@ export interface ExecutionContext {
|
|
|
9
9
|
waitUntil: (promise: Promise<unknown>) => void;
|
|
10
10
|
passThroughOnException: () => void;
|
|
11
11
|
}
|
|
12
|
-
export type WorkflowHandlers<TEnv = unknown> = Record<string,
|
|
12
|
+
export type WorkflowHandlers<TEnv = unknown> = Record<string, WorkflowHandlerConfig<TEnv, any, any>>;
|
|
13
13
|
export interface PloyHandler<TEnv = unknown> {
|
|
14
14
|
fetch?: FetchHandler<TEnv>;
|
|
15
15
|
message?: MessageHandler<TEnv>;
|
package/dist/workflow.d.ts
CHANGED
|
@@ -29,3 +29,7 @@ export interface WorkflowContext<TEnv = unknown, TInput = unknown> {
|
|
|
29
29
|
step: WorkflowStep;
|
|
30
30
|
}
|
|
31
31
|
export type WorkflowHandler<TEnv = unknown, TInput = unknown, TOutput = unknown> = (ctx: WorkflowContext<TEnv, TInput>) => Promise<TOutput>;
|
|
32
|
+
export interface WorkflowHandlerConfig<TEnv = unknown, TInput = unknown, TOutput = unknown> {
|
|
33
|
+
handler: WorkflowHandler<TEnv, TInput, TOutput>;
|
|
34
|
+
onError?: (error: Error, ctx: WorkflowContext<TEnv, TInput>) => Promise<void>;
|
|
35
|
+
}
|
package/globals.d.ts
CHANGED
|
@@ -18,10 +18,10 @@ declare global {
|
|
|
18
18
|
type Ploy = PloyHandler<PloyEnv>;
|
|
19
19
|
|
|
20
20
|
// --- Binding types ---
|
|
21
|
-
type
|
|
22
|
-
type
|
|
23
|
-
type
|
|
24
|
-
type
|
|
21
|
+
type Database = import("@meetploy/types").Database;
|
|
22
|
+
type DBPreparedStatement = import("@meetploy/types").DBPreparedStatement;
|
|
23
|
+
type DBResult<T = unknown> = import("@meetploy/types").DBResult<T>;
|
|
24
|
+
type DBResultMeta = import("@meetploy/types").DBResultMeta;
|
|
25
25
|
type CacheBinding = import("@meetploy/types").CacheBinding;
|
|
26
26
|
type QueueBinding = import("@meetploy/types").QueueBinding;
|
|
27
27
|
type StateBinding = import("@meetploy/types").StateBinding;
|