@statezero/core 0.2.59 → 0.2.61
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/adaptors/vue/components/StateZeroDebugPanel.js +1 -1
- package/dist/core/eventReceivers.js +1 -0
- package/dist/flavours/django/manager.d.ts +9 -0
- package/dist/flavours/django/manager.js +11 -0
- package/dist/flavours/django/model.d.ts +6 -0
- package/dist/flavours/django/model.js +8 -0
- package/dist/flavours/django/querySet.d.ts +10 -0
- package/dist/flavours/django/querySet.js +29 -0
- package/package.json +1 -1
|
@@ -1088,7 +1088,7 @@ class Fs {
|
|
|
1088
1088
|
authEndpoint: s.authEndpoint,
|
|
1089
1089
|
auth: { headers: s.getAuthHeaders?.() || {} }
|
|
1090
1090
|
};
|
|
1091
|
-
s.wsHost ? (l.wsHost = s.wsHost, l.wsPort = s.wsPort ?? 443, l.wssPort = s.wssPort ?? 443, l.enabledTransports = s.enabledTransports ?? ["ws", "wss"]) : l.cluster = s.cluster, this.pusherClient = new ys(s.appKey, l), this.pusherClient.connection.bind("connected", () => {
|
|
1091
|
+
s.wsHost ? (l.wsHost = s.wsHost, l.wsPort = s.wsPort ?? 443, l.wssPort = s.wssPort ?? 443, l.enabledTransports = s.enabledTransports ?? ["ws", "wss"], l.cluster = "") : l.cluster = s.cluster, this.pusherClient = new ys(s.appKey, l), this.pusherClient.connection.bind("connected", () => {
|
|
1092
1092
|
console.log(
|
|
1093
1093
|
`Pusher client connected successfully for backend: ${this.configKey}.`
|
|
1094
1094
|
), this.connectionTimeoutId && (clearTimeout(this.connectionTimeoutId), this.connectionTimeoutId = null);
|
|
@@ -85,6 +85,7 @@ export class PusherEventReceiver {
|
|
|
85
85
|
pusherOpts.wsPort = clientOptions.wsPort ?? 443;
|
|
86
86
|
pusherOpts.wssPort = clientOptions.wssPort ?? 443;
|
|
87
87
|
pusherOpts.enabledTransports = clientOptions.enabledTransports ?? ['ws', 'wss'];
|
|
88
|
+
pusherOpts.cluster = "";
|
|
88
89
|
}
|
|
89
90
|
else {
|
|
90
91
|
pusherOpts.cluster = clientOptions.cluster;
|
|
@@ -157,6 +157,15 @@ export class Manager {
|
|
|
157
157
|
* and a boolean indicating whether it was created.
|
|
158
158
|
*/
|
|
159
159
|
updateOrCreate(lookupFields: any, defaults?: Object): Promise<ResultTuple>;
|
|
160
|
+
/**
|
|
161
|
+
* Reconstructs a QuerySet builder from a compiled AST dict.
|
|
162
|
+
* The returned QuerySet can be further chained with .filter(),
|
|
163
|
+
* .exclude(), .orderBy(), .search() before executing.
|
|
164
|
+
*
|
|
165
|
+
* @param {Object} ast - A compiled AST (from build() or compile()).
|
|
166
|
+
* @returns {QuerySet} A new QuerySet that can be chained further.
|
|
167
|
+
*/
|
|
168
|
+
hydrate(ast: Object): QuerySet<any>;
|
|
160
169
|
/**
|
|
161
170
|
* Executes a pre-compiled AST through the standard QueryExecutor path.
|
|
162
171
|
*
|
|
@@ -200,6 +200,17 @@ export class Manager {
|
|
|
200
200
|
async updateOrCreate(lookupFields, defaults = {}) {
|
|
201
201
|
return this.newQuerySet().updateOrCreate(lookupFields, defaults);
|
|
202
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Reconstructs a QuerySet builder from a compiled AST dict.
|
|
205
|
+
* The returned QuerySet can be further chained with .filter(),
|
|
206
|
+
* .exclude(), .orderBy(), .search() before executing.
|
|
207
|
+
*
|
|
208
|
+
* @param {Object} ast - A compiled AST (from build() or compile()).
|
|
209
|
+
* @returns {QuerySet} A new QuerySet that can be chained further.
|
|
210
|
+
*/
|
|
211
|
+
hydrate(ast) {
|
|
212
|
+
return this.QuerySetClass.hydrate(ast, this.ModelClass);
|
|
213
|
+
}
|
|
203
214
|
/**
|
|
204
215
|
* Executes a pre-compiled AST through the standard QueryExecutor path.
|
|
205
216
|
*
|
|
@@ -54,6 +54,12 @@ export class Model {
|
|
|
54
54
|
* @returns {Promise<any>} The query result.
|
|
55
55
|
*/
|
|
56
56
|
static execute(ast: import("./querySet.js").CompiledAST): Promise<any>;
|
|
57
|
+
/**
|
|
58
|
+
* Reconstructs a QuerySet builder from a compiled AST dict.
|
|
59
|
+
* @param {Object} ast - A compiled AST (from build() or compile()).
|
|
60
|
+
* @returns {QuerySet} A new QuerySet that can be chained further.
|
|
61
|
+
*/
|
|
62
|
+
static hydrate(ast: Object): QuerySet;
|
|
57
63
|
/**
|
|
58
64
|
* Get field permissions for the current user (cached on the class)
|
|
59
65
|
* @param {boolean} refresh - Force refresh the cached permissions
|
|
@@ -322,6 +322,14 @@ export class Model {
|
|
|
322
322
|
static execute(ast) {
|
|
323
323
|
return this.objects.execute(ast);
|
|
324
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* Reconstructs a QuerySet builder from a compiled AST dict.
|
|
327
|
+
* @param {Object} ast - A compiled AST (from build() or compile()).
|
|
328
|
+
* @returns {QuerySet} A new QuerySet that can be chained further.
|
|
329
|
+
*/
|
|
330
|
+
static hydrate(ast) {
|
|
331
|
+
return this.objects.hydrate(ast);
|
|
332
|
+
}
|
|
325
333
|
/**
|
|
326
334
|
* Get field permissions for the current user (cached on the class)
|
|
327
335
|
* @param {boolean} refresh - Force refresh the cached permissions
|
|
@@ -16,6 +16,16 @@
|
|
|
16
16
|
* @template T
|
|
17
17
|
*/
|
|
18
18
|
export class QuerySet<T> {
|
|
19
|
+
/**
|
|
20
|
+
* Reconstructs a QuerySet builder from a compiled AST dict.
|
|
21
|
+
* The returned QuerySet can be further chained with .filter(),
|
|
22
|
+
* .exclude(), .orderBy(), .search() before executing.
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} ast - A compiled AST (from build() or compile()).
|
|
25
|
+
* @param {Function} ModelClass - The model constructor.
|
|
26
|
+
* @returns {QuerySet} A new QuerySet that can be chained further.
|
|
27
|
+
*/
|
|
28
|
+
static hydrate(ast: Object, ModelClass: Function): QuerySet<any>;
|
|
19
29
|
/**
|
|
20
30
|
* Creates a new QuerySet.
|
|
21
31
|
*
|
|
@@ -688,6 +688,35 @@ export class QuerySet {
|
|
|
688
688
|
updateOrCreate: (args) => this._compile('update_or_create', args),
|
|
689
689
|
};
|
|
690
690
|
}
|
|
691
|
+
/**
|
|
692
|
+
* Reconstructs a QuerySet builder from a compiled AST dict.
|
|
693
|
+
* The returned QuerySet can be further chained with .filter(),
|
|
694
|
+
* .exclude(), .orderBy(), .search() before executing.
|
|
695
|
+
*
|
|
696
|
+
* @param {Object} ast - A compiled AST (from build() or compile()).
|
|
697
|
+
* @param {Function} ModelClass - The model constructor.
|
|
698
|
+
* @returns {QuerySet} A new QuerySet that can be chained further.
|
|
699
|
+
*/
|
|
700
|
+
static hydrate(ast, ModelClass) {
|
|
701
|
+
const nodes = [];
|
|
702
|
+
// Restore filter tree as a single pre-built node
|
|
703
|
+
if (ast.filter) {
|
|
704
|
+
nodes.push(ast.filter);
|
|
705
|
+
}
|
|
706
|
+
// Restore search as a search node
|
|
707
|
+
if (ast.search) {
|
|
708
|
+
nodes.push({
|
|
709
|
+
type: "search",
|
|
710
|
+
searchQuery: ast.search.searchQuery,
|
|
711
|
+
searchFields: ast.search.searchFields,
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
return new QuerySet(ModelClass, {
|
|
715
|
+
nodes,
|
|
716
|
+
orderBy: ast.orderBy ? [...ast.orderBy] : undefined,
|
|
717
|
+
aggregations: ast.aggregations ? [...ast.aggregations] : [],
|
|
718
|
+
});
|
|
719
|
+
}
|
|
691
720
|
build() {
|
|
692
721
|
if (this._prebuiltAST)
|
|
693
722
|
return clone(this._prebuiltAST);
|
package/package.json
CHANGED