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,447 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import type { Schema } from "effect";
|
|
3
|
+
import { type Effect, Effect as EffectModule } from "effect";
|
|
4
|
+
import type { JsonSchema7Root } from "effect/JSONSchema";
|
|
5
|
+
import { type ClientFormDefinition, type WalkError } from "../../../form-client-representation/src/index.js";
|
|
6
|
+
import { type MetricBreakdownControl } from "../../../form-schema/src/index.js";
|
|
7
|
+
import { type DeepWritable, type FlattenFields, submissionSchemaSync as makeSubmissionSchema } from "../../../form-submission-schema/src/index.js";
|
|
8
|
+
import type { OrgUnit } from "./org-unit.js";
|
|
9
|
+
import type { Role } from "./role.js";
|
|
10
|
+
declare const ListItemQueryNotDefinedError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
11
|
+
readonly _tag: "ListItemQueryNotDefinedError";
|
|
12
|
+
} & Readonly<A>;
|
|
13
|
+
/**
|
|
14
|
+
* Error thrown when executeItemQuery is called on a List without an itemQuery defined.
|
|
15
|
+
*/
|
|
16
|
+
export declare class ListItemQueryNotDefinedError extends ListItemQueryNotDefinedError_base<{
|
|
17
|
+
readonly listPath: string;
|
|
18
|
+
}> {
|
|
19
|
+
get message(): string;
|
|
20
|
+
}
|
|
21
|
+
declare const ListItemUpdateNotDefinedError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
22
|
+
readonly _tag: "ListItemUpdateNotDefinedError";
|
|
23
|
+
} & Readonly<A>;
|
|
24
|
+
/**
|
|
25
|
+
* Error thrown when executeUpdate is called on a List without an update function defined.
|
|
26
|
+
*/
|
|
27
|
+
export declare class ListItemUpdateNotDefinedError extends ListItemUpdateNotDefinedError_base<{
|
|
28
|
+
readonly listPath: string;
|
|
29
|
+
}> {
|
|
30
|
+
get message(): string;
|
|
31
|
+
}
|
|
32
|
+
declare const ListItemDeleteNotDefinedError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
33
|
+
readonly _tag: "ListItemDeleteNotDefinedError";
|
|
34
|
+
} & Readonly<A>;
|
|
35
|
+
/**
|
|
36
|
+
* Error thrown when executeDelete is called on a List without a delete function defined.
|
|
37
|
+
*/
|
|
38
|
+
export declare class ListItemDeleteNotDefinedError extends ListItemDeleteNotDefinedError_base<{
|
|
39
|
+
readonly listPath: string;
|
|
40
|
+
}> {
|
|
41
|
+
get message(): string;
|
|
42
|
+
}
|
|
43
|
+
declare const ListCreateError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
44
|
+
readonly _tag: "ListCreateError";
|
|
45
|
+
} & Readonly<A>;
|
|
46
|
+
/**
|
|
47
|
+
* Client-safe creation failure. Use an empty field for a form-level persistence error.
|
|
48
|
+
*/
|
|
49
|
+
export declare class ListCreateError extends ListCreateError_base<{
|
|
50
|
+
readonly field: string;
|
|
51
|
+
readonly message: string;
|
|
52
|
+
}> {
|
|
53
|
+
}
|
|
54
|
+
declare const ListCreateNotDefinedError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
55
|
+
readonly _tag: "ListCreateNotDefinedError";
|
|
56
|
+
} & Readonly<A>;
|
|
57
|
+
export declare class ListCreateNotDefinedError extends ListCreateNotDefinedError_base<{
|
|
58
|
+
readonly listPath: string;
|
|
59
|
+
}> {
|
|
60
|
+
}
|
|
61
|
+
declare const ListUpdateValidationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
62
|
+
readonly _tag: "ListUpdateValidationError";
|
|
63
|
+
} & Readonly<A>;
|
|
64
|
+
/** Client-safe field validation error returned by a List update callback. */
|
|
65
|
+
export declare class ListUpdateValidationError extends ListUpdateValidationError_base<{
|
|
66
|
+
readonly field: string;
|
|
67
|
+
readonly message: string;
|
|
68
|
+
}> {
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Column metadata for list output fields.
|
|
72
|
+
*/
|
|
73
|
+
export declare const ListVisibleInList: unique symbol;
|
|
74
|
+
/**
|
|
75
|
+
* Optional sortability override for list output fields. This can opt hidden
|
|
76
|
+
* fields into API-level sorting, for example internal timestamps that should
|
|
77
|
+
* order rows without being displayed as columns.
|
|
78
|
+
*/
|
|
79
|
+
export declare const ListSortable: unique symbol;
|
|
80
|
+
export interface ListColumn {
|
|
81
|
+
/** Field name (used in GraphQL query) */
|
|
82
|
+
readonly field: string;
|
|
83
|
+
/** Display label (from title annotation or capitalized field name) */
|
|
84
|
+
readonly label: string;
|
|
85
|
+
/** Optional field description from schema annotations */
|
|
86
|
+
readonly description?: string;
|
|
87
|
+
/** Whether this field should be shown in the generic list table */
|
|
88
|
+
readonly visibleInList: boolean;
|
|
89
|
+
/** Whether this field can be used as a standard list sort key */
|
|
90
|
+
readonly sortable: boolean;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Result type for list queries with pagination info.
|
|
94
|
+
*/
|
|
95
|
+
export interface ListQueryResult<TItem> {
|
|
96
|
+
/** Array of items for current page */
|
|
97
|
+
readonly items: readonly TItem[];
|
|
98
|
+
/** Total number of items matching the query (for pagination) */
|
|
99
|
+
readonly totalCount: number;
|
|
100
|
+
}
|
|
101
|
+
export type ListSortDirection = "ASC" | "DESC";
|
|
102
|
+
export interface ListSortInput {
|
|
103
|
+
/** Output field to sort by */
|
|
104
|
+
readonly field: string;
|
|
105
|
+
/** Explicit sort direction */
|
|
106
|
+
readonly direction: ListSortDirection;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Context passed to the list query function.
|
|
110
|
+
*/
|
|
111
|
+
export interface ListQueryContext {
|
|
112
|
+
/** Current page number (1-indexed) */
|
|
113
|
+
readonly page: number;
|
|
114
|
+
/** Number of items per page */
|
|
115
|
+
readonly limit: number;
|
|
116
|
+
/** Optional filter text to search across all columns */
|
|
117
|
+
readonly filter?: string;
|
|
118
|
+
/** Optional standard sort request validated by the GraphQL resolver */
|
|
119
|
+
readonly sort?: ListSortInput;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Context passed to the list item query function.
|
|
123
|
+
*/
|
|
124
|
+
export interface ListItemQueryContext {
|
|
125
|
+
/** Selected generic control values, keyed by declared control name. */
|
|
126
|
+
readonly controls?: Readonly<Record<string, string>>;
|
|
127
|
+
}
|
|
128
|
+
type ListExportOutputFields<TOutput extends Schema.Struct.Fields, TExportOutput extends Schema.Struct.Fields | undefined> = TExportOutput extends Schema.Struct.Fields ? TExportOutput : TOutput;
|
|
129
|
+
/**
|
|
130
|
+
* Type to extract output item type from output schema fields.
|
|
131
|
+
*/
|
|
132
|
+
export type OutputItem<TOutput extends Schema.Struct.Fields> = Schema.Schema.Type<Schema.Struct<TOutput>>;
|
|
133
|
+
/**
|
|
134
|
+
* Function type for list queries.
|
|
135
|
+
* TItem is the output type inferred from the output schema.
|
|
136
|
+
*/
|
|
137
|
+
export type ListQueryFunction<TOutput extends Schema.Struct.Fields, R = never> = (ctx: ListQueryContext) => Effect.Effect<ListQueryResult<OutputItem<TOutput>>, never, R>;
|
|
138
|
+
/**
|
|
139
|
+
* Function type for fetching a single list item by ID.
|
|
140
|
+
* Returns the item or null if not found.
|
|
141
|
+
*/
|
|
142
|
+
export type ListItemQueryFunction<TForm extends Schema.Struct.Fields, R = never> = (id: string, ctx?: ListItemQueryContext) => Effect.Effect<OutputItem<TForm> | null, never, R>;
|
|
143
|
+
/**
|
|
144
|
+
* Type for the update input, flattening wrapper fields and excluding
|
|
145
|
+
* structural/read-only elements.
|
|
146
|
+
*/
|
|
147
|
+
type ListUpdateInput<TForm extends Schema.Struct.Fields> = FlattenFields<TForm> extends infer F extends Schema.Struct.Fields ? {
|
|
148
|
+
[K in keyof F]: Schema.Schema.Type<F[K]>;
|
|
149
|
+
} : never;
|
|
150
|
+
/** Decoded create input, preserving optional keys and excluding read-only fields. */
|
|
151
|
+
export type ListCreateInput<TForm extends Schema.Struct.Fields> = Schema.Schema.Type<ReturnType<typeof makeSubmissionSchema<TForm>>>;
|
|
152
|
+
/**
|
|
153
|
+
* Function type for updating a single list item by ID.
|
|
154
|
+
* Returns the updated item or null if not found.
|
|
155
|
+
* May fail with ListUpdateValidationError for server-side validation.
|
|
156
|
+
*/
|
|
157
|
+
export type ListUpdateFunction<TForm extends Schema.Struct.Fields, R = never> = (id: string, input: ListUpdateInput<TForm>) => Effect.Effect<OutputItem<TForm> | null, ListUpdateValidationError, R>;
|
|
158
|
+
/**
|
|
159
|
+
* Function type for deleting a single list item by ID.
|
|
160
|
+
* Returns void on success. Errors are handled via the Effect error channel.
|
|
161
|
+
*/
|
|
162
|
+
export type ListDeleteFunction<R = never> = (id: string) => Effect.Effect<void, never, R>;
|
|
163
|
+
/**
|
|
164
|
+
* Props for creating a List construct.
|
|
165
|
+
*/
|
|
166
|
+
export interface ListProps<TOutput extends Schema.Struct.Fields, R = never, TForm extends Schema.Struct.Fields = Schema.Struct.Fields, TExportOutput extends Schema.Struct.Fields | undefined = undefined, TCreate extends Schema.Struct.Fields = Schema.Struct.Fields> {
|
|
167
|
+
/** Display name for the list */
|
|
168
|
+
readonly name: string;
|
|
169
|
+
/** Optional display name for a single list item detail view */
|
|
170
|
+
readonly detailName?: string;
|
|
171
|
+
/** Optional description of what this list shows */
|
|
172
|
+
readonly purpose?: string;
|
|
173
|
+
/** Roles allowed to access this list. Must not be empty. */
|
|
174
|
+
readonly roles: readonly [Role, ...Role[]];
|
|
175
|
+
/** Output schema defining the shape of list items `query` should return */
|
|
176
|
+
readonly output: TOutput;
|
|
177
|
+
/** Default page size (default: 20, max: 100) */
|
|
178
|
+
readonly defaultPageSize?: number;
|
|
179
|
+
/** Query function returning paginated results */
|
|
180
|
+
readonly query: ListQueryFunction<TOutput, R>;
|
|
181
|
+
/** Optional export schema overriding the normal list output for CSV exports */
|
|
182
|
+
readonly exportOutput?: TExportOutput;
|
|
183
|
+
/** Optional export query overriding the normal list query for CSV exports */
|
|
184
|
+
readonly exportQuery?: ListQueryFunction<ListExportOutputFields<TOutput, TExportOutput>, R>;
|
|
185
|
+
/** Optional form schema defining detail view fields (can differ from output) */
|
|
186
|
+
readonly form?: () => TForm;
|
|
187
|
+
/** Optional query function for fetching a single item by ID */
|
|
188
|
+
readonly itemQuery?: ListItemQueryFunction<TForm, R>;
|
|
189
|
+
/** Optional update function for updating a single item by ID */
|
|
190
|
+
readonly update?: ListUpdateFunction<TForm, R>;
|
|
191
|
+
/** Optional delete function for deleting a single item by ID */
|
|
192
|
+
readonly delete?: ListDeleteFunction<R>;
|
|
193
|
+
/** Opt-in creation, with an independent form and server-owned record ID. */
|
|
194
|
+
readonly create?: {
|
|
195
|
+
readonly form: () => TCreate;
|
|
196
|
+
readonly submit: (input: ListCreateInput<TCreate>) => Effect.Effect<string, ListCreateError, R>;
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Default page size for lists.
|
|
201
|
+
*/
|
|
202
|
+
export declare const DEFAULT_PAGE_SIZE = 20;
|
|
203
|
+
/**
|
|
204
|
+
* Maximum allowed page size for lists.
|
|
205
|
+
*/
|
|
206
|
+
export declare const MAX_PAGE_SIZE = 100;
|
|
207
|
+
/**
|
|
208
|
+
* List construct for defining paginated data queries.
|
|
209
|
+
*
|
|
210
|
+
* Lists are organizational-level data views that can be accessed
|
|
211
|
+
* based on role authorization. They define:
|
|
212
|
+
* - Output schema for type-safe item structure
|
|
213
|
+
* - Optional filter definitions
|
|
214
|
+
* - A query function that returns paginated results
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```typescript
|
|
218
|
+
* const employeesList = new List(schoolUnit, "employees", {
|
|
219
|
+
* name: "Example Employees",
|
|
220
|
+
* purpose: "View all school employees",
|
|
221
|
+
* roles: [adminRole],
|
|
222
|
+
* output: {
|
|
223
|
+
* id: ES.String,
|
|
224
|
+
* name: ES.String,
|
|
225
|
+
* staffNumber: ES.String,
|
|
226
|
+
* hireDate: DateTimeUtcSchema,
|
|
227
|
+
* },
|
|
228
|
+
* query: (ctx) => Effect.gen(function* () {
|
|
229
|
+
* const ops = yield* SchoolOperations
|
|
230
|
+
* return yield* ops.queryEmployees(ctx)
|
|
231
|
+
* }),
|
|
232
|
+
* })
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
export declare class List<TOutput extends Schema.Struct.Fields = Schema.Struct.Fields, R = never, TId extends string = string, TForm extends Schema.Struct.Fields = Schema.Struct.Fields, TExportOutput extends Schema.Struct.Fields | undefined = undefined, TCreate extends Schema.Struct.Fields = Schema.Struct.Fields> extends Construct {
|
|
236
|
+
readonly isList = true;
|
|
237
|
+
private readonly _create?;
|
|
238
|
+
readonly createFormFields: TCreate | undefined;
|
|
239
|
+
/** Display name for the list */
|
|
240
|
+
readonly name: string;
|
|
241
|
+
/** Optional display name for a single list item detail view */
|
|
242
|
+
readonly detailName?: string;
|
|
243
|
+
/** Optional description of what this list shows */
|
|
244
|
+
readonly purpose?: string;
|
|
245
|
+
/** Roles allowed to access this list */
|
|
246
|
+
readonly roles: readonly [Role, ...Role[]];
|
|
247
|
+
/** Output schema defining the shape of list items */
|
|
248
|
+
readonly output: TOutput;
|
|
249
|
+
/** Default page size */
|
|
250
|
+
readonly defaultPageSize: number;
|
|
251
|
+
/** The query function */
|
|
252
|
+
private readonly _query;
|
|
253
|
+
/** Effective export schema fields */
|
|
254
|
+
private readonly _exportOutput;
|
|
255
|
+
/** Optional export query override */
|
|
256
|
+
private readonly _exportQuery;
|
|
257
|
+
/** Form schema function (optional) */
|
|
258
|
+
private readonly _form?;
|
|
259
|
+
/** Cached form fields from calling _form() at construction */
|
|
260
|
+
private readonly _formFields?;
|
|
261
|
+
/** Item query function (optional) */
|
|
262
|
+
private readonly _itemQuery?;
|
|
263
|
+
/** Update function (optional) */
|
|
264
|
+
private readonly _update?;
|
|
265
|
+
/** Delete function (optional) */
|
|
266
|
+
private readonly _delete?;
|
|
267
|
+
/**
|
|
268
|
+
* Create a List construct.
|
|
269
|
+
*
|
|
270
|
+
* @param scope - Parent OrgUnit
|
|
271
|
+
* @param id - Unique identifier for this list within the OrgUnit
|
|
272
|
+
* @param props - List configuration
|
|
273
|
+
*/
|
|
274
|
+
constructor(scope: OrgUnit, id: TId, props: ListProps<TOutput, R, TForm, TExportOutput, TCreate>);
|
|
275
|
+
get hasCreate(): boolean;
|
|
276
|
+
createMutationName(): string;
|
|
277
|
+
createInputTypeName(): string;
|
|
278
|
+
createSubmissionSchema(): ReturnType<typeof makeSubmissionSchema<TCreate>> | null;
|
|
279
|
+
createFormMetadata(currentProviderUser?: string): EffectModule.Effect<{
|
|
280
|
+
readonly formDefinition: ClientFormDefinition;
|
|
281
|
+
readonly defaultValues: Record<string, DeepWritable<unknown>>;
|
|
282
|
+
readonly jsonSchema: JsonSchema7Root;
|
|
283
|
+
readonly createMutationName: string;
|
|
284
|
+
readonly createInputTypeName: string;
|
|
285
|
+
} | null, WalkError>;
|
|
286
|
+
executeCreate(input: ListCreateInput<TCreate>): Effect.Effect<string, ListCreateError | ListCreateNotDefinedError, R>;
|
|
287
|
+
/**
|
|
288
|
+
* Get the GraphQL query name for this list.
|
|
289
|
+
* Format: "list" + PascalCase path (e.g., "listSchoolEmployees")
|
|
290
|
+
*
|
|
291
|
+
* Uses pathToPascalCase to ensure valid GraphQL identifiers even
|
|
292
|
+
* with paths containing hyphens, numbers, or special characters.
|
|
293
|
+
*/
|
|
294
|
+
queryName(): string;
|
|
295
|
+
/**
|
|
296
|
+
* Execute the list query with the given context.
|
|
297
|
+
*
|
|
298
|
+
* @param ctx - Query context with pagination and optional filter text
|
|
299
|
+
* @returns Effect producing the query result
|
|
300
|
+
*/
|
|
301
|
+
executeQuery(ctx: ListQueryContext): Effect.Effect<ListQueryResult<OutputItem<TOutput>>, never, R>;
|
|
302
|
+
/**
|
|
303
|
+
* Get the parent OrgUnit of this list.
|
|
304
|
+
*/
|
|
305
|
+
get orgUnit(): OrgUnit;
|
|
306
|
+
/**
|
|
307
|
+
* Get the field names from the output schema.
|
|
308
|
+
* Used to build GraphQL queries with the correct subfield selection.
|
|
309
|
+
*/
|
|
310
|
+
outputFieldNames(): string[];
|
|
311
|
+
/**
|
|
312
|
+
* Get column metadata from the output schema.
|
|
313
|
+
* Extracts field names, labels, and visibility metadata from schema annotations.
|
|
314
|
+
*/
|
|
315
|
+
outputColumns(): ListColumn[];
|
|
316
|
+
/**
|
|
317
|
+
* Get the field names from the effective export schema.
|
|
318
|
+
*/
|
|
319
|
+
exportFieldNames(): string[];
|
|
320
|
+
/**
|
|
321
|
+
* Get column metadata from the effective export schema.
|
|
322
|
+
*/
|
|
323
|
+
exportColumns(): ListColumn[];
|
|
324
|
+
/**
|
|
325
|
+
* Execute the effective export query.
|
|
326
|
+
*/
|
|
327
|
+
executeExportQuery(ctx: ListQueryContext): Effect.Effect<ListQueryResult<OutputItem<ListExportOutputFields<TOutput, TExportOutput>>>, never, R>;
|
|
328
|
+
/**
|
|
329
|
+
* Check if this list has a detail form defined.
|
|
330
|
+
*/
|
|
331
|
+
get hasForm(): boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Get the cached form fields.
|
|
334
|
+
* Returns undefined if no form is defined.
|
|
335
|
+
*/
|
|
336
|
+
get formFields(): TForm | undefined;
|
|
337
|
+
/**
|
|
338
|
+
* Get the GraphQL query name for fetching a single item's detail.
|
|
339
|
+
* Format: "listItem" + PascalCase path (e.g., "listItemSchoolEmployees")
|
|
340
|
+
*/
|
|
341
|
+
itemQueryName(): string;
|
|
342
|
+
/**
|
|
343
|
+
* Execute the item query to fetch a single item by ID.
|
|
344
|
+
* Fails with ListItemQueryNotDefinedError if no itemQuery is defined.
|
|
345
|
+
*
|
|
346
|
+
* @param id - The ID of the item to fetch
|
|
347
|
+
* @returns Effect producing the item or null
|
|
348
|
+
*/
|
|
349
|
+
executeItemQuery(id: string, ctx?: ListItemQueryContext): Effect.Effect<OutputItem<TForm> | null, ListItemQueryNotDefinedError, R>;
|
|
350
|
+
/**
|
|
351
|
+
* Get declared generic controls that can be passed to the item query.
|
|
352
|
+
*/
|
|
353
|
+
itemQueryControls(): readonly MetricBreakdownControl[];
|
|
354
|
+
/**
|
|
355
|
+
* Get the field names from the form schema.
|
|
356
|
+
* Returns empty array if no form is defined.
|
|
357
|
+
*/
|
|
358
|
+
formFieldNames(): string[];
|
|
359
|
+
/**
|
|
360
|
+
* Get column metadata from the form schema.
|
|
361
|
+
* Returns empty array if no form is defined.
|
|
362
|
+
*/
|
|
363
|
+
formColumns(): ListColumn[];
|
|
364
|
+
/**
|
|
365
|
+
* Generate the browser-safe form definition for the form fields.
|
|
366
|
+
* List forms do not currently support dynamic rules, so the canonical rule
|
|
367
|
+
* channel is always an empty array.
|
|
368
|
+
* Returns null if no form is defined.
|
|
369
|
+
*/
|
|
370
|
+
clientFormDefinition(): EffectModule.Effect<ClientFormDefinition | null, WalkError>;
|
|
371
|
+
/**
|
|
372
|
+
* Generate JSON Schema for the form's submittable fields.
|
|
373
|
+
* Strips read-only and structural-only fields; removes additionalProperties.
|
|
374
|
+
* Returns null if no form is defined.
|
|
375
|
+
*/
|
|
376
|
+
formSubmissionSchema(): Record<string, unknown> | null;
|
|
377
|
+
/**
|
|
378
|
+
* Get default values for the form fields.
|
|
379
|
+
* Returns null if no form is defined.
|
|
380
|
+
*/
|
|
381
|
+
formDefaults(): Record<string, DeepWritable<unknown>> | null;
|
|
382
|
+
/**
|
|
383
|
+
* Check if this list has an update function defined.
|
|
384
|
+
*/
|
|
385
|
+
get hasUpdate(): boolean;
|
|
386
|
+
/**
|
|
387
|
+
* Check if this list has a delete function defined.
|
|
388
|
+
*/
|
|
389
|
+
get hasDelete(): boolean;
|
|
390
|
+
/**
|
|
391
|
+
* Get the GraphQL mutation name for updating a list item.
|
|
392
|
+
* Format: "updateListItem" + PascalCase path (e.g., "updateListItemSchoolEmployees")
|
|
393
|
+
*/
|
|
394
|
+
updateMutationName(): string;
|
|
395
|
+
/**
|
|
396
|
+
* Get the GraphQL mutation name for deleting a list item.
|
|
397
|
+
* Format: "deleteListItem" + PascalCase path (e.g., "deleteListItemSchoolEmployees")
|
|
398
|
+
*/
|
|
399
|
+
deleteMutationName(): string;
|
|
400
|
+
/**
|
|
401
|
+
* Get the GraphQL input type name for list item updates.
|
|
402
|
+
* Format: "Update" + PascalCase path (e.g., "UpdateSchoolEmployees")
|
|
403
|
+
*/
|
|
404
|
+
updateInputTypeName(): string;
|
|
405
|
+
/**
|
|
406
|
+
* Execute the update function to update a single item by ID.
|
|
407
|
+
* Fails with ListItemUpdateNotDefinedError if no update function is defined,
|
|
408
|
+
* or ListUpdateValidationError if server-side validation rejects the input.
|
|
409
|
+
*
|
|
410
|
+
* @param id - The ID of the item to update
|
|
411
|
+
* @param input - The fields to update (flattened submission schema)
|
|
412
|
+
* @returns Effect producing the updated item or null
|
|
413
|
+
*/
|
|
414
|
+
executeUpdate(id: string, input: ListUpdateInput<TForm>): Effect.Effect<OutputItem<TForm> | null, ListItemUpdateNotDefinedError | ListUpdateValidationError, R>;
|
|
415
|
+
/**
|
|
416
|
+
* Execute the delete function to delete a single item by ID.
|
|
417
|
+
* Fails with ListItemDeleteNotDefinedError if no delete function is defined.
|
|
418
|
+
*
|
|
419
|
+
* @param id - The ID of the item to delete
|
|
420
|
+
* @returns Effect producing void on success
|
|
421
|
+
*/
|
|
422
|
+
executeDelete(id: string): Effect.Effect<void, ListItemDeleteNotDefinedError, R>;
|
|
423
|
+
/**
|
|
424
|
+
* Filter form field entries to only those NOT annotated FormReadOnly=true.
|
|
425
|
+
*/
|
|
426
|
+
private editableFormFieldEntries;
|
|
427
|
+
/**
|
|
428
|
+
* Get editable form fields as a record (excludes FormReadOnly fields).
|
|
429
|
+
* Useful for schema generation where the full field schemas are needed.
|
|
430
|
+
*/
|
|
431
|
+
editableFormFields(): Record<string, Schema.Schema.AnyNoContext>;
|
|
432
|
+
/**
|
|
433
|
+
* Get column metadata for editable form fields only.
|
|
434
|
+
* Returns columns for fields NOT annotated with FormReadOnly.
|
|
435
|
+
*/
|
|
436
|
+
editableFormColumns(): ListColumn[];
|
|
437
|
+
/**
|
|
438
|
+
* Get a URL-safe slug derived from the list name.
|
|
439
|
+
* Used for generating unique object keys for CSV exports.
|
|
440
|
+
*/
|
|
441
|
+
slugName(): string;
|
|
442
|
+
/**
|
|
443
|
+
* Get the list path in normalized form (with leading slash).
|
|
444
|
+
*/
|
|
445
|
+
normalizedPath(): string;
|
|
446
|
+
}
|
|
447
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Effect, Schema } from "effect";
|
|
2
|
+
import type { LookupItem } from "../../../form-schema/src/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Input for independent lookup queries — just filter.
|
|
5
|
+
*/
|
|
6
|
+
export type QueryInput = {
|
|
7
|
+
readonly filter: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Extracts the field name literal from a LookupAccessor.
|
|
11
|
+
*/
|
|
12
|
+
type ExtractFieldName<T> = T extends LookupAccessor<any, infer K> ? K : never;
|
|
13
|
+
/**
|
|
14
|
+
* Input for dependent lookup queries — filter + required dep values.
|
|
15
|
+
*/
|
|
16
|
+
export type DependentQueryInput<D extends LookupAccessor<any, any>[]> = {
|
|
17
|
+
readonly filter: string;
|
|
18
|
+
} & {
|
|
19
|
+
readonly [F in ExtractFieldName<D[number]>]: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Internal override stored by LookupAccessor/LookupBuilder.
|
|
23
|
+
*/
|
|
24
|
+
export interface LookupOverride {
|
|
25
|
+
readonly query: (input: Record<string, string>, limit: number) => Effect.Effect<ReadonlyArray<LookupItem>, unknown, unknown>;
|
|
26
|
+
readonly dependencies?: ReadonlyArray<string>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Storage interface so accessors can write back without depending on Form.
|
|
30
|
+
*/
|
|
31
|
+
export interface LookupOverrideStore {
|
|
32
|
+
_setLookupOverride(fieldName: string, override: LookupOverride): void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Typed accessor for a single lookup field on a Form.
|
|
36
|
+
*
|
|
37
|
+
* Call `.setQuery()` for independent lookups, or
|
|
38
|
+
* `.dependsOn([...]).setQuery()` for dependent lookups.
|
|
39
|
+
*/
|
|
40
|
+
export declare class LookupAccessor<TInput extends Schema.Struct.Fields, K extends string> {
|
|
41
|
+
readonly fieldName: K;
|
|
42
|
+
private _store;
|
|
43
|
+
constructor(store: LookupOverrideStore, fieldName: K);
|
|
44
|
+
/**
|
|
45
|
+
* Set the query for an independent lookup (no dependencies).
|
|
46
|
+
*/
|
|
47
|
+
setQuery(query: (input: QueryInput, limit: number) => Effect.Effect<ReadonlyArray<LookupItem>, unknown, unknown>): void;
|
|
48
|
+
/**
|
|
49
|
+
* Declare dependencies on other lookup fields, returning a builder
|
|
50
|
+
* whose `setQuery` receives the dependency values as typed input.
|
|
51
|
+
*/
|
|
52
|
+
dependsOn<const D extends LookupAccessor<TInput, Exclude<keyof TInput & string, K>>[]>(deps: [...D]): LookupBuilder<TInput, K, D>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Builder returned by `LookupAccessor.dependsOn()`.
|
|
56
|
+
* Its `setQuery` callback receives `{ filter, ...depValues }`.
|
|
57
|
+
*/
|
|
58
|
+
export declare class LookupBuilder<_TInput extends Schema.Struct.Fields, K extends string, D extends LookupAccessor<any, any>[]> {
|
|
59
|
+
private _store;
|
|
60
|
+
private _fieldName;
|
|
61
|
+
private _deps;
|
|
62
|
+
constructor(store: LookupOverrideStore, fieldName: K, deps: D);
|
|
63
|
+
/**
|
|
64
|
+
* Set the query for this dependent lookup.
|
|
65
|
+
*/
|
|
66
|
+
setQuery(query: (input: DependentQueryInput<D>, limit: number) => Effect.Effect<ReadonlyArray<LookupItem>, unknown, unknown>): void;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Effect, Schema } from "effect";
|
|
2
|
+
import type { FormStepMeta, StepMeta } from "./flow-context.js";
|
|
3
|
+
import type { FlowPath } from "./flow-path.js";
|
|
4
|
+
import type { InferSchemaType, Process } from "./process.js";
|
|
5
|
+
import type { IStepScope } from "./step.js";
|
|
6
|
+
import { type AuthorTaggedError, SystemStep, type SystemStepProps } from "./system-step.js";
|
|
7
|
+
/**
|
|
8
|
+
* Props for NodeStep - a concrete SystemStep that takes execute as a prop.
|
|
9
|
+
*
|
|
10
|
+
* @typeParam TState - Accumulated state from previous steps
|
|
11
|
+
* @typeParam TSteps - Record of completed step metadata for ctx.step access
|
|
12
|
+
* @typeParam TInput - Input derived from state
|
|
13
|
+
* @typeParam TOutput - Output schema fields merged into process state
|
|
14
|
+
* @typeParam TIsForEach - Whether this step uses forEach semantics
|
|
15
|
+
*/
|
|
16
|
+
export type NodeStepProps<TState = Record<string, never>, TSteps extends Record<string, StepMeta | FormStepMeta> = Record<string, never>, TInput = unknown, TOutput extends Schema.Struct.Fields = Schema.Struct.Fields, TIsForEach extends boolean = false> = SystemStepProps<TState, TSteps, TInput, TOutput, TIsForEach> & {
|
|
17
|
+
/**
|
|
18
|
+
* The execute function containing the business logic.
|
|
19
|
+
* Receives the derived input and returns the output to merge into state.
|
|
20
|
+
*
|
|
21
|
+
* The execute function may use Effect services (via yield*) and may fail
|
|
22
|
+
* with tagged domain errors. These requirements and errors are propagated
|
|
23
|
+
* when the step is executed by the SystemStepExecutor.
|
|
24
|
+
*/
|
|
25
|
+
readonly execute: (input: TInput) => Effect.Effect<InferSchemaType<TOutput>, AuthorTaggedError, unknown>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* NodeStep is a concrete implementation of SystemStep that takes execute as a prop.
|
|
29
|
+
*
|
|
30
|
+
* This is the most common way to create system steps - you provide the execute
|
|
31
|
+
* function directly as a prop rather than subclassing SystemStep.
|
|
32
|
+
*
|
|
33
|
+
* @typeParam TState - Accumulated state from previous steps
|
|
34
|
+
* @typeParam TSteps - Record of completed step metadata for ctx.step access
|
|
35
|
+
* @typeParam TInput - Input derived from state
|
|
36
|
+
* @typeParam TOutput - Output schema fields merged into process state
|
|
37
|
+
* @typeParam TId - Step identifier literal type
|
|
38
|
+
* @typeParam TIsForEach - Whether this step uses forEach semantics
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const greet = new NodeStep(register, "Greet", {
|
|
43
|
+
* input: (state) => Effect.succeed({ name: state.name }),
|
|
44
|
+
* output: {},
|
|
45
|
+
* execute: (input) => Effect.gen(function* () {
|
|
46
|
+
* console.log(`Hello ${input.name}`)
|
|
47
|
+
* }),
|
|
48
|
+
* })
|
|
49
|
+
*
|
|
50
|
+
* this.start(register).next(greet).end()
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare class NodeStep<TState = Record<string, never>, TSteps extends Record<string, StepMeta | FormStepMeta> = Record<string, never>, TInput = unknown, TOutput extends Schema.Struct.Fields = Schema.Struct.Fields, TId extends string = string, TIsForEach extends boolean = false> extends SystemStep<TState, TSteps, TInput, TOutput, TId, TIsForEach> {
|
|
54
|
+
/**
|
|
55
|
+
* The execute function provided as a prop.
|
|
56
|
+
*/
|
|
57
|
+
private _executeFn;
|
|
58
|
+
constructor(scope: Process | IStepScope<TState, TSteps> | FlowPath<TState, Schema.Struct.Fields | undefined, TSteps>, id: TId, props: NodeStepProps<TState, TSteps, TInput, TOutput, any>);
|
|
59
|
+
/**
|
|
60
|
+
* Execute the step logic with the derived input.
|
|
61
|
+
* Delegates to the execute prop.
|
|
62
|
+
*
|
|
63
|
+
* The returned Effect may have requirements (services) and tagged domain
|
|
64
|
+
* errors that are propagated when the step is executed by the
|
|
65
|
+
* SystemStepExecutor.
|
|
66
|
+
*/
|
|
67
|
+
execute(input: TInput): Effect.Effect<InferSchemaType<TOutput>, AuthorTaggedError, unknown>;
|
|
68
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
/**
|
|
3
|
+
* Type of organizational unit.
|
|
4
|
+
*
|
|
5
|
+
* - organisation: The root organizational unit (only for Organisation class)
|
|
6
|
+
* - board: Top-level governing body
|
|
7
|
+
* - division: Large organizational division
|
|
8
|
+
* - department: Standard department
|
|
9
|
+
* - team: Small team within a department
|
|
10
|
+
* - unit: Generic organizational unit
|
|
11
|
+
* - other: Other types of organizational entities
|
|
12
|
+
*/
|
|
13
|
+
export type OrgUnitType = "organisation" | "board" | "division" | "department" | "team" | "unit" | "other";
|
|
14
|
+
export interface OrgUnitProps {
|
|
15
|
+
/**
|
|
16
|
+
* Full name of organisation or department.
|
|
17
|
+
*/
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly type?: OrgUnitType;
|
|
20
|
+
/** Optional shortened form of the name (e.g., "IT" for "Information Technology") */
|
|
21
|
+
readonly acronym?: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Represents an organizational unit within the hierarchy.
|
|
25
|
+
*
|
|
26
|
+
* Organizational units form a strict tree hierarchy where each unit
|
|
27
|
+
* has exactly one parent (except the root Organisation). They provide
|
|
28
|
+
* scoping for processes and roles.
|
|
29
|
+
*
|
|
30
|
+
* Note: The type "organisation" is reserved for the root Organisation
|
|
31
|
+
* class and cannot be used when creating regular OrgUnit instances.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const org = new Organisation({ name: "Acme Corp" })
|
|
36
|
+
* const board = new OrgUnit(org, "board", {
|
|
37
|
+
* name: "Board of Directors",
|
|
38
|
+
* type: "board"
|
|
39
|
+
* })
|
|
40
|
+
*
|
|
41
|
+
* const finance = new OrgUnit(board, "finance", {
|
|
42
|
+
* name: "Finance Department",
|
|
43
|
+
* type: "department"
|
|
44
|
+
* })
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare class OrgUnit extends Construct {
|
|
48
|
+
readonly isOrgUnit: true;
|
|
49
|
+
readonly name: string;
|
|
50
|
+
readonly type?: OrgUnitType;
|
|
51
|
+
readonly acronym?: string | undefined;
|
|
52
|
+
constructor(scope: OrgUnit, id: string, props: OrgUnitProps);
|
|
53
|
+
}
|