@thinkai/tai-api-contract 2.46.0 → 2.48.0-pr.865.c7804f40

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.46.0
4
+ version: 2.48.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}/...`.
@@ -327,6 +327,56 @@ paths:
327
327
  description: Updated
328
328
  "401":
329
329
  $ref: "#/components/responses/Unauthorized"
330
+ delete:
331
+ tags: [Me]
332
+ summary: Delete current user account and all owned data
333
+ operationId: deleteMe
334
+ description: >
335
+ Self-service account deletion. Hard-deletes the authenticated user in a single
336
+ atomic transaction with the same semantics as admin `deleteUserAndData` (#428):
337
+ owned workspaces (and all workspace-level child tables via CASCADE), membership
338
+ rows in other workspaces, invitations where the user is `invited_by`, and the
339
+ user row itself. After the DB commit, removes the corresponding Supabase Auth
340
+ user via the service-role key; Auth deletion failure is logged but does not
341
+ roll back the DB changes.
342
+
343
+ **Irreversible.** Owned workspaces in the #440 soft-delete grace period are
344
+ also hard-deleted immediately; there is no restore window after account delete.
345
+
346
+ **Authorization:** Bearer JWT required. Body must include the caller's email
347
+ exactly (case-insensitive) as a type-to-confirm guard.
348
+ requestBody:
349
+ required: true
350
+ content:
351
+ application/json:
352
+ schema:
353
+ $ref: "#/components/schemas/DeleteMeBodyDto"
354
+ responses:
355
+ "204":
356
+ description: Account and all owned data deleted.
357
+ "400":
358
+ description: Missing or mismatched confirmation email.
359
+ content:
360
+ application/json:
361
+ schema:
362
+ $ref: "#/components/schemas/ErrorMessageDto"
363
+ example:
364
+ error: Confirmation email does not match account email
365
+ code: email_mismatch
366
+ "401":
367
+ $ref: "#/components/responses/Unauthorized"
368
+ "409":
369
+ description: Identity conflict resolving the current user.
370
+ content:
371
+ application/json:
372
+ schema:
373
+ $ref: "#/components/schemas/ErrorMessageDto"
374
+ "503":
375
+ description: Account deletion not supported by the configured store.
376
+ content:
377
+ application/json:
378
+ schema:
379
+ $ref: "#/components/schemas/ErrorMessageDto"
330
380
 
331
381
  /me/workspaces:
332
382
  get:
@@ -548,6 +598,59 @@ paths:
548
598
  error: Cannot remove the workspace owner
549
599
  code: workspace_owner
550
600
 
601
+ /workspaces/{workspaceId}/org-chart/status:
602
+ get:
603
+ tags: [Workspace]
604
+ summary: Effective org chart status (structure + identity)
605
+ operationId: getWorkspaceOrgChartStatus
606
+ parameters:
607
+ - $ref: "#/components/parameters/WorkspaceId"
608
+ responses:
609
+ "200":
610
+ description: Structure source, identity mappings, and effective chart summary
611
+ content:
612
+ application/json:
613
+ schema:
614
+ $ref: "#/components/schemas/OrgChartStatusDto"
615
+ "401":
616
+ $ref: "#/components/responses/Unauthorized"
617
+ "403":
618
+ $ref: "#/components/responses/Forbidden"
619
+
620
+ /workspaces/{workspaceId}/org-chart/structure-source:
621
+ put:
622
+ tags: [Workspace]
623
+ summary: Switch org structure base between HRIS and uploaded file
624
+ description: >
625
+ Advanced override when both HRIS and uploaded structure caches exist.
626
+ Re-materializes the effective org chart and may queue productivity re-ingest.
627
+ operationId: putWorkspaceOrgStructureSource
628
+ parameters:
629
+ - $ref: "#/components/parameters/WorkspaceId"
630
+ requestBody:
631
+ required: true
632
+ content:
633
+ application/json:
634
+ schema:
635
+ $ref: "#/components/schemas/OrgStructureSourceBodyDto"
636
+ responses:
637
+ "200":
638
+ description: Updated status after re-materialization
639
+ content:
640
+ application/json:
641
+ schema:
642
+ $ref: "#/components/schemas/OrgChartStatusDto"
643
+ "400":
644
+ description: Both structure caches are not available
645
+ content:
646
+ application/json:
647
+ schema:
648
+ $ref: "#/components/schemas/ErrorMessageDto"
649
+ "401":
650
+ $ref: "#/components/responses/Unauthorized"
651
+ "403":
652
+ $ref: "#/components/responses/Forbidden"
653
+
551
654
  /workspaces/{workspaceId}/org-chart:
552
655
  get:
553
656
  tags: [Workspace]
@@ -5980,6 +6083,11 @@ components:
5980
6083
  type: array
5981
6084
  items:
5982
6085
  type: string
6086
+ unmatchedPreview:
6087
+ type: array
6088
+ description: Parse-only preview of identity rows that would not match HRIS persons
6089
+ items:
6090
+ $ref: "#/components/schemas/OrgChartUnmatchedIdentitySampleDto"
5983
6091
 
5984
6092
  OrgChartSaveResultDto:
5985
6093
  type: object
@@ -5991,6 +6099,103 @@ components:
5991
6099
  tenantId:
5992
6100
  type: string
5993
6101
  format: uuid
6102
+ unmatchedCount:
6103
+ type: integer
6104
+ minimum: 0
6105
+ description: Identity rows that did not match HRIS persons (non-blocking)
6106
+
6107
+ OrgStructureSourceBodyDto:
6108
+ type: object
6109
+ additionalProperties: false
6110
+ required: [source]
6111
+ properties:
6112
+ source:
6113
+ type: string
6114
+ enum: [hris, upload]
6115
+
6116
+ OrgChartStructureAvailabilityDto:
6117
+ type: object
6118
+ additionalProperties: false
6119
+ required: [personCount, teamCount]
6120
+ properties:
6121
+ personCount:
6122
+ type: integer
6123
+ minimum: 0
6124
+ teamCount:
6125
+ type: integer
6126
+ minimum: 0
6127
+ provider:
6128
+ type: string
6129
+ description: HRIS provider when structure is from HRIS sync
6130
+
6131
+ OrgChartUnmatchedIdentitySampleDto:
6132
+ type: object
6133
+ additionalProperties: false
6134
+ required: [email]
6135
+ properties:
6136
+ email:
6137
+ type: string
6138
+ employeeId:
6139
+ type: string
6140
+ githubUsername:
6141
+ type: string
6142
+
6143
+ OrgChartStatusDto:
6144
+ type: object
6145
+ additionalProperties: false
6146
+ required: [structure, identity, effective]
6147
+ properties:
6148
+ structure:
6149
+ type: object
6150
+ additionalProperties: false
6151
+ required: [source, hris, uploadOverride]
6152
+ properties:
6153
+ source:
6154
+ type: string
6155
+ enum: [hris, upload]
6156
+ hris:
6157
+ allOf:
6158
+ - $ref: "#/components/schemas/OrgChartStructureAvailabilityDto"
6159
+ - type: object
6160
+ properties:
6161
+ lastSyncAt:
6162
+ type: string
6163
+ format: date-time
6164
+ nullable: true
6165
+ uploadOverride:
6166
+ allOf:
6167
+ - $ref: "#/components/schemas/OrgChartStructureAvailabilityDto"
6168
+ nullable: true
6169
+ identity:
6170
+ type: object
6171
+ additionalProperties: false
6172
+ required: [mappingCount, updatedAt, unmatchedCount, unmatchedSample]
6173
+ properties:
6174
+ mappingCount:
6175
+ type: integer
6176
+ minimum: 0
6177
+ updatedAt:
6178
+ type: string
6179
+ format: date-time
6180
+ nullable: true
6181
+ unmatchedCount:
6182
+ type: integer
6183
+ minimum: 0
6184
+ unmatchedSample:
6185
+ type: array
6186
+ items:
6187
+ $ref: "#/components/schemas/OrgChartUnmatchedIdentitySampleDto"
6188
+ effective:
6189
+ type: object
6190
+ additionalProperties: false
6191
+ required: [personCount, githubMappedCount]
6192
+ properties:
6193
+ personCount:
6194
+ type: integer
6195
+ minimum: 0
6196
+ githubMappedCount:
6197
+ type: integer
6198
+ minimum: 0
5994
6199
 
5995
6200
  TenantSourceEntryDto:
5996
6201
  type: object
@@ -7784,6 +7989,17 @@ components:
7784
7989
  type: string
7785
7990
  nullable: true
7786
7991
 
7992
+ DeleteMeBodyDto:
7993
+ type: object
7994
+ required: [email]
7995
+ properties:
7996
+ email:
7997
+ type: string
7998
+ format: email
7999
+ description: >
8000
+ Must match the authenticated user's email (case-insensitive). Acts as
8001
+ a type-to-confirm guard against accidental deletion.
8002
+
7787
8003
  WorkspaceSummaryDto:
7788
8004
  type: object
7789
8005
  required: [id, slug, name, status, role]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.46.0",
3
+ "version": "2.48.0-pr.865.c7804f40",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -82,7 +82,13 @@ export interface paths {
82
82
  /** Update current user profile */
83
83
  put: operations["updateMe"];
84
84
  post?: never;
85
- delete?: never;
85
+ /**
86
+ * Delete current user account and all owned data
87
+ * @description Self-service account deletion. Hard-deletes the authenticated user in a single atomic transaction with the same semantics as admin `deleteUserAndData` (#428): owned workspaces (and all workspace-level child tables via CASCADE), membership rows in other workspaces, invitations where the user is `invited_by`, and the user row itself. After the DB commit, removes the corresponding Supabase Auth user via the service-role key; Auth deletion failure is logged but does not roll back the DB changes.
88
+ * **Irreversible.** Owned workspaces in the #440 soft-delete grace period are also hard-deleted immediately; there is no restore window after account delete.
89
+ * **Authorization:** Bearer JWT required. Body must include the caller's email exactly (case-insensitive) as a type-to-confirm guard.
90
+ */
91
+ delete: operations["deleteMe"];
86
92
  options?: never;
87
93
  head?: never;
88
94
  patch?: never;
@@ -189,6 +195,43 @@ export interface paths {
189
195
  patch: operations["updateTenantMemberRole"];
190
196
  trace?: never;
191
197
  };
198
+ "/workspaces/{workspaceId}/org-chart/status": {
199
+ parameters: {
200
+ query?: never;
201
+ header?: never;
202
+ path?: never;
203
+ cookie?: never;
204
+ };
205
+ /** Effective org chart status (structure + identity) */
206
+ get: operations["getWorkspaceOrgChartStatus"];
207
+ put?: never;
208
+ post?: never;
209
+ delete?: never;
210
+ options?: never;
211
+ head?: never;
212
+ patch?: never;
213
+ trace?: never;
214
+ };
215
+ "/workspaces/{workspaceId}/org-chart/structure-source": {
216
+ parameters: {
217
+ query?: never;
218
+ header?: never;
219
+ path?: never;
220
+ cookie?: never;
221
+ };
222
+ get?: never;
223
+ /**
224
+ * Switch org structure base between HRIS and uploaded file
225
+ * @description Advanced override when both HRIS and uploaded structure caches exist. Re-materializes the effective org chart and may queue productivity re-ingest.
226
+ */
227
+ put: operations["putWorkspaceOrgStructureSource"];
228
+ post?: never;
229
+ delete?: never;
230
+ options?: never;
231
+ head?: never;
232
+ patch?: never;
233
+ trace?: never;
234
+ };
192
235
  "/workspaces/{workspaceId}/org-chart": {
193
236
  parameters: {
194
237
  query?: never;
@@ -2300,11 +2343,52 @@ export interface components {
2300
2343
  OrgChartImportResultDto: {
2301
2344
  persons: components["schemas"]["OrgChartPersonDto"][];
2302
2345
  errors: string[];
2346
+ /** @description Parse-only preview of identity rows that would not match HRIS persons */
2347
+ unmatchedPreview?: components["schemas"]["OrgChartUnmatchedIdentitySampleDto"][];
2303
2348
  };
2304
2349
  OrgChartSaveResultDto: {
2305
2350
  ok: boolean;
2306
2351
  /** Format: uuid */
2307
2352
  tenantId: string;
2353
+ /** @description Identity rows that did not match HRIS persons (non-blocking) */
2354
+ unmatchedCount?: number;
2355
+ };
2356
+ OrgStructureSourceBodyDto: {
2357
+ /** @enum {string} */
2358
+ source: "hris" | "upload";
2359
+ };
2360
+ OrgChartStructureAvailabilityDto: {
2361
+ personCount: number;
2362
+ teamCount: number;
2363
+ /** @description HRIS provider when structure is from HRIS sync */
2364
+ provider?: string;
2365
+ };
2366
+ OrgChartUnmatchedIdentitySampleDto: {
2367
+ email: string;
2368
+ employeeId?: string;
2369
+ githubUsername?: string;
2370
+ };
2371
+ OrgChartStatusDto: {
2372
+ structure: {
2373
+ /** @enum {string} */
2374
+ source: "hris" | "upload";
2375
+ hris: (components["schemas"]["OrgChartStructureAvailabilityDto"] & {
2376
+ /** Format: date-time */
2377
+ lastSyncAt?: string;
2378
+ }) | null;
2379
+ uploadOverride: components["schemas"]["OrgChartStructureAvailabilityDto"] | null;
2380
+ };
2381
+ identity: {
2382
+ mappingCount: number;
2383
+ /** Format: date-time */
2384
+ updatedAt: string | null;
2385
+ unmatchedCount: number;
2386
+ unmatchedSample: components["schemas"]["OrgChartUnmatchedIdentitySampleDto"][];
2387
+ };
2388
+ effective: {
2389
+ personCount: number;
2390
+ githubMappedCount: number;
2391
+ };
2308
2392
  };
2309
2393
  TenantSourceEntryDto: {
2310
2394
  type: string;
@@ -3104,6 +3188,13 @@ export interface components {
3104
3188
  email?: string;
3105
3189
  defaultWorkspaceId?: string | null;
3106
3190
  };
3191
+ DeleteMeBodyDto: {
3192
+ /**
3193
+ * Format: email
3194
+ * @description Must match the authenticated user's email (case-insensitive). Acts as a type-to-confirm guard against accidental deletion.
3195
+ */
3196
+ email: string;
3197
+ };
3107
3198
  WorkspaceSummaryDto: {
3108
3199
  id: string;
3109
3200
  slug: string;
@@ -4643,6 +4734,10 @@ export type OrgChartDto = components['schemas']['OrgChartDto'];
4643
4734
  export type OrgChartPersonDto = components['schemas']['OrgChartPersonDto'];
4644
4735
  export type OrgChartImportResultDto = components['schemas']['OrgChartImportResultDto'];
4645
4736
  export type OrgChartSaveResultDto = components['schemas']['OrgChartSaveResultDto'];
4737
+ export type OrgStructureSourceBodyDto = components['schemas']['OrgStructureSourceBodyDto'];
4738
+ export type OrgChartStructureAvailabilityDto = components['schemas']['OrgChartStructureAvailabilityDto'];
4739
+ export type OrgChartUnmatchedIdentitySampleDto = components['schemas']['OrgChartUnmatchedIdentitySampleDto'];
4740
+ export type OrgChartStatusDto = components['schemas']['OrgChartStatusDto'];
4646
4741
  export type TenantSourceEntryDto = components['schemas']['TenantSourceEntryDto'];
4647
4742
  export type CursorSourceDto = components['schemas']['CursorSourceDto'];
4648
4743
  export type CursorSourcePatchDto = components['schemas']['CursorSourcePatchDto'];
@@ -4716,6 +4811,7 @@ export type AiToolMemberHeatmapDayDto = components['schemas']['AiToolMemberHeatm
4716
4811
  export type AiToolMemberDetailDto = components['schemas']['AiToolMemberDetailDto'];
4717
4812
  export type MeProfileDto = components['schemas']['MeProfileDto'];
4718
4813
  export type UpdateMeBodyDto = components['schemas']['UpdateMeBodyDto'];
4814
+ export type DeleteMeBodyDto = components['schemas']['DeleteMeBodyDto'];
4719
4815
  export type WorkspaceSummaryDto = components['schemas']['WorkspaceSummaryDto'];
4720
4816
  export type WorkspacesForUserDto = components['schemas']['WorkspacesForUserDto'];
4721
4817
  export type CreateWorkspaceBodyDto = components['schemas']['CreateWorkspaceBodyDto'];
@@ -5113,6 +5209,62 @@ export interface operations {
5113
5209
  401: components["responses"]["Unauthorized"];
5114
5210
  };
5115
5211
  };
5212
+ deleteMe: {
5213
+ parameters: {
5214
+ query?: never;
5215
+ header?: never;
5216
+ path?: never;
5217
+ cookie?: never;
5218
+ };
5219
+ requestBody: {
5220
+ content: {
5221
+ "application/json": components["schemas"]["DeleteMeBodyDto"];
5222
+ };
5223
+ };
5224
+ responses: {
5225
+ /** @description Account and all owned data deleted. */
5226
+ 204: {
5227
+ headers: {
5228
+ [name: string]: unknown;
5229
+ };
5230
+ content?: never;
5231
+ };
5232
+ /** @description Missing or mismatched confirmation email. */
5233
+ 400: {
5234
+ headers: {
5235
+ [name: string]: unknown;
5236
+ };
5237
+ content: {
5238
+ /**
5239
+ * @example {
5240
+ * "error": "Confirmation email does not match account email",
5241
+ * "code": "email_mismatch"
5242
+ * }
5243
+ */
5244
+ "application/json": components["schemas"]["ErrorMessageDto"];
5245
+ };
5246
+ };
5247
+ 401: components["responses"]["Unauthorized"];
5248
+ /** @description Identity conflict resolving the current user. */
5249
+ 409: {
5250
+ headers: {
5251
+ [name: string]: unknown;
5252
+ };
5253
+ content: {
5254
+ "application/json": components["schemas"]["ErrorMessageDto"];
5255
+ };
5256
+ };
5257
+ /** @description Account deletion not supported by the configured store. */
5258
+ 503: {
5259
+ headers: {
5260
+ [name: string]: unknown;
5261
+ };
5262
+ content: {
5263
+ "application/json": components["schemas"]["ErrorMessageDto"];
5264
+ };
5265
+ };
5266
+ };
5267
+ };
5116
5268
  listMyWorkspaces: {
5117
5269
  parameters: {
5118
5270
  query?: never;
@@ -5378,6 +5530,67 @@ export interface operations {
5378
5530
  };
5379
5531
  };
5380
5532
  };
5533
+ getWorkspaceOrgChartStatus: {
5534
+ parameters: {
5535
+ query?: never;
5536
+ header?: never;
5537
+ path: {
5538
+ workspaceId: components["parameters"]["WorkspaceId"];
5539
+ };
5540
+ cookie?: never;
5541
+ };
5542
+ requestBody?: never;
5543
+ responses: {
5544
+ /** @description Structure source, identity mappings, and effective chart summary */
5545
+ 200: {
5546
+ headers: {
5547
+ [name: string]: unknown;
5548
+ };
5549
+ content: {
5550
+ "application/json": components["schemas"]["OrgChartStatusDto"];
5551
+ };
5552
+ };
5553
+ 401: components["responses"]["Unauthorized"];
5554
+ 403: components["responses"]["Forbidden"];
5555
+ };
5556
+ };
5557
+ putWorkspaceOrgStructureSource: {
5558
+ parameters: {
5559
+ query?: never;
5560
+ header?: never;
5561
+ path: {
5562
+ workspaceId: components["parameters"]["WorkspaceId"];
5563
+ };
5564
+ cookie?: never;
5565
+ };
5566
+ requestBody: {
5567
+ content: {
5568
+ "application/json": components["schemas"]["OrgStructureSourceBodyDto"];
5569
+ };
5570
+ };
5571
+ responses: {
5572
+ /** @description Updated status after re-materialization */
5573
+ 200: {
5574
+ headers: {
5575
+ [name: string]: unknown;
5576
+ };
5577
+ content: {
5578
+ "application/json": components["schemas"]["OrgChartStatusDto"];
5579
+ };
5580
+ };
5581
+ /** @description Both structure caches are not available */
5582
+ 400: {
5583
+ headers: {
5584
+ [name: string]: unknown;
5585
+ };
5586
+ content: {
5587
+ "application/json": components["schemas"]["ErrorMessageDto"];
5588
+ };
5589
+ };
5590
+ 401: components["responses"]["Unauthorized"];
5591
+ 403: components["responses"]["Forbidden"];
5592
+ };
5593
+ };
5381
5594
  getTenantOrgChart: {
5382
5595
  parameters: {
5383
5596
  query?: never;