@uluops/ops-sdk 6.1.0 → 6.4.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +93 -1
  2. package/README.md +231 -2
  3. package/dist/client.d.ts +155 -81
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +141 -67
  6. package/dist/client.js.map +1 -1
  7. package/dist/config/constants.d.ts +3 -1
  8. package/dist/config/constants.d.ts.map +1 -1
  9. package/dist/config/constants.js +2 -0
  10. package/dist/config/constants.js.map +1 -1
  11. package/dist/config/generated-version.d.ts +1 -1
  12. package/dist/config/generated-version.js +1 -1
  13. package/dist/config/index.d.ts +1 -0
  14. package/dist/config/index.d.ts.map +1 -1
  15. package/dist/config/index.js +1 -0
  16. package/dist/config/index.js.map +1 -1
  17. package/dist/config/validators.d.ts +25 -1
  18. package/dist/config/validators.d.ts.map +1 -1
  19. package/dist/config/validators.js +31 -1
  20. package/dist/config/validators.js.map +1 -1
  21. package/dist/config/workspace-org.d.ts +77 -0
  22. package/dist/config/workspace-org.d.ts.map +1 -0
  23. package/dist/config/workspace-org.js +182 -0
  24. package/dist/config/workspace-org.js.map +1 -0
  25. package/dist/errors/errors.d.ts +118 -0
  26. package/dist/errors/errors.d.ts.map +1 -1
  27. package/dist/errors/errors.js +138 -0
  28. package/dist/errors/errors.js.map +1 -1
  29. package/dist/http/http-client.d.ts +46 -0
  30. package/dist/http/http-client.d.ts.map +1 -1
  31. package/dist/http/http-client.js +88 -5
  32. package/dist/http/http-client.js.map +1 -1
  33. package/dist/index.d.ts +2 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +1 -0
  36. package/dist/index.js.map +1 -1
  37. package/dist/operations/admin.d.ts +100 -0
  38. package/dist/operations/admin.d.ts.map +1 -0
  39. package/dist/operations/admin.js +130 -0
  40. package/dist/operations/admin.js.map +1 -0
  41. package/dist/operations/auth.d.ts +21 -1
  42. package/dist/operations/auth.d.ts.map +1 -1
  43. package/dist/operations/auth.js +49 -3
  44. package/dist/operations/auth.js.map +1 -1
  45. package/dist/operations/orgs.d.ts +27 -0
  46. package/dist/operations/orgs.d.ts.map +1 -0
  47. package/dist/operations/orgs.js +34 -0
  48. package/dist/operations/orgs.js.map +1 -0
  49. package/dist/operations/projects.d.ts +46 -0
  50. package/dist/operations/projects.d.ts.map +1 -1
  51. package/dist/operations/projects.js +54 -1
  52. package/dist/operations/projects.js.map +1 -1
  53. package/dist/types/auth.d.ts +10 -0
  54. package/dist/types/auth.d.ts.map +1 -1
  55. package/dist/types/index.d.ts +2 -0
  56. package/dist/types/index.d.ts.map +1 -1
  57. package/dist/types/index.js +2 -0
  58. package/dist/types/index.js.map +1 -1
  59. package/dist/types/org.d.ts +25 -0
  60. package/dist/types/org.d.ts.map +1 -0
  61. package/dist/types/org.js +2 -0
  62. package/dist/types/org.js.map +1 -0
  63. package/dist/types/rehome.d.ts +234 -0
  64. package/dist/types/rehome.d.ts.map +1 -0
  65. package/dist/types/rehome.js +171 -0
  66. package/dist/types/rehome.js.map +1 -0
  67. package/dist/types/response-schemas.d.ts +19 -0
  68. package/dist/types/response-schemas.d.ts.map +1 -1
  69. package/dist/types/response-schemas.js +19 -0
  70. package/dist/types/response-schemas.js.map +1 -1
  71. package/dist/types/schemas.d.ts +20 -0
  72. package/dist/types/schemas.d.ts.map +1 -1
  73. package/dist/types/schemas.js +22 -0
  74. package/dist/types/schemas.js.map +1 -1
  75. package/package.json +1 -1
@@ -0,0 +1,27 @@
1
+ import type { OpsHttpClient } from '../http/http-client.js';
2
+ import type { OrgAuditFeed, OrgAuditFeedQuery } from '../types/rehome.js';
3
+ /**
4
+ * The org-visible audit feed (project-org-routing-and-rehome spec D19) —
5
+ * `GET /orgs/:slug/audit-log/global`. Any MEMBER of the org may read it; the
6
+ * full audit log stays admin+ and is not wrapped here.
7
+ *
8
+ * What lands in it: rows whose writer marked `details.visibility = 'org'`.
9
+ * Today that is one class — a project leaving this org for someone's personal
10
+ * org (an org admin may do that, and the org's owner could not see it before
11
+ * D19). The re-home writer's `details` shape is `RehomeAuditDetails`; use
12
+ * `readRehomeAuditDetails(entry)` to narrow, and print anything else raw.
13
+ *
14
+ * Paging: keyset `(createdAt, id)` on `@uluops/platform` ≥ 1.28.4 — `nextCursor`
15
+ * is `<iso>|<uuid>`, opaque to callers; pass it back verbatim. `count` is the
16
+ * page size, not the total (the platform reader has no count).
17
+ *
18
+ * The slug in the PATH is the org; a client-level `orgSlug` header does not
19
+ * redirect this read (`orgContext` resolves `:slug` first).
20
+ *
21
+ * @param client - HTTP client instance
22
+ * @param slug - Org slug (the org whose feed to read — you must be a member)
23
+ * @param query - `{ cursor?, limit? }`; `limit` is 1–100 and the API answers 400 outside that range (it does not clamp)
24
+ * @returns `{ data: { entries }, count, hasMore, nextCursor }`
25
+ */
26
+ export declare function getVisibleAuditLog(client: OpsHttpClient, slug: string, query?: OrgAuditFeedQuery): Promise<OrgAuditFeed>;
27
+ //# sourceMappingURL=orgs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orgs.d.ts","sourceRoot":"","sources":["../../src/operations/orgs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG1E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,iBAAsB,GAC5B,OAAO,CAAC,YAAY,CAAC,CAWvB"}
@@ -0,0 +1,34 @@
1
+ import { OrgAuditFeedResponseSchema } from '../types/rehome.js';
2
+ /**
3
+ * The org-visible audit feed (project-org-routing-and-rehome spec D19) —
4
+ * `GET /orgs/:slug/audit-log/global`. Any MEMBER of the org may read it; the
5
+ * full audit log stays admin+ and is not wrapped here.
6
+ *
7
+ * What lands in it: rows whose writer marked `details.visibility = 'org'`.
8
+ * Today that is one class — a project leaving this org for someone's personal
9
+ * org (an org admin may do that, and the org's owner could not see it before
10
+ * D19). The re-home writer's `details` shape is `RehomeAuditDetails`; use
11
+ * `readRehomeAuditDetails(entry)` to narrow, and print anything else raw.
12
+ *
13
+ * Paging: keyset `(createdAt, id)` on `@uluops/platform` ≥ 1.28.4 — `nextCursor`
14
+ * is `<iso>|<uuid>`, opaque to callers; pass it back verbatim. `count` is the
15
+ * page size, not the total (the platform reader has no count).
16
+ *
17
+ * The slug in the PATH is the org; a client-level `orgSlug` header does not
18
+ * redirect this read (`orgContext` resolves `:slug` first).
19
+ *
20
+ * @param client - HTTP client instance
21
+ * @param slug - Org slug (the org whose feed to read — you must be a member)
22
+ * @param query - `{ cursor?, limit? }`; `limit` is 1–100 and the API answers 400 outside that range (it does not clamp)
23
+ * @returns `{ data: { entries }, count, hasMore, nextCursor }`
24
+ */
25
+ export async function getVisibleAuditLog(client, slug, query = {}) {
26
+ const params = {};
27
+ if (query.cursor !== undefined)
28
+ params['cursor'] = query.cursor;
29
+ if (query.limit !== undefined)
30
+ params['limit'] = String(query.limit);
31
+ // On GET the third argument IS the query (sdk-core `buildRequestUrl`).
32
+ return OrgAuditFeedResponseSchema.parse(await client.request('GET', `/orgs/${encodeURIComponent(slug)}/audit-log/global`, params, { rawEnvelope: true }));
33
+ }
34
+ //# sourceMappingURL=orgs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orgs.js","sourceRoot":"","sources":["../../src/operations/orgs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAqB,EACrB,IAAY,EACZ,QAA2B,EAAE;IAE7B,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAChE,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;QAAE,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrE,uEAAuE;IACvE,OAAO,0BAA0B,CAAC,KAAK,CAAC,MAAM,MAAM,CAAC,OAAO,CAC1D,KAAK,EACL,SAAS,kBAAkB,CAAC,IAAI,CAAC,mBAAmB,EACpD,MAAM,EACN,EAAE,WAAW,EAAE,IAAI,EAAE,CACtB,CAAC,CAAC;AACL,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { OpsHttpClient } from '../http/http-client.js';
2
2
  import type { Project, CreateProjectInput, UpdateProjectInput, DeleteProjectInput, RenameProjectInput, ProjectSummaryResponse, ProjectTrends, ProjectTrendsQuery, ListProjectIssuesQuery, BulkIssueStatusUpdate, BulkIssueStatusResult, MergeIssuesInput, MergeIssuesResult, MergeProjectsInput, MergeProjectsResult } from '../types/projects.js';
3
+ import type { RehomeProjectInput, RehomeResponse } from '../types/rehome.js';
3
4
  import type { Issue } from '../types/issues.js';
4
5
  import type { DeleteResult } from '../types/responses.js';
5
6
  /**
@@ -142,4 +143,49 @@ export declare function mergeIssues(client: OpsHttpClient, idOrName: string, inp
142
143
  * @returns Merge result (spec §5 shape — snake_case fields by contract)
143
144
  */
144
145
  export declare function mergeProjects(client: OpsHttpClient, input: MergeProjectsInput): Promise<MergeProjectsResult>;
146
+ /**
147
+ * Move a project to another org — the MEMBER path (project-org-routing-and-
148
+ * rehome spec §4.1, D14). The SOURCE is the caller's org context: the per-call
149
+ * `org` option (or the client `orgSlug`), never inferred from the project. A
150
+ * caller moving a project out of a work org must scope this call to that org;
151
+ * an unscoped call looks for the project in the caller's PERSONAL org and 404s.
152
+ * Authority: `admin`/`owner` in both orgs (§4.2); a personal-org TARGET only
153
+ * when the caller is that person (C6).
154
+ *
155
+ * After the move the old `(org, name)` address is a tombstone: an org-less
156
+ * write naming the project there gets `410 PROJECT_REHOMED` naming the target
157
+ * (`isProjectRehomedError`), not a forked new project. The move is reversible
158
+ * by moving back (a reversal annihilates the tombstone).
159
+ *
160
+ * Refusals (`rehomeRefusalReason(err)` reads the enumerated ones): 400
161
+ * `same_org` | `project_has_no_org`; 403 INSUFFICIENT_ORG_ROLE (source) |
162
+ * ORG_ACCESS_DENIED (target membership or personal target, C6) | ORG_SUSPENDED
163
+ * (C3); 402 PROJECT_LIMIT (target cap, C2); 409 `name_collision` |
164
+ * `soft_deleted_conflict` | `rehomed_away_conflict` (C1/C7) | `export_in_progress`
165
+ * (C4) | `moved_during_request` | MERGE_LOCK_UNAVAILABLE (details.retry_after_seconds;
166
+ * the SDK does NOT auto-retry).
167
+ *
168
+ * **Re-runs and lost responses.** The lookup is SOURCE-scoped, so after the
169
+ * move the same call (same source, same name) does not answer `same_org` — it
170
+ * answers 404 (by name, the address is now a tombstone; by id, the project is
171
+ * no longer in that org). `same_org` is the idempotence signal of the ADMIN
172
+ * path, whose lookup is by id and unscoped. If a member-path call times out
173
+ * or the response is lost, do not retry blind: read the project with
174
+ * `{ org: targetOrg }` (or check `admin.listProjectRehomeEvents` if you can) —
175
+ * a hit there means the move landed.
176
+ *
177
+ * @param client - HTTP client instance (scope it to the source org)
178
+ * @param idOrName - Project UUID or name, resolved in the source org
179
+ * @param input - `{ targetOrg, reason? }`
180
+ * @returns The project after the move (`orgId` is the target) plus `rehome.{from_org,to_org,audit_ids}`
181
+ * @throws {InputValidationError} If `targetOrg` is not a slug or `reason` is empty / over 500 chars
182
+ * @example
183
+ * ```typescript
184
+ * // the project lives in org "acme" → name the source; the target is the input
185
+ * const moved = await client.projects.rehome('billing', { targetOrg: 'ulu-labs', reason: 'team took it over' }, { org: 'acme' });
186
+ * moved.rehome.from_org.slug; // 'acme'
187
+ * moved.rehome.to_org.slug; // 'ulu-labs'
188
+ * ```
189
+ */
190
+ export declare function rehome(client: OpsHttpClient, idOrName: string, input: RehomeProjectInput): Promise<RehomeResponse>;
145
191
  //# sourceMappingURL=projects.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/operations/projects.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,KAAK,EACV,OAAO,EACP,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAoB1D;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAO7F;AAED;;;;;;;GAOG;AACH,wBAAsB,GAAG,CACvB,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CAElB;AAED;;;;;;;;GAQG;AACH,wBAAsB,MAAM,CAC1B,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAC1B,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,aAAa,EACrB,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C,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,qBAAqB,EAAE,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CAKhC;AAED;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,iBAAiB,CAAC,CAS5B;AAED;;;;;;;;;;;;;;;GAeG;AAGH,wBAAsB,aAAa,CACjC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAY9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAsB,MAAM,CAC1B,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,cAAc,CAAC,CASzB"}
@@ -1,7 +1,8 @@
1
1
  import { z } from 'zod';
2
2
  import { toApiQuery } from '../http/http-client.js';
3
+ import { RehomeResponseSchema } from '../types/rehome.js';
3
4
  import { ProjectResponseSchema, ProjectSummaryResponseSchema, ProjectTrendsResponseSchema, IssueResponseSchema, BulkStatusUpdateResultResponseSchema, MergeIssuesResultResponseSchema, MergeProjectsResultResponseSchema, DeleteResultResponseSchema, } from '../types/response-schemas.js';
4
- import { validateCreateProjectInput, validateUpdateProjectInput, validateDeleteProjectInput, validateRenameProjectInput, validateMergeProjectsInput, } from '../config/validators.js';
5
+ import { validateCreateProjectInput, validateUpdateProjectInput, validateDeleteProjectInput, validateRenameProjectInput, validateMergeProjectsInput, validateRehomeProjectInput, } from '../config/validators.js';
5
6
  import { buildIssueListParams } from './query-utils.js';
6
7
  /**
7
8
  * List all projects accessible to the current user.
@@ -214,4 +215,56 @@ export async function mergeProjects(client, input) {
214
215
  confirmCrossOrg: input.confirmCrossOrg,
215
216
  }));
216
217
  }
218
+ /**
219
+ * Move a project to another org — the MEMBER path (project-org-routing-and-
220
+ * rehome spec §4.1, D14). The SOURCE is the caller's org context: the per-call
221
+ * `org` option (or the client `orgSlug`), never inferred from the project. A
222
+ * caller moving a project out of a work org must scope this call to that org;
223
+ * an unscoped call looks for the project in the caller's PERSONAL org and 404s.
224
+ * Authority: `admin`/`owner` in both orgs (§4.2); a personal-org TARGET only
225
+ * when the caller is that person (C6).
226
+ *
227
+ * After the move the old `(org, name)` address is a tombstone: an org-less
228
+ * write naming the project there gets `410 PROJECT_REHOMED` naming the target
229
+ * (`isProjectRehomedError`), not a forked new project. The move is reversible
230
+ * by moving back (a reversal annihilates the tombstone).
231
+ *
232
+ * Refusals (`rehomeRefusalReason(err)` reads the enumerated ones): 400
233
+ * `same_org` | `project_has_no_org`; 403 INSUFFICIENT_ORG_ROLE (source) |
234
+ * ORG_ACCESS_DENIED (target membership or personal target, C6) | ORG_SUSPENDED
235
+ * (C3); 402 PROJECT_LIMIT (target cap, C2); 409 `name_collision` |
236
+ * `soft_deleted_conflict` | `rehomed_away_conflict` (C1/C7) | `export_in_progress`
237
+ * (C4) | `moved_during_request` | MERGE_LOCK_UNAVAILABLE (details.retry_after_seconds;
238
+ * the SDK does NOT auto-retry).
239
+ *
240
+ * **Re-runs and lost responses.** The lookup is SOURCE-scoped, so after the
241
+ * move the same call (same source, same name) does not answer `same_org` — it
242
+ * answers 404 (by name, the address is now a tombstone; by id, the project is
243
+ * no longer in that org). `same_org` is the idempotence signal of the ADMIN
244
+ * path, whose lookup is by id and unscoped. If a member-path call times out
245
+ * or the response is lost, do not retry blind: read the project with
246
+ * `{ org: targetOrg }` (or check `admin.listProjectRehomeEvents` if you can) —
247
+ * a hit there means the move landed.
248
+ *
249
+ * @param client - HTTP client instance (scope it to the source org)
250
+ * @param idOrName - Project UUID or name, resolved in the source org
251
+ * @param input - `{ targetOrg, reason? }`
252
+ * @returns The project after the move (`orgId` is the target) plus `rehome.{from_org,to_org,audit_ids}`
253
+ * @throws {InputValidationError} If `targetOrg` is not a slug or `reason` is empty / over 500 chars
254
+ * @example
255
+ * ```typescript
256
+ * // the project lives in org "acme" → name the source; the target is the input
257
+ * const moved = await client.projects.rehome('billing', { targetOrg: 'ulu-labs', reason: 'team took it over' }, { org: 'acme' });
258
+ * moved.rehome.from_org.slug; // 'acme'
259
+ * moved.rehome.to_org.slug; // 'ulu-labs'
260
+ * ```
261
+ */
262
+ export async function rehome(client, idOrName, input) {
263
+ const valid = validateRehomeProjectInput(input);
264
+ return RehomeResponseSchema.parse(await client.post(`/projects/${encodeURIComponent(idOrName)}/rehome`,
265
+ // The API body is `.strict()` (a typo'd key is a 400, not a stripped one),
266
+ // so only the two contract fields go on the wire, and `reason` is omitted
267
+ // rather than sent as undefined/null.
268
+ { target_org: valid.targetOrg, ...(valid.reason !== undefined ? { reason: valid.reason } : {}) }));
269
+ }
217
270
  //# sourceMappingURL=projects.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/operations/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAoBpD,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,2BAA2B,EAC3B,mBAAmB,EACnB,oCAAoC,EACpC,+BAA+B,EAC/B,iCAAiC,EACjC,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,0BAA0B,EAC1B,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,MAAqB;IAC9C,qEAAqE;IACrE,uEAAuE;IACvE,OAAO,CAAC,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,CAAC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AAE,KAAK,CAAC,eAAe;KACvC,CACF,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,MAAqB,EACrB,QAAgB,EAChB,KAAyB;IAEzB,MAAM,KAAK,GAAG,0BAA0B,CAAC,KAAK,CAAC,CAAC;IAChD,OAAO,oBAAoB,CAAC,KAAK,CAAC,MAAM,MAAM,CAAC,IAAI,CACjD,aAAa,kBAAkB,CAAC,QAAQ,CAAC,SAAS;IAClD,2EAA2E;IAC3E,0EAA0E;IAC1E,sCAAsC;IACtC,EAAE,UAAU,EAAE,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CACjG,CAAC,CAAC;AACL,CAAC"}
@@ -48,6 +48,16 @@ export interface LoginInput {
48
48
  email: string;
49
49
  password: string;
50
50
  }
51
+ /**
52
+ * TOTP completion of an MFA-challenged login (`POST /auth/totp/login`).
53
+ * `mfaChallengeToken` comes from the {@link MfaRequiredError} the first login threw.
54
+ */
55
+ export interface TotpLoginInput {
56
+ mfaChallengeToken: string;
57
+ /** Six digits. */
58
+ code: string;
59
+ rememberMe?: boolean;
60
+ }
51
61
  /**
52
62
  * Profile update input
53
63
  */
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/types/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2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,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B"}
@@ -1,5 +1,7 @@
1
1
  export * from './enums.js';
2
2
  export * from './auth.js';
3
+ export * from './org.js';
4
+ export * from './rehome.js';
3
5
  export * from './projects.js';
4
6
  export * from './runs.js';
5
7
  export * from './issues.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAG3B,cAAc,WAAW,CAAC;AAG1B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAG3B,cAAc,WAAW,CAAC;AAG1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,cAAc,CAAC"}
@@ -3,6 +3,8 @@ export * from './enums.js';
3
3
  // Auth types
4
4
  export * from './auth.js';
5
5
  // Domain types
6
+ export * from './org.js';
7
+ export * from './rehome.js';
6
8
  export * from './projects.js';
7
9
  export * from './runs.js';
8
10
  export * from './issues.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,YAAY,CAAC;AAE3B,aAAa;AACb,cAAc,WAAW,CAAC;AAE1B,eAAe;AACf,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAE/B,iBAAiB;AACjB,cAAc,gBAAgB,CAAC;AAE/B,iCAAiC;AACjC,cAAc,cAAc,CAAC;AAE7B,qGAAqG"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,YAAY,CAAC;AAE3B,aAAa;AACb,cAAc,WAAW,CAAC;AAE1B,eAAe;AACf,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAE/B,iBAAiB;AACjB,cAAc,gBAAgB,CAAC;AAE/B,iCAAiC;AACjC,cAAc,cAAc,CAAC;AAE7B,qGAAqG"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Org scoping for a single call (project-org-routing-and-rehome spec §3.2, D12).
3
+ *
4
+ * Every project, run, issue and analytics operation accepts this as its last
5
+ * argument. `org` is the target org's slug and becomes the `X-Org-Slug`
6
+ * header on that one request, overriding the client-level `orgSlug`.
7
+ *
8
+ * Omit it to use the client's `orgSlug`, or — with neither — the key-holder's
9
+ * personal org. The API never infers an org from a project name (spec D2):
10
+ * a request that names no org creates or targets the PERSONAL project of that
11
+ * name, even when a work org has a project by the same name. Name the org.
12
+ */
13
+ export interface OrgScopedOptions {
14
+ /** Org slug (1–100 chars: alphanumeric, hyphen, underscore). */
15
+ org?: string;
16
+ }
17
+ /** Run write/preview options: client-side validation escape hatch + org scope. */
18
+ export interface RunCallOptions extends OrgScopedOptions {
19
+ /**
20
+ * Skip the SDK's input validation. A convenience escape for pre-validated
21
+ * callers (MCP, autosave hooks); the server validates regardless.
22
+ */
23
+ _skipClientValidation?: boolean;
24
+ }
25
+ //# sourceMappingURL=org.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org.d.ts","sourceRoot":"","sources":["../../src/types/org.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gEAAgE;IAChE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,kFAAkF;AAClF,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=org.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org.js","sourceRoot":"","sources":["../../src/types/org.ts"],"names":[],"mappings":""}
@@ -0,0 +1,234 @@
1
+ /**
2
+ * Project re-home types (project-org-routing-and-rehome spec §4, D14/D19/D21).
3
+ *
4
+ * Three surfaces, three audiences, deliberately NOT one namespace:
5
+ *
6
+ * - `projects.rehome()` — the MEMBER path. Moves one project out of the
7
+ * caller's org context (the `org` option, or the client `orgSlug`) into
8
+ * another org the caller administers. This is the product capability.
9
+ * - `orgs.getVisibleAuditLog()` — the D19 FEED. Any member of an org can
10
+ * read the rows its writers marked org-visible; today that is a project
11
+ * leaving the org for someone's personal org.
12
+ * - `admin.*` — the platform-admin surface behind D20: session-only writes
13
+ * (a `ulr_` key gets `403 SESSION_REQUIRED`), plus the two key-readable
14
+ * ledgers. The Phase 4 migration script is the intended caller; an MCP tool
15
+ * deliberately does not exist for these.
16
+ *
17
+ * Wire casing is mixed BY CONTRACT and the schemas below pin it rather than
18
+ * normalise it: the re-home block (`from_org`, `to_org`, `audit_ids`) and the
19
+ * audit-row `details` are snake_case (spec §4.1 declares them so, and the
20
+ * details are written by the API as an opaque JSON blob the platform stores
21
+ * verbatim); the tombstone and ledger rows are camelCase business objects like
22
+ * every other read in this SDK. Normalising one side would make the SDK's
23
+ * types disagree with the curl a reader uses to check them.
24
+ */
25
+ import { z } from 'zod';
26
+ /** Member path input. `targetOrg` is the slug; `reason` is optional here and REQUIRED on the admin path. */
27
+ export interface RehomeProjectInput {
28
+ /** Slug of the org the project should live in after the move. */
29
+ targetOrg: string;
30
+ /** Operator-authored free text, ≤ 500 chars. Stored on the tombstone; never rendered into an error. */
31
+ reason?: string;
32
+ }
33
+ /** Admin path input — same body, `reason` mandatory (spec §4.1, ratified 2026-09-13). */
34
+ export interface AdminRehomeProjectInput {
35
+ targetOrg: string;
36
+ /** Required: on the admin path the target org's only standing is the audit row plus this text. */
37
+ reason: string;
38
+ }
39
+ /** Filters for the reservation listing and the ledger. `org` accepts a UUID OR a slug (the API resolves either). */
40
+ export interface ProjectRehomeListQuery {
41
+ projectId?: string;
42
+ org?: string;
43
+ /** ISO 8601 lower bound on `createdAt`. */
44
+ since?: string;
45
+ /** 1–500. The API clamps; the reservation listing defaults to its own page size, the ledger to 100. */
46
+ limit?: number;
47
+ }
48
+ /** Ledger filters add the event kind and the `seq` cursor (pass `nextCursor` back verbatim). */
49
+ export interface ProjectRehomeEventListQuery extends ProjectRehomeListQuery {
50
+ event?: ProjectRehomeEventKind;
51
+ cursor?: string;
52
+ }
53
+ /** D19 feed paging. `cursor` is opaque — pass a prior page's `nextCursor` back verbatim. */
54
+ export interface OrgAuditFeedQuery {
55
+ cursor?: string;
56
+ /** 1–100. The API does NOT clamp: a value outside the range is a 400 (`OrgVisibleAuditLogQuery`, `.min(1).max(100)`). */
57
+ limit?: number;
58
+ }
59
+ /** `{ id, slug }` — both, because slugs retire on org deletion and ids are opaque to a reader (spec §4.1). */
60
+ export declare const OrgRefSchema: z.ZodObject<{
61
+ id: z.ZodString;
62
+ slug: z.ZodString;
63
+ }, z.core.$strip>;
64
+ export type OrgRef = z.infer<typeof OrgRefSchema>;
65
+ /**
66
+ * `POST /projects/:id/rehome` and its admin twin. The project read projection
67
+ * after the move (its `orgId` is the target) plus the re-home block.
68
+ *
69
+ * `audit_ids` is `[]` today: the platform ACL's `writeAuditLog` returns void,
70
+ * so there are no ids to hand back, and the API reports the field empty rather
71
+ * than omitting it because it is in the contract. The durable record is the
72
+ * ledger (`admin.listProjectRehomeEvents`), not this array.
73
+ */
74
+ export declare const RehomeResponseSchema: z.ZodObject<{
75
+ id: z.ZodString;
76
+ name: z.ZodString;
77
+ domain: z.ZodOptional<z.ZodString>;
78
+ ownerId: z.ZodString;
79
+ orgId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
80
+ createdAt: z.ZodUnion<[z.ZodString, z.ZodString]>;
81
+ updatedAt: z.ZodUnion<[z.ZodString, z.ZodString]>;
82
+ rehome: z.ZodObject<{
83
+ from_org: z.ZodObject<{
84
+ id: z.ZodString;
85
+ slug: z.ZodString;
86
+ }, z.core.$strip>;
87
+ to_org: z.ZodObject<{
88
+ id: z.ZodString;
89
+ slug: z.ZodString;
90
+ }, z.core.$strip>;
91
+ audit_ids: z.ZodArray<z.ZodString>;
92
+ }, z.core.$strip>;
93
+ }, z.core.$strip>;
94
+ export type RehomeResponse = z.infer<typeof RehomeResponseSchema>;
95
+ /**
96
+ * A reservation (tombstone) row — `GET /admin/projects/rehomes`. One per
97
+ * vacated `(sourceOrgId, name)` address, pointing at where the project lives
98
+ * now. A reversal ANNIHILATES (A→B→A leaves no row), a release deletes; this
99
+ * listing is therefore the current redirect table, not the history — the
100
+ * history is {@link ProjectRehomeEventSchema}.
101
+ */
102
+ export declare const ProjectRehomeSchema: z.ZodObject<{
103
+ id: z.ZodString;
104
+ sourceOrgId: z.ZodString;
105
+ name: z.ZodString;
106
+ projectId: z.ZodString;
107
+ targetOrgId: z.ZodString;
108
+ actorId: z.ZodNullable<z.ZodString>;
109
+ reason: z.ZodNullable<z.ZodString>;
110
+ createdAt: z.ZodUnion<[z.ZodString, z.ZodString]>;
111
+ }, z.core.$strip>;
112
+ export type ProjectRehome = z.infer<typeof ProjectRehomeSchema>;
113
+ /**
114
+ * Ledger event kinds (D21). Server-controlled and additive, so the schema
115
+ * accepts any string — the six known values are exported for callers that
116
+ * branch, and a seventh must not turn a successful read into a client outage
117
+ * (the `mergeProjects` conflict-kind lesson).
118
+ */
119
+ export declare const PROJECT_REHOME_EVENT_KINDS: readonly ["moved", "repointed", "annihilated", "degenerate_dropped", "released", "hard_deleted"];
120
+ export type ProjectRehomeEventKind = (typeof PROJECT_REHOME_EVENT_KINDS)[number];
121
+ /** An append-only ledger row — `GET /admin/projects/rehome-events`. Nothing the API offers removes one. */
122
+ export declare const ProjectRehomeEventSchema: z.ZodObject<{
123
+ id: z.ZodString;
124
+ seq: z.ZodNumber;
125
+ event: z.ZodString;
126
+ projectId: z.ZodString;
127
+ projectName: z.ZodString;
128
+ fromOrgId: z.ZodNullable<z.ZodString>;
129
+ toOrgId: z.ZodNullable<z.ZodString>;
130
+ addressName: z.ZodNullable<z.ZodString>;
131
+ tombstoneId: z.ZodNullable<z.ZodString>;
132
+ actorId: z.ZodNullable<z.ZodString>;
133
+ viaAdminPath: z.ZodBoolean;
134
+ reason: z.ZodNullable<z.ZodString>;
135
+ cause: z.ZodNullable<z.ZodString>;
136
+ createdAt: z.ZodUnion<[z.ZodString, z.ZodString]>;
137
+ }, z.core.$strip>;
138
+ export type ProjectRehomeEvent = z.infer<typeof ProjectRehomeEventSchema>;
139
+ /** Reservation listing envelope. `total` is the MATCHING count, `returned` the page — they differ once paged. */
140
+ export declare const ProjectRehomeListResponseSchema: z.ZodObject<{
141
+ data: z.ZodArray<z.ZodObject<{
142
+ id: z.ZodString;
143
+ sourceOrgId: z.ZodString;
144
+ name: z.ZodString;
145
+ projectId: z.ZodString;
146
+ targetOrgId: z.ZodString;
147
+ actorId: z.ZodNullable<z.ZodString>;
148
+ reason: z.ZodNullable<z.ZodString>;
149
+ createdAt: z.ZodUnion<[z.ZodString, z.ZodString]>;
150
+ }, z.core.$strip>>;
151
+ total: z.ZodNumber;
152
+ returned: z.ZodNumber;
153
+ }, z.core.$strip>;
154
+ export type ProjectRehomeList = z.infer<typeof ProjectRehomeListResponseSchema>;
155
+ /** Ledger envelope — keyset-paged by `seq`; `nextCursor` is null on the last page. */
156
+ export declare const ProjectRehomeEventListResponseSchema: z.ZodObject<{
157
+ total: z.ZodNumber;
158
+ returned: z.ZodNumber;
159
+ data: z.ZodArray<z.ZodObject<{
160
+ id: z.ZodString;
161
+ seq: z.ZodNumber;
162
+ event: z.ZodString;
163
+ projectId: z.ZodString;
164
+ projectName: z.ZodString;
165
+ fromOrgId: z.ZodNullable<z.ZodString>;
166
+ toOrgId: z.ZodNullable<z.ZodString>;
167
+ addressName: z.ZodNullable<z.ZodString>;
168
+ tombstoneId: z.ZodNullable<z.ZodString>;
169
+ actorId: z.ZodNullable<z.ZodString>;
170
+ viaAdminPath: z.ZodBoolean;
171
+ reason: z.ZodNullable<z.ZodString>;
172
+ cause: z.ZodNullable<z.ZodString>;
173
+ createdAt: z.ZodUnion<[z.ZodString, z.ZodString]>;
174
+ }, z.core.$strip>>;
175
+ hasMore: z.ZodBoolean;
176
+ nextCursor: z.ZodNullable<z.ZodString>;
177
+ }, z.core.$strip>;
178
+ export type ProjectRehomeEventList = z.infer<typeof ProjectRehomeEventListResponseSchema>;
179
+ /**
180
+ * One row of the D19 feed (`GET /orgs/:slug/audit-log/global`). `action` is
181
+ * the platform's closed ENUM (`org.updated` for every re-home fact); the real
182
+ * event is `details.action` — see {@link RehomeAuditDetails} for the shape the
183
+ * re-home writer produces. `details` is typed loosely on purpose: other
184
+ * writers may mark rows org-visible with other shapes.
185
+ */
186
+ export declare const OrgAuditEntrySchema: z.ZodObject<{
187
+ id: z.ZodString;
188
+ actorId: z.ZodNullable<z.ZodString>;
189
+ action: z.ZodString;
190
+ details: z.ZodRecord<z.ZodString, z.ZodUnknown>;
191
+ createdAt: z.ZodUnion<[z.ZodString, z.ZodString]>;
192
+ }, z.core.$strip>;
193
+ export type OrgAuditEntry = z.infer<typeof OrgAuditEntrySchema>;
194
+ export declare const OrgAuditFeedResponseSchema: z.ZodObject<{
195
+ data: z.ZodObject<{
196
+ entries: z.ZodArray<z.ZodObject<{
197
+ id: z.ZodString;
198
+ actorId: z.ZodNullable<z.ZodString>;
199
+ action: z.ZodString;
200
+ details: z.ZodRecord<z.ZodString, z.ZodUnknown>;
201
+ createdAt: z.ZodUnion<[z.ZodString, z.ZodString]>;
202
+ }, z.core.$strip>>;
203
+ }, z.core.$strip>;
204
+ count: z.ZodNumber;
205
+ hasMore: z.ZodBoolean;
206
+ nextCursor: z.ZodNullable<z.ZodString>;
207
+ }, z.core.$strip>;
208
+ export type OrgAuditFeed = z.infer<typeof OrgAuditFeedResponseSchema>;
209
+ /**
210
+ * The `details` blob the re-home writer puts on its audit rows (both the
211
+ * `rehome_out` row on the source org and the `rehome_in` row on the target).
212
+ * Read it with {@link readRehomeAuditDetails}, which returns `null` for rows
213
+ * written by anything else.
214
+ */
215
+ export interface RehomeAuditDetails {
216
+ source: 'project_rehome';
217
+ action: 'project.rehome_out' | 'project.rehome_in' | (string & {});
218
+ project_id: string;
219
+ project_name: string;
220
+ from_org: OrgRef;
221
+ to_org: OrgRef;
222
+ actor: string | null;
223
+ reason: string | null;
224
+ via_admin_path: boolean;
225
+ to_personal_org: boolean;
226
+ visibility: 'org' | 'admin' | (string & {});
227
+ }
228
+ /**
229
+ * Narrow a feed entry's `details` to the re-home writer's shape, or `null`.
230
+ * A renderer branches on this: a non-null result is a project move it can
231
+ * describe in one line; null is some other org-visible fact to print raw.
232
+ */
233
+ export declare function readRehomeAuditDetails(entry: Pick<OrgAuditEntry, 'details'>): RehomeAuditDetails | null;
234
+ //# sourceMappingURL=rehome.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rehome.d.ts","sourceRoot":"","sources":["../../src/types/rehome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,4GAA4G;AAC5G,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB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