@kinotic-ai/os-api 1.6.1 → 1.8.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 CHANGED
@@ -40,6 +40,9 @@ var __export = (target, all) => {
40
40
  // packages/os-api/src/index.ts
41
41
  var exports_src = {};
42
42
  __export(exports_src, {
43
+ isSystemParticipant: () => isSystemParticipant,
44
+ isOrganizationParticipant: () => isOrganizationParticipant,
45
+ isApplicationParticipant: () => isApplicationParticipant,
43
46
  WorkloadStatus: () => WorkloadStatus,
44
47
  WorkloadServiceProxy: () => WorkloadServiceProxy,
45
48
  Workload: () => Workload,
@@ -59,6 +62,7 @@ __export(exports_src, {
59
62
  ProjectService: () => ProjectService,
60
63
  Project: () => Project,
61
64
  ProgressType: () => ProgressType,
65
+ ParticipantType: () => ParticipantType,
62
66
  PageableC3Type: () => PageableC3Type,
63
67
  PageC3Type: () => PageC3Type,
64
68
  OsApiPlugin: () => OsApiPlugin,
@@ -449,8 +453,8 @@ class IamUser {
449
453
  authType = null;
450
454
  oidcSubject = null;
451
455
  oidcConfigId = null;
452
- authScopeType = "";
453
- authScopeId = "";
456
+ organizationId = null;
457
+ applicationId = null;
454
458
  tenantId = null;
455
459
  enabled = true;
456
460
  created = null;
@@ -493,6 +497,27 @@ class KinoticProjectConfig {
493
497
  fileExtensionForImports = ".js";
494
498
  validate;
495
499
  }
500
+ // packages/os-api/src/api/security/ParticipantType.ts
501
+ var ParticipantType;
502
+ ((ParticipantType2) => {
503
+ ParticipantType2["SYSTEM"] = "system";
504
+ ParticipantType2["ORGANIZATION"] = "organization";
505
+ ParticipantType2["APPLICATION"] = "application";
506
+ })(ParticipantType ||= {});
507
+ // packages/os-api/src/api/security/ParticipantGuards.ts
508
+ function scopeType(participant) {
509
+ return participant.type;
510
+ }
511
+ function isSystemParticipant(participant) {
512
+ return scopeType(participant) === "system" /* SYSTEM */;
513
+ }
514
+ function isOrganizationParticipant(participant) {
515
+ const type = scopeType(participant);
516
+ return type === "organization" /* ORGANIZATION */ || type === "application" /* APPLICATION */;
517
+ }
518
+ function isApplicationParticipant(participant) {
519
+ return scopeType(participant) === "application" /* APPLICATION */;
520
+ }
496
521
  // packages/os-api/src/api/services/IApplicationService.ts
497
522
  var import_core = require("@kinotic-ai/core");
498
523
 
@@ -714,25 +739,22 @@ var import_core8 = require("@kinotic-ai/core");
714
739
 
715
740
  class IamUserService extends import_core8.CrudServiceProxy {
716
741
  constructor(kinotic) {
717
- super(kinotic.serviceProxy("org.kinotic.os.api.services.iam.IamUserService"));
742
+ super(kinotic.serviceProxy("org.kinotic.domain.api.services.iam.IamUserService"));
718
743
  }
719
- findByEmailAndScope(email, authScopeType, authScopeId) {
720
- return this.serviceProxy.invoke("findByEmailAndScope", [email, authScopeType, authScopeId]);
744
+ findByEmail(email, organizationId, applicationId) {
745
+ return arguments.length >= 3 ? this.serviceProxy.invoke("findByEmail", [email, organizationId, applicationId]) : this.serviceProxy.invoke("findByEmail", [email]);
721
746
  }
722
- findByScope(authScopeType, authScopeId, pageable) {
723
- return this.serviceProxy.invoke("findByScope", [authScopeType, authScopeId, pageable]);
747
+ findFirstOrgUserByEmail(email) {
748
+ return this.serviceProxy.invoke("findFirstOrgUserByEmail", [email]);
724
749
  }
725
- createUser(user, password) {
726
- return this.serviceProxy.invoke("createUser", [user, password]);
727
- }
728
- changePassword(userId, currentPassword, newPassword) {
729
- return this.serviceProxy.invoke("changePassword", [userId, currentPassword, newPassword]);
750
+ findByOidcIdentity(oidcSubject, oidcConfigId, organizationId, applicationId) {
751
+ return this.serviceProxy.invoke("findByOidcIdentity", [oidcSubject, oidcConfigId, organizationId, applicationId]);
730
752
  }
731
- resetPassword(userId, newPassword) {
732
- return this.serviceProxy.invoke("resetPassword", [userId, newPassword]);
753
+ findAllByOidcIdentity(oidcSubject, oidcConfigId) {
754
+ return this.serviceProxy.invoke("findAllByOidcIdentity", [oidcSubject, oidcConfigId]);
733
755
  }
734
- findFirstByEmailInScopeType(email, authScopeType) {
735
- return this.serviceProxy.invoke("findFirstByEmailInScopeType", [email, authScopeType]);
756
+ createUser(user, password) {
757
+ return this.serviceProxy.invoke("createUser", [user, password]);
736
758
  }
737
759
  }
738
760
  // packages/os-api/src/api/services/IDeviceApprovalService.ts
package/dist/index.d.cts CHANGED
@@ -533,12 +533,12 @@ declare enum AuthType {
533
533
  }
534
534
  import { Identifiable as Identifiable8 } from "@kinotic-ai/core";
535
535
  /**
536
- * Represents an authenticated identity at any scope layer in the IAM system.
537
- * Each user is scoped to exactly one layer and is unique by email within that scope.
536
+ * Represents an authenticated identity in the IAM system. Scope is encoded structurally by
537
+ * which of {@link organizationId} / {@link applicationId} is set:
538
538
  *
539
- * - For SYSTEM and ORGANIZATION scopes, {@link tenantId} must be null.
540
- * - For APPLICATION scopes, {@link tenantId} is required and identifies the
541
- * client tenant the user belongs to within the application's data.
539
+ * - both null SYSTEM
540
+ * - {@link organizationId} only ORGANIZATION
541
+ * - both set APPLICATION, with {@link tenantId} identifying the end-user data slice
542
542
  */
543
543
  declare class IamUser implements Identifiable8<string> {
544
544
  id: string | null;
@@ -547,39 +547,42 @@ declare class IamUser implements Identifiable8<string> {
547
547
  authType: AuthType | null;
548
548
  oidcSubject: string | null;
549
549
  oidcConfigId: string | null;
550
- authScopeType: string;
551
- authScopeId: string;
550
+ organizationId: string | null;
551
+ applicationId: string | null;
552
552
  tenantId: string | null;
553
553
  enabled: boolean;
554
554
  created: number | null;
555
555
  updated: number | null;
556
556
  }
557
557
  /**
558
- * Sent to the server to initiate an organization sign-up.
559
- * The user provides {@link orgName}, {@link orgDescription}, {@link email}, and
560
- * {@link displayName}. The remaining fields ({@link id}, {@link verificationToken},
561
- * {@link expiresAt}, {@link created}) are populated by the server before the record
562
- * is persisted.
558
+ * Sent to {@code POST /api/signup} to start an email/password organization sign-up.
559
+ * Only the user's identity is collected up front; the organization name and password are
560
+ * provided after email verification (see {@link SignUpCompleteRequest}).
563
561
  */
564
562
  interface SignUpRequest {
565
- id?: string | null;
566
- verificationToken?: string | null;
567
- expiresAt?: number | null;
568
- created?: number | null;
569
- orgName: string;
570
- orgDescription?: string | null;
571
563
  email: string;
572
564
  displayName: string;
573
565
  }
574
566
  /**
575
- * Sent to the server to complete an organization sign-up after email verification.
576
- * The {@link token} comes from the verification email link; the {@link password}
577
- * is what the user enters on the "set your password" form.
567
+ * Sent to {@code POST /api/signup/complete} after the user clicks the verification link.
568
+ * The {@link token} comes from that link; {@link orgName} (with optional {@link orgDescription})
569
+ * names the organization to create, and {@link password} is the chosen account password.
578
570
  */
579
571
  interface SignUpCompleteRequest {
580
572
  token: string;
573
+ orgName: string;
574
+ orgDescription?: string | null;
581
575
  password: string;
582
576
  }
577
+ /**
578
+ * Sent to {@code POST /api/signup/complete-org} to finish an OIDC sign-up by naming the
579
+ * organization to create. The verified identity is held server-side, keyed by {@link token}.
580
+ */
581
+ interface CompleteOrgRequest {
582
+ token: string;
583
+ orgName: string;
584
+ orgDescription?: string | null;
585
+ }
583
586
  import { Identifiable as Identifiable9 } from "@kinotic-ai/core";
584
587
  /**
585
588
  * Persisted record of one GitHub App installation that a Kinotic Org has authorised.
@@ -693,6 +696,73 @@ declare class KinoticProjectConfig {
693
696
  */
694
697
  validate?: boolean;
695
698
  }
699
+ /**
700
+ * Identifies which scope layer a participant authenticated against. The server serializes this as
701
+ * the {@code type} discriminator on a participant, and it is used to narrow a base
702
+ * {@code IParticipant} to one of the scope-typed participant interfaces.
703
+ */
704
+ declare enum ParticipantType {
705
+ SYSTEM = "system",
706
+ ORGANIZATION = "organization",
707
+ APPLICATION = "application"
708
+ }
709
+ import { IParticipant } from "@kinotic-ai/core";
710
+ /**
711
+ * A participant authenticated against the platform SYSTEM scope — a platform operator with no
712
+ * organization or application context. Mirrors the server {@code SystemParticipant}.
713
+ */
714
+ interface ISystemParticipant extends IParticipant {
715
+ type: ParticipantType.SYSTEM;
716
+ }
717
+ import { IParticipant as IParticipant2 } from "@kinotic-ai/core";
718
+ /**
719
+ * A participant authenticated against an Organization. {@link organizationId} is the id of the
720
+ * owning Organization and is never null. {@link IApplicationParticipant} extends this type, so an
721
+ * application-scoped participant also satisfies it. Mirrors the server
722
+ * {@code OrganizationParticipant}.
723
+ */
724
+ interface IOrganizationParticipant extends IParticipant2 {
725
+ type: ParticipantType.ORGANIZATION | ParticipantType.APPLICATION;
726
+ /**
727
+ * The id of the Organization this participant is authenticated under; never null.
728
+ */
729
+ organizationId: string;
730
+ }
731
+ /**
732
+ * A participant authenticated against an Application. Extends {@link IOrganizationParticipant}
733
+ * because every Application belongs to an Organization, so an application-scoped session
734
+ * intrinsically carries the owning Organization's id as well. Mirrors the server
735
+ * {@code ApplicationParticipant}.
736
+ */
737
+ interface IApplicationParticipant extends IOrganizationParticipant {
738
+ type: ParticipantType.APPLICATION;
739
+ /**
740
+ * The id of the Application this participant is authenticated under; never null.
741
+ */
742
+ applicationId: string;
743
+ /**
744
+ * The tenant slice of the Application's end-user data this participant belongs to, or null
745
+ * when the Application is not multi-tenant.
746
+ */
747
+ tenantId?: string | null;
748
+ }
749
+ import { IParticipant as IParticipant3 } from "@kinotic-ai/core";
750
+ /**
751
+ * @return true if the participant authenticated against the platform SYSTEM scope
752
+ */
753
+ declare function isSystemParticipant(participant: IParticipant3): participant is ISystemParticipant;
754
+ /**
755
+ * Narrows to an {@link IOrganizationParticipant}, which carries an {@code organizationId}. An
756
+ * application-scoped participant satisfies this too, since every Application is owned by an
757
+ * Organization.
758
+ *
759
+ * @return true if the participant authenticated against an Organization or an Application
760
+ */
761
+ declare function isOrganizationParticipant(participant: IParticipant3): participant is IOrganizationParticipant;
762
+ /**
763
+ * @return true if the participant authenticated against an Application
764
+ */
765
+ declare function isApplicationParticipant(participant: IParticipant3): participant is IApplicationParticipant;
696
766
  import { IKinotic } from "@kinotic-ai/core";
697
767
  import { CrudServiceProxy, ICrudServiceProxy } from "@kinotic-ai/core";
698
768
  interface IApplicationService extends ICrudServiceProxy<Application> {
@@ -1012,65 +1082,46 @@ declare class WorkloadServiceProxy extends CrudServiceProxy7<Workload> implement
1012
1082
  countForNode(nodeId: string): Promise<number>;
1013
1083
  syncIndex(): Promise<void>;
1014
1084
  }
1015
- import { CrudServiceProxy as CrudServiceProxy8, IKinotic as IKinotic11, ICrudServiceProxy as ICrudServiceProxy8, Page as Page3, Pageable as Pageable4 } from "@kinotic-ai/core";
1085
+ import { CrudServiceProxy as CrudServiceProxy8, IKinotic as IKinotic11, ICrudServiceProxy as ICrudServiceProxy8 } from "@kinotic-ai/core";
1086
+ /**
1087
+ * Client proxy for the server's {@code IamUserService}; method shapes mirror the Java interface.
1088
+ *
1089
+ * NOTE: the server interface now lives in {@code kinotic-domain} and is not currently
1090
+ * {@code @Publish}-annotated, so this proxy is not callable over RPC until the backend publishes
1091
+ * the service. The shape here is kept in sync so it is ready once that happens; confirm the
1092
+ * published namespace before relying on it.
1093
+ */
1016
1094
  interface IIamUserService extends ICrudServiceProxy8<IamUser> {
1095
+ /** Finds the first user with the given email across all scopes, or null. */
1096
+ findByEmail(email: string): Promise<IamUser | null>;
1017
1097
  /**
1018
- * Finds the user with the given email within the given auth scope.
1019
- * @param email the email address to look up
1020
- * @param authScopeType the scope type the user is registered against (e.g. {@code SYSTEM}, {@code ORGANIZATION}, {@code APPLICATION})
1021
- * @param authScopeId the id of the scope the user is registered against
1022
- * @return {@link Promise} emitting the matching user, or {@code null} if no user matches
1098
+ * Finds the user with the given email within a scope identified structurally by
1099
+ * (organizationId, applicationId): both null SYSTEM, organizationId only → ORGANIZATION,
1100
+ * both set APPLICATION.
1023
1101
  */
1024
- findByEmailAndScope(email: string, authScopeType: string, authScopeId: string): Promise<IamUser | null>;
1102
+ findByEmail(email: string, organizationId: string | null, applicationId: string | null): Promise<IamUser | null>;
1025
1103
  /**
1026
- * Finds all users registered against the given auth scope.
1027
- * @param authScopeType the scope type to filter by (e.g. {@code SYSTEM}, {@code ORGANIZATION}, {@code APPLICATION})
1028
- * @param authScopeId the id of the scope to filter by
1029
- * @param pageable the paging and sort options
1030
- * @return {@link Promise} emitting a page of users registered against the scope
1104
+ * Finds the first ORGANIZATION-scope user with the given email across all organizations.
1105
+ * Used by sign-up to enforce one user per email before the new org's id exists.
1031
1106
  */
1032
- findByScope(authScopeType: string, authScopeId: string, pageable: Pageable4): Promise<Page3<IamUser>>;
1107
+ findFirstOrgUserByEmail(email: string): Promise<IamUser | null>;
1033
1108
  /**
1034
- * Creates a user and, if a password is provided, the matching credential.
1035
- * {@code APPLICATION}-scoped users must carry a {@code tenantId}; {@code SYSTEM} and {@code ORGANIZATION} users must not.
1036
- * @param user the user to create
1037
- * @param password the password to set, or {@code null} to create the user without a credential
1038
- * @return {@link Promise} emitting the persisted user
1109
+ * Finds the user (if any) with the given OIDC identity within a specific scope, using the
1110
+ * same (organizationId, applicationId) null conventions as {@link findByEmail}.
1039
1111
  */
1112
+ findByOidcIdentity(oidcSubject: string, oidcConfigId: string, organizationId: string | null, applicationId: string | null): Promise<IamUser | null>;
1113
+ /** Finds every user across scopes for a given OIDC identity — e.g. the orgs it can access. */
1114
+ findAllByOidcIdentity(oidcSubject: string, oidcConfigId: string): Promise<IamUser[]>;
1115
+ /** Creates a user and, if a password is provided, the matching credential. */
1040
1116
  createUser(user: IamUser, password: string | null): Promise<IamUser>;
1041
- /**
1042
- * Verifies the current password and updates it. Used when the user knows their current password.
1043
- * @param userId the id of the user whose password should be changed
1044
- * @param currentPassword the user's current password
1045
- * @param newPassword the new password to set
1046
- * @return {@link Promise} that resolves when the password has been updated
1047
- */
1048
- changePassword(userId: string, currentPassword: string, newPassword: string): Promise<void>;
1049
- /**
1050
- * Replaces the user's password without verifying the current one. Administrative reset.
1051
- * @param userId the id of the user whose password should be reset
1052
- * @param newPassword the new password to set
1053
- * @return {@link Promise} that resolves when the password has been reset
1054
- */
1055
- resetPassword(userId: string, newPassword: string): Promise<void>;
1056
- /**
1057
- * Finds the first user with the given email across all scope ids of the given scope type.
1058
- * Used by the sign-up flow to enforce one user per email at organization-creation time,
1059
- * before the new organization's scope id exists.
1060
- * @param email the email address to look up
1061
- * @param authScopeType the scope type to search within (e.g. {@code ORGANIZATION})
1062
- * @return {@link Promise} emitting the first matching user, or {@code null} if no user matches
1063
- */
1064
- findFirstByEmailInScopeType(email: string, authScopeType: string): Promise<IamUser | null>;
1065
1117
  }
1066
1118
  declare class IamUserService extends CrudServiceProxy8<IamUser> implements IIamUserService {
1067
1119
  constructor(kinotic: IKinotic11);
1068
- findByEmailAndScope(email: string, authScopeType: string, authScopeId: string): Promise<IamUser | null>;
1069
- findByScope(authScopeType: string, authScopeId: string, pageable: Pageable4): Promise<Page3<IamUser>>;
1120
+ findByEmail(email: string, organizationId?: string | null, applicationId?: string | null): Promise<IamUser | null>;
1121
+ findFirstOrgUserByEmail(email: string): Promise<IamUser | null>;
1122
+ findByOidcIdentity(oidcSubject: string, oidcConfigId: string, organizationId: string | null, applicationId: string | null): Promise<IamUser | null>;
1123
+ findAllByOidcIdentity(oidcSubject: string, oidcConfigId: string): Promise<IamUser[]>;
1070
1124
  createUser(user: IamUser, password: string | null): Promise<IamUser>;
1071
- changePassword(userId: string, currentPassword: string, newPassword: string): Promise<void>;
1072
- resetPassword(userId: string, newPassword: string): Promise<void>;
1073
- findFirstByEmailInScopeType(email: string, authScopeType: string): Promise<IamUser | null>;
1074
1125
  }
1075
1126
  import { IKinotic as IKinotic12 } from "@kinotic-ai/core";
1076
1127
  /**
@@ -1142,4 +1193,4 @@ declare const OsApiPlugin: KinoticPlugin<IOsApiExtension>;
1142
1193
  declare module "@kinotic-ai/core" {
1143
1194
  interface KinoticSingleton extends IOsApiExtension {}
1144
1195
  }
1145
- 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, IDeviceApprovalService, IDataInsightsService, IApplicationService, GroupLoggerLevelsDescriptor, GitHubToken, GitHubRepoToken, GitHubInstallCompletion, GitHubAppInstallationService, GitHubAppInstallation, FlattenedDecorator, EsIndexConfigurationDecorator, EntityDefinitionService, EntityDefinition, EntityDecorator, EntitiesPathConfig, DiscriminatorDecorator, DeviceApprovalService, DataInsightsService, DataInsightsComponent, AutoGeneratedIdDecorator, AuthType, ApplicationService, Application };
1196
+ export { isSystemParticipant, isOrganizationParticipant, isApplicationParticipant, WorkloadStatus, WorkloadServiceProxy, Workload, VmProviderType, VmNodeStatus, VmNodeServiceProxy, VmNode, VersionDecorator, TimeReferenceDecorator, TextDecorator, TenantSelectionC3Type, TenantIdDecorator, SingleLoggerLevelsDescriptor, SignUpRequest, SignUpCompleteRequest, QueryOptionsC3Type, QueryDecorator, ProjectType, ProjectService, Project, ProgressType, ParticipantType, 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, ISystemParticipant, IProjectService, IOsApiExtension, IOrganizationService, IOrganizationParticipant, INamedQueriesDefinitionService, IMigrationService, ILogManager, IIamUserService, IGitHubAppInstallationService, IEntityDefinitionService, IDeviceApprovalService, IDataInsightsService, IApplicationService, IApplicationParticipant, GroupLoggerLevelsDescriptor, GitHubToken, GitHubRepoToken, GitHubInstallCompletion, GitHubAppInstallationService, GitHubAppInstallation, FlattenedDecorator, EsIndexConfigurationDecorator, EntityDefinitionService, EntityDefinition, EntityDecorator, EntitiesPathConfig, DiscriminatorDecorator, DeviceApprovalService, DataInsightsService, DataInsightsComponent, CompleteOrgRequest, AutoGeneratedIdDecorator, AuthType, ApplicationService, Application };
package/dist/index.d.ts CHANGED
@@ -533,12 +533,12 @@ declare enum AuthType {
533
533
  }
534
534
  import { Identifiable as Identifiable8 } from "@kinotic-ai/core";
535
535
  /**
536
- * Represents an authenticated identity at any scope layer in the IAM system.
537
- * Each user is scoped to exactly one layer and is unique by email within that scope.
536
+ * Represents an authenticated identity in the IAM system. Scope is encoded structurally by
537
+ * which of {@link organizationId} / {@link applicationId} is set:
538
538
  *
539
- * - For SYSTEM and ORGANIZATION scopes, {@link tenantId} must be null.
540
- * - For APPLICATION scopes, {@link tenantId} is required and identifies the
541
- * client tenant the user belongs to within the application's data.
539
+ * - both null SYSTEM
540
+ * - {@link organizationId} only ORGANIZATION
541
+ * - both set APPLICATION, with {@link tenantId} identifying the end-user data slice
542
542
  */
543
543
  declare class IamUser implements Identifiable8<string> {
544
544
  id: string | null;
@@ -547,39 +547,42 @@ declare class IamUser implements Identifiable8<string> {
547
547
  authType: AuthType | null;
548
548
  oidcSubject: string | null;
549
549
  oidcConfigId: string | null;
550
- authScopeType: string;
551
- authScopeId: string;
550
+ organizationId: string | null;
551
+ applicationId: string | null;
552
552
  tenantId: string | null;
553
553
  enabled: boolean;
554
554
  created: number | null;
555
555
  updated: number | null;
556
556
  }
557
557
  /**
558
- * Sent to the server to initiate an organization sign-up.
559
- * The user provides {@link orgName}, {@link orgDescription}, {@link email}, and
560
- * {@link displayName}. The remaining fields ({@link id}, {@link verificationToken},
561
- * {@link expiresAt}, {@link created}) are populated by the server before the record
562
- * is persisted.
558
+ * Sent to {@code POST /api/signup} to start an email/password organization sign-up.
559
+ * Only the user's identity is collected up front; the organization name and password are
560
+ * provided after email verification (see {@link SignUpCompleteRequest}).
563
561
  */
564
562
  interface SignUpRequest {
565
- id?: string | null;
566
- verificationToken?: string | null;
567
- expiresAt?: number | null;
568
- created?: number | null;
569
- orgName: string;
570
- orgDescription?: string | null;
571
563
  email: string;
572
564
  displayName: string;
573
565
  }
574
566
  /**
575
- * Sent to the server to complete an organization sign-up after email verification.
576
- * The {@link token} comes from the verification email link; the {@link password}
577
- * is what the user enters on the "set your password" form.
567
+ * Sent to {@code POST /api/signup/complete} after the user clicks the verification link.
568
+ * The {@link token} comes from that link; {@link orgName} (with optional {@link orgDescription})
569
+ * names the organization to create, and {@link password} is the chosen account password.
578
570
  */
579
571
  interface SignUpCompleteRequest {
580
572
  token: string;
573
+ orgName: string;
574
+ orgDescription?: string | null;
581
575
  password: string;
582
576
  }
577
+ /**
578
+ * Sent to {@code POST /api/signup/complete-org} to finish an OIDC sign-up by naming the
579
+ * organization to create. The verified identity is held server-side, keyed by {@link token}.
580
+ */
581
+ interface CompleteOrgRequest {
582
+ token: string;
583
+ orgName: string;
584
+ orgDescription?: string | null;
585
+ }
583
586
  import { Identifiable as Identifiable9 } from "@kinotic-ai/core";
584
587
  /**
585
588
  * Persisted record of one GitHub App installation that a Kinotic Org has authorised.
@@ -693,6 +696,73 @@ declare class KinoticProjectConfig {
693
696
  */
694
697
  validate?: boolean;
695
698
  }
699
+ /**
700
+ * Identifies which scope layer a participant authenticated against. The server serializes this as
701
+ * the {@code type} discriminator on a participant, and it is used to narrow a base
702
+ * {@code IParticipant} to one of the scope-typed participant interfaces.
703
+ */
704
+ declare enum ParticipantType {
705
+ SYSTEM = "system",
706
+ ORGANIZATION = "organization",
707
+ APPLICATION = "application"
708
+ }
709
+ import { IParticipant } from "@kinotic-ai/core";
710
+ /**
711
+ * A participant authenticated against the platform SYSTEM scope — a platform operator with no
712
+ * organization or application context. Mirrors the server {@code SystemParticipant}.
713
+ */
714
+ interface ISystemParticipant extends IParticipant {
715
+ type: ParticipantType.SYSTEM;
716
+ }
717
+ import { IParticipant as IParticipant2 } from "@kinotic-ai/core";
718
+ /**
719
+ * A participant authenticated against an Organization. {@link organizationId} is the id of the
720
+ * owning Organization and is never null. {@link IApplicationParticipant} extends this type, so an
721
+ * application-scoped participant also satisfies it. Mirrors the server
722
+ * {@code OrganizationParticipant}.
723
+ */
724
+ interface IOrganizationParticipant extends IParticipant2 {
725
+ type: ParticipantType.ORGANIZATION | ParticipantType.APPLICATION;
726
+ /**
727
+ * The id of the Organization this participant is authenticated under; never null.
728
+ */
729
+ organizationId: string;
730
+ }
731
+ /**
732
+ * A participant authenticated against an Application. Extends {@link IOrganizationParticipant}
733
+ * because every Application belongs to an Organization, so an application-scoped session
734
+ * intrinsically carries the owning Organization's id as well. Mirrors the server
735
+ * {@code ApplicationParticipant}.
736
+ */
737
+ interface IApplicationParticipant extends IOrganizationParticipant {
738
+ type: ParticipantType.APPLICATION;
739
+ /**
740
+ * The id of the Application this participant is authenticated under; never null.
741
+ */
742
+ applicationId: string;
743
+ /**
744
+ * The tenant slice of the Application's end-user data this participant belongs to, or null
745
+ * when the Application is not multi-tenant.
746
+ */
747
+ tenantId?: string | null;
748
+ }
749
+ import { IParticipant as IParticipant3 } from "@kinotic-ai/core";
750
+ /**
751
+ * @return true if the participant authenticated against the platform SYSTEM scope
752
+ */
753
+ declare function isSystemParticipant(participant: IParticipant3): participant is ISystemParticipant;
754
+ /**
755
+ * Narrows to an {@link IOrganizationParticipant}, which carries an {@code organizationId}. An
756
+ * application-scoped participant satisfies this too, since every Application is owned by an
757
+ * Organization.
758
+ *
759
+ * @return true if the participant authenticated against an Organization or an Application
760
+ */
761
+ declare function isOrganizationParticipant(participant: IParticipant3): participant is IOrganizationParticipant;
762
+ /**
763
+ * @return true if the participant authenticated against an Application
764
+ */
765
+ declare function isApplicationParticipant(participant: IParticipant3): participant is IApplicationParticipant;
696
766
  import { IKinotic } from "@kinotic-ai/core";
697
767
  import { CrudServiceProxy, ICrudServiceProxy } from "@kinotic-ai/core";
698
768
  interface IApplicationService extends ICrudServiceProxy<Application> {
@@ -1012,65 +1082,46 @@ declare class WorkloadServiceProxy extends CrudServiceProxy7<Workload> implement
1012
1082
  countForNode(nodeId: string): Promise<number>;
1013
1083
  syncIndex(): Promise<void>;
1014
1084
  }
1015
- import { CrudServiceProxy as CrudServiceProxy8, IKinotic as IKinotic11, ICrudServiceProxy as ICrudServiceProxy8, Page as Page3, Pageable as Pageable4 } from "@kinotic-ai/core";
1085
+ import { CrudServiceProxy as CrudServiceProxy8, IKinotic as IKinotic11, ICrudServiceProxy as ICrudServiceProxy8 } from "@kinotic-ai/core";
1086
+ /**
1087
+ * Client proxy for the server's {@code IamUserService}; method shapes mirror the Java interface.
1088
+ *
1089
+ * NOTE: the server interface now lives in {@code kinotic-domain} and is not currently
1090
+ * {@code @Publish}-annotated, so this proxy is not callable over RPC until the backend publishes
1091
+ * the service. The shape here is kept in sync so it is ready once that happens; confirm the
1092
+ * published namespace before relying on it.
1093
+ */
1016
1094
  interface IIamUserService extends ICrudServiceProxy8<IamUser> {
1095
+ /** Finds the first user with the given email across all scopes, or null. */
1096
+ findByEmail(email: string): Promise<IamUser | null>;
1017
1097
  /**
1018
- * Finds the user with the given email within the given auth scope.
1019
- * @param email the email address to look up
1020
- * @param authScopeType the scope type the user is registered against (e.g. {@code SYSTEM}, {@code ORGANIZATION}, {@code APPLICATION})
1021
- * @param authScopeId the id of the scope the user is registered against
1022
- * @return {@link Promise} emitting the matching user, or {@code null} if no user matches
1098
+ * Finds the user with the given email within a scope identified structurally by
1099
+ * (organizationId, applicationId): both null SYSTEM, organizationId only → ORGANIZATION,
1100
+ * both set APPLICATION.
1023
1101
  */
1024
- findByEmailAndScope(email: string, authScopeType: string, authScopeId: string): Promise<IamUser | null>;
1102
+ findByEmail(email: string, organizationId: string | null, applicationId: string | null): Promise<IamUser | null>;
1025
1103
  /**
1026
- * Finds all users registered against the given auth scope.
1027
- * @param authScopeType the scope type to filter by (e.g. {@code SYSTEM}, {@code ORGANIZATION}, {@code APPLICATION})
1028
- * @param authScopeId the id of the scope to filter by
1029
- * @param pageable the paging and sort options
1030
- * @return {@link Promise} emitting a page of users registered against the scope
1104
+ * Finds the first ORGANIZATION-scope user with the given email across all organizations.
1105
+ * Used by sign-up to enforce one user per email before the new org's id exists.
1031
1106
  */
1032
- findByScope(authScopeType: string, authScopeId: string, pageable: Pageable4): Promise<Page3<IamUser>>;
1107
+ findFirstOrgUserByEmail(email: string): Promise<IamUser | null>;
1033
1108
  /**
1034
- * Creates a user and, if a password is provided, the matching credential.
1035
- * {@code APPLICATION}-scoped users must carry a {@code tenantId}; {@code SYSTEM} and {@code ORGANIZATION} users must not.
1036
- * @param user the user to create
1037
- * @param password the password to set, or {@code null} to create the user without a credential
1038
- * @return {@link Promise} emitting the persisted user
1109
+ * Finds the user (if any) with the given OIDC identity within a specific scope, using the
1110
+ * same (organizationId, applicationId) null conventions as {@link findByEmail}.
1039
1111
  */
1112
+ findByOidcIdentity(oidcSubject: string, oidcConfigId: string, organizationId: string | null, applicationId: string | null): Promise<IamUser | null>;
1113
+ /** Finds every user across scopes for a given OIDC identity — e.g. the orgs it can access. */
1114
+ findAllByOidcIdentity(oidcSubject: string, oidcConfigId: string): Promise<IamUser[]>;
1115
+ /** Creates a user and, if a password is provided, the matching credential. */
1040
1116
  createUser(user: IamUser, password: string | null): Promise<IamUser>;
1041
- /**
1042
- * Verifies the current password and updates it. Used when the user knows their current password.
1043
- * @param userId the id of the user whose password should be changed
1044
- * @param currentPassword the user's current password
1045
- * @param newPassword the new password to set
1046
- * @return {@link Promise} that resolves when the password has been updated
1047
- */
1048
- changePassword(userId: string, currentPassword: string, newPassword: string): Promise<void>;
1049
- /**
1050
- * Replaces the user's password without verifying the current one. Administrative reset.
1051
- * @param userId the id of the user whose password should be reset
1052
- * @param newPassword the new password to set
1053
- * @return {@link Promise} that resolves when the password has been reset
1054
- */
1055
- resetPassword(userId: string, newPassword: string): Promise<void>;
1056
- /**
1057
- * Finds the first user with the given email across all scope ids of the given scope type.
1058
- * Used by the sign-up flow to enforce one user per email at organization-creation time,
1059
- * before the new organization's scope id exists.
1060
- * @param email the email address to look up
1061
- * @param authScopeType the scope type to search within (e.g. {@code ORGANIZATION})
1062
- * @return {@link Promise} emitting the first matching user, or {@code null} if no user matches
1063
- */
1064
- findFirstByEmailInScopeType(email: string, authScopeType: string): Promise<IamUser | null>;
1065
1117
  }
1066
1118
  declare class IamUserService extends CrudServiceProxy8<IamUser> implements IIamUserService {
1067
1119
  constructor(kinotic: IKinotic11);
1068
- findByEmailAndScope(email: string, authScopeType: string, authScopeId: string): Promise<IamUser | null>;
1069
- findByScope(authScopeType: string, authScopeId: string, pageable: Pageable4): Promise<Page3<IamUser>>;
1120
+ findByEmail(email: string, organizationId?: string | null, applicationId?: string | null): Promise<IamUser | null>;
1121
+ findFirstOrgUserByEmail(email: string): Promise<IamUser | null>;
1122
+ findByOidcIdentity(oidcSubject: string, oidcConfigId: string, organizationId: string | null, applicationId: string | null): Promise<IamUser | null>;
1123
+ findAllByOidcIdentity(oidcSubject: string, oidcConfigId: string): Promise<IamUser[]>;
1070
1124
  createUser(user: IamUser, password: string | null): Promise<IamUser>;
1071
- changePassword(userId: string, currentPassword: string, newPassword: string): Promise<void>;
1072
- resetPassword(userId: string, newPassword: string): Promise<void>;
1073
- findFirstByEmailInScopeType(email: string, authScopeType: string): Promise<IamUser | null>;
1074
1125
  }
1075
1126
  import { IKinotic as IKinotic12 } from "@kinotic-ai/core";
1076
1127
  /**
@@ -1142,4 +1193,4 @@ declare const OsApiPlugin: KinoticPlugin<IOsApiExtension>;
1142
1193
  declare module "@kinotic-ai/core" {
1143
1194
  interface KinoticSingleton extends IOsApiExtension {}
1144
1195
  }
1145
- 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, IDeviceApprovalService, IDataInsightsService, IApplicationService, GroupLoggerLevelsDescriptor, GitHubToken, GitHubRepoToken, GitHubInstallCompletion, GitHubAppInstallationService, GitHubAppInstallation, FlattenedDecorator, EsIndexConfigurationDecorator, EntityDefinitionService, EntityDefinition, EntityDecorator, EntitiesPathConfig, DiscriminatorDecorator, DeviceApprovalService, DataInsightsService, DataInsightsComponent, AutoGeneratedIdDecorator, AuthType, ApplicationService, Application };
1196
+ export { isSystemParticipant, isOrganizationParticipant, isApplicationParticipant, WorkloadStatus, WorkloadServiceProxy, Workload, VmProviderType, VmNodeStatus, VmNodeServiceProxy, VmNode, VersionDecorator, TimeReferenceDecorator, TextDecorator, TenantSelectionC3Type, TenantIdDecorator, SingleLoggerLevelsDescriptor, SignUpRequest, SignUpCompleteRequest, QueryOptionsC3Type, QueryDecorator, ProjectType, ProjectService, Project, ProgressType, ParticipantType, 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, ISystemParticipant, IProjectService, IOsApiExtension, IOrganizationService, IOrganizationParticipant, INamedQueriesDefinitionService, IMigrationService, ILogManager, IIamUserService, IGitHubAppInstallationService, IEntityDefinitionService, IDeviceApprovalService, IDataInsightsService, IApplicationService, IApplicationParticipant, GroupLoggerLevelsDescriptor, GitHubToken, GitHubRepoToken, GitHubInstallCompletion, GitHubAppInstallationService, GitHubAppInstallation, FlattenedDecorator, EsIndexConfigurationDecorator, EntityDefinitionService, EntityDefinition, EntityDecorator, EntitiesPathConfig, DiscriminatorDecorator, DeviceApprovalService, DataInsightsService, DataInsightsComponent, CompleteOrgRequest, AutoGeneratedIdDecorator, AuthType, ApplicationService, Application };
package/dist/index.js CHANGED
@@ -349,8 +349,8 @@ class IamUser {
349
349
  authType = null;
350
350
  oidcSubject = null;
351
351
  oidcConfigId = null;
352
- authScopeType = "";
353
- authScopeId = "";
352
+ organizationId = null;
353
+ applicationId = null;
354
354
  tenantId = null;
355
355
  enabled = true;
356
356
  created = null;
@@ -393,6 +393,27 @@ class KinoticProjectConfig {
393
393
  fileExtensionForImports = ".js";
394
394
  validate;
395
395
  }
396
+ // packages/os-api/src/api/security/ParticipantType.ts
397
+ var ParticipantType;
398
+ ((ParticipantType2) => {
399
+ ParticipantType2["SYSTEM"] = "system";
400
+ ParticipantType2["ORGANIZATION"] = "organization";
401
+ ParticipantType2["APPLICATION"] = "application";
402
+ })(ParticipantType ||= {});
403
+ // packages/os-api/src/api/security/ParticipantGuards.ts
404
+ function scopeType(participant) {
405
+ return participant.type;
406
+ }
407
+ function isSystemParticipant(participant) {
408
+ return scopeType(participant) === "system" /* SYSTEM */;
409
+ }
410
+ function isOrganizationParticipant(participant) {
411
+ const type = scopeType(participant);
412
+ return type === "organization" /* ORGANIZATION */ || type === "application" /* APPLICATION */;
413
+ }
414
+ function isApplicationParticipant(participant) {
415
+ return scopeType(participant) === "application" /* APPLICATION */;
416
+ }
396
417
  // packages/os-api/src/api/services/IApplicationService.ts
397
418
  import { CrudServiceProxy } from "@kinotic-ai/core";
398
419
 
@@ -614,25 +635,22 @@ import { CrudServiceProxy as CrudServiceProxy8 } from "@kinotic-ai/core";
614
635
 
615
636
  class IamUserService extends CrudServiceProxy8 {
616
637
  constructor(kinotic) {
617
- super(kinotic.serviceProxy("org.kinotic.os.api.services.iam.IamUserService"));
638
+ super(kinotic.serviceProxy("org.kinotic.domain.api.services.iam.IamUserService"));
618
639
  }
619
- findByEmailAndScope(email, authScopeType, authScopeId) {
620
- return this.serviceProxy.invoke("findByEmailAndScope", [email, authScopeType, authScopeId]);
640
+ findByEmail(email, organizationId, applicationId) {
641
+ return arguments.length >= 3 ? this.serviceProxy.invoke("findByEmail", [email, organizationId, applicationId]) : this.serviceProxy.invoke("findByEmail", [email]);
621
642
  }
622
- findByScope(authScopeType, authScopeId, pageable) {
623
- return this.serviceProxy.invoke("findByScope", [authScopeType, authScopeId, pageable]);
643
+ findFirstOrgUserByEmail(email) {
644
+ return this.serviceProxy.invoke("findFirstOrgUserByEmail", [email]);
624
645
  }
625
- createUser(user, password) {
626
- return this.serviceProxy.invoke("createUser", [user, password]);
627
- }
628
- changePassword(userId, currentPassword, newPassword) {
629
- return this.serviceProxy.invoke("changePassword", [userId, currentPassword, newPassword]);
646
+ findByOidcIdentity(oidcSubject, oidcConfigId, organizationId, applicationId) {
647
+ return this.serviceProxy.invoke("findByOidcIdentity", [oidcSubject, oidcConfigId, organizationId, applicationId]);
630
648
  }
631
- resetPassword(userId, newPassword) {
632
- return this.serviceProxy.invoke("resetPassword", [userId, newPassword]);
649
+ findAllByOidcIdentity(oidcSubject, oidcConfigId) {
650
+ return this.serviceProxy.invoke("findAllByOidcIdentity", [oidcSubject, oidcConfigId]);
633
651
  }
634
- findFirstByEmailInScopeType(email, authScopeType) {
635
- return this.serviceProxy.invoke("findFirstByEmailInScopeType", [email, authScopeType]);
652
+ createUser(user, password) {
653
+ return this.serviceProxy.invoke("createUser", [user, password]);
636
654
  }
637
655
  }
638
656
  // packages/os-api/src/api/services/IDeviceApprovalService.ts
@@ -683,6 +701,9 @@ var OsApiPlugin = {
683
701
  }
684
702
  };
685
703
  export {
704
+ isSystemParticipant,
705
+ isOrganizationParticipant,
706
+ isApplicationParticipant,
686
707
  WorkloadStatus,
687
708
  WorkloadServiceProxy,
688
709
  Workload,
@@ -702,6 +723,7 @@ export {
702
723
  ProjectService,
703
724
  Project,
704
725
  ProgressType,
726
+ ParticipantType,
705
727
  PageableC3Type,
706
728
  PageC3Type,
707
729
  OsApiPlugin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kinotic-ai/os-api",
3
- "version": "1.6.1",
3
+ "version": "1.8.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -33,15 +33,15 @@
33
33
  "ui-test": "vitest --ui --coverage.enabled=true --mode development"
34
34
  },
35
35
  "peerDependencies": {
36
- "@kinotic-ai/core": ">=1.2.0"
36
+ "@kinotic-ai/core": ">=1.6.0"
37
37
  },
38
38
  "dependencies": {
39
39
  "@kinotic-ai/idl": "1.0.9",
40
- "@kinotic-ai/persistence": "1.2.1",
40
+ "@kinotic-ai/persistence": "1.3.1",
41
41
  "rxjs": "^7.8.2"
42
42
  },
43
43
  "devDependencies": {
44
- "@kinotic-ai/core": "1.4.0",
44
+ "@kinotic-ai/core": "1.6.0",
45
45
  "@types/node": "^25.3.2",
46
46
  "@vitest/coverage-v8": "^4.0.18",
47
47
  "@vitest/runner": "^4.0.18",