@outbuild-company/schedule-core 1.10.4 → 1.12.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/README.md +91 -162
- package/dist/cdn/schedule-core.global.js +1 -1
- package/dist/cdn/schedule-core.global.js.map +1 -1
- package/dist/index.cjs +1692 -795
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1556 -191
- package/dist/index.d.ts +1556 -191
- package/dist/index.js +1669 -796
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -1,61 +1,32 @@
|
|
|
1
|
-
<div
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
<div class="ob-hero">
|
|
2
|
+
<img src="docs/api/assets/outbuild-mark.svg" alt="Outbuild" class="ob-hero-mark" width="96" />
|
|
3
|
+
<div>
|
|
4
|
+
<p class="ob-eyebrow">OUTBUILD DEVELOPER PLATFORM</p>
|
|
5
|
+
<h1>Schedule Core</h1>
|
|
6
|
+
<p class="ob-hero-copy">The shared scheduling engine used by Outbuild across frontend, backend, tests and background jobs.</p>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
8
9
|
|
|
9
10
|
[](https://github.com/OutBuild-Construction-Software/schedule-core/actions/workflows/ci.yml)
|
|
10
11
|
[](https://www.npmjs.com/package/@outbuild-company/schedule-core)
|
|
12
|
+
[](https://outbuild-construction-software.github.io/schedule-core/)
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
Schedule Core centralizes Outbuild's scheduling calculations and business rules
|
|
15
|
+
so every consumer produces the same result. It owns canonical schedule state;
|
|
16
|
+
rendering, HTTP requests and database writes remain outside the library.
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
## What it handles
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
## Mental model
|
|
21
|
-
|
|
22
|
-
```mermaid
|
|
23
|
-
flowchart LR
|
|
24
|
-
Payload["Backend payload"] --> Normalize["Parse + normalize"]
|
|
25
|
-
Normalize --> Core
|
|
26
|
-
Command["DispatchAction"] --> Core
|
|
27
|
-
|
|
28
|
-
subgraph Engine["Schedule Core"]
|
|
29
|
-
Core["Canonical state"] --> Pipeline["Validate · mutate · derive"]
|
|
30
|
-
Pipeline --> Core
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
Pipeline --> Changes["ChangeSet"]
|
|
34
|
-
Core --> Reads["Read-only snapshots"]
|
|
35
|
-
Changes --> Consumers["UI · persistence · analytics"]
|
|
36
|
-
Reads --> Consumers
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
| Part | Contract |
|
|
20
|
+
| Capability | What the engine owns |
|
|
40
21
|
| --- | --- |
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
| Concept | Role in the engine |
|
|
50
|
-
| --- | --- |
|
|
51
|
-
| **Activities** | Tasks, milestones, and summary projects in a hierarchical schedule. |
|
|
52
|
-
| **Links** | Typed dependencies with working-time lag and effective-graph cycle guards. |
|
|
53
|
-
| **Calendars** | Working days, shifts, exceptions, and date/duration calculations. |
|
|
54
|
-
| **Constraints** | ASAP, ALAP, start-based, finish-based, and fixed-date scheduling rules. |
|
|
55
|
-
| **Autoscheduler** | Applies dependency, constraint, calendar, and parent-bound rules after relevant mutations. |
|
|
56
|
-
| **Critical path** | Computes early/late dates, slack, and critical flags through an asynchronous job. |
|
|
57
|
-
| **ChangeSet** | Entity diffs plus view state, ordering, tracking events, effects, and constraint warnings. |
|
|
58
|
-
| **History** | Undo/redo state and persistence checkpoints owned by the core instance. |
|
|
22
|
+
| Automatic scheduling | Dependency, constraint and hierarchy propagation. |
|
|
23
|
+
| Critical Path | Early and late dates, slack and critical activities. |
|
|
24
|
+
| Working calendars | Calendar-aware dates, durations and working-time lag. |
|
|
25
|
+
| Activities and dependencies | Validated creation, edits, hierarchy and links. |
|
|
26
|
+
| Baselines and filtering | Shared derived state for every consumer. |
|
|
27
|
+
| Undo and redo | Reversible commands with recalculated dependent state. |
|
|
28
|
+
| Fork and projection | Isolated scenarios without changing official state. |
|
|
29
|
+
| UTC-safe calculations | Scheduling behavior independent from local time zones. |
|
|
59
30
|
|
|
60
31
|
## Use it in 30 seconds
|
|
61
32
|
|
|
@@ -65,125 +36,94 @@ npm install @outbuild-company/schedule-core
|
|
|
65
36
|
|
|
66
37
|
```ts
|
|
67
38
|
import {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
39
|
+
ACTIVITY_TYPE,
|
|
40
|
+
ROOT_PARENT_ID,
|
|
41
|
+
createSchedule
|
|
71
42
|
} from '@outbuild-company/schedule-core';
|
|
72
43
|
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
44
|
+
const backend = await fetch('/api/schedules/42').then((response) =>
|
|
45
|
+
response.json()
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const schedule = await createSchedule({
|
|
49
|
+
sector: backend.sector,
|
|
50
|
+
activities: backend.activities ?? [],
|
|
51
|
+
links: backend.links ?? [],
|
|
52
|
+
calendars: backend.calendars ?? [],
|
|
53
|
+
baseCalendars: backend.baseCalendars ?? []
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
const result = await schedule.activities.create({
|
|
58
|
+
activityId: 'A1',
|
|
59
|
+
parentId: ROOT_PARENT_ID,
|
|
60
|
+
overrides: {
|
|
61
|
+
name: 'Excavation',
|
|
62
|
+
type: ACTIVITY_TYPE.TASK,
|
|
63
|
+
durationDays: 3
|
|
64
|
+
}
|
|
84
65
|
});
|
|
85
66
|
|
|
86
|
-
|
|
87
|
-
|
|
67
|
+
console.log(result.ok);
|
|
68
|
+
console.log(schedule.activities.get('A1')?.name);
|
|
69
|
+
} finally {
|
|
70
|
+
schedule.destroy();
|
|
88
71
|
}
|
|
89
|
-
|
|
90
|
-
core.destroy();
|
|
91
72
|
```
|
|
92
73
|
|
|
93
|
-
|
|
74
|
+
Output:
|
|
94
75
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
```ts
|
|
100
|
-
interface ChangeSet {
|
|
101
|
-
source: ChangeSetSource;
|
|
102
|
-
activities: ReadonlyArray<EntityChange<CoreActivity>>;
|
|
103
|
-
links: ReadonlyArray<EntityChange<Link>>;
|
|
104
|
-
calendars: ReadonlyArray<EntityChange<Calendar>>;
|
|
105
|
-
trackingEvents: ReadonlyArray<TrackingEvent>;
|
|
106
|
-
viewState?: ReadonlyArray<ViewStateChange>;
|
|
107
|
-
order?: ReadonlyArray<BranchOrderChange>;
|
|
108
|
-
effects?: ReadonlyArray<ScheduleEffect>;
|
|
109
|
-
warnings?: ReadonlyArray<ConstraintWarning>;
|
|
110
|
-
}
|
|
76
|
+
```text
|
|
77
|
+
true
|
|
78
|
+
Excavation
|
|
111
79
|
```
|
|
112
80
|
|
|
113
|
-
|
|
81
|
+
The library accepts backend-shaped schedule data, normalizes it internally and
|
|
82
|
+
returns a ready instance. A successful mutation updates core state and returns
|
|
83
|
+
the complete `ChangeSet`; a rejected mutation leaves state untouched.
|
|
114
84
|
|
|
115
|
-
##
|
|
85
|
+
## One engine, two public entry points
|
|
116
86
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
-
|
|
122
|
-
- **Persistence is acknowledged.** Storage remains external; a successful `persistence-acknowledge` establishes the saved checkpoint and history boundary.
|
|
123
|
-
|
|
124
|
-
The complete, code-linked contract lives in [INVARIANTS.md](INVARIANTS.md).
|
|
125
|
-
|
|
126
|
-
## Architecture principles
|
|
127
|
-
|
|
128
|
-
### One mutation boundary
|
|
129
|
-
|
|
130
|
-
Domain writes enter through `dispatch()` or `applyActivityBatch()`. Handlers validate commands, update the canonical state, run the required derived passes, and assemble one result for the consumer.
|
|
131
|
-
|
|
132
|
-
### Explicit ownership
|
|
133
|
-
|
|
134
|
-
The core owns schedule entities, temporal calculations, dependency semantics, derived fields, and change tracking. Consumers own transport, persistence execution, UI projection, and presentation of rejected commands.
|
|
135
|
-
|
|
136
|
-
### Narrow internal roles
|
|
137
|
-
|
|
138
|
-
`ScheduleState` is the store, but subsystems depend on smaller capabilities such as activity readers/writers, calendar operations, the write journal, and the autoscheduler port. Architecture tests ratchet layer boundaries and public-entry reachability.
|
|
139
|
-
|
|
140
|
-
### Legacy engines behind adapters
|
|
141
|
-
|
|
142
|
-
The package has no runtime dependency on React or the DHTMLX package. Its calendar and critical-path implementations do retain adapted legacy engine code and Gantt-shaped internal contracts. The application-side bridge projects `ChangeSet` data into DHTMLX; that bridge remains outside this package.
|
|
143
|
-
|
|
144
|
-
## What Schedule Core is not
|
|
145
|
-
|
|
146
|
-
Schedule Core does not:
|
|
147
|
-
|
|
148
|
-
- render a Gantt chart or React component;
|
|
149
|
-
- own a browser application's component state;
|
|
150
|
-
- fetch schedule data or make HTTP requests;
|
|
151
|
-
- write to a database or storage service;
|
|
152
|
-
- decide how warnings, analytics, or rejected commands are presented.
|
|
87
|
+
| Consumer | Entry point |
|
|
88
|
+
| --- | --- |
|
|
89
|
+
| Backend, worker, script or test | `await createSchedule(input)` |
|
|
90
|
+
| Outbuild frontend | The active `scheduleActions` bridge |
|
|
91
|
+
| Low-level integration | `new ScheduleCore(input)` and `await schedule.ready` |
|
|
153
92
|
|
|
154
|
-
|
|
93
|
+
The bridge and programmatic API use the same engine, validations and scheduling
|
|
94
|
+
rules. The frontend bridge additionally owns the live DHTMLX projection;
|
|
95
|
+
DHTMLX is a UI layer, not the scheduling authority.
|
|
155
96
|
|
|
156
|
-
##
|
|
97
|
+
## API model
|
|
157
98
|
|
|
158
99
|
```text
|
|
159
|
-
|
|
160
|
-
├── index.ts public package contract
|
|
161
|
-
├── init/ facade, initialization, read API
|
|
162
|
-
├── dispatch/ commands, handlers, ChangeSets, undo/redo
|
|
163
|
-
├── internal/ state, hierarchy, ordering, dependency graph
|
|
164
|
-
├── autoscheduler/ ASAP/ALAP scheduling and link propagation
|
|
165
|
-
├── calendar/ working-time API and engine adapter
|
|
166
|
-
├── columns/ typed field mutation pipelines
|
|
167
|
-
├── propagations/ parent and derived-field propagation
|
|
168
|
-
├── critical-path/ critical-path facade and legacy adapter
|
|
169
|
-
├── constraints/ constraint vocabulary and date semantics
|
|
170
|
-
├── boundary/ backend normalization and save tracking
|
|
171
|
-
└── testing/ fixtures, scenarios, recordings, and parity harnesses
|
|
100
|
+
backend data → ready schedule → validated action → result + updated state
|
|
172
101
|
```
|
|
173
102
|
|
|
174
|
-
|
|
103
|
+
| Namespace | Responsibility |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| `schedule.activities` | Read and mutate activities and hierarchy. |
|
|
106
|
+
| `schedule.links` | Read and mutate dependencies. |
|
|
107
|
+
| `schedule.calendars` | Read calendars and reconcile dates. |
|
|
108
|
+
| `schedule.selection` | Own selected activity IDs. |
|
|
109
|
+
| `schedule.view` | Filter, order and visibility. |
|
|
110
|
+
| `schedule.baselines` | Apply and read baseline state. |
|
|
111
|
+
| `schedule.persistence` | Read dirty state and acknowledge saved checkpoints. |
|
|
112
|
+
| `schedule.history` | Undo and redo. |
|
|
113
|
+
| `schedule.projection` | Compare official and forked schedules. |
|
|
114
|
+
| `schedule.criticalPath` | Recompute and await Critical Path work. |
|
|
115
|
+
| `schedule.diagnostics` | Audit graphs, revisions and canonical state. |
|
|
175
116
|
|
|
176
|
-
|
|
117
|
+
## Documentation
|
|
177
118
|
|
|
178
|
-
-
|
|
179
|
-
-
|
|
119
|
+
- [Start with the visual API guide](https://outbuild-construction-software.github.io/schedule-core/documents/Schedule_Core.html)
|
|
120
|
+
- [Read the guide in this repository](docs/api/index.md)
|
|
121
|
+
- [Find every namespace and method](docs/api/reference.md)
|
|
180
122
|
|
|
181
|
-
|
|
123
|
+
Every guide uses the same format:
|
|
182
124
|
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
npm run test:unit # unit project
|
|
186
|
-
npm run test:integration # parity and session replays
|
|
125
|
+
```text
|
|
126
|
+
state before → API call → returned result → state after
|
|
187
127
|
```
|
|
188
128
|
|
|
189
129
|
## Development
|
|
@@ -197,19 +137,8 @@ npm run typecheck:boundary
|
|
|
197
137
|
npm run lint
|
|
198
138
|
npm test
|
|
199
139
|
npm run build
|
|
140
|
+
npm run docs:check
|
|
200
141
|
```
|
|
201
142
|
|
|
202
|
-
The
|
|
203
|
-
|
|
204
|
-
## Documentation
|
|
205
|
-
|
|
206
|
-
- [Public API](docs/API.md) — supported entry point, lifecycle, commands, reads, persistence, and types.
|
|
207
|
-
- [Model invariants](INVARIANTS.md) — verified units, dates, queueing, write capture, persistence, and graph rules.
|
|
208
|
-
- [Domain and architecture index](docs/domain/README.md) — canonical map of the detailed domain documentation.
|
|
209
|
-
- [State roles](docs/domain/STATE_ROLES.md) — internal capability boundaries around `ScheduleState`.
|
|
210
|
-
- [Activity ownership](docs/domain/model/SCHEDULE_CORE_OWNERSHIP.md) — current core/render authority by field category.
|
|
211
|
-
- [Temporal model](docs/domain/scheduling/temporal-model.md) — temporal vocabulary, policies, and known open decisions.
|
|
212
|
-
- [Calendars](docs/domain/dates-calendars/CALENDARS.md) — working-time model, normalization, and engine boundary.
|
|
213
|
-
- [Constraints](docs/domain/constraints/01-constraint-types-catalog.md) — supported constraint vocabulary and semantics.
|
|
214
|
-
- [Architecture audit](docs/audit/README.md) — measured implementation map, findings, and unresolved questions.
|
|
215
|
-
- [Changelog](CHANGELOG.md) — released behavior and package history.
|
|
143
|
+
The package emits ESM, CommonJS, type declarations, source maps and a browser
|
|
144
|
+
IIFE. It has no runtime dependencies.
|