@opencode/schema 2.1.4 → 2.2.1
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/agent.d.ts +5 -0
- package/dist/config/experimental.d.ts +39 -0
- package/dist/config/experimental.js +19 -0
- package/dist/config/provider.d.ts +57 -11
- package/dist/config/provider.js +15 -16
- package/dist/config.d.ts +1 -0
- package/dist/config.js +3 -0
- package/dist/event-manifest.d.ts +8 -0
- package/dist/file-diff.d.ts +2 -0
- package/dist/file-diff.js +2 -0
- package/dist/generate.d.ts +355 -0
- package/dist/generate.js +134 -0
- package/dist/goal.d.ts +126 -0
- package/dist/goal.js +40 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp.d.ts +1 -0
- package/dist/mcp.js +2 -0
- package/dist/model-compatibility.d.ts +15 -4
- package/dist/model-compatibility.js +15 -4
- package/dist/model.d.ts +39 -8
- package/dist/model.js +12 -7
- package/dist/plugin.d.ts +15 -0
- package/dist/plugin.js +11 -1
- package/dist/prompt.d.ts +96 -0
- package/dist/prompt.js +17 -1
- package/dist/provider.d.ts +40 -0
- package/dist/provider.js +14 -3
- package/dist/schedule.d.ts +220 -0
- package/dist/schedule.js +110 -0
- package/dist/session-event.d.ts +20 -0
- package/dist/session-inbox.d.ts +714 -86
- package/dist/session-inbox.js +10 -1
- package/dist/session-message.d.ts +968 -0
- package/dist/session-message.js +19 -1
- package/dist/session-revert.d.ts +37 -0
- package/dist/session-transfer.d.ts +4 -0
- package/dist/session.d.ts +4 -0
- package/dist/usage-limits.d.ts +227 -0
- package/dist/usage-limits.js +59 -0
- package/dist/vcs.d.ts +3 -0
- package/dist/vcs.js +2 -0
- package/package.json +2 -1
package/dist/provider.d.ts
CHANGED
|
@@ -95,6 +95,14 @@ export type Compaction = typeof Compaction.Type;
|
|
|
95
95
|
/** "websocket" on a route without a WebSocket channel warns and falls back to HTTP. */
|
|
96
96
|
export declare const Transport: Schema.Literals<readonly ["http", "websocket"]>;
|
|
97
97
|
export type Transport = typeof Transport.Type;
|
|
98
|
+
/** Prompt-cache lifetime such as "5m", "30m", "1h" or "24h", in models.dev's duration format. */
|
|
99
|
+
export declare const CacheTTL: Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>;
|
|
100
|
+
export type CacheTTL = typeof CacheTTL.Type;
|
|
101
|
+
/** Prompt-cache settings. `ttl` is sent to the provider as given; each provider accepts its own set. */
|
|
102
|
+
export declare const Cache: Schema.Struct<{
|
|
103
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
104
|
+
}>;
|
|
105
|
+
export type Cache = typeof Cache.Type;
|
|
98
106
|
/** HTTP request body compression; only endpoints known to decode it should enable it. */
|
|
99
107
|
export declare const Encoding: Schema.Literals<readonly ["zstd", "gzip", "none"]>;
|
|
100
108
|
export type Encoding = typeof Encoding.Type;
|
|
@@ -111,6 +119,11 @@ export declare const Settings: Schema.StructWithRest<Schema.Struct<{
|
|
|
111
119
|
}>, Schema.Struct<{
|
|
112
120
|
readonly type: Schema.Literal<"native">;
|
|
113
121
|
}>]>>, never, never>;
|
|
122
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
123
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
124
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
125
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
126
|
+
}>>, never, never>;
|
|
114
127
|
readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
|
|
115
128
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
116
129
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>;
|
|
@@ -129,6 +142,11 @@ export declare const Overlays: {
|
|
|
129
142
|
}>, Schema.Struct<{
|
|
130
143
|
readonly type: Schema.Literal<"native">;
|
|
131
144
|
}>]>>, never, never>;
|
|
145
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
146
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
147
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
148
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
149
|
+
}>>, never, never>;
|
|
132
150
|
readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
|
|
133
151
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
134
152
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>>, Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
|
|
@@ -144,6 +162,11 @@ export declare const Overlays: {
|
|
|
144
162
|
}>, Schema.Struct<{
|
|
145
163
|
readonly type: Schema.Literal<"native">;
|
|
146
164
|
}>]>>, never, never>;
|
|
165
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
166
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
167
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
168
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
169
|
+
}>>, never, never>;
|
|
147
170
|
readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
|
|
148
171
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
149
172
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>, never, never>;
|
|
@@ -166,6 +189,11 @@ export declare const Request: Schema.Struct<{
|
|
|
166
189
|
}>, Schema.Struct<{
|
|
167
190
|
readonly type: Schema.Literal<"native">;
|
|
168
191
|
}>]>>, never, never>;
|
|
192
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
193
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
194
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
195
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
196
|
+
}>>, never, never>;
|
|
169
197
|
readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
|
|
170
198
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
171
199
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>;
|
|
@@ -188,6 +216,11 @@ export declare const Info: Schema.Struct<{
|
|
|
188
216
|
}>, Schema.Struct<{
|
|
189
217
|
readonly type: Schema.Literal<"native">;
|
|
190
218
|
}>]>>, never, never>;
|
|
219
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
220
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
221
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
222
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
223
|
+
}>>, never, never>;
|
|
191
224
|
readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
|
|
192
225
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
193
226
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>>, Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
|
|
@@ -203,6 +236,11 @@ export declare const Info: Schema.Struct<{
|
|
|
203
236
|
}>, Schema.Struct<{
|
|
204
237
|
readonly type: Schema.Literal<"native">;
|
|
205
238
|
}>]>>, never, never>;
|
|
239
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
240
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
241
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
242
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
243
|
+
}>>, never, never>;
|
|
206
244
|
readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
|
|
207
245
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
208
246
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>, never, never>;
|
|
@@ -260,6 +298,7 @@ export declare const Info: Schema.Struct<{
|
|
|
260
298
|
readonly supportsPromptCacheKey: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
261
299
|
readonly streamUsage: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
262
300
|
readonly cacheFormat: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["anthropic", "alibaba"]>>>, Schema.optionalKey<Schema.Literals<readonly ["anthropic", "alibaba"]>>, never, never>;
|
|
301
|
+
readonly mediaInput: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["assets", "state", "root"]>>>, Schema.optionalKey<Schema.Literals<readonly ["assets", "state", "root"]>>, never, never>;
|
|
263
302
|
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
264
303
|
readonly reasoningField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<import("./model-compatibility.js").ReasoningField, import("./model-compatibility.js").ReasoningField, never, never>>>, Schema.optionalKey<Schema.Codec<import("./model-compatibility.js").ReasoningField, import("./model-compatibility.js").ReasoningField, never, never>>, never, never>;
|
|
265
304
|
readonly requireReasoning: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
@@ -269,6 +308,7 @@ export declare const Info: Schema.Struct<{
|
|
|
269
308
|
readonly supportsPromptCacheKey: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
270
309
|
readonly streamUsage: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
271
310
|
readonly cacheFormat: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["anthropic", "alibaba"]>>>, Schema.optionalKey<Schema.Literals<readonly ["anthropic", "alibaba"]>>, never, never>;
|
|
311
|
+
readonly mediaInput: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["assets", "state", "root"]>>>, Schema.optionalKey<Schema.Literals<readonly ["assets", "state", "root"]>>, never, never>;
|
|
272
312
|
}>>, never, never>;
|
|
273
313
|
}> & {
|
|
274
314
|
empty: (id: ID) => Info;
|
package/dist/provider.js
CHANGED
|
@@ -29,13 +29,24 @@ export const Compaction = Schema.Union([
|
|
|
29
29
|
.annotate({ identifier: "Provider.Compaction" });
|
|
30
30
|
/** "websocket" on a route without a WebSocket channel warns and falls back to HTTP. */
|
|
31
31
|
export const Transport = Schema.Literals(["http", "websocket"]).annotate({ identifier: "Provider.Transport" });
|
|
32
|
+
/** Prompt-cache lifetime such as "5m", "30m", "1h" or "24h", in models.dev's duration format. */
|
|
33
|
+
export const CacheTTL = Schema.TemplateLiteral([Schema.Number, Schema.Literals(["ms", "s", "m", "h", "d"])])
|
|
34
|
+
.check(Schema.isPattern(/^\d+(ms|s|m|h|d)$/))
|
|
35
|
+
.annotate({ identifier: "Provider.CacheTTL" });
|
|
36
|
+
/** Prompt-cache settings. `ttl` is sent to the provider as given; each provider accepts its own set. */
|
|
37
|
+
export const Cache = Schema.Struct({
|
|
38
|
+
ttl: CacheTTL.pipe(optional),
|
|
39
|
+
}).annotate({ identifier: "Provider.Cache" });
|
|
32
40
|
/** HTTP request body compression; only endpoints known to decode it should enable it. */
|
|
33
41
|
export const Encoding = Schema.Literals(["zstd", "gzip", "none"]).annotate({ identifier: "Provider.Encoding" });
|
|
42
|
+
const Timeout = Schema.Union([Schema.Finite, Schema.Literal(false)]).pipe(optional);
|
|
43
|
+
// The named fields are the settings OpenCode reads itself; every other key is a provider option for the provider package.
|
|
34
44
|
export const Settings = Schema.StructWithRest(Schema.Struct({
|
|
35
|
-
timeout:
|
|
36
|
-
headerTimeout:
|
|
37
|
-
chunkTimeout:
|
|
45
|
+
timeout: Timeout,
|
|
46
|
+
headerTimeout: Timeout,
|
|
47
|
+
chunkTimeout: Timeout,
|
|
38
48
|
compaction: Compaction.pipe(optional),
|
|
49
|
+
cache: Cache.pipe(optional),
|
|
39
50
|
transport: Transport.pipe(optional),
|
|
40
51
|
encoding: Encoding.pipe(optional),
|
|
41
52
|
}), [Schema.Record(Schema.String, Schema.Any)]).annotate({ identifier: "Provider.Settings" });
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
export * as Schedule from "./schedule.js";
|
|
2
|
+
import { Option, Schema } from "effect";
|
|
3
|
+
import { SessionID } from "./session-id.js";
|
|
4
|
+
export declare const ID: Schema.brand<Schema.String, "Schedule.ID"> & {
|
|
5
|
+
create: () => string & import("effect/Brand").Brand<"Schedule.ID">;
|
|
6
|
+
};
|
|
7
|
+
export type ID = typeof ID.Type;
|
|
8
|
+
/** Milliseconds in a duration string, or `None` when it is not one. */
|
|
9
|
+
export declare const durationMillis: (value: string) => Option.Option<number>;
|
|
10
|
+
/** A duration such as "90 seconds", "5 minutes" or "2 hours". The service validates it, since clients cannot run a custom check. */
|
|
11
|
+
export declare const DurationString: Schema.String;
|
|
12
|
+
export declare const In: Schema.Struct<{
|
|
13
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
14
|
+
readonly type: Schema.tag<"in">;
|
|
15
|
+
readonly in: Schema.String;
|
|
16
|
+
}>;
|
|
17
|
+
/** An instant with an offset, or a wall-clock time in `tz`, e.g. "2026-10-27T09:00". */
|
|
18
|
+
export declare const At: Schema.Struct<{
|
|
19
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
20
|
+
readonly type: Schema.tag<"at">;
|
|
21
|
+
readonly at: Schema.String;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const Every: Schema.Struct<{
|
|
24
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
25
|
+
readonly type: Schema.tag<"every">;
|
|
26
|
+
readonly every: Schema.String;
|
|
27
|
+
}>;
|
|
28
|
+
export declare const Cron: Schema.Struct<{
|
|
29
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
30
|
+
readonly type: Schema.tag<"cron">;
|
|
31
|
+
readonly cron: Schema.String;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const When: Schema.Union<readonly [Schema.Struct<{
|
|
34
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
35
|
+
readonly type: Schema.tag<"in">;
|
|
36
|
+
readonly in: Schema.String;
|
|
37
|
+
}>, Schema.Struct<{
|
|
38
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
39
|
+
readonly type: Schema.tag<"at">;
|
|
40
|
+
readonly at: Schema.String;
|
|
41
|
+
}>, Schema.Struct<{
|
|
42
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
43
|
+
readonly type: Schema.tag<"every">;
|
|
44
|
+
readonly every: Schema.String;
|
|
45
|
+
}>, Schema.Struct<{
|
|
46
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
47
|
+
readonly type: Schema.tag<"cron">;
|
|
48
|
+
readonly cron: Schema.String;
|
|
49
|
+
}>]>;
|
|
50
|
+
export type When = typeof When.Type;
|
|
51
|
+
/** Stops a repeating schedule at whichever limit comes first. */
|
|
52
|
+
export declare const Ends: Schema.Struct<{
|
|
53
|
+
readonly after: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
54
|
+
readonly at: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
55
|
+
readonly times: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
56
|
+
}>;
|
|
57
|
+
export type Ends = typeof Ends.Type;
|
|
58
|
+
export declare const PromptAction: Schema.Struct<{
|
|
59
|
+
readonly type: Schema.tag<"prompt">;
|
|
60
|
+
readonly prompt: Schema.String;
|
|
61
|
+
}>;
|
|
62
|
+
export declare const Action: Schema.Union<readonly [Schema.Struct<{
|
|
63
|
+
readonly type: Schema.tag<"prompt">;
|
|
64
|
+
readonly prompt: Schema.String;
|
|
65
|
+
}>]>;
|
|
66
|
+
export type Action = typeof Action.Type;
|
|
67
|
+
export declare const Status: Schema.Literals<readonly ["active", "paused", "done"]>;
|
|
68
|
+
export type Status = typeof Status.Type;
|
|
69
|
+
export declare const Outcome: Schema.Literals<readonly ["fired", "late", "skipped", "disabled", "failed"]>;
|
|
70
|
+
export type Outcome = typeof Outcome.Type;
|
|
71
|
+
export declare const Info: Schema.Struct<{
|
|
72
|
+
readonly id: Schema.brand<Schema.String, "Schedule.ID"> & {
|
|
73
|
+
create: () => string & import("effect/Brand").Brand<"Schedule.ID">;
|
|
74
|
+
};
|
|
75
|
+
readonly sessionID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "SessionID"> & {
|
|
76
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
77
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "SessionID"> & {
|
|
78
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
79
|
+
}>, never, never>;
|
|
80
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
81
|
+
readonly when: Schema.Union<readonly [Schema.Struct<{
|
|
82
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
83
|
+
readonly type: Schema.tag<"in">;
|
|
84
|
+
readonly in: Schema.String;
|
|
85
|
+
}>, Schema.Struct<{
|
|
86
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
87
|
+
readonly type: Schema.tag<"at">;
|
|
88
|
+
readonly at: Schema.String;
|
|
89
|
+
}>, Schema.Struct<{
|
|
90
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
91
|
+
readonly type: Schema.tag<"every">;
|
|
92
|
+
readonly every: Schema.String;
|
|
93
|
+
}>, Schema.Struct<{
|
|
94
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
95
|
+
readonly type: Schema.tag<"cron">;
|
|
96
|
+
readonly cron: Schema.String;
|
|
97
|
+
}>]>;
|
|
98
|
+
readonly tz: Schema.String;
|
|
99
|
+
readonly action: Schema.Union<readonly [Schema.Struct<{
|
|
100
|
+
readonly type: Schema.tag<"prompt">;
|
|
101
|
+
readonly prompt: Schema.String;
|
|
102
|
+
}>]>;
|
|
103
|
+
readonly status: Schema.Literals<readonly ["active", "paused", "done"]>;
|
|
104
|
+
readonly nextDueAt: Schema.decodeTo<Schema.optional<Schema.toType<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>>, Schema.optionalKey<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>, never, never>;
|
|
105
|
+
readonly endsAt: Schema.decodeTo<Schema.optional<Schema.toType<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>>, Schema.optionalKey<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>, never, never>;
|
|
106
|
+
readonly remainingRuns: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
107
|
+
readonly runCount: Schema.Int;
|
|
108
|
+
readonly lastFiredAt: Schema.decodeTo<Schema.optional<Schema.toType<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>>, Schema.optionalKey<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>, never, never>;
|
|
109
|
+
readonly lastOutcome: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["fired", "late", "skipped", "disabled", "failed"]>>>, Schema.optionalKey<Schema.Literals<readonly ["fired", "late", "skipped", "disabled", "failed"]>>, never, never>;
|
|
110
|
+
readonly time: Schema.Struct<{
|
|
111
|
+
readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
112
|
+
readonly updated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
113
|
+
}>;
|
|
114
|
+
}>;
|
|
115
|
+
export type Info = typeof Info.Type;
|
|
116
|
+
export declare const CreateInput: Schema.Struct<{
|
|
117
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
118
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
119
|
+
};
|
|
120
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
121
|
+
readonly when: Schema.Union<readonly [Schema.Struct<{
|
|
122
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
123
|
+
readonly type: Schema.tag<"in">;
|
|
124
|
+
readonly in: Schema.String;
|
|
125
|
+
}>, Schema.Struct<{
|
|
126
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
127
|
+
readonly type: Schema.tag<"at">;
|
|
128
|
+
readonly at: Schema.String;
|
|
129
|
+
}>, Schema.Struct<{
|
|
130
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
131
|
+
readonly type: Schema.tag<"every">;
|
|
132
|
+
readonly every: Schema.String;
|
|
133
|
+
}>, Schema.Struct<{
|
|
134
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
135
|
+
readonly type: Schema.tag<"cron">;
|
|
136
|
+
readonly cron: Schema.String;
|
|
137
|
+
}>]>;
|
|
138
|
+
readonly ends: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
139
|
+
readonly after: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
140
|
+
readonly at: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
141
|
+
readonly times: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
142
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
143
|
+
readonly after: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
144
|
+
readonly at: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
145
|
+
readonly times: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
146
|
+
}>>, never, never>;
|
|
147
|
+
readonly action: Schema.Union<readonly [Schema.Struct<{
|
|
148
|
+
readonly type: Schema.tag<"prompt">;
|
|
149
|
+
readonly prompt: Schema.String;
|
|
150
|
+
}>]>;
|
|
151
|
+
}>;
|
|
152
|
+
export type CreateInput = typeof CreateInput.Type;
|
|
153
|
+
/** The `when` callers write: exactly one of `in`, `at`, `every` or `cron`, with an optional `tz`. */
|
|
154
|
+
export declare const WhenInput: Schema.Union<readonly [Schema.Struct<{
|
|
155
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
156
|
+
readonly in: Schema.String;
|
|
157
|
+
readonly at: Schema.optionalKey<Schema.Never>;
|
|
158
|
+
readonly every: Schema.optionalKey<Schema.Never>;
|
|
159
|
+
readonly cron: Schema.optionalKey<Schema.Never>;
|
|
160
|
+
}>, Schema.Struct<{
|
|
161
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
162
|
+
readonly at: Schema.String;
|
|
163
|
+
readonly in: Schema.optionalKey<Schema.Never>;
|
|
164
|
+
readonly every: Schema.optionalKey<Schema.Never>;
|
|
165
|
+
readonly cron: Schema.optionalKey<Schema.Never>;
|
|
166
|
+
}>, Schema.Struct<{
|
|
167
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
168
|
+
readonly every: Schema.String;
|
|
169
|
+
readonly in: Schema.optionalKey<Schema.Never>;
|
|
170
|
+
readonly at: Schema.optionalKey<Schema.Never>;
|
|
171
|
+
readonly cron: Schema.optionalKey<Schema.Never>;
|
|
172
|
+
}>, Schema.Struct<{
|
|
173
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
174
|
+
readonly cron: Schema.String;
|
|
175
|
+
readonly in: Schema.optionalKey<Schema.Never>;
|
|
176
|
+
readonly at: Schema.optionalKey<Schema.Never>;
|
|
177
|
+
readonly every: Schema.optionalKey<Schema.Never>;
|
|
178
|
+
}>]>;
|
|
179
|
+
export type WhenInput = typeof WhenInput.Type;
|
|
180
|
+
/** A schedule as callers describe it: when it fires, when it stops, and the prompt it wakes the Session with. */
|
|
181
|
+
export declare const Request: Schema.Struct<{
|
|
182
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
183
|
+
readonly when: Schema.Union<readonly [Schema.Struct<{
|
|
184
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
185
|
+
readonly in: Schema.String;
|
|
186
|
+
readonly at: Schema.optionalKey<Schema.Never>;
|
|
187
|
+
readonly every: Schema.optionalKey<Schema.Never>;
|
|
188
|
+
readonly cron: Schema.optionalKey<Schema.Never>;
|
|
189
|
+
}>, Schema.Struct<{
|
|
190
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
191
|
+
readonly at: Schema.String;
|
|
192
|
+
readonly in: Schema.optionalKey<Schema.Never>;
|
|
193
|
+
readonly every: Schema.optionalKey<Schema.Never>;
|
|
194
|
+
readonly cron: Schema.optionalKey<Schema.Never>;
|
|
195
|
+
}>, Schema.Struct<{
|
|
196
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
197
|
+
readonly every: Schema.String;
|
|
198
|
+
readonly in: Schema.optionalKey<Schema.Never>;
|
|
199
|
+
readonly at: Schema.optionalKey<Schema.Never>;
|
|
200
|
+
readonly cron: Schema.optionalKey<Schema.Never>;
|
|
201
|
+
}>, Schema.Struct<{
|
|
202
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
203
|
+
readonly cron: Schema.String;
|
|
204
|
+
readonly in: Schema.optionalKey<Schema.Never>;
|
|
205
|
+
readonly at: Schema.optionalKey<Schema.Never>;
|
|
206
|
+
readonly every: Schema.optionalKey<Schema.Never>;
|
|
207
|
+
}>]>;
|
|
208
|
+
readonly ends: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
209
|
+
readonly after: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
210
|
+
readonly at: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
211
|
+
readonly times: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
212
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
213
|
+
readonly after: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
214
|
+
readonly at: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
215
|
+
readonly times: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
216
|
+
}>>, never, never>;
|
|
217
|
+
readonly prompt: Schema.String;
|
|
218
|
+
}>;
|
|
219
|
+
export type Request = typeof Request.Type;
|
|
220
|
+
export declare const toCreateInput: (sessionID: SessionID, request: Request) => CreateInput;
|
package/dist/schedule.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export * as Schedule from "./schedule.js";
|
|
2
|
+
import { Duration, Option, Schema } from "effect";
|
|
3
|
+
import { ascending } from "./identifier.js";
|
|
4
|
+
import { DateTimeUtcFromMillis, NonNegativeInt, PositiveInt, optional, statics } from "./schema.js";
|
|
5
|
+
import { SessionID } from "./session-id.js";
|
|
6
|
+
export const ID = Schema.String.check(Schema.isStartingWith("sch_")).pipe(Schema.brand("Schedule.ID"), Schema.annotate({ identifier: "Schedule.ID" }), statics((schema) => ({
|
|
7
|
+
create: () => schema.make("sch_" + ascending()),
|
|
8
|
+
})));
|
|
9
|
+
const decodeDuration = Schema.decodeUnknownOption(Schema.DurationFromString);
|
|
10
|
+
/** Milliseconds in a duration string, or `None` when it is not one. */
|
|
11
|
+
export const durationMillis = (value) => decodeDuration(value).pipe(Option.map(Duration.toMillis));
|
|
12
|
+
/** A duration such as "90 seconds", "5 minutes" or "2 hours". The service validates it, since clients cannot run a custom check. */
|
|
13
|
+
export const DurationString = Schema.String.annotate({
|
|
14
|
+
identifier: "Schedule.Duration",
|
|
15
|
+
description: 'A duration such as "90 seconds", "5 minutes" or "2 hours".',
|
|
16
|
+
});
|
|
17
|
+
const zone = {
|
|
18
|
+
tz: Schema.String.pipe(optional).annotate({
|
|
19
|
+
description: "IANA time zone. Defaults to the configured timezone, then the server's local zone.",
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
export const In = Schema.Struct({ type: Schema.tag("in"), in: DurationString, ...zone }).annotate({
|
|
23
|
+
identifier: "Schedule.When.In",
|
|
24
|
+
});
|
|
25
|
+
/** An instant with an offset, or a wall-clock time in `tz`, e.g. "2026-10-27T09:00". */
|
|
26
|
+
export const At = Schema.Struct({ type: Schema.tag("at"), at: Schema.String, ...zone }).annotate({
|
|
27
|
+
identifier: "Schedule.When.At",
|
|
28
|
+
});
|
|
29
|
+
export const Every = Schema.Struct({ type: Schema.tag("every"), every: DurationString, ...zone }).annotate({
|
|
30
|
+
identifier: "Schedule.When.Every",
|
|
31
|
+
});
|
|
32
|
+
export const Cron = Schema.Struct({ type: Schema.tag("cron"), cron: Schema.String, ...zone }).annotate({
|
|
33
|
+
identifier: "Schedule.When.Cron",
|
|
34
|
+
});
|
|
35
|
+
export const When = Schema.Union([In, At, Every, Cron]).pipe(Schema.toTaggedUnion("type"), Schema.annotate({ identifier: "Schedule.When" }));
|
|
36
|
+
/** Stops a repeating schedule at whichever limit comes first. */
|
|
37
|
+
export const Ends = Schema.Struct({
|
|
38
|
+
after: DurationString.pipe(optional),
|
|
39
|
+
at: Schema.String.pipe(optional),
|
|
40
|
+
times: PositiveInt.pipe(optional),
|
|
41
|
+
}).annotate({ identifier: "Schedule.Ends" });
|
|
42
|
+
export const PromptAction = Schema.Struct({ type: Schema.tag("prompt"), prompt: Schema.String }).annotate({
|
|
43
|
+
identifier: "Schedule.Action.Prompt",
|
|
44
|
+
});
|
|
45
|
+
export const Action = Schema.Union([PromptAction]).pipe(Schema.toTaggedUnion("type"), Schema.annotate({ identifier: "Schedule.Action" }));
|
|
46
|
+
export const Status = Schema.Literals(["active", "paused", "done"]).annotate({ identifier: "Schedule.Status" });
|
|
47
|
+
export const Outcome = Schema.Literals(["fired", "late", "skipped", "disabled", "failed"]).annotate({
|
|
48
|
+
identifier: "Schedule.Outcome",
|
|
49
|
+
});
|
|
50
|
+
export const Info = Schema.Struct({
|
|
51
|
+
id: ID,
|
|
52
|
+
sessionID: SessionID.pipe(optional),
|
|
53
|
+
name: Schema.String.pipe(optional),
|
|
54
|
+
when: When,
|
|
55
|
+
tz: Schema.String,
|
|
56
|
+
action: Action,
|
|
57
|
+
status: Status,
|
|
58
|
+
nextDueAt: DateTimeUtcFromMillis.pipe(optional),
|
|
59
|
+
endsAt: DateTimeUtcFromMillis.pipe(optional),
|
|
60
|
+
remainingRuns: NonNegativeInt.pipe(optional),
|
|
61
|
+
runCount: NonNegativeInt,
|
|
62
|
+
lastFiredAt: DateTimeUtcFromMillis.pipe(optional),
|
|
63
|
+
lastOutcome: Outcome.pipe(optional),
|
|
64
|
+
time: Schema.Struct({ created: DateTimeUtcFromMillis, updated: DateTimeUtcFromMillis }),
|
|
65
|
+
}).annotate({ identifier: "Schedule.Info" });
|
|
66
|
+
export const CreateInput = Schema.Struct({
|
|
67
|
+
sessionID: SessionID,
|
|
68
|
+
name: Schema.String.pipe(optional),
|
|
69
|
+
when: When,
|
|
70
|
+
ends: Ends.pipe(optional),
|
|
71
|
+
action: Action,
|
|
72
|
+
}).annotate({ identifier: "Schedule.CreateInput" });
|
|
73
|
+
/** Declares a trigger absent, so `{ in, every }` fails instead of decoding as a one-shot. */
|
|
74
|
+
const absent = Schema.optionalKey(Schema.Never);
|
|
75
|
+
/** The `when` callers write: exactly one of `in`, `at`, `every` or `cron`, with an optional `tz`. */
|
|
76
|
+
export const WhenInput = Schema.Union([
|
|
77
|
+
Schema.Struct({ in: In.fields.in, at: absent, every: absent, cron: absent, ...zone }),
|
|
78
|
+
Schema.Struct({ at: At.fields.at, in: absent, every: absent, cron: absent, ...zone }),
|
|
79
|
+
Schema.Struct({ every: Every.fields.every, in: absent, at: absent, cron: absent, ...zone }),
|
|
80
|
+
Schema.Struct({ cron: Cron.fields.cron, in: absent, at: absent, every: absent, ...zone }),
|
|
81
|
+
]).annotate({ identifier: "Schedule.WhenInput" });
|
|
82
|
+
/** A schedule as callers describe it: when it fires, when it stops, and the prompt it wakes the Session with. */
|
|
83
|
+
export const Request = Schema.Struct({
|
|
84
|
+
name: Schema.String.pipe(optional).annotate({ description: "A short label for the schedule." }),
|
|
85
|
+
when: WhenInput.annotate({
|
|
86
|
+
description: 'When it fires: { in: "20 minutes" }, { at: "2026-10-27T09:00" }, { every: "1 hour" } or { cron: "0 9 * * 1-5" }. Wall-clock times use tz.',
|
|
87
|
+
}),
|
|
88
|
+
ends: Ends.pipe(optional).annotate({
|
|
89
|
+
description: 'Stops a repeating schedule at the first limit reached: { after: "8 hours" }, { at }, { times: 3 }.',
|
|
90
|
+
}),
|
|
91
|
+
prompt: Schema.String.check(Schema.isMinLength(1)).annotate({
|
|
92
|
+
description: "The message the Session receives each time the schedule fires.",
|
|
93
|
+
}),
|
|
94
|
+
}).annotate({ identifier: "Schedule.Request" });
|
|
95
|
+
export const toCreateInput = (sessionID, request) => ({
|
|
96
|
+
sessionID,
|
|
97
|
+
name: request.name,
|
|
98
|
+
when: toWhen(request.when),
|
|
99
|
+
ends: request.ends,
|
|
100
|
+
action: { type: "prompt", prompt: request.prompt },
|
|
101
|
+
});
|
|
102
|
+
const toWhen = (when) => {
|
|
103
|
+
if (when.in !== undefined)
|
|
104
|
+
return { type: "in", in: when.in, tz: when.tz };
|
|
105
|
+
if (when.at !== undefined)
|
|
106
|
+
return { type: "at", at: when.at, tz: when.tz };
|
|
107
|
+
if (when.every !== undefined)
|
|
108
|
+
return { type: "every", every: when.every, tz: when.tz };
|
|
109
|
+
return { type: "cron", cron: when.cron, tz: when.tz };
|
|
110
|
+
};
|
package/dist/session-event.d.ts
CHANGED
|
@@ -4357,12 +4357,14 @@ export declare namespace RevertEvent {
|
|
|
4357
4357
|
readonly additions: Schema.Int;
|
|
4358
4358
|
readonly deletions: Schema.Int;
|
|
4359
4359
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
4360
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
4360
4361
|
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
4361
4362
|
readonly file: Schema.String;
|
|
4362
4363
|
readonly patch: Schema.String;
|
|
4363
4364
|
readonly additions: Schema.Int;
|
|
4364
4365
|
readonly deletions: Schema.Int;
|
|
4365
4366
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
4367
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
4366
4368
|
}>>>, never, never>;
|
|
4367
4369
|
}>;
|
|
4368
4370
|
}>;
|
|
@@ -4390,12 +4392,14 @@ export declare namespace RevertEvent {
|
|
|
4390
4392
|
readonly additions: Schema.Int;
|
|
4391
4393
|
readonly deletions: Schema.Int;
|
|
4392
4394
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
4395
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
4393
4396
|
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
4394
4397
|
readonly file: Schema.String;
|
|
4395
4398
|
readonly patch: Schema.String;
|
|
4396
4399
|
readonly additions: Schema.Int;
|
|
4397
4400
|
readonly deletions: Schema.Int;
|
|
4398
4401
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
4402
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
4399
4403
|
}>>>, never, never>;
|
|
4400
4404
|
}>;
|
|
4401
4405
|
}>;
|
|
@@ -8447,12 +8451,14 @@ export declare const Definitions: readonly [Schema.Struct<{
|
|
|
8447
8451
|
readonly additions: Schema.Int;
|
|
8448
8452
|
readonly deletions: Schema.Int;
|
|
8449
8453
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
8454
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
8450
8455
|
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
8451
8456
|
readonly file: Schema.String;
|
|
8452
8457
|
readonly patch: Schema.String;
|
|
8453
8458
|
readonly additions: Schema.Int;
|
|
8454
8459
|
readonly deletions: Schema.Int;
|
|
8455
8460
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
8461
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
8456
8462
|
}>>>, never, never>;
|
|
8457
8463
|
}>;
|
|
8458
8464
|
}>;
|
|
@@ -8480,12 +8486,14 @@ export declare const Definitions: readonly [Schema.Struct<{
|
|
|
8480
8486
|
readonly additions: Schema.Int;
|
|
8481
8487
|
readonly deletions: Schema.Int;
|
|
8482
8488
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
8489
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
8483
8490
|
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
8484
8491
|
readonly file: Schema.String;
|
|
8485
8492
|
readonly patch: Schema.String;
|
|
8486
8493
|
readonly additions: Schema.Int;
|
|
8487
8494
|
readonly deletions: Schema.Int;
|
|
8488
8495
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
8496
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
8489
8497
|
}>>>, never, never>;
|
|
8490
8498
|
}>;
|
|
8491
8499
|
}>;
|
|
@@ -11038,12 +11046,14 @@ export declare const DurableDefinitions: readonly [...((Schema.Struct<{
|
|
|
11038
11046
|
readonly additions: Schema.Int;
|
|
11039
11047
|
readonly deletions: Schema.Int;
|
|
11040
11048
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
11049
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
11041
11050
|
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
11042
11051
|
readonly file: Schema.String;
|
|
11043
11052
|
readonly patch: Schema.String;
|
|
11044
11053
|
readonly additions: Schema.Int;
|
|
11045
11054
|
readonly deletions: Schema.Int;
|
|
11046
11055
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
11056
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
11047
11057
|
}>>>, never, never>;
|
|
11048
11058
|
}>;
|
|
11049
11059
|
}>;
|
|
@@ -11071,12 +11081,14 @@ export declare const DurableDefinitions: readonly [...((Schema.Struct<{
|
|
|
11071
11081
|
readonly additions: Schema.Int;
|
|
11072
11082
|
readonly deletions: Schema.Int;
|
|
11073
11083
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
11084
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
11074
11085
|
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
11075
11086
|
readonly file: Schema.String;
|
|
11076
11087
|
readonly patch: Schema.String;
|
|
11077
11088
|
readonly additions: Schema.Int;
|
|
11078
11089
|
readonly deletions: Schema.Int;
|
|
11079
11090
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
11091
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
11080
11092
|
}>>>, never, never>;
|
|
11081
11093
|
}>;
|
|
11082
11094
|
}>;
|
|
@@ -15416,12 +15428,14 @@ export declare const Durable: Schema.toTaggedUnion<"type", readonly [...((Schema
|
|
|
15416
15428
|
readonly additions: Schema.Int;
|
|
15417
15429
|
readonly deletions: Schema.Int;
|
|
15418
15430
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
15431
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
15419
15432
|
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
15420
15433
|
readonly file: Schema.String;
|
|
15421
15434
|
readonly patch: Schema.String;
|
|
15422
15435
|
readonly additions: Schema.Int;
|
|
15423
15436
|
readonly deletions: Schema.Int;
|
|
15424
15437
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
15438
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
15425
15439
|
}>>>, never, never>;
|
|
15426
15440
|
}>;
|
|
15427
15441
|
}>;
|
|
@@ -15449,12 +15463,14 @@ export declare const Durable: Schema.toTaggedUnion<"type", readonly [...((Schema
|
|
|
15449
15463
|
readonly additions: Schema.Int;
|
|
15450
15464
|
readonly deletions: Schema.Int;
|
|
15451
15465
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
15466
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
15452
15467
|
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
15453
15468
|
readonly file: Schema.String;
|
|
15454
15469
|
readonly patch: Schema.String;
|
|
15455
15470
|
readonly additions: Schema.Int;
|
|
15456
15471
|
readonly deletions: Schema.Int;
|
|
15457
15472
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
15473
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
15458
15474
|
}>>>, never, never>;
|
|
15459
15475
|
}>;
|
|
15460
15476
|
}>;
|
|
@@ -19480,12 +19496,14 @@ export declare const All: Schema.toTaggedUnion<"type", readonly [Schema.toTagged
|
|
|
19480
19496
|
readonly additions: Schema.Int;
|
|
19481
19497
|
readonly deletions: Schema.Int;
|
|
19482
19498
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
19499
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
19483
19500
|
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
19484
19501
|
readonly file: Schema.String;
|
|
19485
19502
|
readonly patch: Schema.String;
|
|
19486
19503
|
readonly additions: Schema.Int;
|
|
19487
19504
|
readonly deletions: Schema.Int;
|
|
19488
19505
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
19506
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
19489
19507
|
}>>>, never, never>;
|
|
19490
19508
|
}>;
|
|
19491
19509
|
}>;
|
|
@@ -19513,12 +19531,14 @@ export declare const All: Schema.toTaggedUnion<"type", readonly [Schema.toTagged
|
|
|
19513
19531
|
readonly additions: Schema.Int;
|
|
19514
19532
|
readonly deletions: Schema.Int;
|
|
19515
19533
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
19534
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
19516
19535
|
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
19517
19536
|
readonly file: Schema.String;
|
|
19518
19537
|
readonly patch: Schema.String;
|
|
19519
19538
|
readonly additions: Schema.Int;
|
|
19520
19539
|
readonly deletions: Schema.Int;
|
|
19521
19540
|
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
19541
|
+
readonly more: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
19522
19542
|
}>>>, never, never>;
|
|
19523
19543
|
}>;
|
|
19524
19544
|
}>;
|