@thinkai/tai-api-contract 2.12.0 → 2.13.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.
@@ -1665,6 +1665,66 @@ export interface paths {
1665
1665
  patch?: never;
1666
1666
  trace?: never;
1667
1667
  };
1668
+ "/workspaces/{workspaceId}/absences": {
1669
+ parameters: {
1670
+ query?: never;
1671
+ header?: never;
1672
+ path?: never;
1673
+ cookie?: never;
1674
+ };
1675
+ /**
1676
+ * List absence records
1677
+ * @description Returns time-off/absence records sourced from connected HRIS providers (e.g. Personio) for the given date window. Requires workspace membership.
1678
+ */
1679
+ get: operations["listWorkspaceAbsences"];
1680
+ put?: never;
1681
+ post?: never;
1682
+ delete?: never;
1683
+ options?: never;
1684
+ head?: never;
1685
+ patch?: never;
1686
+ trace?: never;
1687
+ };
1688
+ "/workspaces/{workspaceId}/hris/status": {
1689
+ parameters: {
1690
+ query?: never;
1691
+ header?: never;
1692
+ path?: never;
1693
+ cookie?: never;
1694
+ };
1695
+ /**
1696
+ * HRIS sync status
1697
+ * @description Returns the last sync status for every HRIS provider connected to the workspace. Returns an empty `statuses` array when no HRIS source has been synced yet. Requires workspace membership.
1698
+ */
1699
+ get: operations["getHrisSyncStatus"];
1700
+ put?: never;
1701
+ post?: never;
1702
+ delete?: never;
1703
+ options?: never;
1704
+ head?: never;
1705
+ patch?: never;
1706
+ trace?: never;
1707
+ };
1708
+ "/workspaces/{workspaceId}/hris/sync": {
1709
+ parameters: {
1710
+ query?: never;
1711
+ header?: never;
1712
+ path?: never;
1713
+ cookie?: never;
1714
+ };
1715
+ get?: never;
1716
+ put?: never;
1717
+ /**
1718
+ * Trigger manual HRIS sync
1719
+ * @description Manually triggers an HRIS sync for the workspace. Runs synchronously and returns the result. Requires editor role (same permission level as org-chart writes). Returns 422 when no HRIS source is configured.
1720
+ */
1721
+ post: operations["triggerHrisSync"];
1722
+ delete?: never;
1723
+ options?: never;
1724
+ head?: never;
1725
+ patch?: never;
1726
+ trace?: never;
1727
+ };
1668
1728
  }
1669
1729
  export type webhooks = Record<string, never>;
1670
1730
  export interface components {
@@ -3215,6 +3275,57 @@ export interface components {
3215
3275
  [key: string]: unknown;
3216
3276
  } | null;
3217
3277
  };
3278
+ WorkspaceAbsenceDto: {
3279
+ /** @description HRIS provider that sourced this record (e.g. 'personio', 'zenhr'). */
3280
+ source: string;
3281
+ /** Format: email */
3282
+ employeeEmail: string;
3283
+ absenceType: string;
3284
+ /** Format: date */
3285
+ startDate: string;
3286
+ /** Format: date */
3287
+ endDate: string;
3288
+ halfDayStart: boolean;
3289
+ halfDayEnd: boolean;
3290
+ /** @enum {string} */
3291
+ status: "approved" | "pending" | "rejected";
3292
+ };
3293
+ WorkspaceAbsenceListDto: {
3294
+ absences: components["schemas"]["WorkspaceAbsenceDto"][];
3295
+ /**
3296
+ * Format: date-time
3297
+ * @description ISO timestamp of the most recent successful HRIS sync, or null if never synced.
3298
+ */
3299
+ syncedAt: string | null;
3300
+ };
3301
+ HrisSyncStatusDto: {
3302
+ /** @description Provider identifier (e.g. 'personio', 'zenhr'). */
3303
+ provider: string;
3304
+ /** Format: date-time */
3305
+ lastSyncAt: string | null;
3306
+ /** @enum {string} */
3307
+ status: "ok" | "error" | "never";
3308
+ lastError?: string | null;
3309
+ };
3310
+ HrisSyncStatusListDto: {
3311
+ statuses: components["schemas"]["HrisSyncStatusDto"][];
3312
+ };
3313
+ HrisTriggerSyncResultDto: {
3314
+ /** @enum {string} */
3315
+ status: "ok" | "skipped" | "error";
3316
+ /** @description Stable machine-readable code (e.g. 'no_personio_source', 'hris_sync_failed'). */
3317
+ code?: string;
3318
+ /** @description Number of employees synced (present when status = 'ok'). */
3319
+ employeeCount?: number;
3320
+ /** @description Number of absence records synced (present when status = 'ok'). */
3321
+ absenceCount?: number;
3322
+ /** @description Wall-clock duration of the sync in milliseconds (present when status = 'ok'). */
3323
+ durationMs?: number;
3324
+ /** @description Machine-readable reason for a skipped sync (e.g. 'no_personio_source'). */
3325
+ reason?: string;
3326
+ /** @description Error message when status = 'error'. */
3327
+ error?: string;
3328
+ };
3218
3329
  ActivityLogPageDto: components["schemas"]["PageMetaDto"] & {
3219
3330
  items: components["schemas"]["ActivityLogEntryDto"][];
3220
3331
  };
@@ -3444,6 +3555,11 @@ export type PatchRepoArchiveResponseDto = components['schemas']['PatchRepoArchiv
3444
3555
  export type ActivityLogEventTypeDto = components['schemas']['ActivityLogEventTypeDto'];
3445
3556
  export type ActivityLogActorDto = components['schemas']['ActivityLogActorDto'];
3446
3557
  export type ActivityLogEntryDto = components['schemas']['ActivityLogEntryDto'];
3558
+ export type WorkspaceAbsenceDto = components['schemas']['WorkspaceAbsenceDto'];
3559
+ export type WorkspaceAbsenceListDto = components['schemas']['WorkspaceAbsenceListDto'];
3560
+ export type HrisSyncStatusDto = components['schemas']['HrisSyncStatusDto'];
3561
+ export type HrisSyncStatusListDto = components['schemas']['HrisSyncStatusListDto'];
3562
+ export type HrisTriggerSyncResultDto = components['schemas']['HrisTriggerSyncResultDto'];
3447
3563
  export type ActivityLogPageDto = components['schemas']['ActivityLogPageDto'];
3448
3564
  export type ResponseUnauthorized = components['responses']['Unauthorized'];
3449
3565
  export type ResponseForbidden = components['responses']['Forbidden'];
@@ -7620,4 +7736,149 @@ export interface operations {
7620
7736
  };
7621
7737
  };
7622
7738
  };
7739
+ listWorkspaceAbsences: {
7740
+ parameters: {
7741
+ query?: {
7742
+ /** @description Start of date window (ISO YYYY-MM-DD). Defaults to today. */
7743
+ from?: string;
7744
+ /** @description End of date window (ISO YYYY-MM-DD). Defaults to 90 days from today. */
7745
+ to?: string;
7746
+ };
7747
+ header?: never;
7748
+ path: {
7749
+ workspaceId: components["parameters"]["WorkspaceId"];
7750
+ };
7751
+ cookie?: never;
7752
+ };
7753
+ requestBody?: never;
7754
+ responses: {
7755
+ /** @description Absence list with last sync timestamp */
7756
+ 200: {
7757
+ headers: {
7758
+ [name: string]: unknown;
7759
+ };
7760
+ content: {
7761
+ /**
7762
+ * @example {
7763
+ * "absences": [
7764
+ * {
7765
+ * "source": "personio",
7766
+ * "employeeEmail": "alice@example.com",
7767
+ * "absenceType": "Vacation",
7768
+ * "startDate": "2025-07-01",
7769
+ * "endDate": "2025-07-05",
7770
+ * "halfDayStart": false,
7771
+ * "halfDayEnd": false,
7772
+ * "status": "approved"
7773
+ * }
7774
+ * ],
7775
+ * "syncedAt": "2025-06-30T08:00:00.000Z"
7776
+ * }
7777
+ */
7778
+ "application/json": components["schemas"]["WorkspaceAbsenceListDto"];
7779
+ };
7780
+ };
7781
+ 401: components["responses"]["Unauthorized"];
7782
+ 403: components["responses"]["Forbidden"];
7783
+ };
7784
+ };
7785
+ getHrisSyncStatus: {
7786
+ parameters: {
7787
+ query?: never;
7788
+ header?: never;
7789
+ path: {
7790
+ workspaceId: components["parameters"]["WorkspaceId"];
7791
+ };
7792
+ cookie?: never;
7793
+ };
7794
+ requestBody?: never;
7795
+ responses: {
7796
+ /** @description Sync status list */
7797
+ 200: {
7798
+ headers: {
7799
+ [name: string]: unknown;
7800
+ };
7801
+ content: {
7802
+ /**
7803
+ * @example {
7804
+ * "statuses": [
7805
+ * {
7806
+ * "provider": "personio",
7807
+ * "lastSyncAt": "2025-06-30T08:00:00.000Z",
7808
+ * "status": "ok"
7809
+ * }
7810
+ * ]
7811
+ * }
7812
+ */
7813
+ "application/json": components["schemas"]["HrisSyncStatusListDto"];
7814
+ };
7815
+ };
7816
+ 401: components["responses"]["Unauthorized"];
7817
+ 403: components["responses"]["Forbidden"];
7818
+ };
7819
+ };
7820
+ triggerHrisSync: {
7821
+ parameters: {
7822
+ query?: never;
7823
+ header?: never;
7824
+ path: {
7825
+ workspaceId: components["parameters"]["WorkspaceId"];
7826
+ };
7827
+ cookie?: never;
7828
+ };
7829
+ requestBody?: never;
7830
+ responses: {
7831
+ /** @description Sync completed successfully */
7832
+ 200: {
7833
+ headers: {
7834
+ [name: string]: unknown;
7835
+ };
7836
+ content: {
7837
+ /**
7838
+ * @example {
7839
+ * "status": "ok",
7840
+ * "employeeCount": 42,
7841
+ * "absenceCount": 7,
7842
+ * "durationMs": 1234
7843
+ * }
7844
+ */
7845
+ "application/json": components["schemas"]["HrisTriggerSyncResultDto"];
7846
+ };
7847
+ };
7848
+ 401: components["responses"]["Unauthorized"];
7849
+ 403: components["responses"]["Forbidden"];
7850
+ /** @description No HRIS source configured for this workspace */
7851
+ 422: {
7852
+ headers: {
7853
+ [name: string]: unknown;
7854
+ };
7855
+ content: {
7856
+ /**
7857
+ * @example {
7858
+ * "status": "skipped",
7859
+ * "code": "no_personio_source",
7860
+ * "reason": "no_personio_source"
7861
+ * }
7862
+ */
7863
+ "application/json": components["schemas"]["HrisTriggerSyncResultDto"];
7864
+ };
7865
+ };
7866
+ /** @description Sync failed (Personio API error, decryption failure, etc.) */
7867
+ 500: {
7868
+ headers: {
7869
+ [name: string]: unknown;
7870
+ };
7871
+ content: {
7872
+ /**
7873
+ * @example {
7874
+ * "status": "error",
7875
+ * "code": "hris_sync_failed",
7876
+ * "error": "Personio employees API 401"
7877
+ * }
7878
+ */
7879
+ "application/json": components["schemas"]["HrisTriggerSyncResultDto"];
7880
+ };
7881
+ };
7882
+ };
7883
+ };
7623
7884
  }
package/src/index.ts CHANGED
@@ -1019,3 +1019,58 @@ export interface YourAiJourneyAiSpendDto {
1019
1019
  activeUsers: number;
1020
1020
  }[];
1021
1021
  }
1022
+
1023
+ // --- HRIS (Personio, ZenHR, …) ---
1024
+
1025
+ /** A single absence/leave record sourced from an HRIS provider. */
1026
+ export interface WorkspaceAbsenceDto {
1027
+ /** HRIS provider that sourced this record ('personio', 'zenhr', …). */
1028
+ source: string;
1029
+ employeeEmail: string;
1030
+ absenceType: string;
1031
+ /** ISO date YYYY-MM-DD */
1032
+ startDate: string;
1033
+ /** ISO date YYYY-MM-DD */
1034
+ endDate: string;
1035
+ halfDayStart: boolean;
1036
+ halfDayEnd: boolean;
1037
+ status: "approved" | "pending" | "rejected";
1038
+ }
1039
+
1040
+ /** Response body for GET /workspaces/:id/absences */
1041
+ export interface WorkspaceAbsenceListDto {
1042
+ absences: WorkspaceAbsenceDto[];
1043
+ /** ISO timestamp of the most recent successful sync, or null if never synced. */
1044
+ syncedAt: string | null;
1045
+ }
1046
+
1047
+ /** Sync status for a single HRIS provider connected to a workspace. */
1048
+ export interface HrisSyncStatusDto {
1049
+ /** Provider identifier ('personio', 'zenhr', …). */
1050
+ provider: string;
1051
+ lastSyncAt: string | null;
1052
+ status: "ok" | "error" | "never";
1053
+ lastError?: string;
1054
+ }
1055
+
1056
+ /** Response body for GET /workspaces/:id/hris/status */
1057
+ export interface HrisSyncStatusListDto {
1058
+ statuses: HrisSyncStatusDto[];
1059
+ }
1060
+
1061
+ /** Response body for POST /workspaces/:id/hris/sync (manual trigger). */
1062
+ export interface HrisTriggerSyncResultDto {
1063
+ status: "ok" | "skipped" | "error";
1064
+ /** Stable machine-readable code (e.g. 'no_personio_source', 'hris_sync_failed'). */
1065
+ code?: string;
1066
+ /** Number of employees synced (present when status = 'ok'). */
1067
+ employeeCount?: number;
1068
+ /** Number of absence records synced (present when status = 'ok'). */
1069
+ absenceCount?: number;
1070
+ /** Wall-clock duration of the sync in milliseconds (present when status = 'ok'). */
1071
+ durationMs?: number;
1072
+ /** Machine-readable reason for a skipped sync (e.g. 'no_personio_source'). */
1073
+ reason?: string;
1074
+ /** Error message when status = 'error'. */
1075
+ error?: string;
1076
+ }