@positronic/spec 0.0.56 → 0.0.58
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/api/auth.d.ts +14 -0
- package/dist/api/auth.d.ts.map +1 -0
- package/dist/api/auth.js +38 -0
- package/dist/api/auth.js.map +1 -0
- package/dist/{api.d.ts → api/brains.d.ts} +2 -160
- package/dist/api/brains.d.ts.map +1 -0
- package/dist/{api.js → api/brains.js} +18 -1234
- package/dist/api/brains.js.map +1 -0
- package/dist/api/bundle.d.ts +17 -0
- package/dist/api/bundle.d.ts.map +1 -0
- package/dist/api/bundle.js +56 -0
- package/dist/api/bundle.js.map +1 -0
- package/dist/api/index.d.ts +14 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +12 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/pages.d.ts +46 -0
- package/dist/api/pages.d.ts.map +1 -0
- package/dist/api/pages.js +338 -0
- package/dist/api/pages.js.map +1 -0
- package/dist/api/resources.d.ts +28 -0
- package/dist/api/resources.d.ts.map +1 -0
- package/dist/api/resources.js +272 -0
- package/dist/api/resources.js.map +1 -0
- package/dist/api/schedules.d.ts +20 -0
- package/dist/api/schedules.d.ts.map +1 -0
- package/dist/api/schedules.js +159 -0
- package/dist/api/schedules.js.map +1 -0
- package/dist/api/secrets.d.ts +42 -0
- package/dist/api/secrets.d.ts.map +1 -0
- package/dist/api/secrets.js +259 -0
- package/dist/api/secrets.js.map +1 -0
- package/dist/api/signals.d.ts +53 -0
- package/dist/api/signals.d.ts.map +1 -0
- package/dist/api/signals.js +276 -0
- package/dist/api/signals.js.map +1 -0
- package/dist/api/status.d.ts +3 -0
- package/dist/api/status.d.ts.map +1 -0
- package/dist/api/status.js +23 -0
- package/dist/api/status.js.map +1 -0
- package/dist/api/types.d.ts +2 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +2 -0
- package/dist/api/types.js.map +1 -0
- package/dist/api/users.d.ts +43 -0
- package/dist/api/users.d.ts.map +1 -0
- package/dist/api/users.js +221 -0
- package/dist/api/users.js.map +1 -0
- package/dist/api/webhooks.d.ts +30 -0
- package/dist/api/webhooks.d.ts.map +1 -0
- package/dist/api/webhooks.js +208 -0
- package/dist/api/webhooks.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/api/auth.js +204 -0
- package/dist/src/{api.js → api/brains.js} +1378 -4108
- package/dist/src/api/bundle.js +228 -0
- package/dist/src/api/index.js +11 -0
- package/dist/src/api/pages.js +840 -0
- package/dist/src/api/resources.js +707 -0
- package/dist/src/api/schedules.js +479 -0
- package/dist/src/api/secrets.js +718 -0
- package/dist/src/api/signals.js +778 -0
- package/dist/src/api/status.js +180 -0
- package/dist/src/api/types.js +1 -0
- package/dist/src/api/users.js +650 -0
- package/dist/src/api/webhooks.js +639 -0
- package/dist/src/index.js +1 -1
- package/package.json +1 -1
- package/dist/api.d.ts.map +0 -1
- package/dist/api.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Fetch } from './types.js';
|
|
2
|
+
export interface AuthSetupResponse {
|
|
3
|
+
backend: string;
|
|
4
|
+
rootKeyConfigured: boolean;
|
|
5
|
+
instructions: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const auth: {
|
|
8
|
+
/**
|
|
9
|
+
* Test GET /auth/setup - Unauthenticated endpoint returning setup instructions
|
|
10
|
+
* This endpoint should be accessible without authentication
|
|
11
|
+
*/
|
|
12
|
+
setup(fetch: Fetch): Promise<boolean>;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,IAAI;IACf;;;OAGG;iBACgB,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC;CAqC5C,CAAC"}
|
package/dist/api/auth.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const auth = {
|
|
2
|
+
/**
|
|
3
|
+
* Test GET /auth/setup - Unauthenticated endpoint returning setup instructions
|
|
4
|
+
* This endpoint should be accessible without authentication
|
|
5
|
+
*/
|
|
6
|
+
async setup(fetch) {
|
|
7
|
+
try {
|
|
8
|
+
const request = new Request('http://example.com/auth/setup', {
|
|
9
|
+
method: 'GET',
|
|
10
|
+
});
|
|
11
|
+
const response = await fetch(request);
|
|
12
|
+
if (!response.ok) {
|
|
13
|
+
console.error(`GET /auth/setup returned ${response.status}`);
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const data = (await response.json());
|
|
17
|
+
// Validate response structure
|
|
18
|
+
if (typeof data.backend !== 'string') {
|
|
19
|
+
console.error(`Expected backend to be string, got ${typeof data.backend}`);
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (typeof data.rootKeyConfigured !== 'boolean') {
|
|
23
|
+
console.error(`Expected rootKeyConfigured to be boolean, got ${typeof data.rootKeyConfigured}`);
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if (typeof data.instructions !== 'string') {
|
|
27
|
+
console.error(`Expected instructions to be string, got ${typeof data.instructions}`);
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
console.error(`Failed to test GET /auth/setup:`, error);
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0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CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;YACxD,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -1,31 +1,4 @@
|
|
|
1
|
-
type Fetch
|
|
2
|
-
export declare function testStatus(fetch: Fetch): Promise<boolean>;
|
|
3
|
-
export declare const resources: {
|
|
4
|
-
/**
|
|
5
|
-
* Test GET /resources - List all resources
|
|
6
|
-
*/
|
|
7
|
-
list(fetch: Fetch): Promise<boolean>;
|
|
8
|
-
/**
|
|
9
|
-
* Test POST /resources - Upload a resource
|
|
10
|
-
*/
|
|
11
|
-
upload(fetch: Fetch): Promise<boolean>;
|
|
12
|
-
/**
|
|
13
|
-
* Test DELETE /resources/:key - Delete a specific resource
|
|
14
|
-
*/
|
|
15
|
-
delete(fetch: Fetch, key: string): Promise<boolean>;
|
|
16
|
-
/**
|
|
17
|
-
* Test DELETE /resources - Bulk delete all resources (dev mode only)
|
|
18
|
-
*/
|
|
19
|
-
deleteAll(fetch: Fetch): Promise<boolean>;
|
|
20
|
-
/**
|
|
21
|
-
* Test DELETE /resources preserves pages - bulk delete should not delete pages
|
|
22
|
-
*/
|
|
23
|
-
deleteAllPreservesPages(fetch: Fetch): Promise<boolean>;
|
|
24
|
-
/**
|
|
25
|
-
* Test POST /resources/presigned-link - Generate presigned URL for upload
|
|
26
|
-
*/
|
|
27
|
-
generatePresignedLink(fetch: Fetch): Promise<boolean>;
|
|
28
|
-
};
|
|
1
|
+
import type { Fetch } from './types.js';
|
|
29
2
|
export declare const brains: {
|
|
30
3
|
/**
|
|
31
4
|
* Test POST /brains/runs - Create a new brain run
|
|
@@ -152,135 +125,4 @@ export declare const brains: {
|
|
|
152
125
|
*/
|
|
153
126
|
innerBrainCompleteDoesNotAffectOuterStatus(fetch: Fetch, outerBrainIdentifier: string, webhookSlug: string, webhookPayload: Record<string, any>): Promise<boolean>;
|
|
154
127
|
};
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Test POST /brains/schedules - Create a new schedule
|
|
158
|
-
*/
|
|
159
|
-
create(fetch: Fetch, identifier: string, cronExpression: string): Promise<string | null>;
|
|
160
|
-
/**
|
|
161
|
-
* Test GET /brains/schedules - List all schedules
|
|
162
|
-
*/
|
|
163
|
-
list(fetch: Fetch): Promise<boolean>;
|
|
164
|
-
/**
|
|
165
|
-
* Test DELETE /brains/schedules/:scheduleId - Delete a schedule
|
|
166
|
-
*/
|
|
167
|
-
delete(fetch: Fetch, scheduleId: string): Promise<boolean>;
|
|
168
|
-
/**
|
|
169
|
-
* Test GET /brains/schedules/runs - Get history of scheduled runs
|
|
170
|
-
*/
|
|
171
|
-
runs(fetch: Fetch, scheduleId?: string, limit?: number): Promise<boolean>;
|
|
172
|
-
};
|
|
173
|
-
export declare const secrets: {
|
|
174
|
-
/**
|
|
175
|
-
* Test POST /secrets - Create or update a secret
|
|
176
|
-
*/
|
|
177
|
-
create(fetch: Fetch, name: string, value: string): Promise<boolean>;
|
|
178
|
-
/**
|
|
179
|
-
* Test GET /secrets - List all secrets (names only, not values)
|
|
180
|
-
*/
|
|
181
|
-
list(fetch: Fetch): Promise<boolean>;
|
|
182
|
-
/**
|
|
183
|
-
* Test DELETE /secrets/:name - Delete a specific secret
|
|
184
|
-
*/
|
|
185
|
-
delete(fetch: Fetch, name: string): Promise<boolean>;
|
|
186
|
-
/**
|
|
187
|
-
* Test GET /secrets/:name/exists - Check if a secret exists
|
|
188
|
-
*/
|
|
189
|
-
exists(fetch: Fetch, name: string): Promise<boolean>;
|
|
190
|
-
/**
|
|
191
|
-
* Test POST /secrets/bulk - Create multiple secrets
|
|
192
|
-
*/
|
|
193
|
-
bulk(fetch: Fetch, secrets: Array<{
|
|
194
|
-
name: string;
|
|
195
|
-
value: string;
|
|
196
|
-
}>): Promise<boolean>;
|
|
197
|
-
};
|
|
198
|
-
export declare const webhooks: {
|
|
199
|
-
/**
|
|
200
|
-
* Test GET /webhooks - List all available webhook handlers
|
|
201
|
-
*/
|
|
202
|
-
list(fetch: Fetch): Promise<boolean>;
|
|
203
|
-
/**
|
|
204
|
-
* Test POST /webhooks/:slug - Receive an incoming webhook from an external service
|
|
205
|
-
*/
|
|
206
|
-
receive(fetch: Fetch, slug: string, payload: any): Promise<boolean>;
|
|
207
|
-
/**
|
|
208
|
-
* Test POST /webhooks/:slug with non-existent webhook - Should return 404
|
|
209
|
-
*/
|
|
210
|
-
notFound(fetch: Fetch, slug: string): Promise<boolean>;
|
|
211
|
-
/**
|
|
212
|
-
* Test POST /webhooks/system/ui-form - Built-in webhook for UI form submissions.
|
|
213
|
-
* This is used by pages generated via .ui() steps to submit form data.
|
|
214
|
-
*
|
|
215
|
-
* The endpoint:
|
|
216
|
-
* - Accepts form data (application/x-www-form-urlencoded or multipart/form-data)
|
|
217
|
-
* - Requires an `identifier` query parameter to match the waiting brain
|
|
218
|
-
* - Returns { received: true, action: 'resumed' | 'not_found', ... }
|
|
219
|
-
*/
|
|
220
|
-
uiForm(fetch: Fetch, identifier: string, formData: Record<string, string | string[]>): Promise<boolean>;
|
|
221
|
-
/**
|
|
222
|
-
* Test POST /webhooks/system/ui-form with missing identifier - Should return 400
|
|
223
|
-
*/
|
|
224
|
-
uiFormMissingIdentifier(fetch: Fetch): Promise<boolean>;
|
|
225
|
-
};
|
|
226
|
-
export declare const pages: {
|
|
227
|
-
/**
|
|
228
|
-
* Test GET /pages - List all pages
|
|
229
|
-
*/
|
|
230
|
-
list(fetch: Fetch): Promise<boolean>;
|
|
231
|
-
/**
|
|
232
|
-
* Test POST /pages - Create a new page
|
|
233
|
-
*/
|
|
234
|
-
create(fetch: Fetch, slug: string, html: string, brainRunId: string, options?: {
|
|
235
|
-
persist?: boolean;
|
|
236
|
-
ttl?: number;
|
|
237
|
-
}): Promise<string | null>;
|
|
238
|
-
/**
|
|
239
|
-
* Test GET /pages/:slug - Get page HTML content
|
|
240
|
-
*/
|
|
241
|
-
get(fetch: Fetch, slug: string): Promise<string | null>;
|
|
242
|
-
/**
|
|
243
|
-
* Test GET /pages/:slug/meta - Get page metadata
|
|
244
|
-
*/
|
|
245
|
-
getMeta(fetch: Fetch, slug: string): Promise<{
|
|
246
|
-
slug: string;
|
|
247
|
-
brainRunId: string;
|
|
248
|
-
persist: boolean;
|
|
249
|
-
ttl?: number;
|
|
250
|
-
createdAt: string;
|
|
251
|
-
size: number;
|
|
252
|
-
} | null>;
|
|
253
|
-
/**
|
|
254
|
-
* Test PUT /pages/:slug - Update page HTML content
|
|
255
|
-
*/
|
|
256
|
-
update(fetch: Fetch, slug: string, html: string): Promise<boolean>;
|
|
257
|
-
/**
|
|
258
|
-
* Test DELETE /pages/:slug - Delete a page
|
|
259
|
-
*/
|
|
260
|
-
delete(fetch: Fetch, slug: string): Promise<boolean>;
|
|
261
|
-
/**
|
|
262
|
-
* Test GET /pages/:slug with non-existent page - Should return 404
|
|
263
|
-
*/
|
|
264
|
-
notFound(fetch: Fetch, slug: string): Promise<boolean>;
|
|
265
|
-
/**
|
|
266
|
-
* Test DELETE /pages/:slug preserves resources - deleting a page should not delete resources
|
|
267
|
-
*/
|
|
268
|
-
deletePreservesResources(fetch: Fetch): Promise<boolean>;
|
|
269
|
-
};
|
|
270
|
-
/**
|
|
271
|
-
* Bundle API Tests
|
|
272
|
-
*
|
|
273
|
-
* Tests for the /bundle/components.js endpoint which serves the component bundle.
|
|
274
|
-
*
|
|
275
|
-
* NOTE: These tests only verify the API endpoint behavior. The bundle build and
|
|
276
|
-
* upload process is backend-specific and must be tested separately by each
|
|
277
|
-
* backend implementation.
|
|
278
|
-
*/
|
|
279
|
-
export declare const bundle: {
|
|
280
|
-
/**
|
|
281
|
-
* Test GET /bundle/components.js - Serve the component bundle
|
|
282
|
-
*/
|
|
283
|
-
get(fetch: Fetch): Promise<boolean>;
|
|
284
|
-
};
|
|
285
|
-
export {};
|
|
286
|
-
//# sourceMappingURL=api.d.ts.map
|
|
128
|
+
//# sourceMappingURL=brains.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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