@gen3/core 0.11.38 → 0.11.40
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/cjs/index.js +90 -40
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/server.js.map +1 -1
- package/dist/dts/constants.d.ts +1 -1
- package/dist/dts/features/filters/filters.d.ts +13 -0
- package/dist/dts/features/filters/filters.d.ts.map +1 -1
- package/dist/dts/features/filters/types.d.ts +1 -0
- package/dist/dts/features/filters/types.d.ts.map +1 -1
- package/dist/dts/features/guppy/guppyDownloadSlice.d.ts +3 -3
- package/dist/dts/features/guppy/guppyDownloadSlice.d.ts.map +1 -1
- package/dist/dts/features/guppy/index.d.ts +3 -8
- package/dist/dts/features/guppy/index.d.ts.map +1 -1
- package/dist/dts/features/guppy/types.d.ts +3 -3
- package/dist/dts/features/guppy/types.d.ts.map +1 -1
- package/dist/dts/index.d.ts +2 -2
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/esm/index.js +85 -41
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/server.js.map +1 -1
- package/dist/index.d.ts +46 -6
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -68,11 +68,16 @@ var Accessibility = /*#__PURE__*/ function(Accessibility) {
|
|
|
68
68
|
Accessibility["ALL"] = "all";
|
|
69
69
|
return Accessibility;
|
|
70
70
|
}({});
|
|
71
|
+
const FILE_FORMATS = {
|
|
72
|
+
JSON: 'json',
|
|
73
|
+
TSV: 'tsv',
|
|
74
|
+
CSV: 'csv'
|
|
75
|
+
};
|
|
71
76
|
const FILE_DELIMITERS = {
|
|
72
77
|
tsv: '\t',
|
|
73
78
|
csv: ','
|
|
74
79
|
};
|
|
75
|
-
const CART_LIMIT =
|
|
80
|
+
const CART_LIMIT = 80000;
|
|
76
81
|
|
|
77
82
|
const isFetchError = (obj)=>{
|
|
78
83
|
if (typeof obj !== 'object' || obj === null) {
|
|
@@ -849,6 +854,48 @@ const guppyAPISliceMiddleware = guppyApi.middleware;
|
|
|
849
854
|
const guppyApiSliceReducerPath = guppyApi.reducerPath;
|
|
850
855
|
const guppyApiReducer = guppyApi.reducer;
|
|
851
856
|
|
|
857
|
+
const isFilterSet = (input)=>{
|
|
858
|
+
if (typeof input !== 'object' || input === null) {
|
|
859
|
+
return false;
|
|
860
|
+
}
|
|
861
|
+
const { root, mode } = input;
|
|
862
|
+
if (typeof root !== 'object' || root === null) {
|
|
863
|
+
return false;
|
|
864
|
+
}
|
|
865
|
+
if (![
|
|
866
|
+
'and',
|
|
867
|
+
'or'
|
|
868
|
+
].includes(mode)) {
|
|
869
|
+
return false;
|
|
870
|
+
}
|
|
871
|
+
return true;
|
|
872
|
+
};
|
|
873
|
+
const isUnion = (value)=>{
|
|
874
|
+
return typeof value === 'object' && value !== null && value.operator === 'or' && Array.isArray(value.operands);
|
|
875
|
+
};
|
|
876
|
+
const isIntersection = (value)=>{
|
|
877
|
+
return typeof value === 'object' && value !== null && value.operator === 'and' && Array.isArray(value.operands);
|
|
878
|
+
};
|
|
879
|
+
/**
|
|
880
|
+
* Type guard for Union or Intersection
|
|
881
|
+
* @param o - operator to check
|
|
882
|
+
* @category Filters
|
|
883
|
+
*/ const isIntersectionOrUnion = (o)=>o.operator === 'and' || o.operator === 'or';
|
|
884
|
+
const isOperandsType = (operation)=>{
|
|
885
|
+
return operation?.operands !== undefined;
|
|
886
|
+
};
|
|
887
|
+
const ifOperationWithField = (operation)=>{
|
|
888
|
+
return operation.field !== undefined;
|
|
889
|
+
};
|
|
890
|
+
const isNestedFilter = (operation)=>{
|
|
891
|
+
return operation.operator === 'nested';
|
|
892
|
+
};
|
|
893
|
+
const isIndexedFilterSetEmpty = (filters)=>Object.values(filters).every((filterSet)=>Object.keys(filterSet).length === 0);
|
|
894
|
+
const EmptyFilterSet = {
|
|
895
|
+
mode: 'and',
|
|
896
|
+
root: {}
|
|
897
|
+
};
|
|
898
|
+
|
|
852
899
|
const isOperationWithField = (operation)=>{
|
|
853
900
|
return operation?.field !== undefined;
|
|
854
901
|
};
|
|
@@ -1272,44 +1319,41 @@ const filterSetToOperation = (fs)=>{
|
|
|
1272
1319
|
}
|
|
1273
1320
|
};
|
|
1274
1321
|
};
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1322
|
+
/**
|
|
1323
|
+
* Constructs a nested operation object based on the provided field and leaf operand.
|
|
1324
|
+
* If the field does not contain a dot '.', it either assigns the field to the leaf operand (if applicable)
|
|
1325
|
+
* or returns the leaf operand as is. When the field contains dots, it splits the field into parts,
|
|
1326
|
+
* creates a "nested" operation for the root field, and recursively constructs the nested structure
|
|
1327
|
+
* for the remaining portion of the field.
|
|
1328
|
+
*
|
|
1329
|
+
* @param {string} field - The hierarchical field path, with segments separated by dots (e.g., "root.child").
|
|
1330
|
+
* @param {Operation} leafOperand - The operation to be nested within the specified path.
|
|
1331
|
+
* @param parentPath - The parent path of the current field. Guppy nested filters require a parent path.
|
|
1332
|
+
* @returns {Operation} A nested operation object that represents the structured path and operand.
|
|
1333
|
+
*/ const buildNestedFilterForOperation = (field, leafOperand, parentPath = undefined)=>{
|
|
1334
|
+
if (!field.includes('.')) {
|
|
1335
|
+
// at the end of the path
|
|
1336
|
+
if (ifOperationWithField(leafOperand)) {
|
|
1337
|
+
// update the field for operations with a field
|
|
1338
|
+
return {
|
|
1339
|
+
...leafOperand,
|
|
1340
|
+
field
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
return leafOperand;
|
|
1283
1344
|
}
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
return
|
|
1345
|
+
const splitFieldArray = field.split('.');
|
|
1346
|
+
const nextField = splitFieldArray.shift();
|
|
1347
|
+
if (!nextField) {
|
|
1348
|
+
console.warn('Invalid field path:', field);
|
|
1349
|
+
return leafOperand;
|
|
1289
1350
|
}
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
return typeof value === 'object' && value !== null && value.operator === 'and' && Array.isArray(value.operands);
|
|
1297
|
-
};
|
|
1298
|
-
/**
|
|
1299
|
-
* Type guard for Union or Intersection
|
|
1300
|
-
* @param o - operator to check
|
|
1301
|
-
* @category Filters
|
|
1302
|
-
*/ const isIntersectionOrUnion = (o)=>o.operator === 'and' || o.operator === 'or';
|
|
1303
|
-
const isOperandsType = (operation)=>{
|
|
1304
|
-
return operation?.operands !== undefined;
|
|
1305
|
-
};
|
|
1306
|
-
const isNestedFilter = (operation)=>{
|
|
1307
|
-
return operation.operator === 'nested';
|
|
1308
|
-
};
|
|
1309
|
-
const isIndexedFilterSetEmpty = (filters)=>Object.values(filters).every((filterSet)=>Object.keys(filterSet).length === 0);
|
|
1310
|
-
const EmptyFilterSet = {
|
|
1311
|
-
mode: 'and',
|
|
1312
|
-
root: {}
|
|
1351
|
+
const currentPath = parentPath ? `${parentPath}.${nextField}` : nextField;
|
|
1352
|
+
return {
|
|
1353
|
+
operator: 'nested',
|
|
1354
|
+
path: currentPath,
|
|
1355
|
+
operand: buildNestedFilterForOperation(splitFieldArray.join('.'), leafOperand, currentPath)
|
|
1356
|
+
};
|
|
1313
1357
|
};
|
|
1314
1358
|
|
|
1315
1359
|
const FieldNameOverrides = {};
|
|
@@ -1834,7 +1878,7 @@ const rootReducer = toolkit.combineReducers({
|
|
|
1834
1878
|
* @param {string} format
|
|
1835
1879
|
*/ async function jsonToFormat(json, format) {
|
|
1836
1880
|
if (Object.keys(FILE_DELIMITERS).includes(format)) {
|
|
1837
|
-
const flatJson =
|
|
1881
|
+
const flatJson = flattenJson(json);
|
|
1838
1882
|
const data = await conversion(flatJson, {
|
|
1839
1883
|
delimiter: FILE_DELIMITERS[format]
|
|
1840
1884
|
});
|
|
@@ -4966,7 +5010,7 @@ const { useGraphQLQuery } = graphQLAPI;
|
|
|
4966
5010
|
* @param endpoints - Resolver function which configures the query with
|
|
4967
5011
|
* type, filter, accessibility, fields, and sort arguments
|
|
4968
5012
|
* @returns: A guppy download API for fetching bulk metadata
|
|
4969
|
-
*/ const
|
|
5013
|
+
*/ const guppyDownloadApi = gen3Api.injectEndpoints({
|
|
4970
5014
|
endpoints: (builder)=>({
|
|
4971
5015
|
downloadFromGuppy: builder.query({
|
|
4972
5016
|
query: ({ type, filter, accessibility, fields, sort })=>{
|
|
@@ -4992,7 +5036,7 @@ const { useGraphQLQuery } = graphQLAPI;
|
|
|
4992
5036
|
})
|
|
4993
5037
|
})
|
|
4994
5038
|
});
|
|
4995
|
-
const { useDownloadFromGuppyQuery, useLazyDownloadFromGuppyQuery } =
|
|
5039
|
+
const { useDownloadFromGuppyQuery, useLazyDownloadFromGuppyQuery } = guppyDownloadApi;
|
|
4996
5040
|
|
|
4997
5041
|
const TAGS = 'manifest';
|
|
4998
5042
|
const manifestTags = gen3Api.enhanceEndpoints({
|
|
@@ -5827,6 +5871,8 @@ exports.EmptyFilterSet = EmptyFilterSet;
|
|
|
5827
5871
|
exports.EmptyWorkspaceStatusResponse = EmptyWorkspaceStatusResponse;
|
|
5828
5872
|
exports.EnumValueExtractorHandler = EnumValueExtractorHandler;
|
|
5829
5873
|
exports.ExtractValueFromObject = ExtractValueFromObject;
|
|
5874
|
+
exports.FILE_DELIMITERS = FILE_DELIMITERS;
|
|
5875
|
+
exports.FILE_FORMATS = FILE_FORMATS;
|
|
5830
5876
|
exports.GEN3_API = GEN3_API;
|
|
5831
5877
|
exports.GEN3_AUTHZ_API = GEN3_AUTHZ_API;
|
|
5832
5878
|
exports.GEN3_COMMONS_NAME = GEN3_COMMONS_NAME;
|
|
@@ -5858,6 +5904,7 @@ exports.appendFilterToOperation = appendFilterToOperation;
|
|
|
5858
5904
|
exports.buildGetAggregationQuery = buildGetAggregationQuery;
|
|
5859
5905
|
exports.buildGetStatsAggregationQuery = buildGetStatsAggregationQuery;
|
|
5860
5906
|
exports.buildListItemsGroupedByDataset = buildListItemsGroupedByDataset;
|
|
5907
|
+
exports.buildNestedFilterForOperation = buildNestedFilterForOperation;
|
|
5861
5908
|
exports.buildNestedGQLFilter = buildNestedGQLFilter;
|
|
5862
5909
|
exports.calculatePercentageAsNumber = calculatePercentageAsNumber;
|
|
5863
5910
|
exports.calculatePercentageAsString = calculatePercentageAsString;
|
|
@@ -5918,11 +5965,13 @@ exports.guppyAPISliceMiddleware = guppyAPISliceMiddleware;
|
|
|
5918
5965
|
exports.guppyApi = guppyApi;
|
|
5919
5966
|
exports.guppyApiReducer = guppyApiReducer;
|
|
5920
5967
|
exports.guppyApiSliceReducerPath = guppyApiSliceReducerPath;
|
|
5968
|
+
exports.guppyDownloadApi = guppyDownloadApi;
|
|
5921
5969
|
exports.handleGqlOperation = handleGqlOperation;
|
|
5922
5970
|
exports.handleOperation = handleOperation;
|
|
5923
5971
|
exports.hideModal = hideModal;
|
|
5924
5972
|
exports.histogramQueryStrForEachField = histogramQueryStrForEachField;
|
|
5925
5973
|
exports.humanify = humanify;
|
|
5974
|
+
exports.ifOperationWithField = ifOperationWithField;
|
|
5926
5975
|
exports.isAdditionalDataItem = isAdditionalDataItem;
|
|
5927
5976
|
exports.isArray = isArray;
|
|
5928
5977
|
exports.isAuthenticated = isAuthenticated;
|
|
@@ -5971,6 +6020,7 @@ exports.isTimeGreaterThan = isTimeGreaterThan;
|
|
|
5971
6020
|
exports.isUnion = isUnion;
|
|
5972
6021
|
exports.isWorkspaceActive = isWorkspaceActive;
|
|
5973
6022
|
exports.isWorkspaceRunningOrStopping = isWorkspaceRunningOrStopping;
|
|
6023
|
+
exports.jsonToFormat = jsonToFormat;
|
|
5974
6024
|
exports.listifyMethodsFromMapping = listifyMethodsFromMapping;
|
|
5975
6025
|
exports.logoutFence = logoutFence;
|
|
5976
6026
|
exports.manifestApi = manifestApi;
|