@thinkai/tai-api-contract 2.60.0 → 2.61.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.
@@ -1,7 +1,7 @@
1
1
  openapi: 3.0.3
2
2
  info:
3
3
  title: ThinkAI API
4
- version: 2.60.0
4
+ version: 2.61.0
5
5
  description: >
6
6
  Contract surface for the AI Driven SDLC backend used by ThinkAI.
7
7
  Workspace-scoped routes use `/workspaces/{workspaceId}/...`.
@@ -1469,6 +1469,10 @@ paths:
1469
1469
  value:
1470
1470
  success: false
1471
1471
  error: "invalid_token"
1472
+ zenhr_sync_in_progress:
1473
+ value:
1474
+ success: false
1475
+ error: zenhr_sync_in_progress
1472
1476
  "400":
1473
1477
  description: Invalid body or missing env for token refs
1474
1478
  content:
@@ -6604,7 +6608,8 @@ paths:
6604
6608
  Returns `{ ok: false, oauthRequired: true }` when stored credentials exist but refresh
6605
6609
  failed with an OAuth re-authorization error (e.g. `invalid_grant`); the SPA should
6606
6610
  start ZenHR OAuth next. Returns `502` for other upstream failures (same semantics as
6607
- `GET .../integrations/zenhr/branches`).
6611
+ `GET .../integrations/zenhr/branches`). Returns `503` with `zenhr_sync_in_progress` when
6612
+ an HRIS sync or OAuth refresh is already in progress for this workspace (retry shortly).
6608
6613
  parameters:
6609
6614
  - $ref: "#/components/parameters/WorkspaceId"
6610
6615
  responses:
@@ -6642,6 +6647,107 @@ paths:
6642
6647
  $ref: "#/components/schemas/ErrorMessageDto"
6643
6648
  example:
6644
6649
  error: zenhr_reconnect_failed
6650
+ "503":
6651
+ $ref: "#/components/responses/ZenHrSyncInProgress"
6652
+
6653
+ /workspaces/{workspaceId}/integrations/zenhr/branches:
6654
+ get:
6655
+ tags: [HRIS, Integrations]
6656
+ summary: List ZenHR branches
6657
+ operationId: listWorkspaceZenHrBranches
6658
+ description: >
6659
+ Lists ZenHR branches for the connected OAuth app so a workspace admin can pick one.
6660
+ Requires workspace admin role. Returns `503` with `zenhr_sync_in_progress` when an HRIS
6661
+ sync or OAuth refresh is already in progress (retry shortly).
6662
+ parameters:
6663
+ - $ref: "#/components/parameters/WorkspaceId"
6664
+ responses:
6665
+ "200":
6666
+ description: Branch list
6667
+ content:
6668
+ application/json:
6669
+ schema:
6670
+ $ref: "#/components/schemas/ZenHrBranchesListDto"
6671
+ "401":
6672
+ $ref: "#/components/responses/Unauthorized"
6673
+ "403":
6674
+ $ref: "#/components/responses/Forbidden"
6675
+ "404":
6676
+ description: ZenHR is not connected for this workspace
6677
+ content:
6678
+ application/json:
6679
+ schema:
6680
+ $ref: "#/components/schemas/ErrorMessageDto"
6681
+ example:
6682
+ error: zenhr_not_connected
6683
+ "502":
6684
+ description: ZenHR branch list unavailable
6685
+ content:
6686
+ application/json:
6687
+ schema:
6688
+ $ref: "#/components/schemas/ErrorMessageDto"
6689
+ example:
6690
+ error: zenhr_branches_unavailable
6691
+ "503":
6692
+ $ref: "#/components/responses/ZenHrSyncInProgress"
6693
+
6694
+ /workspaces/{workspaceId}/integrations/zenhr/branch:
6695
+ patch:
6696
+ tags: [HRIS, Integrations]
6697
+ summary: Save selected ZenHR branch
6698
+ operationId: patchWorkspaceZenHrBranch
6699
+ description: >
6700
+ Validates and persists the admin-selected ZenHR branch id on the workspace source.
6701
+ Requires workspace admin role. Returns `503` with `zenhr_sync_in_progress` when an HRIS
6702
+ sync or OAuth refresh is already in progress (retry shortly).
6703
+ parameters:
6704
+ - $ref: "#/components/parameters/WorkspaceId"
6705
+ requestBody:
6706
+ required: true
6707
+ content:
6708
+ application/json:
6709
+ schema:
6710
+ $ref: "#/components/schemas/ZenHrBranchSelectionDto"
6711
+ responses:
6712
+ "200":
6713
+ description: Branch saved
6714
+ content:
6715
+ application/json:
6716
+ schema:
6717
+ $ref: "#/components/schemas/ZenHrBranchSelectionResultDto"
6718
+ "400":
6719
+ description: Invalid body or unknown branch id
6720
+ content:
6721
+ application/json:
6722
+ schema:
6723
+ $ref: "#/components/schemas/ErrorMessageDto"
6724
+ examples:
6725
+ invalid_request:
6726
+ value: { error: invalid_request }
6727
+ invalid_branch_id:
6728
+ value: { error: invalid_branch_id }
6729
+ "401":
6730
+ $ref: "#/components/responses/Unauthorized"
6731
+ "403":
6732
+ $ref: "#/components/responses/Forbidden"
6733
+ "404":
6734
+ description: ZenHR is not connected for this workspace
6735
+ content:
6736
+ application/json:
6737
+ schema:
6738
+ $ref: "#/components/schemas/ErrorMessageDto"
6739
+ example:
6740
+ error: zenhr_not_connected
6741
+ "502":
6742
+ description: ZenHR branch validation unavailable
6743
+ content:
6744
+ application/json:
6745
+ schema:
6746
+ $ref: "#/components/schemas/ErrorMessageDto"
6747
+ example:
6748
+ error: zenhr_branches_unavailable
6749
+ "503":
6750
+ $ref: "#/components/responses/ZenHrSyncInProgress"
6645
6751
 
6646
6752
  /workspaces/{workspaceId}/hris/status:
6647
6753
  get:
@@ -6972,6 +7078,14 @@ components:
6972
7078
  application/json:
6973
7079
  schema:
6974
7080
  $ref: "#/components/schemas/ErrorMessageDto"
7081
+ ZenHrSyncInProgress:
7082
+ description: HRIS sync or ZenHR OAuth refresh already in progress for this workspace
7083
+ content:
7084
+ application/json:
7085
+ schema:
7086
+ $ref: "#/components/schemas/ErrorMessageDto"
7087
+ example:
7088
+ error: zenhr_sync_in_progress
6975
7089
 
6976
7090
  schemas:
6977
7091
  ErrorMessageDto:
@@ -7749,6 +7863,9 @@ components:
7749
7863
  type: boolean
7750
7864
  error:
7751
7865
  type: string
7866
+ description: >
7867
+ Machine-readable failure code when success=false (e.g. invalid_token,
7868
+ zenhr_sync_in_progress when ZenHR OAuth refresh is contended).
7752
7869
  executionKeyValid:
7753
7870
  type: boolean
7754
7871
  nullable: true
@@ -13519,6 +13636,38 @@ components:
13519
13636
  enum: [zenhr_oauth_required]
13520
13637
  description: Machine-readable code when ok=false and oauthRequired=true.
13521
13638
 
13639
+ ZenHrBranchDto:
13640
+ type: object
13641
+ required: [id, name]
13642
+ properties:
13643
+ id:
13644
+ type: string
13645
+ name:
13646
+ type: string
13647
+
13648
+ ZenHrBranchesListDto:
13649
+ type: object
13650
+ required: [branches]
13651
+ properties:
13652
+ branches:
13653
+ type: array
13654
+ items:
13655
+ $ref: "#/components/schemas/ZenHrBranchDto"
13656
+
13657
+ ZenHrBranchSelectionDto:
13658
+ type: object
13659
+ required: [branchId]
13660
+ properties:
13661
+ branchId:
13662
+ type: string
13663
+
13664
+ ZenHrBranchSelectionResultDto:
13665
+ type: object
13666
+ required: [branchId]
13667
+ properties:
13668
+ branchId:
13669
+ type: string
13670
+
13522
13671
  HrisTriggerSyncResultDto:
13523
13672
  type: object
13524
13673
  required: [status]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.60.0",
3
+ "version": "2.61.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -2641,7 +2641,7 @@ export interface paths {
2641
2641
  put?: never;
2642
2642
  /**
2643
2643
  * Attempt silent ZenHR reconnect
2644
- * @description Attempts a silent token refresh and branch ping using stored ZenHR OAuth credentials. Returns `{ ok: true }` when the connection is restored without user interaction. Returns `{ ok: false, oauthRequired: true }` when stored credentials exist but refresh failed with an OAuth re-authorization error (e.g. `invalid_grant`); the SPA should start ZenHR OAuth next. Returns `502` for other upstream failures (same semantics as `GET .../integrations/zenhr/branches`).
2644
+ * @description Attempts a silent token refresh and branch ping using stored ZenHR OAuth credentials. Returns `{ ok: true }` when the connection is restored without user interaction. Returns `{ ok: false, oauthRequired: true }` when stored credentials exist but refresh failed with an OAuth re-authorization error (e.g. `invalid_grant`); the SPA should start ZenHR OAuth next. Returns `502` for other upstream failures (same semantics as `GET .../integrations/zenhr/branches`). Returns `503` with `zenhr_sync_in_progress` when an HRIS sync or OAuth refresh is already in progress for this workspace (retry shortly).
2645
2645
  */
2646
2646
  post: operations["reconnectWorkspaceZenHr"];
2647
2647
  delete?: never;
@@ -2650,6 +2650,46 @@ export interface paths {
2650
2650
  patch?: never;
2651
2651
  trace?: never;
2652
2652
  };
2653
+ "/workspaces/{workspaceId}/integrations/zenhr/branches": {
2654
+ parameters: {
2655
+ query?: never;
2656
+ header?: never;
2657
+ path?: never;
2658
+ cookie?: never;
2659
+ };
2660
+ /**
2661
+ * List ZenHR branches
2662
+ * @description Lists ZenHR branches for the connected OAuth app so a workspace admin can pick one. Requires workspace admin role. Returns `503` with `zenhr_sync_in_progress` when an HRIS sync or OAuth refresh is already in progress (retry shortly).
2663
+ */
2664
+ get: operations["listWorkspaceZenHrBranches"];
2665
+ put?: never;
2666
+ post?: never;
2667
+ delete?: never;
2668
+ options?: never;
2669
+ head?: never;
2670
+ patch?: never;
2671
+ trace?: never;
2672
+ };
2673
+ "/workspaces/{workspaceId}/integrations/zenhr/branch": {
2674
+ parameters: {
2675
+ query?: never;
2676
+ header?: never;
2677
+ path?: never;
2678
+ cookie?: never;
2679
+ };
2680
+ get?: never;
2681
+ put?: never;
2682
+ post?: never;
2683
+ delete?: never;
2684
+ options?: never;
2685
+ head?: never;
2686
+ /**
2687
+ * Save selected ZenHR branch
2688
+ * @description Validates and persists the admin-selected ZenHR branch id on the workspace source. Requires workspace admin role. Returns `503` with `zenhr_sync_in_progress` when an HRIS sync or OAuth refresh is already in progress (retry shortly).
2689
+ */
2690
+ patch: operations["patchWorkspaceZenHrBranch"];
2691
+ trace?: never;
2692
+ };
2653
2693
  "/workspaces/{workspaceId}/hris/status": {
2654
2694
  parameters: {
2655
2695
  query?: never;
@@ -3058,6 +3098,7 @@ export interface components {
3058
3098
  };
3059
3099
  TestConnectionResponseDto: {
3060
3100
  success: boolean;
3101
+ /** @description Machine-readable failure code when success=false (e.g. invalid_token, zenhr_sync_in_progress when ZenHR OAuth refresh is contended). */
3061
3102
  error?: string;
3062
3103
  /** @description Present when `executionToken` was included in the test request. `true` = key passed save-time validation (format + not-admin-key check). `false` = key failed validation (see `executionKeyError` for detail). `null` = `executionToken` was not provided. */
3063
3104
  executionKeyValid?: boolean | null;
@@ -5782,6 +5823,19 @@ export interface components {
5782
5823
  */
5783
5824
  error?: "zenhr_oauth_required";
5784
5825
  };
5826
+ ZenHrBranchDto: {
5827
+ id: string;
5828
+ name: string;
5829
+ };
5830
+ ZenHrBranchesListDto: {
5831
+ branches: components["schemas"]["ZenHrBranchDto"][];
5832
+ };
5833
+ ZenHrBranchSelectionDto: {
5834
+ branchId: string;
5835
+ };
5836
+ ZenHrBranchSelectionResultDto: {
5837
+ branchId: string;
5838
+ };
5785
5839
  HrisTriggerSyncResultDto: {
5786
5840
  /** @enum {string} */
5787
5841
  status: "ok" | "skipped" | "error" | "partial";
@@ -5945,6 +5999,20 @@ export interface components {
5945
5999
  "application/json": components["schemas"]["ErrorMessageDto"];
5946
6000
  };
5947
6001
  };
6002
+ /** @description HRIS sync or ZenHR OAuth refresh already in progress for this workspace */
6003
+ ZenHrSyncInProgress: {
6004
+ headers: {
6005
+ [name: string]: unknown;
6006
+ };
6007
+ content: {
6008
+ /**
6009
+ * @example {
6010
+ * "error": "zenhr_sync_in_progress"
6011
+ * }
6012
+ */
6013
+ "application/json": components["schemas"]["ErrorMessageDto"];
6014
+ };
6015
+ };
5948
6016
  };
5949
6017
  parameters: {
5950
6018
  WorkspaceId: string;
@@ -6277,6 +6345,10 @@ export type WorkspaceAbsenceListDto = components['schemas']['WorkspaceAbsenceLis
6277
6345
  export type HrisSyncStatusDto = components['schemas']['HrisSyncStatusDto'];
6278
6346
  export type HrisSyncStatusListDto = components['schemas']['HrisSyncStatusListDto'];
6279
6347
  export type ZenHrReconnectResultDto = components['schemas']['ZenHrReconnectResultDto'];
6348
+ export type ZenHrBranchDto = components['schemas']['ZenHrBranchDto'];
6349
+ export type ZenHrBranchesListDto = components['schemas']['ZenHrBranchesListDto'];
6350
+ export type ZenHrBranchSelectionDto = components['schemas']['ZenHrBranchSelectionDto'];
6351
+ export type ZenHrBranchSelectionResultDto = components['schemas']['ZenHrBranchSelectionResultDto'];
6280
6352
  export type HrisTriggerSyncResultDto = components['schemas']['HrisTriggerSyncResultDto'];
6281
6353
  export type HrisProviderSyncResultDto = components['schemas']['HrisProviderSyncResultDto'];
6282
6354
  export type ActivityLogPageDto = components['schemas']['ActivityLogPageDto'];
@@ -6284,6 +6356,7 @@ export type ReadinessTokenUsageRowDto = components['schemas']['ReadinessTokenUsa
6284
6356
  export type ReadinessTokenUsageByDimensionRowDto = components['schemas']['ReadinessTokenUsageByDimensionRowDto'];
6285
6357
  export type ResponseUnauthorized = components['responses']['Unauthorized'];
6286
6358
  export type ResponseForbidden = components['responses']['Forbidden'];
6359
+ export type ResponseZenHrSyncInProgress = components['responses']['ZenHrSyncInProgress'];
6287
6360
  export type ParameterWorkspaceId = components['parameters']['WorkspaceId'];
6288
6361
  export type ParameterRepoId = components['parameters']['RepoId'];
6289
6362
  export type ParameterProviderSlug = components['parameters']['ProviderSlug'];
@@ -13092,6 +13165,126 @@ export interface operations {
13092
13165
  "application/json": components["schemas"]["ErrorMessageDto"];
13093
13166
  };
13094
13167
  };
13168
+ 503: components["responses"]["ZenHrSyncInProgress"];
13169
+ };
13170
+ };
13171
+ listWorkspaceZenHrBranches: {
13172
+ parameters: {
13173
+ query?: never;
13174
+ header?: never;
13175
+ path: {
13176
+ workspaceId: components["parameters"]["WorkspaceId"];
13177
+ };
13178
+ cookie?: never;
13179
+ };
13180
+ requestBody?: never;
13181
+ responses: {
13182
+ /** @description Branch list */
13183
+ 200: {
13184
+ headers: {
13185
+ [name: string]: unknown;
13186
+ };
13187
+ content: {
13188
+ "application/json": components["schemas"]["ZenHrBranchesListDto"];
13189
+ };
13190
+ };
13191
+ 401: components["responses"]["Unauthorized"];
13192
+ 403: components["responses"]["Forbidden"];
13193
+ /** @description ZenHR is not connected for this workspace */
13194
+ 404: {
13195
+ headers: {
13196
+ [name: string]: unknown;
13197
+ };
13198
+ content: {
13199
+ /**
13200
+ * @example {
13201
+ * "error": "zenhr_not_connected"
13202
+ * }
13203
+ */
13204
+ "application/json": components["schemas"]["ErrorMessageDto"];
13205
+ };
13206
+ };
13207
+ /** @description ZenHR branch list unavailable */
13208
+ 502: {
13209
+ headers: {
13210
+ [name: string]: unknown;
13211
+ };
13212
+ content: {
13213
+ /**
13214
+ * @example {
13215
+ * "error": "zenhr_branches_unavailable"
13216
+ * }
13217
+ */
13218
+ "application/json": components["schemas"]["ErrorMessageDto"];
13219
+ };
13220
+ };
13221
+ 503: components["responses"]["ZenHrSyncInProgress"];
13222
+ };
13223
+ };
13224
+ patchWorkspaceZenHrBranch: {
13225
+ parameters: {
13226
+ query?: never;
13227
+ header?: never;
13228
+ path: {
13229
+ workspaceId: components["parameters"]["WorkspaceId"];
13230
+ };
13231
+ cookie?: never;
13232
+ };
13233
+ requestBody: {
13234
+ content: {
13235
+ "application/json": components["schemas"]["ZenHrBranchSelectionDto"];
13236
+ };
13237
+ };
13238
+ responses: {
13239
+ /** @description Branch saved */
13240
+ 200: {
13241
+ headers: {
13242
+ [name: string]: unknown;
13243
+ };
13244
+ content: {
13245
+ "application/json": components["schemas"]["ZenHrBranchSelectionResultDto"];
13246
+ };
13247
+ };
13248
+ /** @description Invalid body or unknown branch id */
13249
+ 400: {
13250
+ headers: {
13251
+ [name: string]: unknown;
13252
+ };
13253
+ content: {
13254
+ "application/json": components["schemas"]["ErrorMessageDto"];
13255
+ };
13256
+ };
13257
+ 401: components["responses"]["Unauthorized"];
13258
+ 403: components["responses"]["Forbidden"];
13259
+ /** @description ZenHR is not connected for this workspace */
13260
+ 404: {
13261
+ headers: {
13262
+ [name: string]: unknown;
13263
+ };
13264
+ content: {
13265
+ /**
13266
+ * @example {
13267
+ * "error": "zenhr_not_connected"
13268
+ * }
13269
+ */
13270
+ "application/json": components["schemas"]["ErrorMessageDto"];
13271
+ };
13272
+ };
13273
+ /** @description ZenHR branch validation unavailable */
13274
+ 502: {
13275
+ headers: {
13276
+ [name: string]: unknown;
13277
+ };
13278
+ content: {
13279
+ /**
13280
+ * @example {
13281
+ * "error": "zenhr_branches_unavailable"
13282
+ * }
13283
+ */
13284
+ "application/json": components["schemas"]["ErrorMessageDto"];
13285
+ };
13286
+ };
13287
+ 503: components["responses"]["ZenHrSyncInProgress"];
13095
13288
  };
13096
13289
  };
13097
13290
  getHrisSyncStatus: {