@kinotic-ai/persistence 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 +65 -0
- package/dist/index.cjs +357 -0
- package/dist/index.d.cts +681 -0
- package/dist/index.d.ts +681 -0
- package/dist/index.js +318 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# @kinotic-ai/persistence
|
|
2
|
+
|
|
3
|
+
Instant, schema-driven data access for your Kinotic applications. `@kinotic-ai/persistence` eliminates the data layer boilerplate that slows every project down — define your entity once and get full CRUD, full-text search, pagination, bulk operations, and named queries without writing a single query or mapping file. It is designed for developers who want enterprise-grade data capabilities without the infrastructure overhead.
|
|
4
|
+
|
|
5
|
+
**[Get started at kinotic.ai/getting-started](https://kinotic.ai/getting-started)**
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Why @kinotic-ai/persistence?
|
|
10
|
+
|
|
11
|
+
- **Zero query boilerplate.** Decorate your TypeScript classes and the data layer is ready — no mappers, no repositories, no hand-written queries to maintain.
|
|
12
|
+
- **Search is a first-class feature.** Full-text search across your data is available immediately, as naturally as any other read operation.
|
|
13
|
+
- **Built for scale.** Pagination, bulk operations, and cursor-based traversal handle large datasets without architectural changes.
|
|
14
|
+
- **Multi-tenancy handled for you.** Data isolation between tenants is automatic — your application logic stays clean.
|
|
15
|
+
- **One line to activate.** Plugs directly into your existing Kinotic connection. No separate configuration, no extra infrastructure.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
### Decorator-Driven Entity Definition
|
|
22
|
+
Annotate your TypeScript classes with decorators from this package to define entities — ID generation, indexing behavior, precision, multi-tenancy, access policies, and more. Once decorated, the full data access layer — reads, writes, deletes, and queries — is available immediately. No separate schema files, no mapping layer to write or maintain.
|
|
23
|
+
|
|
24
|
+
### Full CRUD and Bulk Operations
|
|
25
|
+
Create, read, update, and delete individual records or entire batches with a consistent API. Bulk operations are designed for high-throughput scenarios without special-casing.
|
|
26
|
+
|
|
27
|
+
### Full-Text Search
|
|
28
|
+
Query your data with powerful full-text search out of the box. No separate search infrastructure required — it comes with the persistence layer.
|
|
29
|
+
|
|
30
|
+
### Flexible Pagination
|
|
31
|
+
Retrieve large result sets with both offset-based and cursor-based pagination. Switch between styles depending on the use case without changing your data model.
|
|
32
|
+
|
|
33
|
+
### Named and Reusable Queries
|
|
34
|
+
Define complex queries once, give them a name, and reuse them across your application. Query definitions are first-class citizens, not one-off strings scattered through your code.
|
|
35
|
+
|
|
36
|
+
### Multi-Tenancy and Data Isolation
|
|
37
|
+
Tenant boundaries are enforced automatically. Data from one tenant never leaks into another — no conditional filters to add, no policies to wire up manually.
|
|
38
|
+
|
|
39
|
+
### Optimistic Locking
|
|
40
|
+
Concurrent writes are safe by default. Optimistic locking prevents silent data conflicts without requiring pessimistic locks or complex transaction management.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Part of the Kinotic Ecosystem
|
|
45
|
+
|
|
46
|
+
`@kinotic-ai/persistence` sits in the middle of the Kinotic JavaScript/TypeScript stack:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
@kinotic-ai/os-api ← cloud OS management
|
|
50
|
+
@kinotic-ai/persistence ← schema-driven data access (this package)
|
|
51
|
+
@kinotic-ai/idl ← cross-language type schemas
|
|
52
|
+
@kinotic-ai/core ← connection & transport
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
It depends on `@kinotic-ai/core` for the platform connection and `@kinotic-ai/idl` for schema definitions. `@kinotic-ai/os-api` builds on top of it to provide full cloud OS management.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install @kinotic-ai/persistence
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
For full documentation, guides, and API reference, visit **[kinotic.ai](https://kinotic.ai)**.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
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/persistence/src/index.ts
|
|
41
|
+
var exports_src = {};
|
|
42
|
+
__export(exports_src, {
|
|
43
|
+
TenantSpecificId: () => TenantSpecificId,
|
|
44
|
+
QueryOptions: () => QueryOptions,
|
|
45
|
+
PrecisionType: () => PrecisionType,
|
|
46
|
+
PersistencePlugin: () => PersistencePlugin,
|
|
47
|
+
MultiTenancyType: () => MultiTenancyType,
|
|
48
|
+
KinoticSingleton: () => import_core5.KinoticSingleton,
|
|
49
|
+
Kinotic: () => import_core5.Kinotic,
|
|
50
|
+
EsIndexConfigurationData: () => EsIndexConfigurationData,
|
|
51
|
+
EntityType: () => EntityType,
|
|
52
|
+
EntityServiceDecoratorsDecorator: () => EntityServiceDecoratorsDecorator,
|
|
53
|
+
EntityServiceDecorator: () => EntityServiceDecorator,
|
|
54
|
+
EntityService: () => EntityService,
|
|
55
|
+
EntitiesService: () => EntitiesService,
|
|
56
|
+
AdminEntityService: () => AdminEntityService,
|
|
57
|
+
AdminEntitiesService: () => AdminEntitiesService
|
|
58
|
+
});
|
|
59
|
+
module.exports = __toCommonJS(exports_src);
|
|
60
|
+
|
|
61
|
+
// packages/persistence/src/api/model/QueryOptions.ts
|
|
62
|
+
class QueryOptions {
|
|
63
|
+
timeZone;
|
|
64
|
+
requestTimeout;
|
|
65
|
+
pageTimeout;
|
|
66
|
+
}
|
|
67
|
+
// packages/persistence/src/api/model/TenantSpecificId.ts
|
|
68
|
+
class TenantSpecificId {
|
|
69
|
+
entityId;
|
|
70
|
+
tenantId;
|
|
71
|
+
constructor(entityId, tenantId) {
|
|
72
|
+
this.entityId = entityId;
|
|
73
|
+
this.tenantId = tenantId;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// packages/persistence/src/api/idl/EntityServiceDecorator.ts
|
|
77
|
+
var import_idl = require("@kinotic-ai/idl");
|
|
78
|
+
|
|
79
|
+
class EntityServiceDecorator extends import_idl.C3Decorator {
|
|
80
|
+
}
|
|
81
|
+
// packages/persistence/src/api/idl/EntityServiceDecoratorsDecorator.ts
|
|
82
|
+
var import_idl2 = require("@kinotic-ai/idl");
|
|
83
|
+
|
|
84
|
+
class EntityServiceDecoratorsDecorator extends import_idl2.C3Decorator {
|
|
85
|
+
config;
|
|
86
|
+
constructor() {
|
|
87
|
+
super();
|
|
88
|
+
this.type = "EntityServiceDecoratorsDecorator";
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// packages/persistence/src/api/idl/EntityType.ts
|
|
92
|
+
var EntityType;
|
|
93
|
+
((EntityType2) => {
|
|
94
|
+
EntityType2[EntityType2["TABLE"] = 0] = "TABLE";
|
|
95
|
+
EntityType2[EntityType2["STREAM"] = 1] = "STREAM";
|
|
96
|
+
})(EntityType ||= {});
|
|
97
|
+
// packages/persistence/src/api/idl/EsIndexConfigurationData.ts
|
|
98
|
+
class EsIndexConfigurationData {
|
|
99
|
+
componentTemplates = [];
|
|
100
|
+
}
|
|
101
|
+
// packages/persistence/src/api/idl/MultiTenancyType.ts
|
|
102
|
+
var MultiTenancyType;
|
|
103
|
+
((MultiTenancyType2) => {
|
|
104
|
+
MultiTenancyType2[MultiTenancyType2["NONE"] = 0] = "NONE";
|
|
105
|
+
MultiTenancyType2[MultiTenancyType2["SHARED"] = 1] = "SHARED";
|
|
106
|
+
})(MultiTenancyType ||= {});
|
|
107
|
+
// packages/persistence/src/api/idl/PrecisionType.ts
|
|
108
|
+
var PrecisionType;
|
|
109
|
+
((PrecisionType2) => {
|
|
110
|
+
PrecisionType2[PrecisionType2["DOUBLE"] = 0] = "DOUBLE";
|
|
111
|
+
PrecisionType2[PrecisionType2["FLOAT"] = 1] = "FLOAT";
|
|
112
|
+
PrecisionType2[PrecisionType2["INT"] = 2] = "INT";
|
|
113
|
+
PrecisionType2[PrecisionType2["LONG"] = 3] = "LONG";
|
|
114
|
+
PrecisionType2[PrecisionType2["SHORT"] = 4] = "SHORT";
|
|
115
|
+
})(PrecisionType ||= {});
|
|
116
|
+
// packages/persistence/src/api/IEntitiesService.ts
|
|
117
|
+
var import_core = require("@kinotic-ai/core");
|
|
118
|
+
|
|
119
|
+
class EntitiesService {
|
|
120
|
+
serviceProxy;
|
|
121
|
+
constructor(kinotic) {
|
|
122
|
+
this.serviceProxy = kinotic.serviceProxy("org.kinotic.persistence.api.services.JsonEntitiesService");
|
|
123
|
+
}
|
|
124
|
+
bulkSave(structureId, entities) {
|
|
125
|
+
return this.serviceProxy.invoke("bulkSave", [structureId, entities]);
|
|
126
|
+
}
|
|
127
|
+
bulkUpdate(structureId, entities) {
|
|
128
|
+
return this.serviceProxy.invoke("bulkUpdate", [structureId, entities]);
|
|
129
|
+
}
|
|
130
|
+
count(structureId) {
|
|
131
|
+
return this.serviceProxy.invoke("count", [structureId]);
|
|
132
|
+
}
|
|
133
|
+
countByQuery(structureId, query) {
|
|
134
|
+
return this.serviceProxy.invoke("countByQuery", [structureId, query]);
|
|
135
|
+
}
|
|
136
|
+
deleteById(structureId, id) {
|
|
137
|
+
return this.serviceProxy.invoke("deleteById", [structureId, id]);
|
|
138
|
+
}
|
|
139
|
+
deleteByQuery(structureId, query) {
|
|
140
|
+
return this.serviceProxy.invoke("deleteByQuery", [structureId, query]);
|
|
141
|
+
}
|
|
142
|
+
async findAll(structureId, pageable) {
|
|
143
|
+
const page = await this.findAllSinglePage(structureId, pageable);
|
|
144
|
+
return new import_core.FunctionalIterablePage(pageable, page, (pageable2) => this.findAllSinglePage(structureId, pageable2));
|
|
145
|
+
}
|
|
146
|
+
async findAllSinglePage(structureId, pageable) {
|
|
147
|
+
return this.serviceProxy.invoke("findAll", [structureId, pageable]);
|
|
148
|
+
}
|
|
149
|
+
findById(structureId, id) {
|
|
150
|
+
return this.serviceProxy.invoke("findById", [structureId, id]);
|
|
151
|
+
}
|
|
152
|
+
findByIds(structureId, ids) {
|
|
153
|
+
return this.serviceProxy.invoke("findByIds", [structureId, ids]);
|
|
154
|
+
}
|
|
155
|
+
namedQuery(structureId, queryName, parameters) {
|
|
156
|
+
return this.serviceProxy.invoke("namedQuery", [structureId, queryName, parameters]);
|
|
157
|
+
}
|
|
158
|
+
async namedQueryPage(structureId, queryName, parameters, pageable) {
|
|
159
|
+
const page = await this.namedQuerySinglePage(structureId, queryName, parameters, pageable);
|
|
160
|
+
return new import_core.FunctionalIterablePage(pageable, page, (pageable2) => this.namedQuerySinglePage(structureId, queryName, parameters, pageable2));
|
|
161
|
+
}
|
|
162
|
+
namedQuerySinglePage(structureId, queryName, parameters, pageable) {
|
|
163
|
+
return this.serviceProxy.invoke("namedQueryPage", [structureId, queryName, parameters, pageable]);
|
|
164
|
+
}
|
|
165
|
+
save(structureId, entity) {
|
|
166
|
+
return this.serviceProxy.invoke("save", [structureId, entity]);
|
|
167
|
+
}
|
|
168
|
+
async search(structureId, searchText, pageable) {
|
|
169
|
+
const page = await this.searchSinglePage(structureId, searchText, pageable);
|
|
170
|
+
return new import_core.FunctionalIterablePage(pageable, page, (pageable2) => this.searchSinglePage(structureId, searchText, pageable2));
|
|
171
|
+
}
|
|
172
|
+
async searchSinglePage(structureId, searchText, pageable) {
|
|
173
|
+
return this.serviceProxy.invoke("search", [structureId, searchText, pageable]);
|
|
174
|
+
}
|
|
175
|
+
async syncIndex(structureId) {
|
|
176
|
+
return this.serviceProxy.invoke("syncIndex", [structureId]);
|
|
177
|
+
}
|
|
178
|
+
update(structureId, entity) {
|
|
179
|
+
return this.serviceProxy.invoke("update", [structureId, entity]);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// packages/persistence/src/api/IAdminEntitiesService.ts
|
|
183
|
+
var import_core2 = require("@kinotic-ai/core");
|
|
184
|
+
|
|
185
|
+
class AdminEntitiesService {
|
|
186
|
+
serviceProxy;
|
|
187
|
+
constructor(kinotic) {
|
|
188
|
+
this.serviceProxy = kinotic.serviceProxy("org.kinotic.persistence.api.services.AdminJsonEntitiesService");
|
|
189
|
+
}
|
|
190
|
+
count(structureId, tenantSelection) {
|
|
191
|
+
return this.serviceProxy.invoke("count", [structureId, tenantSelection]);
|
|
192
|
+
}
|
|
193
|
+
countByQuery(structureId, query, tenantSelection) {
|
|
194
|
+
return this.serviceProxy.invoke("countByQuery", [structureId, query, tenantSelection]);
|
|
195
|
+
}
|
|
196
|
+
deleteById(structureId, id) {
|
|
197
|
+
return this.serviceProxy.invoke("deleteById", [structureId, id]);
|
|
198
|
+
}
|
|
199
|
+
deleteByQuery(structureId, query, tenantSelection) {
|
|
200
|
+
return this.serviceProxy.invoke("deleteByQuery", [structureId, query, tenantSelection]);
|
|
201
|
+
}
|
|
202
|
+
async findAll(structureId, tenantSelection, pageable) {
|
|
203
|
+
const page = await this.findAllSinglePage(structureId, tenantSelection, pageable);
|
|
204
|
+
return new import_core2.FunctionalIterablePage(pageable, page, (pageable2) => this.findAllSinglePage(structureId, tenantSelection, pageable2));
|
|
205
|
+
}
|
|
206
|
+
async findAllSinglePage(structureId, tenantSelection, pageable) {
|
|
207
|
+
return this.serviceProxy.invoke("findAll", [structureId, tenantSelection, pageable]);
|
|
208
|
+
}
|
|
209
|
+
findById(structureId, id) {
|
|
210
|
+
return this.serviceProxy.invoke("findById", [structureId, id]);
|
|
211
|
+
}
|
|
212
|
+
findByIds(structureId, ids) {
|
|
213
|
+
return this.serviceProxy.invoke("findByIds", [structureId, ids]);
|
|
214
|
+
}
|
|
215
|
+
namedQuery(structureId, queryName, parameters) {
|
|
216
|
+
return this.serviceProxy.invoke("namedQuery", [structureId, queryName, parameters]);
|
|
217
|
+
}
|
|
218
|
+
async namedQueryPage(structureId, queryName, parameters, pageable) {
|
|
219
|
+
const page = await this.namedQuerySinglePage(structureId, queryName, parameters, pageable);
|
|
220
|
+
return new import_core2.FunctionalIterablePage(pageable, page, (pageable2) => this.namedQuerySinglePage(structureId, queryName, parameters, pageable2));
|
|
221
|
+
}
|
|
222
|
+
namedQuerySinglePage(structureId, queryName, parameters, pageable) {
|
|
223
|
+
return this.serviceProxy.invoke("namedQueryPage", [structureId, queryName, parameters, pageable]);
|
|
224
|
+
}
|
|
225
|
+
async search(structureId, searchText, tenantSelection, pageable) {
|
|
226
|
+
const page = await this.searchSinglePage(structureId, searchText, tenantSelection, pageable);
|
|
227
|
+
return new import_core2.FunctionalIterablePage(pageable, page, (pageable2) => this.searchSinglePage(structureId, searchText, tenantSelection, pageable2));
|
|
228
|
+
}
|
|
229
|
+
async searchSinglePage(structureId, searchText, tenantSelection, pageable) {
|
|
230
|
+
return this.serviceProxy.invoke("search", [structureId, searchText, tenantSelection, pageable]);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// packages/persistence/src/api/IEntityService.ts
|
|
234
|
+
var import_core3 = require("@kinotic-ai/core");
|
|
235
|
+
class EntityService {
|
|
236
|
+
structureApplicationId;
|
|
237
|
+
structureName;
|
|
238
|
+
structureId;
|
|
239
|
+
entitiesService;
|
|
240
|
+
constructor(structureApplicationId, structureName, entitiesService) {
|
|
241
|
+
this.structureApplicationId = structureApplicationId;
|
|
242
|
+
this.structureName = structureName;
|
|
243
|
+
this.structureId = (structureApplicationId + "." + structureName).toLowerCase();
|
|
244
|
+
this.entitiesService = entitiesService ?? new EntitiesService(import_core3.Kinotic);
|
|
245
|
+
}
|
|
246
|
+
async bulkSave(entities) {
|
|
247
|
+
const entitiesToSave = await this.beforeBulkSaveOrUpdate(entities);
|
|
248
|
+
return this.entitiesService.bulkSave(this.structureId, entitiesToSave);
|
|
249
|
+
}
|
|
250
|
+
async bulkUpdate(entities) {
|
|
251
|
+
const entitiesToSave = await this.beforeBulkSaveOrUpdate(entities);
|
|
252
|
+
return this.entitiesService.bulkUpdate(this.structureId, entitiesToSave);
|
|
253
|
+
}
|
|
254
|
+
count() {
|
|
255
|
+
return this.entitiesService.count(this.structureId);
|
|
256
|
+
}
|
|
257
|
+
countByQuery(query) {
|
|
258
|
+
return this.entitiesService.countByQuery(this.structureId, query);
|
|
259
|
+
}
|
|
260
|
+
deleteById(id) {
|
|
261
|
+
return this.entitiesService.deleteById(this.structureId, id);
|
|
262
|
+
}
|
|
263
|
+
deleteByQuery(query) {
|
|
264
|
+
return this.entitiesService.deleteByQuery(this.structureId, query);
|
|
265
|
+
}
|
|
266
|
+
findAll(pageable) {
|
|
267
|
+
return this.entitiesService.findAll(this.structureId, pageable);
|
|
268
|
+
}
|
|
269
|
+
findById(id) {
|
|
270
|
+
return this.entitiesService.findById(this.structureId, id);
|
|
271
|
+
}
|
|
272
|
+
findByIds(ids) {
|
|
273
|
+
return this.entitiesService.findByIds(this.structureId, ids);
|
|
274
|
+
}
|
|
275
|
+
namedQuery(queryName, queryParameters) {
|
|
276
|
+
return this.entitiesService.namedQuery(this.structureId, queryName, queryParameters);
|
|
277
|
+
}
|
|
278
|
+
namedQueryPage(queryName, queryParameters, pageable) {
|
|
279
|
+
return this.entitiesService.namedQueryPage(this.structureId, queryName, queryParameters, pageable);
|
|
280
|
+
}
|
|
281
|
+
async save(entity) {
|
|
282
|
+
const entityToSave = await this.beforeSaveOrUpdate(entity);
|
|
283
|
+
return this.entitiesService.save(this.structureId, entityToSave);
|
|
284
|
+
}
|
|
285
|
+
search(searchText, pageable) {
|
|
286
|
+
return this.entitiesService.search(this.structureId, searchText, pageable);
|
|
287
|
+
}
|
|
288
|
+
async syncIndex() {
|
|
289
|
+
return this.entitiesService.syncIndex(this.structureId);
|
|
290
|
+
}
|
|
291
|
+
async update(entity) {
|
|
292
|
+
const entityToSave = await this.beforeSaveOrUpdate(entity);
|
|
293
|
+
return this.entitiesService.update(this.structureId, entityToSave);
|
|
294
|
+
}
|
|
295
|
+
async beforeBulkSaveOrUpdate(entities) {
|
|
296
|
+
return Promise.resolve(entities);
|
|
297
|
+
}
|
|
298
|
+
async beforeSaveOrUpdate(entity) {
|
|
299
|
+
return Promise.resolve(entity);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
// packages/persistence/src/api/IAdminEntityService.ts
|
|
303
|
+
var import_core4 = require("@kinotic-ai/core");
|
|
304
|
+
class AdminEntityService {
|
|
305
|
+
structureApplicationId;
|
|
306
|
+
structureName;
|
|
307
|
+
structureId;
|
|
308
|
+
adminEntitiesService;
|
|
309
|
+
constructor(structureApplicationId, structureName, adminEntitiesService) {
|
|
310
|
+
this.structureApplicationId = structureApplicationId;
|
|
311
|
+
this.structureName = structureName;
|
|
312
|
+
this.structureId = (structureApplicationId + "." + structureName).toLowerCase();
|
|
313
|
+
this.adminEntitiesService = adminEntitiesService ?? new AdminEntitiesService(import_core4.Kinotic);
|
|
314
|
+
}
|
|
315
|
+
count(tenantSelection) {
|
|
316
|
+
return this.adminEntitiesService.count(this.structureId, tenantSelection);
|
|
317
|
+
}
|
|
318
|
+
countByQuery(query, tenantSelection) {
|
|
319
|
+
return this.adminEntitiesService.countByQuery(this.structureId, query, tenantSelection);
|
|
320
|
+
}
|
|
321
|
+
deleteById(id) {
|
|
322
|
+
return this.adminEntitiesService.deleteById(this.structureId, id);
|
|
323
|
+
}
|
|
324
|
+
deleteByQuery(query, tenantSelection) {
|
|
325
|
+
return this.adminEntitiesService.deleteByQuery(this.structureId, query, tenantSelection);
|
|
326
|
+
}
|
|
327
|
+
findAll(tenantSelection, pageable) {
|
|
328
|
+
return this.adminEntitiesService.findAll(this.structureId, tenantSelection, pageable);
|
|
329
|
+
}
|
|
330
|
+
findById(id) {
|
|
331
|
+
return this.adminEntitiesService.findById(this.structureId, id);
|
|
332
|
+
}
|
|
333
|
+
findByIds(ids) {
|
|
334
|
+
return this.adminEntitiesService.findByIds(this.structureId, ids);
|
|
335
|
+
}
|
|
336
|
+
namedQuery(queryName, queryParameters) {
|
|
337
|
+
return this.adminEntitiesService.namedQuery(this.structureId, queryName, queryParameters);
|
|
338
|
+
}
|
|
339
|
+
namedQueryPage(queryName, queryParameters, pageable) {
|
|
340
|
+
return this.adminEntitiesService.namedQueryPage(this.structureId, queryName, queryParameters, pageable);
|
|
341
|
+
}
|
|
342
|
+
search(searchText, tenantSelection, pageable) {
|
|
343
|
+
return this.adminEntitiesService.search(this.structureId, searchText, tenantSelection, pageable);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
// packages/persistence/src/api/PersistencePlugin.ts
|
|
347
|
+
var PersistencePlugin = {
|
|
348
|
+
install(kinotic) {
|
|
349
|
+
return {
|
|
350
|
+
entities: new EntitiesService(kinotic),
|
|
351
|
+
adminEntities: new AdminEntitiesService(kinotic)
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
// packages/persistence/src/index.ts
|
|
357
|
+
var import_core5 = require("@kinotic-ai/core");
|