@chisquare-tech/origine-ngx-apps-code 0.3.0 → 0.5.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.3.0",
3
+ "version": "0.5.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",
@@ -54,6 +54,8 @@ interface Repo {
54
54
  empty: boolean;
55
55
  capabilities: string[];
56
56
  readOnly?: boolean;
57
+ /** The caller's collaborator permission on this repository (read, write or maintain), if any. */
58
+ collaborator?: string;
57
59
  createdAt?: string;
58
60
  }
59
61
  interface GitPerson {
@@ -149,6 +151,27 @@ interface Blob {
149
151
  rawUrl?: string;
150
152
  downloadUrl?: string;
151
153
  lastCommit?: Commit;
154
+ /** The file as it is (asked for by the editor; UTF-8 text shown in full). */
155
+ text?: string;
156
+ }
157
+ interface CommitRequest {
158
+ branch: string;
159
+ from?: string;
160
+ expect?: string;
161
+ files?: Record<string, string>;
162
+ uploads?: Record<string, string>;
163
+ deletes?: string[];
164
+ pull?: {
165
+ title?: string;
166
+ body?: string;
167
+ };
168
+ message: string;
169
+ }
170
+ interface CommitResult {
171
+ branch: string;
172
+ commit: Commit;
173
+ created: boolean;
174
+ pull?: number;
152
175
  }
153
176
  interface BlameHunk {
154
177
  commit: string;
@@ -175,6 +198,15 @@ interface Ref {
175
198
  merged: boolean;
176
199
  canDelete: boolean;
177
200
  }
201
+ /** A repository collaborator (DEV-06): access beyond the project role, for one repository. */
202
+ interface Collaborator {
203
+ repoId: string;
204
+ userId: string;
205
+ permission: 'read' | 'write' | 'maintain';
206
+ projectRole: string;
207
+ addedBy: string;
208
+ createdAt: string;
209
+ }
178
210
  /** A file on a release (DEV-15). */
179
211
  interface ReleaseAsset {
180
212
  id: string;
@@ -389,7 +421,9 @@ declare class CodeApi {
389
421
  updateProtection(project: string, name: string, id: string, p: Partial<Protection>): Observable<Protection>;
390
422
  removeProtection(project: string, name: string, id: string): Observable<unknown>;
391
423
  tree(project: string, name: string, ref: string, path: string): Observable<Tree>;
392
- blob(project: string, name: string, ref: string, path: string): Observable<Blob>;
424
+ blob(project: string, name: string, ref: string, path: string, withText?: boolean): Observable<Blob>;
425
+ /** A commit from the browser (DEV-13): files, base64 uploads and deletes; from a new branch it can open a pull request. */
426
+ commitFiles(project: string, name: string, body: CommitRequest): Observable<CommitResult>;
393
427
  blame(project: string, name: string, ref: string, path: string): Observable<BlameHunk[]>;
394
428
  files(project: string, name: string, ref: string): Observable<{
395
429
  files: string[];
@@ -411,6 +445,9 @@ declare class CodeApi {
411
445
  }): Observable<FileDiff>;
412
446
  compare(project: string, name: string, base: string, head: string): Observable<Comparison>;
413
447
  refs(project: string, name: string, kind?: 'branch' | 'tag', q?: string): Observable<Ref[]>;
448
+ collaborators(project: string, name: string): Observable<Collaborator[]>;
449
+ setCollaborator(project: string, name: string, userId: string, permission: string): Observable<Collaborator>;
450
+ removeCollaborator(project: string, name: string, userId: string): Observable<unknown>;
414
451
  createTag(project: string, name: string, tag: string, target: string): Observable<Ref>;
415
452
  deleteTag(project: string, name: string, tag: string): Observable<unknown>;
416
453
  releases(project: string, name: string): Observable<Release[]>;
@@ -524,6 +561,8 @@ declare abstract class RepoPage {
524
561
  protected readonly people: _angular_core.Signal<People>;
525
562
  protected readonly canWrite: _angular_core.Signal<boolean>;
526
563
  protected readonly canAdmin: _angular_core.Signal<boolean>;
564
+ /** Repository settings short of a rename, the visibility and deletion: Maintainers, and maintain collaborators. */
565
+ protected readonly canMaintain: _angular_core.Signal<boolean>;
527
566
  protected readonly canProtect: _angular_core.Signal<boolean>;
528
567
  constructor();
529
568
  /** Called with the repository once it has loaded (and again after it changes). */
@@ -696,6 +735,7 @@ declare class RepoHomePage extends RepoPage {
696
735
  protected readonly path: _angular_core.WritableSignal<string>;
697
736
  protected readonly proto: _angular_core.WritableSignal<"https" | "ssh">;
698
737
  protected readonly cloneOpen: _angular_core.WritableSignal<boolean>;
738
+ protected readonly addOpen: _angular_core.WritableSignal<boolean>;
699
739
  protected readonly copied: _angular_core.WritableSignal<boolean>;
700
740
  protected readonly finding: _angular_core.WritableSignal<boolean>;
701
741
  protected readonly fq: _angular_core.WritableSignal<string>;
@@ -729,6 +769,34 @@ declare class RepoHomePage extends RepoPage {
729
769
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<RepoHomePage, "o-code-repo", never, {}, {}, never, never, true, never>;
730
770
  }
731
771
 
772
+ /** Where a web commit goes: onto the branch, or onto a new branch with a pull request. */
773
+ interface CommitChoice {
774
+ message: string;
775
+ /** Set for a new branch (with a pull request into the current one). */
776
+ newBranch?: string;
777
+ }
778
+ /** Whether a branch protection pattern names the branch (as code's protect.Match: * within a segment, ** across). */
779
+ declare function matchesPattern(pattern: string, branch: string): boolean;
780
+ declare class CommitBox {
781
+ private readonly api;
782
+ private readonly host;
783
+ readonly repo: _angular_core.InputSignal<string>;
784
+ readonly branch: _angular_core.InputSignal<string>;
785
+ readonly defaultMessage: _angular_core.InputSignal<string>;
786
+ readonly busy: _angular_core.InputSignal<boolean>;
787
+ readonly commit: _angular_core.OutputEmitterRef<CommitChoice>;
788
+ readonly cancel: _angular_core.OutputEmitterRef<void>;
789
+ protected readonly message: _angular_core.WritableSignal<string>;
790
+ protected readonly toNew: _angular_core.WritableSignal<boolean>;
791
+ protected readonly newBranch: _angular_core.WritableSignal<string>;
792
+ private readonly rules;
793
+ protected readonly blocked: _angular_core.Signal<boolean>;
794
+ constructor();
795
+ protected send(): void;
796
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CommitBox, never>;
797
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CommitBox, "o-commit-box", never, { "repo": { "alias": "repo"; "required": true; "isSignal": true; }; "branch": { "alias": "branch"; "required": true; "isSignal": true; }; "defaultMessage": { "alias": "defaultMessage"; "required": false; "isSignal": true; }; "busy": { "alias": "busy"; "required": false; "isSignal": true; }; }, { "commit": "commit"; "cancel": "cancel"; }, never, never, true, never>;
798
+ }
799
+
732
800
  declare class FilePage extends RepoPage {
733
801
  private readonly router;
734
802
  protected readonly blob: _angular_core.WritableSignal<Blob | null>;
@@ -746,8 +814,18 @@ declare class FilePage extends RepoPage {
746
814
  path: string;
747
815
  }[]>;
748
816
  protected readonly meta: _angular_core.Signal<string>;
817
+ protected readonly mode: _angular_core.WritableSignal<"" | "delete" | "edit">;
818
+ protected readonly text: _angular_core.WritableSignal<string | null>;
819
+ protected readonly busy: _angular_core.WritableSignal<boolean>;
820
+ private readonly branches;
821
+ /** The branch the view is on ('' for a tag or a commit, which cannot take commits). */
822
+ protected readonly branch: _angular_core.Signal<string>;
823
+ protected readonly editable: _angular_core.Signal<boolean>;
749
824
  constructor();
750
825
  protected onRepo(r: Repo): void;
826
+ protected startEdit(): void;
827
+ /** Commits the edit (or the delete), onto the branch or onto a new branch with a pull request. */
828
+ protected save(c: CommitChoice, del?: boolean): void;
751
829
  protected pickRef(ref: string): void;
752
830
  protected pickLine(n: number): void;
753
831
  protected copyText(): void;
@@ -1006,6 +1084,18 @@ declare class RepoSettingsPage extends RepoPage {
1006
1084
  hint: string;
1007
1085
  }[];
1008
1086
  constructor();
1087
+ protected readonly collabs: _angular_core.WritableSignal<Collaborator[]>;
1088
+ protected readonly perms: {
1089
+ id: string;
1090
+ label: string;
1091
+ }[];
1092
+ protected readonly addable: _angular_core.Signal<_chisquare_tech_origine_ngx_apps_code.CodePerson[]>;
1093
+ protected newCollab: string;
1094
+ protected newPerm: string;
1095
+ protected roleLabel(r: string): string;
1096
+ private loadCollabs;
1097
+ protected setCollab(userId: string, permission: string, adding?: boolean): void;
1098
+ protected removeCollab(userId: string): void;
1009
1099
  protected onRepo(r: Repo): void;
1010
1100
  protected go(s: Section): void;
1011
1101
  protected max0(n: number): number;
@@ -1070,5 +1160,33 @@ declare class ReleasesPage extends RepoPage {
1070
1160
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<ReleasesPage, "o-code-releases", never, {}, {}, never, never, true, never>;
1071
1161
  }
1072
1162
 
1073
- export { BranchesPage, CodeApi, CodeHost, CommitPage, CommitsPage, CurrentRepo, CurrentRepoPage, DiffView, FilePage, NewRepoPage, People, PullPage, PullsPage, RefPicker, ReleasesPage, RepoHomePage, RepoPage, RepoSettingsPage, ReposPage, TOKEN_CSS, ago, apiMessage, checkDot, copy, dayLabel, initials, langColour, pair, shortDate, size };
1074
- export type { BlameHunk, Blob, CheckStatus, CodePerson, CodeProject, Commit, CommitDetail, Comparison, DiffHunk, DiffLine, Entry, FileChange, FileDiff, Gate, GateRow, GitPerson, Language, LineComment, NewComment, PRComment, Protection, Pull, PullBrief, Ref, Release, ReleaseAsset, ReleaseInput, Repo, Review, ReviewBrief, SplitRow, Thread, ThreadReply, Timeline, Tree };
1163
+ interface Upload {
1164
+ name: string;
1165
+ size: number;
1166
+ b64: string;
1167
+ }
1168
+ declare class NewFilePage extends RepoPage {
1169
+ private readonly router;
1170
+ protected readonly upload: _angular_core.WritableSignal<boolean>;
1171
+ protected readonly ref: _angular_core.WritableSignal<string>;
1172
+ protected readonly uploads: _angular_core.WritableSignal<Upload[]>;
1173
+ protected readonly busy: _angular_core.WritableSignal<boolean>;
1174
+ protected filePath: string;
1175
+ protected content: string;
1176
+ protected dir: string;
1177
+ protected readonly branch: _angular_core.Signal<string>;
1178
+ protected readonly defaultMessage: _angular_core.Signal<"Add files via upload" | "Create a file">;
1179
+ protected readonly fmt: typeof size;
1180
+ constructor();
1181
+ protected onRepo(_: Repo): void;
1182
+ protected pick(ev: Event): Promise<void>;
1183
+ protected shown(name: string): string;
1184
+ protected drop(name: string): void;
1185
+ protected back(): void;
1186
+ protected save(c: CommitChoice): void;
1187
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NewFilePage, never>;
1188
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NewFilePage, "o-code-new-file", never, {}, {}, never, never, true, never>;
1189
+ }
1190
+
1191
+ export { BranchesPage, CodeApi, CodeHost, 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 };
1192
+ export type { BlameHunk, Blob, CheckStatus, CodePerson, CodeProject, Collaborator, Commit, CommitChoice, CommitDetail, CommitRequest, CommitResult, Comparison, DiffHunk, DiffLine, Entry, FileChange, FileDiff, Gate, GateRow, GitPerson, Language, LineComment, NewComment, PRComment, Protection, Pull, PullBrief, Ref, Release, ReleaseAsset, ReleaseInput, Repo, Review, ReviewBrief, SplitRow, Thread, ThreadReply, Timeline, Tree };