@kohost/api-client 4.20.6 → 4.21.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/dist/cjs/models/automation.d.cts +1 -1
- package/dist/cjs/schemas/automation.cjs +56 -1
- package/dist/cjs/schemas/automation.cjs.map +1 -1
- package/dist/cjs/schemas/automation.d.cts +57 -2
- package/dist/esm/models/automation.d.ts +1 -1
- package/dist/esm/schemas/automation.d.ts +57 -2
- package/dist/esm/schemas/automation.js +56 -1
- package/dist/esm/schemas/automation.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,8 +2,8 @@ import { Entity } from './entity.cjs';
|
|
|
2
2
|
import { validateAutomation } from '../validate.cjs';
|
|
3
3
|
import { AutomationSchema, automationSchema } from '../schemas/automation.cjs';
|
|
4
4
|
import 'ajv';
|
|
5
|
-
import '../schemas/definitions.cjs';
|
|
6
5
|
import 'json-schema-to-ts';
|
|
6
|
+
import '../schemas/definitions.cjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Data type for Automation constructor - exported for backwards compatibility
|
|
@@ -56,9 +56,64 @@ const automationSchema = {
|
|
|
56
56
|
properties: {
|
|
57
57
|
discriminator: {
|
|
58
58
|
type: "string",
|
|
59
|
-
enum: ["schedule", "event"],
|
|
59
|
+
enum: ["schedule", "event", "rrule"],
|
|
60
60
|
description: "Type of trigger"
|
|
61
61
|
},
|
|
62
|
+
rrule: {
|
|
63
|
+
type: "object",
|
|
64
|
+
additionalProperties: false,
|
|
65
|
+
description: "RFC 5545 recurrence rule with solar time support",
|
|
66
|
+
required: ["expression", "timezone", "timeMode"],
|
|
67
|
+
properties: {
|
|
68
|
+
expression: {
|
|
69
|
+
type: "string",
|
|
70
|
+
description: "RFC 5545 RRULE string (omit BYHOUR/BYMINUTE when using solar timeMode)"
|
|
71
|
+
},
|
|
72
|
+
timezone: {
|
|
73
|
+
type: "string",
|
|
74
|
+
description: "IANA timezone for rule evaluation"
|
|
75
|
+
},
|
|
76
|
+
timeMode: {
|
|
77
|
+
type: "object",
|
|
78
|
+
additionalProperties: false,
|
|
79
|
+
required: ["type"],
|
|
80
|
+
properties: {
|
|
81
|
+
type: {
|
|
82
|
+
type: "string",
|
|
83
|
+
enum: ["fixed", "sunrise", "sunset"],
|
|
84
|
+
description: "How to determine execution time on matching days"
|
|
85
|
+
},
|
|
86
|
+
time: {
|
|
87
|
+
type: "string",
|
|
88
|
+
description: "HH:mm time for fixed mode"
|
|
89
|
+
},
|
|
90
|
+
offsetSeconds: {
|
|
91
|
+
type: "integer",
|
|
92
|
+
description: "Offset in seconds from time or solar event (negative = before)",
|
|
93
|
+
default: 0
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
location: {
|
|
98
|
+
type: "object",
|
|
99
|
+
additionalProperties: false,
|
|
100
|
+
description: "Required when timeMode is sunrise or sunset",
|
|
101
|
+
required: ["lat", "lng"],
|
|
102
|
+
properties: {
|
|
103
|
+
lat: {
|
|
104
|
+
type: "number",
|
|
105
|
+
minimum: -90,
|
|
106
|
+
maximum: 90
|
|
107
|
+
},
|
|
108
|
+
lng: {
|
|
109
|
+
type: "number",
|
|
110
|
+
minimum: -180,
|
|
111
|
+
maximum: 180
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
62
117
|
// Time-based trigger properties
|
|
63
118
|
schedule: {
|
|
64
119
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../.generated/schemas/automation.ts"],"sourcesContent":["import defs, { ISODateString } from \"./definitions\";\nimport type { FromSchema } from \"json-schema-to-ts\";\n\nexport const automationSchema = {\n $schema: \"http://json-schema.org/draft-07/schema\",\n $id: \"automation.json\",\n title: \"Automation\",\n description: \"An automation is a collection of triggers and actions\",\n type: \"object\",\n required: [\"id\", \"type\", \"trigger\", \"actions\"],\n properties: {\n id: {\n $ref: \"definitions.json#/definitions/id\",\n },\n name: {\n type: \"string\",\n description: \"The friendly name of the automation\",\n },\n type: {\n type: \"string\",\n enum: [\"automation\"],\n default: \"automation\",\n },\n isEnabled: {\n type: \"boolean\",\n description: \"Whether the automation is currently enabled\",\n default: true,\n },\n description: {\n type: \"string\",\n description: \"The text description of the automation\",\n },\n trigger: {\n type: \"object\",\n description: \"The trigger that initiates the automation\",\n required: [\"discriminator\"],\n properties: {\n discriminator: {\n type: \"string\",\n enum: [\"schedule\", \"event\"],\n description: \"Type of trigger\",\n },\n // Time-based trigger properties\n schedule: {\n type: \"object\",\n additionalProperties: false,\n description: \"Schedule for time-based triggers\",\n required: [\"days\", \"time\", \"timezone\"],\n properties: {\n days: {\n type: \"array\",\n description: \"Days of the week (0 = Sunday, 6 = Saturday)\",\n items: {\n type: \"integer\",\n minimum: 0,\n maximum: 6,\n },\n },\n time: {\n type: \"string\",\n description: \"Time of day to trigger the automation\",\n },\n timeOffsetSeconds: {\n type: \"integer\",\n description: \"Offset in seconds from the scheduled time\",\n default: 0,\n },\n repeat: {\n type: \"boolean\",\n description: \"Whether the schedule repeats\",\n default: true,\n },\n timezone: {\n type: \"string\",\n description: \"Timezone for the schedule (IANA timezone format)\",\n },\n },\n },\n event: {\n type: \"object\",\n required: [\"eventType\", \"eventProperties\", \"match\"],\n additionalProperties: false,\n properties: {\n eventType: {\n type: \"string\",\n description:\n \"Name of the event that triggers the automation actions\",\n },\n eventProperties: {\n type: \"array\",\n description:\n \"Properties of the event that triggers the automation actions\",\n items: {\n type: \"object\",\n required: [\"property\", \"value\", \"operator\"],\n additionalProperties: false,\n properties: {\n property: {\n type: \"string\",\n description: \"Property of the event\",\n },\n value: {\n type: [\"string\", \"number\", \"boolean\"],\n description: \"Value of the property\",\n },\n operator: {\n type: \"string\",\n description: \"Operator of the property\",\n enum: [\n \"==\",\n \"!=\",\n \">\",\n \">=\",\n \"<\",\n \"<=\",\n \"contains\",\n \"notContains\",\n ],\n },\n },\n },\n },\n match: {\n type: \"string\",\n description:\n \"Match criteria for the event to trigger the automation actions\",\n enum: [\"any\", \"all\"],\n },\n },\n },\n },\n },\n actions: {\n type: \"array\",\n description: \"Actions to perform when the trigger conditions are met\",\n items: {\n type: \"object\",\n required: [\"useCase\", \"useCaseParams\"],\n additionalProperties: false,\n properties: {\n useCase: {\n type: \"string\",\n description: \"Name of the use case to call\",\n },\n useCaseParams: {\n type: \"object\",\n description: \"Parameters to pass to the use case\",\n required: [\"data\"],\n properties: {\n data: {\n type: [\"object\", \"array\"],\n description: \"Data to pass to the use case\",\n },\n },\n },\n },\n minItems: 1,\n },\n },\n createdAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation was created\",\n },\n updatedAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation was updated\",\n },\n nextRunAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation is scheduled to run next\",\n },\n lastRunAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation was last triggered\",\n },\n deletedAt: {\n $ref: \"definitions.json#/definitions/date\",\n },\n webhookUrl: {\n type: \"string\",\n description: \"The URL of the webhook that triggers the automation\",\n format: \"uri\",\n },\n },\n additionalProperties: false,\n} as const;\n\nexport type AutomationSchema = FromSchema<\n typeof automationSchema,\n {\n references: [typeof defs];\n deserialize: [\n {\n pattern: {\n format: \"date-time\";\n };\n output: Date | ISODateString;\n },\n ];\n }\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,mBAAmB;AAAA,EAC9B,SAAS;AAAA,EACT,KAAK;AAAA,EACL,OAAO;AAAA,EACP,aAAa;AAAA,EACb,MAAM;AAAA,EACN,UAAU,CAAC,MAAM,QAAQ,WAAW,SAAS;AAAA,EAC7C,YAAY;AAAA,IACV,IAAI;AAAA,MACF,MAAM;AAAA,IACR;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,IACA,MAAM;AA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IACf;AAAA,IACA,WAAW;AAAA,MACT,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,IACA,WAAW;AAAA,MACT,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,IACA,WAAW;AAAA,MACT,MAAM;AAAA,IACR;AAAA,IACA,YAAY;AAAA,MACV,MAAM;AAAA,MACN,aAAa;AAAA,MACb,QAAQ;AAAA,IACV;AAAA,EACF;AAAA,EACA,sBAAsB;AACxB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../.generated/schemas/automation.ts"],"sourcesContent":["import type { FromSchema } from \"json-schema-to-ts\";\nimport defs, { ISODateString } from \"./definitions\";\n\nexport const automationSchema = {\n $schema: \"http://json-schema.org/draft-07/schema\",\n $id: \"automation.json\",\n title: \"Automation\",\n description: \"An automation is a collection of triggers and actions\",\n type: \"object\",\n required: [\"id\", \"type\", \"trigger\", \"actions\"],\n properties: {\n id: {\n $ref: \"definitions.json#/definitions/id\",\n },\n name: {\n type: \"string\",\n description: \"The friendly name of the automation\",\n },\n type: {\n type: \"string\",\n enum: [\"automation\"],\n default: \"automation\",\n },\n isEnabled: {\n type: \"boolean\",\n description: \"Whether the automation is currently enabled\",\n default: true,\n },\n description: {\n type: \"string\",\n description: \"The text description of the automation\",\n },\n trigger: {\n type: \"object\",\n description: \"The trigger that initiates the automation\",\n required: [\"discriminator\"],\n properties: {\n discriminator: {\n type: \"string\",\n enum: [\"schedule\", \"event\", \"rrule\"],\n description: \"Type of trigger\",\n },\n rrule: {\n type: \"object\",\n additionalProperties: false,\n description: \"RFC 5545 recurrence rule with solar time support\",\n required: [\"expression\", \"timezone\", \"timeMode\"],\n properties: {\n expression: {\n type: \"string\",\n description:\n \"RFC 5545 RRULE string (omit BYHOUR/BYMINUTE when using solar timeMode)\",\n },\n timezone: {\n type: \"string\",\n description: \"IANA timezone for rule evaluation\",\n },\n timeMode: {\n type: \"object\",\n additionalProperties: false,\n required: [\"type\"],\n properties: {\n type: {\n type: \"string\",\n enum: [\"fixed\", \"sunrise\", \"sunset\"],\n description:\n \"How to determine execution time on matching days\",\n },\n time: {\n type: \"string\",\n description: \"HH:mm time for fixed mode\",\n },\n offsetSeconds: {\n type: \"integer\",\n description:\n \"Offset in seconds from time or solar event (negative = before)\",\n default: 0,\n },\n },\n },\n location: {\n type: \"object\",\n additionalProperties: false,\n description: \"Required when timeMode is sunrise or sunset\",\n required: [\"lat\", \"lng\"],\n properties: {\n lat: {\n type: \"number\",\n minimum: -90,\n maximum: 90,\n },\n lng: {\n type: \"number\",\n minimum: -180,\n maximum: 180,\n },\n },\n },\n },\n },\n // Time-based trigger properties\n schedule: {\n type: \"object\",\n additionalProperties: false,\n description: \"Schedule for time-based triggers\",\n required: [\"days\", \"time\", \"timezone\"],\n properties: {\n days: {\n type: \"array\",\n description: \"Days of the week (0 = Sunday, 6 = Saturday)\",\n items: {\n type: \"integer\",\n minimum: 0,\n maximum: 6,\n },\n },\n time: {\n type: \"string\",\n description: \"Time of day to trigger the automation\",\n },\n timeOffsetSeconds: {\n type: \"integer\",\n description: \"Offset in seconds from the scheduled time\",\n default: 0,\n },\n repeat: {\n type: \"boolean\",\n description: \"Whether the schedule repeats\",\n default: true,\n },\n timezone: {\n type: \"string\",\n description: \"Timezone for the schedule (IANA timezone format)\",\n },\n },\n },\n event: {\n type: \"object\",\n required: [\"eventType\", \"eventProperties\", \"match\"],\n additionalProperties: false,\n properties: {\n eventType: {\n type: \"string\",\n description:\n \"Name of the event that triggers the automation actions\",\n },\n eventProperties: {\n type: \"array\",\n description:\n \"Properties of the event that triggers the automation actions\",\n items: {\n type: \"object\",\n required: [\"property\", \"value\", \"operator\"],\n additionalProperties: false,\n properties: {\n property: {\n type: \"string\",\n description: \"Property of the event\",\n },\n value: {\n type: [\"string\", \"number\", \"boolean\"],\n description: \"Value of the property\",\n },\n operator: {\n type: \"string\",\n description: \"Operator of the property\",\n enum: [\n \"==\",\n \"!=\",\n \">\",\n \">=\",\n \"<\",\n \"<=\",\n \"contains\",\n \"notContains\",\n ],\n },\n },\n },\n },\n match: {\n type: \"string\",\n description:\n \"Match criteria for the event to trigger the automation actions\",\n enum: [\"any\", \"all\"],\n },\n },\n },\n },\n },\n actions: {\n type: \"array\",\n description: \"Actions to perform when the trigger conditions are met\",\n items: {\n type: \"object\",\n required: [\"useCase\", \"useCaseParams\"],\n additionalProperties: false,\n properties: {\n useCase: {\n type: \"string\",\n description: \"Name of the use case to call\",\n },\n useCaseParams: {\n type: \"object\",\n description: \"Parameters to pass to the use case\",\n required: [\"data\"],\n properties: {\n data: {\n type: [\"object\", \"array\"],\n description: \"Data to pass to the use case\",\n },\n },\n },\n },\n minItems: 1,\n },\n },\n createdAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation was created\",\n },\n updatedAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation was updated\",\n },\n nextRunAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation is scheduled to run next\",\n },\n lastRunAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation was last triggered\",\n },\n deletedAt: {\n $ref: \"definitions.json#/definitions/date\",\n },\n webhookUrl: {\n type: \"string\",\n description: \"The URL of the webhook that triggers the automation\",\n format: \"uri\",\n },\n },\n additionalProperties: false,\n} as const;\n\nexport type AutomationSchema = FromSchema<\n typeof automationSchema,\n {\n references: [typeof defs];\n deserialize: [\n {\n pattern: {\n format: \"date-time\";\n };\n output: Date | ISODateString;\n },\n ];\n }\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,mBAAmB;AAAA,EAC9B,SAAS;AAAA,EACT,KAAK;AAAA,EACL,OAAO;AAAA,EACP,aAAa;AAAA,EACb,MAAM;AAAA,EACN,UAAU,CAAC,MAAM,QAAQ,WAAW,SAAS;AAAA,EAC7C,YAAY;AAAA,IACV,IAAI;AAAA,MACF,MAAM;AAAA,IACR;AAAA,IACA,MAAM;AAAA,MACJ,MA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AM;AAAA,MACN,aAAa;AAAA,MACb,QAAQ;AAAA,IACV;AAAA,EACF;AAAA,EACA,sBAAsB;AACxB;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import defs, { ISODateString } from './definitions.cjs';
|
|
2
1
|
import { FromSchema } from 'json-schema-to-ts';
|
|
2
|
+
import defs, { ISODateString } from './definitions.cjs';
|
|
3
3
|
|
|
4
4
|
declare const automationSchema: {
|
|
5
5
|
readonly $schema: "http://json-schema.org/draft-07/schema";
|
|
@@ -37,9 +37,64 @@ declare const automationSchema: {
|
|
|
37
37
|
readonly properties: {
|
|
38
38
|
readonly discriminator: {
|
|
39
39
|
readonly type: "string";
|
|
40
|
-
readonly enum: readonly ["schedule", "event"];
|
|
40
|
+
readonly enum: readonly ["schedule", "event", "rrule"];
|
|
41
41
|
readonly description: "Type of trigger";
|
|
42
42
|
};
|
|
43
|
+
readonly rrule: {
|
|
44
|
+
readonly type: "object";
|
|
45
|
+
readonly additionalProperties: false;
|
|
46
|
+
readonly description: "RFC 5545 recurrence rule with solar time support";
|
|
47
|
+
readonly required: readonly ["expression", "timezone", "timeMode"];
|
|
48
|
+
readonly properties: {
|
|
49
|
+
readonly expression: {
|
|
50
|
+
readonly type: "string";
|
|
51
|
+
readonly description: "RFC 5545 RRULE string (omit BYHOUR/BYMINUTE when using solar timeMode)";
|
|
52
|
+
};
|
|
53
|
+
readonly timezone: {
|
|
54
|
+
readonly type: "string";
|
|
55
|
+
readonly description: "IANA timezone for rule evaluation";
|
|
56
|
+
};
|
|
57
|
+
readonly timeMode: {
|
|
58
|
+
readonly type: "object";
|
|
59
|
+
readonly additionalProperties: false;
|
|
60
|
+
readonly required: readonly ["type"];
|
|
61
|
+
readonly properties: {
|
|
62
|
+
readonly type: {
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
readonly enum: readonly ["fixed", "sunrise", "sunset"];
|
|
65
|
+
readonly description: "How to determine execution time on matching days";
|
|
66
|
+
};
|
|
67
|
+
readonly time: {
|
|
68
|
+
readonly type: "string";
|
|
69
|
+
readonly description: "HH:mm time for fixed mode";
|
|
70
|
+
};
|
|
71
|
+
readonly offsetSeconds: {
|
|
72
|
+
readonly type: "integer";
|
|
73
|
+
readonly description: "Offset in seconds from time or solar event (negative = before)";
|
|
74
|
+
readonly default: 0;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
readonly location: {
|
|
79
|
+
readonly type: "object";
|
|
80
|
+
readonly additionalProperties: false;
|
|
81
|
+
readonly description: "Required when timeMode is sunrise or sunset";
|
|
82
|
+
readonly required: readonly ["lat", "lng"];
|
|
83
|
+
readonly properties: {
|
|
84
|
+
readonly lat: {
|
|
85
|
+
readonly type: "number";
|
|
86
|
+
readonly minimum: -90;
|
|
87
|
+
readonly maximum: 90;
|
|
88
|
+
};
|
|
89
|
+
readonly lng: {
|
|
90
|
+
readonly type: "number";
|
|
91
|
+
readonly minimum: -180;
|
|
92
|
+
readonly maximum: 180;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
};
|
|
43
98
|
readonly schedule: {
|
|
44
99
|
readonly type: "object";
|
|
45
100
|
readonly additionalProperties: false;
|
|
@@ -2,8 +2,8 @@ import { Entity } from './entity.js';
|
|
|
2
2
|
import { validateAutomation } from '../validate.js';
|
|
3
3
|
import { AutomationSchema, automationSchema } from '../schemas/automation.js';
|
|
4
4
|
import 'ajv';
|
|
5
|
-
import '../schemas/definitions.js';
|
|
6
5
|
import 'json-schema-to-ts';
|
|
6
|
+
import '../schemas/definitions.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Data type for Automation constructor - exported for backwards compatibility
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import defs, { ISODateString } from './definitions.js';
|
|
2
1
|
import { FromSchema } from 'json-schema-to-ts';
|
|
2
|
+
import defs, { ISODateString } from './definitions.js';
|
|
3
3
|
|
|
4
4
|
declare const automationSchema: {
|
|
5
5
|
readonly $schema: "http://json-schema.org/draft-07/schema";
|
|
@@ -37,9 +37,64 @@ declare const automationSchema: {
|
|
|
37
37
|
readonly properties: {
|
|
38
38
|
readonly discriminator: {
|
|
39
39
|
readonly type: "string";
|
|
40
|
-
readonly enum: readonly ["schedule", "event"];
|
|
40
|
+
readonly enum: readonly ["schedule", "event", "rrule"];
|
|
41
41
|
readonly description: "Type of trigger";
|
|
42
42
|
};
|
|
43
|
+
readonly rrule: {
|
|
44
|
+
readonly type: "object";
|
|
45
|
+
readonly additionalProperties: false;
|
|
46
|
+
readonly description: "RFC 5545 recurrence rule with solar time support";
|
|
47
|
+
readonly required: readonly ["expression", "timezone", "timeMode"];
|
|
48
|
+
readonly properties: {
|
|
49
|
+
readonly expression: {
|
|
50
|
+
readonly type: "string";
|
|
51
|
+
readonly description: "RFC 5545 RRULE string (omit BYHOUR/BYMINUTE when using solar timeMode)";
|
|
52
|
+
};
|
|
53
|
+
readonly timezone: {
|
|
54
|
+
readonly type: "string";
|
|
55
|
+
readonly description: "IANA timezone for rule evaluation";
|
|
56
|
+
};
|
|
57
|
+
readonly timeMode: {
|
|
58
|
+
readonly type: "object";
|
|
59
|
+
readonly additionalProperties: false;
|
|
60
|
+
readonly required: readonly ["type"];
|
|
61
|
+
readonly properties: {
|
|
62
|
+
readonly type: {
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
readonly enum: readonly ["fixed", "sunrise", "sunset"];
|
|
65
|
+
readonly description: "How to determine execution time on matching days";
|
|
66
|
+
};
|
|
67
|
+
readonly time: {
|
|
68
|
+
readonly type: "string";
|
|
69
|
+
readonly description: "HH:mm time for fixed mode";
|
|
70
|
+
};
|
|
71
|
+
readonly offsetSeconds: {
|
|
72
|
+
readonly type: "integer";
|
|
73
|
+
readonly description: "Offset in seconds from time or solar event (negative = before)";
|
|
74
|
+
readonly default: 0;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
readonly location: {
|
|
79
|
+
readonly type: "object";
|
|
80
|
+
readonly additionalProperties: false;
|
|
81
|
+
readonly description: "Required when timeMode is sunrise or sunset";
|
|
82
|
+
readonly required: readonly ["lat", "lng"];
|
|
83
|
+
readonly properties: {
|
|
84
|
+
readonly lat: {
|
|
85
|
+
readonly type: "number";
|
|
86
|
+
readonly minimum: -90;
|
|
87
|
+
readonly maximum: 90;
|
|
88
|
+
};
|
|
89
|
+
readonly lng: {
|
|
90
|
+
readonly type: "number";
|
|
91
|
+
readonly minimum: -180;
|
|
92
|
+
readonly maximum: 180;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
};
|
|
43
98
|
readonly schedule: {
|
|
44
99
|
readonly type: "object";
|
|
45
100
|
readonly additionalProperties: false;
|
|
@@ -34,9 +34,64 @@ const automationSchema = {
|
|
|
34
34
|
properties: {
|
|
35
35
|
discriminator: {
|
|
36
36
|
type: "string",
|
|
37
|
-
enum: ["schedule", "event"],
|
|
37
|
+
enum: ["schedule", "event", "rrule"],
|
|
38
38
|
description: "Type of trigger"
|
|
39
39
|
},
|
|
40
|
+
rrule: {
|
|
41
|
+
type: "object",
|
|
42
|
+
additionalProperties: false,
|
|
43
|
+
description: "RFC 5545 recurrence rule with solar time support",
|
|
44
|
+
required: ["expression", "timezone", "timeMode"],
|
|
45
|
+
properties: {
|
|
46
|
+
expression: {
|
|
47
|
+
type: "string",
|
|
48
|
+
description: "RFC 5545 RRULE string (omit BYHOUR/BYMINUTE when using solar timeMode)"
|
|
49
|
+
},
|
|
50
|
+
timezone: {
|
|
51
|
+
type: "string",
|
|
52
|
+
description: "IANA timezone for rule evaluation"
|
|
53
|
+
},
|
|
54
|
+
timeMode: {
|
|
55
|
+
type: "object",
|
|
56
|
+
additionalProperties: false,
|
|
57
|
+
required: ["type"],
|
|
58
|
+
properties: {
|
|
59
|
+
type: {
|
|
60
|
+
type: "string",
|
|
61
|
+
enum: ["fixed", "sunrise", "sunset"],
|
|
62
|
+
description: "How to determine execution time on matching days"
|
|
63
|
+
},
|
|
64
|
+
time: {
|
|
65
|
+
type: "string",
|
|
66
|
+
description: "HH:mm time for fixed mode"
|
|
67
|
+
},
|
|
68
|
+
offsetSeconds: {
|
|
69
|
+
type: "integer",
|
|
70
|
+
description: "Offset in seconds from time or solar event (negative = before)",
|
|
71
|
+
default: 0
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
location: {
|
|
76
|
+
type: "object",
|
|
77
|
+
additionalProperties: false,
|
|
78
|
+
description: "Required when timeMode is sunrise or sunset",
|
|
79
|
+
required: ["lat", "lng"],
|
|
80
|
+
properties: {
|
|
81
|
+
lat: {
|
|
82
|
+
type: "number",
|
|
83
|
+
minimum: -90,
|
|
84
|
+
maximum: 90
|
|
85
|
+
},
|
|
86
|
+
lng: {
|
|
87
|
+
type: "number",
|
|
88
|
+
minimum: -180,
|
|
89
|
+
maximum: 180
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
40
95
|
// Time-based trigger properties
|
|
41
96
|
schedule: {
|
|
42
97
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../.generated/schemas/automation.ts"],"sourcesContent":["import defs, { ISODateString } from \"./definitions\";\nimport type { FromSchema } from \"json-schema-to-ts\";\n\nexport const automationSchema = {\n $schema: \"http://json-schema.org/draft-07/schema\",\n $id: \"automation.json\",\n title: \"Automation\",\n description: \"An automation is a collection of triggers and actions\",\n type: \"object\",\n required: [\"id\", \"type\", \"trigger\", \"actions\"],\n properties: {\n id: {\n $ref: \"definitions.json#/definitions/id\",\n },\n name: {\n type: \"string\",\n description: \"The friendly name of the automation\",\n },\n type: {\n type: \"string\",\n enum: [\"automation\"],\n default: \"automation\",\n },\n isEnabled: {\n type: \"boolean\",\n description: \"Whether the automation is currently enabled\",\n default: true,\n },\n description: {\n type: \"string\",\n description: \"The text description of the automation\",\n },\n trigger: {\n type: \"object\",\n description: \"The trigger that initiates the automation\",\n required: [\"discriminator\"],\n properties: {\n discriminator: {\n type: \"string\",\n enum: [\"schedule\", \"event\"],\n description: \"Type of trigger\",\n },\n // Time-based trigger properties\n schedule: {\n type: \"object\",\n additionalProperties: false,\n description: \"Schedule for time-based triggers\",\n required: [\"days\", \"time\", \"timezone\"],\n properties: {\n days: {\n type: \"array\",\n description: \"Days of the week (0 = Sunday, 6 = Saturday)\",\n items: {\n type: \"integer\",\n minimum: 0,\n maximum: 6,\n },\n },\n time: {\n type: \"string\",\n description: \"Time of day to trigger the automation\",\n },\n timeOffsetSeconds: {\n type: \"integer\",\n description: \"Offset in seconds from the scheduled time\",\n default: 0,\n },\n repeat: {\n type: \"boolean\",\n description: \"Whether the schedule repeats\",\n default: true,\n },\n timezone: {\n type: \"string\",\n description: \"Timezone for the schedule (IANA timezone format)\",\n },\n },\n },\n event: {\n type: \"object\",\n required: [\"eventType\", \"eventProperties\", \"match\"],\n additionalProperties: false,\n properties: {\n eventType: {\n type: \"string\",\n description:\n \"Name of the event that triggers the automation actions\",\n },\n eventProperties: {\n type: \"array\",\n description:\n \"Properties of the event that triggers the automation actions\",\n items: {\n type: \"object\",\n required: [\"property\", \"value\", \"operator\"],\n additionalProperties: false,\n properties: {\n property: {\n type: \"string\",\n description: \"Property of the event\",\n },\n value: {\n type: [\"string\", \"number\", \"boolean\"],\n description: \"Value of the property\",\n },\n operator: {\n type: \"string\",\n description: \"Operator of the property\",\n enum: [\n \"==\",\n \"!=\",\n \">\",\n \">=\",\n \"<\",\n \"<=\",\n \"contains\",\n \"notContains\",\n ],\n },\n },\n },\n },\n match: {\n type: \"string\",\n description:\n \"Match criteria for the event to trigger the automation actions\",\n enum: [\"any\", \"all\"],\n },\n },\n },\n },\n },\n actions: {\n type: \"array\",\n description: \"Actions to perform when the trigger conditions are met\",\n items: {\n type: \"object\",\n required: [\"useCase\", \"useCaseParams\"],\n additionalProperties: false,\n properties: {\n useCase: {\n type: \"string\",\n description: \"Name of the use case to call\",\n },\n useCaseParams: {\n type: \"object\",\n description: \"Parameters to pass to the use case\",\n required: [\"data\"],\n properties: {\n data: {\n type: [\"object\", \"array\"],\n description: \"Data to pass to the use case\",\n },\n },\n },\n },\n minItems: 1,\n },\n },\n createdAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation was created\",\n },\n updatedAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation was updated\",\n },\n nextRunAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation is scheduled to run next\",\n },\n lastRunAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation was last triggered\",\n },\n deletedAt: {\n $ref: \"definitions.json#/definitions/date\",\n },\n webhookUrl: {\n type: \"string\",\n description: \"The URL of the webhook that triggers the automation\",\n format: \"uri\",\n },\n },\n additionalProperties: false,\n} as const;\n\nexport type AutomationSchema = FromSchema<\n typeof automationSchema,\n {\n references: [typeof defs];\n deserialize: [\n {\n pattern: {\n format: \"date-time\";\n };\n output: Date | ISODateString;\n },\n ];\n }\n>;\n"],"mappings":"AAGO,MAAM,mBAAmB;AAAA,EAC9B,SAAS;AAAA,EACT,KAAK;AAAA,EACL,OAAO;AAAA,EACP,aAAa;AAAA,EACb,MAAM;AAAA,EACN,UAAU,CAAC,MAAM,QAAQ,WAAW,SAAS;AAAA,EAC7C,YAAY;AAAA,IACV,IAAI;AAAA,MACF,MAAM;AAAA,IACR;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,MAAM,CAAC,YAAY;AAAA,MACnB,SAAS;AAAA,IACX;AAAA,IACA,WAAW;AAAA,MACT,MAAM;AAAA,MACN,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,IACA,aAAa;AAAA,MACX,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,IACA,SAAS;AAAA,MACP,MAA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A,IACV;AAAA,EACF;AAAA,EACA,sBAAsB;AACxB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../.generated/schemas/automation.ts"],"sourcesContent":["import type { FromSchema } from \"json-schema-to-ts\";\nimport defs, { ISODateString } from \"./definitions\";\n\nexport const automationSchema = {\n $schema: \"http://json-schema.org/draft-07/schema\",\n $id: \"automation.json\",\n title: \"Automation\",\n description: \"An automation is a collection of triggers and actions\",\n type: \"object\",\n required: [\"id\", \"type\", \"trigger\", \"actions\"],\n properties: {\n id: {\n $ref: \"definitions.json#/definitions/id\",\n },\n name: {\n type: \"string\",\n description: \"The friendly name of the automation\",\n },\n type: {\n type: \"string\",\n enum: [\"automation\"],\n default: \"automation\",\n },\n isEnabled: {\n type: \"boolean\",\n description: \"Whether the automation is currently enabled\",\n default: true,\n },\n description: {\n type: \"string\",\n description: \"The text description of the automation\",\n },\n trigger: {\n type: \"object\",\n description: \"The trigger that initiates the automation\",\n required: [\"discriminator\"],\n properties: {\n discriminator: {\n type: \"string\",\n enum: [\"schedule\", \"event\", \"rrule\"],\n description: \"Type of trigger\",\n },\n rrule: {\n type: \"object\",\n additionalProperties: false,\n description: \"RFC 5545 recurrence rule with solar time support\",\n required: [\"expression\", \"timezone\", \"timeMode\"],\n properties: {\n expression: {\n type: \"string\",\n description:\n \"RFC 5545 RRULE string (omit BYHOUR/BYMINUTE when using solar timeMode)\",\n },\n timezone: {\n type: \"string\",\n description: \"IANA timezone for rule evaluation\",\n },\n timeMode: {\n type: \"object\",\n additionalProperties: false,\n required: [\"type\"],\n properties: {\n type: {\n type: \"string\",\n enum: [\"fixed\", \"sunrise\", \"sunset\"],\n description:\n \"How to determine execution time on matching days\",\n },\n time: {\n type: \"string\",\n description: \"HH:mm time for fixed mode\",\n },\n offsetSeconds: {\n type: \"integer\",\n description:\n \"Offset in seconds from time or solar event (negative = before)\",\n default: 0,\n },\n },\n },\n location: {\n type: \"object\",\n additionalProperties: false,\n description: \"Required when timeMode is sunrise or sunset\",\n required: [\"lat\", \"lng\"],\n properties: {\n lat: {\n type: \"number\",\n minimum: -90,\n maximum: 90,\n },\n lng: {\n type: \"number\",\n minimum: -180,\n maximum: 180,\n },\n },\n },\n },\n },\n // Time-based trigger properties\n schedule: {\n type: \"object\",\n additionalProperties: false,\n description: \"Schedule for time-based triggers\",\n required: [\"days\", \"time\", \"timezone\"],\n properties: {\n days: {\n type: \"array\",\n description: \"Days of the week (0 = Sunday, 6 = Saturday)\",\n items: {\n type: \"integer\",\n minimum: 0,\n maximum: 6,\n },\n },\n time: {\n type: \"string\",\n description: \"Time of day to trigger the automation\",\n },\n timeOffsetSeconds: {\n type: \"integer\",\n description: \"Offset in seconds from the scheduled time\",\n default: 0,\n },\n repeat: {\n type: \"boolean\",\n description: \"Whether the schedule repeats\",\n default: true,\n },\n timezone: {\n type: \"string\",\n description: \"Timezone for the schedule (IANA timezone format)\",\n },\n },\n },\n event: {\n type: \"object\",\n required: [\"eventType\", \"eventProperties\", \"match\"],\n additionalProperties: false,\n properties: {\n eventType: {\n type: \"string\",\n description:\n \"Name of the event that triggers the automation actions\",\n },\n eventProperties: {\n type: \"array\",\n description:\n \"Properties of the event that triggers the automation actions\",\n items: {\n type: \"object\",\n required: [\"property\", \"value\", \"operator\"],\n additionalProperties: false,\n properties: {\n property: {\n type: \"string\",\n description: \"Property of the event\",\n },\n value: {\n type: [\"string\", \"number\", \"boolean\"],\n description: \"Value of the property\",\n },\n operator: {\n type: \"string\",\n description: \"Operator of the property\",\n enum: [\n \"==\",\n \"!=\",\n \">\",\n \">=\",\n \"<\",\n \"<=\",\n \"contains\",\n \"notContains\",\n ],\n },\n },\n },\n },\n match: {\n type: \"string\",\n description:\n \"Match criteria for the event to trigger the automation actions\",\n enum: [\"any\", \"all\"],\n },\n },\n },\n },\n },\n actions: {\n type: \"array\",\n description: \"Actions to perform when the trigger conditions are met\",\n items: {\n type: \"object\",\n required: [\"useCase\", \"useCaseParams\"],\n additionalProperties: false,\n properties: {\n useCase: {\n type: \"string\",\n description: \"Name of the use case to call\",\n },\n useCaseParams: {\n type: \"object\",\n description: \"Parameters to pass to the use case\",\n required: [\"data\"],\n properties: {\n data: {\n type: [\"object\", \"array\"],\n description: \"Data to pass to the use case\",\n },\n },\n },\n },\n minItems: 1,\n },\n },\n createdAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation was created\",\n },\n updatedAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation was updated\",\n },\n nextRunAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation is scheduled to run next\",\n },\n lastRunAt: {\n $ref: \"definitions.json#/definitions/date\",\n description: \"When the automation was last triggered\",\n },\n deletedAt: {\n $ref: \"definitions.json#/definitions/date\",\n },\n webhookUrl: {\n type: \"string\",\n description: \"The URL of the webhook that triggers the automation\",\n format: \"uri\",\n },\n },\n additionalProperties: false,\n} as const;\n\nexport type AutomationSchema = FromSchema<\n typeof automationSchema,\n {\n references: [typeof defs];\n deserialize: [\n {\n pattern: {\n format: \"date-time\";\n };\n output: Date | ISODateString;\n },\n ];\n }\n>;\n"],"mappings":"AAGO,MAAM,mBAAmB;AAAA,EAC9B,SAAS;AAAA,EACT,KAAK;AAAA,EACL,OAAO;AAAA,EACP,aAAa;AAAA,EACb,MAAM;AAAA,EACN,UAAU,CAAC,MAAM,QAAQ,WAAW,SAAS;AAAA,EAC7C,YAAY;AAAA,IACV,IAAI;AAAA,MACF,MAAM;AAAA,IACR;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,MAAM,CAAC,YAAY;AAAA,MACnB,SAAS;AAAA,IACX;AAAA,IACA,WAAW;AAAA,MACT,MAAM;AAAA,MACN,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,IACA,aAAa;AAAA,MACX,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,IACA,SAAS;AAAA,MACP,MA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