@kinotic-ai/app-api 5.0.0-beta.1

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/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # @kinotic-ai/app-api
2
+
3
+ Client API for the Kinotic platform's **application plane**: the tenant services addressed in the
4
+ `app-api` zone, which an application's own pages call for the user they serve: the user's tenant,
5
+ its members, the invitations into it and the grants its users hold on it.
6
+
7
+ ```typescript
8
+ import { Kinotic } from '@kinotic-ai/core'
9
+ import { AppApiPlugin } from '@kinotic-ai/app-api'
10
+
11
+ Kinotic.use(AppApiPlugin)
12
+ await Kinotic.connect()
13
+ const tenant = await Kinotic.tenant.getTenant()
14
+ await Kinotic.tenantMembers.inviteMember('colleague@example.com', 'Colleague')
15
+ ```
16
+
17
+ The management plane's client API lives in `@kinotic-ai/management-api`.
package/dist/index.cjs ADDED
@@ -0,0 +1,136 @@
1
+ var import_node_module = require("node:module");
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ function __accessProp(key) {
7
+ return this[key];
8
+ }
9
+ var __toCommonJS = (from) => {
10
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
11
+ if (entry)
12
+ return entry;
13
+ entry = __defProp({}, "__esModule", { value: true });
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (var key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(entry, key))
17
+ __defProp(entry, key, {
18
+ get: __accessProp.bind(from, key),
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ __moduleCache.set(from, entry);
23
+ return entry;
24
+ };
25
+ var __moduleCache;
26
+ var __returnValue = (v) => v;
27
+ function __exportSetter(name, newValue) {
28
+ this[name] = __returnValue.bind(null, newValue);
29
+ }
30
+ var __export = (target, all) => {
31
+ for (var name in all)
32
+ __defProp(target, name, {
33
+ get: all[name],
34
+ enumerable: true,
35
+ configurable: true,
36
+ set: __exportSetter.bind(all, name)
37
+ });
38
+ };
39
+
40
+ // packages/app-api/src/index.ts
41
+ var exports_src = {};
42
+ __export(exports_src, {
43
+ TenantService: () => TenantService,
44
+ TenantMemberService: () => TenantMemberService,
45
+ Tenant: () => Tenant,
46
+ AppApiPlugin: () => AppApiPlugin,
47
+ APP_API_ZONE: () => import_management_api3.APP_API_ZONE
48
+ });
49
+ module.exports = __toCommonJS(exports_src);
50
+ var import_management_api3 = require("@kinotic-ai/management-api");
51
+
52
+ // packages/app-api/src/api/model/Tenant.ts
53
+ class Tenant {
54
+ id;
55
+ organizationId;
56
+ applicationId;
57
+ tenantId;
58
+ name = "";
59
+ createdBy = null;
60
+ ssoConfigId = null;
61
+ ssoRoleId = null;
62
+ created = null;
63
+ updated = null;
64
+ }
65
+ // packages/app-api/src/api/services/ITenantService.ts
66
+ var import_management_api = require("@kinotic-ai/management-api");
67
+
68
+ class TenantService {
69
+ serviceProxy;
70
+ constructor(kinotic) {
71
+ this.serviceProxy = kinotic.serviceProxy(`${import_management_api.APP_API_ZONE}~org.kinotic.domain.api.services.TenantService`);
72
+ }
73
+ getTenant() {
74
+ return this.serviceProxy.invoke("getTenant", []);
75
+ }
76
+ rename(name) {
77
+ return this.serviceProxy.invoke("rename", [name]);
78
+ }
79
+ getSso() {
80
+ return this.serviceProxy.invoke("getSso", []);
81
+ }
82
+ configureSso(configuration, ssoRoleId) {
83
+ return this.serviceProxy.invoke("configureSso", [configuration, ssoRoleId]);
84
+ }
85
+ removeSso() {
86
+ return this.serviceProxy.invoke("removeSso", []);
87
+ }
88
+ }
89
+ // packages/app-api/src/api/services/security/ITenantMemberService.ts
90
+ var import_management_api2 = require("@kinotic-ai/management-api");
91
+ var import_core = require("@kinotic-ai/core");
92
+
93
+ class TenantMemberService {
94
+ serviceProxy;
95
+ constructor(kinotic) {
96
+ this.serviceProxy = kinotic.serviceProxy(`${import_management_api2.APP_API_ZONE}~org.kinotic.domain.api.services.security.TenantMemberService`);
97
+ }
98
+ async findMembers(pageable) {
99
+ const page = await this.serviceProxy.invoke("findMembers", [pageable]);
100
+ return new import_core.FunctionalIterablePage(pageable, page, (next) => this.serviceProxy.invoke("findMembers", [next]));
101
+ }
102
+ inviteMember(email, displayName) {
103
+ return this.serviceProxy.invoke("inviteMember", [email, displayName]);
104
+ }
105
+ async findPendingInvites(pageable) {
106
+ const page = await this.serviceProxy.invoke("findPendingInvites", [pageable]);
107
+ return new import_core.FunctionalIterablePage(pageable, page, (next) => this.serviceProxy.invoke("findPendingInvites", [next]));
108
+ }
109
+ cancelInvite(inviteId) {
110
+ return this.serviceProxy.invoke("cancelInvite", [inviteId]);
111
+ }
112
+ removeMember(userId) {
113
+ return this.serviceProxy.invoke("removeMember", [userId]);
114
+ }
115
+ findRoles() {
116
+ return this.serviceProxy.invoke("findRoles", []);
117
+ }
118
+ findGrants() {
119
+ return this.serviceProxy.invoke("findGrants", []);
120
+ }
121
+ grant(subject, roleId) {
122
+ return this.serviceProxy.invoke("grant", [subject, roleId]);
123
+ }
124
+ revoke(grantId) {
125
+ return this.serviceProxy.invoke("revoke", [grantId]);
126
+ }
127
+ }
128
+ // packages/app-api/src/api/AppApiPlugin.ts
129
+ var AppApiPlugin = {
130
+ install(kinotic) {
131
+ return {
132
+ tenant: new TenantService(kinotic),
133
+ tenantMembers: new TenantMemberService(kinotic)
134
+ };
135
+ }
136
+ };
@@ -0,0 +1,143 @@
1
+ import { APP_API_ZONE } from "@kinotic-ai/management-api";
2
+ import { Identifiable } from "@kinotic-ai/core";
3
+ /**
4
+ * One tenant of an application: the slice of the application's SHARED rows a group of its users share, and the
5
+ * object the application's store grants on. A tenant is created by a customer signing up, or by the application
6
+ * for each user when it isolates them.
7
+ */
8
+ declare class Tenant implements Identifiable<string> {
9
+ /** The record's id, <organizationId>.<applicationId>.<tenantId>. */
10
+ id: string;
11
+ organizationId: string;
12
+ applicationId: string;
13
+ /**
14
+ * The tenant's id within its application: what its users carry, the routing key of their shared rows, and
15
+ * the id of the tenant object in the application's store.
16
+ */
17
+ tenantId: string;
18
+ /** The name the tenant's users know it by, such as the customer's company name. */
19
+ name: string;
20
+ /** The user the tenant was created for: the customer who signed up, or the user it isolates. */
21
+ createdBy: string | null;
22
+ /**
23
+ * The id of the OidcConfiguration the tenant signs its users in with, or null while the tenant has no
24
+ * identity provider of its own.
25
+ */
26
+ ssoConfigId: string | null;
27
+ /**
28
+ * The role granted on the tenant to a user its identity provider signs in for the first time, such as
29
+ * tenant.viewer; null grants membership alone.
30
+ */
31
+ ssoRoleId: string | null;
32
+ created: string | null;
33
+ updated: string | null;
34
+ }
35
+ import { OidcConfiguration } from "@kinotic-ai/management-api";
36
+ import { IKinotic } from "@kinotic-ai/core";
37
+ /**
38
+ * The tenant the connected user belongs to, for an application's own pages: what it is called, and the
39
+ * identity provider its administrator chose for its users. Every function acts on the caller's tenant, and what the caller may do is
40
+ * checked on that tenant in the application's store.
41
+ */
42
+ interface ITenantService {
43
+ /** The caller's tenant. Needs tenant_can_view. */
44
+ getTenant(): Promise<Tenant>;
45
+ /** Renames the caller's tenant; its id stays what it was. Needs tenant_can_edit. */
46
+ rename(name: string): Promise<Tenant>;
47
+ /** The identity provider the caller's tenant signs its users in with, or null while it has none. */
48
+ getSso(): Promise<OidcConfiguration | null>;
49
+ /**
50
+ * Makes the given identity provider the caller's tenant's own, replacing the one it had: the tenant's
51
+ * users sign in through it from the application's login page by the tenant's id, and a user it signs in
52
+ * for the first time is created in the tenant, granted the given role on it. The configuration names the
53
+ * provider kind, the client id and the authority; a client secret is named by reference to one an
54
+ * operator stores, or left out for a public client. Needs tenant_can_edit.
55
+ * @param configuration the provider, as a new configuration; its ownership is set by the platform
56
+ * @param ssoRoleId the role granted to a user the provider signs in for the first time, one of those
57
+ * ITenantMemberService.findRoles lists, or null for membership alone
58
+ * @return the tenant as saved, naming the configuration
59
+ */
60
+ configureSso(configuration: OidcConfiguration, ssoRoleId: string | null): Promise<Tenant>;
61
+ /**
62
+ * Removes the caller's tenant's identity provider, so its users sign in with passwords; a user the
63
+ * provider created keeps its account. Needs tenant_can_edit.
64
+ * @return the tenant as saved
65
+ */
66
+ removeSso(): Promise<Tenant>;
67
+ }
68
+ declare class TenantService implements ITenantService {
69
+ private readonly serviceProxy;
70
+ constructor(kinotic: IKinotic);
71
+ getTenant(): Promise<Tenant>;
72
+ rename(name: string): Promise<Tenant>;
73
+ getSso(): Promise<OidcConfiguration | null>;
74
+ configureSso(configuration: OidcConfiguration, ssoRoleId: string | null): Promise<Tenant>;
75
+ removeSso(): Promise<Tenant>;
76
+ }
77
+ import { Grant, PendingInviteSummary, RoleDefinition, Subject, UserParticipantIdentity } from "@kinotic-ai/management-api";
78
+ import { IKinotic as IKinotic2, IterablePage, Pageable } from "@kinotic-ai/core";
79
+ /**
80
+ * The users of the connected user's tenant, for an application's own pages: who belongs to it, the invitations
81
+ * into it, and the grants its users hold on it. Every function acts on the caller's tenant, and what the caller
82
+ * may do is checked on that tenant in the application's store: viewing its members needs
83
+ * tenant_can_view_members, managing them tenant_can_manage_members, viewing its grants tenant_can_view_access
84
+ * and managing them tenant_can_manage_access, all of which the tenant's administrator holds.
85
+ */
86
+ interface ITenantMemberService {
87
+ /** The users of the tenant. */
88
+ findMembers(pageable: Pageable): Promise<IterablePage<UserParticipantIdentity>>;
89
+ /**
90
+ * Invites someone into the tenant by email: sends the invitation email and returns the pending invitation.
91
+ * Rejects when the email already has an account in the application or an invitation is pending for it,
92
+ * and when the application does not enable invitations into a tenant.
93
+ */
94
+ inviteMember(email: string, displayName: string | null): Promise<PendingInviteSummary>;
95
+ /** The live (unexpired) invitations into the tenant. */
96
+ findPendingInvites(pageable: Pageable): Promise<IterablePage<PendingInviteSummary>>;
97
+ /** Cancels an invitation into the tenant. */
98
+ cancelInvite(inviteId: string): Promise<void>;
99
+ /**
100
+ * Permanently removes a user of the tenant, including any stored credential. Callers cannot remove
101
+ * themselves.
102
+ */
103
+ removeMember(userId: string): Promise<void>;
104
+ /**
105
+ * Every role a grant on the tenant can name: the built-in roles of the tenant and of the rows of each entity
106
+ * definition inside it, each with the permissions it bundles.
107
+ */
108
+ findRoles(): Promise<RoleDefinition[]>;
109
+ /** The grants made on the tenant. */
110
+ findGrants(): Promise<Grant[]>;
111
+ /**
112
+ * Grants a role to a user of the tenant on the tenant, so the user holds every permission the role bundles
113
+ * on the tenant and on every row inside it.
114
+ * @param subject a user naming the identity id of one of the tenant's users
115
+ * @param roleId the role granted, one {@link findRoles} lists, such as tenant.viewer or invoice.editor
116
+ */
117
+ grant(subject: Subject, roleId: string): Promise<Grant>;
118
+ /** Revokes a grant made on the tenant. */
119
+ revoke(grantId: string): Promise<void>;
120
+ }
121
+ declare class TenantMemberService implements ITenantMemberService {
122
+ private readonly serviceProxy;
123
+ constructor(kinotic: IKinotic2);
124
+ findMembers(pageable: Pageable): Promise<IterablePage<UserParticipantIdentity>>;
125
+ inviteMember(email: string, displayName: string | null): Promise<PendingInviteSummary>;
126
+ findPendingInvites(pageable: Pageable): Promise<IterablePage<PendingInviteSummary>>;
127
+ cancelInvite(inviteId: string): Promise<void>;
128
+ removeMember(userId: string): Promise<void>;
129
+ findRoles(): Promise<RoleDefinition[]>;
130
+ findGrants(): Promise<Grant[]>;
131
+ grant(subject: Subject, roleId: string): Promise<Grant>;
132
+ revoke(grantId: string): Promise<void>;
133
+ }
134
+ import { KinoticPlugin } from "@kinotic-ai/core";
135
+ interface IAppApiExtension {
136
+ tenant: ITenantService;
137
+ tenantMembers: ITenantMemberService;
138
+ }
139
+ declare const AppApiPlugin: KinoticPlugin<IAppApiExtension>;
140
+ declare module "@kinotic-ai/core" {
141
+ interface KinoticSingleton extends IAppApiExtension {}
142
+ }
143
+ export { TenantService, TenantMemberService, Tenant, ITenantService, ITenantMemberService, IAppApiExtension, AppApiPlugin, APP_API_ZONE };
@@ -0,0 +1,143 @@
1
+ import { APP_API_ZONE } from "@kinotic-ai/management-api";
2
+ import { Identifiable } from "@kinotic-ai/core";
3
+ /**
4
+ * One tenant of an application: the slice of the application's SHARED rows a group of its users share, and the
5
+ * object the application's store grants on. A tenant is created by a customer signing up, or by the application
6
+ * for each user when it isolates them.
7
+ */
8
+ declare class Tenant implements Identifiable<string> {
9
+ /** The record's id, <organizationId>.<applicationId>.<tenantId>. */
10
+ id: string;
11
+ organizationId: string;
12
+ applicationId: string;
13
+ /**
14
+ * The tenant's id within its application: what its users carry, the routing key of their shared rows, and
15
+ * the id of the tenant object in the application's store.
16
+ */
17
+ tenantId: string;
18
+ /** The name the tenant's users know it by, such as the customer's company name. */
19
+ name: string;
20
+ /** The user the tenant was created for: the customer who signed up, or the user it isolates. */
21
+ createdBy: string | null;
22
+ /**
23
+ * The id of the OidcConfiguration the tenant signs its users in with, or null while the tenant has no
24
+ * identity provider of its own.
25
+ */
26
+ ssoConfigId: string | null;
27
+ /**
28
+ * The role granted on the tenant to a user its identity provider signs in for the first time, such as
29
+ * tenant.viewer; null grants membership alone.
30
+ */
31
+ ssoRoleId: string | null;
32
+ created: string | null;
33
+ updated: string | null;
34
+ }
35
+ import { OidcConfiguration } from "@kinotic-ai/management-api";
36
+ import { IKinotic } from "@kinotic-ai/core";
37
+ /**
38
+ * The tenant the connected user belongs to, for an application's own pages: what it is called, and the
39
+ * identity provider its administrator chose for its users. Every function acts on the caller's tenant, and what the caller may do is
40
+ * checked on that tenant in the application's store.
41
+ */
42
+ interface ITenantService {
43
+ /** The caller's tenant. Needs tenant_can_view. */
44
+ getTenant(): Promise<Tenant>;
45
+ /** Renames the caller's tenant; its id stays what it was. Needs tenant_can_edit. */
46
+ rename(name: string): Promise<Tenant>;
47
+ /** The identity provider the caller's tenant signs its users in with, or null while it has none. */
48
+ getSso(): Promise<OidcConfiguration | null>;
49
+ /**
50
+ * Makes the given identity provider the caller's tenant's own, replacing the one it had: the tenant's
51
+ * users sign in through it from the application's login page by the tenant's id, and a user it signs in
52
+ * for the first time is created in the tenant, granted the given role on it. The configuration names the
53
+ * provider kind, the client id and the authority; a client secret is named by reference to one an
54
+ * operator stores, or left out for a public client. Needs tenant_can_edit.
55
+ * @param configuration the provider, as a new configuration; its ownership is set by the platform
56
+ * @param ssoRoleId the role granted to a user the provider signs in for the first time, one of those
57
+ * ITenantMemberService.findRoles lists, or null for membership alone
58
+ * @return the tenant as saved, naming the configuration
59
+ */
60
+ configureSso(configuration: OidcConfiguration, ssoRoleId: string | null): Promise<Tenant>;
61
+ /**
62
+ * Removes the caller's tenant's identity provider, so its users sign in with passwords; a user the
63
+ * provider created keeps its account. Needs tenant_can_edit.
64
+ * @return the tenant as saved
65
+ */
66
+ removeSso(): Promise<Tenant>;
67
+ }
68
+ declare class TenantService implements ITenantService {
69
+ private readonly serviceProxy;
70
+ constructor(kinotic: IKinotic);
71
+ getTenant(): Promise<Tenant>;
72
+ rename(name: string): Promise<Tenant>;
73
+ getSso(): Promise<OidcConfiguration | null>;
74
+ configureSso(configuration: OidcConfiguration, ssoRoleId: string | null): Promise<Tenant>;
75
+ removeSso(): Promise<Tenant>;
76
+ }
77
+ import { Grant, PendingInviteSummary, RoleDefinition, Subject, UserParticipantIdentity } from "@kinotic-ai/management-api";
78
+ import { IKinotic as IKinotic2, IterablePage, Pageable } from "@kinotic-ai/core";
79
+ /**
80
+ * The users of the connected user's tenant, for an application's own pages: who belongs to it, the invitations
81
+ * into it, and the grants its users hold on it. Every function acts on the caller's tenant, and what the caller
82
+ * may do is checked on that tenant in the application's store: viewing its members needs
83
+ * tenant_can_view_members, managing them tenant_can_manage_members, viewing its grants tenant_can_view_access
84
+ * and managing them tenant_can_manage_access, all of which the tenant's administrator holds.
85
+ */
86
+ interface ITenantMemberService {
87
+ /** The users of the tenant. */
88
+ findMembers(pageable: Pageable): Promise<IterablePage<UserParticipantIdentity>>;
89
+ /**
90
+ * Invites someone into the tenant by email: sends the invitation email and returns the pending invitation.
91
+ * Rejects when the email already has an account in the application or an invitation is pending for it,
92
+ * and when the application does not enable invitations into a tenant.
93
+ */
94
+ inviteMember(email: string, displayName: string | null): Promise<PendingInviteSummary>;
95
+ /** The live (unexpired) invitations into the tenant. */
96
+ findPendingInvites(pageable: Pageable): Promise<IterablePage<PendingInviteSummary>>;
97
+ /** Cancels an invitation into the tenant. */
98
+ cancelInvite(inviteId: string): Promise<void>;
99
+ /**
100
+ * Permanently removes a user of the tenant, including any stored credential. Callers cannot remove
101
+ * themselves.
102
+ */
103
+ removeMember(userId: string): Promise<void>;
104
+ /**
105
+ * Every role a grant on the tenant can name: the built-in roles of the tenant and of the rows of each entity
106
+ * definition inside it, each with the permissions it bundles.
107
+ */
108
+ findRoles(): Promise<RoleDefinition[]>;
109
+ /** The grants made on the tenant. */
110
+ findGrants(): Promise<Grant[]>;
111
+ /**
112
+ * Grants a role to a user of the tenant on the tenant, so the user holds every permission the role bundles
113
+ * on the tenant and on every row inside it.
114
+ * @param subject a user naming the identity id of one of the tenant's users
115
+ * @param roleId the role granted, one {@link findRoles} lists, such as tenant.viewer or invoice.editor
116
+ */
117
+ grant(subject: Subject, roleId: string): Promise<Grant>;
118
+ /** Revokes a grant made on the tenant. */
119
+ revoke(grantId: string): Promise<void>;
120
+ }
121
+ declare class TenantMemberService implements ITenantMemberService {
122
+ private readonly serviceProxy;
123
+ constructor(kinotic: IKinotic2);
124
+ findMembers(pageable: Pageable): Promise<IterablePage<UserParticipantIdentity>>;
125
+ inviteMember(email: string, displayName: string | null): Promise<PendingInviteSummary>;
126
+ findPendingInvites(pageable: Pageable): Promise<IterablePage<PendingInviteSummary>>;
127
+ cancelInvite(inviteId: string): Promise<void>;
128
+ removeMember(userId: string): Promise<void>;
129
+ findRoles(): Promise<RoleDefinition[]>;
130
+ findGrants(): Promise<Grant[]>;
131
+ grant(subject: Subject, roleId: string): Promise<Grant>;
132
+ revoke(grantId: string): Promise<void>;
133
+ }
134
+ import { KinoticPlugin } from "@kinotic-ai/core";
135
+ interface IAppApiExtension {
136
+ tenant: ITenantService;
137
+ tenantMembers: ITenantMemberService;
138
+ }
139
+ declare const AppApiPlugin: KinoticPlugin<IAppApiExtension>;
140
+ declare module "@kinotic-ai/core" {
141
+ interface KinoticSingleton extends IAppApiExtension {}
142
+ }
143
+ export { TenantService, TenantMemberService, Tenant, ITenantService, ITenantMemberService, IAppApiExtension, AppApiPlugin, APP_API_ZONE };
package/dist/index.js ADDED
@@ -0,0 +1,99 @@
1
+ // packages/app-api/src/index.ts
2
+ import { APP_API_ZONE as APP_API_ZONE3 } from "@kinotic-ai/management-api";
3
+
4
+ // packages/app-api/src/api/model/Tenant.ts
5
+ class Tenant {
6
+ id;
7
+ organizationId;
8
+ applicationId;
9
+ tenantId;
10
+ name = "";
11
+ createdBy = null;
12
+ ssoConfigId = null;
13
+ ssoRoleId = null;
14
+ created = null;
15
+ updated = null;
16
+ }
17
+ // packages/app-api/src/api/services/ITenantService.ts
18
+ import { APP_API_ZONE } from "@kinotic-ai/management-api";
19
+
20
+ class TenantService {
21
+ serviceProxy;
22
+ constructor(kinotic) {
23
+ this.serviceProxy = kinotic.serviceProxy(`${APP_API_ZONE}~org.kinotic.domain.api.services.TenantService`);
24
+ }
25
+ getTenant() {
26
+ return this.serviceProxy.invoke("getTenant", []);
27
+ }
28
+ rename(name) {
29
+ return this.serviceProxy.invoke("rename", [name]);
30
+ }
31
+ getSso() {
32
+ return this.serviceProxy.invoke("getSso", []);
33
+ }
34
+ configureSso(configuration, ssoRoleId) {
35
+ return this.serviceProxy.invoke("configureSso", [configuration, ssoRoleId]);
36
+ }
37
+ removeSso() {
38
+ return this.serviceProxy.invoke("removeSso", []);
39
+ }
40
+ }
41
+ // packages/app-api/src/api/services/security/ITenantMemberService.ts
42
+ import {
43
+ APP_API_ZONE as APP_API_ZONE2
44
+ } from "@kinotic-ai/management-api";
45
+ import {
46
+ FunctionalIterablePage
47
+ } from "@kinotic-ai/core";
48
+
49
+ class TenantMemberService {
50
+ serviceProxy;
51
+ constructor(kinotic) {
52
+ this.serviceProxy = kinotic.serviceProxy(`${APP_API_ZONE2}~org.kinotic.domain.api.services.security.TenantMemberService`);
53
+ }
54
+ async findMembers(pageable) {
55
+ const page = await this.serviceProxy.invoke("findMembers", [pageable]);
56
+ return new FunctionalIterablePage(pageable, page, (next) => this.serviceProxy.invoke("findMembers", [next]));
57
+ }
58
+ inviteMember(email, displayName) {
59
+ return this.serviceProxy.invoke("inviteMember", [email, displayName]);
60
+ }
61
+ async findPendingInvites(pageable) {
62
+ const page = await this.serviceProxy.invoke("findPendingInvites", [pageable]);
63
+ return new FunctionalIterablePage(pageable, page, (next) => this.serviceProxy.invoke("findPendingInvites", [next]));
64
+ }
65
+ cancelInvite(inviteId) {
66
+ return this.serviceProxy.invoke("cancelInvite", [inviteId]);
67
+ }
68
+ removeMember(userId) {
69
+ return this.serviceProxy.invoke("removeMember", [userId]);
70
+ }
71
+ findRoles() {
72
+ return this.serviceProxy.invoke("findRoles", []);
73
+ }
74
+ findGrants() {
75
+ return this.serviceProxy.invoke("findGrants", []);
76
+ }
77
+ grant(subject, roleId) {
78
+ return this.serviceProxy.invoke("grant", [subject, roleId]);
79
+ }
80
+ revoke(grantId) {
81
+ return this.serviceProxy.invoke("revoke", [grantId]);
82
+ }
83
+ }
84
+ // packages/app-api/src/api/AppApiPlugin.ts
85
+ var AppApiPlugin = {
86
+ install(kinotic) {
87
+ return {
88
+ tenant: new TenantService(kinotic),
89
+ tenantMembers: new TenantMemberService(kinotic)
90
+ };
91
+ }
92
+ };
93
+ export {
94
+ TenantService,
95
+ TenantMemberService,
96
+ Tenant,
97
+ AppApiPlugin,
98
+ APP_API_ZONE3 as APP_API_ZONE
99
+ };
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@kinotic-ai/app-api",
3
+ "version": "5.0.0-beta.1",
4
+ "type": "module",
5
+ "description": "Client API for the Kinotic platform's application plane: the tenant services an application's own pages call for the user they serve.",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "module": "./dist/index.js",
10
+ "main": "./dist/index.cjs",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "import": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ },
18
+ "require": {
19
+ "types": "./dist/index.d.cts",
20
+ "default": "./dist/index.cjs"
21
+ }
22
+ },
23
+ "./package.json": "./package.json"
24
+ },
25
+ "homepage": "https://github.com/kinotic-ai/kinotic",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/kinotic-ai/kinotic.git",
29
+ "directory": "kinotic-js/workspace/packages/app-api"
30
+ },
31
+ "license": "Elastic License 2.0",
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "scripts": {
36
+ "type-check": "tsc --noEmit",
37
+ "test": "bun test --pass-with-no-tests",
38
+ "coverage": "bun test --coverage --pass-with-no-tests"
39
+ },
40
+ "peerDependencies": {
41
+ "@kinotic-ai/core": "^5.0.0-beta.18",
42
+ "@kinotic-ai/management-api": "^5.0.0-beta.48"
43
+ },
44
+ "devDependencies": {
45
+ "@kinotic-ai/core": "5.0.0-beta.18",
46
+ "@kinotic-ai/management-api": "5.0.0-beta.48",
47
+ "@types/bun": "^1.3.9",
48
+ "typescript": "^5.9.3"
49
+ }
50
+ }