Generated from services/crossfire/node/packages/contracts/src/wake-up.ts at
52bf0279Definitions#
These TypeScript definitions document server validation. check.object rejects unknown fields. Custom functions and refinements specify additional checks.
Imported definitions#
services/crossfire/node/packages/contracts/src/schema/validation.tsservices/crossfire/node/packages/contracts/src/schema/response.tsservices/crossfire/node/packages/contracts/src/schema/request.tsservices/crossfire/node/packages/kernel/src/result.ts
WakeSchedule#
export type WakeSchedule = {
kind: 'interval';
seconds: number;
} | {
kind: 'cron';
expression: string;
timeZone: string;
};wakeSchedule#
wakeSchedule: check.Parser<WakeSchedule> = input => {
if (!input || typeof input !== 'object' || !('kind' in input))
return failure('invalid', 'Choose an interval or calendar schedule');
if (input.kind === 'interval')
return check.object({ kind: check.choice('interval'), seconds: check.integer(1, 31536000) })(input);
if (input.kind === 'cron')
return check.object({ kind: check.choice('cron'), expression: check.text(200), timeZone: check.text(100) })(input);
return failure('invalid', 'Unknown schedule kind');
}Related definitions:
name#
name = check.refine(check.text(100), value => !!value.trim(), 'Provide a Wake-up name')Related definitions:
message#
message = check.refine(check.plainText(16384), value => !!value.trim(), 'Provide a wake-up message')Related definitions:
agentIds#
agentIds = check.refine(check.list(check.identifier, 1000), ids => new Set(ids).size === ids.length, 'Duplicate attached agents')Related definitions:
fields#
fields = { name, message, schedule: wakeSchedule, enabled: check.boolean, agentIds }Related definitions:
wakeRuleCreation#
wakeRuleCreation = check.object({ ruleId: check.identifier, ...fields })Related definitions:
wakeRuleChange#
wakeRuleChange = check.object({ expectedRevision: check.integer(), ...fields })Related definitions:
wakeRuleRemoval#
wakeRuleRemoval = check.object({ expectedRevision: check.integer() })Related definitions:
summary#
summary = { ruleId: check.identifier, owner: principal, configuredById: check.identifier, name, message, schedule: wakeSchedule,
enabled: check.boolean, revision: check.integer(), createdAt: check.integer(), updatedAt: check.integer(), agentCount: check.integer(0, 1000),
nextDueAt: check.nullable(check.integer()), lastDeliveredAt: check.nullable(check.integer()) }Related definitions:
wakeRuleSummary#
wakeRuleSummary = check.object(summary)Related definitions:
wakeRuleAgent#
wakeRuleAgent = check.object({ principalId: check.identifier, matrixUserId: check.matrixUserId, kind: check.choice('agent'),
displayName: check.text(255), ownerId: check.identifier, ownerMatrixId: check.matrixUserId,
ruleId: check.identifier, agentId: check.identifier, nextDueAt: check.integer(), lastDeliveredAt: check.nullable(check.integer()) })Related definitions:
wakeRuleDetails#
wakeRuleDetails = check.object({ ...summary, agents: check.list(wakeRuleAgent, 1000) })Related definitions:
wakeAttachment#
wakeAttachment = check.object({ runId: check.identifier, sessionId: check.text(200) })Related definitions:
wakeAttachmentQuery#
export function wakeAttachmentQuery(input: unknown) {
const values = listQuery(['runId', 'sessionId'])(input);
if (!values.ok)
return values;
return wakeAttachment({ runId: values.value.get('runId'), sessionId: values.value.get('sessionId') });
}Related definitions:
wakeMetadata#
wakeMetadata = check.object({ now: check.integer(), nextDueAt: check.nullable(check.integer()) })Related definitions:
scheduledWake#
scheduledWake = check.object({ deliveryId: check.identifier, ruleId: check.identifier, ruleRevision: check.integer(), name, message,
scheduledAt: check.integer(), sessionId: check.text(200), ownerMatrixId: check.matrixUserId, authorizerMatrixId: check.matrixUserId })Related definitions:
WakeRuleSummary#
export type WakeRuleSummary = check.Parsed<typeof wakeRuleSummary>;Related definitions:
WakeRuleDetails#
export type WakeRuleDetails = check.Parsed<typeof wakeRuleDetails>;Related definitions:
WakeAttachment#
export type WakeAttachment = check.Parsed<typeof wakeAttachment>;Related definitions:
ScheduledWake#
export type ScheduledWake = check.Parsed<typeof scheduledWake>;Related definitions: