@kinotic-ai/persistence 1.5.2 → 3.0.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 +26 -89
- package/dist/index.d.cts +28 -49
- package/dist/index.d.ts +28 -49
- package/dist/index.js +26 -89
- package/package.json +4 -5
package/dist/index.cjs
CHANGED
|
@@ -50,7 +50,6 @@ __export(exports_src, {
|
|
|
50
50
|
QueryOptions: () => QueryOptions,
|
|
51
51
|
Query: () => Query,
|
|
52
52
|
PrecisionType: () => PrecisionType,
|
|
53
|
-
PrecisionConfig: () => PrecisionConfig,
|
|
54
53
|
Precision: () => Precision,
|
|
55
54
|
PolicyDecorator: () => PolicyDecorator,
|
|
56
55
|
Policy: () => Policy,
|
|
@@ -59,7 +58,6 @@ __export(exports_src, {
|
|
|
59
58
|
NotIndexed: () => NotIndexed,
|
|
60
59
|
Nested: () => Nested,
|
|
61
60
|
MultiTenancyType: () => MultiTenancyType,
|
|
62
|
-
KinoticPersistenceDecorator: () => KinoticPersistenceDecorator,
|
|
63
61
|
Id: () => Id,
|
|
64
62
|
Flattened: () => Flattened,
|
|
65
63
|
EsIndexConfigurationData: () => EsIndexConfigurationData,
|
|
@@ -69,14 +67,13 @@ __export(exports_src, {
|
|
|
69
67
|
EntityServiceDecorators: () => EntityServiceDecorators,
|
|
70
68
|
EntityServiceDecorator: () => EntityServiceDecorator,
|
|
71
69
|
EntityRepository: () => EntityRepository,
|
|
72
|
-
EntityConfig: () => EntityConfig,
|
|
73
70
|
Entity: () => Entity,
|
|
74
71
|
EntitiesRepository: () => EntitiesRepository,
|
|
75
|
-
DiscriminatorConfig: () => DiscriminatorConfig,
|
|
76
72
|
Discriminator: () => Discriminator,
|
|
77
73
|
AutoGeneratedId: () => AutoGeneratedId,
|
|
78
74
|
AdminEntityRepository: () => AdminEntityRepository,
|
|
79
75
|
AdminEntitiesRepository: () => AdminEntitiesRepository,
|
|
76
|
+
APP_API_ZONE: () => APP_API_ZONE,
|
|
80
77
|
$Role: () => $Role,
|
|
81
78
|
$Policy: () => $Policy
|
|
82
79
|
});
|
|
@@ -97,9 +94,6 @@ class TenantSpecificId {
|
|
|
97
94
|
this.tenantId = tenantId;
|
|
98
95
|
}
|
|
99
96
|
}
|
|
100
|
-
// packages/persistence/src/api/KinoticPersistenceDecorators.ts
|
|
101
|
-
var import_reflect_metadata = require("reflect-metadata");
|
|
102
|
-
|
|
103
97
|
// packages/persistence/src/api/idl/EntityType.ts
|
|
104
98
|
var EntityType;
|
|
105
99
|
((EntityType2) => {
|
|
@@ -125,98 +119,40 @@ var PrecisionType;
|
|
|
125
119
|
})(PrecisionType ||= {});
|
|
126
120
|
|
|
127
121
|
// packages/persistence/src/api/KinoticPersistenceDecorators.ts
|
|
128
|
-
|
|
129
|
-
(
|
|
130
|
-
|
|
131
|
-
KinoticPersistenceDecorator2["Id"] = "__structures-id__";
|
|
132
|
-
KinoticPersistenceDecorator2["AutoGeneratedId"] = "__structures-auto-generated-id__";
|
|
133
|
-
KinoticPersistenceDecorator2["Flattened"] = "__structures-flattened__";
|
|
134
|
-
KinoticPersistenceDecorator2["Nested"] = "__structures-nested__";
|
|
135
|
-
KinoticPersistenceDecorator2["Text"] = "__structures-text__";
|
|
136
|
-
KinoticPersistenceDecorator2["NotNull"] = "__structures-notnull__";
|
|
137
|
-
KinoticPersistenceDecorator2["Precision"] = "__structures-precision__";
|
|
138
|
-
KinoticPersistenceDecorator2["Discriminator"] = "__structures-discriminator__";
|
|
139
|
-
KinoticPersistenceDecorator2["Query"] = "__structures-query__";
|
|
140
|
-
KinoticPersistenceDecorator2["EntityServiceDecorators"] = "__structures-entity-service-decorators__";
|
|
141
|
-
})(KinoticPersistenceDecorator ||= {});
|
|
142
|
-
function AutoGeneratedId(target, propertyKey) {
|
|
143
|
-
Reflect.defineMetadata("__structures-auto-generated-id__" /* AutoGeneratedId */, {}, target, propertyKey);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
class DiscriminatorConfig {
|
|
147
|
-
propertyName;
|
|
148
|
-
constructor(propertyName) {
|
|
149
|
-
this.propertyName = propertyName;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
function Discriminator(propertyName) {
|
|
153
|
-
return function(target, propertyKey) {
|
|
154
|
-
Reflect.defineMetadata("__structures-discriminator__" /* Discriminator */, new DiscriminatorConfig(propertyName), target, propertyKey);
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
class EntityConfig {
|
|
159
|
-
multiTenancyType;
|
|
160
|
-
entityType;
|
|
161
|
-
constructor(multiTenancyType, entityType = 0 /* TABLE */) {
|
|
162
|
-
this.multiTenancyType = multiTenancyType;
|
|
163
|
-
this.entityType = entityType;
|
|
164
|
-
}
|
|
122
|
+
function AutoGeneratedId(_value, _context) {}
|
|
123
|
+
function Discriminator(_propertyName) {
|
|
124
|
+
return function(_value, _context) {};
|
|
165
125
|
}
|
|
166
|
-
function Entity(
|
|
167
|
-
return function(
|
|
168
|
-
Reflect.defineMetadata("__structures-entity__" /* Entity */, new EntityConfig(multiTenancyType, entityType), constructor);
|
|
169
|
-
};
|
|
126
|
+
function Entity(_multiTenancyType = 0 /* NONE */, _entityType = 0 /* TABLE */) {
|
|
127
|
+
return function(_value, _context) {};
|
|
170
128
|
}
|
|
171
129
|
function EntityServiceDecorators(_config) {
|
|
172
|
-
return function(
|
|
130
|
+
return function(_value, _context) {};
|
|
173
131
|
}
|
|
174
132
|
function EsIndexConfiguration(_value) {
|
|
175
|
-
return function(
|
|
176
|
-
}
|
|
177
|
-
function Flattened(target, propertyKey) {
|
|
178
|
-
Reflect.defineMetadata("__structures-flattened__" /* Flattened */, {}, target, propertyKey);
|
|
179
|
-
}
|
|
180
|
-
function Id(target, propertyKey) {
|
|
181
|
-
Reflect.defineMetadata("__structures-id__" /* Id */, {}, target, propertyKey);
|
|
182
|
-
}
|
|
183
|
-
function Nested(target, propertyKey) {
|
|
184
|
-
Reflect.defineMetadata("__structures-nested__" /* Nested */, {}, target, propertyKey);
|
|
185
|
-
}
|
|
186
|
-
function NotIndexed(_target, _propertyKey) {}
|
|
187
|
-
function NotNull(target, propertyKey) {
|
|
188
|
-
Reflect.defineMetadata("__structures-notnull__" /* NotNull */, {}, target, propertyKey);
|
|
133
|
+
return function(_target, _context) {};
|
|
189
134
|
}
|
|
135
|
+
function Flattened(_value, _context) {}
|
|
136
|
+
function Id(_value, _context) {}
|
|
137
|
+
function Nested(_value, _context) {}
|
|
138
|
+
function NotIndexed(_value, _context) {}
|
|
139
|
+
function NotNull(_value, _context) {}
|
|
190
140
|
function Policy(_policies) {
|
|
191
|
-
return function(
|
|
141
|
+
return function(_value, _context) {};
|
|
192
142
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
precisionType;
|
|
196
|
-
constructor(precisionType) {
|
|
197
|
-
this.precisionType = precisionType;
|
|
198
|
-
}
|
|
143
|
+
function Precision(_precisionType = 2 /* INT */) {
|
|
144
|
+
return function(_value, _context) {};
|
|
199
145
|
}
|
|
200
|
-
function
|
|
201
|
-
return function(
|
|
202
|
-
Reflect.defineMetadata("__structures-precision__" /* Precision */, new PrecisionConfig(precisionType), target, propertyKey);
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
function Query(statements) {
|
|
206
|
-
return function(target, key, descriptor) {
|
|
207
|
-
Reflect.defineMetadata("__structures-query__" /* Query */, statements, target, key);
|
|
208
|
-
return descriptor;
|
|
209
|
-
};
|
|
146
|
+
function Query(_statements) {
|
|
147
|
+
return function(_value, _context) {};
|
|
210
148
|
}
|
|
211
149
|
function Role(_roles) {
|
|
212
|
-
return function(
|
|
213
|
-
}
|
|
214
|
-
function Text(target, propertyKey) {
|
|
215
|
-
Reflect.defineMetadata("__structures-text__" /* Text */, {}, target, propertyKey);
|
|
150
|
+
return function(_value, _context) {};
|
|
216
151
|
}
|
|
217
|
-
function
|
|
218
|
-
function
|
|
219
|
-
function
|
|
152
|
+
function Text(_value, _context) {}
|
|
153
|
+
function TimeReference(_value, _context) {}
|
|
154
|
+
function Version(_value, _context) {}
|
|
155
|
+
function TenantId(_value, _context) {}
|
|
220
156
|
// packages/persistence/src/api/idl/EntityServiceDecorator.ts
|
|
221
157
|
var import_idl = require("@kinotic-ai/idl");
|
|
222
158
|
|
|
@@ -262,11 +198,12 @@ function $Role(roles) {
|
|
|
262
198
|
}
|
|
263
199
|
// packages/persistence/src/api/IEntitiesRepository.ts
|
|
264
200
|
var import_core = require("@kinotic-ai/core");
|
|
201
|
+
var APP_API_ZONE = "app_api";
|
|
265
202
|
|
|
266
203
|
class EntitiesRepository {
|
|
267
204
|
serviceProxy;
|
|
268
205
|
constructor(kinotic) {
|
|
269
|
-
this.serviceProxy = kinotic.serviceProxy(
|
|
206
|
+
this.serviceProxy = kinotic.serviceProxy(`${APP_API_ZONE}.org.kinotic.persistence.api.services.JsonEntitiesRepository`);
|
|
270
207
|
}
|
|
271
208
|
bulkSave(entityDefinitionId, entities) {
|
|
272
209
|
return this.serviceProxy.invoke("bulkSave", [entityDefinitionId, entities]);
|
|
@@ -332,7 +269,7 @@ var import_core2 = require("@kinotic-ai/core");
|
|
|
332
269
|
class AdminEntitiesRepository {
|
|
333
270
|
serviceProxy;
|
|
334
271
|
constructor(kinotic) {
|
|
335
|
-
this.serviceProxy = kinotic.serviceProxy(
|
|
272
|
+
this.serviceProxy = kinotic.serviceProxy(`${APP_API_ZONE}.org.kinotic.persistence.api.services.AdminJsonEntitiesRepository`);
|
|
336
273
|
}
|
|
337
274
|
count(entityDefinitionId, tenantSelection) {
|
|
338
275
|
return this.serviceProxy.invoke("count", [entityDefinitionId, tenantSelection]);
|
package/dist/index.d.cts
CHANGED
|
@@ -14,7 +14,7 @@ declare class QueryOptions {
|
|
|
14
14
|
pageTimeout: string;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* An identifier that can be used to find
|
|
17
|
+
* An identifier that can be used to find an Entity for a specific id and tenant
|
|
18
18
|
*/
|
|
19
19
|
declare class TenantSpecificId {
|
|
20
20
|
/**
|
|
@@ -104,81 +104,55 @@ type DecoratedFunction = FilteredMethods<IEntityService<any>> | "allCreate" | "a
|
|
|
104
104
|
* This is a map of method names to an array of decorators that should be applied to that method
|
|
105
105
|
*/
|
|
106
106
|
type EntityServiceDecoratorsConfig = Partial<Record<DecoratedFunction, EntityServiceDecorator[]>>;
|
|
107
|
-
declare enum KinoticPersistenceDecorator {
|
|
108
|
-
Entity = "__structures-entity__",
|
|
109
|
-
Id = "__structures-id__",
|
|
110
|
-
AutoGeneratedId = "__structures-auto-generated-id__",
|
|
111
|
-
Flattened = "__structures-flattened__",
|
|
112
|
-
Nested = "__structures-nested__",
|
|
113
|
-
Text = "__structures-text__",
|
|
114
|
-
NotNull = "__structures-notnull__",
|
|
115
|
-
Precision = "__structures-precision__",
|
|
116
|
-
Discriminator = "__structures-discriminator__",
|
|
117
|
-
Query = "__structures-query__",
|
|
118
|
-
EntityServiceDecorators = "__structures-entity-service-decorators__"
|
|
119
|
-
}
|
|
120
107
|
/**
|
|
121
108
|
* Signifies that a property is an auto-generated ID for the entity.
|
|
122
109
|
*/
|
|
123
|
-
declare function AutoGeneratedId(
|
|
124
|
-
declare class DiscriminatorConfig {
|
|
125
|
-
propertyName: string;
|
|
126
|
-
constructor(propertyName: string);
|
|
127
|
-
}
|
|
110
|
+
declare function AutoGeneratedId(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
128
111
|
/**
|
|
129
112
|
* Signifies that a property is a discriminator for the entity.
|
|
130
113
|
* This is used to determine the type of the entity when deserializing from JSON.
|
|
131
114
|
* @param propertyName the name of the property to use as the discriminator
|
|
132
115
|
*/
|
|
133
|
-
declare function Discriminator(
|
|
134
|
-
declare class EntityConfig {
|
|
135
|
-
multiTenancyType: MultiTenancyType;
|
|
136
|
-
entityType: EntityType;
|
|
137
|
-
constructor(multiTenancyType: MultiTenancyType, entityType?: EntityType);
|
|
138
|
-
}
|
|
116
|
+
declare function Discriminator(_propertyName: string): (_value: undefined, _context: ClassFieldDecoratorContext) => void;
|
|
139
117
|
/**
|
|
140
|
-
* Signifies that a class is a
|
|
141
|
-
* This is required to define the class as an entity in the
|
|
118
|
+
* Signifies that a class is a Entity.
|
|
119
|
+
* This is required to define the class as an entity in the Kinotic framework.
|
|
142
120
|
* @param multiTenancyType the type of multi-tenancy to use for this entity
|
|
143
121
|
* @param entityType the type of entity to use for this entity
|
|
144
122
|
*/
|
|
145
|
-
declare function Entity(
|
|
123
|
+
declare function Entity(_multiTenancyType?: MultiTenancyType, _entityType?: EntityType): (_value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
146
124
|
/**
|
|
147
125
|
* A class Decorator when applied to an Entity will configure Decorators to be applied to the EntityService
|
|
148
126
|
* @param config the {@link EntityServiceDecoratorsConfig} to use
|
|
149
127
|
*/
|
|
150
|
-
declare function EntityServiceDecorators(_config: EntityServiceDecoratorsConfig): (
|
|
128
|
+
declare function EntityServiceDecorators(_config: EntityServiceDecoratorsConfig): (_value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
151
129
|
/**
|
|
152
130
|
* Provides configuration for the Elasticsearch index.
|
|
153
|
-
* This can be used to override the default index settings and mappings used by
|
|
131
|
+
* This can be used to override the default index settings and mappings used by Kinotic.
|
|
154
132
|
*/
|
|
155
|
-
declare function EsIndexConfiguration(_value: EsIndexConfigurationData): (
|
|
156
|
-
declare function Flattened(
|
|
133
|
+
declare function EsIndexConfiguration(_value: EsIndexConfigurationData): (_target: Function, _context: ClassDecoratorContext<any>) => void;
|
|
134
|
+
declare function Flattened(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
157
135
|
/**
|
|
158
136
|
* Signifies that a property is the ID of the entity.
|
|
159
137
|
*/
|
|
160
|
-
declare function Id(
|
|
161
|
-
declare function Nested(
|
|
138
|
+
declare function Id(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
139
|
+
declare function Nested(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
162
140
|
/**
|
|
163
141
|
* Signifies that a property is not indexed in Elasticsearch.
|
|
164
142
|
*/
|
|
165
|
-
declare function NotIndexed(
|
|
166
|
-
declare function NotNull(
|
|
167
|
-
declare function Policy(_policies: string[][]): (
|
|
168
|
-
declare
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
declare function Precision(precisionType?: PrecisionType): (target: any, propertyKey: string) => void;
|
|
173
|
-
declare function Query(statements: string): (target: any, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
174
|
-
declare function Role(_roles: string[]): (_target: any, _propertyKey?: string, _descriptor?: PropertyDescriptor) => void;
|
|
175
|
-
declare function Text(target: any, propertyKey: string): void;
|
|
143
|
+
declare function NotIndexed(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
144
|
+
declare function NotNull(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
145
|
+
declare function Policy(_policies: string[][]): (_value: unknown, _context: ClassDecoratorContext<any> | ClassFieldDecoratorContext | ClassMethodDecoratorContext) => void;
|
|
146
|
+
declare function Precision(_precisionType?: PrecisionType): (_value: undefined, _context: ClassFieldDecoratorContext) => void;
|
|
147
|
+
declare function Query(_statements: string): (_value: Function, _context: ClassMethodDecoratorContext) => void;
|
|
148
|
+
declare function Role(_roles: string[]): (_value: unknown, _context: ClassDecoratorContext<any> | ClassFieldDecoratorContext | ClassMethodDecoratorContext) => void;
|
|
149
|
+
declare function Text(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
176
150
|
/**
|
|
177
151
|
* This is used for data streams to signify the field that should be used as the time reference.
|
|
178
152
|
*/
|
|
179
|
-
declare function TimeReference(
|
|
180
|
-
declare function Version(
|
|
181
|
-
declare function TenantId(
|
|
153
|
+
declare function TimeReference(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
154
|
+
declare function Version(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
155
|
+
declare function TenantId(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
182
156
|
import { C3Decorator as C3Decorator2 } from "@kinotic-ai/idl";
|
|
183
157
|
/**
|
|
184
158
|
* Provides a way to add decorators to an entity service
|
|
@@ -207,6 +181,11 @@ declare class RoleDecorator extends EntityServiceDecorator {
|
|
|
207
181
|
declare function $Role(roles: string[]): RoleDecorator;
|
|
208
182
|
import { IKinotic } from "@kinotic-ai/core";
|
|
209
183
|
import { IServiceProxy, Page, Pageable, IterablePage } from "@kinotic-ai/core";
|
|
184
|
+
/**
|
|
185
|
+
* The zone for the platform's application facing data services, such as entity persistence
|
|
186
|
+
* and named query execution — where the services backing these repositories are hosted.
|
|
187
|
+
*/
|
|
188
|
+
declare const APP_API_ZONE = "app_api";
|
|
210
189
|
interface IEntitiesRepository {
|
|
211
190
|
/**
|
|
212
191
|
* Saves all given entities.
|
|
@@ -781,4 +760,4 @@ declare const PersistencePlugin: KinoticPlugin<IPersistenceExtension>;
|
|
|
781
760
|
declare module "@kinotic-ai/core" {
|
|
782
761
|
interface KinoticSingleton extends IPersistenceExtension {}
|
|
783
762
|
}
|
|
784
|
-
export { Version, TimeReference, Text, TenantSpecificId, TenantSelection, TenantId, RoleDecorator, Role, QueryParameter, QueryOptions, Query, PrecisionType,
|
|
763
|
+
export { Version, TimeReference, Text, TenantSpecificId, TenantSelection, TenantId, RoleDecorator, Role, QueryParameter, QueryOptions, Query, PrecisionType, Precision, PolicyDecorator, Policy, PersistencePlugin, NotNull, NotIndexed, Nested, MultiTenancyType, Id, IPersistenceExtension, IEntityRepository, IEntitiesRepository, IAdminEntityRepository, IAdminEntitiesRepository, Flattened, EsIndexConfigurationData, EsIndexConfiguration, EntityType, EntityServiceDecoratorsDecorator, EntityServiceDecoratorsConfig, EntityServiceDecorators, EntityServiceDecorator, EntityRepository, Entity, EntitiesRepository, Discriminator, DecoratedFunction, AutoGeneratedId, AdminEntityRepository, AdminEntitiesRepository, APP_API_ZONE, $Role, $Policy };
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ declare class QueryOptions {
|
|
|
14
14
|
pageTimeout: string;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* An identifier that can be used to find
|
|
17
|
+
* An identifier that can be used to find an Entity for a specific id and tenant
|
|
18
18
|
*/
|
|
19
19
|
declare class TenantSpecificId {
|
|
20
20
|
/**
|
|
@@ -104,81 +104,55 @@ type DecoratedFunction = FilteredMethods<IEntityService<any>> | "allCreate" | "a
|
|
|
104
104
|
* This is a map of method names to an array of decorators that should be applied to that method
|
|
105
105
|
*/
|
|
106
106
|
type EntityServiceDecoratorsConfig = Partial<Record<DecoratedFunction, EntityServiceDecorator[]>>;
|
|
107
|
-
declare enum KinoticPersistenceDecorator {
|
|
108
|
-
Entity = "__structures-entity__",
|
|
109
|
-
Id = "__structures-id__",
|
|
110
|
-
AutoGeneratedId = "__structures-auto-generated-id__",
|
|
111
|
-
Flattened = "__structures-flattened__",
|
|
112
|
-
Nested = "__structures-nested__",
|
|
113
|
-
Text = "__structures-text__",
|
|
114
|
-
NotNull = "__structures-notnull__",
|
|
115
|
-
Precision = "__structures-precision__",
|
|
116
|
-
Discriminator = "__structures-discriminator__",
|
|
117
|
-
Query = "__structures-query__",
|
|
118
|
-
EntityServiceDecorators = "__structures-entity-service-decorators__"
|
|
119
|
-
}
|
|
120
107
|
/**
|
|
121
108
|
* Signifies that a property is an auto-generated ID for the entity.
|
|
122
109
|
*/
|
|
123
|
-
declare function AutoGeneratedId(
|
|
124
|
-
declare class DiscriminatorConfig {
|
|
125
|
-
propertyName: string;
|
|
126
|
-
constructor(propertyName: string);
|
|
127
|
-
}
|
|
110
|
+
declare function AutoGeneratedId(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
128
111
|
/**
|
|
129
112
|
* Signifies that a property is a discriminator for the entity.
|
|
130
113
|
* This is used to determine the type of the entity when deserializing from JSON.
|
|
131
114
|
* @param propertyName the name of the property to use as the discriminator
|
|
132
115
|
*/
|
|
133
|
-
declare function Discriminator(
|
|
134
|
-
declare class EntityConfig {
|
|
135
|
-
multiTenancyType: MultiTenancyType;
|
|
136
|
-
entityType: EntityType;
|
|
137
|
-
constructor(multiTenancyType: MultiTenancyType, entityType?: EntityType);
|
|
138
|
-
}
|
|
116
|
+
declare function Discriminator(_propertyName: string): (_value: undefined, _context: ClassFieldDecoratorContext) => void;
|
|
139
117
|
/**
|
|
140
|
-
* Signifies that a class is a
|
|
141
|
-
* This is required to define the class as an entity in the
|
|
118
|
+
* Signifies that a class is a Entity.
|
|
119
|
+
* This is required to define the class as an entity in the Kinotic framework.
|
|
142
120
|
* @param multiTenancyType the type of multi-tenancy to use for this entity
|
|
143
121
|
* @param entityType the type of entity to use for this entity
|
|
144
122
|
*/
|
|
145
|
-
declare function Entity(
|
|
123
|
+
declare function Entity(_multiTenancyType?: MultiTenancyType, _entityType?: EntityType): (_value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
146
124
|
/**
|
|
147
125
|
* A class Decorator when applied to an Entity will configure Decorators to be applied to the EntityService
|
|
148
126
|
* @param config the {@link EntityServiceDecoratorsConfig} to use
|
|
149
127
|
*/
|
|
150
|
-
declare function EntityServiceDecorators(_config: EntityServiceDecoratorsConfig): (
|
|
128
|
+
declare function EntityServiceDecorators(_config: EntityServiceDecoratorsConfig): (_value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
151
129
|
/**
|
|
152
130
|
* Provides configuration for the Elasticsearch index.
|
|
153
|
-
* This can be used to override the default index settings and mappings used by
|
|
131
|
+
* This can be used to override the default index settings and mappings used by Kinotic.
|
|
154
132
|
*/
|
|
155
|
-
declare function EsIndexConfiguration(_value: EsIndexConfigurationData): (
|
|
156
|
-
declare function Flattened(
|
|
133
|
+
declare function EsIndexConfiguration(_value: EsIndexConfigurationData): (_target: Function, _context: ClassDecoratorContext<any>) => void;
|
|
134
|
+
declare function Flattened(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
157
135
|
/**
|
|
158
136
|
* Signifies that a property is the ID of the entity.
|
|
159
137
|
*/
|
|
160
|
-
declare function Id(
|
|
161
|
-
declare function Nested(
|
|
138
|
+
declare function Id(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
139
|
+
declare function Nested(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
162
140
|
/**
|
|
163
141
|
* Signifies that a property is not indexed in Elasticsearch.
|
|
164
142
|
*/
|
|
165
|
-
declare function NotIndexed(
|
|
166
|
-
declare function NotNull(
|
|
167
|
-
declare function Policy(_policies: string[][]): (
|
|
168
|
-
declare
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
declare function Precision(precisionType?: PrecisionType): (target: any, propertyKey: string) => void;
|
|
173
|
-
declare function Query(statements: string): (target: any, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
174
|
-
declare function Role(_roles: string[]): (_target: any, _propertyKey?: string, _descriptor?: PropertyDescriptor) => void;
|
|
175
|
-
declare function Text(target: any, propertyKey: string): void;
|
|
143
|
+
declare function NotIndexed(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
144
|
+
declare function NotNull(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
145
|
+
declare function Policy(_policies: string[][]): (_value: unknown, _context: ClassDecoratorContext<any> | ClassFieldDecoratorContext | ClassMethodDecoratorContext) => void;
|
|
146
|
+
declare function Precision(_precisionType?: PrecisionType): (_value: undefined, _context: ClassFieldDecoratorContext) => void;
|
|
147
|
+
declare function Query(_statements: string): (_value: Function, _context: ClassMethodDecoratorContext) => void;
|
|
148
|
+
declare function Role(_roles: string[]): (_value: unknown, _context: ClassDecoratorContext<any> | ClassFieldDecoratorContext | ClassMethodDecoratorContext) => void;
|
|
149
|
+
declare function Text(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
176
150
|
/**
|
|
177
151
|
* This is used for data streams to signify the field that should be used as the time reference.
|
|
178
152
|
*/
|
|
179
|
-
declare function TimeReference(
|
|
180
|
-
declare function Version(
|
|
181
|
-
declare function TenantId(
|
|
153
|
+
declare function TimeReference(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
154
|
+
declare function Version(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
155
|
+
declare function TenantId(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
182
156
|
import { C3Decorator as C3Decorator2 } from "@kinotic-ai/idl";
|
|
183
157
|
/**
|
|
184
158
|
* Provides a way to add decorators to an entity service
|
|
@@ -207,6 +181,11 @@ declare class RoleDecorator extends EntityServiceDecorator {
|
|
|
207
181
|
declare function $Role(roles: string[]): RoleDecorator;
|
|
208
182
|
import { IKinotic } from "@kinotic-ai/core";
|
|
209
183
|
import { IServiceProxy, Page, Pageable, IterablePage } from "@kinotic-ai/core";
|
|
184
|
+
/**
|
|
185
|
+
* The zone for the platform's application facing data services, such as entity persistence
|
|
186
|
+
* and named query execution — where the services backing these repositories are hosted.
|
|
187
|
+
*/
|
|
188
|
+
declare const APP_API_ZONE = "app_api";
|
|
210
189
|
interface IEntitiesRepository {
|
|
211
190
|
/**
|
|
212
191
|
* Saves all given entities.
|
|
@@ -781,4 +760,4 @@ declare const PersistencePlugin: KinoticPlugin<IPersistenceExtension>;
|
|
|
781
760
|
declare module "@kinotic-ai/core" {
|
|
782
761
|
interface KinoticSingleton extends IPersistenceExtension {}
|
|
783
762
|
}
|
|
784
|
-
export { Version, TimeReference, Text, TenantSpecificId, TenantSelection, TenantId, RoleDecorator, Role, QueryParameter, QueryOptions, Query, PrecisionType,
|
|
763
|
+
export { Version, TimeReference, Text, TenantSpecificId, TenantSelection, TenantId, RoleDecorator, Role, QueryParameter, QueryOptions, Query, PrecisionType, Precision, PolicyDecorator, Policy, PersistencePlugin, NotNull, NotIndexed, Nested, MultiTenancyType, Id, IPersistenceExtension, IEntityRepository, IEntitiesRepository, IAdminEntityRepository, IAdminEntitiesRepository, Flattened, EsIndexConfigurationData, EsIndexConfiguration, EntityType, EntityServiceDecoratorsDecorator, EntityServiceDecoratorsConfig, EntityServiceDecorators, EntityServiceDecorator, EntityRepository, Entity, EntitiesRepository, Discriminator, DecoratedFunction, AutoGeneratedId, AdminEntityRepository, AdminEntitiesRepository, APP_API_ZONE, $Role, $Policy };
|
package/dist/index.js
CHANGED
|
@@ -13,9 +13,6 @@ class TenantSpecificId {
|
|
|
13
13
|
this.tenantId = tenantId;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
// packages/persistence/src/api/KinoticPersistenceDecorators.ts
|
|
17
|
-
import"reflect-metadata";
|
|
18
|
-
|
|
19
16
|
// packages/persistence/src/api/idl/EntityType.ts
|
|
20
17
|
var EntityType;
|
|
21
18
|
((EntityType2) => {
|
|
@@ -41,98 +38,40 @@ var PrecisionType;
|
|
|
41
38
|
})(PrecisionType ||= {});
|
|
42
39
|
|
|
43
40
|
// packages/persistence/src/api/KinoticPersistenceDecorators.ts
|
|
44
|
-
|
|
45
|
-
(
|
|
46
|
-
|
|
47
|
-
KinoticPersistenceDecorator2["Id"] = "__structures-id__";
|
|
48
|
-
KinoticPersistenceDecorator2["AutoGeneratedId"] = "__structures-auto-generated-id__";
|
|
49
|
-
KinoticPersistenceDecorator2["Flattened"] = "__structures-flattened__";
|
|
50
|
-
KinoticPersistenceDecorator2["Nested"] = "__structures-nested__";
|
|
51
|
-
KinoticPersistenceDecorator2["Text"] = "__structures-text__";
|
|
52
|
-
KinoticPersistenceDecorator2["NotNull"] = "__structures-notnull__";
|
|
53
|
-
KinoticPersistenceDecorator2["Precision"] = "__structures-precision__";
|
|
54
|
-
KinoticPersistenceDecorator2["Discriminator"] = "__structures-discriminator__";
|
|
55
|
-
KinoticPersistenceDecorator2["Query"] = "__structures-query__";
|
|
56
|
-
KinoticPersistenceDecorator2["EntityServiceDecorators"] = "__structures-entity-service-decorators__";
|
|
57
|
-
})(KinoticPersistenceDecorator ||= {});
|
|
58
|
-
function AutoGeneratedId(target, propertyKey) {
|
|
59
|
-
Reflect.defineMetadata("__structures-auto-generated-id__" /* AutoGeneratedId */, {}, target, propertyKey);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
class DiscriminatorConfig {
|
|
63
|
-
propertyName;
|
|
64
|
-
constructor(propertyName) {
|
|
65
|
-
this.propertyName = propertyName;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function Discriminator(propertyName) {
|
|
69
|
-
return function(target, propertyKey) {
|
|
70
|
-
Reflect.defineMetadata("__structures-discriminator__" /* Discriminator */, new DiscriminatorConfig(propertyName), target, propertyKey);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
class EntityConfig {
|
|
75
|
-
multiTenancyType;
|
|
76
|
-
entityType;
|
|
77
|
-
constructor(multiTenancyType, entityType = 0 /* TABLE */) {
|
|
78
|
-
this.multiTenancyType = multiTenancyType;
|
|
79
|
-
this.entityType = entityType;
|
|
80
|
-
}
|
|
41
|
+
function AutoGeneratedId(_value, _context) {}
|
|
42
|
+
function Discriminator(_propertyName) {
|
|
43
|
+
return function(_value, _context) {};
|
|
81
44
|
}
|
|
82
|
-
function Entity(
|
|
83
|
-
return function(
|
|
84
|
-
Reflect.defineMetadata("__structures-entity__" /* Entity */, new EntityConfig(multiTenancyType, entityType), constructor);
|
|
85
|
-
};
|
|
45
|
+
function Entity(_multiTenancyType = 0 /* NONE */, _entityType = 0 /* TABLE */) {
|
|
46
|
+
return function(_value, _context) {};
|
|
86
47
|
}
|
|
87
48
|
function EntityServiceDecorators(_config) {
|
|
88
|
-
return function(
|
|
49
|
+
return function(_value, _context) {};
|
|
89
50
|
}
|
|
90
51
|
function EsIndexConfiguration(_value) {
|
|
91
|
-
return function(
|
|
92
|
-
}
|
|
93
|
-
function Flattened(target, propertyKey) {
|
|
94
|
-
Reflect.defineMetadata("__structures-flattened__" /* Flattened */, {}, target, propertyKey);
|
|
95
|
-
}
|
|
96
|
-
function Id(target, propertyKey) {
|
|
97
|
-
Reflect.defineMetadata("__structures-id__" /* Id */, {}, target, propertyKey);
|
|
98
|
-
}
|
|
99
|
-
function Nested(target, propertyKey) {
|
|
100
|
-
Reflect.defineMetadata("__structures-nested__" /* Nested */, {}, target, propertyKey);
|
|
101
|
-
}
|
|
102
|
-
function NotIndexed(_target, _propertyKey) {}
|
|
103
|
-
function NotNull(target, propertyKey) {
|
|
104
|
-
Reflect.defineMetadata("__structures-notnull__" /* NotNull */, {}, target, propertyKey);
|
|
52
|
+
return function(_target, _context) {};
|
|
105
53
|
}
|
|
54
|
+
function Flattened(_value, _context) {}
|
|
55
|
+
function Id(_value, _context) {}
|
|
56
|
+
function Nested(_value, _context) {}
|
|
57
|
+
function NotIndexed(_value, _context) {}
|
|
58
|
+
function NotNull(_value, _context) {}
|
|
106
59
|
function Policy(_policies) {
|
|
107
|
-
return function(
|
|
60
|
+
return function(_value, _context) {};
|
|
108
61
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
precisionType;
|
|
112
|
-
constructor(precisionType) {
|
|
113
|
-
this.precisionType = precisionType;
|
|
114
|
-
}
|
|
62
|
+
function Precision(_precisionType = 2 /* INT */) {
|
|
63
|
+
return function(_value, _context) {};
|
|
115
64
|
}
|
|
116
|
-
function
|
|
117
|
-
return function(
|
|
118
|
-
Reflect.defineMetadata("__structures-precision__" /* Precision */, new PrecisionConfig(precisionType), target, propertyKey);
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
function Query(statements) {
|
|
122
|
-
return function(target, key, descriptor) {
|
|
123
|
-
Reflect.defineMetadata("__structures-query__" /* Query */, statements, target, key);
|
|
124
|
-
return descriptor;
|
|
125
|
-
};
|
|
65
|
+
function Query(_statements) {
|
|
66
|
+
return function(_value, _context) {};
|
|
126
67
|
}
|
|
127
68
|
function Role(_roles) {
|
|
128
|
-
return function(
|
|
129
|
-
}
|
|
130
|
-
function Text(target, propertyKey) {
|
|
131
|
-
Reflect.defineMetadata("__structures-text__" /* Text */, {}, target, propertyKey);
|
|
69
|
+
return function(_value, _context) {};
|
|
132
70
|
}
|
|
133
|
-
function
|
|
134
|
-
function
|
|
135
|
-
function
|
|
71
|
+
function Text(_value, _context) {}
|
|
72
|
+
function TimeReference(_value, _context) {}
|
|
73
|
+
function Version(_value, _context) {}
|
|
74
|
+
function TenantId(_value, _context) {}
|
|
136
75
|
// packages/persistence/src/api/idl/EntityServiceDecorator.ts
|
|
137
76
|
import { C3Decorator } from "@kinotic-ai/idl";
|
|
138
77
|
|
|
@@ -180,11 +119,12 @@ function $Role(roles) {
|
|
|
180
119
|
import {
|
|
181
120
|
FunctionalIterablePage
|
|
182
121
|
} from "@kinotic-ai/core";
|
|
122
|
+
var APP_API_ZONE = "app_api";
|
|
183
123
|
|
|
184
124
|
class EntitiesRepository {
|
|
185
125
|
serviceProxy;
|
|
186
126
|
constructor(kinotic) {
|
|
187
|
-
this.serviceProxy = kinotic.serviceProxy(
|
|
127
|
+
this.serviceProxy = kinotic.serviceProxy(`${APP_API_ZONE}.org.kinotic.persistence.api.services.JsonEntitiesRepository`);
|
|
188
128
|
}
|
|
189
129
|
bulkSave(entityDefinitionId, entities) {
|
|
190
130
|
return this.serviceProxy.invoke("bulkSave", [entityDefinitionId, entities]);
|
|
@@ -252,7 +192,7 @@ import {
|
|
|
252
192
|
class AdminEntitiesRepository {
|
|
253
193
|
serviceProxy;
|
|
254
194
|
constructor(kinotic) {
|
|
255
|
-
this.serviceProxy = kinotic.serviceProxy(
|
|
195
|
+
this.serviceProxy = kinotic.serviceProxy(`${APP_API_ZONE}.org.kinotic.persistence.api.services.AdminJsonEntitiesRepository`);
|
|
256
196
|
}
|
|
257
197
|
count(entityDefinitionId, tenantSelection) {
|
|
258
198
|
return this.serviceProxy.invoke("count", [entityDefinitionId, tenantSelection]);
|
|
@@ -434,7 +374,6 @@ export {
|
|
|
434
374
|
QueryOptions,
|
|
435
375
|
Query,
|
|
436
376
|
PrecisionType,
|
|
437
|
-
PrecisionConfig,
|
|
438
377
|
Precision,
|
|
439
378
|
PolicyDecorator,
|
|
440
379
|
Policy,
|
|
@@ -443,7 +382,6 @@ export {
|
|
|
443
382
|
NotIndexed,
|
|
444
383
|
Nested,
|
|
445
384
|
MultiTenancyType,
|
|
446
|
-
KinoticPersistenceDecorator,
|
|
447
385
|
Id,
|
|
448
386
|
Flattened,
|
|
449
387
|
EsIndexConfigurationData,
|
|
@@ -453,14 +391,13 @@ export {
|
|
|
453
391
|
EntityServiceDecorators,
|
|
454
392
|
EntityServiceDecorator,
|
|
455
393
|
EntityRepository,
|
|
456
|
-
EntityConfig,
|
|
457
394
|
Entity,
|
|
458
395
|
EntitiesRepository,
|
|
459
|
-
DiscriminatorConfig,
|
|
460
396
|
Discriminator,
|
|
461
397
|
AutoGeneratedId,
|
|
462
398
|
AdminEntityRepository,
|
|
463
399
|
AdminEntitiesRepository,
|
|
400
|
+
APP_API_ZONE,
|
|
464
401
|
$Role,
|
|
465
402
|
$Policy
|
|
466
403
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kinotic-ai/persistence",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -32,15 +32,14 @@
|
|
|
32
32
|
"coverage": "bun test --coverage --pass-with-no-tests"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@kinotic-ai/core": ">=
|
|
35
|
+
"@kinotic-ai/core": ">=3.0.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@kinotic-ai/idl": "1.0.
|
|
39
|
-
"reflect-metadata": "^0.2.2",
|
|
38
|
+
"@kinotic-ai/idl": "1.0.10",
|
|
40
39
|
"rxjs": "^7.8.2"
|
|
41
40
|
},
|
|
42
41
|
"devDependencies": {
|
|
43
|
-
"@kinotic-ai/core": "
|
|
42
|
+
"@kinotic-ai/core": "3.0.0",
|
|
44
43
|
"@types/node": "^25.3.2",
|
|
45
44
|
"tslib": "^2.8.1",
|
|
46
45
|
"typescript": "^5.9.3"
|