@meetploy/types 1.0.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 +22 -0
- package/dist/db.js +2 -0
- package/dist/db.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/ploy.d.ts +14 -0
- package/dist/ploy.js +2 -0
- package/dist/ploy.js.map +1 -0
- package/dist/queue.d.ts +24 -0
- package/dist/queue.js +2 -0
- package/dist/queue.js.map +1 -0
- package/dist/workflow.d.ts +31 -0
- package/dist/workflow.js +2 -0
- package/dist/workflow.js.map +1 -0
- package/package.json +29 -0
package/dist/db.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface D1ResultMeta {
|
|
2
|
+
duration: number;
|
|
3
|
+
rows_read: number;
|
|
4
|
+
rows_written: number;
|
|
5
|
+
}
|
|
6
|
+
export interface D1Result<T = unknown> {
|
|
7
|
+
results: T[];
|
|
8
|
+
success: boolean;
|
|
9
|
+
meta: D1ResultMeta;
|
|
10
|
+
}
|
|
11
|
+
export interface D1PreparedStatement {
|
|
12
|
+
bind: (...values: unknown[]) => D1PreparedStatement;
|
|
13
|
+
run: <T = unknown>() => Promise<D1Result<T>>;
|
|
14
|
+
all: <T = unknown>() => Promise<D1Result<T>>;
|
|
15
|
+
first: <T = unknown>(colName?: string) => Promise<T | null>;
|
|
16
|
+
raw: <T = unknown>() => Promise<T[][]>;
|
|
17
|
+
}
|
|
18
|
+
export interface D1Database {
|
|
19
|
+
prepare: (query: string) => D1PreparedStatement;
|
|
20
|
+
exec: (query: string) => Promise<D1Result>;
|
|
21
|
+
batch: <T = unknown>(statements: D1PreparedStatement[]) => Promise<D1Result<T>[]>;
|
|
22
|
+
}
|
package/dist/db.js
ADDED
package/dist/db.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { D1Database, D1PreparedStatement, D1Result, D1ResultMeta, } from "./db.js";
|
|
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";
|
|
4
|
+
export type { ExecutionContext, FetchHandler, MessageHandler, Ploy, WorkflowHandlers, } from "./ploy.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/ploy.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { QueueMessageEvent } from "./queue.js";
|
|
2
|
+
import type { WorkflowHandler } from "./workflow.js";
|
|
3
|
+
export type FetchHandler<TEnv = unknown> = (request: Request, env: TEnv, ctx: ExecutionContext) => Response | Promise<Response>;
|
|
4
|
+
export type MessageHandler<TEnv = unknown> = (event: QueueMessageEvent, env: TEnv, ctx: ExecutionContext) => void | Promise<void>;
|
|
5
|
+
export interface ExecutionContext {
|
|
6
|
+
waitUntil: (promise: Promise<unknown>) => void;
|
|
7
|
+
passThroughOnException: () => void;
|
|
8
|
+
}
|
|
9
|
+
export type WorkflowHandlers<TEnv = unknown> = Record<string, WorkflowHandler<TEnv, unknown, unknown>>;
|
|
10
|
+
export interface Ploy<TEnv = unknown> {
|
|
11
|
+
fetch?: FetchHandler<TEnv>;
|
|
12
|
+
message?: MessageHandler<TEnv>;
|
|
13
|
+
workflows?: WorkflowHandlers<TEnv>;
|
|
14
|
+
}
|
package/dist/ploy.js
ADDED
package/dist/ploy.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ploy.js","sourceRoot":"","sources":["../src/ploy.ts"],"names":[],"mappings":""}
|
package/dist/queue.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface QueueSendOptions {
|
|
2
|
+
delaySeconds?: number;
|
|
3
|
+
}
|
|
4
|
+
export interface QueueBatchMessage {
|
|
5
|
+
payload: unknown;
|
|
6
|
+
delaySeconds?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface QueueSendResult {
|
|
9
|
+
messageId: string;
|
|
10
|
+
}
|
|
11
|
+
export interface QueueSendBatchResult {
|
|
12
|
+
messageIds: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface QueueBinding {
|
|
15
|
+
send: (payload: unknown, opts?: QueueSendOptions) => Promise<QueueSendResult>;
|
|
16
|
+
sendBatch: (messages: QueueBatchMessage[]) => Promise<QueueSendBatchResult>;
|
|
17
|
+
}
|
|
18
|
+
export interface QueueMessageEvent {
|
|
19
|
+
id: string;
|
|
20
|
+
queueName: string;
|
|
21
|
+
payload: unknown;
|
|
22
|
+
attempt: number;
|
|
23
|
+
timestamp: Date;
|
|
24
|
+
}
|
package/dist/queue.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type WorkflowExecutionStatus = "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
2
|
+
export interface WorkflowExecution {
|
|
3
|
+
id: string;
|
|
4
|
+
status: WorkflowExecutionStatus;
|
|
5
|
+
input?: unknown;
|
|
6
|
+
output?: unknown;
|
|
7
|
+
errorMessage?: string;
|
|
8
|
+
startedAt?: string;
|
|
9
|
+
completedAt?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface WorkflowTriggerResult {
|
|
12
|
+
executionId: string;
|
|
13
|
+
}
|
|
14
|
+
export interface WorkflowBinding {
|
|
15
|
+
trigger: (input?: unknown) => Promise<WorkflowTriggerResult>;
|
|
16
|
+
getExecution: (id: string) => Promise<WorkflowExecution>;
|
|
17
|
+
cancel: (id: string) => Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export interface WorkflowStepOptions {
|
|
20
|
+
retries?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface WorkflowStep {
|
|
23
|
+
run: <T>(name: string, fn: () => T | Promise<T>, opts?: WorkflowStepOptions) => Promise<T>;
|
|
24
|
+
sleep: (ms: number) => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export interface WorkflowContext<TEnv = unknown, TInput = unknown> {
|
|
27
|
+
input: TInput;
|
|
28
|
+
env: TEnv;
|
|
29
|
+
step: WorkflowStep;
|
|
30
|
+
}
|
|
31
|
+
export type WorkflowHandler<TEnv = unknown, TInput = unknown, TOutput = unknown> = (ctx: WorkflowContext<TEnv, TInput>) => Promise<TOutput>;
|
package/dist/workflow.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@meetploy/types",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/polarlightsllc/ploy.git",
|
|
8
|
+
"directory": "packages/types"
|
|
9
|
+
},
|
|
10
|
+
"license": "SEE LICENSE IN ../../LICENSE",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"module": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist/"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc && resolve-tspaths",
|
|
25
|
+
"dev": "tsc-watch --onSuccess 'resolve-tspaths'",
|
|
26
|
+
"format": "eslint --fix . && prettier --write .",
|
|
27
|
+
"lint": "eslint . && prettier --check ."
|
|
28
|
+
}
|
|
29
|
+
}
|