goby-database 2.1.20 → 2.2.21
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.js +6 -8
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -797,7 +797,7 @@ export default class Project {
|
|
|
797
797
|
}
|
|
798
798
|
// MARKER: modify item retrieval
|
|
799
799
|
retrieve_class_items({ class_id, class_name, class_data, pagination = {} }) {
|
|
800
|
-
var _a, _b, _c, _d;
|
|
800
|
+
var _a, _b, _c, _d, _e;
|
|
801
801
|
const pagination_defaults = {
|
|
802
802
|
page_size: null,
|
|
803
803
|
property_range: 'all'
|
|
@@ -837,7 +837,7 @@ export default class Project {
|
|
|
837
837
|
let target_select = `
|
|
838
838
|
SELECT
|
|
839
839
|
"${property_junction_column_name}",
|
|
840
|
-
json_object('class_id',${target.class_id},'
|
|
840
|
+
json_object('class_id',${target.class_id},'system_id',junction."${target_junction_column_name}"${label_sql_string}) AS target_data
|
|
841
841
|
FROM junction_${junction_id} AS junction
|
|
842
842
|
LEFT JOIN "class_${target_class === null || target_class === void 0 ? void 0 : target_class.name}" AS target_class ON junction."${target_junction_column_name}" = target_class.system_id
|
|
843
843
|
`;
|
|
@@ -896,12 +896,9 @@ export default class Project {
|
|
|
896
896
|
}
|
|
897
897
|
}
|
|
898
898
|
});
|
|
899
|
-
|
|
899
|
+
let total = (_e = this.db.prepare(`SELECT COUNT(1) AS total FROM ${class_string}`).all()[0]) === null || _e === void 0 ? void 0 : _e.total;
|
|
900
|
+
return Object.assign(Object.assign({}, pagination), { loaded: items, total });
|
|
900
901
|
}
|
|
901
|
-
// include:{
|
|
902
|
-
// class_id:number;
|
|
903
|
-
// pagination:ItemPagination
|
|
904
|
-
// }[] = []
|
|
905
902
|
// MARKER: modify item retrieval
|
|
906
903
|
retrieve_all_classes(include = {}) {
|
|
907
904
|
const classes_data = this.run.get_all_classes.all();
|
|
@@ -915,7 +912,8 @@ export default class Project {
|
|
|
915
912
|
class_name: name,
|
|
916
913
|
pagination
|
|
917
914
|
}) : {
|
|
918
|
-
loaded: []
|
|
915
|
+
loaded: [],
|
|
916
|
+
total: 0
|
|
919
917
|
};
|
|
920
918
|
return {
|
|
921
919
|
id,
|
package/dist/types.d.ts
CHANGED
|
@@ -146,6 +146,8 @@ export type ItemPagination = {
|
|
|
146
146
|
};
|
|
147
147
|
export type PaginatedItems = ItemPagination & {
|
|
148
148
|
loaded: ClassRow[];
|
|
149
|
+
/** a count of all the items in the class, not just those loaded */
|
|
150
|
+
total: number;
|
|
149
151
|
};
|
|
150
152
|
export type JunctionSides = [RelationshipSide, RelationshipSide];
|
|
151
153
|
export type JunctionTable = {
|