terse-types 0.5.2 → 0.6.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/README.md +1 -1
- package/dist/ActorEndpoint.d.ts +9 -0
- package/dist/ActorEndpoint.js +32 -0
- package/dist/ApiRouteBuilder.d.ts +3 -0
- package/dist/ApiRoutes.json +3 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.js +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Internal shared types for the [Terse](https://useterse.ai) platform.
|
|
|
9
9
|
If you landed here while building a workflow, you almost certainly want one of these instead:
|
|
10
10
|
|
|
11
11
|
- **[`terse-cli`](https://www.npmjs.com/package/terse-cli)** to scaffold, test, and deploy workflows
|
|
12
|
-
- **[`terse-sdk`](https://www.npmjs.com/package/terse-sdk)** to write workflow code (`createJob`, `
|
|
12
|
+
- **[`terse-sdk`](https://www.npmjs.com/package/terse-sdk)** to write workflow code (`createJob`, `step`, `waitForInput`, trigger types)
|
|
13
13
|
- **[docs.useterse.ai](https://docs.useterse.ai)** for guides and reference
|
|
14
14
|
|
|
15
15
|
If a doc, post, or LLM pointed you at `terse-types` directly, that was probably a mistake on our end. [Let us know](mailto:support@useterse.ai) so we can fix it. The types you actually need are re-exported from `terse-sdk`.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ActorEndpoint {
|
|
2
|
+
kind: "terse" | "runtime";
|
|
3
|
+
origin: string;
|
|
4
|
+
projectId: string;
|
|
5
|
+
actorUrl: string;
|
|
6
|
+
contractUrl: string;
|
|
7
|
+
}
|
|
8
|
+
/** The URL selects the API explicitly; localhost alone never changes authentication or routing. */
|
|
9
|
+
export declare function parseActorEndpoint(value: string): ActorEndpoint;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** The URL selects the API explicitly; localhost alone never changes authentication or routing. */
|
|
2
|
+
export function parseActorEndpoint(value) {
|
|
3
|
+
const invalid = () => new Error("TERSE_ACTOR_URL must be an HTTP(S) URL ending in /<projectId>/actors or /v1/projects/<projectId>/actors, without credentials, query, or fragment");
|
|
4
|
+
let url;
|
|
5
|
+
try {
|
|
6
|
+
url = new URL(value.trim());
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
throw invalid();
|
|
10
|
+
}
|
|
11
|
+
const match = /^\/(?:(sdk|v1)\/projects\/)?([^/]+)\/actors\/?$/.exec(url.pathname);
|
|
12
|
+
if (!match || !["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash)
|
|
13
|
+
throw invalid();
|
|
14
|
+
let projectId;
|
|
15
|
+
try {
|
|
16
|
+
projectId = decodeURIComponent(match[2]);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
throw invalid();
|
|
20
|
+
}
|
|
21
|
+
if (!/^[A-Za-z0-9._-]{1,64}$/.test(projectId) || projectId === "." || projectId === "..")
|
|
22
|
+
throw invalid();
|
|
23
|
+
const kind = match[1] === "v1" ? "runtime" : "terse";
|
|
24
|
+
const project = encodeURIComponent(projectId);
|
|
25
|
+
return {
|
|
26
|
+
kind,
|
|
27
|
+
origin: url.origin,
|
|
28
|
+
projectId,
|
|
29
|
+
actorUrl: `${url.origin}${kind === "runtime" ? `/v1/projects/${project}` : `/${project}`}/actors`,
|
|
30
|
+
contractUrl: `${url.origin}${kind === "runtime" ? `/v1/projects/${project}/deployment/contract` : `/sdk/projects/${project}/actors/contract`}`
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -194,6 +194,9 @@ export declare const ApiRoutes: {
|
|
|
194
194
|
INPUT_REQUEST: string;
|
|
195
195
|
INPUT_RESPONSE: string;
|
|
196
196
|
CREATE_PROJECT: string;
|
|
197
|
+
ACTOR_CONTRACT: string;
|
|
198
|
+
ACTOR_CONNECT: string;
|
|
199
|
+
ACTOR_INVOKE: string;
|
|
197
200
|
DEPLOY: string;
|
|
198
201
|
IDENTIFY: string;
|
|
199
202
|
DEVICE_TOKEN_EXCHANGE: string;
|
package/dist/ApiRoutes.json
CHANGED
|
@@ -194,6 +194,9 @@
|
|
|
194
194
|
"INPUT_REQUEST": "/sdk/input-request",
|
|
195
195
|
"INPUT_RESPONSE": "/sdk/input-request/:token/response",
|
|
196
196
|
"CREATE_PROJECT": "/sdk/projects",
|
|
197
|
+
"ACTOR_CONTRACT": "/sdk/projects/:projectId/actors/contract",
|
|
198
|
+
"ACTOR_CONNECT": "/:projectId/actors",
|
|
199
|
+
"ACTOR_INVOKE": "/:projectId/actors/invoke",
|
|
197
200
|
"DEPLOY": "/sdk/deploy",
|
|
198
201
|
"IDENTIFY": "/sdk/auth/identify",
|
|
199
202
|
"DEVICE_TOKEN_EXCHANGE": "/sdk/auth/device-token-exchange",
|
package/dist/types.d.ts
CHANGED
|
@@ -15463,6 +15463,8 @@ export declare const sdkDeployRequestBodySchema: z.ZodObject<{
|
|
|
15463
15463
|
campaignIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
15464
15464
|
}, z.core.$strip>]>>;
|
|
15465
15465
|
}, z.core.$strip>>;
|
|
15466
|
+
actorTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
15467
|
+
actorContract: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
15466
15468
|
remoteServerUrl: z.ZodOptional<z.ZodString>;
|
|
15467
15469
|
sourceZipBase64: z.ZodOptional<z.ZodString>;
|
|
15468
15470
|
sourceObjectKey: z.ZodOptional<z.ZodString>;
|
|
@@ -15495,6 +15497,7 @@ export declare const sdkDeployRemovedSchema: z.ZodObject<{
|
|
|
15495
15497
|
}, z.core.$strip>;
|
|
15496
15498
|
export declare const sdkDeployResponseBodySchema: z.ZodObject<{
|
|
15497
15499
|
success: z.ZodBoolean;
|
|
15500
|
+
actorTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
15498
15501
|
signingSecret: z.ZodOptional<z.ZodString>;
|
|
15499
15502
|
projectApiKey: z.ZodOptional<z.ZodString>;
|
|
15500
15503
|
results: z.ZodArray<z.ZodObject<{
|
package/dist/types.js
CHANGED
|
@@ -697,6 +697,9 @@ export const sdkDeployRequestBodySchema = z
|
|
|
697
697
|
projectId: z.string(),
|
|
698
698
|
cliVersion: z.string(),
|
|
699
699
|
jobs: z.array(sdkDeployJobSchema),
|
|
700
|
+
actorTypes: z.array(z.string().min(1)).optional(),
|
|
701
|
+
/** Public actor API compiled by little-actors; validated by the control plane on registration. */
|
|
702
|
+
actorContract: z.record(z.string(), z.json()).optional(),
|
|
700
703
|
remoteServerUrl: z.string().optional(),
|
|
701
704
|
sourceZipBase64: z.string().optional(),
|
|
702
705
|
/** Key of an archive already uploaded to object storage. Preferred over sourceZipBase64. */
|
|
@@ -743,6 +746,7 @@ export const sdkDeployRemovedSchema = z.object({
|
|
|
743
746
|
});
|
|
744
747
|
export const sdkDeployResponseBodySchema = z.object({
|
|
745
748
|
success: z.boolean(),
|
|
749
|
+
actorTypes: z.array(z.string()).optional(),
|
|
746
750
|
signingSecret: z.string().optional(),
|
|
747
751
|
projectApiKey: z.string().optional(),
|
|
748
752
|
results: z.array(sdkDeployResultSchema),
|