@kinotic-ai/os-api 1.3.0 → 1.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/dist/index.cjs +23 -48
- package/dist/index.d.cts +60 -73
- package/dist/index.d.ts +60 -73
- package/dist/index.js +23 -48
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -57,8 +57,6 @@ __export(exports_src, {
|
|
|
57
57
|
QueryDecorator: () => QueryDecorator,
|
|
58
58
|
ProjectType: () => ProjectType,
|
|
59
59
|
ProjectService: () => ProjectService,
|
|
60
|
-
ProjectGitHubRepoService: () => ProjectGitHubRepoService,
|
|
61
|
-
ProjectGitHubRepoLink: () => ProjectGitHubRepoLink,
|
|
62
60
|
Project: () => Project,
|
|
63
61
|
ProgressType: () => ProgressType,
|
|
64
62
|
PageableC3Type: () => PageableC3Type,
|
|
@@ -80,7 +78,9 @@ __export(exports_src, {
|
|
|
80
78
|
IamUserService: () => IamUserService,
|
|
81
79
|
IamUser: () => IamUser,
|
|
82
80
|
GroupLoggerLevelsDescriptor: () => GroupLoggerLevelsDescriptor,
|
|
83
|
-
|
|
81
|
+
GitHubToken: () => GitHubToken,
|
|
82
|
+
GitHubRepoToken: () => GitHubRepoToken,
|
|
83
|
+
GitHubInstallCompletion: () => GitHubInstallCompletion,
|
|
84
84
|
GitHubAppInstallationService: () => GitHubAppInstallationService,
|
|
85
85
|
GitHubAppInstallation: () => GitHubAppInstallation,
|
|
86
86
|
FlattenedDecorator: () => FlattenedDecorator,
|
|
@@ -90,7 +90,6 @@ __export(exports_src, {
|
|
|
90
90
|
EntityDecorator: () => EntityDecorator,
|
|
91
91
|
DiscriminatorDecorator: () => DiscriminatorDecorator,
|
|
92
92
|
DataInsightsService: () => DataInsightsService,
|
|
93
|
-
AvailableRepo: () => AvailableRepo,
|
|
94
93
|
AutoGeneratedIdDecorator: () => AutoGeneratedIdDecorator,
|
|
95
94
|
AuthType: () => AuthType,
|
|
96
95
|
ApplicationService: () => ApplicationService,
|
|
@@ -302,6 +301,10 @@ class Project {
|
|
|
302
301
|
name;
|
|
303
302
|
description;
|
|
304
303
|
sourceOfTruth = null;
|
|
304
|
+
repoFullName;
|
|
305
|
+
repoId;
|
|
306
|
+
defaultBranch;
|
|
307
|
+
repoPrivate = true;
|
|
305
308
|
updated = null;
|
|
306
309
|
constructor(id, applicationId, name, description) {
|
|
307
310
|
this.id = id;
|
|
@@ -451,41 +454,31 @@ class IamUser {
|
|
|
451
454
|
created = null;
|
|
452
455
|
updated = null;
|
|
453
456
|
}
|
|
454
|
-
// packages/os-api/src/api/model/github/AvailableRepo.ts
|
|
455
|
-
class AvailableRepo {
|
|
456
|
-
repoId = "";
|
|
457
|
-
fullName = "";
|
|
458
|
-
defaultBranch = "";
|
|
459
|
-
privateRepo = false;
|
|
460
|
-
}
|
|
461
457
|
// packages/os-api/src/api/model/github/GitHubAppInstallation.ts
|
|
462
458
|
class GitHubAppInstallation {
|
|
463
459
|
id = null;
|
|
464
460
|
organizationId = "";
|
|
465
|
-
githubInstallationId =
|
|
461
|
+
githubInstallationId = 0;
|
|
466
462
|
accountLogin = "";
|
|
467
463
|
accountType = "";
|
|
468
464
|
suspendedAt = null;
|
|
469
465
|
created = null;
|
|
470
466
|
updated = null;
|
|
471
467
|
}
|
|
472
|
-
// packages/os-api/src/api/model/github/
|
|
473
|
-
class
|
|
468
|
+
// packages/os-api/src/api/model/github/GitHubToken.ts
|
|
469
|
+
class GitHubToken {
|
|
474
470
|
token = "";
|
|
475
471
|
expiresAt = 0;
|
|
472
|
+
}
|
|
473
|
+
// packages/os-api/src/api/model/github/GitHubRepoToken.ts
|
|
474
|
+
class GitHubRepoToken extends GitHubToken {
|
|
476
475
|
cloneUrl = "";
|
|
477
476
|
defaultBranch = "";
|
|
478
477
|
}
|
|
479
|
-
// packages/os-api/src/api/model/github/
|
|
480
|
-
class
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
organizationId = "";
|
|
484
|
-
installationId = "";
|
|
485
|
-
repoFullName = "";
|
|
486
|
-
repoId = "";
|
|
487
|
-
defaultBranch = "";
|
|
488
|
-
updated = null;
|
|
478
|
+
// packages/os-api/src/api/model/github/GitHubInstallCompletion.ts
|
|
479
|
+
class GitHubInstallCompletion {
|
|
480
|
+
installation;
|
|
481
|
+
returnTo = null;
|
|
489
482
|
}
|
|
490
483
|
// packages/os-api/src/api/model/KinoticProjectConfig.ts
|
|
491
484
|
class KinoticProjectConfig {
|
|
@@ -747,33 +740,16 @@ class GitHubAppInstallationService extends import_core9.CrudServiceProxy {
|
|
|
747
740
|
constructor(kinotic) {
|
|
748
741
|
super(kinotic.serviceProxy("org.kinotic.github.api.services.GitHubAppInstallationService"));
|
|
749
742
|
}
|
|
750
|
-
startInstall() {
|
|
751
|
-
return this.serviceProxy.invoke("startInstall", []);
|
|
743
|
+
startInstall(returnTo) {
|
|
744
|
+
return this.serviceProxy.invoke("startInstall", [returnTo]);
|
|
745
|
+
}
|
|
746
|
+
completeInstall(installationId, state) {
|
|
747
|
+
return this.serviceProxy.invoke("completeInstall", [installationId, state]);
|
|
752
748
|
}
|
|
753
749
|
findForCurrentOrg() {
|
|
754
750
|
return this.serviceProxy.invoke("findForCurrentOrg", []);
|
|
755
751
|
}
|
|
756
752
|
}
|
|
757
|
-
// packages/os-api/src/api/services/IProjectGitHubRepoService.ts
|
|
758
|
-
var import_core10 = require("@kinotic-ai/core");
|
|
759
|
-
|
|
760
|
-
class ProjectGitHubRepoService extends import_core10.CrudServiceProxy {
|
|
761
|
-
constructor(kinotic) {
|
|
762
|
-
super(kinotic.serviceProxy("org.kinotic.github.api.services.ProjectGitHubRepoService"));
|
|
763
|
-
}
|
|
764
|
-
listAvailableRepos() {
|
|
765
|
-
return this.serviceProxy.invoke("listAvailableRepos", []);
|
|
766
|
-
}
|
|
767
|
-
linkProject(projectId, repoFullName) {
|
|
768
|
-
return this.serviceProxy.invoke("linkProject", [projectId, repoFullName]);
|
|
769
|
-
}
|
|
770
|
-
unlinkProject(projectId) {
|
|
771
|
-
return this.serviceProxy.invoke("unlinkProject", [projectId]);
|
|
772
|
-
}
|
|
773
|
-
findByProject(projectId) {
|
|
774
|
-
return this.serviceProxy.invoke("findByProject", [projectId]);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
753
|
// packages/os-api/src/api/OsApiPlugin.ts
|
|
778
754
|
var OsApiPlugin = {
|
|
779
755
|
install(kinotic) {
|
|
@@ -789,8 +765,7 @@ var OsApiPlugin = {
|
|
|
789
765
|
vmNodes: new VmNodeServiceProxy(kinotic),
|
|
790
766
|
workloads: new WorkloadServiceProxy(kinotic),
|
|
791
767
|
iamUsers: new IamUserService(kinotic),
|
|
792
|
-
githubAppInstallations: new GitHubAppInstallationService(kinotic)
|
|
793
|
-
githubRepoLinks: new ProjectGitHubRepoService(kinotic)
|
|
768
|
+
githubAppInstallations: new GitHubAppInstallationService(kinotic)
|
|
794
769
|
};
|
|
795
770
|
}
|
|
796
771
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -198,6 +198,24 @@ declare class Project implements Identifiable3<string> {
|
|
|
198
198
|
*/
|
|
199
199
|
sourceOfTruth: ProjectType | null;
|
|
200
200
|
/**
|
|
201
|
+
* Full name ({@code owner/repo}) of the GitHub repository backing this project.
|
|
202
|
+
* Stamped at create time by the server-side repo provisioner.
|
|
203
|
+
*/
|
|
204
|
+
repoFullName: string;
|
|
205
|
+
/**
|
|
206
|
+
* GitHub's stable repository id. Survives renames on the GitHub side.
|
|
207
|
+
*/
|
|
208
|
+
repoId: number;
|
|
209
|
+
/**
|
|
210
|
+
* Default branch of the backing repository at the time it was provisioned.
|
|
211
|
+
*/
|
|
212
|
+
defaultBranch: string;
|
|
213
|
+
/**
|
|
214
|
+
* Visibility chosen for the backing repository at create time. The SPA sets
|
|
215
|
+
* this before save; the platform passes it through to GitHub.
|
|
216
|
+
*/
|
|
217
|
+
repoPrivate: boolean;
|
|
218
|
+
/**
|
|
201
219
|
* The date and time the project was updated.
|
|
202
220
|
*/
|
|
203
221
|
updated: number | null;
|
|
@@ -562,18 +580,6 @@ interface SignUpCompleteRequest {
|
|
|
562
580
|
token: string;
|
|
563
581
|
password: string;
|
|
564
582
|
}
|
|
565
|
-
/**
|
|
566
|
-
* One row in the repo dropdown shown when linking a project. Carries just enough
|
|
567
|
-
* info for the UI; a successful link round-trips through
|
|
568
|
-
* {@link IProjectGitHubRepoService} which re-validates against GitHub before
|
|
569
|
-
* persisting.
|
|
570
|
-
*/
|
|
571
|
-
declare class AvailableRepo {
|
|
572
|
-
repoId: string;
|
|
573
|
-
fullName: string;
|
|
574
|
-
defaultBranch: string;
|
|
575
|
-
privateRepo: boolean;
|
|
576
|
-
}
|
|
577
583
|
import { Identifiable as Identifiable9 } from "@kinotic-ai/core";
|
|
578
584
|
/**
|
|
579
585
|
* Persisted record of one GitHub App installation that a Kinotic Org has authorised.
|
|
@@ -584,7 +590,7 @@ import { Identifiable as Identifiable9 } from "@kinotic-ai/core";
|
|
|
584
590
|
declare class GitHubAppInstallation implements Identifiable9<string> {
|
|
585
591
|
id: string | null;
|
|
586
592
|
organizationId: string;
|
|
587
|
-
githubInstallationId:
|
|
593
|
+
githubInstallationId: number;
|
|
588
594
|
accountLogin: string;
|
|
589
595
|
accountType: string;
|
|
590
596
|
suspendedAt: number | null;
|
|
@@ -592,37 +598,36 @@ declare class GitHubAppInstallation implements Identifiable9<string> {
|
|
|
592
598
|
updated: number | null;
|
|
593
599
|
}
|
|
594
600
|
/**
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
*
|
|
598
|
-
* (epoch milliseconds).
|
|
601
|
+
* A short-lived GitHub installation access token. Mirrors the Java
|
|
602
|
+
* {@code org.kinotic.github.api.model.GitHubToken}; {@code expiresAt} is the
|
|
603
|
+
* absolute UTC instant (epoch milliseconds) at which GitHub will reject the token.
|
|
599
604
|
*/
|
|
600
|
-
declare class
|
|
601
|
-
/** Bearer token to send as {@code Authorization: Bearer <token>}
|
|
605
|
+
declare class GitHubToken {
|
|
606
|
+
/** Bearer token to send as {@code Authorization: Bearer <token>}. */
|
|
602
607
|
token: string;
|
|
603
|
-
/** Absolute expiry (epoch milliseconds).
|
|
608
|
+
/** Absolute expiry (epoch milliseconds). Do not use past this point. */
|
|
604
609
|
expiresAt: number;
|
|
605
|
-
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* A {@link GitHubToken} bundled with the repository-clone metadata a worker needs
|
|
613
|
+
* to {@code git clone} the project's backing repo. Returned by
|
|
614
|
+
* {@code GitHubProjectRepoService.issueRepoToken}.
|
|
615
|
+
*/
|
|
616
|
+
declare class GitHubRepoToken extends GitHubToken {
|
|
617
|
+
/** {@code https://github.com/<owner>/<repo>.git} for the project's repo. */
|
|
606
618
|
cloneUrl: string;
|
|
607
|
-
/** Default branch on the
|
|
619
|
+
/** Default branch on the repo (e.g. {@code main}). */
|
|
608
620
|
defaultBranch: string;
|
|
609
621
|
}
|
|
610
|
-
import { Identifiable as Identifiable10 } from "@kinotic-ai/core";
|
|
611
622
|
/**
|
|
612
|
-
*
|
|
613
|
-
*
|
|
614
|
-
* (
|
|
615
|
-
*
|
|
623
|
+
* Result of finalising a GitHub install round-trip. {@code returnTo} echoes what
|
|
624
|
+
* the SPA staged when it called {@code startInstall(...)} and may carry query
|
|
625
|
+
* params (e.g. {@code /projects?openNewProject=1}) so the destination page can
|
|
626
|
+
* pick up where the user was.
|
|
616
627
|
*/
|
|
617
|
-
declare class
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
organizationId: string;
|
|
621
|
-
installationId: string;
|
|
622
|
-
repoFullName: string;
|
|
623
|
-
repoId: string;
|
|
624
|
-
defaultBranch: string;
|
|
625
|
-
updated: number | null;
|
|
628
|
+
declare class GitHubInstallCompletion {
|
|
629
|
+
installation: GitHubAppInstallation;
|
|
630
|
+
returnTo: string | null;
|
|
626
631
|
}
|
|
627
632
|
/**
|
|
628
633
|
* Configuration for a single entities path and its corresponding repository output.
|
|
@@ -1070,52 +1075,35 @@ declare class IamUserService extends CrudServiceProxy8<IamUser> implements IIamU
|
|
|
1070
1075
|
import { CrudServiceProxy as CrudServiceProxy9, IKinotic as IKinotic12, ICrudServiceProxy as ICrudServiceProxy9 } from "@kinotic-ai/core";
|
|
1071
1076
|
interface IGitHubAppInstallationService extends ICrudServiceProxy9<GitHubAppInstallation> {
|
|
1072
1077
|
/**
|
|
1073
|
-
* Stages a single-use
|
|
1074
|
-
*
|
|
1078
|
+
* Stages a single-use state token bound to the caller's organization plus the
|
|
1079
|
+
* supplied returnTo, then returns the GitHub install URL with that state
|
|
1075
1080
|
* embedded. The SPA performs {@code window.location = url}.
|
|
1076
|
-
*
|
|
1077
|
-
*
|
|
1078
|
-
*
|
|
1081
|
+
*
|
|
1082
|
+
* returnTo is echoed back from {@link completeInstall} and may carry query
|
|
1083
|
+
* params (e.g. {@code /projects?openNewProject=1}) so the destination page
|
|
1084
|
+
* can pick up where the user was.
|
|
1079
1085
|
*/
|
|
1080
|
-
startInstall(): Promise<string>;
|
|
1086
|
+
startInstall(returnTo: string | null): Promise<string>;
|
|
1087
|
+
/**
|
|
1088
|
+
* Finalises the install once GitHub has redirected the browser back to the SPA
|
|
1089
|
+
* callback. Consumes the staged state, fetches the install details from GitHub,
|
|
1090
|
+
* persists the {@link GitHubAppInstallation} row, and returns it along with the
|
|
1091
|
+
* original intent and returnTo.
|
|
1092
|
+
*/
|
|
1093
|
+
completeInstall(installationId: number, state: string): Promise<GitHubInstallCompletion>;
|
|
1081
1094
|
/**
|
|
1082
1095
|
* Returns the (at-most-one) installation bound to the caller's organization, or
|
|
1083
|
-
*
|
|
1084
|
-
*
|
|
1096
|
+
* null if GitHub is not yet linked. Drives the "linked / not linked" indicator
|
|
1097
|
+
* in the org-settings UI.
|
|
1085
1098
|
*/
|
|
1086
1099
|
findForCurrentOrg(): Promise<GitHubAppInstallation | null>;
|
|
1087
1100
|
}
|
|
1088
1101
|
declare class GitHubAppInstallationService extends CrudServiceProxy9<GitHubAppInstallation> implements IGitHubAppInstallationService {
|
|
1089
1102
|
constructor(kinotic: IKinotic12);
|
|
1090
|
-
startInstall(): Promise<string>;
|
|
1103
|
+
startInstall(returnTo: string | null): Promise<string>;
|
|
1104
|
+
completeInstall(installationId: number, state: string): Promise<GitHubInstallCompletion>;
|
|
1091
1105
|
findForCurrentOrg(): Promise<GitHubAppInstallation | null>;
|
|
1092
1106
|
}
|
|
1093
|
-
import { CrudServiceProxy as CrudServiceProxy10, IKinotic as IKinotic13, ICrudServiceProxy as ICrudServiceProxy10 } from "@kinotic-ai/core";
|
|
1094
|
-
interface IProjectGitHubRepoService extends ICrudServiceProxy10<ProjectGitHubRepoLink> {
|
|
1095
|
-
/**
|
|
1096
|
-
* Lists the repositories visible under the caller's organization's installation.
|
|
1097
|
-
* Calls GitHub on every invocation; not cached because the org admin may have
|
|
1098
|
-
* just toggled repo access.
|
|
1099
|
-
*/
|
|
1100
|
-
listAvailableRepos(): Promise<AvailableRepo[]>;
|
|
1101
|
-
/**
|
|
1102
|
-
* Creates or replaces the link for the given project. Validates that the chosen
|
|
1103
|
-
* {@code repoFullName} is reachable through the org's installation before
|
|
1104
|
-
* persisting.
|
|
1105
|
-
*/
|
|
1106
|
-
linkProject(projectId: string, repoFullName: string): Promise<ProjectGitHubRepoLink>;
|
|
1107
|
-
/** Removes the link for the given project, if any. */
|
|
1108
|
-
unlinkProject(projectId: string): Promise<void>;
|
|
1109
|
-
/** Returns the link for the given project, or {@code null} when none exists. */
|
|
1110
|
-
findByProject(projectId: string): Promise<ProjectGitHubRepoLink | null>;
|
|
1111
|
-
}
|
|
1112
|
-
declare class ProjectGitHubRepoService extends CrudServiceProxy10<ProjectGitHubRepoLink> implements IProjectGitHubRepoService {
|
|
1113
|
-
constructor(kinotic: IKinotic13);
|
|
1114
|
-
listAvailableRepos(): Promise<AvailableRepo[]>;
|
|
1115
|
-
linkProject(projectId: string, repoFullName: string): Promise<ProjectGitHubRepoLink>;
|
|
1116
|
-
unlinkProject(projectId: string): Promise<void>;
|
|
1117
|
-
findByProject(projectId: string): Promise<ProjectGitHubRepoLink | null>;
|
|
1118
|
-
}
|
|
1119
1107
|
import { KinoticPlugin } from "@kinotic-ai/core";
|
|
1120
1108
|
interface IOsApiExtension {
|
|
1121
1109
|
applications: IApplicationService;
|
|
@@ -1130,10 +1118,9 @@ interface IOsApiExtension {
|
|
|
1130
1118
|
workloads: IWorkloadService;
|
|
1131
1119
|
iamUsers: IIamUserService;
|
|
1132
1120
|
githubAppInstallations: IGitHubAppInstallationService;
|
|
1133
|
-
githubRepoLinks: IProjectGitHubRepoService;
|
|
1134
1121
|
}
|
|
1135
1122
|
declare const OsApiPlugin: KinoticPlugin<IOsApiExtension>;
|
|
1136
1123
|
declare module "@kinotic-ai/core" {
|
|
1137
1124
|
interface KinoticSingleton extends IOsApiExtension {}
|
|
1138
1125
|
}
|
|
1139
|
-
export { WorkloadStatus, WorkloadServiceProxy, Workload, VmProviderType, VmNodeStatus, VmNodeServiceProxy, VmNode, VersionDecorator, TimeReferenceDecorator, TextDecorator, TenantSelectionC3Type, TenantIdDecorator, SingleLoggerLevelsDescriptor, SignUpRequest, SignUpCompleteRequest, QueryOptionsC3Type, QueryDecorator, ProjectType, ProjectService,
|
|
1126
|
+
export { WorkloadStatus, WorkloadServiceProxy, Workload, VmProviderType, VmNodeStatus, VmNodeServiceProxy, VmNode, VersionDecorator, TimeReferenceDecorator, TextDecorator, TenantSelectionC3Type, TenantIdDecorator, SingleLoggerLevelsDescriptor, SignUpRequest, SignUpCompleteRequest, QueryOptionsC3Type, QueryDecorator, ProjectType, ProjectService, Project, ProgressType, PageableC3Type, PageC3Type, OsApiPlugin, OrganizationService, Organization, NotIndexedDecorator, NestedDecorator, NamedQueriesDefinitionService, NamedQueriesDefinition, MigrationService, MigrationResult, MigrationRequest, MigrationDefinition, LoggersDescriptor, LoggerLevelsDescriptor, LogManager, LogLevel, KinoticProjectConfig, InsightRequest, InsightProgress, IdDecorator, IamUserService, IamUser, IWorkloadService, IVmNodeService, IProjectService, IOsApiExtension, IOrganizationService, INamedQueriesDefinitionService, IMigrationService, ILogManager, IIamUserService, IGitHubAppInstallationService, IEntityDefinitionService, IDataInsightsService, IApplicationService, GroupLoggerLevelsDescriptor, GitHubToken, GitHubRepoToken, GitHubInstallCompletion, GitHubAppInstallationService, GitHubAppInstallation, FlattenedDecorator, EsIndexConfigurationDecorator, EntityDefinitionService, EntityDefinition, EntityDecorator, EntitiesPathConfig, DiscriminatorDecorator, DataInsightsService, DataInsightsComponent, AutoGeneratedIdDecorator, AuthType, ApplicationService, Application };
|
package/dist/index.d.ts
CHANGED
|
@@ -198,6 +198,24 @@ declare class Project implements Identifiable3<string> {
|
|
|
198
198
|
*/
|
|
199
199
|
sourceOfTruth: ProjectType | null;
|
|
200
200
|
/**
|
|
201
|
+
* Full name ({@code owner/repo}) of the GitHub repository backing this project.
|
|
202
|
+
* Stamped at create time by the server-side repo provisioner.
|
|
203
|
+
*/
|
|
204
|
+
repoFullName: string;
|
|
205
|
+
/**
|
|
206
|
+
* GitHub's stable repository id. Survives renames on the GitHub side.
|
|
207
|
+
*/
|
|
208
|
+
repoId: number;
|
|
209
|
+
/**
|
|
210
|
+
* Default branch of the backing repository at the time it was provisioned.
|
|
211
|
+
*/
|
|
212
|
+
defaultBranch: string;
|
|
213
|
+
/**
|
|
214
|
+
* Visibility chosen for the backing repository at create time. The SPA sets
|
|
215
|
+
* this before save; the platform passes it through to GitHub.
|
|
216
|
+
*/
|
|
217
|
+
repoPrivate: boolean;
|
|
218
|
+
/**
|
|
201
219
|
* The date and time the project was updated.
|
|
202
220
|
*/
|
|
203
221
|
updated: number | null;
|
|
@@ -562,18 +580,6 @@ interface SignUpCompleteRequest {
|
|
|
562
580
|
token: string;
|
|
563
581
|
password: string;
|
|
564
582
|
}
|
|
565
|
-
/**
|
|
566
|
-
* One row in the repo dropdown shown when linking a project. Carries just enough
|
|
567
|
-
* info for the UI; a successful link round-trips through
|
|
568
|
-
* {@link IProjectGitHubRepoService} which re-validates against GitHub before
|
|
569
|
-
* persisting.
|
|
570
|
-
*/
|
|
571
|
-
declare class AvailableRepo {
|
|
572
|
-
repoId: string;
|
|
573
|
-
fullName: string;
|
|
574
|
-
defaultBranch: string;
|
|
575
|
-
privateRepo: boolean;
|
|
576
|
-
}
|
|
577
583
|
import { Identifiable as Identifiable9 } from "@kinotic-ai/core";
|
|
578
584
|
/**
|
|
579
585
|
* Persisted record of one GitHub App installation that a Kinotic Org has authorised.
|
|
@@ -584,7 +590,7 @@ import { Identifiable as Identifiable9 } from "@kinotic-ai/core";
|
|
|
584
590
|
declare class GitHubAppInstallation implements Identifiable9<string> {
|
|
585
591
|
id: string | null;
|
|
586
592
|
organizationId: string;
|
|
587
|
-
githubInstallationId:
|
|
593
|
+
githubInstallationId: number;
|
|
588
594
|
accountLogin: string;
|
|
589
595
|
accountType: string;
|
|
590
596
|
suspendedAt: number | null;
|
|
@@ -592,37 +598,36 @@ declare class GitHubAppInstallation implements Identifiable9<string> {
|
|
|
592
598
|
updated: number | null;
|
|
593
599
|
}
|
|
594
600
|
/**
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
*
|
|
598
|
-
* (epoch milliseconds).
|
|
601
|
+
* A short-lived GitHub installation access token. Mirrors the Java
|
|
602
|
+
* {@code org.kinotic.github.api.model.GitHubToken}; {@code expiresAt} is the
|
|
603
|
+
* absolute UTC instant (epoch milliseconds) at which GitHub will reject the token.
|
|
599
604
|
*/
|
|
600
|
-
declare class
|
|
601
|
-
/** Bearer token to send as {@code Authorization: Bearer <token>}
|
|
605
|
+
declare class GitHubToken {
|
|
606
|
+
/** Bearer token to send as {@code Authorization: Bearer <token>}. */
|
|
602
607
|
token: string;
|
|
603
|
-
/** Absolute expiry (epoch milliseconds).
|
|
608
|
+
/** Absolute expiry (epoch milliseconds). Do not use past this point. */
|
|
604
609
|
expiresAt: number;
|
|
605
|
-
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* A {@link GitHubToken} bundled with the repository-clone metadata a worker needs
|
|
613
|
+
* to {@code git clone} the project's backing repo. Returned by
|
|
614
|
+
* {@code GitHubProjectRepoService.issueRepoToken}.
|
|
615
|
+
*/
|
|
616
|
+
declare class GitHubRepoToken extends GitHubToken {
|
|
617
|
+
/** {@code https://github.com/<owner>/<repo>.git} for the project's repo. */
|
|
606
618
|
cloneUrl: string;
|
|
607
|
-
/** Default branch on the
|
|
619
|
+
/** Default branch on the repo (e.g. {@code main}). */
|
|
608
620
|
defaultBranch: string;
|
|
609
621
|
}
|
|
610
|
-
import { Identifiable as Identifiable10 } from "@kinotic-ai/core";
|
|
611
622
|
/**
|
|
612
|
-
*
|
|
613
|
-
*
|
|
614
|
-
* (
|
|
615
|
-
*
|
|
623
|
+
* Result of finalising a GitHub install round-trip. {@code returnTo} echoes what
|
|
624
|
+
* the SPA staged when it called {@code startInstall(...)} and may carry query
|
|
625
|
+
* params (e.g. {@code /projects?openNewProject=1}) so the destination page can
|
|
626
|
+
* pick up where the user was.
|
|
616
627
|
*/
|
|
617
|
-
declare class
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
organizationId: string;
|
|
621
|
-
installationId: string;
|
|
622
|
-
repoFullName: string;
|
|
623
|
-
repoId: string;
|
|
624
|
-
defaultBranch: string;
|
|
625
|
-
updated: number | null;
|
|
628
|
+
declare class GitHubInstallCompletion {
|
|
629
|
+
installation: GitHubAppInstallation;
|
|
630
|
+
returnTo: string | null;
|
|
626
631
|
}
|
|
627
632
|
/**
|
|
628
633
|
* Configuration for a single entities path and its corresponding repository output.
|
|
@@ -1070,52 +1075,35 @@ declare class IamUserService extends CrudServiceProxy8<IamUser> implements IIamU
|
|
|
1070
1075
|
import { CrudServiceProxy as CrudServiceProxy9, IKinotic as IKinotic12, ICrudServiceProxy as ICrudServiceProxy9 } from "@kinotic-ai/core";
|
|
1071
1076
|
interface IGitHubAppInstallationService extends ICrudServiceProxy9<GitHubAppInstallation> {
|
|
1072
1077
|
/**
|
|
1073
|
-
* Stages a single-use
|
|
1074
|
-
*
|
|
1078
|
+
* Stages a single-use state token bound to the caller's organization plus the
|
|
1079
|
+
* supplied returnTo, then returns the GitHub install URL with that state
|
|
1075
1080
|
* embedded. The SPA performs {@code window.location = url}.
|
|
1076
|
-
*
|
|
1077
|
-
*
|
|
1078
|
-
*
|
|
1081
|
+
*
|
|
1082
|
+
* returnTo is echoed back from {@link completeInstall} and may carry query
|
|
1083
|
+
* params (e.g. {@code /projects?openNewProject=1}) so the destination page
|
|
1084
|
+
* can pick up where the user was.
|
|
1079
1085
|
*/
|
|
1080
|
-
startInstall(): Promise<string>;
|
|
1086
|
+
startInstall(returnTo: string | null): Promise<string>;
|
|
1087
|
+
/**
|
|
1088
|
+
* Finalises the install once GitHub has redirected the browser back to the SPA
|
|
1089
|
+
* callback. Consumes the staged state, fetches the install details from GitHub,
|
|
1090
|
+
* persists the {@link GitHubAppInstallation} row, and returns it along with the
|
|
1091
|
+
* original intent and returnTo.
|
|
1092
|
+
*/
|
|
1093
|
+
completeInstall(installationId: number, state: string): Promise<GitHubInstallCompletion>;
|
|
1081
1094
|
/**
|
|
1082
1095
|
* Returns the (at-most-one) installation bound to the caller's organization, or
|
|
1083
|
-
*
|
|
1084
|
-
*
|
|
1096
|
+
* null if GitHub is not yet linked. Drives the "linked / not linked" indicator
|
|
1097
|
+
* in the org-settings UI.
|
|
1085
1098
|
*/
|
|
1086
1099
|
findForCurrentOrg(): Promise<GitHubAppInstallation | null>;
|
|
1087
1100
|
}
|
|
1088
1101
|
declare class GitHubAppInstallationService extends CrudServiceProxy9<GitHubAppInstallation> implements IGitHubAppInstallationService {
|
|
1089
1102
|
constructor(kinotic: IKinotic12);
|
|
1090
|
-
startInstall(): Promise<string>;
|
|
1103
|
+
startInstall(returnTo: string | null): Promise<string>;
|
|
1104
|
+
completeInstall(installationId: number, state: string): Promise<GitHubInstallCompletion>;
|
|
1091
1105
|
findForCurrentOrg(): Promise<GitHubAppInstallation | null>;
|
|
1092
1106
|
}
|
|
1093
|
-
import { CrudServiceProxy as CrudServiceProxy10, IKinotic as IKinotic13, ICrudServiceProxy as ICrudServiceProxy10 } from "@kinotic-ai/core";
|
|
1094
|
-
interface IProjectGitHubRepoService extends ICrudServiceProxy10<ProjectGitHubRepoLink> {
|
|
1095
|
-
/**
|
|
1096
|
-
* Lists the repositories visible under the caller's organization's installation.
|
|
1097
|
-
* Calls GitHub on every invocation; not cached because the org admin may have
|
|
1098
|
-
* just toggled repo access.
|
|
1099
|
-
*/
|
|
1100
|
-
listAvailableRepos(): Promise<AvailableRepo[]>;
|
|
1101
|
-
/**
|
|
1102
|
-
* Creates or replaces the link for the given project. Validates that the chosen
|
|
1103
|
-
* {@code repoFullName} is reachable through the org's installation before
|
|
1104
|
-
* persisting.
|
|
1105
|
-
*/
|
|
1106
|
-
linkProject(projectId: string, repoFullName: string): Promise<ProjectGitHubRepoLink>;
|
|
1107
|
-
/** Removes the link for the given project, if any. */
|
|
1108
|
-
unlinkProject(projectId: string): Promise<void>;
|
|
1109
|
-
/** Returns the link for the given project, or {@code null} when none exists. */
|
|
1110
|
-
findByProject(projectId: string): Promise<ProjectGitHubRepoLink | null>;
|
|
1111
|
-
}
|
|
1112
|
-
declare class ProjectGitHubRepoService extends CrudServiceProxy10<ProjectGitHubRepoLink> implements IProjectGitHubRepoService {
|
|
1113
|
-
constructor(kinotic: IKinotic13);
|
|
1114
|
-
listAvailableRepos(): Promise<AvailableRepo[]>;
|
|
1115
|
-
linkProject(projectId: string, repoFullName: string): Promise<ProjectGitHubRepoLink>;
|
|
1116
|
-
unlinkProject(projectId: string): Promise<void>;
|
|
1117
|
-
findByProject(projectId: string): Promise<ProjectGitHubRepoLink | null>;
|
|
1118
|
-
}
|
|
1119
1107
|
import { KinoticPlugin } from "@kinotic-ai/core";
|
|
1120
1108
|
interface IOsApiExtension {
|
|
1121
1109
|
applications: IApplicationService;
|
|
@@ -1130,10 +1118,9 @@ interface IOsApiExtension {
|
|
|
1130
1118
|
workloads: IWorkloadService;
|
|
1131
1119
|
iamUsers: IIamUserService;
|
|
1132
1120
|
githubAppInstallations: IGitHubAppInstallationService;
|
|
1133
|
-
githubRepoLinks: IProjectGitHubRepoService;
|
|
1134
1121
|
}
|
|
1135
1122
|
declare const OsApiPlugin: KinoticPlugin<IOsApiExtension>;
|
|
1136
1123
|
declare module "@kinotic-ai/core" {
|
|
1137
1124
|
interface KinoticSingleton extends IOsApiExtension {}
|
|
1138
1125
|
}
|
|
1139
|
-
export { WorkloadStatus, WorkloadServiceProxy, Workload, VmProviderType, VmNodeStatus, VmNodeServiceProxy, VmNode, VersionDecorator, TimeReferenceDecorator, TextDecorator, TenantSelectionC3Type, TenantIdDecorator, SingleLoggerLevelsDescriptor, SignUpRequest, SignUpCompleteRequest, QueryOptionsC3Type, QueryDecorator, ProjectType, ProjectService,
|
|
1126
|
+
export { WorkloadStatus, WorkloadServiceProxy, Workload, VmProviderType, VmNodeStatus, VmNodeServiceProxy, VmNode, VersionDecorator, TimeReferenceDecorator, TextDecorator, TenantSelectionC3Type, TenantIdDecorator, SingleLoggerLevelsDescriptor, SignUpRequest, SignUpCompleteRequest, QueryOptionsC3Type, QueryDecorator, ProjectType, ProjectService, Project, ProgressType, PageableC3Type, PageC3Type, OsApiPlugin, OrganizationService, Organization, NotIndexedDecorator, NestedDecorator, NamedQueriesDefinitionService, NamedQueriesDefinition, MigrationService, MigrationResult, MigrationRequest, MigrationDefinition, LoggersDescriptor, LoggerLevelsDescriptor, LogManager, LogLevel, KinoticProjectConfig, InsightRequest, InsightProgress, IdDecorator, IamUserService, IamUser, IWorkloadService, IVmNodeService, IProjectService, IOsApiExtension, IOrganizationService, INamedQueriesDefinitionService, IMigrationService, ILogManager, IIamUserService, IGitHubAppInstallationService, IEntityDefinitionService, IDataInsightsService, IApplicationService, GroupLoggerLevelsDescriptor, GitHubToken, GitHubRepoToken, GitHubInstallCompletion, GitHubAppInstallationService, GitHubAppInstallation, FlattenedDecorator, EsIndexConfigurationDecorator, EntityDefinitionService, EntityDefinition, EntityDecorator, EntitiesPathConfig, DiscriminatorDecorator, DataInsightsService, DataInsightsComponent, AutoGeneratedIdDecorator, AuthType, ApplicationService, Application };
|
package/dist/index.js
CHANGED
|
@@ -202,6 +202,10 @@ class Project {
|
|
|
202
202
|
name;
|
|
203
203
|
description;
|
|
204
204
|
sourceOfTruth = null;
|
|
205
|
+
repoFullName;
|
|
206
|
+
repoId;
|
|
207
|
+
defaultBranch;
|
|
208
|
+
repoPrivate = true;
|
|
205
209
|
updated = null;
|
|
206
210
|
constructor(id, applicationId, name, description) {
|
|
207
211
|
this.id = id;
|
|
@@ -351,41 +355,31 @@ class IamUser {
|
|
|
351
355
|
created = null;
|
|
352
356
|
updated = null;
|
|
353
357
|
}
|
|
354
|
-
// packages/os-api/src/api/model/github/AvailableRepo.ts
|
|
355
|
-
class AvailableRepo {
|
|
356
|
-
repoId = "";
|
|
357
|
-
fullName = "";
|
|
358
|
-
defaultBranch = "";
|
|
359
|
-
privateRepo = false;
|
|
360
|
-
}
|
|
361
358
|
// packages/os-api/src/api/model/github/GitHubAppInstallation.ts
|
|
362
359
|
class GitHubAppInstallation {
|
|
363
360
|
id = null;
|
|
364
361
|
organizationId = "";
|
|
365
|
-
githubInstallationId =
|
|
362
|
+
githubInstallationId = 0;
|
|
366
363
|
accountLogin = "";
|
|
367
364
|
accountType = "";
|
|
368
365
|
suspendedAt = null;
|
|
369
366
|
created = null;
|
|
370
367
|
updated = null;
|
|
371
368
|
}
|
|
372
|
-
// packages/os-api/src/api/model/github/
|
|
373
|
-
class
|
|
369
|
+
// packages/os-api/src/api/model/github/GitHubToken.ts
|
|
370
|
+
class GitHubToken {
|
|
374
371
|
token = "";
|
|
375
372
|
expiresAt = 0;
|
|
373
|
+
}
|
|
374
|
+
// packages/os-api/src/api/model/github/GitHubRepoToken.ts
|
|
375
|
+
class GitHubRepoToken extends GitHubToken {
|
|
376
376
|
cloneUrl = "";
|
|
377
377
|
defaultBranch = "";
|
|
378
378
|
}
|
|
379
|
-
// packages/os-api/src/api/model/github/
|
|
380
|
-
class
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
organizationId = "";
|
|
384
|
-
installationId = "";
|
|
385
|
-
repoFullName = "";
|
|
386
|
-
repoId = "";
|
|
387
|
-
defaultBranch = "";
|
|
388
|
-
updated = null;
|
|
379
|
+
// packages/os-api/src/api/model/github/GitHubInstallCompletion.ts
|
|
380
|
+
class GitHubInstallCompletion {
|
|
381
|
+
installation;
|
|
382
|
+
returnTo = null;
|
|
389
383
|
}
|
|
390
384
|
// packages/os-api/src/api/model/KinoticProjectConfig.ts
|
|
391
385
|
class KinoticProjectConfig {
|
|
@@ -647,33 +641,16 @@ class GitHubAppInstallationService extends CrudServiceProxy9 {
|
|
|
647
641
|
constructor(kinotic) {
|
|
648
642
|
super(kinotic.serviceProxy("org.kinotic.github.api.services.GitHubAppInstallationService"));
|
|
649
643
|
}
|
|
650
|
-
startInstall() {
|
|
651
|
-
return this.serviceProxy.invoke("startInstall", []);
|
|
644
|
+
startInstall(returnTo) {
|
|
645
|
+
return this.serviceProxy.invoke("startInstall", [returnTo]);
|
|
646
|
+
}
|
|
647
|
+
completeInstall(installationId, state) {
|
|
648
|
+
return this.serviceProxy.invoke("completeInstall", [installationId, state]);
|
|
652
649
|
}
|
|
653
650
|
findForCurrentOrg() {
|
|
654
651
|
return this.serviceProxy.invoke("findForCurrentOrg", []);
|
|
655
652
|
}
|
|
656
653
|
}
|
|
657
|
-
// packages/os-api/src/api/services/IProjectGitHubRepoService.ts
|
|
658
|
-
import { CrudServiceProxy as CrudServiceProxy10 } from "@kinotic-ai/core";
|
|
659
|
-
|
|
660
|
-
class ProjectGitHubRepoService extends CrudServiceProxy10 {
|
|
661
|
-
constructor(kinotic) {
|
|
662
|
-
super(kinotic.serviceProxy("org.kinotic.github.api.services.ProjectGitHubRepoService"));
|
|
663
|
-
}
|
|
664
|
-
listAvailableRepos() {
|
|
665
|
-
return this.serviceProxy.invoke("listAvailableRepos", []);
|
|
666
|
-
}
|
|
667
|
-
linkProject(projectId, repoFullName) {
|
|
668
|
-
return this.serviceProxy.invoke("linkProject", [projectId, repoFullName]);
|
|
669
|
-
}
|
|
670
|
-
unlinkProject(projectId) {
|
|
671
|
-
return this.serviceProxy.invoke("unlinkProject", [projectId]);
|
|
672
|
-
}
|
|
673
|
-
findByProject(projectId) {
|
|
674
|
-
return this.serviceProxy.invoke("findByProject", [projectId]);
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
654
|
// packages/os-api/src/api/OsApiPlugin.ts
|
|
678
655
|
var OsApiPlugin = {
|
|
679
656
|
install(kinotic) {
|
|
@@ -689,8 +666,7 @@ var OsApiPlugin = {
|
|
|
689
666
|
vmNodes: new VmNodeServiceProxy(kinotic),
|
|
690
667
|
workloads: new WorkloadServiceProxy(kinotic),
|
|
691
668
|
iamUsers: new IamUserService(kinotic),
|
|
692
|
-
githubAppInstallations: new GitHubAppInstallationService(kinotic)
|
|
693
|
-
githubRepoLinks: new ProjectGitHubRepoService(kinotic)
|
|
669
|
+
githubAppInstallations: new GitHubAppInstallationService(kinotic)
|
|
694
670
|
};
|
|
695
671
|
}
|
|
696
672
|
};
|
|
@@ -712,8 +688,6 @@ export {
|
|
|
712
688
|
QueryDecorator,
|
|
713
689
|
ProjectType,
|
|
714
690
|
ProjectService,
|
|
715
|
-
ProjectGitHubRepoService,
|
|
716
|
-
ProjectGitHubRepoLink,
|
|
717
691
|
Project,
|
|
718
692
|
ProgressType,
|
|
719
693
|
PageableC3Type,
|
|
@@ -735,7 +709,9 @@ export {
|
|
|
735
709
|
IamUserService,
|
|
736
710
|
IamUser,
|
|
737
711
|
GroupLoggerLevelsDescriptor,
|
|
738
|
-
|
|
712
|
+
GitHubToken,
|
|
713
|
+
GitHubRepoToken,
|
|
714
|
+
GitHubInstallCompletion,
|
|
739
715
|
GitHubAppInstallationService,
|
|
740
716
|
GitHubAppInstallation,
|
|
741
717
|
FlattenedDecorator,
|
|
@@ -745,7 +721,6 @@ export {
|
|
|
745
721
|
EntityDecorator,
|
|
746
722
|
DiscriminatorDecorator,
|
|
747
723
|
DataInsightsService,
|
|
748
|
-
AvailableRepo,
|
|
749
724
|
AutoGeneratedIdDecorator,
|
|
750
725
|
AuthType,
|
|
751
726
|
ApplicationService,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kinotic-ai/os-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"rxjs": "^7.8.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@kinotic-ai/core": "1.2.
|
|
44
|
+
"@kinotic-ai/core": "1.2.2",
|
|
45
45
|
"@types/node": "^25.3.2",
|
|
46
46
|
"@vitest/coverage-v8": "^4.0.18",
|
|
47
47
|
"@vitest/runner": "^4.0.18",
|