@coasys/ad4m 0.8.2-prerelease-2 → 0.9.0-rc2

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.
@@ -6,40 +6,183 @@ export declare class PerspectiveAction {
6
6
  }
7
7
  export declare function addLink(source: string, predicate: string, target: string): PerspectiveAction;
8
8
  export declare function hasLink(predicate: string): string;
9
- interface InstanceQueryParams {
9
+ export interface InstanceQueryParams {
10
+ /**
11
+ * An object representing the WHERE clause of the query.
12
+ */
10
13
  where?: object;
14
+ /**
15
+ * A string representing the condition clause of the query.
16
+ */
11
17
  condition?: string;
12
18
  }
13
- export declare function instanceQuery(options?: InstanceQueryParams): <T>(target: T, key: keyof T, descriptor: PropertyDescriptor) => void;
14
- interface PropertyOptions {
19
+ /**
20
+ * Decorator for querying instances of a subject class.
21
+ *
22
+ * @category Decorators
23
+ *
24
+ * @description
25
+ * NOTE: Only works on methods that return a promise and will throw an error if not used on a method that returns a promise.
26
+ * This will allow you to query for instances of a subject class with custom clauses within the instance clauses.
27
+ *
28
+ * @example
29
+ * // Usage with where clause
30
+ * InstanceQuery({ where: { name: "John" }}) // this will return all the properties of the subject class with the name "John"
31
+ *
32
+ * @example
33
+ * // Usage with condition clause
34
+ * InstanceQuery({ condition: "triple(Instance, 'age', Age), Age > 18" }) // this will return all the properties of the subject class with the age greater than 18
35
+ *
36
+ * @param {Object} [options] - Query options.
37
+ */
38
+ export declare function InstanceQuery(options?: InstanceQueryParams): <T>(target: T, key: keyof T, descriptor: PropertyDescriptor) => void;
39
+ export interface PropertyOptions {
40
+ /**
41
+ * The predicate of the property. All properties must have this option.
42
+ */
15
43
  through?: string;
44
+ /**
45
+ * The initial value of the property. Required if the property is marked as required.
46
+ */
16
47
  initial?: string;
48
+ /**
49
+ * Indicates whether the property is required. If true, an initial value must be provided.
50
+ */
17
51
  required?: boolean;
52
+ /**
53
+ * Indicates whether the property is writable. If true, a setter will be available in the prolog engine.
54
+ */
18
55
  writable?: boolean;
56
+ /**
57
+ * The language used to store the property. Can be the default `Literal` Language or a custom language address.
58
+ */
19
59
  resolveLanguage?: string;
60
+ /**
61
+ * Custom getter to get the value of the property in the prolog engine. If not provided, the default getter will be used.
62
+ */
20
63
  getter?: string;
64
+ /**
65
+ * Custom setter to set the value of the property in the prolog engine. Only available if the property is writable.
66
+ */
21
67
  setter?: string;
68
+ /**
69
+ * Indicates whether the property is stored locally in the perspective and not in the network. Useful for properties that are not meant to be shared with the network.
70
+ */
22
71
  local?: boolean;
23
72
  }
24
- export declare function subjectProperty(opts: PropertyOptions): <T>(target: T, key: keyof T) => void;
25
- interface FlagOptions {
73
+ /**
74
+ * Decorator for defining properties of a subject class.
75
+ *
76
+ * @category Decorators
77
+ *
78
+ * @description
79
+ * This will allow you to define properties with different conditions and how they would be defined in proflog engine.
80
+ *
81
+ * - All properties must have a `through` option which is the predicate of the property.
82
+ * -e If the property is required, it must have an `initial` option which is the initial value of the property.
83
+ * - If the property is writable, it will have a setter in prolog engine. A custom setter can be defined with the `setter` option.
84
+ * - If resolveLanguage is defined, you can use the default `Literal` Language or use your custom language address that can be used to store the property.
85
+ * - If a custom getter is defined, it will be used to get the value of the property in prolog engine. If not, the default getter will be used.
86
+ * - If local is defined, the property will be stored locally in the perspective and not in the network. This is useful for properties that are not meant to be shared with the network
87
+ *
88
+ * @example
89
+ * // Usage
90
+ * SubjectProperty({ through: "ad4m://name", initial: "John", required: true }) // this will define a property with the name "ad4m://name" and the initial value "John"
91
+ *
92
+ * @param {PropertyOptions} [opts] - Property options.
93
+ */
94
+ export declare function SubjectProperty(opts: PropertyOptions): <T>(target: T, key: keyof T) => void;
95
+ export interface FlagOptions {
96
+ /**
97
+ * The predicate of the property. All properties must have this option.
98
+ */
26
99
  through: string;
100
+ /**
101
+ * The value of the property.
102
+ */
27
103
  value: string;
28
104
  }
29
- export declare function subjectFlag(opts: FlagOptions): <T>(target: T, key: keyof T) => void;
105
+ /**
106
+ * Decorator for defining flags of a subject class
107
+ *
108
+ * @category Decorators
109
+ *
110
+ * @description
111
+ * The idea behind flag decorator is to define a property that is required and has an initial value.
112
+ * This will allow you to define a strict instance query. This behaviour can also be achieved with the `SubjectProperty` decorator but the `SubjectFlag` decorator is a shorthand for that.
113
+ *
114
+ * NOTE: Use of Flag is discouraged and should be used only when necessary.
115
+ *
116
+ * - All properties must have a `through` & `initial` option which is the predicate of the property.
117
+ *
118
+ * @example
119
+ * // Usage
120
+ * SubjectFlag({ through: "ad4m://name", value: "John" }) // this will define a flag with the name "ad4m://name" and the initial value "John"
121
+ *
122
+ * @param {FlagOptions} [opts] Flag options.
123
+ */
124
+ export declare function SubjectFlag(opts: FlagOptions): <T>(target: T, key: keyof T) => void;
30
125
  interface WhereOptions {
31
126
  isInstance?: any;
32
127
  condition?: string;
33
128
  }
34
- interface CollectionOptions {
129
+ export interface CollectionOptions {
130
+ /**
131
+ * The predicate of the property. All properties must have this option.
132
+ */
35
133
  through: string;
134
+ /**
135
+ * An object representing the WHERE clause of the query.
136
+ */
36
137
  where?: WhereOptions;
138
+ /**
139
+ * Indicates whether the property is stored locally in the perspective and not in the network. Useful for properties that are not meant to be shared with the network.
140
+ */
37
141
  local?: boolean;
38
142
  }
39
- export declare function subjectCollection(opts: CollectionOptions): <T>(target: T, key: keyof T) => void;
143
+ /**
144
+ * Decorator for defining collections of a subject class.
145
+ *
146
+ * @category Decorators
147
+ *
148
+ * @description
149
+ * This will allow you to define collections with different conditions and how they would be defined in proflog engine.
150
+ *
151
+ * NOTE: The property needs to be an array for it to picked up during the initialization phase.
152
+ *
153
+ * - All collections must have a `through` option which is the predicate of the collection.
154
+ * - If the collection has a `where` option, it can be used to define a custom condition for the collection.
155
+ * - If the collection has a `local` option, the collection will be stored locally in the perspective and not in the network. This is useful for collections that are not meant to be shared with the network.
156
+ *
157
+ * @example
158
+ * // Usage
159
+ * SubjectCollection({ through: "ad4m://friends" }) // this will define a collection with the name "ad4m://friends"
160
+ *
161
+ * @param opts Collection options.
162
+ */
163
+ export declare function SubjectCollection(opts: CollectionOptions): <T>(target: T, key: keyof T) => void;
40
164
  export declare function makeRandomPrologAtom(length: number): string;
41
- interface SDNAClassOptions {
165
+ export interface SDNAClassOptions {
166
+ /**
167
+ * The name of the entity.
168
+ */
42
169
  name: string;
43
170
  }
171
+ /**
172
+ * Decorator for defining an SDNA class.
173
+ *
174
+ * @category Decorators
175
+ *
176
+ * @description
177
+ * This will create a new SDNA class with the given name and add custom methods to generate the SDNA for the class, for this to work the class need to have the properties defined using the decorators like `SubjectProperty`.
178
+ *
179
+ * Note: This decorator is required for the class to be picked up during the initialization phase.
180
+ *
181
+ * @example
182
+ * // Usage
183
+ * SDNAClass({ name: "Person" }) // this will create a new SDNA class with the name "Person"
184
+ *
185
+ * @param opts SDNA class options.
186
+ */
44
187
  export declare function SDNAClass(opts: SDNAClassOptions): (target: any) => void;
45
188
  export {};
@@ -13,11 +13,30 @@ export function addLink(source, predicate, target) {
13
13
  export function hasLink(predicate) {
14
14
  return `triple(this, "${predicate}", _)`;
15
15
  }
16
- export function instanceQuery(options) {
16
+ /**
17
+ * Decorator for querying instances of a subject class.
18
+ *
19
+ * @category Decorators
20
+ *
21
+ * @description
22
+ * NOTE: Only works on methods that return a promise and will throw an error if not used on a method that returns a promise.
23
+ * This will allow you to query for instances of a subject class with custom clauses within the instance clauses.
24
+ *
25
+ * @example
26
+ * // Usage with where clause
27
+ * InstanceQuery({ where: { name: "John" }}) // this will return all the properties of the subject class with the name "John"
28
+ *
29
+ * @example
30
+ * // Usage with condition clause
31
+ * InstanceQuery({ condition: "triple(Instance, 'age', Age), Age > 18" }) // this will return all the properties of the subject class with the age greater than 18
32
+ *
33
+ * @param {Object} [options] - Query options.
34
+ */
35
+ export function InstanceQuery(options) {
17
36
  return function (target, key, descriptor) {
18
37
  const originalMethod = descriptor.value;
19
38
  if (typeof originalMethod !== "function") {
20
- throw new Error("instanceQuery decorator can only be applied to methods");
39
+ throw new Error("InstanceQuery decorator can only be applied to methods");
21
40
  }
22
41
  descriptor.value = async function (perspective) {
23
42
  let instances = [];
@@ -50,8 +69,35 @@ export function instanceQuery(options) {
50
69
  };
51
70
  };
52
71
  }
53
- export function subjectProperty(opts) {
72
+ /**
73
+ * Decorator for defining properties of a subject class.
74
+ *
75
+ * @category Decorators
76
+ *
77
+ * @description
78
+ * This will allow you to define properties with different conditions and how they would be defined in proflog engine.
79
+ *
80
+ * - All properties must have a `through` option which is the predicate of the property.
81
+ * -e If the property is required, it must have an `initial` option which is the initial value of the property.
82
+ * - If the property is writable, it will have a setter in prolog engine. A custom setter can be defined with the `setter` option.
83
+ * - If resolveLanguage is defined, you can use the default `Literal` Language or use your custom language address that can be used to store the property.
84
+ * - If a custom getter is defined, it will be used to get the value of the property in prolog engine. If not, the default getter will be used.
85
+ * - If local is defined, the property will be stored locally in the perspective and not in the network. This is useful for properties that are not meant to be shared with the network
86
+ *
87
+ * @example
88
+ * // Usage
89
+ * SubjectProperty({ through: "ad4m://name", initial: "John", required: true }) // this will define a property with the name "ad4m://name" and the initial value "John"
90
+ *
91
+ * @param {PropertyOptions} [opts] - Property options.
92
+ */
93
+ export function SubjectProperty(opts) {
54
94
  return function (target, key) {
95
+ if (opts.required && !opts.initial) {
96
+ throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");
97
+ }
98
+ if (!opts.through && !opts.getter) {
99
+ throw new Error("SubjectProperty requires either 'through' or 'getter' option");
100
+ }
55
101
  target["__properties"] = target["__properties"] || {};
56
102
  target["__properties"][key] = target["__properties"][key] || {};
57
103
  target["__properties"][key] = { ...target["__properties"][key], ...opts };
@@ -62,8 +108,36 @@ export function subjectProperty(opts) {
62
108
  Object.defineProperty(target, key, { configurable: true, writable: true });
63
109
  };
64
110
  }
65
- export function subjectFlag(opts) {
111
+ /**
112
+ * Decorator for defining flags of a subject class
113
+ *
114
+ * @category Decorators
115
+ *
116
+ * @description
117
+ * The idea behind flag decorator is to define a property that is required and has an initial value.
118
+ * This will allow you to define a strict instance query. This behaviour can also be achieved with the `SubjectProperty` decorator but the `SubjectFlag` decorator is a shorthand for that.
119
+ *
120
+ * NOTE: Use of Flag is discouraged and should be used only when necessary.
121
+ *
122
+ * - All properties must have a `through` & `initial` option which is the predicate of the property.
123
+ *
124
+ * @example
125
+ * // Usage
126
+ * SubjectFlag({ through: "ad4m://name", value: "John" }) // this will define a flag with the name "ad4m://name" and the initial value "John"
127
+ *
128
+ * @param {FlagOptions} [opts] Flag options.
129
+ */
130
+ export function SubjectFlag(opts) {
66
131
  return function (target, key) {
132
+ if (!opts.through && !opts.value) {
133
+ throw new Error("SubjectFlag requires a 'through' and 'value' option");
134
+ }
135
+ if (!opts.through) {
136
+ throw new Error("SubjectFlag requires a 'through' option");
137
+ }
138
+ if (!opts.value) {
139
+ throw new Error("SubjectFlag requires a 'value' option");
140
+ }
67
141
  target["__properties"] = target["__properties"] || {};
68
142
  target["__properties"][key] = target["__properties"][key] || {};
69
143
  target["__properties"][key] = {
@@ -78,7 +152,27 @@ export function subjectFlag(opts) {
78
152
  Object.defineProperty(target, key, { configurable: true, writable: true });
79
153
  };
80
154
  }
81
- export function subjectCollection(opts) {
155
+ /**
156
+ * Decorator for defining collections of a subject class.
157
+ *
158
+ * @category Decorators
159
+ *
160
+ * @description
161
+ * This will allow you to define collections with different conditions and how they would be defined in proflog engine.
162
+ *
163
+ * NOTE: The property needs to be an array for it to picked up during the initialization phase.
164
+ *
165
+ * - All collections must have a `through` option which is the predicate of the collection.
166
+ * - If the collection has a `where` option, it can be used to define a custom condition for the collection.
167
+ * - If the collection has a `local` option, the collection will be stored locally in the perspective and not in the network. This is useful for collections that are not meant to be shared with the network.
168
+ *
169
+ * @example
170
+ * // Usage
171
+ * SubjectCollection({ through: "ad4m://friends" }) // this will define a collection with the name "ad4m://friends"
172
+ *
173
+ * @param opts Collection options.
174
+ */
175
+ export function SubjectCollection(opts) {
82
176
  return function (target, key) {
83
177
  target["__collections"] = target["__collections"] || {};
84
178
  target["__collections"][key] = opts;
@@ -98,6 +192,22 @@ export function makeRandomPrologAtom(length) {
98
192
  }
99
193
  return result;
100
194
  }
195
+ /**
196
+ * Decorator for defining an SDNA class.
197
+ *
198
+ * @category Decorators
199
+ *
200
+ * @description
201
+ * This will create a new SDNA class with the given name and add custom methods to generate the SDNA for the class, for this to work the class need to have the properties defined using the decorators like `SubjectProperty`.
202
+ *
203
+ * Note: This decorator is required for the class to be picked up during the initialization phase.
204
+ *
205
+ * @example
206
+ * // Usage
207
+ * SDNAClass({ name: "Person" }) // this will create a new SDNA class with the name "Person"
208
+ *
209
+ * @param opts SDNA class options.
210
+ */
101
211
  export function SDNAClass(opts) {
102
212
  return function (target) {
103
213
  target.prototype.className = opts.name;
@@ -1,7 +1,25 @@
1
1
  import { PerspectiveProxy } from "../perspectives/PerspectiveProxy";
2
+ /**
3
+ * Represents a subject in the perspective.
4
+ * A subject is an entity that has properties and collections.
5
+ */
2
6
  export declare class Subject {
3
7
  #private;
8
+ /**
9
+ * Constructs a new subject.
10
+ * @param perspective - The perspective that the subject belongs to.
11
+ * @param baseExpression - The base expression of the subject.
12
+ * @param subjectClass - The class of the subject.
13
+ */
4
14
  constructor(perspective: PerspectiveProxy, baseExpression: string, subjectClass: string);
15
+ /**
16
+ * Gets the base expression of the subject.
17
+ */
5
18
  get baseExpression(): string;
19
+ /**
20
+ * Initializes the subject by validating it and defining its properties and collections dynamically.
21
+ *
22
+ * NOTE: This method should be called before using the subject. All the properties and collections of the subject defined are not type-checked.
23
+ */
6
24
  init(): Promise<void>;
7
25
  }
@@ -11,7 +11,17 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
11
  };
12
12
  var _Subject_baseExpression, _Subject_subjectClass, _Subject_perspective;
13
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
+ */
14
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 subjectClass - The class of the subject.
24
+ */
15
25
  constructor(perspective, baseExpression, subjectClass) {
16
26
  _Subject_baseExpression.set(this, void 0);
17
27
  _Subject_subjectClass.set(this, void 0);
@@ -20,14 +30,24 @@ export class Subject {
20
30
  __classPrivateFieldSet(this, _Subject_subjectClass, subjectClass, "f");
21
31
  __classPrivateFieldSet(this, _Subject_perspective, perspective, "f");
22
32
  }
33
+ /**
34
+ * Gets the base expression of the subject.
35
+ */
23
36
  get baseExpression() {
24
37
  return __classPrivateFieldGet(this, _Subject_baseExpression, "f");
25
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
+ */
26
44
  async init() {
45
+ // Check if the subject is a valid instance of the subject class
27
46
  let isInstance = await __classPrivateFieldGet(this, _Subject_perspective, "f").isSubjectInstance(__classPrivateFieldGet(this, _Subject_baseExpression, "f"), __classPrivateFieldGet(this, _Subject_subjectClass, "f"));
28
47
  if (!isInstance) {
29
48
  throw `Not a valid subject instance of ${__classPrivateFieldGet(this, _Subject_subjectClass, "f")} for ${__classPrivateFieldGet(this, _Subject_baseExpression, "f")}`;
30
49
  }
50
+ // Define properties and collections dynamically
31
51
  let results = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClass, "f")}", C), property(C, Property)`);
32
52
  let properties = results.map(result => result.Property);
33
53
  for (let p of properties) {
@@ -70,8 +90,8 @@ export class Subject {
70
90
  }
71
91
  });
72
92
  }
93
+ // Define setters
73
94
  const setters = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClass, "f")}", C), property_setter(C, Property, Setter)`);
74
- //console.log("Subject setters: " + setters.map(setter => setter.Property))
75
95
  for (let setter of (setters ? setters : [])) {
76
96
  if (setter) {
77
97
  const property = setter.Property;
@@ -89,6 +109,7 @@ export class Subject {
89
109
  };
90
110
  }
91
111
  }
112
+ // Define collections
92
113
  let results2 = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClass, "f")}", C), collection(C, Collection)`);
93
114
  if (!results2)
94
115
  results2 = [];
@@ -108,6 +129,7 @@ export class Subject {
108
129
  }
109
130
  });
110
131
  }
132
+ // Define collection adders
111
133
  let adders = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClass, "f")}", C), collection_adder(C, Collection, Adder)`);
112
134
  if (!adders)
113
135
  adders = [];
@@ -125,6 +147,7 @@ export class Subject {
125
147
  };
126
148
  }
127
149
  }
150
+ // Define collection removers
128
151
  let removers = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClass, "f")}", C), collection_remover(C, Collection, Remover)`);
129
152
  if (!removers)
130
153
  removers = [];
@@ -142,6 +165,7 @@ export class Subject {
142
165
  };
143
166
  }
144
167
  }
168
+ // Define collection setters
145
169
  let collectionSetters = await __classPrivateFieldGet(this, _Subject_perspective, "f").infer(`subject_class("${__classPrivateFieldGet(this, _Subject_subjectClass, "f")}", C), collection_setter(C, Collection, Setter)`);
146
170
  if (!collectionSetters)
147
171
  collectionSetters = [];
@@ -2,22 +2,93 @@ import { PerspectiveProxy } from "../perspectives/PerspectiveProxy";
2
2
  export type QueryPartialEntity<T> = {
3
3
  [P in keyof T]?: T[P] | (() => string);
4
4
  };
5
+ /**
6
+ * Class representing a subject entity.
7
+ * 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.
8
+ */
5
9
  export declare class SubjectEntity {
6
10
  #private;
7
11
  author: string;
8
12
  timestamp: string;
13
+ /**
14
+ * Constructs a new subject.
15
+ * @param perspective - The perspective that the subject belongs to.
16
+ * @param baseExpression - The base expression of the subject.
17
+ * @param soruce - The source of the subject, the expression this instance is linked too.
18
+ */
9
19
  constructor(perspective: PerspectiveProxy, baseExpression?: string, source?: string);
20
+ /**
21
+ * Gets the base expression of the subject.
22
+ */
10
23
  get baseExpression(): string;
11
24
  private getData;
12
25
  private setProperty;
13
26
  private setCollectionSetter;
14
27
  private setCollectionAdder;
15
28
  private setCollectionRemover;
29
+ /**
30
+ * Save the subject entity.
31
+ * 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".
32
+ *
33
+ * If a property has an action, it will perform the action (Only for collections).
34
+ * If a property is an array and is not empty, it will set the collection.
35
+ * If a property is not undefined, not null, and not an empty string, it will set the property.
36
+ *
37
+ *
38
+ * @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.
39
+ */
16
40
  save(): Promise<void>;
41
+ /**
42
+ * Update the subject entity.
43
+ *
44
+ * It will iterate over the properties of the subject entity.
45
+ *
46
+ * If a property has an action, it will perform the action (Only for collections).
47
+ * If a property is an array and is not empty, it will set the collection.
48
+ * If a property is not undefined, not null, and not an empty string, it will set the property.
49
+ *
50
+ * @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.
51
+ */
17
52
  update(): Promise<void>;
53
+ /**
54
+ * Get the subject entity with all the properties & collection populated.
55
+ *
56
+ * @returns The subject entity.
57
+ *
58
+ * @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.
59
+ */
18
60
  get(): Promise<this>;
61
+ /**
62
+ * Delete the subject entity.
63
+ * This method will remove the subject from the perspective.
64
+ *
65
+ * @throws Will throw an error if the subject entity cannot be removed.
66
+ */
19
67
  delete(): Promise<void>;
68
+ /**
69
+ * Get all the subject entities of the subject class.
70
+ *
71
+ * NOTE: this is a static method and should be called on the class itself.
72
+ *
73
+ * @param perspective - The perspective that the subject belongs to.
74
+ *
75
+ * @returns The subject entities.
76
+ *
77
+ * @throws Will throw an error if the subject entity cannot be converted to a subject class, or if the subject proxies cannot be gotten.
78
+ */
20
79
  static all(perspective: PerspectiveProxy): Promise<any[]>;
80
+ /**
81
+ * Query the subject entities of the subject class.
82
+ *
83
+ * NOTE: this is a static method and should be called on the class itself.
84
+ *
85
+ * @param perspective - The perspective that the subject belongs to.
86
+ * @param query - The query of the subject entities.
87
+ *
88
+ * @returns The subject entities.
89
+ *
90
+ * @throws Will throw an error if the subject entity cannot be converted to a subject class, or if the query cannot be inferred, or if the data of the subject entities cannot be gotten.
91
+ */
21
92
  static query(perspective: PerspectiveProxy, query?: SubjectEntityQueryParam): Promise<SubjectEntity[]>;
22
93
  }
23
94
  export type SubjectArray<T> = T[] | {