@stetcms/client 0.1.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/LICENSE +202 -0
- package/README.md +68 -0
- package/dist/codegen.d.ts +37 -0
- package/dist/codegen.js +112 -0
- package/dist/index.d.ts +571 -0
- package/dist/index.js +397 -0
- package/package.json +56 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
import { ContentModel, DEFAULT_ORIGIN, entryTypeName, fetchContentModel, renderContentModule } from "./codegen.js";
|
|
2
|
+
import { ContractRouterClient, InferContractRouterInputs, InferContractRouterOutputs } from "@orpc/contract";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { isDefinedError, safe } from "@orpc/client";
|
|
5
|
+
|
|
6
|
+
//#region ../../internal/api/src/contract.d.ts
|
|
7
|
+
declare const organizationSchema: z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
slug: z.ZodString;
|
|
11
|
+
logo: z.ZodNullable<z.ZodString>;
|
|
12
|
+
createdAt: z.ZodISODateTime;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
type Organization = z.infer<typeof organizationSchema>;
|
|
15
|
+
declare const contentTypeSchema: z.ZodObject<{
|
|
16
|
+
slug: z.ZodString;
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
kind: z.ZodEnum<{
|
|
19
|
+
map: "map";
|
|
20
|
+
collection: "collection";
|
|
21
|
+
}>;
|
|
22
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
23
|
+
key: z.ZodString;
|
|
24
|
+
name: z.ZodString;
|
|
25
|
+
type: z.ZodEnum<{
|
|
26
|
+
number: "number";
|
|
27
|
+
date: "date";
|
|
28
|
+
text: "text";
|
|
29
|
+
rich_text: "rich_text";
|
|
30
|
+
checkbox: "checkbox";
|
|
31
|
+
select: "select";
|
|
32
|
+
multi_select: "multi_select";
|
|
33
|
+
link: "link";
|
|
34
|
+
person: "person";
|
|
35
|
+
asset: "asset";
|
|
36
|
+
reference: "reference";
|
|
37
|
+
multi_reference: "multi_reference";
|
|
38
|
+
}>;
|
|
39
|
+
options: z.ZodArray<z.ZodObject<{
|
|
40
|
+
name: z.ZodString;
|
|
41
|
+
color: z.ZodString;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
collection: z.ZodOptional<z.ZodString>;
|
|
44
|
+
deprecated: z.ZodOptional<z.ZodObject<{
|
|
45
|
+
at: z.ZodISODateTime;
|
|
46
|
+
by: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
type ContentType = z.infer<typeof contentTypeSchema>;
|
|
51
|
+
declare const contentEntrySchema: z.ZodObject<{
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
slug: z.ZodString;
|
|
54
|
+
title: z.ZodString;
|
|
55
|
+
fields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
56
|
+
createdAt: z.ZodISODateTime;
|
|
57
|
+
updatedAt: z.ZodISODateTime;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
type ContentEntry = z.infer<typeof contentEntrySchema>;
|
|
60
|
+
declare const contract: {
|
|
61
|
+
health: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
62
|
+
status: z.ZodLiteral<"ok">;
|
|
63
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
64
|
+
readonly RATE_LIMITED: {
|
|
65
|
+
readonly status: 429;
|
|
66
|
+
readonly message: "Too many requests. Try again shortly.";
|
|
67
|
+
};
|
|
68
|
+
}>, Record<never, never>>;
|
|
69
|
+
analytics: {
|
|
70
|
+
ingest: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
71
|
+
context: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
72
|
+
metadata: z.ZodDefault<z.ZodObject<{
|
|
73
|
+
visitor: z.ZodOptional<z.ZodString>;
|
|
74
|
+
country: z.ZodOptional<z.ZodString>;
|
|
75
|
+
region: z.ZodOptional<z.ZodString>;
|
|
76
|
+
city: z.ZodOptional<z.ZodString>;
|
|
77
|
+
browser: z.ZodOptional<z.ZodString>;
|
|
78
|
+
os: z.ZodOptional<z.ZodString>;
|
|
79
|
+
device: z.ZodOptional<z.ZodEnum<{
|
|
80
|
+
desktop: "desktop";
|
|
81
|
+
mobile: "mobile";
|
|
82
|
+
tablet: "tablet";
|
|
83
|
+
}>>;
|
|
84
|
+
}, z.core.$strip>>;
|
|
85
|
+
events: z.ZodArray<z.ZodObject<{
|
|
86
|
+
name: z.ZodString;
|
|
87
|
+
props: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
88
|
+
timestamp: z.ZodNumber;
|
|
89
|
+
url: z.ZodOptional<z.ZodString>;
|
|
90
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, z.core.$strip>>;
|
|
92
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
93
|
+
accepted: z.ZodNumber;
|
|
94
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
95
|
+
readonly RATE_LIMITED: {
|
|
96
|
+
readonly status: 429;
|
|
97
|
+
readonly message: "Too many requests. Try again shortly.";
|
|
98
|
+
};
|
|
99
|
+
readonly UNAUTHORIZED: {
|
|
100
|
+
readonly message: "Authentication required. Pass an organization API key in the `x-api-key` header.";
|
|
101
|
+
};
|
|
102
|
+
}>, Record<never, never>>;
|
|
103
|
+
sync: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
104
|
+
events: z.ZodArray<z.ZodObject<{
|
|
105
|
+
name: z.ZodString;
|
|
106
|
+
props: z.ZodArray<z.ZodString>;
|
|
107
|
+
}, z.core.$strip>>;
|
|
108
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
109
|
+
synced: z.ZodNumber;
|
|
110
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
111
|
+
readonly RATE_LIMITED: {
|
|
112
|
+
readonly status: 429;
|
|
113
|
+
readonly message: "Too many requests. Try again shortly.";
|
|
114
|
+
};
|
|
115
|
+
readonly UNAUTHORIZED: {
|
|
116
|
+
readonly message: "Authentication required. Pass an organization API key in the `x-api-key` header.";
|
|
117
|
+
};
|
|
118
|
+
}>, Record<never, never>>;
|
|
119
|
+
};
|
|
120
|
+
content: {
|
|
121
|
+
model: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
122
|
+
types: z.ZodArray<z.ZodObject<{
|
|
123
|
+
slug: z.ZodString;
|
|
124
|
+
name: z.ZodString;
|
|
125
|
+
kind: z.ZodEnum<{
|
|
126
|
+
map: "map";
|
|
127
|
+
collection: "collection";
|
|
128
|
+
}>;
|
|
129
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
130
|
+
key: z.ZodString;
|
|
131
|
+
name: z.ZodString;
|
|
132
|
+
type: z.ZodEnum<{
|
|
133
|
+
number: "number";
|
|
134
|
+
date: "date";
|
|
135
|
+
text: "text";
|
|
136
|
+
rich_text: "rich_text";
|
|
137
|
+
checkbox: "checkbox";
|
|
138
|
+
select: "select";
|
|
139
|
+
multi_select: "multi_select";
|
|
140
|
+
link: "link";
|
|
141
|
+
person: "person";
|
|
142
|
+
asset: "asset";
|
|
143
|
+
reference: "reference";
|
|
144
|
+
multi_reference: "multi_reference";
|
|
145
|
+
}>;
|
|
146
|
+
options: z.ZodArray<z.ZodObject<{
|
|
147
|
+
name: z.ZodString;
|
|
148
|
+
color: z.ZodString;
|
|
149
|
+
}, z.core.$strip>>;
|
|
150
|
+
collection: z.ZodOptional<z.ZodString>;
|
|
151
|
+
deprecated: z.ZodOptional<z.ZodObject<{
|
|
152
|
+
at: z.ZodISODateTime;
|
|
153
|
+
by: z.ZodOptional<z.ZodString>;
|
|
154
|
+
}, z.core.$strip>>;
|
|
155
|
+
}, z.core.$strip>>;
|
|
156
|
+
}, z.core.$strip>>;
|
|
157
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
158
|
+
readonly RATE_LIMITED: {
|
|
159
|
+
readonly status: 429;
|
|
160
|
+
readonly message: "Too many requests. Try again shortly.";
|
|
161
|
+
};
|
|
162
|
+
readonly UNAUTHORIZED: {
|
|
163
|
+
readonly message: "Authentication required. Pass an organization API key in the `x-api-key` header.";
|
|
164
|
+
};
|
|
165
|
+
readonly QUOTA_EXCEEDED: {
|
|
166
|
+
readonly status: 429;
|
|
167
|
+
readonly message: "The organization's API request limit for this period has been reached.";
|
|
168
|
+
};
|
|
169
|
+
}>, Record<never, never>>;
|
|
170
|
+
list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
171
|
+
type: z.ZodString;
|
|
172
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
173
|
+
type: z.ZodObject<{
|
|
174
|
+
slug: z.ZodString;
|
|
175
|
+
name: z.ZodString;
|
|
176
|
+
kind: z.ZodEnum<{
|
|
177
|
+
map: "map";
|
|
178
|
+
collection: "collection";
|
|
179
|
+
}>;
|
|
180
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
181
|
+
key: z.ZodString;
|
|
182
|
+
name: z.ZodString;
|
|
183
|
+
type: z.ZodEnum<{
|
|
184
|
+
number: "number";
|
|
185
|
+
date: "date";
|
|
186
|
+
text: "text";
|
|
187
|
+
rich_text: "rich_text";
|
|
188
|
+
checkbox: "checkbox";
|
|
189
|
+
select: "select";
|
|
190
|
+
multi_select: "multi_select";
|
|
191
|
+
link: "link";
|
|
192
|
+
person: "person";
|
|
193
|
+
asset: "asset";
|
|
194
|
+
reference: "reference";
|
|
195
|
+
multi_reference: "multi_reference";
|
|
196
|
+
}>;
|
|
197
|
+
options: z.ZodArray<z.ZodObject<{
|
|
198
|
+
name: z.ZodString;
|
|
199
|
+
color: z.ZodString;
|
|
200
|
+
}, z.core.$strip>>;
|
|
201
|
+
collection: z.ZodOptional<z.ZodString>;
|
|
202
|
+
deprecated: z.ZodOptional<z.ZodObject<{
|
|
203
|
+
at: z.ZodISODateTime;
|
|
204
|
+
by: z.ZodOptional<z.ZodString>;
|
|
205
|
+
}, z.core.$strip>>;
|
|
206
|
+
}, z.core.$strip>>;
|
|
207
|
+
}, z.core.$strip>;
|
|
208
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
209
|
+
id: z.ZodString;
|
|
210
|
+
slug: z.ZodString;
|
|
211
|
+
title: z.ZodString;
|
|
212
|
+
fields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
213
|
+
createdAt: z.ZodISODateTime;
|
|
214
|
+
updatedAt: z.ZodISODateTime;
|
|
215
|
+
}, z.core.$strip>>;
|
|
216
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
217
|
+
NOT_FOUND: {
|
|
218
|
+
readonly message: "No content type with that slug in this organization.";
|
|
219
|
+
};
|
|
220
|
+
RATE_LIMITED: {
|
|
221
|
+
readonly status: 429;
|
|
222
|
+
readonly message: "Too many requests. Try again shortly.";
|
|
223
|
+
};
|
|
224
|
+
UNAUTHORIZED: {
|
|
225
|
+
readonly message: "Authentication required. Pass an organization API key in the `x-api-key` header.";
|
|
226
|
+
};
|
|
227
|
+
QUOTA_EXCEEDED: {
|
|
228
|
+
readonly status: 429;
|
|
229
|
+
readonly message: "The organization's API request limit for this period has been reached.";
|
|
230
|
+
};
|
|
231
|
+
}>, Record<never, never>>;
|
|
232
|
+
get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
233
|
+
type: z.ZodString;
|
|
234
|
+
slug: z.ZodString;
|
|
235
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
236
|
+
id: z.ZodString;
|
|
237
|
+
slug: z.ZodString;
|
|
238
|
+
title: z.ZodString;
|
|
239
|
+
fields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
240
|
+
createdAt: z.ZodISODateTime;
|
|
241
|
+
updatedAt: z.ZodISODateTime;
|
|
242
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
243
|
+
NOT_FOUND: {
|
|
244
|
+
message: string;
|
|
245
|
+
};
|
|
246
|
+
RATE_LIMITED: {
|
|
247
|
+
readonly status: 429;
|
|
248
|
+
readonly message: "Too many requests. Try again shortly.";
|
|
249
|
+
};
|
|
250
|
+
UNAUTHORIZED: {
|
|
251
|
+
readonly message: "Authentication required. Pass an organization API key in the `x-api-key` header.";
|
|
252
|
+
};
|
|
253
|
+
QUOTA_EXCEEDED: {
|
|
254
|
+
readonly status: 429;
|
|
255
|
+
readonly message: "The organization's API request limit for this period has been reached.";
|
|
256
|
+
};
|
|
257
|
+
}>, Record<never, never>>;
|
|
258
|
+
};
|
|
259
|
+
org: {
|
|
260
|
+
current: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
261
|
+
id: z.ZodString;
|
|
262
|
+
name: z.ZodString;
|
|
263
|
+
slug: z.ZodString;
|
|
264
|
+
logo: z.ZodNullable<z.ZodString>;
|
|
265
|
+
createdAt: z.ZodISODateTime;
|
|
266
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
267
|
+
readonly RATE_LIMITED: {
|
|
268
|
+
readonly status: 429;
|
|
269
|
+
readonly message: "Too many requests. Try again shortly.";
|
|
270
|
+
};
|
|
271
|
+
readonly UNAUTHORIZED: {
|
|
272
|
+
readonly message: "Authentication required. Pass an organization API key in the `x-api-key` header.";
|
|
273
|
+
};
|
|
274
|
+
readonly QUOTA_EXCEEDED: {
|
|
275
|
+
readonly status: 429;
|
|
276
|
+
readonly message: "The organization's API request limit for this period has been reached.";
|
|
277
|
+
};
|
|
278
|
+
}>, Record<never, never>>;
|
|
279
|
+
billing: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
280
|
+
plan: z.ZodEnum<{
|
|
281
|
+
free: "free";
|
|
282
|
+
paid: "paid";
|
|
283
|
+
}>;
|
|
284
|
+
status: z.ZodNullable<z.ZodString>;
|
|
285
|
+
seats: z.ZodNullable<z.ZodNumber>;
|
|
286
|
+
periodEnd: z.ZodNullable<z.ZodISODateTime>;
|
|
287
|
+
cancelAtPeriodEnd: z.ZodBoolean;
|
|
288
|
+
usage: z.ZodArray<z.ZodObject<{
|
|
289
|
+
feature: z.ZodEnum<{
|
|
290
|
+
members: "members";
|
|
291
|
+
apiRequests: "apiRequests";
|
|
292
|
+
storage: "storage";
|
|
293
|
+
}>;
|
|
294
|
+
used: z.ZodNumber;
|
|
295
|
+
cap: z.ZodNullable<z.ZodNumber>;
|
|
296
|
+
window: z.ZodNullable<z.ZodEnum<{
|
|
297
|
+
month: "month";
|
|
298
|
+
}>>;
|
|
299
|
+
}, z.core.$strip>>;
|
|
300
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
301
|
+
readonly RATE_LIMITED: {
|
|
302
|
+
readonly status: 429;
|
|
303
|
+
readonly message: "Too many requests. Try again shortly.";
|
|
304
|
+
};
|
|
305
|
+
readonly UNAUTHORIZED: {
|
|
306
|
+
readonly message: "Authentication required. Pass an organization API key in the `x-api-key` header.";
|
|
307
|
+
};
|
|
308
|
+
readonly QUOTA_EXCEEDED: {
|
|
309
|
+
readonly status: 429;
|
|
310
|
+
readonly message: "The organization's API request limit for this period has been reached.";
|
|
311
|
+
};
|
|
312
|
+
}>, Record<never, never>>;
|
|
313
|
+
note: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
314
|
+
text: z.ZodNullable<z.ZodString>;
|
|
315
|
+
words: z.ZodNumber;
|
|
316
|
+
savedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
317
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
318
|
+
readonly RATE_LIMITED: {
|
|
319
|
+
readonly status: 429;
|
|
320
|
+
readonly message: "Too many requests. Try again shortly.";
|
|
321
|
+
};
|
|
322
|
+
readonly UNAUTHORIZED: {
|
|
323
|
+
readonly message: "Authentication required. Pass an organization API key in the `x-api-key` header.";
|
|
324
|
+
};
|
|
325
|
+
readonly QUOTA_EXCEEDED: {
|
|
326
|
+
readonly status: 429;
|
|
327
|
+
readonly message: "The organization's API request limit for this period has been reached.";
|
|
328
|
+
};
|
|
329
|
+
}>, Record<never, never>>;
|
|
330
|
+
};
|
|
331
|
+
webhooks: {
|
|
332
|
+
list: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodArray<z.ZodObject<{
|
|
333
|
+
id: z.ZodString;
|
|
334
|
+
url: z.ZodString;
|
|
335
|
+
events: z.ZodArray<z.ZodEnum<{
|
|
336
|
+
"content.changed": "content.changed";
|
|
337
|
+
"member.joined": "member.joined";
|
|
338
|
+
"invitation.created": "invitation.created";
|
|
339
|
+
"subscription.started": "subscription.started";
|
|
340
|
+
"subscription.canceled": "subscription.canceled";
|
|
341
|
+
ping: "ping";
|
|
342
|
+
}>>;
|
|
343
|
+
enabled: z.ZodBoolean;
|
|
344
|
+
createdAt: z.ZodISODateTime;
|
|
345
|
+
}, z.core.$strip>>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
346
|
+
readonly RATE_LIMITED: {
|
|
347
|
+
readonly status: 429;
|
|
348
|
+
readonly message: "Too many requests. Try again shortly.";
|
|
349
|
+
};
|
|
350
|
+
readonly UNAUTHORIZED: {
|
|
351
|
+
readonly message: "Authentication required. Pass an organization API key in the `x-api-key` header.";
|
|
352
|
+
};
|
|
353
|
+
readonly QUOTA_EXCEEDED: {
|
|
354
|
+
readonly status: 429;
|
|
355
|
+
readonly message: "The organization's API request limit for this period has been reached.";
|
|
356
|
+
};
|
|
357
|
+
}>, Record<never, never>>;
|
|
358
|
+
create: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
359
|
+
url: z.ZodURL;
|
|
360
|
+
events: z.ZodArray<z.ZodEnum<{
|
|
361
|
+
"content.changed": "content.changed";
|
|
362
|
+
"member.joined": "member.joined";
|
|
363
|
+
"invitation.created": "invitation.created";
|
|
364
|
+
"subscription.started": "subscription.started";
|
|
365
|
+
"subscription.canceled": "subscription.canceled";
|
|
366
|
+
ping: "ping";
|
|
367
|
+
}>>;
|
|
368
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
369
|
+
id: z.ZodString;
|
|
370
|
+
url: z.ZodString;
|
|
371
|
+
events: z.ZodArray<z.ZodEnum<{
|
|
372
|
+
"content.changed": "content.changed";
|
|
373
|
+
"member.joined": "member.joined";
|
|
374
|
+
"invitation.created": "invitation.created";
|
|
375
|
+
"subscription.started": "subscription.started";
|
|
376
|
+
"subscription.canceled": "subscription.canceled";
|
|
377
|
+
ping: "ping";
|
|
378
|
+
}>>;
|
|
379
|
+
enabled: z.ZodBoolean;
|
|
380
|
+
createdAt: z.ZodISODateTime;
|
|
381
|
+
secret: z.ZodString;
|
|
382
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
383
|
+
BAD_REQUEST: {
|
|
384
|
+
message: string;
|
|
385
|
+
};
|
|
386
|
+
RATE_LIMITED: {
|
|
387
|
+
readonly status: 429;
|
|
388
|
+
readonly message: "Too many requests. Try again shortly.";
|
|
389
|
+
};
|
|
390
|
+
UNAUTHORIZED: {
|
|
391
|
+
readonly message: "Authentication required. Pass an organization API key in the `x-api-key` header.";
|
|
392
|
+
};
|
|
393
|
+
QUOTA_EXCEEDED: {
|
|
394
|
+
readonly status: 429;
|
|
395
|
+
readonly message: "The organization's API request limit for this period has been reached.";
|
|
396
|
+
};
|
|
397
|
+
}>, Record<never, never>>;
|
|
398
|
+
delete: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
399
|
+
id: z.ZodString;
|
|
400
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
401
|
+
id: z.ZodString;
|
|
402
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
403
|
+
NOT_FOUND: {
|
|
404
|
+
readonly message: "No webhook endpoint with that id in this organization.";
|
|
405
|
+
};
|
|
406
|
+
RATE_LIMITED: {
|
|
407
|
+
readonly status: 429;
|
|
408
|
+
readonly message: "Too many requests. Try again shortly.";
|
|
409
|
+
};
|
|
410
|
+
UNAUTHORIZED: {
|
|
411
|
+
readonly message: "Authentication required. Pass an organization API key in the `x-api-key` header.";
|
|
412
|
+
};
|
|
413
|
+
QUOTA_EXCEEDED: {
|
|
414
|
+
readonly status: 429;
|
|
415
|
+
readonly message: "The organization's API request limit for this period has been reached.";
|
|
416
|
+
};
|
|
417
|
+
}>, Record<never, never>>;
|
|
418
|
+
rotateSecret: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
419
|
+
id: z.ZodString;
|
|
420
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
421
|
+
id: z.ZodString;
|
|
422
|
+
url: z.ZodString;
|
|
423
|
+
events: z.ZodArray<z.ZodEnum<{
|
|
424
|
+
"content.changed": "content.changed";
|
|
425
|
+
"member.joined": "member.joined";
|
|
426
|
+
"invitation.created": "invitation.created";
|
|
427
|
+
"subscription.started": "subscription.started";
|
|
428
|
+
"subscription.canceled": "subscription.canceled";
|
|
429
|
+
ping: "ping";
|
|
430
|
+
}>>;
|
|
431
|
+
enabled: z.ZodBoolean;
|
|
432
|
+
createdAt: z.ZodISODateTime;
|
|
433
|
+
secret: z.ZodString;
|
|
434
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
435
|
+
NOT_FOUND: {
|
|
436
|
+
readonly message: "No webhook endpoint with that id in this organization.";
|
|
437
|
+
};
|
|
438
|
+
RATE_LIMITED: {
|
|
439
|
+
readonly status: 429;
|
|
440
|
+
readonly message: "Too many requests. Try again shortly.";
|
|
441
|
+
};
|
|
442
|
+
UNAUTHORIZED: {
|
|
443
|
+
readonly message: "Authentication required. Pass an organization API key in the `x-api-key` header.";
|
|
444
|
+
};
|
|
445
|
+
QUOTA_EXCEEDED: {
|
|
446
|
+
readonly status: 429;
|
|
447
|
+
readonly message: "The organization's API request limit for this period has been reached.";
|
|
448
|
+
};
|
|
449
|
+
}>, Record<never, never>>;
|
|
450
|
+
deliveries: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
451
|
+
id: z.ZodString;
|
|
452
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
453
|
+
id: z.ZodString;
|
|
454
|
+
eventId: z.ZodString;
|
|
455
|
+
eventType: z.ZodString;
|
|
456
|
+
status: z.ZodEnum<{
|
|
457
|
+
success: "success";
|
|
458
|
+
failed: "failed";
|
|
459
|
+
}>;
|
|
460
|
+
responseStatus: z.ZodNullable<z.ZodNumber>;
|
|
461
|
+
attempts: z.ZodNumber;
|
|
462
|
+
createdAt: z.ZodISODateTime;
|
|
463
|
+
}, z.core.$strip>>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
464
|
+
NOT_FOUND: {
|
|
465
|
+
readonly message: "No webhook endpoint with that id in this organization.";
|
|
466
|
+
};
|
|
467
|
+
RATE_LIMITED: {
|
|
468
|
+
readonly status: 429;
|
|
469
|
+
readonly message: "Too many requests. Try again shortly.";
|
|
470
|
+
};
|
|
471
|
+
UNAUTHORIZED: {
|
|
472
|
+
readonly message: "Authentication required. Pass an organization API key in the `x-api-key` header.";
|
|
473
|
+
};
|
|
474
|
+
QUOTA_EXCEEDED: {
|
|
475
|
+
readonly status: 429;
|
|
476
|
+
readonly message: "The organization's API request limit for this period has been reached.";
|
|
477
|
+
};
|
|
478
|
+
}>, Record<never, never>>;
|
|
479
|
+
};
|
|
480
|
+
};
|
|
481
|
+
//#endregion
|
|
482
|
+
//#region src/content.d.ts
|
|
483
|
+
/** Fields every entry carries, whatever its collection's shape. */
|
|
484
|
+
type ContentEntryBase = {
|
|
485
|
+
id: string;
|
|
486
|
+
slug: string;
|
|
487
|
+
title: string; /** ISO 8601. */
|
|
488
|
+
createdAt: string;
|
|
489
|
+
updatedAt: string;
|
|
490
|
+
};
|
|
491
|
+
/**
|
|
492
|
+
* What a reference field holds: enough to render a link without a second
|
|
493
|
+
* request, and the slug to fetch the whole entry with the target
|
|
494
|
+
* collection's `get()`. Which collection that is stands in the generated
|
|
495
|
+
* field's doc comment.
|
|
496
|
+
*/
|
|
497
|
+
type ContentReference = {
|
|
498
|
+
id: string;
|
|
499
|
+
slug: string;
|
|
500
|
+
title: string;
|
|
501
|
+
};
|
|
502
|
+
/**
|
|
503
|
+
* What an asset field holds. `url` is a fully-qualified, public URL: the API
|
|
504
|
+
* returns it relative to itself and the client resolves it against the origin
|
|
505
|
+
* it was configured with, so it can go straight into an `img` tag or a
|
|
506
|
+
* download link on your own site, which is a different origin.
|
|
507
|
+
*/
|
|
508
|
+
type ContentAsset = {
|
|
509
|
+
id: string;
|
|
510
|
+
url: string; /** The original filename. */
|
|
511
|
+
name: string;
|
|
512
|
+
contentType: string; /** Bytes. */
|
|
513
|
+
size: number;
|
|
514
|
+
};
|
|
515
|
+
/**
|
|
516
|
+
* The shape `@stetcms/vite` generates from the organization's content model:
|
|
517
|
+
* one key per collection or map, carrying its kind and full entry type.
|
|
518
|
+
*/
|
|
519
|
+
type ContentModelShape = Record<string, {
|
|
520
|
+
kind: 'collection' | 'map';
|
|
521
|
+
entry: ContentEntryBase;
|
|
522
|
+
}>;
|
|
523
|
+
type CollectionClient<E extends ContentEntryBase> = {
|
|
524
|
+
/** Every entry, oldest first. */list(): Promise<E[]>; /** One entry, addressed by its slug. */
|
|
525
|
+
get(slug: string): Promise<E>;
|
|
526
|
+
};
|
|
527
|
+
type MapClient<E extends ContentEntryBase> = {
|
|
528
|
+
/** The map's single entry. */get(): Promise<E>;
|
|
529
|
+
};
|
|
530
|
+
type ContentClient<M extends ContentModelShape> = { [K in keyof M]: M[K] extends {
|
|
531
|
+
kind: 'map';
|
|
532
|
+
} ? MapClient<M[K]['entry']> : CollectionClient<M[K]['entry']> };
|
|
533
|
+
type ContentClientOptions = {
|
|
534
|
+
origin?: string;
|
|
535
|
+
/**
|
|
536
|
+
* Organization API key, sent as `x-api-key`. Content is served to servers:
|
|
537
|
+
* keep the key out of browser bundles and call from your own backend.
|
|
538
|
+
*/
|
|
539
|
+
apiKey?: string;
|
|
540
|
+
fetch?: typeof globalThis.fetch;
|
|
541
|
+
};
|
|
542
|
+
/**
|
|
543
|
+
* Joins an asset path to the Stet origin. Anything already absolute is left
|
|
544
|
+
* alone, so a future API that returns whole URLs needs no change here.
|
|
545
|
+
*/
|
|
546
|
+
declare function assetUrl(url: string, origin: string): string;
|
|
547
|
+
/**
|
|
548
|
+
* The same join applied inside a body's markdown, so an image an editor
|
|
549
|
+
* dropped into a body renders on your site as readily as an asset field does.
|
|
550
|
+
*/
|
|
551
|
+
declare function resolveAssetPaths(text: string, origin: string): string;
|
|
552
|
+
/**
|
|
553
|
+
* The model-shaped client `stet.gen.ts` instantiates: `stet.posts.list()`,
|
|
554
|
+
* `stet.posts.get('hello-world')`, `stet.landing.get()`. The type parameter
|
|
555
|
+
* narrows which keys exist and what their entries look like; the runtime is
|
|
556
|
+
* one Proxy over the content API.
|
|
557
|
+
*/
|
|
558
|
+
declare function createContentClient<M extends ContentModelShape>(options?: ContentClientOptions): ContentClient<M>;
|
|
559
|
+
//#endregion
|
|
560
|
+
//#region src/index.d.ts
|
|
561
|
+
type ApiInputs = InferContractRouterInputs<typeof contract>;
|
|
562
|
+
type ApiOutputs = InferContractRouterOutputs<typeof contract>;
|
|
563
|
+
type StetClient = ContractRouterClient<typeof contract>;
|
|
564
|
+
type StetClientOptions = {
|
|
565
|
+
origin?: string;
|
|
566
|
+
apiKey?: string;
|
|
567
|
+
fetch?: typeof globalThis.fetch;
|
|
568
|
+
};
|
|
569
|
+
declare function createStetClient(options?: StetClientOptions): StetClient;
|
|
570
|
+
//#endregion
|
|
571
|
+
export { ApiInputs, ApiOutputs, type CollectionClient, type ContentAsset, type ContentClient, type ContentClientOptions, type ContentEntry, type ContentEntryBase, type ContentModel, type ContentModelShape, type ContentReference, type ContentType, DEFAULT_ORIGIN, type MapClient, type Organization, StetClient, StetClientOptions, assetUrl, createContentClient, createStetClient, entryTypeName, fetchContentModel, isDefinedError, renderContentModule, resolveAssetPaths, safe };
|