New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sankhyalabs/core

Package Overview
Dependencies
Maintainers
0
Versions
746
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sankhyalabs/core - npm Package Compare versions

Comparing version 0.0.0-hotfix-rc-KB-79342.1 to 0.0.0-hotfix-rc-KB-80782.0

22

.docs/classes/Change.md

@@ -35,3 +35,3 @@ [**@sankhyalabs/core**](../README.md) • **Docs**

src/dataunit/DataUnit.ts:1931
src/dataunit/DataUnit.ts:1952

@@ -46,3 +46,3 @@ ## Properties

src/dataunit/DataUnit.ts:1929
src/dataunit/DataUnit.ts:1950

@@ -57,3 +57,3 @@ ***

src/dataunit/DataUnit.ts:1924
src/dataunit/DataUnit.ts:1945

@@ -68,3 +68,3 @@ ***

src/dataunit/DataUnit.ts:1925
src/dataunit/DataUnit.ts:1946

@@ -79,3 +79,3 @@ ***

src/dataunit/DataUnit.ts:1926
src/dataunit/DataUnit.ts:1947

@@ -90,3 +90,3 @@ ***

src/dataunit/DataUnit.ts:1927
src/dataunit/DataUnit.ts:1948

@@ -109,3 +109,3 @@ ## Accessors

src/dataunit/DataUnit.ts:1946
src/dataunit/DataUnit.ts:1967

@@ -128,3 +128,3 @@ ## Methods

src/dataunit/DataUnit.ts:1968
src/dataunit/DataUnit.ts:1989

@@ -147,3 +147,3 @@ ***

src/dataunit/DataUnit.ts:1979
src/dataunit/DataUnit.ts:2000

@@ -166,3 +166,3 @@ ***

src/dataunit/DataUnit.ts:1957
src/dataunit/DataUnit.ts:1978

@@ -185,2 +185,2 @@ ***

src/dataunit/DataUnit.ts:1990
src/dataunit/DataUnit.ts:2011

@@ -339,3 +339,3 @@ [**@sankhyalabs/core**](../README.md) • **Docs**

src/dataunit/DataUnit.ts:1883
src/dataunit/DataUnit.ts:1904

@@ -508,3 +508,3 @@ ***

src/dataunit/DataUnit.ts:1864
src/dataunit/DataUnit.ts:1885

@@ -599,3 +599,3 @@ ***

src/dataunit/DataUnit.ts:1873
src/dataunit/DataUnit.ts:1894

@@ -642,3 +642,3 @@ ***

src/dataunit/DataUnit.ts:1855
src/dataunit/DataUnit.ts:1876

@@ -699,3 +699,3 @@ ***

src/dataunit/DataUnit.ts:1487
src/dataunit/DataUnit.ts:1505

@@ -718,3 +718,3 @@ ***

src/dataunit/DataUnit.ts:1476
src/dataunit/DataUnit.ts:1494

@@ -745,3 +745,3 @@ ***

src/dataunit/DataUnit.ts:1329
src/dataunit/DataUnit.ts:1347

@@ -786,3 +786,3 @@ ***

src/dataunit/DataUnit.ts:1372
src/dataunit/DataUnit.ts:1390

@@ -803,3 +803,3 @@ ***

src/dataunit/DataUnit.ts:1262
src/dataunit/DataUnit.ts:1280

@@ -896,3 +896,3 @@ ***

src/dataunit/DataUnit.ts:1761
src/dataunit/DataUnit.ts:1782

@@ -931,3 +931,3 @@ ***

src/dataunit/DataUnit.ts:1537
src/dataunit/DataUnit.ts:1555

@@ -956,3 +956,3 @@ ***

src/dataunit/DataUnit.ts:1585
src/dataunit/DataUnit.ts:1603

@@ -979,3 +979,3 @@ ***

src/dataunit/DataUnit.ts:1746
src/dataunit/DataUnit.ts:1767

@@ -1068,3 +1068,3 @@ ***

src/dataunit/DataUnit.ts:1735
src/dataunit/DataUnit.ts:1756

@@ -1105,3 +1105,3 @@ ***

src/dataunit/DataUnit.ts:1605
src/dataunit/DataUnit.ts:1623

@@ -1220,3 +1220,3 @@ ***

src/dataunit/DataUnit.ts:1706
src/dataunit/DataUnit.ts:1727

@@ -1314,3 +1314,3 @@ ***

src/dataunit/DataUnit.ts:1724
src/dataunit/DataUnit.ts:1745

@@ -1389,3 +1389,3 @@ ***

src/dataunit/DataUnit.ts:1252
src/dataunit/DataUnit.ts:1270

@@ -1440,3 +1440,3 @@ ***

src/dataunit/DataUnit.ts:1243
src/dataunit/DataUnit.ts:1261

@@ -1465,3 +1465,3 @@ ***

src/dataunit/DataUnit.ts:1812
src/dataunit/DataUnit.ts:1833

@@ -1490,3 +1490,3 @@ ***

src/dataunit/DataUnit.ts:1836
src/dataunit/DataUnit.ts:1857

@@ -1509,3 +1509,3 @@ ***

src/dataunit/DataUnit.ts:1224
src/dataunit/DataUnit.ts:1242

@@ -1528,3 +1528,3 @@ ***

src/dataunit/DataUnit.ts:1695
src/dataunit/DataUnit.ts:1716

@@ -1575,3 +1575,3 @@ ***

src/dataunit/DataUnit.ts:1456
src/dataunit/DataUnit.ts:1474

@@ -1594,3 +1594,3 @@ ***

src/dataunit/DataUnit.ts:1386
src/dataunit/DataUnit.ts:1404

@@ -1613,3 +1613,3 @@ ***

src/dataunit/DataUnit.ts:1444
src/dataunit/DataUnit.ts:1462

@@ -1632,3 +1632,3 @@ ***

src/dataunit/DataUnit.ts:1397
src/dataunit/DataUnit.ts:1415

@@ -1651,3 +1651,3 @@ ***

src/dataunit/DataUnit.ts:1412
src/dataunit/DataUnit.ts:1430

@@ -1694,3 +1694,3 @@ ***

src/dataunit/DataUnit.ts:1776
src/dataunit/DataUnit.ts:1797

@@ -1723,3 +1723,3 @@ ***

src/dataunit/DataUnit.ts:1568
src/dataunit/DataUnit.ts:1586

@@ -1746,3 +1746,3 @@ ***

src/dataunit/DataUnit.ts:1348
src/dataunit/DataUnit.ts:1366

@@ -1771,3 +1771,3 @@ ***

src/dataunit/DataUnit.ts:1428
src/dataunit/DataUnit.ts:1446

@@ -1790,3 +1790,3 @@ ***

src/dataunit/DataUnit.ts:1361
src/dataunit/DataUnit.ts:1379

@@ -1931,3 +1931,3 @@ ***

src/dataunit/DataUnit.ts:1274
src/dataunit/DataUnit.ts:1292

@@ -2016,3 +2016,3 @@ ***

src/dataunit/DataUnit.ts:1301
src/dataunit/DataUnit.ts:1319

@@ -2031,3 +2031,3 @@ ***

src/dataunit/DataUnit.ts:1887
src/dataunit/DataUnit.ts:1908

@@ -2054,3 +2054,3 @@ ***

src/dataunit/DataUnit.ts:1510
src/dataunit/DataUnit.ts:1528

@@ -2112,3 +2112,3 @@ ***

src/dataunit/DataUnit.ts:1667
src/dataunit/DataUnit.ts:1685

@@ -2135,3 +2135,3 @@ ***

src/dataunit/DataUnit.ts:1618
src/dataunit/DataUnit.ts:1636

@@ -2318,2 +2318,20 @@ ***

### selectAllRecords()
> **selectAllRecords**(): `Promise`\<`undefined` \| [`SelectionInfo`](SelectionInfo.md)\>
Seleciona todos os registros da página.
#### Returns
`Promise`\<`undefined` \| [`SelectionInfo`](SelectionInfo.md)\>
- Informações sobre a seleção.
#### Source
src/dataunit/DataUnit.ts:1222
***
### selectFirst()

@@ -2519,3 +2537,3 @@

src/dataunit/DataUnit.ts:1792
src/dataunit/DataUnit.ts:1813

@@ -2573,3 +2591,3 @@ ***

src/dataunit/DataUnit.ts:1630
src/dataunit/DataUnit.ts:1648

@@ -2592,6 +2610,24 @@ ***

src/dataunit/DataUnit.ts:1521
src/dataunit/DataUnit.ts:1539
***
### unSelectAllRecords()
> **unSelectAllRecords**(): `Promise`\<`undefined` \| [`SelectionInfo`](SelectionInfo.md)\>
Desseleciona todos os registros da página.
#### Returns
`Promise`\<`undefined` \| [`SelectionInfo`](SelectionInfo.md)\>
- Informações sobre a seleção.
#### Source
src/dataunit/DataUnit.ts:1231
***
### undo()

@@ -2615,3 +2651,3 @@

src/dataunit/DataUnit.ts:1499
src/dataunit/DataUnit.ts:1517

@@ -2642,3 +2678,3 @@ ***

src/dataunit/DataUnit.ts:1648
src/dataunit/DataUnit.ts:1666

@@ -2671,6 +2707,24 @@ ***

src/dataunit/DataUnit.ts:1191
src/dataunit/DataUnit.ts:1190
***
### updatePageSelectionAll()
> `private` **updatePageSelectionAll**(`addRecords`): `Promise`\<`undefined` \| [`SelectionInfo`](SelectionInfo.md)\>
#### Parameters
• **addRecords**: `boolean`
#### Returns
`Promise`\<`undefined` \| [`SelectionInfo`](SelectionInfo.md)\>
#### Source
src/dataunit/DataUnit.ts:1202
***
### updatePagination()

@@ -2677,0 +2731,0 @@

@@ -33,3 +33,3 @@ [**@sankhyalabs/core**](../README.md) • **Docs**

src/dataunit/DataUnit.ts:2035
src/dataunit/DataUnit.ts:2056

@@ -44,3 +44,3 @@ ## Properties

src/dataunit/DataUnit.ts:2032
src/dataunit/DataUnit.ts:2053

@@ -55,3 +55,3 @@ ***

src/dataunit/DataUnit.ts:2033
src/dataunit/DataUnit.ts:2054

@@ -66,3 +66,3 @@ ***

src/dataunit/DataUnit.ts:2029
src/dataunit/DataUnit.ts:2050

@@ -81,3 +81,3 @@ ***

src/dataunit/DataUnit.ts:2031
src/dataunit/DataUnit.ts:2052

@@ -92,3 +92,3 @@ ***

src/dataunit/DataUnit.ts:2028
src/dataunit/DataUnit.ts:2049

@@ -103,3 +103,3 @@ ***

src/dataunit/DataUnit.ts:2030
src/dataunit/DataUnit.ts:2051

@@ -118,3 +118,3 @@ ## Accessors

src/dataunit/DataUnit.ts:2063
src/dataunit/DataUnit.ts:2084

@@ -133,3 +133,3 @@ ***

src/dataunit/DataUnit.ts:2053
src/dataunit/DataUnit.ts:2074

@@ -148,3 +148,3 @@ ***

src/dataunit/DataUnit.ts:2043
src/dataunit/DataUnit.ts:2064

@@ -163,3 +163,3 @@ ## Methods

src/dataunit/DataUnit.ts:2070
src/dataunit/DataUnit.ts:2091

@@ -178,2 +178,2 @@ ***

src/dataunit/DataUnit.ts:2074
src/dataunit/DataUnit.ts:2095

@@ -17,3 +17,3 @@ [**@sankhyalabs/core**](../README.md) • **Docs**

src/dataunit/DataUnit.ts:1914
src/dataunit/DataUnit.ts:1935

@@ -28,3 +28,3 @@ ***

src/dataunit/DataUnit.ts:1916
src/dataunit/DataUnit.ts:1937

@@ -39,3 +39,3 @@ ***

src/dataunit/DataUnit.ts:1913
src/dataunit/DataUnit.ts:1934

@@ -50,2 +50,2 @@ ***

src/dataunit/DataUnit.ts:1915
src/dataunit/DataUnit.ts:1936

@@ -17,3 +17,3 @@ [**@sankhyalabs/core**](../README.md) • **Docs**

src/dataunit/DataUnit.ts:2022
src/dataunit/DataUnit.ts:2043

@@ -28,2 +28,2 @@ ***

src/dataunit/DataUnit.ts:2023
src/dataunit/DataUnit.ts:2044

@@ -25,2 +25,2 @@ [**@sankhyalabs/core**](../README.md) • **Docs**

src/dataunit/DataUnit.ts:1897
src/dataunit/DataUnit.ts:1918

@@ -17,3 +17,3 @@ [**@sankhyalabs/core**](../README.md) • **Docs**

src/dataunit/DataUnit.ts:2002
src/dataunit/DataUnit.ts:2023

@@ -28,3 +28,3 @@ ***

src/dataunit/DataUnit.ts:2003
src/dataunit/DataUnit.ts:2024

@@ -39,2 +39,2 @@ ***

src/dataunit/DataUnit.ts:2004
src/dataunit/DataUnit.ts:2025

@@ -17,3 +17,3 @@ [**@sankhyalabs/core**](../README.md) • **Docs**

src/dataunit/DataUnit.ts:2009
src/dataunit/DataUnit.ts:2030

@@ -28,3 +28,3 @@ ***

src/dataunit/DataUnit.ts:2010
src/dataunit/DataUnit.ts:2031

@@ -39,2 +39,2 @@ ***

src/dataunit/DataUnit.ts:2008
src/dataunit/DataUnit.ts:2029

@@ -25,3 +25,3 @@ [**@sankhyalabs/core**](../README.md) • **Docs**

src/dataunit/DataUnit.ts:1904
src/dataunit/DataUnit.ts:1925

@@ -36,3 +36,3 @@ ***

src/dataunit/DataUnit.ts:1903
src/dataunit/DataUnit.ts:1924

@@ -47,3 +47,3 @@ ***

src/dataunit/DataUnit.ts:1901
src/dataunit/DataUnit.ts:1922

@@ -58,2 +58,2 @@ ***

src/dataunit/DataUnit.ts:1902
src/dataunit/DataUnit.ts:1923

@@ -21,3 +21,3 @@ [**@sankhyalabs/core**](../README.md) • **Docs**

src/dataunit/DataUnit.ts:1909
src/dataunit/DataUnit.ts:1930

@@ -36,3 +36,3 @@ ***

src/dataunit/DataUnit.ts:1904
src/dataunit/DataUnit.ts:1925

@@ -51,3 +51,3 @@ ***

src/dataunit/DataUnit.ts:1903
src/dataunit/DataUnit.ts:1924

@@ -66,3 +66,3 @@ ***

src/dataunit/DataUnit.ts:1901
src/dataunit/DataUnit.ts:1922

@@ -81,2 +81,2 @@ ***

src/dataunit/DataUnit.ts:1902
src/dataunit/DataUnit.ts:1923

@@ -17,3 +17,3 @@ [**@sankhyalabs/core**](../README.md) • **Docs**

src/dataunit/DataUnit.ts:1997
src/dataunit/DataUnit.ts:2018

@@ -28,3 +28,3 @@ ***

src/dataunit/DataUnit.ts:1998
src/dataunit/DataUnit.ts:2019

@@ -39,2 +39,2 @@ ***

src/dataunit/DataUnit.ts:1996
src/dataunit/DataUnit.ts:2017

@@ -17,2 +17,2 @@ [**@sankhyalabs/core**](../README.md) • **Docs**

src/dataunit/DataUnit.ts:2079
src/dataunit/DataUnit.ts:2100

@@ -574,8 +574,20 @@ import { ChildDescriptor, FieldDescriptor, Filter, FilterProvider, Sort, SortingProvider, UnitMetadata } from "./metadata/UnitMetadata.js";

* @param executionCtx - Contexto de execução da seleção dos registros do DataUnit.
*
* @returns - Informações sobre a seleção.
*/
updatePageSelection(selection: Array<string>, executionCtx?: ExecutionContext): Promise<SelectionInfo | undefined>;
private updatePageSelectionAll;
/**
* Seleciona todos os registros da página.
*
* @returns - Informações sobre a seleção.
*/
selectAllRecords(): Promise<SelectionInfo | undefined>;
/**
* Desseleciona todos os registros da página.
*
* @returns - Informações sobre a seleção.
*/
unSelectAllRecords(): Promise<SelectionInfo | undefined>;
/**
*
* Obtém informações sobre a seleção atual.

@@ -582,0 +594,0 @@ *

import DateUtils from '../../utils/DateUtils.js';
import { MaskFormatter } from '../../utils/MaskFormatter.js';
import { NumberUtils } from '../../utils/NumberUtils.js';
import { TimeFormatter } from '../../utils/TimeFormatter.js';
import { DataType, toString } from '../metadata/DataType.js';

@@ -33,2 +34,5 @@ import { UserInterface } from '../metadata/UnitMetadata.js';

}
if ((descriptor === null || descriptor === void 0 ? void 0 : descriptor.userInterface) === UserInterface.ELAPSEDTIME) {
return TimeFormatter.prepareValue(value, true);
}
if ((descriptor === null || descriptor === void 0 ? void 0 : descriptor.userInterface) === UserInterface.DATETIME) {

@@ -35,0 +39,0 @@ return DateUtils.formatDateTime(value);

@@ -15,2 +15,4 @@ import { Action } from "../action/DataUnitAction.js";

return Object.assign(Object.assign({}, currentState), { paginationInfo: action.payload });
case Action.DATA_SAVED:
return Object.assign(Object.assign({}, currentState), { paginationInfo: updatePaginationInfo(stateManager, action.payload) });
}

@@ -48,2 +50,16 @@ return currentState;

};
const updatePaginationInfo = (stateManager, payload) => {
const paginationInfo = getPaginationInfo(stateManager);
let { records, changes } = payload;
if (!records || !changes || !paginationInfo || !validateNewRecordOperation(changes))
return paginationInfo;
const { count, firstRecord, lastRecord, total } = paginationInfo;
return Object.assign(Object.assign({}, paginationInfo), { count: (count !== null && count !== void 0 ? count : 0) + records.length, firstRecord: firstRecord === 0 && records.length > 0 ? 1 : firstRecord, lastRecord: lastRecord + records.length, total: (total !== null && total !== void 0 ? total : 0) + records.length });
};
const validateNewRecordOperation = (changes) => {
return changes.every(change => isNewRecordOperation(change._operation));
};
const isNewRecordOperation = (operation) => {
return ["INSERT", "COPY"].includes(operation);
};
//# sourceMappingURL=LoadingControlSlice.js.map

@@ -48,2 +48,2 @@ import { StringUtils } from "./utils/StringUtils.js";

import { LockManager, LockManagerOperation } from "./utils/LockManager.js";
export { LockManager, LockManagerOperation, StringUtils, MaskFormatter, NumberUtils, FloatingManager, DateUtils, ArrayUtils, TimeFormatter, SkwHttpProvider, HttpProvider, RequestMetadata, AuthorizedServiceCaller, DataUnit, DataUnitStorage, Record, SavedRecord, DataType, UnitMetadata, FieldDescriptor, UserInterface, DependencyType, ChildDescriptor, ChildLink, DataUnitAction, Action, Change, Sort, Filter, ChangeOperation, DUActionInterceptor, ApplicationContext, WaitingChange, PageRequest, QuickFilter, ReadyUtil, ObjectUtils, WarningException, WaitingChangeException, ErrorException, ErrorTracking, ExecutionContext, PaginationInfo, SortingProvider, SortMode, LoadDataRequest, LoadDataResponse, SelectionInfo, SelectionMode, ElementIDUtils, IElementIDInfo, UserAgentUtils, JSUtils, VersionUtils, OnboardingUtils, PromiseSync, PromiseSyncCallback, HTMLBuilder, IRepository, IDBRepository, ILoadResult, IRepositoryIndex, FieldComparator, defaultDataLoader, KeyboardManager, SearchUtils, ServiceUtils, StorageType, OverflowWatcher, OnOverflowCallBack, OverflowDirection, OverFlowWatcherParams, OVERFLOWED_CLASS_NAME, DataUnitEventOptions, ServiceCanceledException, SilentException, };
export { LockManager, LockManagerOperation, StringUtils, MaskFormatter, NumberUtils, FloatingManager, DateUtils, ArrayUtils, TimeFormatter, SkwHttpProvider, HttpProvider, RequestMetadata, AuthorizedServiceCaller, DataUnit, DataUnitStorage, Record, SavedRecord, DataType, UnitMetadata, FieldDescriptor, UserInterface, DependencyType, ChildDescriptor, ChildLink, DataUnitAction, Action, Change, Sort, Filter, ChangeOperation, DUActionInterceptor, ApplicationContext, WaitingChange, PageRequest, QuickFilter, ReadyUtil, ObjectUtils, WarningException, WaitingChangeException, ErrorException, ErrorTracking, ExecutionContext, PaginationInfo, SortingProvider, SortMode, LoadDataRequest, LoadDataResponse, SelectionInfo, SelectionMode, ElementIDUtils, IElementIDInfo, UserAgentUtils, JSUtils, VersionUtils, OnboardingUtils, PromiseSync, PromiseSyncCallback, HTMLBuilder, IRepository, IDBRepository, ILoadResult, IRepositoryIndex, FieldComparator, defaultDataLoader, KeyboardManager, SearchUtils, ServiceUtils, StorageType, OverflowWatcher, OnOverflowCallBack, OverflowDirection, OverFlowWatcherParams, OVERFLOWED_CLASS_NAME, DataUnitEventOptions, ServiceCanceledException, SilentException };

@@ -43,3 +43,3 @@ import { StringUtils } from "./utils/StringUtils.js";

/*Classes públicas no pacote*/
export { LockManager, LockManagerOperation, StringUtils, MaskFormatter, NumberUtils, FloatingManager, DateUtils, ArrayUtils, TimeFormatter, SkwHttpProvider, HttpProvider, RequestMetadata, AuthorizedServiceCaller, DataUnit, DataUnitStorage, DataType, UserInterface, DependencyType, DataUnitAction, Action, Change, ChangeOperation, ApplicationContext, ReadyUtil, ObjectUtils, WarningException, WaitingChangeException, ErrorException, ErrorTracking, SortMode, SelectionInfo, SelectionMode, ElementIDUtils, UserAgentUtils, JSUtils, VersionUtils, OnboardingUtils, PromiseSync, HTMLBuilder, IDBRepository, FieldComparator, defaultDataLoader, KeyboardManager, SearchUtils, ServiceUtils, StorageType, OverflowWatcher, OverflowDirection, OVERFLOWED_CLASS_NAME, ServiceCanceledException, SilentException, };
export { LockManager, LockManagerOperation, StringUtils, MaskFormatter, NumberUtils, FloatingManager, DateUtils, ArrayUtils, TimeFormatter, SkwHttpProvider, HttpProvider, RequestMetadata, AuthorizedServiceCaller, DataUnit, DataUnitStorage, DataType, UserInterface, DependencyType, DataUnitAction, Action, Change, ChangeOperation, ApplicationContext, ReadyUtil, ObjectUtils, WarningException, WaitingChangeException, ErrorException, ErrorTracking, SortMode, SelectionInfo, SelectionMode, ElementIDUtils, UserAgentUtils, JSUtils, VersionUtils, OnboardingUtils, PromiseSync, HTMLBuilder, IDBRepository, FieldComparator, defaultDataLoader, KeyboardManager, SearchUtils, ServiceUtils, StorageType, OverflowWatcher, OverflowDirection, OVERFLOWED_CLASS_NAME, ServiceCanceledException, SilentException };
//# sourceMappingURL=index.js.map
{
"name": "@sankhyalabs/core",
"version": "0.0.0-hotfix-rc-KB-79342.1",
"version": "0.0.0-hotfix-rc-KB-80782.0",
"description": "Modulo core JavaScript da Sankhya.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

import DateUtils from '../../utils/DateUtils.js';
import { MaskFormatter } from '../../utils/MaskFormatter.js';
import { NumberUtils } from '../../utils/NumberUtils.js';
import { TimeFormatter } from '../../utils/TimeFormatter.js';
import { DataType, toString } from '../metadata/DataType.js';

@@ -42,2 +43,6 @@ import { FieldDescriptor, UserInterface } from '../metadata/UnitMetadata.js';

if(descriptor?.userInterface === UserInterface.ELAPSEDTIME){
return TimeFormatter.prepareValue(value, true);
}
if(descriptor?.userInterface === UserInterface.DATETIME){

@@ -44,0 +49,0 @@ return DateUtils.formatDateTime(value);

import { ChangeOperation } from "../../DataUnit.js";
import { LoadDataRequest } from "../../loading/LoadDataRequest.js";

@@ -19,2 +20,5 @@ import { PaginationInfo } from "../../loading/PaginationInfo.js";

return {...currentState, paginationInfo: action.payload};
case Action.DATA_SAVED:
return {...currentState, paginationInfo: updatePaginationInfo(stateManager, action.payload)};
}

@@ -60,5 +64,43 @@ return currentState;

const updatePaginationInfo = (stateManager: StateManager, payload: Payload): PaginationInfo =>{
const paginationInfo = getPaginationInfo(stateManager);
let { records, changes } = payload;
if(!records || !changes || !paginationInfo || !validateNewRecordOperation(changes)) return paginationInfo as PaginationInfo;
const { count, firstRecord, lastRecord, total } = paginationInfo;
return {
...paginationInfo,
count: (count ?? 0) + records.length,
firstRecord: firstRecord === 0 && records.length > 0 ? 1 : firstRecord,
lastRecord: lastRecord + records.length,
total: (total ?? 0) + records.length
}
}
const validateNewRecordOperation = (changes: Array<Change>): boolean => {
return changes.every(change => isNewRecordOperation(change._operation));
};
const isNewRecordOperation = (operation: string): operation is ChangeOperation => {
return ["INSERT", "COPY"].includes(operation);
};
interface LoadingControlState{
lastRequest: LoadDataRequest;
paginationInfo: PaginationInfo;
}
interface Change {
dataUnit: string;
record: Record<string, any>;
updatingFields: Record<string, any>;
_operation: string;
}
interface Payload {
changes: Change[];
records: Record<string, any>[];
}

@@ -126,3 +126,3 @@ import { StringUtils } from "./utils/StringUtils.js";

ServiceCanceledException,
SilentException,
SilentException
};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc