processfocus 0.1.0-next.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/LICENSE.md +28 -0
- package/README.md +14 -0
- package/dist/auth-FmXptohB.mjs +275 -0
- package/dist/auth-config/src/lib/authentication-config.d.ts +146 -0
- package/dist/auth-config/src/lib/custom-entities-config.d.ts +47 -0
- package/dist/auth-config/src/lib/policies-config.d.ts +52 -0
- package/dist/auth-config/src/lib/provider-types.d.ts +194 -0
- package/dist/auth.d.ts +4 -0
- package/dist/auth.mjs +2 -0
- package/dist/business-calendar/src/index.d.ts +10 -0
- package/dist/business-calendar/src/lib/calendar-config.d.ts +163 -0
- package/dist/business-calendar/src/lib/calendar-period.d.ts +88 -0
- package/dist/business-calendar/src/lib/calendar-service-impl.d.ts +19 -0
- package/dist/business-calendar/src/lib/calendar-service.d.ts +215 -0
- package/dist/business-calendar/src/lib/datetime-utils.d.ts +30 -0
- package/dist/business-calendar/src/lib/duration-calculator.d.ts +49 -0
- package/dist/business-calendar/src/lib/errors.d.ts +69 -0
- package/dist/business-calendar/src/lib/holiday-calculator.d.ts +61 -0
- package/dist/business-calendar/src/lib/holidays.d.ts +141 -0
- package/dist/business-calendar/src/lib/types.d.ts +110 -0
- package/dist/calendar.d.ts +1 -0
- package/dist/calendar.mjs +1204 -0
- package/dist/form-client-representation/src/index.d.ts +6 -0
- package/dist/form-client-representation/src/lib/as-client-representation.d.ts +31 -0
- package/dist/form-client-representation/src/lib/client-form-definition.d.ts +17 -0
- package/dist/form-client-representation/src/lib/extract-annotations.d.ts +20 -0
- package/dist/form-client-representation/src/lib/plugin-registry.d.ts +6 -0
- package/dist/form-client-representation/src/lib/types.d.ts +239 -0
- package/dist/form-client-representation/src/lib/walker.d.ts +68 -0
- package/dist/form-rule/src/index.d.ts +3 -0
- package/dist/form-rule/src/lib/evaluator.d.ts +2 -0
- package/dist/form-rule/src/lib/paths.d.ts +9 -0
- package/dist/form-rule/src/lib/types.d.ts +89 -0
- package/dist/form-schema/src/index.d.ts +8 -0
- package/dist/form-schema/src/lib/annotation-helpers.d.ts +8 -0
- package/dist/form-schema/src/lib/deferred-value.d.ts +10 -0
- package/dist/form-schema/src/lib/email.d.ts +23 -0
- package/dist/form-schema/src/lib/field-count.d.ts +32 -0
- package/dist/form-schema/src/lib/form-annotations.d.ts +25 -0
- package/dist/form-schema/src/lib/form-schema.d.ts +459 -0
- package/dist/form-schema/src/lib/phone.d.ts +4 -0
- package/dist/form-schema/src/lib/property-signature.d.ts +3 -0
- package/dist/form-submission-schema/src/index.d.ts +2 -0
- package/dist/form-submission-schema/src/lib/form-submission-schema.d.ts +49 -0
- package/dist/form-submission-schema/src/lib/schema-defaults.d.ts +16 -0
- package/dist/forms.d.ts +1 -0
- package/dist/forms.mjs +2 -0
- package/dist/frontend-manifest/src/index.d.ts +2 -0
- package/dist/frontend-manifest/src/lib/browser-plugin-artifact.d.ts +25 -0
- package/dist/frontend-manifest/src/lib/frontend-manifest.d.ts +83 -0
- package/dist/frontend-plugin-host/src/index.d.ts +2 -0
- package/dist/frontend-plugin-host/src/lib/frontend-plugin-host.d.ts +124 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.mjs +3780 -0
- package/dist/manifest.d.ts +2 -0
- package/dist/manifest.mjs +5 -0
- package/dist/paths-BkzLn-rG.mjs +282 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.mjs +84 -0
- package/dist/process/src/lib/app-icons.d.ts +52 -0
- package/dist/process/src/lib/brands.d.ts +20 -0
- package/dist/process/src/lib/document-store.d.ts +30 -0
- package/dist/process/src/lib/execution-failure-notifications.d.ts +14 -0
- package/dist/process/src/lib/flow-context.d.ts +181 -0
- package/dist/process/src/lib/flow-path.d.ts +123 -0
- package/dist/process/src/lib/form-authoring.d.ts +19 -0
- package/dist/process/src/lib/form-decoration.d.ts +13 -0
- package/dist/process/src/lib/form-defaults.d.ts +5 -0
- package/dist/process/src/lib/form.d.ts +557 -0
- package/dist/process/src/lib/invitation.d.ts +35 -0
- package/dist/process/src/lib/list.d.ts +447 -0
- package/dist/process/src/lib/lookup-accessor.d.ts +68 -0
- package/dist/process/src/lib/node_step.d.ts +68 -0
- package/dist/process/src/lib/org-unit.d.ts +53 -0
- package/dist/process/src/lib/org-utils.d.ts +56 -0
- package/dist/process/src/lib/organisation-frontend-plugin-manifest.d.ts +33 -0
- package/dist/process/src/lib/organisation.d.ts +166 -0
- package/dist/process/src/lib/phase.d.ts +16 -0
- package/dist/process/src/lib/process.d.ts +196 -0
- package/dist/process/src/lib/public-form-branding.d.ts +27 -0
- package/dist/process/src/lib/role.d.ts +29 -0
- package/dist/process/src/lib/schedule.d.ts +239 -0
- package/dist/process/src/lib/sla.d.ts +84 -0
- package/dist/process/src/lib/stats-view.d.ts +68 -0
- package/dist/process/src/lib/step.d.ts +130 -0
- package/dist/process/src/lib/system-step-executor.d.ts +130 -0
- package/dist/process/src/lib/system-step.d.ts +248 -0
- package/dist/sdk/src/auth.d.ts +4 -0
- package/dist/sdk/src/calendar.d.ts +1 -0
- package/dist/sdk/src/forms.d.ts +1 -0
- package/dist/sdk/src/index.d.ts +26 -0
- package/dist/sdk/src/manifest.d.ts +2 -0
- package/dist/sdk/src/plugin.d.ts +3 -0
- package/dist/sdk/src/testing.d.ts +9 -0
- package/dist/src-C-909PVQ.mjs +498 -0
- package/dist/testing.d.ts +9 -0
- package/dist/testing.mjs +5 -0
- package/package.json +67 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes a path for database storage by ensuring it starts with a forward slash.
|
|
3
|
+
* Paths in constructs don't have a leading slash, but stored paths should have one
|
|
4
|
+
* to clearly indicate they are paths.
|
|
5
|
+
*
|
|
6
|
+
* @param path - Path like "Demo/engineering/bug-fix" or "/Demo/engineering/bug-fix"
|
|
7
|
+
* @returns Normalized path with leading slash like "/Demo/engineering/bug-fix"
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* normalizePath("Demo/engineering/bug-fix")
|
|
12
|
+
* // => "/Demo/engineering/bug-fix"
|
|
13
|
+
*
|
|
14
|
+
* normalizePath("/Demo/engineering/bug-fix")
|
|
15
|
+
* // => "/Demo/engineering/bug-fix"
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare const normalizePath: (path: string) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Strips the leading slash from a path, converting from database format to construct format.
|
|
21
|
+
* This is the inverse of normalizePath.
|
|
22
|
+
*
|
|
23
|
+
* @param path - Path like "/Demo/engineering/bug-fix" or "Demo/engineering/bug-fix"
|
|
24
|
+
* @returns Path without leading slash like "Demo/engineering/bug-fix"
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* toConstructPath("/Demo/engineering/bug-fix")
|
|
29
|
+
* // => "Demo/engineering/bug-fix"
|
|
30
|
+
*
|
|
31
|
+
* toConstructPath("Demo/engineering/bug-fix")
|
|
32
|
+
* // => "Demo/engineering/bug-fix"
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare const toConstructPath: (path: string) => string;
|
|
36
|
+
/**
|
|
37
|
+
* Converts a construct path to a PascalCase name.
|
|
38
|
+
* Used for generating GraphQL type names from step/process paths.
|
|
39
|
+
* Path format: "orgUnit/processName/stepName" or "/orgUnit/processName/stepName"
|
|
40
|
+
*
|
|
41
|
+
* Handles optional leading slash for backward compatibility.
|
|
42
|
+
*
|
|
43
|
+
* @param path - Full construct path like "engineering/bug-report-fix/Report bug"
|
|
44
|
+
* or "/engineering/bug-report-fix/Report bug"
|
|
45
|
+
* @returns PascalCase name like "EngineeringBugReportFixReportBug"
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* pathToPascalCase("engineering/bug-report-fix/Report bug")
|
|
50
|
+
* // => "EngineeringBugReportFixReportBug"
|
|
51
|
+
*
|
|
52
|
+
* pathToPascalCase("/engineering/bug-report-fix/Report bug")
|
|
53
|
+
* // => "EngineeringBugReportFixReportBug"
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare const pathToPascalCase: (path: string) => string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { IConstruct } from "constructs";
|
|
2
|
+
import { type BrowserPluginCategory, type OrganisationFrontendPluginManifestClientPlugin } from "../../../frontend-manifest/src/index.js";
|
|
3
|
+
import type { Organisation } from "./organisation.js";
|
|
4
|
+
export type { BrowserPluginArtifactEntry, BrowserPluginArtifactManifest, BrowserPluginCategory, OrganisationFrontendPluginManifestClientPlugin, OrganisationFrontendPluginManifestJson, } from "../../../frontend-manifest/src/index.js";
|
|
5
|
+
export { BROWSER_PLUGIN_ARTIFACT_MANIFEST_FILE, BROWSER_PLUGIN_ARTIFACT_MANIFEST_FORMAT, BROWSER_PLUGIN_ARTIFACT_MANIFEST_VERSION, parseBrowserPluginArtifactManifest, } from "../../../frontend-manifest/src/index.js";
|
|
6
|
+
/** Categorizes how the Dashboard activates a browser plugin. */
|
|
7
|
+
export type OrganisationFrontendManifestPluginCategory = BrowserPluginCategory;
|
|
8
|
+
export interface OrganisationFrontendPluginManifestProvider {
|
|
9
|
+
readonly isFrontendClientPluginManifestProvider: true;
|
|
10
|
+
readonly frontendManifestPluginCategory?: OrganisationFrontendManifestPluginCategory;
|
|
11
|
+
buildFrontendClientPluginManifest(): OrganisationFrontendPluginManifestClientPlugin;
|
|
12
|
+
}
|
|
13
|
+
export interface OrganisationBrowserPluginBuildInput {
|
|
14
|
+
readonly identity: string;
|
|
15
|
+
readonly category: BrowserPluginCategory;
|
|
16
|
+
readonly hostInterfaceVersion: number;
|
|
17
|
+
readonly entrypoint: string;
|
|
18
|
+
readonly preparation?: OrganisationBrowserPluginPreparationBuildInput;
|
|
19
|
+
}
|
|
20
|
+
export interface OrganisationBrowserPluginPreparationBuildInput {
|
|
21
|
+
readonly kind: "stylesheet";
|
|
22
|
+
readonly entrypoint: string;
|
|
23
|
+
}
|
|
24
|
+
export interface OrganisationBrowserPluginArtifactProvider {
|
|
25
|
+
readonly isBrowserPluginArtifactProvider: true;
|
|
26
|
+
buildBrowserPluginArtifact(): OrganisationBrowserPluginBuildInput;
|
|
27
|
+
}
|
|
28
|
+
type OrganisationFrontendPluginManifestConstruct = IConstruct & OrganisationFrontendPluginManifestProvider;
|
|
29
|
+
type OrganisationBrowserPluginArtifactConstruct = IConstruct & OrganisationFrontendPluginManifestProvider & OrganisationBrowserPluginArtifactProvider;
|
|
30
|
+
export declare const findOrganisationFrontendPluginManifestProviders: (org: Organisation) => ReadonlyArray<OrganisationFrontendPluginManifestConstruct>;
|
|
31
|
+
export declare const findOrganisationBrowserPluginArtifactProviders: (org: Organisation) => ReadonlyArray<OrganisationBrowserPluginArtifactConstruct>;
|
|
32
|
+
export declare const buildOrganisationBrowserPluginBuildInput: (provider: OrganisationBrowserPluginArtifactConstruct) => OrganisationBrowserPluginBuildInput;
|
|
33
|
+
export declare const buildOrganisationFrontendPluginManifestClientPlugin: (provider: OrganisationFrontendPluginManifestConstruct) => OrganisationFrontendPluginManifestClientPlugin;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import type { BusinessCalendarConfig } from "../../../business-calendar/src/index.js";
|
|
2
|
+
import type { DocumentStore } from "./document-store.js";
|
|
3
|
+
import type { Form } from "./form.js";
|
|
4
|
+
import type { List } from "./list.js";
|
|
5
|
+
import { OrgUnit as OrgUnitClass } from "./org-unit.js";
|
|
6
|
+
import { type Process } from "./process.js";
|
|
7
|
+
import type { StatsView } from "./stats-view.js";
|
|
8
|
+
import type { Step } from "./step.js";
|
|
9
|
+
/**
|
|
10
|
+
* Validates that a string is a valid IANA timezone identifier.
|
|
11
|
+
* @throws Error if timezone is invalid
|
|
12
|
+
*/
|
|
13
|
+
export declare const validateTimeZone: (timeZone: string) => void;
|
|
14
|
+
/**
|
|
15
|
+
* This Organisation is purely for internal use (testing).
|
|
16
|
+
*
|
|
17
|
+
* The real organisation lives in the organisation package, and has
|
|
18
|
+
* various helper methods to use it.
|
|
19
|
+
*/
|
|
20
|
+
export interface OrganisationProps {
|
|
21
|
+
/**
|
|
22
|
+
* Full name of organisation.
|
|
23
|
+
*/
|
|
24
|
+
readonly name: string;
|
|
25
|
+
/**
|
|
26
|
+
* Shortened form.
|
|
27
|
+
*/
|
|
28
|
+
readonly acronym?: string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* IANA timezone identifier (e.g., "Europe/Amsterdam", "America/New_York").
|
|
31
|
+
* Defaults to "UTC" if not specified.
|
|
32
|
+
*/
|
|
33
|
+
readonly timeZone?: string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* BCP 47 locale used for organisation-authored date/time display.
|
|
36
|
+
*/
|
|
37
|
+
readonly locale?: string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Business calendar configuration for the organisation.
|
|
40
|
+
* Defines working hours, holidays, and special periods.
|
|
41
|
+
*
|
|
42
|
+
* Behaviour: default is to be closed, the business calendar specifies when the
|
|
43
|
+
* business is operating.
|
|
44
|
+
*
|
|
45
|
+
* Default when no calendar is specified: a 24/7 calendar.
|
|
46
|
+
*/
|
|
47
|
+
readonly businessCalendar?: BusinessCalendarConfig | undefined;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Represents the root organizational unit.
|
|
51
|
+
*
|
|
52
|
+
* Organisation extends OrgUnit and is automatically assigned type "organisation".
|
|
53
|
+
* It serves as the root of the organizational hierarchy tree.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const org = new Organisation({
|
|
58
|
+
* name: "Acme Corp",
|
|
59
|
+
* timeZone: "Europe/Amsterdam"
|
|
60
|
+
* })
|
|
61
|
+
* const hr = new OrgUnit(org, "hr", {
|
|
62
|
+
* name: "Human Resources",
|
|
63
|
+
* type: "department"
|
|
64
|
+
* })
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare class Organisation extends OrgUnitClass {
|
|
68
|
+
readonly isOrganisation: true;
|
|
69
|
+
/**
|
|
70
|
+
* IANA timezone identifier (e.g., "Europe/Amsterdam", "America/New_York").
|
|
71
|
+
*/
|
|
72
|
+
readonly timeZone: string;
|
|
73
|
+
/**
|
|
74
|
+
* BCP 47 locale used for organisation-authored date/time display.
|
|
75
|
+
*/
|
|
76
|
+
readonly locale: string;
|
|
77
|
+
/**
|
|
78
|
+
* Business calendar configuration for the organisation.
|
|
79
|
+
* Defines working hours, holidays, and special periods.
|
|
80
|
+
*/
|
|
81
|
+
readonly businessCalendar?: BusinessCalendarConfig | undefined;
|
|
82
|
+
constructor(props: OrganisationProps);
|
|
83
|
+
/**
|
|
84
|
+
* Find a step by its path relative to the organisation root.
|
|
85
|
+
* Path format: "orgUnit/processName/stepName"
|
|
86
|
+
*
|
|
87
|
+
* @param stepPath - Path like "engineering/bug-report-fix/Report bug"
|
|
88
|
+
* @returns The Step if found, otherwise undefined
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const step = org.stepByPath("engineering/bug-report-fix/Report bug")
|
|
93
|
+
* if (step) {
|
|
94
|
+
* // Handle step
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
stepByPath(stepPath: string): Step | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Find a Form step by its path relative to the organisation root.
|
|
101
|
+
* Returns undefined if the path doesn't exist or points to a non-Form step.
|
|
102
|
+
*
|
|
103
|
+
* @param stepPath - Path like "engineering/bug-report-fix/Report bug"
|
|
104
|
+
* @returns The Form if found, otherwise undefined
|
|
105
|
+
*/
|
|
106
|
+
formByPath(stepPath: string): Form | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Recursively collects all processes from this organisation.
|
|
109
|
+
*
|
|
110
|
+
* @returns Array of all Process instances in the organisation tree
|
|
111
|
+
*/
|
|
112
|
+
processes(): Process[];
|
|
113
|
+
/**
|
|
114
|
+
* Recursively collects all lists from this organisation.
|
|
115
|
+
*
|
|
116
|
+
* @returns Array of all List instances in the organisation tree
|
|
117
|
+
*/
|
|
118
|
+
lists(): List<any, any, any, any, any, any>[];
|
|
119
|
+
/**
|
|
120
|
+
* Recursively collects all document stores from this organisation.
|
|
121
|
+
*
|
|
122
|
+
* @returns Array of all DocumentStore instances in the organisation tree
|
|
123
|
+
*/
|
|
124
|
+
documentStores(): DocumentStore[];
|
|
125
|
+
/**
|
|
126
|
+
* Recursively collects all stats views from this organisation.
|
|
127
|
+
*
|
|
128
|
+
* @returns Array of all StatsView instances in the organisation tree
|
|
129
|
+
*/
|
|
130
|
+
statsViews(): StatsView[];
|
|
131
|
+
/**
|
|
132
|
+
* Find a List by its path relative to the organisation root.
|
|
133
|
+
* Path format: "orgUnit/listName" (e.g., "school/employees")
|
|
134
|
+
*
|
|
135
|
+
* @param listPath - Path to the list
|
|
136
|
+
* @returns The List if found, otherwise undefined
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* const list = org.listByPath("school/employees")
|
|
141
|
+
* if (list) {
|
|
142
|
+
* // Use the list
|
|
143
|
+
* }
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
listByPath(listPath: string): List<any, any, any, any, any, any> | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* Returns true if the node ID is the virtual end node (__end__).
|
|
149
|
+
* Used when walking process graphs to skip the end node.
|
|
150
|
+
*/
|
|
151
|
+
isEndNode(nodeId: string): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Validates all process flows in the organisation.
|
|
154
|
+
* A flow is valid if all non-virtual nodes are reachable and have an edge to the end node.
|
|
155
|
+
*
|
|
156
|
+
* @returns Array of validation errors with process path and problem details
|
|
157
|
+
*/
|
|
158
|
+
validateAllFlows(): Array<{
|
|
159
|
+
processPath: string;
|
|
160
|
+
unreachable: string[];
|
|
161
|
+
dangling: string[];
|
|
162
|
+
missingElse: string[];
|
|
163
|
+
multipleElse: string[];
|
|
164
|
+
orphanElse: string[];
|
|
165
|
+
}>;
|
|
166
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import type { OrgUnit } from "./org-unit.js";
|
|
3
|
+
export interface PhaseProps {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Represents a phase in a process. Steps can be assigned a phase, and
|
|
8
|
+
* will be visually indicates as being part of the given phase in a
|
|
9
|
+
* swimlane.
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
export declare class Phase extends Construct {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly orgUnit: OrgUnit;
|
|
15
|
+
constructor(scope: OrgUnit, id: string, props?: PhaseProps);
|
|
16
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import type { Schema } from "effect";
|
|
3
|
+
import { MultiDirectedGraph as DirectedGraph } from "graphology";
|
|
4
|
+
import type { DayOfMonth, TimeOfDay } from "../../../business-calendar/src/index.js";
|
|
5
|
+
import type { FlattenFields } from "../../../form-submission-schema/src/index.js";
|
|
6
|
+
import type { CamelCase, FlowContext, FormStepMeta, StepMeta } from "./flow-context.js";
|
|
7
|
+
import { type FlowPath } from "./flow-path.js";
|
|
8
|
+
import type { Form } from "./form.js";
|
|
9
|
+
import type { OrgUnit } from "./org-unit.js";
|
|
10
|
+
import type { Role } from "./role.js";
|
|
11
|
+
import type { ScheduledTime } from "./schedule.js";
|
|
12
|
+
import type { SlaConfig } from "./sla.js";
|
|
13
|
+
import type { Step } from "./step.js";
|
|
14
|
+
export interface ProcessResponsibility {
|
|
15
|
+
readonly role: Role;
|
|
16
|
+
readonly responsibility: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Use lowercase weekday strings for process cron config so org definitions and
|
|
20
|
+
* JSON manifests stay ergonomic and stable across serialisation boundaries.
|
|
21
|
+
*/
|
|
22
|
+
export type CronWeekday = "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
|
|
23
|
+
export interface DailyProcessCron {
|
|
24
|
+
readonly type: "daily";
|
|
25
|
+
readonly at: TimeOfDay;
|
|
26
|
+
readonly timeZone?: string | undefined;
|
|
27
|
+
}
|
|
28
|
+
export interface HourlyProcessCron {
|
|
29
|
+
readonly type: "hourly";
|
|
30
|
+
readonly minute: number;
|
|
31
|
+
readonly timeZone?: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
export interface WeeklyProcessCron {
|
|
34
|
+
readonly type: "weekly";
|
|
35
|
+
readonly weekday: CronWeekday;
|
|
36
|
+
readonly at: TimeOfDay;
|
|
37
|
+
readonly timeZone?: string | undefined;
|
|
38
|
+
}
|
|
39
|
+
export interface MonthlyProcessCron {
|
|
40
|
+
readonly type: "monthly";
|
|
41
|
+
readonly dayOfMonth: DayOfMonth;
|
|
42
|
+
readonly at: TimeOfDay;
|
|
43
|
+
readonly timeZone?: string | undefined;
|
|
44
|
+
}
|
|
45
|
+
export type ProcessCron = HourlyProcessCron | DailyProcessCron | WeeklyProcessCron | MonthlyProcessCron;
|
|
46
|
+
export interface ProcessProps {
|
|
47
|
+
/**
|
|
48
|
+
* Name of process.
|
|
49
|
+
*/
|
|
50
|
+
readonly name: string;
|
|
51
|
+
/**
|
|
52
|
+
* Purpose of process.
|
|
53
|
+
*/
|
|
54
|
+
readonly purpose: string;
|
|
55
|
+
/**
|
|
56
|
+
* Optional path to a Markdown document that explains how to operate this process.
|
|
57
|
+
* Relative paths are resolved from the organisation root.
|
|
58
|
+
*/
|
|
59
|
+
readonly documentationPath?: string | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Description of responsibilities of each roles in the process.
|
|
62
|
+
* Shown in the process flow.
|
|
63
|
+
*
|
|
64
|
+
* Determines the ordering of swimlanes when set.
|
|
65
|
+
*/
|
|
66
|
+
readonly responsibilities?: ProcessResponsibility[];
|
|
67
|
+
/**
|
|
68
|
+
* Optional SLA (Service Level Agreement) for the overall process.
|
|
69
|
+
* Specifies the maximum duration for the process to complete,
|
|
70
|
+
* measured in business calendar time.
|
|
71
|
+
*/
|
|
72
|
+
readonly sla?: SlaConfig;
|
|
73
|
+
/**
|
|
74
|
+
* Optional deploy-time recurring start metadata.
|
|
75
|
+
* Only supported for processes with exactly one system start step.
|
|
76
|
+
*/
|
|
77
|
+
readonly cron?: ProcessCron;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Condition function type for flow edges.
|
|
81
|
+
* The optional second parameter provides access to completed step metadata.
|
|
82
|
+
*
|
|
83
|
+
* @typeParam TState - Accumulated state type from completed steps
|
|
84
|
+
* @typeParam TSteps - Record of completed step metadata (optional)
|
|
85
|
+
*/
|
|
86
|
+
export type Condition<TState, TSteps extends Record<string, StepMeta> = Record<string, never>> = (state: TState, ctx?: FlowContext<TSteps>) => boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Schedule function type for flow edges.
|
|
89
|
+
* Returns a ScheduledTime indicating when the transition should trigger.
|
|
90
|
+
*
|
|
91
|
+
* @param state - Accumulated state from completed steps
|
|
92
|
+
* @param ctx - Flow context with completed step metadata (e.g., completedAt times)
|
|
93
|
+
* @typeParam TState - Accumulated state type from completed steps
|
|
94
|
+
* @typeParam TSteps - Record of completed step metadata
|
|
95
|
+
*/
|
|
96
|
+
export type ScheduleFn<TState, TSteps extends Record<string, StepMeta> = Record<string, never>> = (state: TState, ctx: FlowContext<TSteps>) => ScheduledTime;
|
|
97
|
+
export interface EdgeAttributes<TState> {
|
|
98
|
+
condition?: Condition<TState> | undefined;
|
|
99
|
+
conditionText?: string | undefined;
|
|
100
|
+
schedule?: ScheduleFn<TState, any> | undefined;
|
|
101
|
+
scheduleText?: string | undefined;
|
|
102
|
+
isEndStep?: boolean;
|
|
103
|
+
isElse?: boolean;
|
|
104
|
+
isOnError?: boolean;
|
|
105
|
+
taggedErrors?: readonly string[];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Concrete graph node type for serialization/deserialization.
|
|
109
|
+
* Represents a Step with generic state and input types.
|
|
110
|
+
*/
|
|
111
|
+
export type GraphNode = Step<Record<string, unknown>, Schema.Struct.Fields | undefined>;
|
|
112
|
+
/**
|
|
113
|
+
* Concrete graph edge type for serialization/deserialization.
|
|
114
|
+
* Represents an edge with unknown state type.
|
|
115
|
+
*/
|
|
116
|
+
export type GraphEdge = EdgeAttributes<unknown>;
|
|
117
|
+
/**
|
|
118
|
+
* Base interface for anything that can provide access to a Process.
|
|
119
|
+
* Both Process and Step implement this interface.
|
|
120
|
+
*/
|
|
121
|
+
export interface IProcessHolder {
|
|
122
|
+
readonly process: Process;
|
|
123
|
+
}
|
|
124
|
+
export type InferSchemaType<T extends Schema.Struct.Fields | undefined> = T extends Schema.Struct.Fields ? Schema.Schema.Type<ReturnType<typeof Schema.Struct<T>>> : object;
|
|
125
|
+
export type InferFormSchemaType<T extends Schema.Struct.Fields | undefined> = T extends Schema.Struct.Fields ? FlattenFields<T> extends infer F extends Schema.Struct.Fields ? Schema.Schema.Type<ReturnType<typeof Schema.Struct<F>>> : object : object;
|
|
126
|
+
export type ResolveStepOutput<TOutput extends Schema.Struct.Fields | undefined, TIsForm extends boolean> = TIsForm extends true ? InferFormSchemaType<TOutput> : InferSchemaType<TOutput>;
|
|
127
|
+
export declare class Process extends Construct implements IProcessHolder {
|
|
128
|
+
static readonly START_NODE = "__start__";
|
|
129
|
+
static readonly END_NODE = "__end__";
|
|
130
|
+
readonly isProcess: true;
|
|
131
|
+
/**
|
|
132
|
+
* Returns true if the node ID is a virtual node (__start__ or __end__).
|
|
133
|
+
*/
|
|
134
|
+
static isVirtualNode(nodeId: string): boolean;
|
|
135
|
+
private readonly graph;
|
|
136
|
+
/**
|
|
137
|
+
* Reference to this Process instance, allowing Process to be used
|
|
138
|
+
* as a scope when creating Steps.
|
|
139
|
+
*/
|
|
140
|
+
readonly process: Process;
|
|
141
|
+
readonly props: ProcessProps;
|
|
142
|
+
readonly orgUnit: OrgUnit;
|
|
143
|
+
constructor(scope: OrgUnit, id: string, props: ProcessProps);
|
|
144
|
+
/**
|
|
145
|
+
* Returns the GraphQL mutation name for starting this process.
|
|
146
|
+
* Example: "engineering/bug-report-fix" -> "startEngineeringBugReportFix"
|
|
147
|
+
*/
|
|
148
|
+
startMutationName(): string;
|
|
149
|
+
start<TInitialState, TOutput extends Schema.Struct.Fields | undefined, TId extends string, TIsForm extends boolean = false>(initialStep: Step<TInitialState, TOutput, TId, TIsForm, boolean>): FlowPath<ResolveStepOutput<TOutput, TIsForm>, TOutput, TIsForm extends true ? {
|
|
150
|
+
[K in CamelCase<TId>]: FormStepMeta;
|
|
151
|
+
} : {
|
|
152
|
+
[K in CamelCase<TId>]: StepMeta;
|
|
153
|
+
}>;
|
|
154
|
+
addEndEdge<TState = Record<string, never>, TOutput extends Schema.Struct.Fields | undefined = undefined, TIsForm extends boolean = boolean>(step: Step<TState, TOutput, string, TIsForm, boolean>): void;
|
|
155
|
+
/**
|
|
156
|
+
* Adds an else edge to the __end__ node.
|
|
157
|
+
* This is followed ONLY if NO conditional edges from the step match.
|
|
158
|
+
*/
|
|
159
|
+
addElseEndEdge<TState = Record<string, never>, TOutput extends Schema.Struct.Fields | undefined = undefined, TIsForm extends boolean = boolean>(step: Step<TState, TOutput, string, TIsForm, boolean>): void;
|
|
160
|
+
/**
|
|
161
|
+
* Validates process flows and returns problematic step paths.
|
|
162
|
+
* Checks for:
|
|
163
|
+
* - Dangling steps: no outgoing edges (missing .end())
|
|
164
|
+
* - Unreachable steps: not reachable from start
|
|
165
|
+
* - Missing else branches: steps with conditional edges but no else branch
|
|
166
|
+
* - Multiple else branches: steps with more than one else edge
|
|
167
|
+
* - Orphan else branches: steps with else edge but no conditional edges
|
|
168
|
+
*
|
|
169
|
+
* @returns Object with separate arrays for unreachable, dangling, missingElse, multipleElse, and orphanElse steps
|
|
170
|
+
*/
|
|
171
|
+
validateFlows(): {
|
|
172
|
+
unreachable: string[];
|
|
173
|
+
dangling: string[];
|
|
174
|
+
missingElse: string[];
|
|
175
|
+
multipleElse: string[];
|
|
176
|
+
orphanElse: string[];
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Returns steps connected from __start__ (hides graph implementation).
|
|
180
|
+
* @returns Array of start steps for this process
|
|
181
|
+
*/
|
|
182
|
+
startNodes(): Step<Record<string, unknown>, Schema.Struct.Fields | undefined, string, boolean, boolean>[];
|
|
183
|
+
getGraph(): DirectedGraph;
|
|
184
|
+
/**
|
|
185
|
+
* Returns all real (non-virtual) node IDs in the process graph.
|
|
186
|
+
* Filters out __start__ and __end__ nodes.
|
|
187
|
+
*/
|
|
188
|
+
realNodes(): string[];
|
|
189
|
+
addNode<TState = Record<string, never>, TOutput extends Schema.Struct.Fields | undefined = undefined, TIsForm extends boolean = boolean>(step: Step<TState, TOutput, string, TIsForm, boolean>): void;
|
|
190
|
+
addEdge<TSourceState = Record<string, never>, TSourceOutput extends Schema.Struct.Fields | undefined = undefined, TSourceIsForm extends boolean = boolean, TDestState = Record<string, never>, TDestOutput extends Schema.Struct.Fields | undefined = undefined, TDestIsForm extends boolean = boolean>(source: Step<TSourceState, TSourceOutput, string, TSourceIsForm, boolean>, dest: Step<TDestState, TDestOutput, string, TDestIsForm, boolean>, attributes?: EdgeAttributes<TSourceState>): void;
|
|
191
|
+
/** Get all Form steps in this process. */
|
|
192
|
+
forms(): Array<{
|
|
193
|
+
form: Form<Record<string, unknown>, Record<string, StepMeta>, Schema.Struct.Fields>;
|
|
194
|
+
path: string;
|
|
195
|
+
}>;
|
|
196
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Construct, type IConstruct } from "constructs";
|
|
2
|
+
import type { Organisation } from "./organisation.js";
|
|
3
|
+
export declare const PUBLIC_FORM_BRANDING_PUBLIC_PATH_PREFIX = "/_pf/public-form-branding/";
|
|
4
|
+
export interface PublicFormBrandingProps {
|
|
5
|
+
readonly headerHtml?: string | undefined;
|
|
6
|
+
readonly footerHtml?: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface OrganisationFrontendManifestPublicFormBranding {
|
|
9
|
+
readonly headerHtml?: string | undefined;
|
|
10
|
+
readonly footerHtml?: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface OrganisationFrontendManifestPublicFormBrandingFile {
|
|
13
|
+
readonly sourcePath: string;
|
|
14
|
+
readonly publicPath: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class PublicFormBranding extends Construct {
|
|
17
|
+
readonly isPublicFormBranding: true;
|
|
18
|
+
readonly headerHtml: string | undefined;
|
|
19
|
+
readonly footerHtml: string | undefined;
|
|
20
|
+
constructor(scope: IConstruct, id: string, props: PublicFormBrandingProps);
|
|
21
|
+
}
|
|
22
|
+
export declare const buildOrganisationFrontendManifestPublicFormBranding: (org: Organisation, options?: {
|
|
23
|
+
readonly basePath?: string | undefined;
|
|
24
|
+
}) => OrganisationFrontendManifestPublicFormBranding | null;
|
|
25
|
+
export declare const buildOrganisationFrontendManifestPublicFormBrandingFiles: (org: Organisation, options?: {
|
|
26
|
+
readonly basePath?: string | undefined;
|
|
27
|
+
}) => ReadonlyArray<OrganisationFrontendManifestPublicFormBrandingFile>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import type { OrgUnit } from "./org-unit.js";
|
|
3
|
+
export interface RoleProps {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Represents a role within an organizational unit.
|
|
8
|
+
*
|
|
9
|
+
* Roles are scoped to specific organizational units and define
|
|
10
|
+
* who (human or system) can execute steps in a process.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const finance = new OrgUnit(org, "finance", {
|
|
15
|
+
* name: "Finance Department",
|
|
16
|
+
* type: "department"
|
|
17
|
+
* })
|
|
18
|
+
*
|
|
19
|
+
* const accountant = new Role(finance, "accountant", {
|
|
20
|
+
* name: "Accountant"
|
|
21
|
+
* })
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class Role extends Construct {
|
|
25
|
+
readonly isRole: true;
|
|
26
|
+
readonly name: string;
|
|
27
|
+
readonly orgUnit: OrgUnit;
|
|
28
|
+
constructor(scope: OrgUnit, id: string, props?: RoleProps);
|
|
29
|
+
}
|