@compforge/harness-common 0.5.7 → 0.5.8

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,5 +1,5 @@
1
1
  import type { Identity } from "../identity.js";
2
- import { type Repository } from "./repository.js";
2
+ import { type Repository, type RepositoryKey, type RepositorySnapshot } from "./repository.js";
3
3
  export type PullRequestState = "open" | "merged" | "closed";
4
4
  /**
5
5
  * A code-review proposal owned by its target Repository (GitHub PR or GitLab MR).
@@ -23,5 +23,19 @@ export interface PullRequest extends Identity {
23
23
  readonly updatedAt?: string;
24
24
  readonly mergedAt?: string;
25
25
  }
26
+ /** The target Repository and its local PR number / MR iid; no methods or observation facts are required. */
27
+ export interface PullRequestKey {
28
+ readonly repository: RepositoryKey;
29
+ readonly number: PullRequest["number"];
30
+ }
31
+ /**
32
+ * @spec A PR snapshot retains the common field names and optional facts, without PR or nested Repository identity methods.
33
+ * @why JSON and remote observations must not require each consumer to invent a parallel PR shape or reconstruct methods.
34
+ * @see {@link component://docs/pull-request.md}
35
+ */
36
+ export type PullRequestSnapshot = Omit<PullRequest, "id" | "repository" | "sourceRepository"> & {
37
+ readonly repository: RepositorySnapshot;
38
+ readonly sourceRepository?: RepositorySnapshot;
39
+ };
26
40
  /** Derive identity from fields; never trust a consumer's display URL or repository id method. */
27
- export declare function pullRequestId(pr: Pick<PullRequest, "repository" | "number">): string;
41
+ export declare function pullRequestId<T extends PullRequestKey>(pr: T): string;
@@ -14,8 +14,12 @@ export interface Repository extends Identity {
14
14
  */
15
15
  readonly forkedFrom?: string | null;
16
16
  }
17
+ /** Identity fields usable without constructing an in-process Repository. */
18
+ export type RepositoryKey = Pick<Repository, "forge" | "path">;
19
+ /** Repository facts carried by JSON, storage and remote observations; identity methods are not data. */
20
+ export type RepositorySnapshot = Omit<Repository, "id">;
17
21
  /**
18
22
  * Derive the Repository.id() value from identity fields.
19
23
  * @spec Repository identity is forge.name/path; fork provenance is excluded.
20
24
  */
21
- export declare function repositoryId(repository: Pick<Repository, "forge" | "path">): string;
25
+ export declare function repositoryId(repository: RepositoryKey): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compforge/harness-common",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "description": "Execution-neutral client lifecycle and datasource contracts for harnesses",
5
5
  "type": "module",
6
6
  "scripts": {