@vuu-ui/vuu-data-remote 0.13.13 → 0.13.15
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/cjs/ConnectionManager.js.map +1 -1
- package/cjs/DedicatedWorker.js.map +1 -1
- package/cjs/VuuDataSource.js +18 -0
- package/cjs/VuuDataSource.js.map +1 -1
- package/cjs/WebSocketConnection.js.map +1 -1
- package/cjs/authenticate.js.map +1 -1
- package/cjs/constants.js.map +1 -1
- package/cjs/data-source.js.map +1 -1
- package/cjs/index.js +0 -2
- package/cjs/index.js.map +1 -1
- package/cjs/inlined-worker.js +33 -23
- package/cjs/inlined-worker.js.map +1 -1
- package/cjs/message-utils.js.map +1 -1
- package/esm/ConnectionManager.js.map +1 -1
- package/esm/DedicatedWorker.js.map +1 -1
- package/esm/VuuDataSource.js +18 -0
- package/esm/VuuDataSource.js.map +1 -1
- package/esm/WebSocketConnection.js.map +1 -1
- package/esm/authenticate.js.map +1 -1
- package/esm/constants.js.map +1 -1
- package/esm/data-source.js.map +1 -1
- package/esm/index.js +0 -1
- package/esm/index.js.map +1 -1
- package/esm/inlined-worker.js +33 -23
- package/esm/inlined-worker.js.map +1 -1
- package/esm/message-utils.js.map +1 -1
- package/package.json +7 -7
- package/types/VuuDataSource.d.ts +2 -0
- package/types/index.d.ts +0 -1
- package/types/inlined-worker.d.ts +1 -1
- package/types/server-proxy/viewport.d.ts +3 -3
- package/cjs/rest-data/RestDataSource.js +0 -172
- package/cjs/rest-data/RestDataSource.js.map +0 -1
- package/cjs/rest-data/moving-window.js +0 -66
- package/cjs/rest-data/moving-window.js.map +0 -1
- package/cjs/rest-data/rest-utils.js +0 -60
- package/cjs/rest-data/rest-utils.js.map +0 -1
- package/esm/rest-data/RestDataSource.js +0 -170
- package/esm/rest-data/RestDataSource.js.map +0 -1
- package/esm/rest-data/moving-window.js +0 -64
- package/esm/rest-data/moving-window.js.map +0 -1
- package/esm/rest-data/rest-utils.js +0 -55
- package/esm/rest-data/rest-utils.js.map +0 -1
- package/types/rest-data/RestDataSource.d.ts +0 -42
- package/types/rest-data/moving-window.d.ts +0 -14
- package/types/rest-data/rest-utils.d.ts +0 -14
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
const NDJsonReader = (startIndex, jsonHandler, onEnd) => (response) => {
|
|
2
|
-
if (response.ok && response.body) {
|
|
3
|
-
const stream = response.body.getReader();
|
|
4
|
-
const decoder = new TextDecoder();
|
|
5
|
-
const matcher = /\r?\n/;
|
|
6
|
-
let buf = "";
|
|
7
|
-
let index = startIndex;
|
|
8
|
-
const loop = () => stream.read().then(({ done, value }) => {
|
|
9
|
-
if (done) {
|
|
10
|
-
if (buf.length > 0) jsonHandler(index, JSON.parse(buf));
|
|
11
|
-
onEnd();
|
|
12
|
-
} else {
|
|
13
|
-
const chunk = decoder.decode(value, {
|
|
14
|
-
stream: true
|
|
15
|
-
});
|
|
16
|
-
buf += chunk;
|
|
17
|
-
const jsonFragments = buf.split(matcher);
|
|
18
|
-
buf = jsonFragments.pop() ?? "";
|
|
19
|
-
for (const jsonFragment of jsonFragments) {
|
|
20
|
-
jsonHandler(index, JSON.parse(jsonFragment));
|
|
21
|
-
index += 1;
|
|
22
|
-
}
|
|
23
|
-
return loop();
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
return loop();
|
|
27
|
-
} else {
|
|
28
|
-
throw Error(`response invalid ${response.status} ${response.statusText}`);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
const jsonToDataSourceRow = (rowIndex, json, columnMap) => {
|
|
32
|
-
const dataSourceRow = [
|
|
33
|
-
rowIndex,
|
|
34
|
-
rowIndex,
|
|
35
|
-
true,
|
|
36
|
-
false,
|
|
37
|
-
0,
|
|
38
|
-
0,
|
|
39
|
-
json.ric,
|
|
40
|
-
0
|
|
41
|
-
];
|
|
42
|
-
for (const [column, colIdx] of Object.entries(columnMap)) {
|
|
43
|
-
dataSourceRow[colIdx] = json[column];
|
|
44
|
-
}
|
|
45
|
-
return dataSourceRow;
|
|
46
|
-
};
|
|
47
|
-
const sortParamsToList = (sortDefs) => sortDefs.reduce(
|
|
48
|
-
(list, { column, sortType }) => list.concat([column, sortType]),
|
|
49
|
-
[]
|
|
50
|
-
);
|
|
51
|
-
const sortToQueryString = (sort) => `&sort=[${sortParamsToList(sort.sortDefs)}]`;
|
|
52
|
-
const filterToQueryString = (vuuFilter) => `&filter=[${vuuFilter.filter}]`;
|
|
53
|
-
|
|
54
|
-
export { NDJsonReader, filterToQueryString, jsonToDataSourceRow, sortToQueryString };
|
|
55
|
-
//# sourceMappingURL=rest-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rest-utils.js","sources":["../../src/rest-data/rest-utils.ts"],"sourcesContent":["import { DataSourceRow } from \"@vuu-ui/vuu-data-types\";\nimport {\n VuuFilter,\n VuuRowDataItemType,\n VuuSort,\n VuuSortCol,\n} from \"@vuu-ui/vuu-protocol-types\";\nimport { ColumnMap } from \"@vuu-ui/vuu-utils\";\n\nexport type JsonPrimitive = string | number | boolean | null;\nexport type JsonArray = Json[];\nexport type JsonObject = { [key: string]: Json };\nexport type Json = JsonPrimitive | JsonArray | JsonObject;\nexport type JsonHandler = (rowIndex: number, json: JsonObject) => void;\n\nexport const NDJsonReader =\n (startIndex: number, jsonHandler: JsonHandler, onEnd: () => void) =>\n (response: Response) => {\n if (response.ok && response.body) {\n const stream = response.body.getReader();\n const decoder = new TextDecoder();\n const matcher = /\\r?\\n/;\n let buf = \"\";\n let index = startIndex;\n\n const loop: () => void = () =>\n stream.read().then(({ done, value }) => {\n if (done) {\n if (buf.length > 0) jsonHandler(index, JSON.parse(buf));\n onEnd();\n } else {\n const chunk = decoder.decode(value, {\n stream: true,\n });\n buf += chunk;\n\n const jsonFragments = buf.split(matcher);\n buf = jsonFragments.pop() ?? \"\";\n for (const jsonFragment of jsonFragments) {\n jsonHandler(index, JSON.parse(jsonFragment));\n index += 1;\n }\n return loop();\n }\n });\n return loop();\n } else {\n throw Error(`response invalid ${response.status} ${response.statusText}`);\n }\n };\n\nexport const jsonToDataSourceRow = (\n rowIndex: number,\n json: JsonObject,\n columnMap: ColumnMap,\n): DataSourceRow => {\n const dataSourceRow: DataSourceRow = [\n rowIndex,\n rowIndex,\n true,\n false,\n 0,\n 0,\n json.ric as string,\n 0,\n ];\n for (const [column, colIdx] of Object.entries(columnMap)) {\n dataSourceRow[colIdx] = json[column] as VuuRowDataItemType;\n }\n return dataSourceRow;\n};\n\nconst sortParamsToList = (sortDefs: VuuSortCol[]) =>\n sortDefs.reduce<string[]>(\n (list, { column, sortType }) => list.concat([column, sortType]),\n [],\n );\n\nexport const sortToQueryString = (sort: VuuSort) =>\n `&sort=[${sortParamsToList(sort.sortDefs)}]`;\n\nexport const filterToQueryString = (vuuFilter: VuuFilter) =>\n `&filter=[${vuuFilter.filter}]`;\n"],"names":[],"mappings":"AAeO,MAAM,eACX,CAAC,UAAA,EAAoB,WAA0B,EAAA,KAAA,KAC/C,CAAC,QAAuB,KAAA;AACtB,EAAI,IAAA,QAAA,CAAS,EAAM,IAAA,QAAA,CAAS,IAAM,EAAA;AAChC,IAAM,MAAA,MAAA,GAAS,QAAS,CAAA,IAAA,CAAK,SAAU,EAAA;AACvC,IAAM,MAAA,OAAA,GAAU,IAAI,WAAY,EAAA;AAChC,IAAA,MAAM,OAAU,GAAA,OAAA;AAChB,IAAA,IAAI,GAAM,GAAA,EAAA;AACV,IAAA,IAAI,KAAQ,GAAA,UAAA;AAEZ,IAAM,MAAA,IAAA,GAAmB,MACvB,MAAA,CAAO,IAAK,EAAA,CAAE,KAAK,CAAC,EAAE,IAAM,EAAA,KAAA,EAAY,KAAA;AACtC,MAAA,IAAI,IAAM,EAAA;AACR,QAAI,IAAA,GAAA,CAAI,SAAS,CAAG,EAAA,WAAA,CAAY,OAAO,IAAK,CAAA,KAAA,CAAM,GAAG,CAAC,CAAA;AACtD,QAAM,KAAA,EAAA;AAAA,OACD,MA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A,CAAK,MAAO,CAAA,CAAC,MAAQ,EAAA,QAAQ,CAAC,CAAA;AAAA,EAC9D;AACF,CAAA;AAEK,MAAM,oBAAoB,CAAC,IAAA,KAChC,UAAU,gBAAiB,CAAA,IAAA,CAAK,QAAQ,CAAC,CAAA,CAAA;AAEpC,MAAM,mBAAsB,GAAA,CAAC,SAClC,KAAA,CAAA,SAAA,EAAY,UAAU,MAAM,CAAA,CAAA;;;;"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { DataSource, DataSourceConstructorProps, DataSourceEditHandler, DataSourceStatus, DataSourceSubscribeCallback, DataSourceSubscribeProps, WithBaseFilter, WithFullConfig } from "@vuu-ui/vuu-data-types";
|
|
2
|
-
import { VuuTable, VuuGroupBy, VuuRange } from "@vuu-ui/vuu-protocol-types";
|
|
3
|
-
import { BaseDataSource } from "@vuu-ui/vuu-utils";
|
|
4
|
-
export type RestMetaData = {
|
|
5
|
-
recordCount: number;
|
|
6
|
-
};
|
|
7
|
-
export declare class RestDataSource extends BaseDataSource implements DataSource {
|
|
8
|
-
#private;
|
|
9
|
-
private static _api;
|
|
10
|
-
groupBy: VuuGroupBy;
|
|
11
|
-
selectedRowsCount: number;
|
|
12
|
-
status: DataSourceStatus;
|
|
13
|
-
table: VuuTable;
|
|
14
|
-
constructor(props: DataSourceConstructorProps & {
|
|
15
|
-
url?: string;
|
|
16
|
-
});
|
|
17
|
-
subscribe(subscribeProps: DataSourceSubscribeProps, callback: DataSourceSubscribeCallback): Promise<void>;
|
|
18
|
-
unsubscribe(): void;
|
|
19
|
-
private get pageSize();
|
|
20
|
-
static get api(): string;
|
|
21
|
-
static set api(url: string);
|
|
22
|
-
get url(): string;
|
|
23
|
-
get dataUrl(): string;
|
|
24
|
-
get httpHeaders(): Headers | undefined;
|
|
25
|
-
get metaDataUrl(): string;
|
|
26
|
-
private get queryStringParameters();
|
|
27
|
-
get title(): string;
|
|
28
|
-
set title(title: string);
|
|
29
|
-
rangeRequest(range: VuuRange): void;
|
|
30
|
-
get config(): WithBaseFilter<WithFullConfig>;
|
|
31
|
-
set config(config: WithBaseFilter<WithFullConfig>);
|
|
32
|
-
private fetchData;
|
|
33
|
-
private fetchMetaData;
|
|
34
|
-
private sendRowsToClient;
|
|
35
|
-
applyEdit: DataSourceEditHandler;
|
|
36
|
-
openTreeNode: () => never;
|
|
37
|
-
closeTreeNode: () => never;
|
|
38
|
-
remoteProcedureCall: <T>() => Promise<T>;
|
|
39
|
-
menuRpcCall: () => Promise<string>;
|
|
40
|
-
rpcCall: <T>() => Promise<T>;
|
|
41
|
-
select: () => never;
|
|
42
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DataSourceRow } from "@vuu-ui/vuu-data-types";
|
|
2
|
-
import { VuuRange } from "@vuu-ui/vuu-protocol-types";
|
|
3
|
-
export declare class MovingWindow {
|
|
4
|
-
data: DataSourceRow[];
|
|
5
|
-
rowCount: number;
|
|
6
|
-
private range;
|
|
7
|
-
constructor({ from, to }: VuuRange);
|
|
8
|
-
setRowCount: (rowCount: number) => void;
|
|
9
|
-
add(data: DataSourceRow): void;
|
|
10
|
-
getAtIndex(index: number): DataSourceRow | undefined;
|
|
11
|
-
isWithinRange(index: number): boolean;
|
|
12
|
-
setRange({ from, to }: VuuRange): void;
|
|
13
|
-
getSelectedRows(): DataSourceRow[];
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DataSourceRow } from "@vuu-ui/vuu-data-types";
|
|
2
|
-
import { VuuFilter, VuuSort } from "@vuu-ui/vuu-protocol-types";
|
|
3
|
-
import { ColumnMap } from "@vuu-ui/vuu-utils";
|
|
4
|
-
export type JsonPrimitive = string | number | boolean | null;
|
|
5
|
-
export type JsonArray = Json[];
|
|
6
|
-
export type JsonObject = {
|
|
7
|
-
[key: string]: Json;
|
|
8
|
-
};
|
|
9
|
-
export type Json = JsonPrimitive | JsonArray | JsonObject;
|
|
10
|
-
export type JsonHandler = (rowIndex: number, json: JsonObject) => void;
|
|
11
|
-
export declare const NDJsonReader: (startIndex: number, jsonHandler: JsonHandler, onEnd: () => void) => (response: Response) => void;
|
|
12
|
-
export declare const jsonToDataSourceRow: (rowIndex: number, json: JsonObject, columnMap: ColumnMap) => DataSourceRow;
|
|
13
|
-
export declare const sortToQueryString: (sort: VuuSort) => string;
|
|
14
|
-
export declare const filterToQueryString: (vuuFilter: VuuFilter) => string;
|