Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 2x 2x 2x 2x | import { z } from 'zod/mini';
import { stackOneHeadersSchema } from './headers';
/**
* Zod schema for RPC action request validation
* @see https://docs.stackone.com/platform/api-reference/actions/make-an-rpc-call-to-an-action
*/
export const rpcActionRequestSchema = z.object({
action: z.string(),
body: z.optional(z.record(z.string(), z.unknown())),
headers: z.optional(stackOneHeadersSchema),
path: z.optional(z.record(z.string(), z.unknown())),
query: z.optional(z.record(z.string(), z.unknown())),
});
/**
* RPC action request payload
*/
export type RpcActionRequest = z.infer<typeof rpcActionRequestSchema>;
/**
* Zod schema for RPC action response data
*/
const rpcActionResponseDataSchema = z.union([
z.record(z.string(), z.unknown()),
z.array(z.record(z.string(), z.unknown())),
z.null(),
]);
/**
* Zod schema for RPC action response validation
*
* The server returns a flexible JSON structure. Known fields:
* - `data`: The main response data (object, array, or null)
* - `next`: Pagination cursor for fetching next page
*
* Additional fields from the connector response are passed through.
* @see unified-cloud-api/src/unified-api-v2/unifiedAPIv2.service.ts processActionCall
*/
export const rpcActionResponseSchema = z.looseObject({
next: z.nullable(z.optional(z.string())),
data: z.optional(rpcActionResponseDataSchema),
});
/**
* RPC action response from the StackOne API
* Contains known fields (data, next) plus any additional fields from the connector
*/
export type RpcActionResponse = z.infer<typeof rpcActionResponseSchema>;
/**
* Zod schema for RPC client configuration validation
*/
export const rpcClientConfigSchema = z.object({
serverURL: z.optional(z.string()),
security: z.object({
username: z.string(),
password: z.optional(z.string()),
}),
});
/**
* Configuration for the RPC client
*/
export type RpcClientConfig = z.infer<typeof rpcClientConfigSchema>;
|