@meetploy/types 1.6.0 → 1.8.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/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  export type { D1Database, D1PreparedStatement, D1Result, D1ResultMeta, } from "./db.js";
2
2
  export type { QueueBinding, QueueBatchMessage, QueueMessageEvent, QueueSendOptions, QueueSendResult, QueueSendBatchResult, } from "./queue.js";
3
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";
4
+ export type { TimerHandler, ExecutionContext, FetchHandler, MessageHandler, Ploy, PloyHandler, WorkflowHandlers, } from "./ploy.js";
5
+ export type { TimerBinding, TimerEvent, TimerOptions } from "./timer.js";
5
6
  export type { CacheBinding } from "./cache.js";
6
7
  export type { StateBinding } from "./state.js";
7
8
  export type { FileStorageBinding, FileStorageObject, FileStorageKey, FileStorageListResult, FileStoragePutOptions, FileStorageListOptions, } from "./fs.js";
package/dist/ploy.d.ts CHANGED
@@ -1,16 +1,20 @@
1
1
  import type { QueueMessageEvent } from "./queue.js";
2
2
  import type { ScheduledHandler } from "./scheduled.js";
3
+ import type { TimerEvent } from "./timer.js";
3
4
  import type { WorkflowHandler } from "./workflow.js";
4
5
  export type FetchHandler<TEnv = unknown> = (request: Request, env: TEnv, ctx: ExecutionContext) => Response | Promise<Response>;
5
6
  export type MessageHandler<TEnv = unknown> = (event: QueueMessageEvent, env: TEnv, ctx: ExecutionContext) => void | Promise<void>;
7
+ export type TimerHandler<TEnv = unknown> = (event: TimerEvent, env: TEnv, ctx: ExecutionContext) => void | Promise<void>;
6
8
  export interface ExecutionContext {
7
9
  waitUntil: (promise: Promise<unknown>) => void;
8
10
  passThroughOnException: () => void;
9
11
  }
10
12
  export type WorkflowHandlers<TEnv = unknown> = Record<string, WorkflowHandler<TEnv, any, any>>;
11
- export interface Ploy<TEnv = unknown> {
13
+ export interface PloyHandler<TEnv = unknown> {
12
14
  fetch?: FetchHandler<TEnv>;
13
15
  message?: MessageHandler<TEnv>;
16
+ timer?: TimerHandler<TEnv>;
14
17
  workflows?: WorkflowHandlers<TEnv>;
15
18
  scheduled?: ScheduledHandler<TEnv>;
16
19
  }
20
+ export type Ploy<TEnv = unknown> = PloyHandler<TEnv>;
@@ -0,0 +1,20 @@
1
+ export interface TimerOptions {
2
+ payload?: unknown;
3
+ intervalMs?: number;
4
+ }
5
+ export interface TimerBinding {
6
+ set: (id: string, scheduledTime: Date | number, options?: TimerOptions | unknown) => Promise<void>;
7
+ get: (id: string) => Promise<{
8
+ id: string;
9
+ scheduledTime: number;
10
+ payload?: unknown;
11
+ intervalMs?: number;
12
+ } | null>;
13
+ delete: (id: string) => Promise<void>;
14
+ }
15
+ export interface TimerEvent {
16
+ id: string;
17
+ scheduledTime: number;
18
+ payload?: unknown;
19
+ intervalMs?: number;
20
+ }
package/dist/timer.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=timer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timer.js","sourceRoot":"","sources":["../src/timer.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetploy/types",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/dist/alarm.d.ts DELETED
@@ -1,14 +0,0 @@
1
- export interface AlarmBinding {
2
- set: (id: string, scheduledTime: Date | number, payload?: unknown) => Promise<void>;
3
- get: (id: string) => Promise<{
4
- id: string;
5
- scheduledTime: number;
6
- payload?: unknown;
7
- } | null>;
8
- delete: (id: string) => Promise<void>;
9
- }
10
- export interface AlarmEvent {
11
- id: string;
12
- scheduledTime: number;
13
- payload?: unknown;
14
- }
package/dist/alarm.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=alarm.js.map
package/dist/alarm.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"alarm.js","sourceRoot":"","sources":["../src/alarm.ts"],"names":[],"mappings":""}