@myagentroam/protocol 0.10.23 → 0.10.25

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.
@@ -0,0 +1,195 @@
1
+ import { z } from 'zod';
2
+ export declare const webPushSubscriptionSchema: z.ZodObject<{
3
+ endpoint: z.ZodString;
4
+ expirationTime: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
5
+ keys: z.ZodObject<{
6
+ p256dh: z.ZodString;
7
+ auth: z.ZodString;
8
+ }, "strict", z.ZodTypeAny, {
9
+ p256dh: string;
10
+ auth: string;
11
+ }, {
12
+ p256dh: string;
13
+ auth: string;
14
+ }>;
15
+ }, "strict", z.ZodTypeAny, {
16
+ keys: {
17
+ p256dh: string;
18
+ auth: string;
19
+ };
20
+ endpoint: string;
21
+ expirationTime?: number | null | undefined;
22
+ }, {
23
+ keys: {
24
+ p256dh: string;
25
+ auth: string;
26
+ };
27
+ endpoint: string;
28
+ expirationTime?: number | null | undefined;
29
+ }>;
30
+ export declare const webPushRegistrationSchema: z.ZodObject<{
31
+ clientToken: z.ZodString;
32
+ subscription: z.ZodObject<{
33
+ endpoint: z.ZodString;
34
+ expirationTime: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
35
+ keys: z.ZodObject<{
36
+ p256dh: z.ZodString;
37
+ auth: z.ZodString;
38
+ }, "strict", z.ZodTypeAny, {
39
+ p256dh: string;
40
+ auth: string;
41
+ }, {
42
+ p256dh: string;
43
+ auth: string;
44
+ }>;
45
+ }, "strict", z.ZodTypeAny, {
46
+ keys: {
47
+ p256dh: string;
48
+ auth: string;
49
+ };
50
+ endpoint: string;
51
+ expirationTime?: number | null | undefined;
52
+ }, {
53
+ keys: {
54
+ p256dh: string;
55
+ auth: string;
56
+ };
57
+ endpoint: string;
58
+ expirationTime?: number | null | undefined;
59
+ }>;
60
+ bindingVersion: z.ZodOptional<z.ZodNumber>;
61
+ enabled: z.ZodDefault<z.ZodBoolean>;
62
+ }, "strict", z.ZodTypeAny, {
63
+ enabled: boolean;
64
+ clientToken: string;
65
+ subscription: {
66
+ keys: {
67
+ p256dh: string;
68
+ auth: string;
69
+ };
70
+ endpoint: string;
71
+ expirationTime?: number | null | undefined;
72
+ };
73
+ bindingVersion?: number | undefined;
74
+ }, {
75
+ clientToken: string;
76
+ subscription: {
77
+ keys: {
78
+ p256dh: string;
79
+ auth: string;
80
+ };
81
+ endpoint: string;
82
+ expirationTime?: number | null | undefined;
83
+ };
84
+ enabled?: boolean | undefined;
85
+ bindingVersion?: number | undefined;
86
+ }>;
87
+ export type WebPushRegistration = z.input<typeof webPushRegistrationSchema>;
88
+ export declare const webPushClientRequestSchema: z.ZodObject<{
89
+ clientToken: z.ZodString;
90
+ subscription: z.ZodObject<{
91
+ endpoint: z.ZodString;
92
+ expirationTime: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
93
+ keys: z.ZodObject<{
94
+ p256dh: z.ZodString;
95
+ auth: z.ZodString;
96
+ }, "strict", z.ZodTypeAny, {
97
+ p256dh: string;
98
+ auth: string;
99
+ }, {
100
+ p256dh: string;
101
+ auth: string;
102
+ }>;
103
+ }, "strict", z.ZodTypeAny, {
104
+ keys: {
105
+ p256dh: string;
106
+ auth: string;
107
+ };
108
+ endpoint: string;
109
+ expirationTime?: number | null | undefined;
110
+ }, {
111
+ keys: {
112
+ p256dh: string;
113
+ auth: string;
114
+ };
115
+ endpoint: string;
116
+ expirationTime?: number | null | undefined;
117
+ }>;
118
+ bindingVersion: z.ZodOptional<z.ZodNumber>;
119
+ enabled: z.ZodDefault<z.ZodBoolean>;
120
+ } & {
121
+ expectedAccount: z.ZodString;
122
+ }, "strict", z.ZodTypeAny, {
123
+ enabled: boolean;
124
+ clientToken: string;
125
+ subscription: {
126
+ keys: {
127
+ p256dh: string;
128
+ auth: string;
129
+ };
130
+ endpoint: string;
131
+ expirationTime?: number | null | undefined;
132
+ };
133
+ expectedAccount: string;
134
+ bindingVersion?: number | undefined;
135
+ }, {
136
+ clientToken: string;
137
+ subscription: {
138
+ keys: {
139
+ p256dh: string;
140
+ auth: string;
141
+ };
142
+ endpoint: string;
143
+ expirationTime?: number | null | undefined;
144
+ };
145
+ expectedAccount: string;
146
+ enabled?: boolean | undefined;
147
+ bindingVersion?: number | undefined;
148
+ }>;
149
+ export declare const webPushClientResolveSchema: z.ZodObject<Pick<{
150
+ clientToken: z.ZodString;
151
+ subscription: z.ZodObject<{
152
+ endpoint: z.ZodString;
153
+ expirationTime: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
154
+ keys: z.ZodObject<{
155
+ p256dh: z.ZodString;
156
+ auth: z.ZodString;
157
+ }, "strict", z.ZodTypeAny, {
158
+ p256dh: string;
159
+ auth: string;
160
+ }, {
161
+ p256dh: string;
162
+ auth: string;
163
+ }>;
164
+ }, "strict", z.ZodTypeAny, {
165
+ keys: {
166
+ p256dh: string;
167
+ auth: string;
168
+ };
169
+ endpoint: string;
170
+ expirationTime?: number | null | undefined;
171
+ }, {
172
+ keys: {
173
+ p256dh: string;
174
+ auth: string;
175
+ };
176
+ endpoint: string;
177
+ expirationTime?: number | null | undefined;
178
+ }>;
179
+ bindingVersion: z.ZodOptional<z.ZodNumber>;
180
+ enabled: z.ZodDefault<z.ZodBoolean>;
181
+ } & {
182
+ expectedAccount: z.ZodString;
183
+ }, "clientToken" | "expectedAccount">, "strict", z.ZodTypeAny, {
184
+ clientToken: string;
185
+ expectedAccount: string;
186
+ }, {
187
+ clientToken: string;
188
+ expectedAccount: string;
189
+ }>;
190
+ export type WebPushSubscription = z.infer<typeof webPushSubscriptionSchema>;
191
+ export interface WebPushBinding {
192
+ readonly subscriptionId: string;
193
+ readonly bindingVersion: number;
194
+ readonly enabled: boolean;
195
+ }
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ export const webPushSubscriptionSchema = z
3
+ .object({
4
+ endpoint: z.string().url().max(2048),
5
+ expirationTime: z.number().int().nonnegative().safe().nullable().optional(),
6
+ keys: z
7
+ .object({
8
+ p256dh: z.string().regex(/^[A-Za-z0-9_-]{87}$/u),
9
+ auth: z.string().regex(/^[A-Za-z0-9_-]{22}$/u)
10
+ })
11
+ .strict()
12
+ })
13
+ .strict();
14
+ export const webPushRegistrationSchema = z
15
+ .object({
16
+ clientToken: z.string().regex(/^[A-Za-z0-9_-]{43}$/u),
17
+ subscription: webPushSubscriptionSchema,
18
+ bindingVersion: z.number().int().positive().safe().optional(),
19
+ enabled: z.boolean().default(true)
20
+ })
21
+ .strict();
22
+ // This is an identity consistency check, never a caller-selected authorization identity.
23
+ export const webPushClientRequestSchema = webPushRegistrationSchema.extend({
24
+ expectedAccount: z.string().min(1).max(128)
25
+ });
26
+ export const webPushClientResolveSchema = webPushClientRequestSchema.pick({
27
+ clientToken: true,
28
+ expectedAccount: true
29
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/protocol",
3
- "version": "0.10.23",
3
+ "version": "0.10.25",
4
4
  "description": "Shared runtime protocol schemas for MyAgentRoam.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",