@servicetitan/data-query 32.4.0 → 32.5.0
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/data-source/async-data-source.d.ts +1 -1
- package/dist/data-source/async-data-source.d.ts.map +1 -1
- package/dist/data-source/async-data-source.js.map +1 -1
- package/dist/data-source/in-memory-data-source.d.ts +1 -1
- package/dist/data-source/in-memory-data-source.d.ts.map +1 -1
- package/dist/data-source/in-memory-data-source.js.map +1 -1
- package/dist/data-source/index.d.ts +1 -1
- package/dist/data-source/index.d.ts.map +1 -1
- package/dist/data-source/index.js +0 -1
- package/dist/data-source/index.js.map +1 -1
- package/dist/index.d.ts +18 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/data-source/async-data-source.ts +1 -1
- package/src/data-source/in-memory-data-source.ts +1 -1
- package/src/data-source/index.ts +1 -1
- package/src/index.ts +18 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { State } from '../state';
|
|
2
2
|
import { DataResult } from '../data-result.interface';
|
|
3
3
|
import { CancelToken } from 'axios';
|
|
4
|
-
import { DataSource, IdType } from './data-source';
|
|
4
|
+
import type { DataSource, IdType } from './data-source';
|
|
5
5
|
interface Operations<T, TId> {
|
|
6
6
|
get(state: State, cancelToken?: CancelToken): Promise<DataResult<T>>;
|
|
7
7
|
add?(item: T, index?: number): Promise<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-data-source.d.ts","sourceRoot":"","sources":["../../src/data-source/async-data-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAc,EAAE,WAAW,EAAqB,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;
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AG,EAAE,SAAS,CAAC,EAAE,OAAO;IAMvF,OAAO,CAAC,KAAK,EAAE,KAAK;IAkBpB,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM;IAY9B,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAUvC,UAAU,CAAC,EAAE,EAAE,GAAG;CAW3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data-source/async-data-source.ts"],"sourcesContent":["import { State } from '../state';\nimport { DataResult } from '../data-result.interface';\nimport axios, { CancelToken, CancelTokenSource } from 'axios';\nimport { DataSource, IdType } from './data-source';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { toJS, comparer } from 'mobx';\n\ninterface Operations<T, TId> {\n get(state: State, cancelToken?: CancelToken): Promise<DataResult<T>>;\n add?(item: T, index?: number): Promise<T>;\n update?(id: TId, changes: Partial<T>): Promise<void>;\n remove?(id: TId): Promise<T | undefined>;\n}\n\nexport class AsyncDataSource<T, TId extends IdType = never> implements DataSource<T, TId> {\n idSelector?: (row: T) => TId;\n\n private operations: Operations<T, TId>;\n\n private withCache?: boolean;\n private cached?: {\n state: State;\n result: DataResult<T>;\n };\n\n private cancelation?: CancelTokenSource;\n\n constructor(operations: Operations<T, TId>, idSelector?: (row: T) => TId, withCache?: boolean) {\n this.operations = operations;\n this.idSelector = idSelector;\n this.withCache = withCache;\n }\n\n async getData(state: State) {\n if (this.cancelation) {\n this.cancelation.cancel();\n }\n\n if (this.withCache && this.cached && comparer.structural(this.cached.state, state)) {\n return cloneDeep(this.cached.result);\n }\n\n this.cancelation = axios.CancelToken.source();\n const result = toJS(await this.operations.get(state, this.cancelation.token));\n this.cancelation = undefined;\n\n this.cached = { state, result };\n\n return cloneDeep(result);\n }\n\n async addData(row: T, index?: number) {\n if (!this.operations.add) {\n throw 'missing add function in the operations';\n }\n\n const result = await this.operations.add(row, index);\n\n this.cached = undefined;\n\n return result;\n }\n\n async updateData(id: TId, changes: Partial<T>) {\n if (!this.operations.update) {\n throw 'missing update function in the operations';\n }\n\n await this.operations.update(id, changes);\n\n this.cached = undefined;\n }\n\n async removeData(id: TId) {\n if (!this.operations.remove) {\n throw 'missing remove function in the operations';\n }\n\n const result = await this.operations.remove(id);\n\n this.cached = undefined;\n\n return result;\n }\n}\n"],"names":["axios","cloneDeep","toJS","comparer","AsyncDataSource","getData","state","cancelation","cancel","withCache","cached","structural","result","CancelToken","source","operations","get","token","undefined","addData","row","index","add","updateData","id","changes","update","removeData","remove","idSelector"],"mappings":";;;;;;;;;;;;;AAEA,OAAOA,WAA+C,QAAQ;AAE9D,OAAOC,eAAe,mBAAmB;AACzC,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AAStC,OAAO,MAAMC;IAmBT,MAAMC,QAAQC,KAAY,EAAE;QACxB,IAAI,IAAI,CAACC,WAAW,EAAE;YAClB,IAAI,CAACA,WAAW,CAACC,MAAM;QAC3B;QAEA,IAAI,IAAI,CAACC,SAAS,IAAI,IAAI,CAACC,MAAM,IAAIP,SAASQ,UAAU,CAAC,IAAI,CAACD,MAAM,CAACJ,KAAK,EAAEA,QAAQ;YAChF,OAAOL,UAAU,IAAI,CAACS,MAAM,CAACE,MAAM;QACvC;QAEA,IAAI,CAACL,WAAW,GAAGP,MAAMa,WAAW,CAACC,MAAM;QAC3C,MAAMF,SAASV,KAAK,MAAM,IAAI,CAACa,UAAU,CAACC,GAAG,CAACV,OAAO,IAAI,CAACC,WAAW,CAACU,KAAK;QAC3E,IAAI,CAACV,WAAW,GAAGW;QAEnB,IAAI,CAACR,MAAM,GAAG;YAAEJ;YAAOM;QAAO;QAE9B,OAAOX,UAAUW;IACrB;IAEA,MAAMO,QAAQC,GAAM,EAAEC,KAAc,EAAE;QAClC,IAAI,CAAC,IAAI,CAACN,UAAU,CAACO,GAAG,EAAE;YACtB,MAAM;QACV;QAEA,MAAMV,SAAS,MAAM,IAAI,CAACG,UAAU,CAACO,GAAG,CAACF,KAAKC;QAE9C,IAAI,CAACX,MAAM,GAAGQ;QAEd,OAAON;IACX;IAEA,MAAMW,WAAWC,EAAO,EAAEC,OAAmB,EAAE;QAC3C,IAAI,CAAC,IAAI,CAACV,UAAU,CAACW,MAAM,EAAE;YACzB,MAAM;QACV;QAEA,MAAM,IAAI,CAACX,UAAU,CAACW,MAAM,CAACF,IAAIC;QAEjC,IAAI,CAACf,MAAM,GAAGQ;IAClB;IAEA,MAAMS,WAAWH,EAAO,EAAE;QACtB,IAAI,CAAC,IAAI,CAACT,UAAU,CAACa,MAAM,EAAE;YACzB,MAAM;QACV;QAEA,MAAMhB,SAAS,MAAM,IAAI,CAACG,UAAU,CAACa,MAAM,CAACJ;QAE5C,IAAI,CAACd,MAAM,GAAGQ;QAEd,OAAON;IACX;IAxDA,YAAYG,UAA8B,EAAEc,UAA4B,EAAEpB,SAAmB,CAAE;QAZ/FoB,uBAAAA,cAAAA,KAAAA;QAEA,uBAAQd,cAAR,KAAA;QAEA,uBAAQN,aAAR,KAAA;QACA,uBAAQC,UAAR,KAAA;QAKA,uBAAQH,eAAR,KAAA;QAGI,IAAI,CAACQ,UAAU,GAAGA;QAClB,IAAI,CAACc,UAAU,GAAGA;QAClB,IAAI,CAACpB,SAAS,GAAGA;IACrB;AAqDJ"}
|
|
1
|
+
{"version":3,"sources":["../../src/data-source/async-data-source.ts"],"sourcesContent":["import { State } from '../state';\nimport { DataResult } from '../data-result.interface';\nimport axios, { CancelToken, CancelTokenSource } from 'axios';\nimport type { DataSource, IdType } from './data-source';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { toJS, comparer } from 'mobx';\n\ninterface Operations<T, TId> {\n get(state: State, cancelToken?: CancelToken): Promise<DataResult<T>>;\n add?(item: T, index?: number): Promise<T>;\n update?(id: TId, changes: Partial<T>): Promise<void>;\n remove?(id: TId): Promise<T | undefined>;\n}\n\nexport class AsyncDataSource<T, TId extends IdType = never> implements DataSource<T, TId> {\n idSelector?: (row: T) => TId;\n\n private operations: Operations<T, TId>;\n\n private withCache?: boolean;\n private cached?: {\n state: State;\n result: DataResult<T>;\n };\n\n private cancelation?: CancelTokenSource;\n\n constructor(operations: Operations<T, TId>, idSelector?: (row: T) => TId, withCache?: boolean) {\n this.operations = operations;\n this.idSelector = idSelector;\n this.withCache = withCache;\n }\n\n async getData(state: State) {\n if (this.cancelation) {\n this.cancelation.cancel();\n }\n\n if (this.withCache && this.cached && comparer.structural(this.cached.state, state)) {\n return cloneDeep(this.cached.result);\n }\n\n this.cancelation = axios.CancelToken.source();\n const result = toJS(await this.operations.get(state, this.cancelation.token));\n this.cancelation = undefined;\n\n this.cached = { state, result };\n\n return cloneDeep(result);\n }\n\n async addData(row: T, index?: number) {\n if (!this.operations.add) {\n throw 'missing add function in the operations';\n }\n\n const result = await this.operations.add(row, index);\n\n this.cached = undefined;\n\n return result;\n }\n\n async updateData(id: TId, changes: Partial<T>) {\n if (!this.operations.update) {\n throw 'missing update function in the operations';\n }\n\n await this.operations.update(id, changes);\n\n this.cached = undefined;\n }\n\n async removeData(id: TId) {\n if (!this.operations.remove) {\n throw 'missing remove function in the operations';\n }\n\n const result = await this.operations.remove(id);\n\n this.cached = undefined;\n\n return result;\n }\n}\n"],"names":["axios","cloneDeep","toJS","comparer","AsyncDataSource","getData","state","cancelation","cancel","withCache","cached","structural","result","CancelToken","source","operations","get","token","undefined","addData","row","index","add","updateData","id","changes","update","removeData","remove","idSelector"],"mappings":";;;;;;;;;;;;;AAEA,OAAOA,WAA+C,QAAQ;AAE9D,OAAOC,eAAe,mBAAmB;AACzC,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AAStC,OAAO,MAAMC;IAmBT,MAAMC,QAAQC,KAAY,EAAE;QACxB,IAAI,IAAI,CAACC,WAAW,EAAE;YAClB,IAAI,CAACA,WAAW,CAACC,MAAM;QAC3B;QAEA,IAAI,IAAI,CAACC,SAAS,IAAI,IAAI,CAACC,MAAM,IAAIP,SA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KA,uBAAQH,eAAR,KAAA;QAGI,IAAI,CAACQ,UAAU,GAAGA;QAClB,IAAI,CAACc,UAAU,GAAGA;QAClB,IAAI,CAACpB,SAAS,GAAGA;IACrB;AAqDJ"}
|
|
@@ -2,7 +2,7 @@ import { State } from '../state';
|
|
|
2
2
|
import { Preprocessors } from '../common.interfaces';
|
|
3
3
|
import { CompositeFilterDescriptor } from '../filtering/filter-descriptor.interface';
|
|
4
4
|
import { DataResult } from '../data-result.interface';
|
|
5
|
-
import { DataSource, IdType } from './data-source';
|
|
5
|
+
import type { DataSource, IdType } from './data-source';
|
|
6
6
|
export declare class InMemoryDataSource<T, TId extends IdType = never> implements DataSource<T, TId> {
|
|
7
7
|
idSelector?: (row: T) => TId;
|
|
8
8
|
private clone;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory-data-source.d.ts","sourceRoot":"","sources":["../../src/data-source/in-memory-data-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"in-memory-data-source.d.ts","sourceRoot":"","sources":["../../src/data-source/in-memory-data-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAKxD,qBAAa,kBAAkB,CAAC,CAAC,EAAE,GAAG,SAAS,MAAM,GAAG,KAAK,CAAE,YAAW,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC;IACxF,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC;IAE7B,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,aAAa,CAAmB;IAExC,OAAO,CAAC,MAAM,CAAC,CAGb;gBAGE,IAAI,EAAE,CAAC,EAAE,EACT,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,GAAG,EAC5B,aAAa,GAAE,aAAa,CAAC,CAAC,CAAM,EACpC,EAAE,eAAe,EAAE,GAAE;QAAE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAA;KAAO;IAUvE,OAAO,CAAC,KAAK,EAAE,KAAK;IAsBpB,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM;IAYxB,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAgBvC,UAAU,CAAC,EAAE,EAAE,GAAG;IAiBxB,0BAA0B,CAAC,MAAM,EAAE,yBAAyB;CAM/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data-source/in-memory-data-source.ts"],"sourcesContent":["import { State } from '../state';\nimport { Preprocessors } from '../common.interfaces';\nimport { CompositeFilterDescriptor } from '../filtering/filter-descriptor.interface';\nimport { DataResult } from '../data-result.interface';\nimport { filterBy } from '../filtering/filter-expression.factory';\nimport { process } from '../array.operators';\nimport { DataSource, IdType } from './data-source';\nimport cloneDeep from 'lodash/cloneDeep';\nimport cloneDeepWith from 'lodash/cloneDeepWith';\nimport { toJS, comparer } from 'mobx';\n\nexport class InMemoryDataSource<T, TId extends IdType = never> implements DataSource<T, TId> {\n idSelector?: (row: T) => TId;\n\n private clone: <U>(value: U) => U;\n private data: T[];\n private preprocessors: Preprocessors<T>;\n\n private cached?: {\n state: State;\n result: DataResult<T>;\n };\n\n constructor(\n data: T[],\n idSelector?: (row: T) => TId,\n preprocessors: Preprocessors<T> = {},\n { cloneCustomizer }: { cloneCustomizer?: (value: any) => any } = {}\n ) {\n this.clone = cloneCustomizer\n ? <U>(value: U) => cloneDeepWith(value, cloneCustomizer)\n : cloneDeep;\n this.data = this.clone(toJS(data));\n this.idSelector = idSelector;\n this.preprocessors = preprocessors;\n }\n\n getData(state: State) {\n const { skip, take, sort, filter, group } = state;\n\n const sortedAndFiltered =\n this.cached && comparer.structural(this.cached.state, { sort, filter })\n ? this.cached.result\n : process(this.data, { sort, filter }, this.preprocessors);\n\n this.cached = {\n state: { sort, filter },\n result: sortedAndFiltered,\n };\n\n const { data } = process(sortedAndFiltered.data, { skip, take, group }, this.preprocessors);\n const { total } = sortedAndFiltered;\n\n return Promise.resolve({\n total,\n data: this.clone(data),\n } as DataResult<T>);\n }\n\n addData(row: T, index?: number) {\n if (index !== undefined) {\n this.data.splice(index, 0, this.clone(row));\n } else {\n this.data.push(this.clone(row));\n }\n\n this.cached = undefined;\n\n return Promise.resolve(this.clone(row));\n }\n\n async updateData(id: TId, changes: Partial<T>) {\n if (!this.idSelector) {\n throw 'missing idSelector';\n }\n\n const row = this.data.find(row => this.idSelector!(row) === id);\n\n if (row) {\n Object.assign(row, changes);\n\n this.cached = undefined;\n }\n\n return Promise.resolve();\n }\n\n async removeData(id: TId) {\n if (!this.idSelector) {\n throw 'missing idSelector';\n }\n\n const index = this.data.findIndex(row => this.idSelector!(row) === id);\n\n if (index !== -1) {\n const row = this.data[index];\n this.data.splice(index, 1);\n\n this.cached = undefined;\n\n return Promise.resolve(row);\n }\n }\n\n getFilteredPersistentItems(filter: CompositeFilterDescriptor) {\n const set = new Set(this.data);\n const inFilter = filterBy(this.data, filter, this.preprocessors);\n inFilter.forEach(dataItem => set.delete(dataItem));\n return this.clone(Array.from(set));\n }\n}\n"],"names":["filterBy","process","cloneDeep","cloneDeepWith","toJS","comparer","InMemoryDataSource","getData","state","skip","take","sort","filter","group","sortedAndFiltered","cached","structural","result","data","preprocessors","total","Promise","resolve","clone","addData","row","index","undefined","splice","push","updateData","id","changes","idSelector","find","Object","assign","removeData","findIndex","getFilteredPersistentItems","set","Set","inFilter","forEach","dataItem","delete","Array","from","cloneCustomizer","value"],"mappings":";;;;;;;;;;;;;AAIA,SAASA,QAAQ,QAAQ,yCAAyC;AAClE,SAASC,OAAO,QAAQ,qBAAqB;AAE7C,OAAOC,eAAe,mBAAmB;AACzC,OAAOC,mBAAmB,uBAAuB;AACjD,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AAEtC,OAAO,MAAMC;IA0BTC,QAAQC,KAAY,EAAE;QAClB,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,EAAEC,KAAK,EAAE,GAAGL;QAE5C,MAAMM,oBACF,IAAI,CAACC,MAAM,IAAIV,SAASW,UAAU,CAAC,IAAI,CAACD,MAAM,CAACP,KAAK,EAAE;YAAEG;YAAMC;QAAO,KAC/D,IAAI,CAACG,MAAM,CAACE,MAAM,GAClBhB,QAAQ,IAAI,CAACiB,IAAI,EAAE;YAAEP;YAAMC;QAAO,GAAG,IAAI,CAACO,aAAa;QAEjE,IAAI,CAACJ,MAAM,GAAG;YACVP,OAAO;gBAAEG;gBAAMC;YAAO;YACtBK,QAAQH;QACZ;QAEA,MAAM,EAAEI,IAAI,EAAE,GAAGjB,QAAQa,kBAAkBI,IAAI,EAAE;YAAET;YAAMC;YAAMG;QAAM,GAAG,IAAI,CAACM,aAAa;QAC1F,MAAM,EAAEC,KAAK,EAAE,GAAGN;QAElB,OAAOO,QAAQC,OAAO,CAAC;YACnBF;YACAF,MAAM,IAAI,CAACK,KAAK,CAACL;QACrB;IACJ;IAEAM,QAAQC,GAAM,EAAEC,KAAc,EAAE;QAC5B,IAAIA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D;QACxC,OAAO,IAAI,CAACrB,KAAK,CAACuB,MAAMC,IAAI,CAACP;IACjC;IAtFA,YACItB,IAAS,EACTe,UAA4B,EAC5Bd,gBAAkC,CAAC,CAAC,EACpC,EAAE6B,eAAe,EAA6C,GAAG,CAAC,CAAC,CACrE;QAhBFf,uBAAAA,cAAAA,KAAAA;QAEA,uBAAQV,SAAR,KAAA;QACA,uBAAQL,QAAR,KAAA;QACA,uBAAQC,iBAAR,KAAA;QAEA,uBAAQJ,UAAR,KAAA;QAWI,IAAI,CAACQ,KAAK,GAAGyB,kBACP,CAAIC,QAAa9C,cAAc8C,OAAOD,mBACtC9C;QACN,IAAI,CAACgB,IAAI,GAAG,IAAI,CAACK,KAAK,CAACnB,KAAKc;QAC5B,IAAI,CAACe,UAAU,GAAGA;QAClB,IAAI,CAACd,aAAa,GAAGA;IACzB;AA2EJ"}
|
|
1
|
+
{"version":3,"sources":["../../src/data-source/in-memory-data-source.ts"],"sourcesContent":["import { State } from '../state';\nimport { Preprocessors } from '../common.interfaces';\nimport { CompositeFilterDescriptor } from '../filtering/filter-descriptor.interface';\nimport { DataResult } from '../data-result.interface';\nimport { filterBy } from '../filtering/filter-expression.factory';\nimport { process } from '../array.operators';\nimport type { DataSource, IdType } from './data-source';\nimport cloneDeep from 'lodash/cloneDeep';\nimport cloneDeepWith from 'lodash/cloneDeepWith';\nimport { toJS, comparer } from 'mobx';\n\nexport class InMemoryDataSource<T, TId extends IdType = never> implements DataSource<T, TId> {\n idSelector?: (row: T) => TId;\n\n private clone: <U>(value: U) => U;\n private data: T[];\n private preprocessors: Preprocessors<T>;\n\n private cached?: {\n state: State;\n result: DataResult<T>;\n };\n\n constructor(\n data: T[],\n idSelector?: (row: T) => TId,\n preprocessors: Preprocessors<T> = {},\n { cloneCustomizer }: { cloneCustomizer?: (value: any) => any } = {}\n ) {\n this.clone = cloneCustomizer\n ? <U>(value: U) => cloneDeepWith(value, cloneCustomizer)\n : cloneDeep;\n this.data = this.clone(toJS(data));\n this.idSelector = idSelector;\n this.preprocessors = preprocessors;\n }\n\n getData(state: State) {\n const { skip, take, sort, filter, group } = state;\n\n const sortedAndFiltered =\n this.cached && comparer.structural(this.cached.state, { sort, filter })\n ? this.cached.result\n : process(this.data, { sort, filter }, this.preprocessors);\n\n this.cached = {\n state: { sort, filter },\n result: sortedAndFiltered,\n };\n\n const { data } = process(sortedAndFiltered.data, { skip, take, group }, this.preprocessors);\n const { total } = sortedAndFiltered;\n\n return Promise.resolve({\n total,\n data: this.clone(data),\n } as DataResult<T>);\n }\n\n addData(row: T, index?: number) {\n if (index !== undefined) {\n this.data.splice(index, 0, this.clone(row));\n } else {\n this.data.push(this.clone(row));\n }\n\n this.cached = undefined;\n\n return Promise.resolve(this.clone(row));\n }\n\n async updateData(id: TId, changes: Partial<T>) {\n if (!this.idSelector) {\n throw 'missing idSelector';\n }\n\n const row = this.data.find(row => this.idSelector!(row) === id);\n\n if (row) {\n Object.assign(row, changes);\n\n this.cached = undefined;\n }\n\n return Promise.resolve();\n }\n\n async removeData(id: TId) {\n if (!this.idSelector) {\n throw 'missing idSelector';\n }\n\n const index = this.data.findIndex(row => this.idSelector!(row) === id);\n\n if (index !== -1) {\n const row = this.data[index];\n this.data.splice(index, 1);\n\n this.cached = undefined;\n\n return Promise.resolve(row);\n }\n }\n\n getFilteredPersistentItems(filter: CompositeFilterDescriptor) {\n const set = new Set(this.data);\n const inFilter = filterBy(this.data, filter, this.preprocessors);\n inFilter.forEach(dataItem => set.delete(dataItem));\n return this.clone(Array.from(set));\n }\n}\n"],"names":["filterBy","process","cloneDeep","cloneDeepWith","toJS","comparer","InMemoryDataSource","getData","state","skip","take","sort","filter","group","sortedAndFiltered","cached","structural","result","data","preprocessors","total","Promise","resolve","clone","addData","row","index","undefined","splice","push","updateData","id","changes","idSelector","find","Object","assign","removeData","findIndex","getFilteredPersistentItems","set","Set","inFilter","forEach","dataItem","delete","Array","from","cloneCustomizer","value"],"mappings":";;;;;;;;;;;;;AAIA,SA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BAAQJ,UAAR,KAAA;QAWI,IAAI,CAACQ,KAAK,GAAGyB,kBACP,CAAIC,QAAa9C,cAAc8C,OAAOD,mBACtC9C;QACN,IAAI,CAACgB,IAAI,GAAG,IAAI,CAACK,KAAK,CAACnB,KAAKc;QAC5B,IAAI,CAACe,UAAU,GAAGA;QAClB,IAAI,CAACd,aAAa,GAAGA;IACzB;AA2EJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data-source/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data-source/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data-source/index.ts"],"sourcesContent":["export { DataSource, IdType } from './data-source';\nexport { InMemoryDataSource } from './in-memory-data-source';\nexport { AsyncDataSource } from './async-data-source';\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../src/data-source/index.ts"],"sourcesContent":["export type { DataSource, IdType } from './data-source';\nexport { InMemoryDataSource } from './in-memory-data-source';\nexport { AsyncDataSource } from './async-data-source';\n"],"names":["InMemoryDataSource","AsyncDataSource"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,eAAe,QAAQ,sBAAsB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
export { SortDescriptor } from './sort-descriptor';
|
|
2
|
-
export { GroupDescriptor, GroupResult } from './grouping/group-descriptor.interface';
|
|
3
|
-
export { FilterDescriptor, CompositeFilterDescriptor
|
|
1
|
+
export type { SortDescriptor } from './sort-descriptor';
|
|
2
|
+
export type { GroupDescriptor, GroupResult } from './grouping/group-descriptor.interface';
|
|
3
|
+
export type { FilterDescriptor, CompositeFilterDescriptor } from './filtering/filter-descriptor.interface';
|
|
4
|
+
export { isCompositeFilterDescriptor } from './filtering/filter-descriptor.interface';
|
|
4
5
|
export { toODataString } from './odata.operators';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
6
|
+
export type { DataSourceRequestState } from './mvc/operators';
|
|
7
|
+
export { toDataSourceRequestString, toDataSourceRequest } from './mvc/operators';
|
|
8
|
+
export type { ServerGroupResult } from './mvc/deserialization';
|
|
9
|
+
export { translateDataSourceResultGroups, translateAggregateResults } from './mvc/deserialization';
|
|
10
|
+
export type { State } from './state';
|
|
8
11
|
export { orderBy, process, distinct } from './array.operators';
|
|
9
12
|
export { getter } from './accessor';
|
|
10
13
|
export { filterBy, compileFilter } from './filtering/filter-expression.factory';
|
|
11
14
|
export { groupBy } from './grouping/group.operators';
|
|
12
|
-
export { Comparer
|
|
15
|
+
export type { Comparer } from './sorting/sort-array.operator';
|
|
16
|
+
export { composeSortDescriptors } from './sorting/sort-array.operator';
|
|
13
17
|
export { normalizeFilters } from './filtering/filter.operators';
|
|
14
18
|
export { normalizeGroups } from './grouping/group.operators';
|
|
15
|
-
export { DataResult } from './data-result.interface';
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
19
|
+
export type { DataResult } from './data-result.interface';
|
|
20
|
+
export type { AggregateDescriptor } from './grouping/aggregate.operators';
|
|
21
|
+
export { aggregateBy } from './grouping/aggregate.operators';
|
|
22
|
+
export type { AggregateResult } from './transducers';
|
|
23
|
+
export type { Preprocessors } from './common.interfaces';
|
|
24
|
+
export type { IdType, DataSource } from './data-source';
|
|
25
|
+
export { InMemoryDataSource, AsyncDataSource } from './data-source';
|
|
20
26
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAC1F,YAAY,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAC3G,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,YAAY,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACjF,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,+BAA+B,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACnG,YAAY,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,YAAY,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,YAAY,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { GroupDescriptor, GroupResult } from './grouping/group-descriptor.interface';
|
|
3
|
-
export { FilterDescriptor, CompositeFilterDescriptor, isCompositeFilterDescriptor } from './filtering/filter-descriptor.interface';
|
|
1
|
+
export { isCompositeFilterDescriptor } from './filtering/filter-descriptor.interface';
|
|
4
2
|
export { toODataString } from './odata.operators';
|
|
5
|
-
export { toDataSourceRequestString,
|
|
6
|
-
export { translateDataSourceResultGroups,
|
|
7
|
-
export { State } from './state';
|
|
3
|
+
export { toDataSourceRequestString, toDataSourceRequest } from './mvc/operators';
|
|
4
|
+
export { translateDataSourceResultGroups, translateAggregateResults } from './mvc/deserialization';
|
|
8
5
|
export { orderBy, process, distinct } from './array.operators';
|
|
9
6
|
export { getter } from './accessor';
|
|
10
7
|
export { filterBy, compileFilter } from './filtering/filter-expression.factory';
|
|
11
8
|
export { groupBy } from './grouping/group.operators';
|
|
12
|
-
export {
|
|
9
|
+
export { composeSortDescriptors } from './sorting/sort-array.operator';
|
|
13
10
|
export { normalizeFilters } from './filtering/filter.operators';
|
|
14
11
|
export { normalizeGroups } from './grouping/group.operators';
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export { AggregateResult } from './transducers';
|
|
18
|
-
export { Preprocessors } from './common.interfaces';
|
|
19
|
-
export { IdType, DataSource, InMemoryDataSource, AsyncDataSource } from './data-source';
|
|
12
|
+
export { aggregateBy } from './grouping/aggregate.operators';
|
|
13
|
+
export { InMemoryDataSource, AsyncDataSource } from './data-source';
|
|
20
14
|
|
|
21
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { SortDescriptor } from './sort-descriptor';\nexport { GroupDescriptor, GroupResult } from './grouping/group-descriptor.interface';\nexport { FilterDescriptor, CompositeFilterDescriptor
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type { SortDescriptor } from './sort-descriptor';\nexport type { GroupDescriptor, GroupResult } from './grouping/group-descriptor.interface';\nexport type { FilterDescriptor, CompositeFilterDescriptor } from './filtering/filter-descriptor.interface';\nexport { isCompositeFilterDescriptor } from './filtering/filter-descriptor.interface';\nexport { toODataString } from './odata.operators';\nexport type { DataSourceRequestState } from './mvc/operators';\nexport { toDataSourceRequestString, toDataSourceRequest } from './mvc/operators';\nexport type { ServerGroupResult } from './mvc/deserialization';\nexport { translateDataSourceResultGroups, translateAggregateResults } from './mvc/deserialization';\nexport type { State } from './state';\nexport { orderBy, process, distinct } from './array.operators';\nexport { getter } from './accessor';\nexport { filterBy, compileFilter } from './filtering/filter-expression.factory';\nexport { groupBy } from './grouping/group.operators';\nexport type { Comparer } from './sorting/sort-array.operator';\nexport { composeSortDescriptors } from './sorting/sort-array.operator';\nexport { normalizeFilters } from './filtering/filter.operators';\nexport { normalizeGroups } from './grouping/group.operators';\nexport type { DataResult } from './data-result.interface';\nexport type { AggregateDescriptor } from './grouping/aggregate.operators';\nexport { aggregateBy } from './grouping/aggregate.operators';\nexport type { AggregateResult } from './transducers';\nexport type { Preprocessors } from './common.interfaces';\nexport type { IdType, DataSource } from './data-source'\nexport { InMemoryDataSource, AsyncDataSource } from './data-source'\n"],"names":["isCompositeFilterDescriptor","toODataString","toDataSourceRequestString","toDataSourceRequest","translateDataSourceResultGroups","translateAggregateResults","orderBy","process","distinct","getter","filterBy","compileFilter","groupBy","composeSortDescriptors","normalizeFilters","normalizeGroups","aggregateBy","InMemoryDataSource","AsyncDataSource"],"mappings":"AAGA,SAASA,2BAA2B,QAAQ,0CAA0C;AACtF,SAASC,aAAa,QAAQ,oBAAoB;AAElD,SAASC,yBAAyB,EAAEC,mBAAmB,QAAQ,kBAAkB;AAEjF,SAASC,+BAA+B,EAAEC,yBAAyB,QAAQ,wBAAwB;AAEnG,SAASC,OAAO,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AAC/D,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,QAAQ,EAAEC,aAAa,QAAQ,wCAAwC;AAChF,SAASC,OAAO,QAAQ,6BAA6B;AAErD,SAASC,sBAAsB,QAAQ,gCAAgC;AACvE,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,eAAe,QAAQ,6BAA6B;AAG7D,SAASC,WAAW,QAAQ,iCAAiC;AAI7D,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,gBAAe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/data-query",
|
|
3
|
-
"version": "32.
|
|
3
|
+
"version": "32.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"cli": {
|
|
35
35
|
"webpack": false
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "25988db91418cf6ff9018760bd03ef6c3d7ef8ec"
|
|
38
38
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { State } from '../state';
|
|
2
2
|
import { DataResult } from '../data-result.interface';
|
|
3
3
|
import axios, { CancelToken, CancelTokenSource } from 'axios';
|
|
4
|
-
import { DataSource, IdType } from './data-source';
|
|
4
|
+
import type { DataSource, IdType } from './data-source';
|
|
5
5
|
import cloneDeep from 'lodash/cloneDeep';
|
|
6
6
|
import { toJS, comparer } from 'mobx';
|
|
7
7
|
|
|
@@ -4,7 +4,7 @@ import { CompositeFilterDescriptor } from '../filtering/filter-descriptor.interf
|
|
|
4
4
|
import { DataResult } from '../data-result.interface';
|
|
5
5
|
import { filterBy } from '../filtering/filter-expression.factory';
|
|
6
6
|
import { process } from '../array.operators';
|
|
7
|
-
import { DataSource, IdType } from './data-source';
|
|
7
|
+
import type { DataSource, IdType } from './data-source';
|
|
8
8
|
import cloneDeep from 'lodash/cloneDeep';
|
|
9
9
|
import cloneDeepWith from 'lodash/cloneDeepWith';
|
|
10
10
|
import { toJS, comparer } from 'mobx';
|
package/src/data-source/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
export { SortDescriptor } from './sort-descriptor';
|
|
2
|
-
export { GroupDescriptor, GroupResult } from './grouping/group-descriptor.interface';
|
|
3
|
-
export { FilterDescriptor, CompositeFilterDescriptor
|
|
1
|
+
export type { SortDescriptor } from './sort-descriptor';
|
|
2
|
+
export type { GroupDescriptor, GroupResult } from './grouping/group-descriptor.interface';
|
|
3
|
+
export type { FilterDescriptor, CompositeFilterDescriptor } from './filtering/filter-descriptor.interface';
|
|
4
|
+
export { isCompositeFilterDescriptor } from './filtering/filter-descriptor.interface';
|
|
4
5
|
export { toODataString } from './odata.operators';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
6
|
+
export type { DataSourceRequestState } from './mvc/operators';
|
|
7
|
+
export { toDataSourceRequestString, toDataSourceRequest } from './mvc/operators';
|
|
8
|
+
export type { ServerGroupResult } from './mvc/deserialization';
|
|
9
|
+
export { translateDataSourceResultGroups, translateAggregateResults } from './mvc/deserialization';
|
|
10
|
+
export type { State } from './state';
|
|
8
11
|
export { orderBy, process, distinct } from './array.operators';
|
|
9
12
|
export { getter } from './accessor';
|
|
10
13
|
export { filterBy, compileFilter } from './filtering/filter-expression.factory';
|
|
11
14
|
export { groupBy } from './grouping/group.operators';
|
|
12
|
-
export { Comparer
|
|
15
|
+
export type { Comparer } from './sorting/sort-array.operator';
|
|
16
|
+
export { composeSortDescriptors } from './sorting/sort-array.operator';
|
|
13
17
|
export { normalizeFilters } from './filtering/filter.operators';
|
|
14
18
|
export { normalizeGroups } from './grouping/group.operators';
|
|
15
|
-
export { DataResult } from './data-result.interface';
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
19
|
+
export type { DataResult } from './data-result.interface';
|
|
20
|
+
export type { AggregateDescriptor } from './grouping/aggregate.operators';
|
|
21
|
+
export { aggregateBy } from './grouping/aggregate.operators';
|
|
22
|
+
export type { AggregateResult } from './transducers';
|
|
23
|
+
export type { Preprocessors } from './common.interfaces';
|
|
24
|
+
export type { IdType, DataSource } from './data-source'
|
|
25
|
+
export { InMemoryDataSource, AsyncDataSource } from './data-source'
|