ezship 0.1.11 → 0.1.13
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/README.md +56 -8
- package/access.d.mts +120 -0
- package/access.mjs +987 -0
- package/account.d.mts +19 -0
- package/account.mjs +91 -0
- package/bindings.mjs +136 -0
- package/commands.d.mts +672 -0
- package/commands.mjs +8098 -0
- package/connections.d.mts +61 -0
- package/connections.mjs +312 -0
- package/cron.d.mts +17 -0
- package/cron.mjs +124 -0
- package/documents.d.mts +26 -0
- package/documents.mjs +242 -0
- package/editor-types.json.gz +0 -0
- package/editor.mjs +212 -0
- package/ez.mjs +1300 -2
- package/local-fetch.mjs +57 -0
- package/package.json +82 -6
- package/schema.d.mts +369 -0
- package/schema.mjs +3099 -0
- package/session.d.mts +20 -0
- package/session.mjs +142 -0
- package/shape.d.mts +14 -0
- package/shape.mjs +312 -0
- package/signup.d.mts +11 -0
- package/signup.mjs +42 -0
- package/types.d.mts +879 -0
- package/update-check.mjs +105 -0
- package/workflow.d.mts +63 -0
- package/workflow.mjs +450 -0
package/commands.d.mts
ADDED
|
@@ -0,0 +1,672 @@
|
|
|
1
|
+
// Hand-written declarations for cli/commands.mjs (the contract), for the Worker and the studio SPA.
|
|
2
|
+
// Keep in step with the JSDoc in commands.mjs. The shapes a Workspace returns are the API's, in types.d.mts.
|
|
3
|
+
|
|
4
|
+
import type { LiveSchema } from "./schema.d.mts";
|
|
5
|
+
import type {
|
|
6
|
+
ActorRow,
|
|
7
|
+
Schedule,
|
|
8
|
+
ScheduleEntry,
|
|
9
|
+
ListenerEntry,
|
|
10
|
+
Listener,
|
|
11
|
+
ListenerEvent,
|
|
12
|
+
ApiKey,
|
|
13
|
+
ApiKeyInput,
|
|
14
|
+
CreatedApiKey,
|
|
15
|
+
ScheduleRun,
|
|
16
|
+
AppLink,
|
|
17
|
+
SupportRequest,
|
|
18
|
+
EmailFilter,
|
|
19
|
+
EmailStatus,
|
|
20
|
+
EmailInfo,
|
|
21
|
+
EmailRow,
|
|
22
|
+
Integration,
|
|
23
|
+
IntegrationCall,
|
|
24
|
+
IntegrationInput,
|
|
25
|
+
IntegrationPreviewInput,
|
|
26
|
+
IntegrationResponse,
|
|
27
|
+
IntegrationTest,
|
|
28
|
+
IntegrationCredential,
|
|
29
|
+
IntegrationValueInput,
|
|
30
|
+
IntegrationValueKey,
|
|
31
|
+
OAuthClientAuth,
|
|
32
|
+
OAuthGrant,
|
|
33
|
+
AggregateQuery,
|
|
34
|
+
AggregateRow,
|
|
35
|
+
DataQuery,
|
|
36
|
+
DataResult,
|
|
37
|
+
AuditEvent,
|
|
38
|
+
BuilderRole,
|
|
39
|
+
AuditFilter,
|
|
40
|
+
BuilderRow,
|
|
41
|
+
DeployResult,
|
|
42
|
+
FormatResult,
|
|
43
|
+
FunctionResult,
|
|
44
|
+
RenderRequest,
|
|
45
|
+
RenderRow,
|
|
46
|
+
InstanceInfo,
|
|
47
|
+
AssetRow,
|
|
48
|
+
AttachmentInfo,
|
|
49
|
+
AttachmentRequest,
|
|
50
|
+
AttachmentRow,
|
|
51
|
+
MemberRow,
|
|
52
|
+
UploadRequest,
|
|
53
|
+
UploadTicket,
|
|
54
|
+
PersonRow,
|
|
55
|
+
PreviewInput,
|
|
56
|
+
PreviewResult,
|
|
57
|
+
OtherPreview,
|
|
58
|
+
PreviewRow,
|
|
59
|
+
PushResult,
|
|
60
|
+
SiteAccess,
|
|
61
|
+
SiteSummary,
|
|
62
|
+
SqlResult,
|
|
63
|
+
RedactInput,
|
|
64
|
+
RedactResult,
|
|
65
|
+
TableInfo,
|
|
66
|
+
Version,
|
|
67
|
+
WorkspaceInfo,
|
|
68
|
+
} from "./types.d.mts";
|
|
69
|
+
|
|
70
|
+
export type {
|
|
71
|
+
AuditActor,
|
|
72
|
+
AuditEvent,
|
|
73
|
+
AuditFilter,
|
|
74
|
+
BuilderRow,
|
|
75
|
+
DeployResult,
|
|
76
|
+
InstanceInfo,
|
|
77
|
+
MemberRow,
|
|
78
|
+
PersonRow,
|
|
79
|
+
PushResult,
|
|
80
|
+
SiteAccess,
|
|
81
|
+
SiteSummary,
|
|
82
|
+
Version,
|
|
83
|
+
WorkspaceInfo,
|
|
84
|
+
} from "./types.d.mts";
|
|
85
|
+
|
|
86
|
+
/** What the last pull or push left as the working copy's baseline. */
|
|
87
|
+
export type Pulled = { version: Version; hashes: Record<string, string> };
|
|
88
|
+
/** The working copy against its baseline (`ez status`). */
|
|
89
|
+
export type Changes = { added: string[]; modified: string[]; deleted: string[] };
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* What a command needs from its host: the working copy (unchanged), the Instance's HTTP API and one of its
|
|
93
|
+
* Sites'. How each remote method reaches the API (method, path, body) is ROUTES, below; nothing else says.
|
|
94
|
+
*/
|
|
95
|
+
export interface Workspace {
|
|
96
|
+
callFunction(name: string, input: unknown, preview?: string): Promise<FunctionResult>;
|
|
97
|
+
// Documents (docs/adr/0105)
|
|
98
|
+
renderDocument(input: RenderRequest): Promise<RenderRow>;
|
|
99
|
+
listRenders(): Promise<RenderRow[]>;
|
|
100
|
+
renderInfo(id: string): Promise<RenderRow>;
|
|
101
|
+
/** Which Instance and target this Workspace is bound to (`site` is GLOBAL_ID for the Global Workspace). */
|
|
102
|
+
target?: { instance: string; site: string | null };
|
|
103
|
+
workspaceFor?(
|
|
104
|
+
target: { instance?: string; site?: string; account?: string },
|
|
105
|
+
files: boolean,
|
|
106
|
+
): Promise<Workspace>;
|
|
107
|
+
// the working copy (unchanged)
|
|
108
|
+
files(): Promise<Record<string, string>>;
|
|
109
|
+
write(path: string, content: string): Promise<void>;
|
|
110
|
+
remove(path: string): Promise<void>;
|
|
111
|
+
pulled(): Promise<Pulled | null>;
|
|
112
|
+
setPulled(p: Pulled): Promise<void>;
|
|
113
|
+
/** The client's default Preview name (the CLI's folder, the studio's remembered name); absent when it has none. */
|
|
114
|
+
globalWorkspace?(): Workspace | Promise<Workspace>;
|
|
115
|
+
globalFiles?(): Promise<Record<string, string> | undefined>;
|
|
116
|
+
previewName?(): Promise<string | null>;
|
|
117
|
+
/** The names this client's editor declarations export per module (`@ezship/react`, ...); the CLI's bundle. */
|
|
118
|
+
editorExports?(): Promise<Record<string, string[]>>;
|
|
119
|
+
// the Instance
|
|
120
|
+
instanceStatus(): Promise<InstanceInfo>;
|
|
121
|
+
updateInstance(patch: { name?: string }): Promise<InstanceInfo>;
|
|
122
|
+
listAudit(filter: AuditFilter): Promise<{ events: AuditEvent[]; truncated: boolean }>;
|
|
123
|
+
listSites(): Promise<SiteSummary[]>;
|
|
124
|
+
createSite(input: { name: string }): Promise<SiteSummary>;
|
|
125
|
+
archiveSite(id: string): Promise<void>;
|
|
126
|
+
listBuilders(): Promise<BuilderRow[]>;
|
|
127
|
+
addBuilder(input: {
|
|
128
|
+
email: string;
|
|
129
|
+
name?: string;
|
|
130
|
+
role: string;
|
|
131
|
+
}): Promise<{ id: string; alreadyExists: boolean; resent?: boolean }>;
|
|
132
|
+
setBuilderRole(id: string, role: string): Promise<void>;
|
|
133
|
+
removeBuilder(id: string): Promise<void>;
|
|
134
|
+
listUsers(): Promise<MemberRow[]>;
|
|
135
|
+
/** Support Requests to the Host's Developers (docs/adr/0080); `site` is the bound Site, or null. */
|
|
136
|
+
openSupportRequest(input: {
|
|
137
|
+
subject: string;
|
|
138
|
+
body: string;
|
|
139
|
+
site: string | null;
|
|
140
|
+
}): Promise<SupportRequest>;
|
|
141
|
+
listSupportRequests(): Promise<SupportRequest[]>;
|
|
142
|
+
supportRequest(id: string): Promise<SupportRequest>;
|
|
143
|
+
/** Emails server code sent (docs/adr/0149), newest first; a Limited Builder sees only their Sites'. */
|
|
144
|
+
listEmails(filter?: EmailFilter): Promise<EmailRow[]>;
|
|
145
|
+
emailInfo(id: string): Promise<EmailInfo>;
|
|
146
|
+
/** Integrations (docs/adr/0092): every Builder lists; Admins set, preview and remove. */
|
|
147
|
+
listIntegrations(): Promise<Integration[]>;
|
|
148
|
+
setIntegration(name: string, input: IntegrationInput): Promise<Integration>;
|
|
149
|
+
setIntegrationPreview(name: string, input: IntegrationPreviewInput): Promise<Integration>;
|
|
150
|
+
/** ADR 0138: Admins set or remove one header or parameter a binding adds. */
|
|
151
|
+
setIntegrationValue(name: string, input: IntegrationValueInput): Promise<Integration>;
|
|
152
|
+
removeIntegrationValue(name: string, key: IntegrationValueKey): Promise<Integration>;
|
|
153
|
+
removeIntegration(name: string, force: boolean): Promise<void>;
|
|
154
|
+
integrationCalls(name: string): Promise<IntegrationCall[]>;
|
|
155
|
+
testIntegration(name: string, input: IntegrationTest): Promise<IntegrationResponse>;
|
|
156
|
+
addUser(input: {
|
|
157
|
+
email: string;
|
|
158
|
+
name?: string;
|
|
159
|
+
}): Promise<{ id: string; alreadyMember: boolean; resent?: boolean }>;
|
|
160
|
+
setUserStatus(id: string, status: string): Promise<void>;
|
|
161
|
+
removeUser(id: string): Promise<void>;
|
|
162
|
+
/** Admins: replace a Member's roster groups (docs/adr/0098). */
|
|
163
|
+
setUserGroups(id: string, groups: string[]): Promise<void>;
|
|
164
|
+
// the Instance's assets (docs/adr/0014)
|
|
165
|
+
listAssets(): Promise<AssetRow[]>;
|
|
166
|
+
requestUpload(input: UploadRequest): Promise<UploadTicket>;
|
|
167
|
+
finalizeUpload(id: string): Promise<AssetRow>;
|
|
168
|
+
deleteAsset(id: string, force: boolean): Promise<void>;
|
|
169
|
+
/** The adapter's part of an upload: a local file's size and type, and sending its bytes to the ticket's URL. */
|
|
170
|
+
fileInfo?(
|
|
171
|
+
source: string,
|
|
172
|
+
): Promise<{ size: number; contentType: string | null; filename: string }>;
|
|
173
|
+
sendFile?(upload: UploadTicket["upload"], source: string): Promise<void>;
|
|
174
|
+
// App Attachments (docs/adr/0047): `ez db attach` and `ez db attachment`
|
|
175
|
+
requestAttachment(input: AttachmentRequest): Promise<UploadTicket>;
|
|
176
|
+
finalizeAttachment(id: string): Promise<AttachmentRow>;
|
|
177
|
+
attachmentInfo(id: string): Promise<AttachmentInfo>;
|
|
178
|
+
/** The adapter's part of `ez db attachment --out`: fetch the bytes at `download` with its credential into a local file. */
|
|
179
|
+
receiveFile?(download: string, destination: string): Promise<void>;
|
|
180
|
+
// the Site
|
|
181
|
+
remoteStatus(): Promise<WorkspaceInfo>;
|
|
182
|
+
updateSettings(patch: { name?: string }): Promise<WorkspaceInfo>;
|
|
183
|
+
fetchAll(version?: number): Promise<{ version: Version; files: Record<string, string> }>;
|
|
184
|
+
listVersions(): Promise<Version[]>;
|
|
185
|
+
/** `deleted`: tracked files the Working Copy no longer has; deleted even without prune. */
|
|
186
|
+
pushAll(
|
|
187
|
+
files: Record<string, string>,
|
|
188
|
+
prune: boolean,
|
|
189
|
+
deleted?: string[],
|
|
190
|
+
options?: {
|
|
191
|
+
message?: string;
|
|
192
|
+
dryRun?: boolean;
|
|
193
|
+
acknowledgeExposure?: boolean;
|
|
194
|
+
force?: boolean;
|
|
195
|
+
},
|
|
196
|
+
): Promise<PushResult>;
|
|
197
|
+
deploy(): Promise<DeployResult>;
|
|
198
|
+
/** The Instance's pushed global/schedules.json (ADRs 0076, 0136), each with its next due time and latest run. */
|
|
199
|
+
listSchedules(): Promise<Schedule[]>;
|
|
200
|
+
/** Listeners (docs/adr/0092): any Builder of the Site. */
|
|
201
|
+
listListeners(): Promise<Listener[]>;
|
|
202
|
+
setListenerSecret(name: string, input: { secret: string; overlapHours?: number }): Promise<void>;
|
|
203
|
+
removeListenerSecret(name: string): Promise<void>;
|
|
204
|
+
listenerEvents(name: string, dead: boolean): Promise<ListenerEvent[]>;
|
|
205
|
+
listenerEvent(name: string, id: string): Promise<ListenerEvent>;
|
|
206
|
+
retryListenerEvent(name: string, id: string): Promise<ListenerEvent>;
|
|
207
|
+
/** API Keys (docs/adr/0119): Admins create and revoke; any Builder of the Site lists. */
|
|
208
|
+
listApiKeys(): Promise<ApiKey[]>;
|
|
209
|
+
createApiKey(input: ApiKeyInput): Promise<CreatedApiKey>;
|
|
210
|
+
revokeApiKey(name: string): Promise<ApiKey>;
|
|
211
|
+
listScheduleRuns(name: string): Promise<ScheduleRun[]>;
|
|
212
|
+
/** Runs a schedule's job now, as its actor; answers the run, failed or not. */
|
|
213
|
+
runSchedule(name: string): Promise<ScheduleRun>;
|
|
214
|
+
/** Stops a schedule's due times (ADR 0120); answers the schedule. */
|
|
215
|
+
pauseSchedule(name: string): Promise<Schedule>;
|
|
216
|
+
/** Starts a paused schedule's due times again from now, never catching up; answers the schedule. */
|
|
217
|
+
resumeSchedule(name: string): Promise<Schedule>;
|
|
218
|
+
/** `global`: the Global Working Copy to check against, as a Preview would upload it (ADR 0021). */
|
|
219
|
+
check(
|
|
220
|
+
files: Record<string, string>,
|
|
221
|
+
global?: Record<string, string>,
|
|
222
|
+
): Promise<{ diagnostics: Diagnostic[] }>;
|
|
223
|
+
/** `ez format` (docs/adr/0089): the formatter's changed files, or the syntax errors that stopped it. */
|
|
224
|
+
format(files: Record<string, string>): Promise<FormatResult>;
|
|
225
|
+
listPreviews(): Promise<PreviewRow[]>;
|
|
226
|
+
/** Other Builders' Previews of this Site, most recently active first (docs/adr/0141). */
|
|
227
|
+
listOtherPreviews(): Promise<OtherPreview[]>;
|
|
228
|
+
uploadPreview(name: string, input: PreviewInput): Promise<PreviewResult>;
|
|
229
|
+
deletePreview(name: string): Promise<void>;
|
|
230
|
+
/** A one-time link to the deployed app, or to the caller's Preview `preview` (docs/adr/0059). */
|
|
231
|
+
appLink(preview?: string | null): Promise<AppLink>;
|
|
232
|
+
dbSchema(): Promise<LiveSchema>;
|
|
233
|
+
dbTables(): Promise<TableInfo[]>;
|
|
234
|
+
dbSql(statement: string): Promise<SqlResult>;
|
|
235
|
+
dbAggregate(table: string, query: AggregateQuery): Promise<DataResult<AggregateRow>>;
|
|
236
|
+
/** A query under one Member's access rules (docs/adr/0098); `as` is their id or email. */
|
|
237
|
+
dbQueryAs(
|
|
238
|
+
table: string,
|
|
239
|
+
as: string,
|
|
240
|
+
query: Record<string, unknown>,
|
|
241
|
+
): Promise<DataResult<Record<string, unknown>>>;
|
|
242
|
+
dbActors(query: DataQuery): Promise<DataResult<ActorRow>>;
|
|
243
|
+
/** Admins: blank columns of a Table's closed History rows (docs/adr/0106). */
|
|
244
|
+
dbRedact(input: RedactInput): Promise<RedactResult>;
|
|
245
|
+
siteAccess(): Promise<SiteAccess>;
|
|
246
|
+
setRestricted(restricted: boolean): Promise<SiteAccess>;
|
|
247
|
+
allowBuilder(id: string): Promise<void>;
|
|
248
|
+
denyBuilder(id: string): Promise<void>;
|
|
249
|
+
allowUser(id: string): Promise<void>;
|
|
250
|
+
denyUser(id: string): Promise<void>;
|
|
251
|
+
/** Members in this group, implied ones included, may open the Restricted Site (docs/adr/0101). */
|
|
252
|
+
allowGroup(name: string): Promise<void>;
|
|
253
|
+
denyGroup(name: string): Promise<void>;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** The Workspace methods that are requests rather than the working copy. */
|
|
257
|
+
export type RemoteMethod = Exclude<
|
|
258
|
+
keyof Workspace,
|
|
259
|
+
| "files"
|
|
260
|
+
| "write"
|
|
261
|
+
| "remove"
|
|
262
|
+
| "pulled"
|
|
263
|
+
| "setPulled"
|
|
264
|
+
| "previewName"
|
|
265
|
+
| "editorExports"
|
|
266
|
+
| "globalFiles"
|
|
267
|
+
| "globalWorkspace"
|
|
268
|
+
| "workspaceFor"
|
|
269
|
+
| "target"
|
|
270
|
+
| "fileInfo"
|
|
271
|
+
| "sendFile"
|
|
272
|
+
| "receiveFile"
|
|
273
|
+
>;
|
|
274
|
+
export type RemoteWorkspace = Pick<Workspace, RemoteMethod | "target">;
|
|
275
|
+
export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
276
|
+
/**
|
|
277
|
+
* One remote method on the wire: the path is a template over `:instance`, `:site` and the method's own params;
|
|
278
|
+
* `args` maps the method's arguments to what fills the template, the JSON body and the query string.
|
|
279
|
+
*/
|
|
280
|
+
export type Route<M extends RemoteMethod = RemoteMethod> = {
|
|
281
|
+
method: HttpMethod;
|
|
282
|
+
path: string;
|
|
283
|
+
args?: (...args: Parameters<Workspace[M]>) => {
|
|
284
|
+
params?: Record<string, string>;
|
|
285
|
+
body?: unknown;
|
|
286
|
+
query?: Record<string, unknown>;
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
/** The wire, one entry per remote method: the clients (httpWorkspace) and the server (matchRoute) both derive from it. */
|
|
290
|
+
export const ROUTES: Readonly<{ [M in RemoteMethod]: Route<M> }>;
|
|
291
|
+
/** A transport: the parsed JSON on success, a thrown Error carrying the API's message otherwise. */
|
|
292
|
+
export type Send = (method: HttpMethod, path: string, body?: unknown) => Promise<unknown>;
|
|
293
|
+
/** The remote half of a Workspace over `send`; a Site method with `site: null` rejects with "This command needs a site." */
|
|
294
|
+
export function httpWorkspace(
|
|
295
|
+
send: Send,
|
|
296
|
+
target: { instance: string; site: string | null },
|
|
297
|
+
): RemoteWorkspace;
|
|
298
|
+
/** `name` is null when the path is a route's but the method is not (405); null altogether for an unknown path. */
|
|
299
|
+
export function matchRoute(
|
|
300
|
+
method: string,
|
|
301
|
+
pathname: string,
|
|
302
|
+
): { name: RemoteMethod | null; params: Record<string, string> } | null;
|
|
303
|
+
|
|
304
|
+
export const MAIN_FILE: "App.tsx";
|
|
305
|
+
export const CONTEXT_FILE: "CONTEXT.md";
|
|
306
|
+
/** Docs (ADR 0144): docs/<name>.md in a Site or the Global Workspace, Markdown never built or served. */
|
|
307
|
+
export const DOCS_DIR: "docs/";
|
|
308
|
+
export function docName(path: string): string | null;
|
|
309
|
+
export function contextError(content: string | undefined): string | null;
|
|
310
|
+
/** CONTEXT.md's generated file inventory markers (docs/adr/0108). */
|
|
311
|
+
export const INVENTORY_START: string;
|
|
312
|
+
export const INVENTORY_END: string;
|
|
313
|
+
/** The inventory block for a Working Copy's files, markers included. */
|
|
314
|
+
export function contextInventory(files: Record<string, string>): string;
|
|
315
|
+
/** CONTEXT.md with its inventory block replaced, or appended when it has none. */
|
|
316
|
+
export function withContextInventory(context: string, files: Record<string, string>): string;
|
|
317
|
+
export const PAGES_DIR: "pages/";
|
|
318
|
+
export const COMPONENTS_DIR: "components/";
|
|
319
|
+
/** Custom hooks (ADR 0091): `hooks/use<Name>.ts` in a Site or the Global Workspace (`global/hooks/use<Name>`). */
|
|
320
|
+
export const HOOKS_DIR: "hooks/";
|
|
321
|
+
export function hookName(path: string): string | null;
|
|
322
|
+
export const FUNCTIONS_DIR: "functions/";
|
|
323
|
+
export const FUNCTION_ARTIFACT: "_server/functions.json";
|
|
324
|
+
/** The Instance's compiled Table rules (docs/adr/0099). */
|
|
325
|
+
export const RULES_ARTIFACT: "_server/rules.json";
|
|
326
|
+
/** The Instance's compiled scheduled jobs (ADR 0136). */
|
|
327
|
+
export const JOBS_ARTIFACT: "_server/jobs.json";
|
|
328
|
+
export const FUNCTION_BASE_PATH: "/_ez/functions";
|
|
329
|
+
/** Global Documents (docs/adr/0105): the folder, the private artifact, the app-host paths and the input cap. */
|
|
330
|
+
export const DOCUMENTS_DIR: "documents/";
|
|
331
|
+
export const DOCUMENT_ARTIFACT: "_server/documents.json";
|
|
332
|
+
export const DOCUMENT_BASE_PATH: "/_ez/documents";
|
|
333
|
+
export const DOCUMENT_RE: RegExp;
|
|
334
|
+
export const MAX_RENDER_INPUT_BYTES: 1000000;
|
|
335
|
+
export function documentName(path: string): string | null;
|
|
336
|
+
export const FUNCTION_NAME_RE: RegExp;
|
|
337
|
+
/** Live Table versions for pages (docs/adr/0053): the push stream, the one-shot map, and the write header. */
|
|
338
|
+
export const LIVE_STREAM_PATH: "/_ez/db/stream";
|
|
339
|
+
export const LIVE_VERSIONS_PATH: "/_ez/db/versions";
|
|
340
|
+
/** The declared Tables' access rules for `useCan` (docs/adr/0098). */
|
|
341
|
+
export const ACCESS_RULES_PATH: "/_ez/access";
|
|
342
|
+
/** The active scope's values for the Framework's switcher (docs/adr/0098). */
|
|
343
|
+
export const SCOPE_PATH: "/_ez/scope";
|
|
344
|
+
export const VERSIONS_HEADER: "ez-versions";
|
|
345
|
+
export function functionName(path: string): string | null;
|
|
346
|
+
/** Local functions (ADR 0048): Node code the Desktop runs on the Member's computer. */
|
|
347
|
+
export const LOCAL_DIR: "local/";
|
|
348
|
+
export const LOCAL_ARTIFACT: "_local/functions.json";
|
|
349
|
+
export const LOCAL_BASE_PATH: "/_ez/local";
|
|
350
|
+
export function localFunctionName(path: string): string | null;
|
|
351
|
+
/** Scheduled jobs (ADRs 0076, 0136): the Global Workspace's jobs/<name>.ts, run by its schedules.json, never by a browser. */
|
|
352
|
+
export const JOBS_DIR: "jobs/";
|
|
353
|
+
export function jobName(path: string): string | null;
|
|
354
|
+
export const SCHEDULES_FILE: "schedules.json";
|
|
355
|
+
export const SCHEDULE_MAX: 20;
|
|
356
|
+
export const SCHEDULE_INPUT_MAX: 16000;
|
|
357
|
+
export const SCHEDULE_NAME_RE: RegExp;
|
|
358
|
+
/** The entries of a schedules.json, and every problem with it; entries is empty when there is any. */
|
|
359
|
+
export function parseSchedules(
|
|
360
|
+
source: string,
|
|
361
|
+
files: Record<string, string>,
|
|
362
|
+
): { entries: ScheduleEntry[]; errors: string[] };
|
|
363
|
+
/** The deployed page's settings (ADR 0148): `page.json` in a Site and in the Global Workspace, the Site's winning. */
|
|
364
|
+
export const PAGE_FILE: "page.json";
|
|
365
|
+
export const PAGE_ICON_MAX: 16000;
|
|
366
|
+
/** The browser icon of a page whose Site and Global Workspace set none. */
|
|
367
|
+
export const DEFAULT_PAGE_ICON: string;
|
|
368
|
+
/** The settings of a page.json, and every problem with it; page is empty when there is any. */
|
|
369
|
+
export function parsePage(source: string): { page: { icon?: string }; errors: string[] };
|
|
370
|
+
/** The SVG a Site's page shows as its browser icon: the Site's page.json, else the Global one, else the default. */
|
|
371
|
+
export function pageIcon(files: Record<string, string>, global: Record<string, string>): string;
|
|
372
|
+
/** Listeners (docs/adr/0092): `listeners/<name>.ts`, named in `listeners.json`, received under LISTENER_BASE_PATH. */
|
|
373
|
+
export const LISTENERS_DIR: "listeners/";
|
|
374
|
+
export function listenerName(path: string): string | null;
|
|
375
|
+
export const LISTENERS_FILE: "listeners.json";
|
|
376
|
+
export const LISTENER_MAX: number;
|
|
377
|
+
export const LISTENER_BASE_PATH: "/_ez/listeners/";
|
|
378
|
+
export const WEBHOOK_SCHEMES: readonly ["standard", "stripe", "github", "token"];
|
|
379
|
+
export const LISTENER_OVERLAP_HOURS: { readonly default: number; readonly max: number };
|
|
380
|
+
/** The Site API (docs/adr/0119): `<prefix>/_ez/api/...` with `Authorization: Bearer ezk_...`. */
|
|
381
|
+
export const API_BASE_PATH: "/_ez/api";
|
|
382
|
+
export const API_KEY_PREFIX: "ezk_";
|
|
383
|
+
export const API_KEY_NAME_RE: RegExp;
|
|
384
|
+
export const API_KEY_DAYS: { readonly default: number; readonly max: number };
|
|
385
|
+
export const API_KEYS_PER_SITE: number;
|
|
386
|
+
export const API_KEY_RATE: { readonly burst: number; readonly perSecond: number };
|
|
387
|
+
export const LISTENER_BODY_MAX: number;
|
|
388
|
+
/** The entries of a listeners.json, every problem with it, and the listeners/ files it does not name. */
|
|
389
|
+
export function parseListeners(
|
|
390
|
+
source: string,
|
|
391
|
+
files: Record<string, string>,
|
|
392
|
+
): { entries: ListenerEntry[]; errors: string[]; warnings: string[] };
|
|
393
|
+
/** Global lib modules (ADR 0077): `lib/<name>.ts`, imported by Sites as `global/lib/<name>`. */
|
|
394
|
+
export const LIB_DIR: "lib/";
|
|
395
|
+
export function libModuleName(path: string): string | null;
|
|
396
|
+
/** Table rules (docs/adr/0099): `rules/<table>.ts` in the Global Workspace. */
|
|
397
|
+
export const RULES_DIR: "rules/";
|
|
398
|
+
export function ruleTableName(path: string): string | null;
|
|
399
|
+
/** Workflows (docs/adr/0103): `workflows/<table>.ts` in the Global Workspace. */
|
|
400
|
+
export const WORKFLOWS_DIR: "workflows/";
|
|
401
|
+
export function workflowTableName(path: string): string | null;
|
|
402
|
+
/** Desktop release files (ADR 0048): the feed path on every app origin, the file-name rule and the cap. */
|
|
403
|
+
export const DESKTOP_PATH: "/_ez/desktop";
|
|
404
|
+
export const DESKTOP_FILE_RE: RegExp;
|
|
405
|
+
export const MAX_DESKTOP_FILE_BYTES: 100000000;
|
|
406
|
+
export const CONSTANTS_FILE: "constants.ts";
|
|
407
|
+
export const STYLE_FILE: "style.css";
|
|
408
|
+
export const TYPES_FILE: "db/types.d.ts";
|
|
409
|
+
export const DEFAULT_GLOBAL_FILES: Readonly<Record<string, string>>;
|
|
410
|
+
/** The theme, Shell and components a new Instance's Global Workspace starts with (Version 0). */
|
|
411
|
+
export const STARTER_GLOBAL_FILES: Readonly<Record<string, string>>;
|
|
412
|
+
export const BUILD_ENTRY: "index.html";
|
|
413
|
+
export const BUILD_CONFIG_MARKER: "<!--ez:config-->";
|
|
414
|
+
/** The compiler options of every Site type check, Pipeline and editor alike (docs/adr/0078). */
|
|
415
|
+
export const COMPILER_OPTIONS: Readonly<{
|
|
416
|
+
target: "ES2022";
|
|
417
|
+
lib: string[];
|
|
418
|
+
module: "ESNext";
|
|
419
|
+
moduleResolution: "Bundler";
|
|
420
|
+
jsx: "react-jsx";
|
|
421
|
+
strict: true;
|
|
422
|
+
noUnusedLocals: true;
|
|
423
|
+
noUnusedParameters: true;
|
|
424
|
+
noImplicitReturns: true;
|
|
425
|
+
noFallthroughCasesInSwitch: true;
|
|
426
|
+
noEmit: true;
|
|
427
|
+
skipLibCheck: true;
|
|
428
|
+
isolatedModules: true;
|
|
429
|
+
}>;
|
|
430
|
+
export const COMPONENT_RE: RegExp;
|
|
431
|
+
export const PAGE_RE: RegExp;
|
|
432
|
+
export function componentName(path: string): string | null;
|
|
433
|
+
export function pageRoute(path: string): string | null;
|
|
434
|
+
export function siteFileError(path: string): string | null;
|
|
435
|
+
/** The Global Workspace's target id and its Shell file; see GLOBAL_ID in commands.mjs. */
|
|
436
|
+
export const GLOBAL_ID: "global";
|
|
437
|
+
export const SHELL_FILE: "Shell.tsx";
|
|
438
|
+
export {
|
|
439
|
+
parseSessionDeclaration,
|
|
440
|
+
sessionValueError,
|
|
441
|
+
SESSION_FILE,
|
|
442
|
+
SESSION_LIMITS,
|
|
443
|
+
SESSION_PATH,
|
|
444
|
+
SESSION_VERSION_KEY,
|
|
445
|
+
} from "./session.d.mts";
|
|
446
|
+
export type { SessionDeclaration, SessionLifetime } from "./session.d.mts";
|
|
447
|
+
/** The packages Site UI and Global components and hooks may import by name (docs/adr/0114). */
|
|
448
|
+
export const SITE_PACKAGES: readonly string[];
|
|
449
|
+
export function globalFileError(path: string): string | null;
|
|
450
|
+
export function globalImportError(
|
|
451
|
+
path: string,
|
|
452
|
+
specifier: string,
|
|
453
|
+
files: Record<string, string>,
|
|
454
|
+
typeOnly?: boolean,
|
|
455
|
+
): string | null;
|
|
456
|
+
export function checkGlobalStructure(files: Record<string, string>): Diagnostic[];
|
|
457
|
+
export type DiagnosticRange = {
|
|
458
|
+
start: { line: number; character: number };
|
|
459
|
+
end: { line: number; character: number };
|
|
460
|
+
};
|
|
461
|
+
/** LSP-shaped, 0-based. `code` is a `CHECK_RULES` id; severity 1 is an error, 2 a warning (docs/adr/0078). */
|
|
462
|
+
export type Diagnostic = {
|
|
463
|
+
file: string;
|
|
464
|
+
range: DiagnosticRange;
|
|
465
|
+
severity: 1 | 2;
|
|
466
|
+
code: string;
|
|
467
|
+
message: string;
|
|
468
|
+
/** One text edit that fixes the problem, when the fix is mechanical. */
|
|
469
|
+
fix?: { range: DiagnosticRange; text: string };
|
|
470
|
+
/** The Site a Global check found this in; `file` is then that Site's path. */
|
|
471
|
+
site?: string;
|
|
472
|
+
};
|
|
473
|
+
export type CheckRule = {
|
|
474
|
+
id: string;
|
|
475
|
+
severity: "error" | "warning";
|
|
476
|
+
summary: string;
|
|
477
|
+
fix: string;
|
|
478
|
+
};
|
|
479
|
+
export const CHECK_RULES: readonly CheckRule[];
|
|
480
|
+
/** `ez help rules`: every rule id, its severity and its fix, rendered from CHECK_RULES. */
|
|
481
|
+
export function helpRules(): string;
|
|
482
|
+
/** One entry of `ez check --json`, 1-based. */
|
|
483
|
+
export type CheckEntry = {
|
|
484
|
+
file: string;
|
|
485
|
+
line: number;
|
|
486
|
+
column: number;
|
|
487
|
+
rule: string;
|
|
488
|
+
severity: "error" | "warning";
|
|
489
|
+
message: string;
|
|
490
|
+
fix?: { range: DiagnosticRange; text: string };
|
|
491
|
+
site?: string;
|
|
492
|
+
};
|
|
493
|
+
export function checkEntries(diagnostics: Diagnostic[]): CheckEntry[];
|
|
494
|
+
export type ImportRef = { specifier: string; typeOnly: boolean; line: number; character: number };
|
|
495
|
+
export const DEFAULT_SITE_FILES: Readonly<Record<string, string>>;
|
|
496
|
+
export function scanImports(source: string): ImportRef[];
|
|
497
|
+
export function importError(
|
|
498
|
+
path: string,
|
|
499
|
+
specifier: string,
|
|
500
|
+
typeOnly: boolean,
|
|
501
|
+
files: Record<string, string>,
|
|
502
|
+
): string | null;
|
|
503
|
+
export function checkStructure(files: Record<string, string>): Diagnostic[];
|
|
504
|
+
export function formatDiagnostics(diagnostics: Diagnostic[]): string;
|
|
505
|
+
export const FILE_PATH_RE: RegExp;
|
|
506
|
+
export const MAX_FILE_BYTES: 1000000;
|
|
507
|
+
export { MAX_MESSAGE_CHARS, messageText } from "./schema.mjs";
|
|
508
|
+
export function isValidFilePath(path: string): boolean;
|
|
509
|
+
|
|
510
|
+
export const INSTANCE_ID_RE: RegExp;
|
|
511
|
+
export const RESERVED_INSTANCE_IDS: Set<string>;
|
|
512
|
+
export function isValidInstanceId(id: string): boolean;
|
|
513
|
+
export const SITE_ID_RE: RegExp;
|
|
514
|
+
export const RESERVED_SITE_IDS: Set<string>;
|
|
515
|
+
export function isValidSiteId(id: string): boolean;
|
|
516
|
+
export const SITES_FOLDER: "sites";
|
|
517
|
+
export const RESERVED_FOLDER_NAMES: Set<string>;
|
|
518
|
+
export function siteFolderName(name: string): string;
|
|
519
|
+
export function siteNameError(name: string): string | null;
|
|
520
|
+
export function isValidTargetId(id: string): boolean;
|
|
521
|
+
export const ASSET_NAME_RE: RegExp;
|
|
522
|
+
export const ASSET_TYPES: Readonly<Record<string, string>>;
|
|
523
|
+
export const MAX_ASSET_BYTES: 100000000;
|
|
524
|
+
export const MAX_INSTANCE_ASSET_BYTES: 2000000000;
|
|
525
|
+
export const ASSET_PATH: "/_ez/files";
|
|
526
|
+
export function assetContentType(filename: string): string | null;
|
|
527
|
+
/** App Attachments (docs/adr/0047): the type table, the caps and the app-host path. */
|
|
528
|
+
export const ATTACHMENT_TYPES: Readonly<Record<string, string>>;
|
|
529
|
+
export const MAX_ATTACHMENT_BYTES: 25000000;
|
|
530
|
+
export const MAX_INSTANCE_ATTACHMENT_BYTES: 10000000000;
|
|
531
|
+
export const MAX_UNBOUND_ATTACHMENTS: 20;
|
|
532
|
+
export const MAX_UNBOUND_ATTACHMENT_BYTES: 250000000;
|
|
533
|
+
export const UNBOUND_ATTACHMENT_TTL_MS: 86400000;
|
|
534
|
+
export const ATTACHMENT_PATH: "/_ez/attachments";
|
|
535
|
+
export function attachmentContentType(filename: string): string | null;
|
|
536
|
+
/** Hosted Previews (docs/adr/0013): the URL segment, the name shape, the per-Builder cap and the idle expiry. */
|
|
537
|
+
export const PREVIEW_SEGMENT: "~preview";
|
|
538
|
+
export const PREVIEW_NAME_RE: RegExp;
|
|
539
|
+
export const MAX_PREVIEWS_PER_BUILDER: 10;
|
|
540
|
+
export const PREVIEW_IDLE_MS: number;
|
|
541
|
+
export function previewNameError(name: string): string | null;
|
|
542
|
+
export function previewNameFrom(text: string): string;
|
|
543
|
+
/** One-time app links (docs/adr/0059): how long a link works after `ez link` mints it. */
|
|
544
|
+
export const APP_LINK_TTL_MS: number;
|
|
545
|
+
/** Support Requests (docs/adr/0080): subject and body lengths in characters, and requests per Builder per day. */
|
|
546
|
+
export const SUPPORT_SUBJECT_MAX: number;
|
|
547
|
+
export const SUPPORT_BODY_MAX: number;
|
|
548
|
+
export const SUPPORT_REQUESTS_PER_DAY: number;
|
|
549
|
+
/** Email limits (docs/adr/0149). */
|
|
550
|
+
export const EMAIL_LIMITS: Readonly<{
|
|
551
|
+
perInvocation: number;
|
|
552
|
+
subject: number;
|
|
553
|
+
body: number;
|
|
554
|
+
buttonLabel: number;
|
|
555
|
+
buttonHref: number;
|
|
556
|
+
perDay: number;
|
|
557
|
+
perMinute: number;
|
|
558
|
+
attempts: number;
|
|
559
|
+
}>;
|
|
560
|
+
export const EMAIL_STATUSES: readonly EmailStatus[];
|
|
561
|
+
/** Integrations (docs/adr/0092): names, kinds, credential types, limits and the origin and name checks. */
|
|
562
|
+
export const INTEGRATION_NAME_RE: RegExp;
|
|
563
|
+
export const INTEGRATION_KINDS: readonly ["http"];
|
|
564
|
+
export const CREDENTIAL_TYPES: readonly ["header", "query", "basic", "oauth"];
|
|
565
|
+
export const INTEGRATION_CALLS_KEPT: number;
|
|
566
|
+
export const INTEGRATION_TIMEOUT: {
|
|
567
|
+
readonly min: number;
|
|
568
|
+
readonly default: number;
|
|
569
|
+
readonly max: number;
|
|
570
|
+
};
|
|
571
|
+
export const INTEGRATION_LIMITS: {
|
|
572
|
+
readonly perInstance: number;
|
|
573
|
+
readonly credentialBytes: number;
|
|
574
|
+
readonly requestsPerInvocation: number;
|
|
575
|
+
readonly invocationMs: number;
|
|
576
|
+
readonly bodyBytes: number;
|
|
577
|
+
readonly responseHeaderBytes: number;
|
|
578
|
+
readonly inFlightPerInstance: number;
|
|
579
|
+
readonly perSecond: number;
|
|
580
|
+
readonly burst: number;
|
|
581
|
+
readonly valuesPerBinding: number;
|
|
582
|
+
readonly addedHeaderBytes: number;
|
|
583
|
+
readonly secretMinLength: number;
|
|
584
|
+
};
|
|
585
|
+
export const INTEGRATION_METHODS: readonly ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE"];
|
|
586
|
+
export function integrationOriginError(origin: string, allowHttp?: boolean): string | null;
|
|
587
|
+
export function credentialHeaderError(name: string): string | null;
|
|
588
|
+
export function credentialParamError(param: string): string | null;
|
|
589
|
+
export function basicUserError(user: string): string | null;
|
|
590
|
+
/** OAuth (docs/adr/0140, a draft): the configuration a credential holds; its flows are not built. */
|
|
591
|
+
export const OAUTH_GRANTS: readonly ["client-credentials", "password", "authorization-code"];
|
|
592
|
+
export const OAUTH_CLIENT_AUTH: readonly ["basic", "post"];
|
|
593
|
+
export const OAUTH_NOT_BUILT: string;
|
|
594
|
+
export type OAuthPreset = {
|
|
595
|
+
readonly name: string;
|
|
596
|
+
readonly grant: OAuthGrant;
|
|
597
|
+
readonly origin: string;
|
|
598
|
+
readonly sandboxOrigin: string | null;
|
|
599
|
+
readonly authorizeUrl: string | null;
|
|
600
|
+
readonly tokenUrl: string;
|
|
601
|
+
readonly revokeUrl: string | null;
|
|
602
|
+
readonly scopes: readonly string[];
|
|
603
|
+
readonly clientAuth: OAuthClientAuth;
|
|
604
|
+
readonly rotatesRefreshTokens: boolean;
|
|
605
|
+
/** The connection values a grant brings (the callback's or the token answer's). */
|
|
606
|
+
readonly connection: readonly string[];
|
|
607
|
+
/** Plain values every request needs (docs/adr/0138). */
|
|
608
|
+
readonly values: readonly {
|
|
609
|
+
readonly place: "header" | "query";
|
|
610
|
+
readonly name: string;
|
|
611
|
+
readonly value: string;
|
|
612
|
+
}[];
|
|
613
|
+
};
|
|
614
|
+
export const OAUTH_PRESETS: Readonly<Record<string, OAuthPreset>>;
|
|
615
|
+
export function oauthUrlError(url: string, allowHttp?: boolean): string | null;
|
|
616
|
+
export function oauthCredentialError(
|
|
617
|
+
credential: Partial<Extract<IntegrationCredential, { type: "oauth" }>>,
|
|
618
|
+
allowHttp?: boolean,
|
|
619
|
+
): string | null;
|
|
620
|
+
/** Invites (docs/adr/0025): the claim window and the listing status. */
|
|
621
|
+
export const INVITE_TTL_MS: number;
|
|
622
|
+
export const BUILDER_ROLES: readonly BuilderRole[];
|
|
623
|
+
export type InviteStatus = null | { daysLeft: number } | { expired: true };
|
|
624
|
+
export function inviteStatus(
|
|
625
|
+
person: { lastSignInAt: number | null; invitedAt?: number | null },
|
|
626
|
+
now?: number,
|
|
627
|
+
): InviteStatus;
|
|
628
|
+
export function parseTarget(text: string): { instance: string | null; site: string } | null;
|
|
629
|
+
export const AUTH_PATH: string;
|
|
630
|
+
|
|
631
|
+
export function hashContent(s: string): string;
|
|
632
|
+
export function localChanges(files: Record<string, string>, pulled: Pulled | null): Changes;
|
|
633
|
+
export function countChanges(c: Changes): number;
|
|
634
|
+
export function ago(at: number | null | undefined): string;
|
|
635
|
+
|
|
636
|
+
export const COMMAND_NAMES: readonly string[];
|
|
637
|
+
export const AUDIT_KINDS: readonly string[];
|
|
638
|
+
/** `ez help`'s onboarding: where you are, the programming model, the files, how to work, the lifecycle. */
|
|
639
|
+
export const CONVENTIONS: string;
|
|
640
|
+
/** Every command, one line each: `ez help commands`. */
|
|
641
|
+
export const HELP: string;
|
|
642
|
+
/** `ez help`: CONVENTIONS, the topic index and the everyday commands; the Studio agent's system prompt. */
|
|
643
|
+
export const INSTRUCTIONS: string;
|
|
644
|
+
/** `ez help <topic>`, in index order. */
|
|
645
|
+
export const HELP_TOPICS: readonly { name: string; summary: string; text: () => string }[];
|
|
646
|
+
/** `ez help [<topic> | all]`'s text; null for an unknown topic. */
|
|
647
|
+
export function helpText(topic?: string): string | null;
|
|
648
|
+
/** A complete example of `ez help recipes`; the Pipeline's tests build each against the starter Global. */
|
|
649
|
+
export type Recipe = {
|
|
650
|
+
name: string;
|
|
651
|
+
title: string;
|
|
652
|
+
/** The help topics with the detail. */
|
|
653
|
+
topics: readonly string[];
|
|
654
|
+
/** Statements to add to global/db/schema.sql, or null for none. */
|
|
655
|
+
schema: string | null;
|
|
656
|
+
/** Global Workspace files, by path within global/. */
|
|
657
|
+
global: Readonly<Record<string, string>>;
|
|
658
|
+
/** Site files, by path. */
|
|
659
|
+
files: Readonly<Record<string, string>>;
|
|
660
|
+
notes: string;
|
|
661
|
+
};
|
|
662
|
+
export const RECIPES: readonly Recipe[];
|
|
663
|
+
|
|
664
|
+
export function describeCommand(argv: string[]): string;
|
|
665
|
+
export function runCommand(ws: Workspace, argv: string[], stdin?: string): Promise<string>;
|
|
666
|
+
/** A command that failed with data (ez check's problems); under --json its message is that data as JSON. */
|
|
667
|
+
export class CommandFailure extends Error {
|
|
668
|
+
constructor(message: string, data: unknown);
|
|
669
|
+
data: unknown;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
export const COMMANDS: readonly { usage: string; help: string }[];
|