@automate.ax/api-contract 0.50.1 → 0.50.3

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.
@@ -1,6 +1,26 @@
1
1
  import { z } from "zod";
2
2
  /** SDK compatibility version used to select the immutable runtime image. */
3
- export declare const AUTOMATION_SDK_VERSION = "1";
3
+ export declare const AUTOMATION_SDK_VERSION = "2";
4
+ export type HttpTriggerScope = "trigger" | "automation" | "project";
5
+ export interface HttpTriggerEndpointOptions {
6
+ appOrigin: string;
7
+ automationId: string;
8
+ hookSlot: number;
9
+ projectId: string;
10
+ scope: HttpTriggerScope;
11
+ }
12
+ /**
13
+ * Returns the public URL for one deployed HTTP trigger.
14
+ *
15
+ * @param options - Public origin and trigger identity.
16
+ */
17
+ export declare function getHttpTriggerEndpoint(options: HttpTriggerEndpointOptions): string;
18
+ /**
19
+ * Returns the durable endpoint identity for one configured HTTP scope.
20
+ *
21
+ * @param options - Trigger and owning resource identity.
22
+ */
23
+ export declare function getHttpTriggerEndpointKey(options: Omit<HttpTriggerEndpointOptions, "appOrigin">): string;
4
24
  export declare const deploymentTriggerInfoSchema: z.ZodObject<{
5
25
  details: z.ZodArray<z.ZodObject<{
6
26
  label: z.ZodString;
@@ -1,7 +1,27 @@
1
1
  import { oc } from "@orpc/contract";
2
2
  import { z } from "zod";
3
3
  /** SDK compatibility version used to select the immutable runtime image. */
4
- export const AUTOMATION_SDK_VERSION = "1";
4
+ export const AUTOMATION_SDK_VERSION = "2";
5
+ /**
6
+ * Returns the public URL for one deployed HTTP trigger.
7
+ *
8
+ * @param options - Public origin and trigger identity.
9
+ */
10
+ export function getHttpTriggerEndpoint(options) {
11
+ return new URL(`/x/${getHttpTriggerEndpointKey(options)}/`, options.appOrigin).toString();
12
+ }
13
+ /**
14
+ * Returns the durable endpoint identity for one configured HTTP scope.
15
+ *
16
+ * @param options - Trigger and owning resource identity.
17
+ */
18
+ export function getHttpTriggerEndpointKey(options) {
19
+ if (options.scope === "project")
20
+ return options.projectId;
21
+ if (options.scope === "automation")
22
+ return options.automationId;
23
+ return `${options.automationId}:${options.hookSlot}`;
24
+ }
5
25
  export const deploymentTriggerInfoSchema = z.object({
6
26
  details: z
7
27
  .object({
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { automationExecutionStatusSchema } from "./automation.js";
2
- export { AUTOMATION_SDK_VERSION, deploymentTriggerInfoSchema, type DeploymentTriggerInfo, } from "./deployment.js";
2
+ export { AUTOMATION_SDK_VERSION, deploymentTriggerInfoSchema, getHttpTriggerEndpoint, getHttpTriggerEndpointKey, type DeploymentTriggerInfo, type HttpTriggerEndpointOptions, type HttpTriggerScope, } from "./deployment.js";
3
3
  export { integrationAccountOutputSchema } from "./account.js";
4
4
  export { AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT, AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX, DEFAULT_GATEWAY_MODEL_ID, automationInvocationInputSchema, automationInvocationOutputSchema, automationInvocationScheduleSchema, generationInputSchema, generationResultSchema, runtimeContract, type GenerationInput, type GenerationResult, type RuntimeGenerationInput, } from "./runtime.js";
5
5
  export type { GatewayModelId } from "@ai-sdk/gateway";
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { orgContract } from "./org.js";
9
9
  import { projectContract } from "./project.js";
10
10
  import { runtimeContract } from "./runtime.js";
11
11
  export { automationExecutionStatusSchema } from "./automation.js";
12
- export { AUTOMATION_SDK_VERSION, deploymentTriggerInfoSchema, } from "./deployment.js";
12
+ export { AUTOMATION_SDK_VERSION, deploymentTriggerInfoSchema, getHttpTriggerEndpoint, getHttpTriggerEndpointKey, } from "./deployment.js";
13
13
  export { integrationAccountOutputSchema } from "./account.js";
14
14
  export { AUTOMATION_INVOCATION_DEFAULT_ENTRYPOINT, AUTOMATION_INVOCATION_RESERVED_ENTRYPOINT_PREFIX, DEFAULT_GATEWAY_MODEL_ID, automationInvocationInputSchema, automationInvocationOutputSchema, automationInvocationScheduleSchema, generationInputSchema, generationResultSchema, runtimeContract, } from "./runtime.js";
15
15
  export { createdOrganizationApiKeyOutputSchema, organizationApiKeyOutputSchema, } from "./api-key.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/api-contract",
3
- "version": "0.50.1",
3
+ "version": "0.50.3",
4
4
  "description": "Public oRPC contract for the Automate.ax API.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@ai-sdk/gateway": "^4.0.46",
31
- "@automate.ax/codec": "0.50.1",
31
+ "@automate.ax/codec": "0.50.3",
32
32
  "@orpc/contract": "1.15.0",
33
33
  "zod": "^4.3.6"
34
34
  },
package/src/deployment.ts CHANGED
@@ -2,7 +2,42 @@ import { oc } from "@orpc/contract"
2
2
  import { z } from "zod"
3
3
 
4
4
  /** SDK compatibility version used to select the immutable runtime image. */
5
- export const AUTOMATION_SDK_VERSION = "1"
5
+ export const AUTOMATION_SDK_VERSION = "2"
6
+
7
+ export type HttpTriggerScope = "trigger" | "automation" | "project"
8
+
9
+ export interface HttpTriggerEndpointOptions {
10
+ appOrigin: string
11
+ automationId: string
12
+ hookSlot: number
13
+ projectId: string
14
+ scope: HttpTriggerScope
15
+ }
16
+
17
+ /**
18
+ * Returns the public URL for one deployed HTTP trigger.
19
+ *
20
+ * @param options - Public origin and trigger identity.
21
+ */
22
+ export function getHttpTriggerEndpoint(options: HttpTriggerEndpointOptions) {
23
+ return new URL(
24
+ `/x/${getHttpTriggerEndpointKey(options)}/`,
25
+ options.appOrigin,
26
+ ).toString()
27
+ }
28
+
29
+ /**
30
+ * Returns the durable endpoint identity for one configured HTTP scope.
31
+ *
32
+ * @param options - Trigger and owning resource identity.
33
+ */
34
+ export function getHttpTriggerEndpointKey(
35
+ options: Omit<HttpTriggerEndpointOptions, "appOrigin">,
36
+ ) {
37
+ if (options.scope === "project") return options.projectId
38
+ if (options.scope === "automation") return options.automationId
39
+ return `${options.automationId}:${options.hookSlot}`
40
+ }
6
41
 
7
42
  export const deploymentTriggerInfoSchema = z.object({
8
43
  details: z
package/src/index.ts CHANGED
@@ -13,7 +13,11 @@ export { automationExecutionStatusSchema } from "./automation"
13
13
  export {
14
14
  AUTOMATION_SDK_VERSION,
15
15
  deploymentTriggerInfoSchema,
16
+ getHttpTriggerEndpoint,
17
+ getHttpTriggerEndpointKey,
16
18
  type DeploymentTriggerInfo,
19
+ type HttpTriggerEndpointOptions,
20
+ type HttpTriggerScope,
17
21
  } from "./deployment"
18
22
  export { integrationAccountOutputSchema } from "./account"
19
23
  export {