@cesar-richard/git-connector-sdk 2.5.0 → 2.7.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.
- package/README.md +76 -2
- package/dist/schema.d.ts +1125 -35
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -354,7 +354,26 @@ for (const wi of data.items) {
|
|
|
354
354
|
|
|
355
355
|
## API surface
|
|
356
356
|
|
|
357
|
-
The `/v1/*` API exposes these resources: work items, iterations, work-item details, the unified events stream, raw activities, deliverables, and per-project delivery rules.
|
|
357
|
+
The `/v1/*` API exposes these resources: tracked projects, work items, iterations, work-item details, the unified events stream (polled or server-sent), raw activities, deliverables, and per-project delivery rules.
|
|
358
|
+
|
|
359
|
+
### `GET /v1/projects` — list tracked projects
|
|
360
|
+
|
|
361
|
+
Every project the operator tracks, sorted by `(source, projectKey)`.
|
|
362
|
+
|
|
363
|
+
```ts
|
|
364
|
+
const { data } = await client.GET("/v1/projects");
|
|
365
|
+
// data: { projects: { source, projectKey, name, webUrl, lastSyncedAt }[] }
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
This is the **only correct way** to enumerate projects. Deriving the list by
|
|
369
|
+
paginating `/v1/work-items` or `/v1/activities` and deduplicating
|
|
370
|
+
`(source, projectKey)` is wrong by construction: a tracked project with no
|
|
371
|
+
activity in the window read is invisible that way, so it can never be configured
|
|
372
|
+
downstream. `lastSyncedAt` is `null` when the project has never completed a sync
|
|
373
|
+
— that means *never ingested*, not *quiet*.
|
|
374
|
+
|
|
375
|
+
Pair `source` + `projectKey` to call
|
|
376
|
+
`GET /v1/projects/{source}/{projectKey}/labels`.
|
|
358
377
|
|
|
359
378
|
### `GET /v1/work-items` — list aggregated work items
|
|
360
379
|
|
|
@@ -373,7 +392,24 @@ const { data } = await client.GET("/v1/work-items", {
|
|
|
373
392
|
// data: { items: WorkItem[]; total: number; limit: number }
|
|
374
393
|
```
|
|
375
394
|
|
|
376
|
-
Each `WorkItem` includes its `linkedActivities` (PRs/MRs with full enrichment: reviews summary, unresolved threads, volume, status history, reviewRequestedAt, mergedAt).
|
|
395
|
+
Each `WorkItem` includes its `linkedActivities` (PRs/MRs with full enrichment: reviews summary, unresolved threads, volume, status history, reviewRequestedAt, mergedAt, and the current CI status).
|
|
396
|
+
|
|
397
|
+
#### `linkedActivities[].ci` — current CI status
|
|
398
|
+
|
|
399
|
+
The latest known CI **pipeline** for that PR/MR (not per-job `ci-run`), always
|
|
400
|
+
computed on both the list and the detail route:
|
|
401
|
+
|
|
402
|
+
```ts
|
|
403
|
+
ci?: {
|
|
404
|
+
status: "success" | "failed" | "running" | "canceled" | "unknown";
|
|
405
|
+
url: string | null;
|
|
406
|
+
finishedAt: string | null;
|
|
407
|
+
} | null
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
`null` means *no pipeline is known* — never read it as "green". Together with
|
|
411
|
+
`hasConflicts`, `reviews` and `unresolvedThreads`, `status: "failed"` is the
|
|
412
|
+
fourth signal for rendering a work item as blocked.
|
|
377
413
|
|
|
378
414
|
### `GET /v1/work-items/{source}/{projectKey}/{number}` — detail
|
|
379
415
|
|
|
@@ -426,6 +462,44 @@ Event types in the stream:
|
|
|
426
462
|
| `review` | GH PR review / GL MR approval | resolves to PR/MR | `state`, `reviewer` |
|
|
427
463
|
| `state-transition` | Derived from activity state diff | resolves to PR/MR/issue | `from`, `to` |
|
|
428
464
|
| `ci-run` | GH Actions job / GL pipeline job | resolves to PR/MR via head SHA | `runId`, `jobName`, `conclusion`, `durationSec`, `sha`, `branch` |
|
|
465
|
+
| `ci-pipeline` | GH Actions run / GL pipeline | resolves to PR/MR via head SHA | `runId`, `conclusion`, `status`, `durationSec`, `sha`, `branch` |
|
|
466
|
+
|
|
467
|
+
#### Fetching one activity's events — `?parentActivityId`
|
|
468
|
+
|
|
469
|
+
Pass `parentActivityId` (CSV for several) to get every event attached to a PR/MR
|
|
470
|
+
— commits, pipelines, comments — without guessing a date window. **When this
|
|
471
|
+
filter is given, `from`/`to` become optional**, and omitting them is usually what
|
|
472
|
+
you want: a window silently drops anything older than it, which for a CI pipeline
|
|
473
|
+
means reading "no pipeline" where there is a red one.
|
|
474
|
+
|
|
475
|
+
```ts
|
|
476
|
+
const { data } = await client.GET("/v1/events", {
|
|
477
|
+
params: {
|
|
478
|
+
query: {
|
|
479
|
+
parentActivityId: "github:acme/web:pr:42,github:acme/web:pr:43",
|
|
480
|
+
type: "ci-pipeline",
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
});
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
### `GET /v1/events/stream` — server-sent events
|
|
487
|
+
|
|
488
|
+
SSE on the consumer scope, authenticated with the same `gck_` Bearer token. It
|
|
489
|
+
emits `events.ingested` frames only — operator-scope traffic (sync progress,
|
|
490
|
+
config changes, provider-auth staleness) never crosses this boundary. A `:ping`
|
|
491
|
+
comment every 30 s keeps proxies from dropping the socket.
|
|
492
|
+
|
|
493
|
+
```ts
|
|
494
|
+
const res = await fetch(`${baseUrl}/v1/events/stream`, {
|
|
495
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
496
|
+
});
|
|
497
|
+
// text/event-stream: `event: events.ingested` frames whose data is
|
|
498
|
+
// { type: "events.ingested", payload: { events: GitEvent[] } }
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
Polling `GET /v1/events?since=<ISO>` stays the simpler option and is cheap enough
|
|
502
|
+
for most consumers; reach for the stream when you want push latency.
|
|
429
503
|
|
|
430
504
|
### `GET /v1/deliverables` — classified deliverables of a window
|
|
431
505
|
|