@opencode/schema 0.0.0-dev-1348 → 0.0.0-dev-1350
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/event-manifest.d.ts +64 -0
- package/dist/event-manifest.js +2 -1
- package/dist/push.d.ts +173 -0
- package/dist/push.js +56 -0
- package/package.json +1 -1
package/dist/event-manifest.d.ts
CHANGED
|
@@ -6120,6 +6120,38 @@ export declare const ServerDefinitions: readonly [Schema.Struct<{
|
|
|
6120
6120
|
durability: "ephemeral";
|
|
6121
6121
|
durable: undefined;
|
|
6122
6122
|
data: Schema.Struct<{}>;
|
|
6123
|
+
}, Schema.Struct<{
|
|
6124
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
6125
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
6126
|
+
};
|
|
6127
|
+
readonly created: Schema.Finite;
|
|
6128
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
6129
|
+
readonly type: Schema.Literal<"experimental.push.updated">;
|
|
6130
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
6131
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
6132
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
6133
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
6134
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
6135
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
6136
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
6137
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
6138
|
+
}>, never, never>;
|
|
6139
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
6140
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
6141
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
6142
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
6143
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
6144
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
6145
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
6146
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
6147
|
+
}>, never, never>;
|
|
6148
|
+
}>>, never, never>;
|
|
6149
|
+
readonly data: Schema.Struct<{}>;
|
|
6150
|
+
}> & {
|
|
6151
|
+
type: "experimental.push.updated";
|
|
6152
|
+
durability: "ephemeral";
|
|
6153
|
+
durable: undefined;
|
|
6154
|
+
data: Schema.Struct<{}>;
|
|
6123
6155
|
}, Schema.Struct<{
|
|
6124
6156
|
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
6125
6157
|
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
@@ -12858,6 +12890,38 @@ export declare const Definitions: readonly [Schema.Struct<{
|
|
|
12858
12890
|
durability: "ephemeral";
|
|
12859
12891
|
durable: undefined;
|
|
12860
12892
|
data: Schema.Struct<{}>;
|
|
12893
|
+
}, Schema.Struct<{
|
|
12894
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
12895
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
12896
|
+
};
|
|
12897
|
+
readonly created: Schema.Finite;
|
|
12898
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
12899
|
+
readonly type: Schema.Literal<"experimental.push.updated">;
|
|
12900
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
12901
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
12902
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
12903
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12904
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12905
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
12906
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12907
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12908
|
+
}>, never, never>;
|
|
12909
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
12910
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
12911
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
12912
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12913
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12914
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
12915
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12916
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12917
|
+
}>, never, never>;
|
|
12918
|
+
}>>, never, never>;
|
|
12919
|
+
readonly data: Schema.Struct<{}>;
|
|
12920
|
+
}> & {
|
|
12921
|
+
type: "experimental.push.updated";
|
|
12922
|
+
durability: "ephemeral";
|
|
12923
|
+
durable: undefined;
|
|
12924
|
+
data: Schema.Struct<{}>;
|
|
12861
12925
|
}, Schema.Struct<{
|
|
12862
12926
|
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
12863
12927
|
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
package/dist/event-manifest.js
CHANGED
|
@@ -37,9 +37,10 @@ import { VcsEvent } from "./vcs-event.js";
|
|
|
37
37
|
import { WorkspaceEvent } from "./workspace-event.js";
|
|
38
38
|
import { WorktreeEvent } from "./worktree-event.js";
|
|
39
39
|
import { WebSearch } from "./websearch.js";
|
|
40
|
+
import { Push } from "./push.js";
|
|
40
41
|
const coreDefinitions = Event.inventory(...SessionEvent.Definitions);
|
|
41
42
|
const foundationDefinitions = Event.inventory(...LocationEvent.Definitions, ...ModelsDev.Event.Definitions, ...Credential.Event.Definitions, ...Integration.Event.Definitions, ...Provider.Event.Definitions, ...Model.Event.Definitions, ...Agent.Event.Definitions, ...coreDefinitions);
|
|
42
|
-
const featureDefinitions = Event.inventory(...FileSystem.Event.Definitions, ...Reference.Event.Definitions, ...Permission.Event.Definitions, ...Plugin.Event.Definitions, ...Project.Event.Definitions, ...Worktree.Event.Definitions, ...Command.Event.Definitions, ...Config.Event.Definitions, ...Skill.Event.Definitions, ...Pty.Event.Definitions, ...PersistentPty.Event.Definitions, ...Shell.Event.Definitions, ...Job.Event.Definitions, ...Form.Event.Definitions, ...WebSearch.Event.Definitions, ...Artifact.Event.Definitions);
|
|
43
|
+
const featureDefinitions = Event.inventory(...FileSystem.Event.Definitions, ...Reference.Event.Definitions, ...Permission.Event.Definitions, ...Plugin.Event.Definitions, ...Project.Event.Definitions, ...Worktree.Event.Definitions, ...Command.Event.Definitions, ...Config.Event.Definitions, ...Skill.Event.Definitions, ...Pty.Event.Definitions, ...PersistentPty.Event.Definitions, ...Shell.Event.Definitions, ...Job.Event.Definitions, ...Form.Event.Definitions, ...WebSearch.Event.Definitions, ...Push.Event.Definitions, ...Artifact.Event.Definitions);
|
|
43
44
|
export const ServerDefinitions = Event.inventory(...foundationDefinitions, ...featureDefinitions,
|
|
44
45
|
// Current events the TUI consumes from the public stream.
|
|
45
46
|
...SessionStatusEvent.Definitions, ...TuiEvent.Definitions, ...InstallationEvent.Definitions, ...VcsEvent.Definitions, McpEvent.StatusChanged, McpEvent.ResourcesChanged, McpEvent.ExperimentalEvent);
|
package/dist/push.d.ts
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
export * as Push from "./push.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
export declare const DeviceID: Schema.brand<Schema.String, "Push.DeviceID">;
|
|
4
|
+
export type DeviceID = typeof DeviceID.Type;
|
|
5
|
+
export declare const Time: Schema.Int;
|
|
6
|
+
export declare const Level: Schema.Literals<readonly ["all", "attention", "none"]>;
|
|
7
|
+
export type Level = typeof Level.Type;
|
|
8
|
+
export interface Bell extends Schema.Schema.Type<typeof Bell> {
|
|
9
|
+
}
|
|
10
|
+
export declare const Bell: Schema.Struct<{
|
|
11
|
+
readonly level: Schema.Literals<readonly ["all", "attention", "none"]>;
|
|
12
|
+
readonly until: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
13
|
+
}>;
|
|
14
|
+
export interface Settings extends Schema.Schema.Type<typeof Settings> {
|
|
15
|
+
}
|
|
16
|
+
export declare const Settings: Schema.Struct<{
|
|
17
|
+
readonly paused: Schema.Boolean;
|
|
18
|
+
readonly until: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
19
|
+
}>;
|
|
20
|
+
export interface DeviceSettings extends Schema.Schema.Type<typeof DeviceSettings> {
|
|
21
|
+
}
|
|
22
|
+
export declare const DeviceSettings: Schema.Struct<{
|
|
23
|
+
readonly default: Schema.Literals<readonly ["all", "attention", "none"]>;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const Platform: Schema.Literals<readonly ["android", "ios"]>;
|
|
26
|
+
export type Platform = typeof Platform.Type;
|
|
27
|
+
export interface Register extends Schema.Schema.Type<typeof Register> {
|
|
28
|
+
}
|
|
29
|
+
export declare const Register: Schema.Struct<{
|
|
30
|
+
readonly callbackURL: Schema.String;
|
|
31
|
+
readonly expiresAt: Schema.Int;
|
|
32
|
+
readonly publicKey: Schema.String;
|
|
33
|
+
readonly platform: Schema.Literals<readonly ["android", "ios"]>;
|
|
34
|
+
readonly name: Schema.String;
|
|
35
|
+
readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
36
|
+
readonly default: Schema.Literals<readonly ["all", "attention", "none"]>;
|
|
37
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
38
|
+
readonly default: Schema.Literals<readonly ["all", "attention", "none"]>;
|
|
39
|
+
}>>, never, never>;
|
|
40
|
+
}>;
|
|
41
|
+
export interface Registered extends Schema.Schema.Type<typeof Registered> {
|
|
42
|
+
}
|
|
43
|
+
export declare const Registered: Schema.Struct<{
|
|
44
|
+
readonly publicKey: Schema.String;
|
|
45
|
+
}>;
|
|
46
|
+
export interface DevicePatch extends Schema.Schema.Type<typeof DevicePatch> {
|
|
47
|
+
}
|
|
48
|
+
export declare const DevicePatch: Schema.Struct<{
|
|
49
|
+
readonly paused: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
50
|
+
readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
51
|
+
readonly default: Schema.Literals<readonly ["all", "attention", "none"]>;
|
|
52
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
53
|
+
readonly default: Schema.Literals<readonly ["all", "attention", "none"]>;
|
|
54
|
+
}>>, never, never>;
|
|
55
|
+
}>;
|
|
56
|
+
export interface Device extends Schema.Schema.Type<typeof Device> {
|
|
57
|
+
}
|
|
58
|
+
export declare const Device: Schema.Struct<{
|
|
59
|
+
readonly id: Schema.brand<Schema.String, "Push.DeviceID">;
|
|
60
|
+
readonly name: Schema.String;
|
|
61
|
+
readonly platform: Schema.Literals<readonly ["android", "ios"]>;
|
|
62
|
+
readonly expiresAt: Schema.Int;
|
|
63
|
+
readonly settings: Schema.Struct<{
|
|
64
|
+
readonly default: Schema.Literals<readonly ["all", "attention", "none"]>;
|
|
65
|
+
}>;
|
|
66
|
+
readonly paused: Schema.Boolean;
|
|
67
|
+
readonly sessions: Schema.$Record<Schema.String, Schema.Struct<{
|
|
68
|
+
readonly level: Schema.Literals<readonly ["all", "attention", "none"]>;
|
|
69
|
+
readonly until: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
70
|
+
}>>;
|
|
71
|
+
readonly time: Schema.Struct<{
|
|
72
|
+
readonly created: Schema.Int;
|
|
73
|
+
readonly updated: Schema.Int;
|
|
74
|
+
}>;
|
|
75
|
+
}>;
|
|
76
|
+
export interface Info extends Schema.Schema.Type<typeof Info> {
|
|
77
|
+
}
|
|
78
|
+
export declare const Info: Schema.Struct<{
|
|
79
|
+
readonly settings: Schema.Struct<{
|
|
80
|
+
readonly paused: Schema.Boolean;
|
|
81
|
+
readonly until: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
82
|
+
}>;
|
|
83
|
+
readonly devices: Schema.$Array<Schema.Struct<{
|
|
84
|
+
readonly id: Schema.brand<Schema.String, "Push.DeviceID">;
|
|
85
|
+
readonly name: Schema.String;
|
|
86
|
+
readonly platform: Schema.Literals<readonly ["android", "ios"]>;
|
|
87
|
+
readonly expiresAt: Schema.Int;
|
|
88
|
+
readonly settings: Schema.Struct<{
|
|
89
|
+
readonly default: Schema.Literals<readonly ["all", "attention", "none"]>;
|
|
90
|
+
}>;
|
|
91
|
+
readonly paused: Schema.Boolean;
|
|
92
|
+
readonly sessions: Schema.$Record<Schema.String, Schema.Struct<{
|
|
93
|
+
readonly level: Schema.Literals<readonly ["all", "attention", "none"]>;
|
|
94
|
+
readonly until: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
95
|
+
}>>;
|
|
96
|
+
readonly time: Schema.Struct<{
|
|
97
|
+
readonly created: Schema.Int;
|
|
98
|
+
readonly updated: Schema.Int;
|
|
99
|
+
}>;
|
|
100
|
+
}>>;
|
|
101
|
+
readonly sessions: Schema.$Record<Schema.String, Schema.Struct<{
|
|
102
|
+
readonly level: Schema.Literals<readonly ["all", "attention", "none"]>;
|
|
103
|
+
readonly until: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
104
|
+
}>>;
|
|
105
|
+
}>;
|
|
106
|
+
export declare const Event: {
|
|
107
|
+
Updated: Schema.Struct<{
|
|
108
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
109
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
110
|
+
};
|
|
111
|
+
readonly created: Schema.Finite;
|
|
112
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
113
|
+
readonly type: Schema.Literal<"experimental.push.updated">;
|
|
114
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
115
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
116
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
117
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
118
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
119
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
120
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
121
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
122
|
+
}>, never, never>;
|
|
123
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
124
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
125
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
126
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
127
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
128
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
129
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
130
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
131
|
+
}>, never, never>;
|
|
132
|
+
}>>, never, never>;
|
|
133
|
+
readonly data: Schema.Struct<{}>;
|
|
134
|
+
}> & {
|
|
135
|
+
type: "experimental.push.updated";
|
|
136
|
+
durability: "ephemeral";
|
|
137
|
+
durable: undefined;
|
|
138
|
+
data: Schema.Struct<{}>;
|
|
139
|
+
};
|
|
140
|
+
Definitions: readonly [Schema.Struct<{
|
|
141
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
142
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
143
|
+
};
|
|
144
|
+
readonly created: Schema.Finite;
|
|
145
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
146
|
+
readonly type: Schema.Literal<"experimental.push.updated">;
|
|
147
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
148
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
149
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
150
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
151
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
152
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
153
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
154
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
155
|
+
}>, never, never>;
|
|
156
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
157
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
158
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
159
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
160
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
161
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
162
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
163
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
164
|
+
}>, never, never>;
|
|
165
|
+
}>>, never, never>;
|
|
166
|
+
readonly data: Schema.Struct<{}>;
|
|
167
|
+
}> & {
|
|
168
|
+
type: "experimental.push.updated";
|
|
169
|
+
durability: "ephemeral";
|
|
170
|
+
durable: undefined;
|
|
171
|
+
data: Schema.Struct<{}>;
|
|
172
|
+
}];
|
|
173
|
+
};
|
package/dist/push.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export * as Push from "./push.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { ephemeral, inventory } from "./event.js";
|
|
4
|
+
import { NonNegativeInt, optional } from "./schema.js";
|
|
5
|
+
export const DeviceID = Schema.String.check(Schema.isPattern(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/)).pipe(Schema.brand("Push.DeviceID"), Schema.annotate({ identifier: "Push.DeviceID", description: "A lowercase canonical UUID chosen by the phone" }));
|
|
6
|
+
export const Time = NonNegativeInt.annotate({
|
|
7
|
+
description: "Milliseconds since the Unix epoch",
|
|
8
|
+
});
|
|
9
|
+
export const Level = Schema.Literals(["all", "attention", "none"]).annotate({ identifier: "Push.Level" });
|
|
10
|
+
export const Bell = Schema.Struct({
|
|
11
|
+
level: Level,
|
|
12
|
+
until: Time.pipe(optional),
|
|
13
|
+
}).annotate({ identifier: "Push.Bell" });
|
|
14
|
+
export const Settings = Schema.Struct({
|
|
15
|
+
paused: Schema.Boolean,
|
|
16
|
+
until: Time.pipe(optional),
|
|
17
|
+
}).annotate({ identifier: "Push.Settings" });
|
|
18
|
+
export const DeviceSettings = Schema.Struct({
|
|
19
|
+
default: Level,
|
|
20
|
+
}).annotate({ identifier: "Push.DeviceSettings" });
|
|
21
|
+
export const Platform = Schema.Literals(["android", "ios"]).annotate({ identifier: "Push.Platform" });
|
|
22
|
+
export const Register = Schema.Struct({
|
|
23
|
+
callbackURL: Schema.String,
|
|
24
|
+
expiresAt: Time,
|
|
25
|
+
publicKey: Schema.String,
|
|
26
|
+
platform: Platform,
|
|
27
|
+
name: Schema.String,
|
|
28
|
+
settings: DeviceSettings.pipe(optional),
|
|
29
|
+
}).annotate({ identifier: "Push.Register" });
|
|
30
|
+
export const Registered = Schema.Struct({
|
|
31
|
+
publicKey: Schema.String,
|
|
32
|
+
}).annotate({ identifier: "Push.Registered" });
|
|
33
|
+
export const DevicePatch = Schema.Struct({
|
|
34
|
+
paused: Schema.Boolean.pipe(optional),
|
|
35
|
+
settings: DeviceSettings.pipe(optional),
|
|
36
|
+
}).annotate({ identifier: "Push.DevicePatch" });
|
|
37
|
+
export const Device = Schema.Struct({
|
|
38
|
+
id: DeviceID,
|
|
39
|
+
name: Schema.String,
|
|
40
|
+
platform: Platform,
|
|
41
|
+
expiresAt: Time,
|
|
42
|
+
settings: DeviceSettings,
|
|
43
|
+
paused: Schema.Boolean,
|
|
44
|
+
sessions: Schema.Record(Schema.String, Bell),
|
|
45
|
+
time: Schema.Struct({
|
|
46
|
+
created: Time,
|
|
47
|
+
updated: Time,
|
|
48
|
+
}),
|
|
49
|
+
}).annotate({ identifier: "Push.Device" });
|
|
50
|
+
export const Info = Schema.Struct({
|
|
51
|
+
settings: Settings,
|
|
52
|
+
devices: Schema.Array(Device),
|
|
53
|
+
sessions: Schema.Record(Schema.String, Bell),
|
|
54
|
+
}).annotate({ identifier: "Push.Info" });
|
|
55
|
+
const Updated = ephemeral({ type: "experimental.push.updated", schema: {} });
|
|
56
|
+
export const Event = { Updated, Definitions: inventory(Updated) };
|