@outbuild-company/schedule-core 1.0.0 → 1.0.1

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/index.d.cts CHANGED
@@ -349,8 +349,8 @@ interface BaselinePoint {
349
349
  /**
350
350
  * Pure-domain activity model produced by `parseFromBackend`. Snake_case
351
351
  * matches the backend convention. No index signature — every field is
352
- * explicit. New backend fields must be added here (or to
353
- * `ACTIVITY_PASSTHROUGH_FIELDS` in `parseFromBackend.ts` and here).
352
+ * explicit. New backend fields must be added here and preserved by
353
+ * `normalize-activity.ts`.
354
354
  *
355
355
  * Companion type for runtime mutations: see `ActivityRuntime` below,
356
356
  * which extends this with `DhtmlxHeritageFields`.
@@ -450,6 +450,7 @@ interface Activity {
450
450
  is_critical: CriticalFlag;
451
451
  hasNewActivities: boolean;
452
452
  isNewActivity: true | null;
453
+ date_origin?: Date | null;
453
454
  /**
454
455
  * Active-baseline snapshots for this activity (backend
455
456
  * `sectorbaselinepoint[]`). Passthrough — carried verbatim so the
@@ -1093,6 +1094,7 @@ interface ProjectWorkHours {
1093
1094
  * Validated against the real mocks in
1094
1095
  * `packages/schedule-core/src/testing/projects/startDate/`.
1095
1096
  */
1097
+
1096
1098
  /** Calendar shift definition — one shift per day, CSV-encoded strings. */
1097
1099
  interface BackendShift {
1098
1100
  id: number;
@@ -1130,6 +1132,7 @@ interface BackendCalendar {
1130
1132
  /** CSV of shift ends per day: `"false,16:00,...,false"`. */
1131
1133
  shift_end: string;
1132
1134
  exceptiondays: BackendCalendarException[];
1135
+ baseexceptiondays?: BackendCalendarException[];
1133
1136
  shifts: BackendShift[];
1134
1137
  status: boolean;
1135
1138
  companyId: number;
@@ -1206,25 +1209,28 @@ interface BackendActivityInput {
1206
1209
  responsables: unknown[];
1207
1210
  tags: unknown[];
1208
1211
  activitymodifications: unknown[];
1209
- /** Pending SIRs for this activity — schedule load sends `{ id }` only. */
1210
- pendingRequests: ReadonlyArray<{
1211
- id: number | string;
1212
- }>;
1212
+ pendingRequests: readonly {
1213
+ id?: unknown;
1214
+ }[];
1213
1215
  subcontract: unknown;
1216
+ date_origin?: string | null;
1217
+ baseline_points?: BaselinePoint[];
1214
1218
  createdAt: string;
1215
1219
  updatedAt: string;
1216
1220
  /** Custom fields the backend may include — passed through opaquely. */
1217
1221
  [key: string]: unknown;
1218
1222
  }
1219
- /** Link as returned by the server. */
1220
1223
  interface BackendLink {
1221
1224
  id: number | string;
1222
- source: number | string;
1223
- target: number | string;
1224
- /** DHTMLX kind: `"0"` FS, `"1"` SS, `"2"` FF, `"3"` SF. */
1225
- type: '0' | '1' | '2' | '3';
1225
+ unique_id?: string | null;
1226
+ source_id?: string;
1227
+ target_id?: string;
1228
+ source?: number | string;
1229
+ target?: number | string;
1230
+ type?: unknown;
1226
1231
  lag: number;
1227
- [key: string]: unknown;
1232
+ ganttId?: number;
1233
+ sectorId?: number;
1228
1234
  }
1229
1235
  /** Sector metadata — project-level config from the server. */
1230
1236
  interface BackendSector {
@@ -1601,29 +1607,11 @@ declare class ScheduleCore {
1601
1607
  private _rollback;
1602
1608
  }
1603
1609
 
1604
- /**
1605
- * Parse the raw backend payload into the core's normalized internal model.
1606
- *
1607
- * Pure function. No side effects, no state. Throws on structural errors
1608
- * (missing required fields, broken references) per Q4 in SCHEDULE_CORE_API.md.
1609
- *
1610
- * Public from the package — consumers can use this to pre-validate before
1611
- * instantiating ScheduleCore, or to round-trip data through tests.
1612
- */
1613
-
1614
1610
  interface ParsedInput {
1615
1611
  sector: SectorMetadata;
1616
1612
  activities: Activity[];
1617
1613
  links: Link[];
1618
1614
  calendars: Calendar[];
1619
- /**
1620
- * Baseline calendars, kept SEPARATE from the scheduling `calendars`. They
1621
- * are never used to resolve an activity's calendar — only for the baseline
1622
- * render. Parsed from the raw `baseCalendars` input (the backend's
1623
- * `showBaseCalendar`); reshaped here (id+'-base', baseDefault, exceptions
1624
- * from `baseexceptiondays`) so the core owns the differentiation instead of
1625
- * the frontend `refreshCalendarsRewrite`.
1626
- */
1627
1615
  baseCalendars: Calendar[];
1628
1616
  }
1629
1617
  declare function parseFromBackend(input: BackendInput, reporter?: ScheduleCoreReporter): ParsedInput;
@@ -1992,8 +1980,8 @@ declare const LINK_CODE_TO_TYPE: {
1992
1980
  /**
1993
1981
  * Inverse boundary maps (domain → backend vocabulary).
1994
1982
  *
1995
- * The forward translations live in `parseFromBackend.ts`
1996
- * (`CONSTRAINT_LABEL_MAP`, `LINK_CODE_TO_NUMBER`). The *serialization*
1983
+ * The forward translations live in `constants.ts` (`CONSTRAINT_LABEL_MAP`)
1984
+ * and `link-display.ts` (`LINK_CODE_TO_NUMBER`). The *serialization*
1997
1985
  * core → backend is intentionally NOT owned by this package today — it
1998
1986
  * lives in the consumer bridge (`react_client/gantt.helper.js`,
1999
1987
  * `from_number_to_code` / `GanttConstraint` reverse lookup) because the
package/dist/index.d.ts CHANGED
@@ -349,8 +349,8 @@ interface BaselinePoint {
349
349
  /**
350
350
  * Pure-domain activity model produced by `parseFromBackend`. Snake_case
351
351
  * matches the backend convention. No index signature — every field is
352
- * explicit. New backend fields must be added here (or to
353
- * `ACTIVITY_PASSTHROUGH_FIELDS` in `parseFromBackend.ts` and here).
352
+ * explicit. New backend fields must be added here and preserved by
353
+ * `normalize-activity.ts`.
354
354
  *
355
355
  * Companion type for runtime mutations: see `ActivityRuntime` below,
356
356
  * which extends this with `DhtmlxHeritageFields`.
@@ -450,6 +450,7 @@ interface Activity {
450
450
  is_critical: CriticalFlag;
451
451
  hasNewActivities: boolean;
452
452
  isNewActivity: true | null;
453
+ date_origin?: Date | null;
453
454
  /**
454
455
  * Active-baseline snapshots for this activity (backend
455
456
  * `sectorbaselinepoint[]`). Passthrough — carried verbatim so the
@@ -1093,6 +1094,7 @@ interface ProjectWorkHours {
1093
1094
  * Validated against the real mocks in
1094
1095
  * `packages/schedule-core/src/testing/projects/startDate/`.
1095
1096
  */
1097
+
1096
1098
  /** Calendar shift definition — one shift per day, CSV-encoded strings. */
1097
1099
  interface BackendShift {
1098
1100
  id: number;
@@ -1130,6 +1132,7 @@ interface BackendCalendar {
1130
1132
  /** CSV of shift ends per day: `"false,16:00,...,false"`. */
1131
1133
  shift_end: string;
1132
1134
  exceptiondays: BackendCalendarException[];
1135
+ baseexceptiondays?: BackendCalendarException[];
1133
1136
  shifts: BackendShift[];
1134
1137
  status: boolean;
1135
1138
  companyId: number;
@@ -1206,25 +1209,28 @@ interface BackendActivityInput {
1206
1209
  responsables: unknown[];
1207
1210
  tags: unknown[];
1208
1211
  activitymodifications: unknown[];
1209
- /** Pending SIRs for this activity — schedule load sends `{ id }` only. */
1210
- pendingRequests: ReadonlyArray<{
1211
- id: number | string;
1212
- }>;
1212
+ pendingRequests: readonly {
1213
+ id?: unknown;
1214
+ }[];
1213
1215
  subcontract: unknown;
1216
+ date_origin?: string | null;
1217
+ baseline_points?: BaselinePoint[];
1214
1218
  createdAt: string;
1215
1219
  updatedAt: string;
1216
1220
  /** Custom fields the backend may include — passed through opaquely. */
1217
1221
  [key: string]: unknown;
1218
1222
  }
1219
- /** Link as returned by the server. */
1220
1223
  interface BackendLink {
1221
1224
  id: number | string;
1222
- source: number | string;
1223
- target: number | string;
1224
- /** DHTMLX kind: `"0"` FS, `"1"` SS, `"2"` FF, `"3"` SF. */
1225
- type: '0' | '1' | '2' | '3';
1225
+ unique_id?: string | null;
1226
+ source_id?: string;
1227
+ target_id?: string;
1228
+ source?: number | string;
1229
+ target?: number | string;
1230
+ type?: unknown;
1226
1231
  lag: number;
1227
- [key: string]: unknown;
1232
+ ganttId?: number;
1233
+ sectorId?: number;
1228
1234
  }
1229
1235
  /** Sector metadata — project-level config from the server. */
1230
1236
  interface BackendSector {
@@ -1601,29 +1607,11 @@ declare class ScheduleCore {
1601
1607
  private _rollback;
1602
1608
  }
1603
1609
 
1604
- /**
1605
- * Parse the raw backend payload into the core's normalized internal model.
1606
- *
1607
- * Pure function. No side effects, no state. Throws on structural errors
1608
- * (missing required fields, broken references) per Q4 in SCHEDULE_CORE_API.md.
1609
- *
1610
- * Public from the package — consumers can use this to pre-validate before
1611
- * instantiating ScheduleCore, or to round-trip data through tests.
1612
- */
1613
-
1614
1610
  interface ParsedInput {
1615
1611
  sector: SectorMetadata;
1616
1612
  activities: Activity[];
1617
1613
  links: Link[];
1618
1614
  calendars: Calendar[];
1619
- /**
1620
- * Baseline calendars, kept SEPARATE from the scheduling `calendars`. They
1621
- * are never used to resolve an activity's calendar — only for the baseline
1622
- * render. Parsed from the raw `baseCalendars` input (the backend's
1623
- * `showBaseCalendar`); reshaped here (id+'-base', baseDefault, exceptions
1624
- * from `baseexceptiondays`) so the core owns the differentiation instead of
1625
- * the frontend `refreshCalendarsRewrite`.
1626
- */
1627
1615
  baseCalendars: Calendar[];
1628
1616
  }
1629
1617
  declare function parseFromBackend(input: BackendInput, reporter?: ScheduleCoreReporter): ParsedInput;
@@ -1992,8 +1980,8 @@ declare const LINK_CODE_TO_TYPE: {
1992
1980
  /**
1993
1981
  * Inverse boundary maps (domain → backend vocabulary).
1994
1982
  *
1995
- * The forward translations live in `parseFromBackend.ts`
1996
- * (`CONSTRAINT_LABEL_MAP`, `LINK_CODE_TO_NUMBER`). The *serialization*
1983
+ * The forward translations live in `constants.ts` (`CONSTRAINT_LABEL_MAP`)
1984
+ * and `link-display.ts` (`LINK_CODE_TO_NUMBER`). The *serialization*
1997
1985
  * core → backend is intentionally NOT owned by this package today — it
1998
1986
  * lives in the consumer bridge (`react_client/gantt.helper.js`,
1999
1987
  * `from_number_to_code` / `GanttConstraint` reverse lookup) because the