ag-common 0.0.806 → 0.0.808
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.
|
@@ -136,8 +136,7 @@ const queryDynamo = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
136
136
|
}
|
|
137
137
|
lastEvaluatedKey = result.LastEvaluatedKey;
|
|
138
138
|
// If limit is undefined, we stop after one query (default to single page).
|
|
139
|
-
|
|
140
|
-
if (params.limit === undefined || params.limit === null) {
|
|
139
|
+
if (params.limit === undefined) {
|
|
141
140
|
break;
|
|
142
141
|
}
|
|
143
142
|
// If limit is > 0 and we've reached it, stop processing
|
|
@@ -169,9 +168,8 @@ const scan = (tableName, options) => __awaiter(void 0, void 0, void 0, function*
|
|
|
169
168
|
if ((options === null || options === void 0 ? void 0 : options.limit) === undefined) {
|
|
170
169
|
break;
|
|
171
170
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
Items.length >= options.limit) {
|
|
171
|
+
const limit = options.limit;
|
|
172
|
+
if (limit > 0 && Items.length >= limit) {
|
|
175
173
|
return {
|
|
176
174
|
data: Items.slice(0, options.limit),
|
|
177
175
|
lastEvaluatedKey: ExclusiveStartKey,
|
|
@@ -245,7 +243,7 @@ const batchQueryDynamo = (params) => __awaiter(void 0, void 0, void 0, function*
|
|
|
245
243
|
allItems.push(...result.data);
|
|
246
244
|
totalProcessed += result.data.length;
|
|
247
245
|
// If we have a limit and we've reached it, stop processing
|
|
248
|
-
if (params.limit && totalProcessed >= params.limit) {
|
|
246
|
+
if (params.limit && params.limit > 0 && totalProcessed >= params.limit) {
|
|
249
247
|
return {
|
|
250
248
|
data: allItems.slice(0, params.limit),
|
|
251
249
|
};
|
|
@@ -305,7 +303,7 @@ const executePartiQLQuery = (params) => __awaiter(void 0, void 0, void 0, functi
|
|
|
305
303
|
}
|
|
306
304
|
nextToken = result.NextToken;
|
|
307
305
|
// If we have a limit and we've reached it, stop processing
|
|
308
|
-
if (params.limit && allItems.length >= params.limit) {
|
|
306
|
+
if (params.limit && params.limit > 0 && allItems.length >= params.limit) {
|
|
309
307
|
return {
|
|
310
308
|
data: allItems.slice(0, params.limit),
|
|
311
309
|
};
|
|
@@ -321,8 +319,10 @@ const executePartiQLQuery = (params) => __awaiter(void 0, void 0, void 0, functi
|
|
|
321
319
|
});
|
|
322
320
|
function queryWithGenerator(params) {
|
|
323
321
|
return __asyncGenerator(this, arguments, function* queryWithGenerator_1() {
|
|
324
|
-
|
|
325
|
-
|
|
322
|
+
let limit = undefined;
|
|
323
|
+
if (params.limit && params.limit !== -1) {
|
|
324
|
+
limit = params.limit;
|
|
325
|
+
}
|
|
326
326
|
let items = [];
|
|
327
327
|
let lastEvaluatedKey = params.exclusiveStartKey;
|
|
328
328
|
try {
|
|
@@ -333,12 +333,17 @@ function queryWithGenerator(params) {
|
|
|
333
333
|
// Process items in chunks of BATCH_SIZE
|
|
334
334
|
if (!limit) {
|
|
335
335
|
yield yield __await(items);
|
|
336
|
-
|
|
336
|
+
items = [];
|
|
337
|
+
if (params.limit !== -1) {
|
|
338
|
+
return yield __await(void 0);
|
|
339
|
+
}
|
|
337
340
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
341
|
+
else {
|
|
342
|
+
while (items.length >= limit) {
|
|
343
|
+
const batch = items.slice(0, limit);
|
|
344
|
+
items = items.slice(limit);
|
|
345
|
+
yield yield __await(batch);
|
|
346
|
+
}
|
|
342
347
|
}
|
|
343
348
|
}
|
|
344
349
|
lastEvaluatedKey = result.LastEvaluatedKey;
|
|
@@ -355,8 +360,10 @@ function queryWithGenerator(params) {
|
|
|
355
360
|
}
|
|
356
361
|
function scanWithGenerator(tableName, options) {
|
|
357
362
|
return __asyncGenerator(this, arguments, function* scanWithGenerator_1() {
|
|
358
|
-
|
|
359
|
-
|
|
363
|
+
let limit = undefined;
|
|
364
|
+
if ((options === null || options === void 0 ? void 0 : options.limit) && options.limit !== -1) {
|
|
365
|
+
limit = options.limit;
|
|
366
|
+
}
|
|
360
367
|
let items = [];
|
|
361
368
|
let exclusiveStartKey;
|
|
362
369
|
try {
|
|
@@ -367,12 +374,17 @@ function scanWithGenerator(tableName, options) {
|
|
|
367
374
|
// Process items in chunks of limit
|
|
368
375
|
if (!limit) {
|
|
369
376
|
yield yield __await(items);
|
|
370
|
-
|
|
377
|
+
items = [];
|
|
378
|
+
if ((options === null || options === void 0 ? void 0 : options.limit) !== -1) {
|
|
379
|
+
return yield __await(void 0);
|
|
380
|
+
}
|
|
371
381
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
382
|
+
else {
|
|
383
|
+
while (items.length >= limit) {
|
|
384
|
+
const batch = items.slice(0, limit);
|
|
385
|
+
items = items.slice(limit);
|
|
386
|
+
yield yield __await(batch);
|
|
387
|
+
}
|
|
376
388
|
}
|
|
377
389
|
}
|
|
378
390
|
exclusiveStartKey = result.LastEvaluatedKey;
|
|
@@ -94,6 +94,8 @@ const DarkModeAux = ({ iconSize = '2.5rem', className, mode, onSubmit, style, dm
|
|
|
94
94
|
const [index, setIndex] = (0, react_1.useState)(modes.findIndex((d) => d.mode === dm.darkmode));
|
|
95
95
|
const [fill, background] = getColours(modes[index].mode, mode === 'vert');
|
|
96
96
|
const twCalc = `calc(${iconSize} + ${iconSize} + ${iconSize} + 8px)`;
|
|
97
|
+
const width = mode === 'vert' ? `calc(${iconSize} + 8px)` : twCalc;
|
|
98
|
+
const height = mode === 'vert' ? twCalc : `calc(${iconSize} + 8px)`;
|
|
97
99
|
const setDarkmode = (newDarkMode) => {
|
|
98
100
|
let className = '';
|
|
99
101
|
if (newDarkMode === types_1.TDarkMode.dark) {
|
|
@@ -119,10 +121,8 @@ const DarkModeAux = ({ iconSize = '2.5rem', className, mode, onSubmit, style, dm
|
|
|
119
121
|
dm.setDarkmode(newDarkMode);
|
|
120
122
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(newDarkMode);
|
|
121
123
|
};
|
|
122
|
-
return (react_1.default.createElement("div", { className: (0, utils_1.cn)('flex flex-row overflow-hidden justify-between items-center rounded-4xl', 'data-[mode=vert]:flex-col', className), "data-mode": mode !== null && mode !== void 0 ? mode : 'horiz', style: Object.assign(Object.assign(
|
|
123
|
-
|
|
124
|
-
height: twCalc,
|
|
125
|
-
})) }, modes.map((v, i) => {
|
|
124
|
+
return (react_1.default.createElement("div", { className: (0, utils_1.cn)('flex flex-row overflow-hidden justify-between items-center rounded-4xl', 'border-2 border-solid p-[2px] box-border', 'data-[mode=vert]:flex-col', className), "data-mode": mode !== null && mode !== void 0 ? mode : 'horiz', style: Object.assign(Object.assign({}, style), { background, borderColor: fill, width,
|
|
125
|
+
height }) }, modes.map((v, i) => {
|
|
126
126
|
const selected = index === i;
|
|
127
127
|
return (react_1.default.createElement("div", { className: (0, utils_1.cn)('flex flex-col items-center justify-center rounded-full overflow-hidden cursor-pointer', 'data-[selected=true]:bg-white data-[selected=true]:cursor-default'), "data-selected": selected, style: { width: iconSize, height: iconSize },
|
|
128
128
|
// eslint-disable-next-line react/no-array-index-key
|
package/package.json
CHANGED