@coasys/ad4m 0.10.1-release-candidate-3-test-2 → 0.10.1-release-candidate-4-debug-strings
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/lib/index.cjs +105 -6
- package/lib/index.js +106 -7
- package/lib/src/language/Language.d.ts +3 -0
- package/lib/src/model/Ad4mModel.js +11 -5
- package/lib/src/perspectives/PerspectiveClient.js +1 -1
- package/lib/src/runtime/RuntimeClient.d.ts +3 -0
- package/lib/src/runtime/RuntimeClient.js +30 -0
- package/lib/src/runtime/RuntimeResolver.d.ts +9 -0
- package/lib/src/runtime/RuntimeResolver.js +54 -0
- package/lib/src/schema.gql +10 -0
- package/lib/src/typeDefs.js +10 -0
- package/package.json +1 -2
- package/src/language/Language.ts +6 -2
- package/src/model/Ad4mModel.ts +13 -6
- package/src/perspectives/PerspectiveClient.ts +1 -1
- package/src/runtime/RuntimeClient.ts +33 -0
- package/src/runtime/RuntimeResolver.ts +34 -0
- package/lib/src/subject/Ad4mModel.d.ts +0 -550
- package/lib/src/subject/Ad4mModel.js +0 -956
- package/lib/src/subject/SDNADecorators.d.ts +0 -188
- package/lib/src/subject/SDNADecorators.js +0 -360
- package/lib/src/subject/Subject.d.ts +0 -25
- package/lib/src/subject/Subject.js +0 -188
- package/lib/src/subject/SubjectEntity.d.ts +0 -185
- package/lib/src/subject/SubjectEntity.js +0 -591
- package/lib/src/subject/decorators.d.ts +0 -496
- package/lib/src/subject/decorators.js +0 -683
- package/lib/src/subject/util.d.ts +0 -12
- package/lib/src/subject/util.js +0 -73
- package/yarn-error.log +0 -90
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _Subject_baseExpression, _Subject_subjectClassName, _Subject_perspective;
|
|
13
|
-
import { collectionToAdderName, collectionToRemoverName, collectionToSetterName, propertyNameToSetterName } from "./util";
|
|
14
|
-
/**
|
|
15
|
-
* Represents a subject in the perspective.
|
|
16
|
-
* A subject is an entity that has properties and collections.
|
|
17
|
-
*/
|
|
18
|
-
export class Subject {
|
|
19
|
-
/**
|
|
20
|
-
* Constructs a new subject.
|
|
21
|
-
* @param perspective - The perspective that the subject belongs to.
|
|
22
|
-
* @param baseExpression - The base expression of the subject.
|
|
23
|
-
* @param subjectClassName - The class name of the subject.
|
|
24
|
-
*/
|
|
25
|
-
constructor(perspective, baseExpression, subjectClassName) {
|
|
26
|
-
_Subject_baseExpression.set(this, void 0);
|
|
27
|
-
_Subject_subjectClassName.set(this, void 0);
|
|
28
|
-
_Subject_perspective.set(this, void 0);
|
|
29
|
-
__classPrivateFieldSet(this, _Subject_baseExpression, baseExpression, "f");
|
|
30
|
-
__classPrivateFieldSet(this, _Subject_subjectClassName, subjectClassName, "f");
|
|
31
|
-
__classPrivateFieldSet(this, _Subject_perspective, perspective, "f");
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Gets the base expression of the subject.
|
|
35
|
-
*/
|
|
36
|
-
get baseExpression() {
|
|
37
|
-
return __classPrivateFieldGet(this, _Subject_baseExpression, "f");
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Initializes the subject by validating it and defining its properties and collections dynamically.
|
|
41
|
-
*
|
|
42
|
-
* NOTE: This method should be called before using the subject. All the properties and collections of the subject defined are not type-checked.
|
|
43
|
-
*/
|
|
44
|
-
async init() {
|
|
45
|
-
// Check if the subject is a valid instance of the subject class
|
|
46
|
-
let isInstance = await __classPrivateFieldGet(this, _Subject_perspective, "f").isSubjectInstance(__classPrivateFieldGet(this, _Subject_baseExpression, "f"), __classPrivateFieldGet(this, _Subject_subjectClassName, "f"));
|
|
47
|
-
if (!isInstance) {
|
|
48
|
-
throw `Not a valid subject instance of ${__classPrivateFieldGet(this, _Subject_subjectClassName, "f")} for ${__classPrivateFieldGet(this, _Subject_baseExpression, "f")}`;
|
|
49
|
-
}
|
|
50
|
-
// Define properties and collections dynamically
|
|
51
|
-
let results = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClassName, "f")}", C), property(C, Property)`);
|
|
52
|
-
let properties = results.map(result => result.Property);
|
|
53
|
-
for (let p of properties) {
|
|
54
|
-
const resolveExpressionURI = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClassName, "f")}", C), property_resolve(C, "${p}")`);
|
|
55
|
-
Object.defineProperty(this, p, {
|
|
56
|
-
configurable: true,
|
|
57
|
-
get: async () => {
|
|
58
|
-
let results = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClassName, "f")}", C), property_getter(C, "${__classPrivateFieldGet(this, _Subject_baseExpression, "f")}", "${p}", Value)`);
|
|
59
|
-
if (results && results.length > 0) {
|
|
60
|
-
let expressionURI = results[0].Value;
|
|
61
|
-
if (resolveExpressionURI) {
|
|
62
|
-
try {
|
|
63
|
-
if (expressionURI) {
|
|
64
|
-
const expression = await __classPrivateFieldGet(this, _Subject_perspective, "f").getExpression(expressionURI);
|
|
65
|
-
try {
|
|
66
|
-
return JSON.parse(expression.data);
|
|
67
|
-
}
|
|
68
|
-
catch (e) {
|
|
69
|
-
return expression.data;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
return expressionURI;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
catch (err) {
|
|
77
|
-
return expressionURI;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
return expressionURI;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
else if (results) {
|
|
85
|
-
return results;
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
return undefined;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
// Define setters
|
|
94
|
-
const setters = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClassName, "f")}", C), property_setter(C, Property, Setter)`);
|
|
95
|
-
for (let setter of (setters ? setters : [])) {
|
|
96
|
-
if (setter) {
|
|
97
|
-
const property = setter.Property;
|
|
98
|
-
const actions = eval(setter.Setter);
|
|
99
|
-
const resolveLanguageResults = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClassName, "f")}", C), property_resolve_language(C, "${property}", Language)`);
|
|
100
|
-
let resolveLanguage;
|
|
101
|
-
if (resolveLanguageResults && resolveLanguageResults.length > 0) {
|
|
102
|
-
resolveLanguage = resolveLanguageResults[0].Language;
|
|
103
|
-
}
|
|
104
|
-
this[propertyNameToSetterName(property)] = async (value) => {
|
|
105
|
-
if (resolveLanguage) {
|
|
106
|
-
value = await __classPrivateFieldGet(this, _Subject_perspective, "f").createExpression(value, resolveLanguage);
|
|
107
|
-
}
|
|
108
|
-
await __classPrivateFieldGet(this, _Subject_perspective, "f").executeAction(actions, __classPrivateFieldGet(this, _Subject_baseExpression, "f"), [{ name: "value", value }]);
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// Define collections
|
|
113
|
-
let results2 = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClassName, "f")}", C), collection(C, Collection)`);
|
|
114
|
-
if (!results2)
|
|
115
|
-
results2 = [];
|
|
116
|
-
let collections = results2.map(result => result.Collection);
|
|
117
|
-
for (let c of collections) {
|
|
118
|
-
Object.defineProperty(this, c, {
|
|
119
|
-
configurable: true,
|
|
120
|
-
get: async () => {
|
|
121
|
-
let results = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClassName, "f")}", C), collection_getter(C, "${__classPrivateFieldGet(this, _Subject_baseExpression, "f")}", "${c}", Value)`);
|
|
122
|
-
if (results && results.length > 0 && results[0].Value) {
|
|
123
|
-
let collectionContent = results[0].Value.filter((v) => v !== "" && v !== '');
|
|
124
|
-
return collectionContent;
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
return [];
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
// Define collection adders
|
|
133
|
-
let adders = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClassName, "f")}", C), collection_adder(C, Collection, Adder)`);
|
|
134
|
-
if (!adders)
|
|
135
|
-
adders = [];
|
|
136
|
-
for (let adder of adders) {
|
|
137
|
-
if (adder) {
|
|
138
|
-
const collection = adder.Collection;
|
|
139
|
-
const actions = eval(adder.Adder);
|
|
140
|
-
this[collectionToAdderName(collection)] = async (value) => {
|
|
141
|
-
if (Array.isArray(value)) {
|
|
142
|
-
await Promise.all(value.map(v => __classPrivateFieldGet(this, _Subject_perspective, "f").executeAction(actions, __classPrivateFieldGet(this, _Subject_baseExpression, "f"), [{ name: "value", value: v }])));
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
await __classPrivateFieldGet(this, _Subject_perspective, "f").executeAction(actions, __classPrivateFieldGet(this, _Subject_baseExpression, "f"), [{ name: "value", value }]);
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
// Define collection removers
|
|
151
|
-
let removers = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClassName, "f")}", C), collection_remover(C, Collection, Remover)`);
|
|
152
|
-
if (!removers)
|
|
153
|
-
removers = [];
|
|
154
|
-
for (let remover of removers) {
|
|
155
|
-
if (remover) {
|
|
156
|
-
const collection = remover.Collection;
|
|
157
|
-
const actions = eval(remover.Remover);
|
|
158
|
-
this[collectionToRemoverName(collection)] = async (value) => {
|
|
159
|
-
if (Array.isArray(value)) {
|
|
160
|
-
await Promise.all(value.map(v => __classPrivateFieldGet(this, _Subject_perspective, "f").executeAction(actions, __classPrivateFieldGet(this, _Subject_baseExpression, "f"), [{ name: "value", value: v }])));
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
await __classPrivateFieldGet(this, _Subject_perspective, "f").executeAction(actions, __classPrivateFieldGet(this, _Subject_baseExpression, "f"), [{ name: "value", value }]);
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
// Define collection setters
|
|
169
|
-
let collectionSetters = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClassName, "f")}", C), collection_setter(C, Collection, Setter)`);
|
|
170
|
-
if (!collectionSetters)
|
|
171
|
-
collectionSetters = [];
|
|
172
|
-
for (let collectionSetter of collectionSetters) {
|
|
173
|
-
if (collectionSetter) {
|
|
174
|
-
const collection = collectionSetter.Collection;
|
|
175
|
-
const actions = eval(collectionSetter.Setter);
|
|
176
|
-
this[collectionToSetterName(collection)] = async (value) => {
|
|
177
|
-
if (Array.isArray(value)) {
|
|
178
|
-
await __classPrivateFieldGet(this, _Subject_perspective, "f").executeAction(actions, __classPrivateFieldGet(this, _Subject_baseExpression, "f"), value.map(v => ({ name: "value", value: v })));
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
await __classPrivateFieldGet(this, _Subject_perspective, "f").executeAction(actions, __classPrivateFieldGet(this, _Subject_baseExpression, "f"), [{ name: "value", value }]);
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
_Subject_baseExpression = new WeakMap(), _Subject_subjectClassName = new WeakMap(), _Subject_perspective = new WeakMap();
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { PerspectiveProxy } from "../perspectives/PerspectiveProxy";
|
|
2
|
-
type ValueTuple = [name: string, value: any, resolve?: boolean];
|
|
3
|
-
type WhereOps = {
|
|
4
|
-
not: string | number | boolean | string[] | number[];
|
|
5
|
-
between: [number, number];
|
|
6
|
-
lt: number;
|
|
7
|
-
lte: number;
|
|
8
|
-
gt: number;
|
|
9
|
-
gte: number;
|
|
10
|
-
};
|
|
11
|
-
type WhereCondition = string | number | boolean | string[] | number[] | {
|
|
12
|
-
[K in keyof WhereOps]?: WhereOps[K];
|
|
13
|
-
};
|
|
14
|
-
type Where = {
|
|
15
|
-
[propertyName: string]: WhereCondition;
|
|
16
|
-
};
|
|
17
|
-
type Order = {
|
|
18
|
-
[propertyName: string]: "ASC" | "DESC";
|
|
19
|
-
};
|
|
20
|
-
export type Query = {
|
|
21
|
-
source?: string;
|
|
22
|
-
properties?: string[];
|
|
23
|
-
collections?: string[];
|
|
24
|
-
where?: Where;
|
|
25
|
-
order?: Order;
|
|
26
|
-
offset?: number;
|
|
27
|
-
limit?: number;
|
|
28
|
-
count?: boolean;
|
|
29
|
-
};
|
|
30
|
-
export type AllInstancesResult = {
|
|
31
|
-
AllInstances: SubjectEntity[];
|
|
32
|
-
TotalCount?: number;
|
|
33
|
-
};
|
|
34
|
-
export type ResultsWithTotalCount<T> = {
|
|
35
|
-
results: T[];
|
|
36
|
-
totalCount?: number;
|
|
37
|
-
};
|
|
38
|
-
export type PaginationResult<T> = {
|
|
39
|
-
results: T[];
|
|
40
|
-
totalCount?: number;
|
|
41
|
-
pageSize: number;
|
|
42
|
-
pageNumber: number;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Class representing a subject entity.
|
|
46
|
-
* Can extend this class to create a new subject entity to add methods interact with SDNA and much better experience then using the bare bone methods.
|
|
47
|
-
*/
|
|
48
|
-
export declare class SubjectEntity {
|
|
49
|
-
#private;
|
|
50
|
-
author: string;
|
|
51
|
-
timestamp: string;
|
|
52
|
-
private static classNamesByClass;
|
|
53
|
-
static getClassName(perspective: PerspectiveProxy): Promise<string>;
|
|
54
|
-
/**
|
|
55
|
-
* Constructs a new subject.
|
|
56
|
-
* @param perspective - The perspective that the subject belongs to.
|
|
57
|
-
* @param baseExpression - The base expression of the subject.
|
|
58
|
-
* @param source - The source of the subject, the expression this instance is linked too.
|
|
59
|
-
*/
|
|
60
|
-
constructor(perspective: PerspectiveProxy, baseExpression?: string, source?: string);
|
|
61
|
-
/**
|
|
62
|
-
* Gets the base expression of the subject.
|
|
63
|
-
*/
|
|
64
|
-
get baseExpression(): string;
|
|
65
|
-
/**
|
|
66
|
-
* Protected getter for the perspective.
|
|
67
|
-
* Allows subclasses to access the perspective while keeping it private from external code.
|
|
68
|
-
*/
|
|
69
|
-
protected get perspective(): PerspectiveProxy;
|
|
70
|
-
static assignValuesToInstance(perspective: PerspectiveProxy, instance: SubjectEntity, values: ValueTuple[]): Promise<void>;
|
|
71
|
-
private getData;
|
|
72
|
-
static queryToProlog(perspective: PerspectiveProxy, query: Query): Promise<string>;
|
|
73
|
-
static instancesFromPrologResult<T extends SubjectEntity>(this: typeof SubjectEntity & (new (...args: any[]) => T), perspective: PerspectiveProxy, query: Query, result: AllInstancesResult): Promise<ResultsWithTotalCount<T>>;
|
|
74
|
-
/**
|
|
75
|
-
* Gets all instances of the subject entity in the perspective that match the query params .
|
|
76
|
-
* @param perspective - The perspective that the subject entities belongs to.
|
|
77
|
-
* @param query - The query object used to define search contraints.
|
|
78
|
-
*
|
|
79
|
-
* @returns An array of all subject entity matches.
|
|
80
|
-
*
|
|
81
|
-
*/
|
|
82
|
-
static findAll<T extends SubjectEntity>(this: typeof SubjectEntity & (new (...args: any[]) => T), perspective: PerspectiveProxy, query?: Query): Promise<T[]>;
|
|
83
|
-
/**
|
|
84
|
-
* Gets all instances of the subject entity in the perspective that match the query params and includes a count of all matches without limit applied.
|
|
85
|
-
* @param perspective - The perspective that the subject entities belongs to.
|
|
86
|
-
* @param query - The query object used to define search contraints.
|
|
87
|
-
*
|
|
88
|
-
* @returns An object containing an instances array of all subject entity matches and a count of all matches without limit applied.
|
|
89
|
-
*
|
|
90
|
-
*/
|
|
91
|
-
static findAllAndCount<T extends SubjectEntity>(this: typeof SubjectEntity & (new (...args: any[]) => T), perspective: PerspectiveProxy, query?: Query): Promise<ResultsWithTotalCount<T>>;
|
|
92
|
-
/**
|
|
93
|
-
* Helper function to make pagination easier with explicit pageSize & pageNumber props.
|
|
94
|
-
* @param perspective - The perspective that the subject entities belongs to.
|
|
95
|
-
* @param query - The query object used to define search contraints.
|
|
96
|
-
*
|
|
97
|
-
* @returns An a page of results based on the pageSize & pageNumber props.
|
|
98
|
-
*
|
|
99
|
-
*/
|
|
100
|
-
static paginate<T extends SubjectEntity>(this: typeof SubjectEntity & (new (...args: any[]) => T), perspective: PerspectiveProxy, pageSize: number, pageNumber: number, query?: Query): Promise<PaginationResult<T>>;
|
|
101
|
-
static countQueryToProlog(perspective: PerspectiveProxy, query?: Query): Promise<string>;
|
|
102
|
-
/**
|
|
103
|
-
* Gets a count of all instances of the subject entity in the perspective that match the query params.
|
|
104
|
-
* @param perspective - The perspective that the subject entities belongs to.
|
|
105
|
-
* @param query - The query object used to define search contraints.
|
|
106
|
-
*
|
|
107
|
-
* @returns The count of subject entities matching the query.
|
|
108
|
-
*
|
|
109
|
-
*/
|
|
110
|
-
static count(perspective: PerspectiveProxy, query?: Query): Promise<any>;
|
|
111
|
-
private setProperty;
|
|
112
|
-
private setCollectionSetter;
|
|
113
|
-
private setCollectionAdder;
|
|
114
|
-
private setCollectionRemover;
|
|
115
|
-
/**
|
|
116
|
-
* Save the subject entity.
|
|
117
|
-
* This method will create a new subject with the base expression and add a new link from the source to the base expression with the predicate "ad4m://has_child".
|
|
118
|
-
*
|
|
119
|
-
* If a property has an action, it will perform the action (Only for collections).
|
|
120
|
-
* If a property is an array and is not empty, it will set the collection.
|
|
121
|
-
* If a property is not undefined, not null, and not an empty string, it will set the property.
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* @throws Will throw an error if the subject entity cannot be converted to a subject class, or if the subject cannot be created, or if the link cannot be added, or if the subject entity cannot be updated.
|
|
125
|
-
*/
|
|
126
|
-
save(): Promise<void>;
|
|
127
|
-
/**
|
|
128
|
-
* Update the subject entity.
|
|
129
|
-
*
|
|
130
|
-
* It will iterate over the properties of the subject entity.
|
|
131
|
-
*
|
|
132
|
-
* If a property has an action, it will perform the action (Only for collections).
|
|
133
|
-
* If a property is an array and is not empty, it will set the collection.
|
|
134
|
-
* If a property is not undefined, not null, and not an empty string, it will set the property.
|
|
135
|
-
*
|
|
136
|
-
* @throws Will throw an error if the subject entity cannot be converted to a subject class, or if a property cannot be set, or if a collection cannot be set, or if the data of the subject entity cannot be gotten.
|
|
137
|
-
*/
|
|
138
|
-
update(): Promise<void>;
|
|
139
|
-
/**
|
|
140
|
-
* Get the subject entity with all the properties & collection populated.
|
|
141
|
-
*
|
|
142
|
-
* @returns The subject entity.
|
|
143
|
-
*
|
|
144
|
-
* @throws Will throw an error if the subject entity cannot be converted to a subject class, or if the data of the subject entity cannot be gotten.
|
|
145
|
-
*/
|
|
146
|
-
get(): Promise<this>;
|
|
147
|
-
/**
|
|
148
|
-
* Delete the subject entity.
|
|
149
|
-
* This method will remove the subject from the perspective.
|
|
150
|
-
*
|
|
151
|
-
* @throws Will throw an error if the subject entity cannot be removed.
|
|
152
|
-
*/
|
|
153
|
-
delete(): Promise<void>;
|
|
154
|
-
/** Query builder for SubjectEntity queries.
|
|
155
|
-
* Allows building queries with a fluent interface and either running them once
|
|
156
|
-
* or subscribing to updates.
|
|
157
|
-
*/
|
|
158
|
-
static query<T extends SubjectEntity>(this: typeof SubjectEntity & (new (...args: any[]) => T), perspective: PerspectiveProxy, query?: Query): SubjectQueryBuilder<T>;
|
|
159
|
-
}
|
|
160
|
-
/** Query builder for SubjectEntity queries.
|
|
161
|
-
* Allows building queries with a fluent interface and either running them once
|
|
162
|
-
* or subscribing to updates.
|
|
163
|
-
*/
|
|
164
|
-
export declare class SubjectQueryBuilder<T extends SubjectEntity> {
|
|
165
|
-
private perspective;
|
|
166
|
-
private queryParams;
|
|
167
|
-
private ctor;
|
|
168
|
-
constructor(perspective: PerspectiveProxy, ctor: typeof SubjectEntity, query?: Query);
|
|
169
|
-
where(conditions: Where): SubjectQueryBuilder<T>;
|
|
170
|
-
order(orderBy: Order): SubjectQueryBuilder<T>;
|
|
171
|
-
limit(limit: number): SubjectQueryBuilder<T>;
|
|
172
|
-
offset(offset: number): SubjectQueryBuilder<T>;
|
|
173
|
-
source(source: string): SubjectQueryBuilder<T>;
|
|
174
|
-
properties(properties: string[]): SubjectQueryBuilder<T>;
|
|
175
|
-
collections(collections: string[]): SubjectQueryBuilder<T>;
|
|
176
|
-
/** Execute the query once and return the results */
|
|
177
|
-
get(): Promise<T[]>;
|
|
178
|
-
/** Subscribe to the query and receive updates when results change */
|
|
179
|
-
subscribe(callback: (results: T[]) => void): Promise<T[]>;
|
|
180
|
-
count(): Promise<number>;
|
|
181
|
-
countSubscribe(callback: (count: number) => void): Promise<number>;
|
|
182
|
-
paginate(pageSize: number, pageNumber: number): Promise<PaginationResult<T>>;
|
|
183
|
-
paginateSubscribe(pageSize: number, pageNumber: number, callback: (results: PaginationResult<T>) => void): Promise<PaginationResult<T>>;
|
|
184
|
-
}
|
|
185
|
-
export {};
|