@prave/shared 1.4.6 → 1.4.8
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/schemas/api-keys.schema.d.ts +2 -2
- package/dist/schemas/billing.schema.d.ts +7 -7
- package/dist/schemas/billing.schema.d.ts.map +1 -1
- package/dist/schemas/billing.schema.js +2 -2
- package/dist/schemas/index.d.ts +0 -9
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +0 -9
- package/dist/schemas/install.schema.d.ts +4 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/plan-limits.d.ts +26 -73
- package/dist/types/plan-limits.d.ts.map +1 -1
- package/dist/types/plan-limits.js +33 -69
- package/package.json +1 -1
- package/dist/schemas/credits.schema.d.ts +0 -73
- package/dist/schemas/credits.schema.d.ts.map +0 -1
- package/dist/schemas/credits.schema.js +0 -52
- package/dist/schemas/kv.schema.d.ts +0 -56
- package/dist/schemas/kv.schema.d.ts.map +0 -1
- package/dist/schemas/kv.schema.js +0 -39
- package/dist/schemas/run.schema.d.ts +0 -509
- package/dist/schemas/run.schema.d.ts.map +0 -1
- package/dist/schemas/run.schema.js +0 -192
- package/dist/schemas/sdk.schema.d.ts +0 -51
- package/dist/schemas/sdk.schema.d.ts.map +0 -1
- package/dist/schemas/sdk.schema.js +0 -36
- package/dist/schemas/skill-pr.schema.d.ts +0 -544
- package/dist/schemas/skill-pr.schema.d.ts.map +0 -1
- package/dist/schemas/skill-pr.schema.js +0 -87
- package/dist/schemas/skill-test.schema.d.ts +0 -60
- package/dist/schemas/skill-test.schema.d.ts.map +0 -1
- package/dist/schemas/skill-test.schema.js +0 -25
- package/dist/schemas/skill-version.schema.d.ts +0 -69
- package/dist/schemas/skill-version.schema.d.ts.map +0 -1
- package/dist/schemas/skill-version.schema.js +0 -21
- package/dist/schemas/vault.schema.d.ts +0 -54
- package/dist/schemas/vault.schema.d.ts.map +0 -1
- package/dist/schemas/vault.schema.js +0 -39
- package/dist/schemas/webhook-endpoint.schema.d.ts +0 -161
- package/dist/schemas/webhook-endpoint.schema.d.ts.map +0 -1
- package/dist/schemas/webhook-endpoint.schema.js +0 -74
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* Managed Skill-Tester input. Prave provides the Anthropic API key
|
|
4
|
-
* server-side and meters usage in credits — one credit per request.
|
|
5
|
-
* Model is fixed to Haiku 4.5 for predictable cost; advanced users can
|
|
6
|
-
* later override via a per-plan whitelist.
|
|
7
|
-
*/
|
|
8
|
-
export const skillTestInputSchema = z.object({
|
|
9
|
-
prompt: z.string().min(1).max(12_000),
|
|
10
|
-
max_tokens: z.number().int().min(1).max(8192).optional(),
|
|
11
|
-
temperature: z.number().min(0).max(1).optional(),
|
|
12
|
-
});
|
|
13
|
-
export const skillTestResultSchema = z.object({
|
|
14
|
-
id: z.string().uuid(),
|
|
15
|
-
skill_id: z.string().uuid(),
|
|
16
|
-
model: z.string(),
|
|
17
|
-
input_prompt: z.string(),
|
|
18
|
-
output: z.string(),
|
|
19
|
-
latency_ms: z.number().int().nonnegative(),
|
|
20
|
-
input_tokens: z.number().int().nullable(),
|
|
21
|
-
output_tokens: z.number().int().nullable(),
|
|
22
|
-
status: z.enum(['pending', 'success', 'error']),
|
|
23
|
-
error_message: z.string().nullable(),
|
|
24
|
-
created_at: z.string().datetime(),
|
|
25
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* A snapshot of a Skill's `content` at one point in time. Written
|
|
4
|
-
* automatically by the API whenever the content changes, plus explicitly
|
|
5
|
-
* on revert. Monotonic per-skill `version` integer, starting at 1.
|
|
6
|
-
*/
|
|
7
|
-
export declare const skillVersionSchema: z.ZodObject<{
|
|
8
|
-
id: z.ZodString;
|
|
9
|
-
skill_id: z.ZodString;
|
|
10
|
-
version: z.ZodNumber;
|
|
11
|
-
content: z.ZodString;
|
|
12
|
-
commit_message: z.ZodNullable<z.ZodString>;
|
|
13
|
-
created_by: z.ZodNullable<z.ZodString>;
|
|
14
|
-
created_at: z.ZodString;
|
|
15
|
-
}, "strip", z.ZodTypeAny, {
|
|
16
|
-
id: string;
|
|
17
|
-
skill_id: string;
|
|
18
|
-
content: string;
|
|
19
|
-
created_at: string;
|
|
20
|
-
commit_message: string | null;
|
|
21
|
-
version: number;
|
|
22
|
-
created_by: string | null;
|
|
23
|
-
}, {
|
|
24
|
-
id: string;
|
|
25
|
-
skill_id: string;
|
|
26
|
-
content: string;
|
|
27
|
-
created_at: string;
|
|
28
|
-
commit_message: string | null;
|
|
29
|
-
version: number;
|
|
30
|
-
created_by: string | null;
|
|
31
|
-
}>;
|
|
32
|
-
export type SkillVersion = z.infer<typeof skillVersionSchema>;
|
|
33
|
-
/** Compact list row — omits the full `content` blob so timelines stay cheap. */
|
|
34
|
-
export declare const skillVersionSummarySchema: z.ZodObject<Omit<{
|
|
35
|
-
id: z.ZodString;
|
|
36
|
-
skill_id: z.ZodString;
|
|
37
|
-
version: z.ZodNumber;
|
|
38
|
-
content: z.ZodString;
|
|
39
|
-
commit_message: z.ZodNullable<z.ZodString>;
|
|
40
|
-
created_by: z.ZodNullable<z.ZodString>;
|
|
41
|
-
created_at: z.ZodString;
|
|
42
|
-
}, "content">, "strip", z.ZodTypeAny, {
|
|
43
|
-
id: string;
|
|
44
|
-
skill_id: string;
|
|
45
|
-
created_at: string;
|
|
46
|
-
commit_message: string | null;
|
|
47
|
-
version: number;
|
|
48
|
-
created_by: string | null;
|
|
49
|
-
}, {
|
|
50
|
-
id: string;
|
|
51
|
-
skill_id: string;
|
|
52
|
-
created_at: string;
|
|
53
|
-
commit_message: string | null;
|
|
54
|
-
version: number;
|
|
55
|
-
created_by: string | null;
|
|
56
|
-
}>;
|
|
57
|
-
export type SkillVersionSummary = z.infer<typeof skillVersionSummarySchema>;
|
|
58
|
-
export declare const revertSkillInputSchema: z.ZodObject<{
|
|
59
|
-
version: z.ZodNumber;
|
|
60
|
-
commit_message: z.ZodOptional<z.ZodString>;
|
|
61
|
-
}, "strip", z.ZodTypeAny, {
|
|
62
|
-
version: number;
|
|
63
|
-
commit_message?: string | undefined;
|
|
64
|
-
}, {
|
|
65
|
-
version: number;
|
|
66
|
-
commit_message?: string | undefined;
|
|
67
|
-
}>;
|
|
68
|
-
export type RevertSkillInput = z.infer<typeof revertSkillInputSchema>;
|
|
69
|
-
//# sourceMappingURL=skill-version.schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skill-version.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/skill-version.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;EAQ7B,CAAA;AACF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAE7D,gFAAgF;AAChF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;EAA6C,CAAA;AACnF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAE3E,eAAO,MAAM,sBAAsB;;;;;;;;;EAGjC,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* A snapshot of a Skill's `content` at one point in time. Written
|
|
4
|
-
* automatically by the API whenever the content changes, plus explicitly
|
|
5
|
-
* on revert. Monotonic per-skill `version` integer, starting at 1.
|
|
6
|
-
*/
|
|
7
|
-
export const skillVersionSchema = z.object({
|
|
8
|
-
id: z.string().uuid(),
|
|
9
|
-
skill_id: z.string().uuid(),
|
|
10
|
-
version: z.number().int().positive(),
|
|
11
|
-
content: z.string(),
|
|
12
|
-
commit_message: z.string().nullable(),
|
|
13
|
-
created_by: z.string().uuid().nullable(),
|
|
14
|
-
created_at: z.string().datetime(),
|
|
15
|
-
});
|
|
16
|
-
/** Compact list row — omits the full `content` blob so timelines stay cheap. */
|
|
17
|
-
export const skillVersionSummarySchema = skillVersionSchema.omit({ content: true });
|
|
18
|
-
export const revertSkillInputSchema = z.object({
|
|
19
|
-
version: z.number().int().positive(),
|
|
20
|
-
commit_message: z.string().max(200).optional(),
|
|
21
|
-
});
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* Vault — user-supplied secrets bound to a Run.
|
|
4
|
-
*
|
|
5
|
-
* Values are AES-256-GCM-encrypted at rest (same master key as
|
|
6
|
-
* `runs.env_encrypted` and `user_api_keys`). The plaintext only ever
|
|
7
|
-
* surfaces to the worker via the `/api/v1/sdk/vault/:key` route, which
|
|
8
|
-
* authenticates with the short-lived `PRAVE_SDK_TOKEN` JWT minted per
|
|
9
|
-
* execution.
|
|
10
|
-
*
|
|
11
|
-
* Dashboard UI sets values; SDK reads them. There is intentionally no
|
|
12
|
-
* read endpoint that returns plaintext to the dashboard — once set, a
|
|
13
|
-
* value can only be overwritten, never read back through the web app.
|
|
14
|
-
*/
|
|
15
|
-
export declare const vaultKeySchema: z.ZodString;
|
|
16
|
-
export type VaultKey = z.infer<typeof vaultKeySchema>;
|
|
17
|
-
export declare const vaultSecretSchema: z.ZodObject<{
|
|
18
|
-
key: z.ZodString;
|
|
19
|
-
label: z.ZodNullable<z.ZodString>;
|
|
20
|
-
link: z.ZodNullable<z.ZodString>;
|
|
21
|
-
size_bytes: z.ZodNumber;
|
|
22
|
-
created_at: z.ZodString;
|
|
23
|
-
updated_at: z.ZodString;
|
|
24
|
-
}, "strip", z.ZodTypeAny, {
|
|
25
|
-
size_bytes: number;
|
|
26
|
-
created_at: string;
|
|
27
|
-
updated_at: string;
|
|
28
|
-
label: string | null;
|
|
29
|
-
key: string;
|
|
30
|
-
link: string | null;
|
|
31
|
-
}, {
|
|
32
|
-
size_bytes: number;
|
|
33
|
-
created_at: string;
|
|
34
|
-
updated_at: string;
|
|
35
|
-
label: string | null;
|
|
36
|
-
key: string;
|
|
37
|
-
link: string | null;
|
|
38
|
-
}>;
|
|
39
|
-
export type VaultSecret = z.infer<typeof vaultSecretSchema>;
|
|
40
|
-
export declare const vaultPutInputSchema: z.ZodObject<{
|
|
41
|
-
value: z.ZodString;
|
|
42
|
-
label: z.ZodOptional<z.ZodString>;
|
|
43
|
-
link: z.ZodOptional<z.ZodString>;
|
|
44
|
-
}, "strip", z.ZodTypeAny, {
|
|
45
|
-
value: string;
|
|
46
|
-
label?: string | undefined;
|
|
47
|
-
link?: string | undefined;
|
|
48
|
-
}, {
|
|
49
|
-
value: string;
|
|
50
|
-
label?: string | undefined;
|
|
51
|
-
link?: string | undefined;
|
|
52
|
-
}>;
|
|
53
|
-
export type VaultPutInput = z.infer<typeof vaultPutInputSchema>;
|
|
54
|
-
//# sourceMappingURL=vault.schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vault.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/vault.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;;;;;;;GAYG;AAMH,eAAO,MAAM,cAAc,aAOxB,CAAA;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAErD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAO5B,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAK3D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAA;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* Vault — user-supplied secrets bound to a Run.
|
|
4
|
-
*
|
|
5
|
-
* Values are AES-256-GCM-encrypted at rest (same master key as
|
|
6
|
-
* `runs.env_encrypted` and `user_api_keys`). The plaintext only ever
|
|
7
|
-
* surfaces to the worker via the `/api/v1/sdk/vault/:key` route, which
|
|
8
|
-
* authenticates with the short-lived `PRAVE_SDK_TOKEN` JWT minted per
|
|
9
|
-
* execution.
|
|
10
|
-
*
|
|
11
|
-
* Dashboard UI sets values; SDK reads them. There is intentionally no
|
|
12
|
-
* read endpoint that returns plaintext to the dashboard — once set, a
|
|
13
|
-
* value can only be overwritten, never read back through the web app.
|
|
14
|
-
*/
|
|
15
|
-
// POSIX-ish key — same shape as env var names so skill code can stash
|
|
16
|
-
// secrets under the same identifier (`prave.vault.get('TIKTOK_CLIENT_ID')`)
|
|
17
|
-
// or, where a skill expects an env var directly, the SDK's loader can
|
|
18
|
-
// project them into the bwrap env without renaming.
|
|
19
|
-
export const vaultKeySchema = z
|
|
20
|
-
.string()
|
|
21
|
-
.min(1)
|
|
22
|
-
.max(128)
|
|
23
|
-
.regex(/^[A-Za-z_][A-Za-z0-9_]*$/, 'Use POSIX-style names: letters, digits, underscore; cannot start with a digit.');
|
|
24
|
-
export const vaultSecretSchema = z.object({
|
|
25
|
-
key: vaultKeySchema,
|
|
26
|
-
label: z.string().max(120).nullable(),
|
|
27
|
-
link: z.string().url().max(2_048).nullable(),
|
|
28
|
-
size_bytes: z.number().int().nonnegative(),
|
|
29
|
-
created_at: z.string().datetime(),
|
|
30
|
-
updated_at: z.string().datetime(),
|
|
31
|
-
});
|
|
32
|
-
// Body for PUT /api/v1/runs/:slug/vault/:key. Caller passes the full
|
|
33
|
-
// new value; we encrypt + replace. Empty string is allowed (some
|
|
34
|
-
// providers expect a literal "" header).
|
|
35
|
-
export const vaultPutInputSchema = z.object({
|
|
36
|
-
value: z.string().max(65_536),
|
|
37
|
-
label: z.string().max(120).optional(),
|
|
38
|
-
link: z.string().url().max(2_048).optional(),
|
|
39
|
-
});
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* Webhook endpoint declarations — each one mints a stable HTTPS URL on
|
|
4
|
-
* `in.prave.app/w/<runs.webhook_token>/<endpoint_id>` that buffers
|
|
5
|
-
* inbound traffic into `webhook_events` (or, when trigger_mode is
|
|
6
|
-
* 'immediate', also enqueues a fresh run execution).
|
|
7
|
-
*
|
|
8
|
-
* Two flavours of inbound traffic share this surface:
|
|
9
|
-
* • short-lived OAuth callbacks (`?code=…&state=…`) — almost always
|
|
10
|
-
* 'immediate' so the code is exchanged before its ~10-minute window
|
|
11
|
-
* closes;
|
|
12
|
-
* • long-tail webhooks (Slack interactivity, TikTok post.published,
|
|
13
|
-
* etc.) — 'buffer', drained by `prave.webhooks.drain()` on the
|
|
14
|
-
* next cron run.
|
|
15
|
-
*
|
|
16
|
-
* HMAC verification is optional and only meaningful for buffered
|
|
17
|
-
* webhooks where the provider signs the body. OAuth callbacks rarely
|
|
18
|
-
* sign — providers rely on the redirect_uri being preregistered.
|
|
19
|
-
*/
|
|
20
|
-
export declare const webhookEndpointIdSchema: z.ZodString;
|
|
21
|
-
export type WebhookEndpointId = z.infer<typeof webhookEndpointIdSchema>;
|
|
22
|
-
export declare const webhookTriggerModeSchema: z.ZodEnum<["buffer", "immediate"]>;
|
|
23
|
-
export type WebhookTriggerMode = z.infer<typeof webhookTriggerModeSchema>;
|
|
24
|
-
export declare const webhookHmacAlgorithmSchema: z.ZodEnum<["sha256", "sha1", "sha512"]>;
|
|
25
|
-
export type WebhookHmacAlgorithm = z.infer<typeof webhookHmacAlgorithmSchema>;
|
|
26
|
-
export declare const webhookEndpointSchema: z.ZodObject<{
|
|
27
|
-
id: z.ZodString;
|
|
28
|
-
endpoint_id: z.ZodString;
|
|
29
|
-
label: z.ZodNullable<z.ZodString>;
|
|
30
|
-
url: z.ZodString;
|
|
31
|
-
hmac_header: z.ZodNullable<z.ZodString>;
|
|
32
|
-
hmac_algorithm: z.ZodNullable<z.ZodEnum<["sha256", "sha1", "sha512"]>>;
|
|
33
|
-
signing_secret_preview: z.ZodNullable<z.ZodString>;
|
|
34
|
-
trigger_mode: z.ZodEnum<["buffer", "immediate"]>;
|
|
35
|
-
response_status: z.ZodNumber;
|
|
36
|
-
response_body: z.ZodNullable<z.ZodString>;
|
|
37
|
-
response_content_type: z.ZodNullable<z.ZodString>;
|
|
38
|
-
events_30d: z.ZodOptional<z.ZodNumber>;
|
|
39
|
-
last_received_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
40
|
-
created_at: z.ZodString;
|
|
41
|
-
updated_at: z.ZodString;
|
|
42
|
-
}, "strip", z.ZodTypeAny, {
|
|
43
|
-
id: string;
|
|
44
|
-
created_at: string;
|
|
45
|
-
updated_at: string;
|
|
46
|
-
url: string;
|
|
47
|
-
label: string | null;
|
|
48
|
-
endpoint_id: string;
|
|
49
|
-
hmac_header: string | null;
|
|
50
|
-
hmac_algorithm: "sha256" | "sha1" | "sha512" | null;
|
|
51
|
-
signing_secret_preview: string | null;
|
|
52
|
-
trigger_mode: "buffer" | "immediate";
|
|
53
|
-
response_status: number;
|
|
54
|
-
response_body: string | null;
|
|
55
|
-
response_content_type: string | null;
|
|
56
|
-
events_30d?: number | undefined;
|
|
57
|
-
last_received_at?: string | null | undefined;
|
|
58
|
-
}, {
|
|
59
|
-
id: string;
|
|
60
|
-
created_at: string;
|
|
61
|
-
updated_at: string;
|
|
62
|
-
url: string;
|
|
63
|
-
label: string | null;
|
|
64
|
-
endpoint_id: string;
|
|
65
|
-
hmac_header: string | null;
|
|
66
|
-
hmac_algorithm: "sha256" | "sha1" | "sha512" | null;
|
|
67
|
-
signing_secret_preview: string | null;
|
|
68
|
-
trigger_mode: "buffer" | "immediate";
|
|
69
|
-
response_status: number;
|
|
70
|
-
response_body: string | null;
|
|
71
|
-
response_content_type: string | null;
|
|
72
|
-
events_30d?: number | undefined;
|
|
73
|
-
last_received_at?: string | null | undefined;
|
|
74
|
-
}>;
|
|
75
|
-
export type WebhookEndpoint = z.infer<typeof webhookEndpointSchema>;
|
|
76
|
-
export declare const webhookEndpointCreateInputSchema: z.ZodObject<{
|
|
77
|
-
endpoint_id: z.ZodString;
|
|
78
|
-
label: z.ZodOptional<z.ZodString>;
|
|
79
|
-
trigger_mode: z.ZodDefault<z.ZodEnum<["buffer", "immediate"]>>;
|
|
80
|
-
hmac_header: z.ZodOptional<z.ZodString>;
|
|
81
|
-
hmac_algorithm: z.ZodOptional<z.ZodEnum<["sha256", "sha1", "sha512"]>>;
|
|
82
|
-
signing_secret: z.ZodOptional<z.ZodString>;
|
|
83
|
-
response_status: z.ZodOptional<z.ZodNumber>;
|
|
84
|
-
response_body: z.ZodOptional<z.ZodString>;
|
|
85
|
-
response_content_type: z.ZodOptional<z.ZodString>;
|
|
86
|
-
}, "strip", z.ZodTypeAny, {
|
|
87
|
-
endpoint_id: string;
|
|
88
|
-
trigger_mode: "buffer" | "immediate";
|
|
89
|
-
label?: string | undefined;
|
|
90
|
-
hmac_header?: string | undefined;
|
|
91
|
-
hmac_algorithm?: "sha256" | "sha1" | "sha512" | undefined;
|
|
92
|
-
response_status?: number | undefined;
|
|
93
|
-
response_body?: string | undefined;
|
|
94
|
-
response_content_type?: string | undefined;
|
|
95
|
-
signing_secret?: string | undefined;
|
|
96
|
-
}, {
|
|
97
|
-
endpoint_id: string;
|
|
98
|
-
label?: string | undefined;
|
|
99
|
-
hmac_header?: string | undefined;
|
|
100
|
-
hmac_algorithm?: "sha256" | "sha1" | "sha512" | undefined;
|
|
101
|
-
trigger_mode?: "buffer" | "immediate" | undefined;
|
|
102
|
-
response_status?: number | undefined;
|
|
103
|
-
response_body?: string | undefined;
|
|
104
|
-
response_content_type?: string | undefined;
|
|
105
|
-
signing_secret?: string | undefined;
|
|
106
|
-
}>;
|
|
107
|
-
export type WebhookEndpointCreateInput = z.infer<typeof webhookEndpointCreateInputSchema>;
|
|
108
|
-
export declare const webhookEndpointPatchInputSchema: z.ZodObject<Omit<{
|
|
109
|
-
endpoint_id: z.ZodOptional<z.ZodString>;
|
|
110
|
-
label: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
111
|
-
trigger_mode: z.ZodOptional<z.ZodDefault<z.ZodEnum<["buffer", "immediate"]>>>;
|
|
112
|
-
hmac_header: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
113
|
-
hmac_algorithm: z.ZodOptional<z.ZodOptional<z.ZodEnum<["sha256", "sha1", "sha512"]>>>;
|
|
114
|
-
signing_secret: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
115
|
-
response_status: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
116
|
-
response_body: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
117
|
-
response_content_type: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
118
|
-
}, "endpoint_id">, "strip", z.ZodTypeAny, {
|
|
119
|
-
label?: string | undefined;
|
|
120
|
-
hmac_header?: string | undefined;
|
|
121
|
-
hmac_algorithm?: "sha256" | "sha1" | "sha512" | undefined;
|
|
122
|
-
trigger_mode?: "buffer" | "immediate" | undefined;
|
|
123
|
-
response_status?: number | undefined;
|
|
124
|
-
response_body?: string | undefined;
|
|
125
|
-
response_content_type?: string | undefined;
|
|
126
|
-
signing_secret?: string | undefined;
|
|
127
|
-
}, {
|
|
128
|
-
label?: string | undefined;
|
|
129
|
-
hmac_header?: string | undefined;
|
|
130
|
-
hmac_algorithm?: "sha256" | "sha1" | "sha512" | undefined;
|
|
131
|
-
trigger_mode?: "buffer" | "immediate" | undefined;
|
|
132
|
-
response_status?: number | undefined;
|
|
133
|
-
response_body?: string | undefined;
|
|
134
|
-
response_content_type?: string | undefined;
|
|
135
|
-
signing_secret?: string | undefined;
|
|
136
|
-
}>;
|
|
137
|
-
export type WebhookEndpointPatchInput = z.infer<typeof webhookEndpointPatchInputSchema>;
|
|
138
|
-
export declare const webhookEventForSdkSchema: z.ZodObject<{
|
|
139
|
-
id: z.ZodString;
|
|
140
|
-
received_at: z.ZodString;
|
|
141
|
-
method: z.ZodString;
|
|
142
|
-
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
143
|
-
body: z.ZodNullable<z.ZodString>;
|
|
144
|
-
body_base64: z.ZodNullable<z.ZodString>;
|
|
145
|
-
}, "strip", z.ZodTypeAny, {
|
|
146
|
-
id: string;
|
|
147
|
-
body: string | null;
|
|
148
|
-
received_at: string;
|
|
149
|
-
method: string;
|
|
150
|
-
headers: Record<string, string>;
|
|
151
|
-
body_base64: string | null;
|
|
152
|
-
}, {
|
|
153
|
-
id: string;
|
|
154
|
-
body: string | null;
|
|
155
|
-
received_at: string;
|
|
156
|
-
method: string;
|
|
157
|
-
headers: Record<string, string>;
|
|
158
|
-
body_base64: string | null;
|
|
159
|
-
}>;
|
|
160
|
-
export type WebhookEventForSdk = z.infer<typeof webhookEventForSdkSchema>;
|
|
161
|
-
//# sourceMappingURL=webhook-endpoint.schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webhook-endpoint.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/webhook-endpoint.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;;;;;;;;;;;;GAiBG;AAKH,eAAO,MAAM,uBAAuB,aAOjC,CAAA;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAEvE,eAAO,MAAM,wBAAwB,oCAAkC,CAAA;AACvE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEzE,eAAO,MAAM,0BAA0B,yCAAuC,CAAA;AAC9E,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAE7E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBhC,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU3C,CAAA;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAEzF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAC4B,CAAA;AACxE,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAKvF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;EAOnC,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* Webhook endpoint declarations — each one mints a stable HTTPS URL on
|
|
4
|
-
* `in.prave.app/w/<runs.webhook_token>/<endpoint_id>` that buffers
|
|
5
|
-
* inbound traffic into `webhook_events` (or, when trigger_mode is
|
|
6
|
-
* 'immediate', also enqueues a fresh run execution).
|
|
7
|
-
*
|
|
8
|
-
* Two flavours of inbound traffic share this surface:
|
|
9
|
-
* • short-lived OAuth callbacks (`?code=…&state=…`) — almost always
|
|
10
|
-
* 'immediate' so the code is exchanged before its ~10-minute window
|
|
11
|
-
* closes;
|
|
12
|
-
* • long-tail webhooks (Slack interactivity, TikTok post.published,
|
|
13
|
-
* etc.) — 'buffer', drained by `prave.webhooks.drain()` on the
|
|
14
|
-
* next cron run.
|
|
15
|
-
*
|
|
16
|
-
* HMAC verification is optional and only meaningful for buffered
|
|
17
|
-
* webhooks where the provider signs the body. OAuth callbacks rarely
|
|
18
|
-
* sign — providers rely on the redirect_uri being preregistered.
|
|
19
|
-
*/
|
|
20
|
-
// URL-path-segment shaped — short and lowercase. Skill-builders use
|
|
21
|
-
// it both in their `prave.webhooks.drain('<endpoint_id>')` calls and as
|
|
22
|
-
// the literal path segment in the public URL.
|
|
23
|
-
export const webhookEndpointIdSchema = z
|
|
24
|
-
.string()
|
|
25
|
-
.min(1)
|
|
26
|
-
.max(64)
|
|
27
|
-
.regex(/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/, 'Lowercase letters, digits and dashes — must start and end with an alphanumeric.');
|
|
28
|
-
export const webhookTriggerModeSchema = z.enum(['buffer', 'immediate']);
|
|
29
|
-
export const webhookHmacAlgorithmSchema = z.enum(['sha256', 'sha1', 'sha512']);
|
|
30
|
-
export const webhookEndpointSchema = z.object({
|
|
31
|
-
id: z.string().uuid(),
|
|
32
|
-
endpoint_id: webhookEndpointIdSchema,
|
|
33
|
-
label: z.string().nullable(),
|
|
34
|
-
// Public URL the user pastes into their provider's developer console.
|
|
35
|
-
url: z.string().url(),
|
|
36
|
-
// HMAC config — `null` everywhere means no verification.
|
|
37
|
-
hmac_header: z.string().max(80).nullable(),
|
|
38
|
-
hmac_algorithm: webhookHmacAlgorithmSchema.nullable(),
|
|
39
|
-
// Last 4 chars of the signing secret, to confirm "yes I have one set".
|
|
40
|
-
signing_secret_preview: z.string().nullable(),
|
|
41
|
-
trigger_mode: webhookTriggerModeSchema,
|
|
42
|
-
// Static-response config (Slack slash command wants "200 ok" right back).
|
|
43
|
-
response_status: z.number().int().min(100).max(599),
|
|
44
|
-
response_body: z.string().nullable(),
|
|
45
|
-
response_content_type: z.string().nullable(),
|
|
46
|
-
// Stats surfaced in the UI card.
|
|
47
|
-
events_30d: z.number().int().nonnegative().optional(),
|
|
48
|
-
last_received_at: z.string().datetime().nullable().optional(),
|
|
49
|
-
created_at: z.string().datetime(),
|
|
50
|
-
updated_at: z.string().datetime(),
|
|
51
|
-
});
|
|
52
|
-
export const webhookEndpointCreateInputSchema = z.object({
|
|
53
|
-
endpoint_id: webhookEndpointIdSchema,
|
|
54
|
-
label: z.string().max(120).optional(),
|
|
55
|
-
trigger_mode: webhookTriggerModeSchema.default('buffer'),
|
|
56
|
-
hmac_header: z.string().max(80).optional(),
|
|
57
|
-
hmac_algorithm: webhookHmacAlgorithmSchema.optional(),
|
|
58
|
-
signing_secret: z.string().min(8).max(512).optional(),
|
|
59
|
-
response_status: z.number().int().min(100).max(599).optional(),
|
|
60
|
-
response_body: z.string().max(8_192).optional(),
|
|
61
|
-
response_content_type: z.string().max(120).optional(),
|
|
62
|
-
});
|
|
63
|
-
export const webhookEndpointPatchInputSchema = webhookEndpointCreateInputSchema.partial().omit({ endpoint_id: true });
|
|
64
|
-
// Shape returned to the SDK by GET /api/v1/sdk/webhooks/:endpointId.
|
|
65
|
-
// `body` is a UTF-8 best-effort decode; binary uploads return
|
|
66
|
-
// `body_base64` instead. Headers are forwarded as the captured object.
|
|
67
|
-
export const webhookEventForSdkSchema = z.object({
|
|
68
|
-
id: z.string().uuid(),
|
|
69
|
-
received_at: z.string().datetime(),
|
|
70
|
-
method: z.string(),
|
|
71
|
-
headers: z.record(z.string(), z.string()),
|
|
72
|
-
body: z.string().nullable(),
|
|
73
|
-
body_base64: z.string().nullable(),
|
|
74
|
-
});
|