@kinotic-ai/core 1.0.0-beta.0 → 1.0.0-beta.2
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 +62 -0
- package/dist/index.cjs +189 -280
- package/dist/index.d.cts +446 -517
- package/dist/index.d.ts +446 -517
- package/dist/index.js +189 -280
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1043,150 +1043,6 @@ class ConnectionInfo extends ServerInfo {
|
|
|
1043
1043
|
maxConnectionAttempts;
|
|
1044
1044
|
disableStickySession;
|
|
1045
1045
|
}
|
|
1046
|
-
// packages/core/src/core/api/crud/AbstractIterablePage.ts
|
|
1047
|
-
class AbstractIterablePage {
|
|
1048
|
-
pageable;
|
|
1049
|
-
currentPage;
|
|
1050
|
-
firstPage = true;
|
|
1051
|
-
constructor(pageable, page) {
|
|
1052
|
-
this.pageable = pageable;
|
|
1053
|
-
this.currentPage = page;
|
|
1054
|
-
}
|
|
1055
|
-
async next() {
|
|
1056
|
-
let ret;
|
|
1057
|
-
if (this.firstPage) {
|
|
1058
|
-
this.firstPage = false;
|
|
1059
|
-
ret = { done: !this.hasContent(), value: this };
|
|
1060
|
-
} else {
|
|
1061
|
-
if (this.isOffsetPageable()) {
|
|
1062
|
-
const offsetPageable = this.pageable;
|
|
1063
|
-
offsetPageable.pageNumber++;
|
|
1064
|
-
const numPages = Math.ceil(this.totalElements / this.pageable.pageSize);
|
|
1065
|
-
if (offsetPageable.pageNumber < numPages) {
|
|
1066
|
-
this.currentPage = await this.findNext(this.pageable);
|
|
1067
|
-
ret = { done: false, value: this };
|
|
1068
|
-
} else {
|
|
1069
|
-
ret = { done: true, value: this };
|
|
1070
|
-
}
|
|
1071
|
-
} else {
|
|
1072
|
-
const cursorPageable = this.pageable;
|
|
1073
|
-
cursorPageable.cursor = this.currentPage.cursor || null;
|
|
1074
|
-
this.currentPage = await this.findNext(this.pageable);
|
|
1075
|
-
ret = { done: this.isLastPage(), value: this };
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
return ret;
|
|
1079
|
-
}
|
|
1080
|
-
[Symbol.asyncIterator]() {
|
|
1081
|
-
return this;
|
|
1082
|
-
}
|
|
1083
|
-
hasContent() {
|
|
1084
|
-
return this.currentPage.content !== null && this.currentPage.content !== undefined && this.currentPage.content.length > 0;
|
|
1085
|
-
}
|
|
1086
|
-
isLastPage() {
|
|
1087
|
-
let ret;
|
|
1088
|
-
if (this.isOffsetPageable()) {
|
|
1089
|
-
const numPages = Math.ceil(this.totalElements / this.pageable.pageSize);
|
|
1090
|
-
ret = numPages === this.pageable.pageNumber + 1;
|
|
1091
|
-
} else {
|
|
1092
|
-
ret = !this.firstPage && this.currentPage.cursor === null;
|
|
1093
|
-
}
|
|
1094
|
-
return ret;
|
|
1095
|
-
}
|
|
1096
|
-
isOffsetPageable() {
|
|
1097
|
-
return this.pageable.pageNumber !== undefined;
|
|
1098
|
-
}
|
|
1099
|
-
get totalElements() {
|
|
1100
|
-
return this.currentPage.totalElements;
|
|
1101
|
-
}
|
|
1102
|
-
get cursor() {
|
|
1103
|
-
return this.currentPage.cursor;
|
|
1104
|
-
}
|
|
1105
|
-
get content() {
|
|
1106
|
-
return this.currentPage.content;
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
// packages/core/src/internal/core/api/crud/FindAllIterablePage.ts
|
|
1111
|
-
class FindAllIterablePage extends AbstractIterablePage {
|
|
1112
|
-
crudServiceProxy;
|
|
1113
|
-
constructor(pageable, page, crudServiceProxy) {
|
|
1114
|
-
super(pageable, page);
|
|
1115
|
-
this.crudServiceProxy = crudServiceProxy;
|
|
1116
|
-
}
|
|
1117
|
-
findNext(pageable) {
|
|
1118
|
-
return this.crudServiceProxy.findAllSinglePage(pageable);
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
// packages/core/src/internal/core/api/crud/SearchIterablePage.ts
|
|
1123
|
-
class SearchIterablePage extends AbstractIterablePage {
|
|
1124
|
-
searchText;
|
|
1125
|
-
crudServiceProxy;
|
|
1126
|
-
constructor(pageable, page, searchText, crudServiceProxy) {
|
|
1127
|
-
super(pageable, page);
|
|
1128
|
-
this.searchText = searchText;
|
|
1129
|
-
this.crudServiceProxy = crudServiceProxy;
|
|
1130
|
-
}
|
|
1131
|
-
findNext(pageable) {
|
|
1132
|
-
return this.crudServiceProxy.searchSinglePage(this.searchText, pageable);
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
// packages/core/src/core/api/crud/CrudServiceProxy.ts
|
|
1137
|
-
class CrudServiceProxy {
|
|
1138
|
-
serviceProxy;
|
|
1139
|
-
constructor(serviceProxy) {
|
|
1140
|
-
this.serviceProxy = serviceProxy;
|
|
1141
|
-
}
|
|
1142
|
-
count() {
|
|
1143
|
-
return this.serviceProxy.invoke("count");
|
|
1144
|
-
}
|
|
1145
|
-
create(entity) {
|
|
1146
|
-
return this.serviceProxy.invoke("create", [entity]);
|
|
1147
|
-
}
|
|
1148
|
-
deleteById(id) {
|
|
1149
|
-
return this.serviceProxy.invoke("deleteById", [id]);
|
|
1150
|
-
}
|
|
1151
|
-
async findAll(pageable) {
|
|
1152
|
-
const page = await this.findAllSinglePage(pageable);
|
|
1153
|
-
return new FindAllIterablePage(pageable, page, this);
|
|
1154
|
-
}
|
|
1155
|
-
findAllSinglePage(pageable) {
|
|
1156
|
-
return this.serviceProxy.invoke("findAll", [pageable]);
|
|
1157
|
-
}
|
|
1158
|
-
findById(id) {
|
|
1159
|
-
return this.serviceProxy.invoke("findById", [id]);
|
|
1160
|
-
}
|
|
1161
|
-
save(entity) {
|
|
1162
|
-
return this.serviceProxy.invoke("save", [entity]);
|
|
1163
|
-
}
|
|
1164
|
-
findByIdNotIn(ids, page) {
|
|
1165
|
-
return this.serviceProxy.invoke("findByIdNotIn", [ids, page]);
|
|
1166
|
-
}
|
|
1167
|
-
async search(searchText, pageable) {
|
|
1168
|
-
const page = await this.searchSinglePage(searchText, pageable);
|
|
1169
|
-
return new SearchIterablePage(pageable, page, searchText, this);
|
|
1170
|
-
}
|
|
1171
|
-
searchSinglePage(searchText, pageable) {
|
|
1172
|
-
return this.serviceProxy.invoke("search", [searchText, pageable]);
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
// packages/core/src/core/api/crud/CrudServiceProxyFactory.ts
|
|
1177
|
-
class CrudServiceProxyFactory {
|
|
1178
|
-
serviceRegistry;
|
|
1179
|
-
constructor(serviceRegistry) {
|
|
1180
|
-
this.serviceRegistry = serviceRegistry;
|
|
1181
|
-
}
|
|
1182
|
-
crudServiceProxy(serviceIdentifier) {
|
|
1183
|
-
if (typeof serviceIdentifier === "undefined" || serviceIdentifier.length === 0) {
|
|
1184
|
-
throw new Error("The serviceIdentifier provided must contain a value");
|
|
1185
|
-
}
|
|
1186
|
-
return new CrudServiceProxy(this.serviceRegistry.serviceProxy(serviceIdentifier));
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
1046
|
// packages/core/src/api/errors/KinoticError.ts
|
|
1191
1047
|
class KinoticError extends Error {
|
|
1192
1048
|
constructor(message) {
|
|
@@ -1195,7 +1051,7 @@ class KinoticError extends Error {
|
|
|
1195
1051
|
}
|
|
1196
1052
|
}
|
|
1197
1053
|
|
|
1198
|
-
// packages/core/src/
|
|
1054
|
+
// packages/core/src/api/event/IEventBus.ts
|
|
1199
1055
|
var EventConstants;
|
|
1200
1056
|
((EventConstants2) => {
|
|
1201
1057
|
EventConstants2["CONTENT_TYPE_HEADER"] = "content-type";
|
|
@@ -1223,7 +1079,7 @@ var EventConstants;
|
|
|
1223
1079
|
EventConstants2["TRACESTATE_HEADER"] = "tracestate";
|
|
1224
1080
|
})(EventConstants ||= {});
|
|
1225
1081
|
|
|
1226
|
-
// packages/core/src/
|
|
1082
|
+
// packages/core/src/internal/api/event/StompConnectionManager.ts
|
|
1227
1083
|
import { RxStomp } from "@stomp/rx-stomp";
|
|
1228
1084
|
import { ReconnectionTimeMode } from "@stomp/stompjs";
|
|
1229
1085
|
import { v4 as uuidv4 } from "uuid";
|
|
@@ -1390,7 +1246,7 @@ class StompConnectionManager {
|
|
|
1390
1246
|
}
|
|
1391
1247
|
}
|
|
1392
1248
|
|
|
1393
|
-
// packages/core/src/
|
|
1249
|
+
// packages/core/src/api/event/EventBus.ts
|
|
1394
1250
|
import { context, propagation } from "@opentelemetry/api";
|
|
1395
1251
|
import { firstValueFrom, Observable, Subject, throwError } from "rxjs";
|
|
1396
1252
|
import { filter, map, multicast } from "rxjs/operators";
|
|
@@ -1607,10 +1463,10 @@ class EventBus {
|
|
|
1607
1463
|
}
|
|
1608
1464
|
}
|
|
1609
1465
|
|
|
1610
|
-
// packages/core/src/
|
|
1466
|
+
// packages/core/src/api/ServiceRegistry.ts
|
|
1611
1467
|
import debug2 from "debug";
|
|
1612
1468
|
|
|
1613
|
-
// packages/core/src/
|
|
1469
|
+
// packages/core/src/api/event/DefaultCRI.ts
|
|
1614
1470
|
class DefaultCRI {
|
|
1615
1471
|
_scheme;
|
|
1616
1472
|
_scope;
|
|
@@ -1727,7 +1583,7 @@ class DefaultCRI {
|
|
|
1727
1583
|
}
|
|
1728
1584
|
}
|
|
1729
1585
|
|
|
1730
|
-
// packages/core/src/
|
|
1586
|
+
// packages/core/src/api/event/CRI.ts
|
|
1731
1587
|
function createCRI(...args) {
|
|
1732
1588
|
if (args.length === 1)
|
|
1733
1589
|
return new DefaultCRI(args[0]);
|
|
@@ -1740,7 +1596,7 @@ function createCRI(...args) {
|
|
|
1740
1596
|
throw new Error("Invalid arguments for createCRI");
|
|
1741
1597
|
}
|
|
1742
1598
|
|
|
1743
|
-
// packages/core/src/internal/
|
|
1599
|
+
// packages/core/src/internal/api/ArgumentResolver.ts
|
|
1744
1600
|
class JsonArgumentResolver {
|
|
1745
1601
|
resolveArguments(event) {
|
|
1746
1602
|
if (this.containsJsonContent(event)) {
|
|
@@ -1756,7 +1612,7 @@ class JsonArgumentResolver {
|
|
|
1756
1612
|
}
|
|
1757
1613
|
}
|
|
1758
1614
|
|
|
1759
|
-
// packages/core/src/internal/
|
|
1615
|
+
// packages/core/src/internal/api/EventUtil.ts
|
|
1760
1616
|
class EventUtil {
|
|
1761
1617
|
static createReplyEvent(incomingHeaders, headers, body) {
|
|
1762
1618
|
if (!incomingHeaders) {
|
|
@@ -1781,14 +1637,14 @@ class EventUtil {
|
|
|
1781
1637
|
}
|
|
1782
1638
|
}
|
|
1783
1639
|
|
|
1784
|
-
// packages/core/src/internal/
|
|
1640
|
+
// packages/core/src/internal/api/ReturnValueConverter.ts
|
|
1785
1641
|
class BasicReturnValueConverter {
|
|
1786
1642
|
convert(incomingMetadata, returnValue) {
|
|
1787
1643
|
return EventUtil.createReplyEvent(incomingMetadata, new Map([["content-type" /* CONTENT_TYPE_HEADER */, "application/json"]]), new TextEncoder().encode(JSON.stringify(returnValue)));
|
|
1788
1644
|
}
|
|
1789
1645
|
}
|
|
1790
1646
|
|
|
1791
|
-
// packages/core/src/internal/
|
|
1647
|
+
// packages/core/src/internal/api/Logger.ts
|
|
1792
1648
|
function createDebugLogger(namespace) {
|
|
1793
1649
|
let debug2;
|
|
1794
1650
|
try {
|
|
@@ -1808,7 +1664,7 @@ function createDebugLogger(namespace) {
|
|
|
1808
1664
|
// packages/core/src/api/KinoticDecorators.ts
|
|
1809
1665
|
var import_reflect_metadata = __toESM(require_Reflect(), 1);
|
|
1810
1666
|
|
|
1811
|
-
// packages/core/src/
|
|
1667
|
+
// packages/core/src/api/ServiceIdentifier.ts
|
|
1812
1668
|
class ServiceIdentifier {
|
|
1813
1669
|
namespace;
|
|
1814
1670
|
name;
|
|
@@ -1875,7 +1731,7 @@ function Publish(namespace, name) {
|
|
|
1875
1731
|
};
|
|
1876
1732
|
}
|
|
1877
1733
|
|
|
1878
|
-
// packages/core/src/internal/
|
|
1734
|
+
// packages/core/src/internal/api/ServiceInvocationSupervisor.ts
|
|
1879
1735
|
class ServiceInvocationSupervisor {
|
|
1880
1736
|
log;
|
|
1881
1737
|
active = false;
|
|
@@ -2055,7 +1911,7 @@ class ServiceInvocationSupervisor {
|
|
|
2055
1911
|
}
|
|
2056
1912
|
}
|
|
2057
1913
|
|
|
2058
|
-
// packages/core/src/
|
|
1914
|
+
// packages/core/src/api/ServiceRegistry.ts
|
|
2059
1915
|
import opentelemetry, { SpanKind, SpanStatusCode } from "@opentelemetry/api";
|
|
2060
1916
|
import {
|
|
2061
1917
|
ATTR_SERVER_ADDRESS,
|
|
@@ -2066,7 +1922,6 @@ import { first, map as map2 } from "rxjs/operators";
|
|
|
2066
1922
|
var package_default = {
|
|
2067
1923
|
name: "@kinotic-ai/core",
|
|
2068
1924
|
description: "Kinotic Core",
|
|
2069
|
-
version: "1.0.0-beta.0",
|
|
2070
1925
|
type: "module",
|
|
2071
1926
|
files: [
|
|
2072
1927
|
"dist"
|
|
@@ -2139,7 +1994,7 @@ var package_default = {
|
|
|
2139
1994
|
}
|
|
2140
1995
|
};
|
|
2141
1996
|
|
|
2142
|
-
// packages/core/src/
|
|
1997
|
+
// packages/core/src/api/ServiceRegistry.ts
|
|
2143
1998
|
class JsonEventFactory {
|
|
2144
1999
|
create(cri, args) {
|
|
2145
2000
|
const event = new Event(cri);
|
|
@@ -2288,11 +2143,9 @@ class ServiceProxy {
|
|
|
2288
2143
|
class KinoticSingleton {
|
|
2289
2144
|
_eventBus;
|
|
2290
2145
|
serviceRegistry;
|
|
2291
|
-
crudServiceProxyFactory;
|
|
2292
2146
|
constructor() {
|
|
2293
2147
|
this._eventBus = new EventBus;
|
|
2294
2148
|
this.serviceRegistry = new ServiceRegistry(this._eventBus);
|
|
2295
|
-
this.crudServiceProxyFactory = new CrudServiceProxyFactory(this.serviceRegistry);
|
|
2296
2149
|
}
|
|
2297
2150
|
get eventBus() {
|
|
2298
2151
|
return this._eventBus;
|
|
@@ -2310,131 +2163,154 @@ class KinoticSingleton {
|
|
|
2310
2163
|
serviceProxy(serviceIdentifier) {
|
|
2311
2164
|
return this.serviceRegistry.serviceProxy(serviceIdentifier);
|
|
2312
2165
|
}
|
|
2313
|
-
|
|
2314
|
-
|
|
2166
|
+
use(plugin) {
|
|
2167
|
+
const extension = plugin.install(this);
|
|
2168
|
+
return Object.assign(this, extension);
|
|
2315
2169
|
}
|
|
2316
2170
|
}
|
|
2317
2171
|
var Kinotic = new KinoticSingleton;
|
|
2318
|
-
// packages/core/src/api/
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
}
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
}
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
ret =
|
|
2172
|
+
// packages/core/src/api/crud/AbstractIterablePage.ts
|
|
2173
|
+
class AbstractIterablePage {
|
|
2174
|
+
pageable;
|
|
2175
|
+
currentPage;
|
|
2176
|
+
firstPage = true;
|
|
2177
|
+
constructor(pageable, page) {
|
|
2178
|
+
this.pageable = pageable;
|
|
2179
|
+
this.currentPage = page;
|
|
2180
|
+
}
|
|
2181
|
+
async next() {
|
|
2182
|
+
let ret;
|
|
2183
|
+
if (this.firstPage) {
|
|
2184
|
+
this.firstPage = false;
|
|
2185
|
+
ret = { done: !this.hasContent(), value: this };
|
|
2186
|
+
} else {
|
|
2187
|
+
if (this.isOffsetPageable()) {
|
|
2188
|
+
const offsetPageable = this.pageable;
|
|
2189
|
+
offsetPageable.pageNumber++;
|
|
2190
|
+
const numPages = Math.ceil(this.totalElements / this.pageable.pageSize);
|
|
2191
|
+
if (offsetPageable.pageNumber < numPages) {
|
|
2192
|
+
this.currentPage = await this.findNext(this.pageable);
|
|
2193
|
+
ret = { done: false, value: this };
|
|
2194
|
+
} else {
|
|
2195
|
+
ret = { done: true, value: this };
|
|
2196
|
+
}
|
|
2197
|
+
} else {
|
|
2198
|
+
const cursorPageable = this.pageable;
|
|
2199
|
+
cursorPageable.cursor = this.currentPage.cursor || null;
|
|
2200
|
+
this.currentPage = await this.findNext(this.pageable);
|
|
2201
|
+
ret = { done: this.isLastPage(), value: this };
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
return ret;
|
|
2205
|
+
}
|
|
2206
|
+
[Symbol.asyncIterator]() {
|
|
2207
|
+
return this;
|
|
2208
|
+
}
|
|
2209
|
+
hasContent() {
|
|
2210
|
+
return this.currentPage.content !== null && this.currentPage.content !== undefined && this.currentPage.content.length > 0;
|
|
2211
|
+
}
|
|
2212
|
+
isLastPage() {
|
|
2213
|
+
let ret;
|
|
2214
|
+
if (this.isOffsetPageable()) {
|
|
2215
|
+
const numPages = Math.ceil(this.totalElements / this.pageable.pageSize);
|
|
2216
|
+
ret = numPages === this.pageable.pageNumber + 1;
|
|
2363
2217
|
} else {
|
|
2364
|
-
ret =
|
|
2218
|
+
ret = !this.firstPage && this.currentPage.cursor === null;
|
|
2365
2219
|
}
|
|
2366
|
-
Object.assign(ret, data);
|
|
2367
2220
|
return ret;
|
|
2368
2221
|
}
|
|
2369
|
-
|
|
2370
|
-
return this.
|
|
2222
|
+
isOffsetPageable() {
|
|
2223
|
+
return this.pageable.pageNumber !== undefined;
|
|
2371
2224
|
}
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
// packages/core/src/api/errors/AuthenticationError.ts
|
|
2375
|
-
class AuthenticationError extends KinoticError {
|
|
2376
|
-
constructor(message) {
|
|
2377
|
-
super(message);
|
|
2378
|
-
Object.setPrototypeOf(this, AuthenticationError.prototype);
|
|
2225
|
+
get totalElements() {
|
|
2226
|
+
return this.currentPage.totalElements;
|
|
2379
2227
|
}
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
Object.setPrototypeOf(this, AuthorizationError.prototype);
|
|
2228
|
+
get cursor() {
|
|
2229
|
+
return this.currentPage.cursor;
|
|
2230
|
+
}
|
|
2231
|
+
get content() {
|
|
2232
|
+
return this.currentPage.content;
|
|
2386
2233
|
}
|
|
2387
2234
|
}
|
|
2388
|
-
// packages/core/src/api/
|
|
2389
|
-
class
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
tenantId;
|
|
2398
|
-
metadata;
|
|
2399
|
-
roles;
|
|
2400
|
-
constructor(id, tenantId, metadata, roles) {
|
|
2401
|
-
this.id = id;
|
|
2402
|
-
this.tenantId = tenantId;
|
|
2403
|
-
this.metadata = metadata || new Map;
|
|
2404
|
-
this.roles = roles || [];
|
|
2235
|
+
// packages/core/src/internal/api/crud/FindAllIterablePage.ts
|
|
2236
|
+
class FindAllIterablePage extends AbstractIterablePage {
|
|
2237
|
+
crudServiceProxy;
|
|
2238
|
+
constructor(pageable, page, crudServiceProxy) {
|
|
2239
|
+
super(pageable, page);
|
|
2240
|
+
this.crudServiceProxy = crudServiceProxy;
|
|
2241
|
+
}
|
|
2242
|
+
findNext(pageable) {
|
|
2243
|
+
return this.crudServiceProxy.findAllSinglePage(pageable);
|
|
2405
2244
|
}
|
|
2406
2245
|
}
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2246
|
+
|
|
2247
|
+
// packages/core/src/internal/api/crud/SearchIterablePage.ts
|
|
2248
|
+
class SearchIterablePage extends AbstractIterablePage {
|
|
2249
|
+
searchText;
|
|
2250
|
+
crudServiceProxy;
|
|
2251
|
+
constructor(pageable, page, searchText, crudServiceProxy) {
|
|
2252
|
+
super(pageable, page);
|
|
2253
|
+
this.searchText = searchText;
|
|
2254
|
+
this.crudServiceProxy = crudServiceProxy;
|
|
2255
|
+
}
|
|
2256
|
+
findNext(pageable) {
|
|
2257
|
+
return this.crudServiceProxy.searchSinglePage(this.searchText, pageable);
|
|
2258
|
+
}
|
|
2415
2259
|
}
|
|
2416
|
-
// packages/core/src/core/api/StreamData.ts
|
|
2417
|
-
var StreamOperation;
|
|
2418
|
-
((StreamOperation2) => {
|
|
2419
|
-
StreamOperation2["EXISTING"] = "EXISTING";
|
|
2420
|
-
StreamOperation2["UPDATE"] = "UPDATE";
|
|
2421
|
-
StreamOperation2["REMOVE"] = "REMOVE";
|
|
2422
|
-
})(StreamOperation ||= {});
|
|
2423
2260
|
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
this.
|
|
2261
|
+
// packages/core/src/api/crud/CrudServiceProxy.ts
|
|
2262
|
+
class CrudServiceProxy {
|
|
2263
|
+
serviceProxy;
|
|
2264
|
+
constructor(serviceProxy) {
|
|
2265
|
+
this.serviceProxy = serviceProxy;
|
|
2266
|
+
}
|
|
2267
|
+
count() {
|
|
2268
|
+
return this.serviceProxy.invoke("count");
|
|
2269
|
+
}
|
|
2270
|
+
create(entity) {
|
|
2271
|
+
return this.serviceProxy.invoke("create", [entity]);
|
|
2272
|
+
}
|
|
2273
|
+
deleteById(id) {
|
|
2274
|
+
return this.serviceProxy.invoke("deleteById", [id]);
|
|
2275
|
+
}
|
|
2276
|
+
async findAll(pageable) {
|
|
2277
|
+
const page = await this.findAllSinglePage(pageable);
|
|
2278
|
+
return new FindAllIterablePage(pageable, page, this);
|
|
2279
|
+
}
|
|
2280
|
+
findAllSinglePage(pageable) {
|
|
2281
|
+
return this.serviceProxy.invoke("findAll", [pageable]);
|
|
2282
|
+
}
|
|
2283
|
+
findById(id) {
|
|
2284
|
+
return this.serviceProxy.invoke("findById", [id]);
|
|
2432
2285
|
}
|
|
2433
|
-
|
|
2434
|
-
return this.
|
|
2286
|
+
save(entity) {
|
|
2287
|
+
return this.serviceProxy.invoke("save", [entity]);
|
|
2288
|
+
}
|
|
2289
|
+
findByIdNotIn(ids, page) {
|
|
2290
|
+
return this.serviceProxy.invoke("findByIdNotIn", [ids, page]);
|
|
2291
|
+
}
|
|
2292
|
+
async search(searchText, pageable) {
|
|
2293
|
+
const page = await this.searchSinglePage(searchText, pageable);
|
|
2294
|
+
return new SearchIterablePage(pageable, page, searchText, this);
|
|
2295
|
+
}
|
|
2296
|
+
searchSinglePage(searchText, pageable) {
|
|
2297
|
+
return this.serviceProxy.invoke("search", [searchText, pageable]);
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
// packages/core/src/api/crud/CrudServiceProxyFactory.ts
|
|
2301
|
+
class CrudServiceProxyFactory {
|
|
2302
|
+
serviceRegistry;
|
|
2303
|
+
constructor(serviceRegistry) {
|
|
2304
|
+
this.serviceRegistry = serviceRegistry;
|
|
2305
|
+
}
|
|
2306
|
+
crudServiceProxy(serviceIdentifier) {
|
|
2307
|
+
if (typeof serviceIdentifier === "undefined" || serviceIdentifier.length === 0) {
|
|
2308
|
+
throw new Error("The serviceIdentifier provided must contain a value");
|
|
2309
|
+
}
|
|
2310
|
+
return new CrudServiceProxy(this.serviceRegistry.serviceProxy(serviceIdentifier));
|
|
2435
2311
|
}
|
|
2436
2312
|
}
|
|
2437
|
-
// packages/core/src/
|
|
2313
|
+
// packages/core/src/api/crud/FunctionalIterablePage.ts
|
|
2438
2314
|
class FunctionalIterablePage extends AbstractIterablePage {
|
|
2439
2315
|
pageFunction;
|
|
2440
2316
|
constructor(pageable, page, pageFunction) {
|
|
@@ -2445,13 +2321,13 @@ class FunctionalIterablePage extends AbstractIterablePage {
|
|
|
2445
2321
|
return this.pageFunction(pageable);
|
|
2446
2322
|
}
|
|
2447
2323
|
}
|
|
2448
|
-
// packages/core/src/
|
|
2324
|
+
// packages/core/src/api/crud/IDataSource.ts
|
|
2449
2325
|
class DataSourceUtils {
|
|
2450
2326
|
static instanceOfEditableDataSource(datasource) {
|
|
2451
2327
|
return "create" in datasource;
|
|
2452
2328
|
}
|
|
2453
2329
|
}
|
|
2454
|
-
// packages/core/src/
|
|
2330
|
+
// packages/core/src/api/crud/Pageable.ts
|
|
2455
2331
|
class Pageable {
|
|
2456
2332
|
sort = null;
|
|
2457
2333
|
pageSize = 25;
|
|
@@ -2482,7 +2358,7 @@ class CursorPageable extends Pageable {
|
|
|
2482
2358
|
this.sort = sort;
|
|
2483
2359
|
}
|
|
2484
2360
|
}
|
|
2485
|
-
// packages/core/src/
|
|
2361
|
+
// packages/core/src/api/crud/Sort.ts
|
|
2486
2362
|
var Direction;
|
|
2487
2363
|
((Direction2) => {
|
|
2488
2364
|
Direction2["ASC"] = "ASC";
|
|
@@ -2516,15 +2392,53 @@ class Order {
|
|
|
2516
2392
|
class Sort {
|
|
2517
2393
|
orders = [];
|
|
2518
2394
|
}
|
|
2395
|
+
// packages/core/src/api/errors/AuthenticationError.ts
|
|
2396
|
+
class AuthenticationError extends KinoticError {
|
|
2397
|
+
constructor(message) {
|
|
2398
|
+
super(message);
|
|
2399
|
+
Object.setPrototypeOf(this, AuthenticationError.prototype);
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
// packages/core/src/api/errors/AuthorizationError.ts
|
|
2403
|
+
class AuthorizationError extends KinoticError {
|
|
2404
|
+
constructor(message) {
|
|
2405
|
+
super(message);
|
|
2406
|
+
Object.setPrototypeOf(this, AuthorizationError.prototype);
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
// packages/core/src/api/security/ConnectedInfo.ts
|
|
2410
|
+
class ConnectedInfo {
|
|
2411
|
+
sessionId;
|
|
2412
|
+
replyToId;
|
|
2413
|
+
participant;
|
|
2414
|
+
}
|
|
2415
|
+
// packages/core/src/api/security/Participant.ts
|
|
2416
|
+
class Participant {
|
|
2417
|
+
id;
|
|
2418
|
+
tenantId;
|
|
2419
|
+
metadata;
|
|
2420
|
+
roles;
|
|
2421
|
+
constructor(id, tenantId, metadata, roles) {
|
|
2422
|
+
this.id = id;
|
|
2423
|
+
this.tenantId = tenantId;
|
|
2424
|
+
this.metadata = metadata || new Map;
|
|
2425
|
+
this.roles = roles || [];
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
// packages/core/src/api/security/ParticipantConstants.ts
|
|
2429
|
+
class ParticipantConstants {
|
|
2430
|
+
static PARTICIPANT_TYPE_METADATA_KEY = "type";
|
|
2431
|
+
static PARTICIPANT_TYPE_DEVICE = "device";
|
|
2432
|
+
static PARTICIPANT_TYPE_CLI = "cli";
|
|
2433
|
+
static PARTICIPANT_TYPE_USER = "user";
|
|
2434
|
+
static PARTICIPANT_TYPE_NODE = "node";
|
|
2435
|
+
static CLI_PARTICIPANT_ID = "-42-Kinotic-CLI-42-";
|
|
2436
|
+
}
|
|
2519
2437
|
export {
|
|
2520
|
-
logManager,
|
|
2521
2438
|
createCRI,
|
|
2522
2439
|
Version,
|
|
2523
2440
|
TextEventFactory,
|
|
2524
|
-
StreamOperation,
|
|
2525
|
-
StreamData,
|
|
2526
2441
|
Sort,
|
|
2527
|
-
SingleLoggerLevelsDescriptor,
|
|
2528
2442
|
ServiceRegistry,
|
|
2529
2443
|
ServerInfo,
|
|
2530
2444
|
Scope,
|
|
@@ -2535,15 +2449,10 @@ export {
|
|
|
2535
2449
|
Order,
|
|
2536
2450
|
OffsetPageable,
|
|
2537
2451
|
NullHandling,
|
|
2538
|
-
LoggersDescriptor,
|
|
2539
|
-
LoggerLevelsDescriptor,
|
|
2540
|
-
LogManager,
|
|
2541
|
-
LogLevel,
|
|
2542
2452
|
KinoticSingleton,
|
|
2543
2453
|
KinoticError,
|
|
2544
2454
|
Kinotic,
|
|
2545
2455
|
JsonEventFactory,
|
|
2546
|
-
GroupLoggerLevelsDescriptor,
|
|
2547
2456
|
FunctionalIterablePage,
|
|
2548
2457
|
EventConstants,
|
|
2549
2458
|
EventBus,
|
package/package.json
CHANGED