d25d482dc2
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
82 lines
2.8 KiB
TypeScript
82 lines
2.8 KiB
TypeScript
import { z } from 'zod'
|
|
import { defineRouteContract } from '@/lib/api/contracts/types'
|
|
import { FileInputSchema } from '@/lib/uploads/utils/file-schemas'
|
|
|
|
/**
|
|
* Internal contracts for the UptimeRobot public-status-page (PSP) create/update
|
|
* routes. Those endpoints accept `multipart/form-data` (for optional logo/icon
|
|
* image uploads), so the tools post a JSON envelope to these internal routes,
|
|
* which download the referenced files from storage and forward a multipart
|
|
* request to UptimeRobot.
|
|
*/
|
|
|
|
const pspSchema = z.object({
|
|
id: z.number(),
|
|
friendlyName: z.string(),
|
|
customDomain: z.string().nullable(),
|
|
isPasswordSet: z.boolean().nullable(),
|
|
monitorIds: z.array(z.number()),
|
|
tagIds: z.array(z.number()),
|
|
monitorsCount: z.number().nullable(),
|
|
status: z.string().nullable(),
|
|
urlKey: z.string().nullable(),
|
|
homepageLink: z.string().nullable(),
|
|
gaCode: z.string().nullable(),
|
|
icon: z.string().nullable(),
|
|
logo: z.string().nullable(),
|
|
noIndex: z.boolean().nullable(),
|
|
hideUrlLinks: z.boolean().nullable(),
|
|
subscription: z.boolean().nullable(),
|
|
})
|
|
|
|
const pspRouteResponseSchema = z.object({
|
|
success: z.boolean(),
|
|
output: z.object({ psp: pspSchema }).optional(),
|
|
error: z.string().optional(),
|
|
})
|
|
|
|
const pspSharedFields = {
|
|
apiKey: z.string().min(1, 'API key is required'),
|
|
monitorIds: z
|
|
.string()
|
|
.optional()
|
|
.nullable()
|
|
.describe('Comma-separated monitor IDs to display on the page'),
|
|
status: z.enum(['ENABLED', 'PAUSED']).optional().nullable(),
|
|
password: z.string().max(255).optional().nullable(),
|
|
customDomain: z.string().max(255).optional().nullable(),
|
|
hideUrlLinks: z.boolean().optional().nullable(),
|
|
noIndex: z.boolean().optional().nullable(),
|
|
logo: FileInputSchema.optional().nullable(),
|
|
icon: FileInputSchema.optional().nullable(),
|
|
}
|
|
|
|
export const uptimeRobotCreatePspBodySchema = z.object({
|
|
...pspSharedFields,
|
|
friendlyName: z.string().min(1, 'friendlyName is required').max(255),
|
|
})
|
|
|
|
export type UptimeRobotCreatePspBody = z.input<typeof uptimeRobotCreatePspBodySchema>
|
|
|
|
export const uptimeRobotCreatePspContract = defineRouteContract({
|
|
method: 'POST',
|
|
path: '/api/tools/uptimerobot/create-psp',
|
|
body: uptimeRobotCreatePspBodySchema,
|
|
response: { mode: 'json', schema: pspRouteResponseSchema },
|
|
})
|
|
|
|
export const uptimeRobotUpdatePspBodySchema = z.object({
|
|
...pspSharedFields,
|
|
pspId: z.number().int().min(1, 'pspId is required'),
|
|
friendlyName: z.string().max(255).optional().nullable(),
|
|
})
|
|
|
|
export type UptimeRobotUpdatePspBody = z.input<typeof uptimeRobotUpdatePspBodySchema>
|
|
|
|
export const uptimeRobotUpdatePspContract = defineRouteContract({
|
|
method: 'POST',
|
|
path: '/api/tools/uptimerobot/update-psp',
|
|
body: uptimeRobotUpdatePspBodySchema,
|
|
response: { mode: 'json', schema: pspRouteResponseSchema },
|
|
})
|