@chisquare-tech/origine-ngx-apps-code 0.11.3 → 0.13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chisquare-tech/origine-ngx-apps-code",
3
- "version": "0.11.3",
3
+ "version": "0.13.0",
4
4
  "description": "Origine's Code module screens: repositories, files, commits, branches, pull requests and review, repository settings.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -2,6 +2,7 @@ import * as _angular_core from '@angular/core';
2
2
  import { Signal, AfterViewInit } from '@angular/core';
3
3
  import { Observable } from 'rxjs';
4
4
  import { ActivatedRoute } from '@angular/router';
5
+ import { SafeResourceUrl } from '@angular/platform-browser';
5
6
  import * as _chisquare_tech_origine_ngx_apps_code from '@chisquare-tech/origine-ngx-apps-code';
6
7
 
7
8
  /** A person in the organization, as the host knows them (identity's members). */
@@ -15,7 +16,7 @@ interface CodeProject {
15
16
  id: string;
16
17
  key: string;
17
18
  name: string;
18
- /** The caller's capabilities on the project: code.write, protection.manage, resources.manage… */
19
+ /** The caller's coarse capabilities on the project, from before V4-01. Screens ask can(id). */
19
20
  capabilities: string[];
20
21
  archivedAt?: string;
21
22
  }
@@ -28,6 +29,11 @@ declare abstract class CodeHost {
28
29
  abstract readonly projectLoaded: Signal<boolean>;
29
30
  abstract readonly people: Signal<CodePerson[]>;
30
31
  abstract meId(): string;
32
+ /**
33
+ * Whether the caller holds capability id on the project (V4-01): code.push, code.repo.create…
34
+ * Screens of one repository ask the repository's own caps instead, which add a collaborator row.
35
+ */
36
+ abstract can(id: string, env?: 'protected' | 'unprotected'): boolean;
31
37
  /** A router link to a path inside the current project ('' is its overview). */
32
38
  abstract link(path?: string): string[];
33
39
  }
@@ -52,13 +58,67 @@ interface Repo {
52
58
  cloneHttps: string;
53
59
  cloneSsh: string;
54
60
  empty: boolean;
61
+ /** Coarse capabilities, from before V4-01; screens read caps. */
55
62
  capabilities: string[];
63
+ /** The code capability ids the caller holds on this repository, a collaborator row included (V4-01). */
64
+ caps?: string[];
56
65
  readOnly?: boolean;
57
66
  /** Pull requests can be armed to merge once the gate passes (DEV-25). */
58
67
  allowAutoMerge?: boolean;
59
68
  /** The caller's collaborator permission on this repository (read, write or maintain), if any. */
60
69
  collaborator?: string;
61
70
  createdAt?: string;
71
+ /** The repository is a pull mirror of its import source, read-only for pushes (V6-01). */
72
+ mirror?: boolean;
73
+ }
74
+ /** A repository's pull mirror (V6-01). */
75
+ interface Mirror {
76
+ source: string;
77
+ intervalMinutes: number;
78
+ /** Whom the mirror syncs as: who set it up, or last saved it. */
79
+ setBy: string;
80
+ nextSyncAt: string;
81
+ lastSyncAt?: string;
82
+ lastSuccessAt?: string;
83
+ lastError?: string;
84
+ lfsMissing?: number;
85
+ hasCredentials: boolean;
86
+ waiting: boolean;
87
+ syncing: boolean;
88
+ }
89
+ /** One conflicted file of a pull request, for the resolver (V6-03). */
90
+ interface ConflictFile {
91
+ path: string;
92
+ /** content (resolvable here), binary, modify/delete, rename, large, lfs or other. */
93
+ kind: string;
94
+ resolvable: boolean;
95
+ message?: string;
96
+ base?: string;
97
+ ours?: string;
98
+ theirs?: string;
99
+ merged?: string;
100
+ }
101
+ /** A pull request's conflicts with its target (V6-03). */
102
+ interface Conflicts {
103
+ number: number;
104
+ source: string;
105
+ target: string;
106
+ headSha: string;
107
+ baseSha: string;
108
+ files: ConflictFile[];
109
+ resolvable: boolean;
110
+ canResolve: boolean;
111
+ /** The resolution lands on the head branch; else on a new branch with a pull request into it. */
112
+ direct: boolean;
113
+ }
114
+ /** Where a resolution went (V6-03). */
115
+ interface Resolution {
116
+ branch: string;
117
+ commit: {
118
+ oid: string;
119
+ short: string;
120
+ };
121
+ pull?: number;
62
122
  }
63
123
  interface GitPerson {
64
124
  name: string;
@@ -172,6 +232,16 @@ interface Blob {
172
232
  text?: string;
173
233
  /** Set for a Git LFS file: the view (size, lines, links) is of the object. */
174
234
  lfs?: LfsObject;
235
+ /** How the viewer previews the file (V0-21): a CSV or TSV as a table, a PDF in the browser's viewer. */
236
+ preview?: 'csv' | 'pdf';
237
+ table?: BlobTable;
238
+ }
239
+ /** A delimited file's first rows (V0-21): the header, up to 1,000 rows, and whether there are more. */
240
+ interface BlobTable {
241
+ delimiter: string;
242
+ header: string[];
243
+ rows: string[][];
244
+ truncated: boolean;
175
245
  }
176
246
  interface CommitRequest {
177
247
  branch: string;
@@ -289,7 +359,7 @@ interface Protection {
289
359
  requireCodeOwnerReview?: boolean;
290
360
  requireSignedCommits?: boolean;
291
361
  requireLinearHistory?: boolean;
292
- /** Roles that may bypass the rule: owner, admin, maintainer. */
362
+ /** Roles that may bypass the rule: owner, admin, maintainer, or a custom role ("role:<uuid>"). */
293
363
  bypass?: string[];
294
364
  requiredChecks: string[];
295
365
  }
@@ -429,6 +499,16 @@ declare function apiMessage(err: any, fallback?: string): string;
429
499
  declare class CodeApi {
430
500
  private readonly api;
431
501
  private repoPath;
502
+ /**
503
+ * Whether this installation signs the commits it makes (DEV-31, D-67): GET /signing-key answers.
504
+ * A web edit is then signed, so a rule that only asks for signed commits takes it directly.
505
+ */
506
+ platformSigns(): Observable<boolean>;
507
+ /** The organization's custom roles (V4-01), for the bypass list of a branch rule. */
508
+ customRoles(): Observable<{
509
+ id: string;
510
+ name: string;
511
+ }[]>;
432
512
  repos(project: string): Observable<Repo[]>;
433
513
  create(project: string, body: {
434
514
  name: string;
@@ -446,7 +526,22 @@ declare class CodeApi {
446
526
  token?: string;
447
527
  description?: string;
448
528
  visibility?: string;
529
+ mirror?: boolean;
530
+ intervalMinutes?: number;
449
531
  }): Observable<Repo>;
532
+ /** A repository's pull mirror (V6-01). */
533
+ mirror(project: string, name: string): Observable<Mirror>;
534
+ /** Changes the mirror's source, credentials or interval; the saver becomes whom it syncs as. */
535
+ updateMirror(project: string, name: string, body: Partial<{
536
+ url: string;
537
+ username: string;
538
+ token: string;
539
+ clearCredentials: boolean;
540
+ intervalMinutes: number;
541
+ }>): Observable<Mirror>;
542
+ syncMirror(project: string, name: string): Observable<Mirror>;
543
+ /** Stops mirroring: an ordinary repository that takes pushes. */
544
+ stopMirror(project: string, name: string): Observable<Repo>;
450
545
  repo(project: string, name: string): Observable<Repo>;
451
546
  update(project: string, name: string, body: Partial<{
452
547
  name: string;
@@ -548,6 +643,15 @@ declare class CodeApi {
548
643
  deleteBranch?: boolean;
549
644
  expectHead?: string;
550
645
  }): Observable<Pull>;
646
+ /** A pull request's conflicts with its target, for the resolver (V6-03). */
647
+ conflicts(project: string, name: string, n: number): Observable<Conflicts>;
648
+ /** Commits a resolution of the conflicts (V6-03). */
649
+ resolveConflicts(project: string, name: string, n: number, body: {
650
+ files: Record<string, string>;
651
+ message?: string;
652
+ expectHead: string;
653
+ expectBase: string;
654
+ }): Observable<Resolution>;
551
655
  conversation(project: string, name: string, n: number): Observable<Timeline>;
552
656
  comment(project: string, name: string, n: number, c: NewComment): Observable<PRComment>;
553
657
  /** Arms (method) or disarms (null) auto-merge on a pull request (DEV-25). */
@@ -595,6 +699,17 @@ declare class CurrentRepo {
595
699
  * component's encapsulation, hence ::ng-deep.
596
700
  */
597
701
  declare const TOKEN_CSS = "\n :host ::ng-deep [class^=\"tk-k\"]{color:var(--o-tk-k)}\n :host ::ng-deep [class^=\"tk-s\"], :host ::ng-deep [class^=\"tk-l\"]{color:var(--o-tk-s)}\n :host ::ng-deep [class^=\"tk-c\"]{color:var(--o-tk-c);font-style:italic}\n :host ::ng-deep [class^=\"tk-m\"]{color:var(--o-tk-n)}\n :host ::ng-deep .tk-nf, :host ::ng-deep .tk-nx, :host ::ng-deep .tk-fm{color:var(--o-tk-f)}\n :host ::ng-deep .tk-nb, :host ::ng-deep .tk-nt, :host ::ng-deep .tk-bp{color:var(--o-tk-p)}\n :host ::ng-deep .tk-gi{color:var(--o-add)} :host ::ng-deep .tk-gd{color:var(--o-bad-tx)}\n";
702
+ /** A commit's verification badge (DEV-31, V6-04): commits Origine made read "Verified · Origine". */
703
+ declare function verifyLabel(v: {
704
+ verified: boolean;
705
+ signer?: string;
706
+ }): string;
707
+ /** The badge's hover text: whose key signed it, or why it is not verified. */
708
+ declare function verifyTitle(v: {
709
+ verified: boolean;
710
+ reason: string;
711
+ signer?: string;
712
+ }, name: (id: string) => string): string;
598
713
  /** Why a signed commit is not verified (DEV-31). */
599
714
  declare function verifyWhy(reason: string): string;
600
715
 
@@ -614,11 +729,27 @@ declare abstract class RepoPage {
614
729
  protected readonly note: _angular_core.WritableSignal<string>;
615
730
  protected readonly people: _angular_core.Signal<People>;
616
731
  protected readonly verifyWhy: typeof verifyWhy;
732
+ protected readonly verifyLabel: typeof verifyLabel;
733
+ protected verifyTitle(v: {
734
+ verified: boolean;
735
+ reason: string;
736
+ signer?: string;
737
+ }): string;
738
+ /** Whether the caller holds code capability id on this repository (V4-01): its caps, a collaborator row included. */
739
+ protected can(id: string): boolean;
740
+ /** Takes writes: not archived, and not a pull mirror (V6-01). */
741
+ private readonly live;
617
742
  protected readonly canWrite: _angular_core.Signal<boolean>;
618
- protected readonly canAdmin: _angular_core.Signal<boolean>;
619
- /** Repository settings short of a rename, the visibility and deletion: Maintainers, and maintain collaborators. */
743
+ /** Every repository setting, a rename and the visibility included. */
744
+ protected readonly canSettings: _angular_core.Signal<boolean>;
745
+ /** Repository settings short of a rename and the visibility: the above, and maintain collaborators. */
620
746
  protected readonly canMaintain: _angular_core.Signal<boolean>;
747
+ protected readonly canDelete: _angular_core.Signal<boolean>;
748
+ protected readonly canCollaborators: _angular_core.Signal<boolean>;
621
749
  protected readonly canProtect: _angular_core.Signal<boolean>;
750
+ protected readonly canRelease: _angular_core.Signal<boolean>;
751
+ protected readonly canOpenPull: _angular_core.Signal<boolean>;
752
+ protected readonly canMerge: _angular_core.Signal<boolean>;
622
753
  constructor();
623
754
  /** Called with the repository once it has loaded (and again after it changes). */
624
755
  protected abstract onRepo(repo: Repo): void;
@@ -772,6 +903,8 @@ declare class NewRepoPage {
772
903
  protected url_: string;
773
904
  protected user: string;
774
905
  protected token: string;
906
+ protected mirror: boolean;
907
+ protected interval: number;
775
908
  constructor();
776
909
  protected nameFromUrl(): void;
777
910
  protected copyUrl(): void;
@@ -859,11 +992,14 @@ declare class CommitBox {
859
992
  protected readonly toNew: _angular_core.WritableSignal<boolean>;
860
993
  protected readonly newBranch: _angular_core.WritableSignal<string>;
861
994
  private readonly rules;
995
+ /** Whether the platform signs web commits (GET /signing-key answers). */
996
+ private readonly signs;
862
997
  /** Whether the branch's rules are known yet. */
863
- protected readonly rulesState: _angular_core.WritableSignal<"failed" | "loading" | "loaded">;
998
+ protected readonly rulesState: _angular_core.WritableSignal<"loading" | "loaded" | "failed">;
864
999
  /**
865
1000
  * Direct commits are refused (or may be): the rules block direct pushes, or require signed
866
- * commits (a browser commit is unsigned), or they could not be loaded.
1001
+ * commits while the platform signs nothing (a browser commit is then unsigned), or they could not
1002
+ * be loaded.
867
1003
  */
868
1004
  protected readonly blocked: _angular_core.Signal<boolean>;
869
1005
  private rulesFor;
@@ -882,7 +1018,10 @@ declare class FilePage extends RepoPage {
882
1018
  protected readonly ref: _angular_core.WritableSignal<string>;
883
1019
  protected readonly path: _angular_core.WritableSignal<string>;
884
1020
  protected readonly line: _angular_core.WritableSignal<number>;
885
- protected readonly view: _angular_core.WritableSignal<"preview" | "code">;
1021
+ protected readonly view: _angular_core.WritableSignal<"code" | "preview">;
1022
+ private readonly sanitizer;
1023
+ /** The PDF's signed raw link, trusted as a frame source: the cookieless raw host serves it inline. */
1024
+ protected readonly pdfUrl: _angular_core.Signal<SafeResourceUrl | null>;
886
1025
  protected readonly copied: _angular_core.WritableSignal<boolean>;
887
1026
  protected readonly ago: (s?: string) => string;
888
1027
  protected readonly initials: typeof initials;
@@ -892,7 +1031,7 @@ declare class FilePage extends RepoPage {
892
1031
  path: string;
893
1032
  }[]>;
894
1033
  protected readonly meta: _angular_core.Signal<string>;
895
- protected readonly mode: _angular_core.WritableSignal<"" | "edit" | "delete">;
1034
+ protected readonly mode: _angular_core.WritableSignal<"" | "delete" | "edit">;
896
1035
  protected readonly text: _angular_core.WritableSignal<string | null>;
897
1036
  protected readonly busy: _angular_core.WritableSignal<boolean>;
898
1037
  private readonly branches;
@@ -1050,6 +1189,10 @@ declare class PullPage extends RepoPage {
1050
1189
  protected readonly method: _angular_core.WritableSignal<string>;
1051
1190
  protected readonly delBranch: _angular_core.WritableSignal<boolean>;
1052
1191
  private number;
1192
+ /** The conflict resolver (V6-03): the conflicts, and each file's resolution as edited. */
1193
+ protected readonly resolver: _angular_core.WritableSignal<Conflicts | null>;
1194
+ protected readonly resolved: _angular_core.WritableSignal<Record<string, string>>;
1195
+ protected readonly resolutionReady: _angular_core.Signal<boolean>;
1053
1196
  protected readonly ago: (s?: string) => string;
1054
1197
  protected readonly initials: typeof initials;
1055
1198
  protected readonly dot: typeof checkDot;
@@ -1067,7 +1210,7 @@ declare class PullPage extends RepoPage {
1067
1210
  label: string;
1068
1211
  n: number | undefined;
1069
1212
  }[]>;
1070
- protected readonly badge: _angular_core.Signal<"" | "Merged" | "Closed" | "Draft" | "Open">;
1213
+ protected readonly badge: _angular_core.Signal<"" | "Open" | "Merged" | "Closed" | "Draft">;
1071
1214
  protected readonly badgeBg: _angular_core.Signal<string>;
1072
1215
  protected readonly approvedByMe: _angular_core.Signal<boolean>;
1073
1216
  protected readonly reviewKinds: _angular_core.Signal<({
@@ -1120,6 +1263,11 @@ declare class PullPage extends RepoPage {
1120
1263
  resolved: boolean;
1121
1264
  }): void;
1122
1265
  protected merge(): void;
1266
+ protected openResolver(): void;
1267
+ protected take(path: string, text: string): void;
1268
+ protected hasMarkers(text?: string): boolean;
1269
+ protected conflictKind(kind: string): string;
1270
+ protected commitResolution(): void;
1123
1271
  protected close(reopen: boolean): void;
1124
1272
  protected outside(e: MouseEvent): void;
1125
1273
  private sendReview;
@@ -1129,7 +1277,7 @@ declare class PullPage extends RepoPage {
1129
1277
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<PullPage, "o-code-pull", never, {}, {}, never, never, true, never>;
1130
1278
  }
1131
1279
 
1132
- type Section = 'general' | 'protect' | 'collab' | 'danger';
1280
+ type Section = 'general' | 'mirror' | 'protect' | 'collab' | 'danger';
1133
1281
  interface RuleForm {
1134
1282
  id: string;
1135
1283
  pattern: string;
@@ -1172,11 +1320,25 @@ declare class RepoSettingsPage extends RepoPage {
1172
1320
  label: string;
1173
1321
  hint: string;
1174
1322
  }[];
1175
- protected readonly bypassRoles: {
1323
+ /** Who may bypass a rule: the built-in Owner, Admin and Maintainer, and the organization's custom roles. */
1324
+ private readonly customRoles;
1325
+ protected readonly bypassRoles: _angular_core.Signal<{
1176
1326
  id: string;
1177
1327
  label: string;
1178
- }[];
1328
+ }[]>;
1179
1329
  constructor();
1330
+ protected readonly ago: typeof ago;
1331
+ protected readonly mirror: _angular_core.WritableSignal<Mirror | null>;
1332
+ protected mf: {
1333
+ url: string;
1334
+ username: string;
1335
+ token: string;
1336
+ interval: number;
1337
+ };
1338
+ private loadMirror;
1339
+ protected syncNow(): void;
1340
+ protected saveMirror(): void;
1341
+ protected stopMirror(): void;
1180
1342
  protected readonly collabs: _angular_core.WritableSignal<Collaborator[]>;
1181
1343
  protected readonly perms: {
1182
1344
  id: string;
@@ -1302,5 +1464,5 @@ declare class CodeSearchPage extends RepoPage {
1302
1464
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CodeSearchPage, "o-code-search", never, {}, {}, never, never, true, never>;
1303
1465
  }
1304
1466
 
1305
- export { BranchesPage, CodeApi, CodeHost, CodeSearchPage, CommitBox, CommitPage, CommitsPage, CurrentRepo, CurrentRepoPage, DiffView, FilePage, NewFilePage, NewRepoPage, People, PullPage, PullsPage, RefPicker, ReleasesPage, RepoHomePage, RepoPage, RepoSettingsPage, ReposPage, TOKEN_CSS, ago, apiMessage, checkDot, copy, dayLabel, initials, langColour, matchesPattern, pair, shortDate, size, verifyWhy };
1306
- export type { BlameHunk, Blob, CheckStatus, CodeHit, CodePerson, CodeProject, Collaborator, Commit, CommitChoice, CommitDetail, CommitRequest, CommitResult, Comparison, DiffHunk, DiffLine, Entry, FileChange, FileDiff, Gate, GateRow, GitPerson, Language, LfsObject, LineComment, NewComment, PRComment, Protection, Pull, PullBrief, Ref, Release, ReleaseAsset, ReleaseInput, Repo, Review, ReviewBrief, SplitRow, Thread, ThreadReply, Timeline, Tree };
1467
+ export { BranchesPage, CodeApi, CodeHost, CodeSearchPage, CommitBox, CommitPage, CommitsPage, CurrentRepo, CurrentRepoPage, DiffView, FilePage, NewFilePage, NewRepoPage, People, PullPage, PullsPage, RefPicker, ReleasesPage, RepoHomePage, RepoPage, RepoSettingsPage, ReposPage, TOKEN_CSS, ago, apiMessage, checkDot, copy, dayLabel, initials, langColour, matchesPattern, pair, shortDate, size, verifyLabel, verifyTitle, verifyWhy };
1468
+ export type { BlameHunk, Blob, BlobTable, CheckStatus, CodeHit, CodePerson, CodeProject, Collaborator, Commit, CommitChoice, CommitDetail, CommitRequest, CommitResult, Comparison, ConflictFile, Conflicts, DiffHunk, DiffLine, Entry, FileChange, FileDiff, Gate, GateRow, GitPerson, Language, LfsObject, LineComment, Mirror, NewComment, PRComment, Protection, Pull, PullBrief, Ref, Release, ReleaseAsset, ReleaseInput, Repo, Resolution, Review, ReviewBrief, SplitRow, Thread, ThreadReply, Timeline, Tree };