@coast/core-types 0.0.59 → 0.0.60
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/automations/TCreateAutomation.d.ts +17 -0
- package/dist/automations/TCreateAutomation.js +3 -0
- package/dist/automations/TCreateAutomation.js.map +1 -0
- package/dist/automations/TUpdateAutomation.d.ts +18 -0
- package/dist/automations/TUpdateAutomation.js +3 -0
- package/dist/automations/TUpdateAutomation.js.map +1 -0
- package/dist/automations/ValidatableAutomation.d.ts +4 -0
- package/dist/automations/ValidatableAutomation.js +3 -0
- package/dist/automations/ValidatableAutomation.js.map +1 -0
- package/dist/automations/action/TCreateAnyAutomationAction.d.ts +3 -0
- package/dist/automations/action/TCreateAnyAutomationAction.js +3 -0
- package/dist/automations/action/TCreateAnyAutomationAction.js.map +1 -0
- package/dist/automations/action/TSaveAnyAutomationAction.d.ts +3 -0
- package/dist/automations/action/TSaveAnyAutomationAction.js +3 -0
- package/dist/automations/action/TSaveAnyAutomationAction.js.map +1 -0
- package/dist/utils/DistributiveOmit.d.ts +1 -0
- package/dist/utils/DistributiveOmit.js +3 -0
- package/dist/utils/DistributiveOmit.js.map +1 -0
- package/package.json +1 -1
- package/src/automations/TCreateAutomation.ts +19 -0
- package/src/automations/TUpdateAutomation.ts +19 -0
- package/src/automations/ValidatableAutomation.ts +5 -0
- package/src/automations/action/TCreateAnyAutomationAction.ts +9 -0
- package/src/automations/action/TSaveAnyAutomationAction.ts +4 -0
- package/src/utils/DistributiveOmit.ts +9 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BusinessId } from '../business/BusinessId';
|
|
2
|
+
import { WorkflowTemplateId } from '../workflow-template/WorkflowTemplateId';
|
|
3
|
+
import { TSaveAnyAutomationAction } from './action/TSaveAnyAutomationAction';
|
|
4
|
+
import { AutomationId } from './AutomationId';
|
|
5
|
+
import { AutomationTriggerType } from './AutomationTriggerType';
|
|
6
|
+
import { TCondition } from './condition/TCondition';
|
|
7
|
+
export interface TCreateAutomation {
|
|
8
|
+
workflowTemplateId: WorkflowTemplateId;
|
|
9
|
+
businessId: BusinessId;
|
|
10
|
+
name: string;
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
suppressAutomationChain: boolean;
|
|
13
|
+
trigger: AutomationTriggerType;
|
|
14
|
+
actions: TSaveAnyAutomationAction[];
|
|
15
|
+
conditions?: TCondition[];
|
|
16
|
+
parentId?: AutomationId;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TCreateAutomation.js","sourceRoot":"","sources":["../../src/automations/TCreateAutomation.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BusinessId } from '../business/BusinessId';
|
|
2
|
+
import { WorkflowTemplateId } from '../workflow-template/WorkflowTemplateId';
|
|
3
|
+
import { TSaveAnyAutomationAction } from './action/TSaveAnyAutomationAction';
|
|
4
|
+
import { AutomationId } from './AutomationId';
|
|
5
|
+
import { AutomationTriggerType } from './AutomationTriggerType';
|
|
6
|
+
import { TCondition } from './condition/TCondition';
|
|
7
|
+
export interface TUpdateAutomation {
|
|
8
|
+
id: AutomationId;
|
|
9
|
+
businessId: BusinessId;
|
|
10
|
+
workflowTemplateId: WorkflowTemplateId;
|
|
11
|
+
name: string;
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
suppressAutomationChain: boolean;
|
|
14
|
+
trigger: AutomationTriggerType;
|
|
15
|
+
actions: TSaveAnyAutomationAction[];
|
|
16
|
+
conditions?: TCondition[];
|
|
17
|
+
parentId?: AutomationId;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TUpdateAutomation.js","sourceRoot":"","sources":["../../src/automations/TUpdateAutomation.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidatableAutomation.js","sourceRoot":"","sources":["../../src/automations/ValidatableAutomation.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TCreateAnyAutomationAction.js","sourceRoot":"","sources":["../../../src/automations/action/TCreateAnyAutomationAction.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TSaveAnyAutomationAction.js","sourceRoot":"","sources":["../../../src/automations/action/TSaveAnyAutomationAction.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type DistributiveOmit<T, K extends keyof never> = T extends unknown ? Omit<T, K> : never;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DistributiveOmit.js","sourceRoot":"","sources":["../../src/utils/DistributiveOmit.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BusinessId } from '../business/BusinessId';
|
|
2
|
+
import { WorkflowTemplateId } from '../workflow-template/WorkflowTemplateId';
|
|
3
|
+
import { TSaveAnyAutomationAction } from './action/TSaveAnyAutomationAction';
|
|
4
|
+
import { AutomationId } from './AutomationId';
|
|
5
|
+
import { AutomationTriggerType } from './AutomationTriggerType';
|
|
6
|
+
import { TCondition } from './condition/TCondition';
|
|
7
|
+
|
|
8
|
+
export interface TCreateAutomation {
|
|
9
|
+
workflowTemplateId: WorkflowTemplateId;
|
|
10
|
+
businessId: BusinessId;
|
|
11
|
+
name: string;
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
suppressAutomationChain: boolean;
|
|
14
|
+
trigger: AutomationTriggerType;
|
|
15
|
+
// Support actions with pre-generated ids so that clients can create Automations with references between actions
|
|
16
|
+
actions: TSaveAnyAutomationAction[];
|
|
17
|
+
conditions?: TCondition[];
|
|
18
|
+
parentId?: AutomationId;
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BusinessId } from '../business/BusinessId';
|
|
2
|
+
import { WorkflowTemplateId } from '../workflow-template/WorkflowTemplateId';
|
|
3
|
+
import { TSaveAnyAutomationAction } from './action/TSaveAnyAutomationAction';
|
|
4
|
+
import { AutomationId } from './AutomationId';
|
|
5
|
+
import { AutomationTriggerType } from './AutomationTriggerType';
|
|
6
|
+
import { TCondition } from './condition/TCondition';
|
|
7
|
+
|
|
8
|
+
export interface TUpdateAutomation {
|
|
9
|
+
id: AutomationId;
|
|
10
|
+
businessId: BusinessId;
|
|
11
|
+
workflowTemplateId: WorkflowTemplateId;
|
|
12
|
+
name: string;
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
suppressAutomationChain: boolean;
|
|
15
|
+
trigger: AutomationTriggerType;
|
|
16
|
+
actions: TSaveAnyAutomationAction[];
|
|
17
|
+
conditions?: TCondition[];
|
|
18
|
+
parentId?: AutomationId;
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DistributiveOmit } from '../../utils/DistributiveOmit';
|
|
2
|
+
import { TAnyAutomationAction } from './TAnyAutomationAction';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* An action as submitted on *create*: identical to a read action, but with no `id` yet
|
|
6
|
+
* (action ids are DB-generated). `DistributiveOmit` (not `Omit`) keeps this a discriminated
|
|
7
|
+
* union so `switch (action.type)` still narrows.
|
|
8
|
+
*/
|
|
9
|
+
export type TCreateAnyAutomationAction = DistributiveOmit<TAnyAutomationAction, 'id'>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Like the built-in `Omit`, but distributes over the members of a union.
|
|
3
|
+
*
|
|
4
|
+
* `Omit<A | B, K>` collapses the union into a *single* merged object (losing the discriminant),
|
|
5
|
+
* which breaks `switch (x.type)` narrowing. `DistributiveOmit` applies `Omit` to each member
|
|
6
|
+
* individually, so `DistributiveOmit<A | B, K>` is `Omit<A, K> | Omit<B, K>` and the union
|
|
7
|
+
* (and its discriminant) survives.
|
|
8
|
+
*/
|
|
9
|
+
export type DistributiveOmit<T, K extends keyof never> = T extends unknown ? Omit<T, K> : never;
|