@vuu-ui/vuu-data-react 0.13.13 → 0.13.14
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/index.js +0 -3
- package/cjs/index.js.map +1 -1
- package/esm/index.js +0 -1
- package/esm/index.js.map +1 -1
- package/package.json +14 -14
- package/types/datasource-provider/index.d.ts +0 -1
- package/cjs/datasource-provider/RestDataSourceProvider.js +0 -78
- package/cjs/datasource-provider/RestDataSourceProvider.js.map +0 -1
- package/esm/datasource-provider/RestDataSourceProvider.js +0 -75
- package/esm/datasource-provider/RestDataSourceProvider.js.map +0 -1
- package/types/datasource-provider/RestDataSourceProvider.d.ts +0 -11
package/cjs/index.js
CHANGED
|
@@ -6,7 +6,6 @@ var editRuleValidationChecker = require('./data-editing/edit-rule-validation-che
|
|
|
6
6
|
var UnsavedChangesReport = require('./data-editing/UnsavedChangesReport.js');
|
|
7
7
|
var useEditForm = require('./data-editing/useEditForm.js');
|
|
8
8
|
var formEditState = require('./data-editing/form-edit-state.js');
|
|
9
|
-
var RestDataSourceProvider = require('./datasource-provider/RestDataSourceProvider.js');
|
|
10
9
|
var VuuDataSourceProvider = require('./datasource-provider/VuuDataSourceProvider.js');
|
|
11
10
|
var useLookupValues = require('./hooks/useLookupValues.js');
|
|
12
11
|
var useSessionDataSource = require('./hooks/useSessionDataSource.js');
|
|
@@ -27,8 +26,6 @@ exports.UnsavedChangesReport = UnsavedChangesReport.UnsavedChangesReport;
|
|
|
27
26
|
exports.useEditForm = useEditForm.useEditForm;
|
|
28
27
|
exports.CLEAN_FORM = formEditState.CLEAN_FORM;
|
|
29
28
|
exports.buildFormEditState = formEditState.buildFormEditState;
|
|
30
|
-
exports.RestDataSourceProvider = RestDataSourceProvider.RestDataSourceProvider;
|
|
31
|
-
exports.isRestDataSourceExtension = RestDataSourceProvider.isRestDataSourceExtension;
|
|
32
29
|
exports.VuuDataSourceProvider = VuuDataSourceProvider.VuuDataSourceProvider;
|
|
33
30
|
exports.useLookupValues = useLookupValues.useLookupValues;
|
|
34
31
|
exports.useSessionDataSource = useSessionDataSource.useSessionDataSource;
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/esm/index.js
CHANGED
|
@@ -4,7 +4,6 @@ export { OK, buildValidationChecker, getEditValidationRules } from './data-editi
|
|
|
4
4
|
export { UnsavedChangesReport } from './data-editing/UnsavedChangesReport.js';
|
|
5
5
|
export { useEditForm } from './data-editing/useEditForm.js';
|
|
6
6
|
export { CLEAN_FORM, buildFormEditState } from './data-editing/form-edit-state.js';
|
|
7
|
-
export { RestDataSourceProvider, isRestDataSourceExtension } from './datasource-provider/RestDataSourceProvider.js';
|
|
8
7
|
export { VuuDataSourceProvider } from './datasource-provider/VuuDataSourceProvider.js';
|
|
9
8
|
export { useLookupValues } from './hooks/useLookupValues.js';
|
|
10
9
|
export { useSessionDataSource } from './hooks/useSessionDataSource.js';
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.13.
|
|
2
|
+
"version": "0.13.14",
|
|
3
3
|
"author": "heswell",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@vuu-ui/vuu-data-types": "0.13.
|
|
7
|
-
"@vuu-ui/vuu-filter-types": "0.13.
|
|
8
|
-
"@vuu-ui/vuu-popups": "0.13.
|
|
9
|
-
"@vuu-ui/vuu-protocol-types": "0.13.
|
|
10
|
-
"@vuu-ui/vuu-table-types": "0.13.
|
|
6
|
+
"@vuu-ui/vuu-data-types": "0.13.14",
|
|
7
|
+
"@vuu-ui/vuu-filter-types": "0.13.14",
|
|
8
|
+
"@vuu-ui/vuu-popups": "0.13.14",
|
|
9
|
+
"@vuu-ui/vuu-protocol-types": "0.13.14",
|
|
10
|
+
"@vuu-ui/vuu-table-types": "0.13.14"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@vuu-ui/vuu-context-menu": "0.13.
|
|
14
|
-
"@vuu-ui/vuu-data-remote": "0.13.
|
|
15
|
-
"@vuu-ui/vuu-filter-parser": "0.13.
|
|
16
|
-
"@vuu-ui/vuu-layout": "0.13.
|
|
17
|
-
"@vuu-ui/vuu-popups": "0.13.
|
|
18
|
-
"@vuu-ui/vuu-ui-controls": "0.13.
|
|
19
|
-
"@vuu-ui/vuu-utils": "0.13.
|
|
20
|
-
"@vuu-ui/vuu-table": "0.13.
|
|
13
|
+
"@vuu-ui/vuu-context-menu": "0.13.14",
|
|
14
|
+
"@vuu-ui/vuu-data-remote": "0.13.14",
|
|
15
|
+
"@vuu-ui/vuu-filter-parser": "0.13.14",
|
|
16
|
+
"@vuu-ui/vuu-layout": "0.13.14",
|
|
17
|
+
"@vuu-ui/vuu-popups": "0.13.14",
|
|
18
|
+
"@vuu-ui/vuu-ui-controls": "0.13.14",
|
|
19
|
+
"@vuu-ui/vuu-utils": "0.13.14",
|
|
20
|
+
"@vuu-ui/vuu-table": "0.13.14",
|
|
21
21
|
"@salt-ds/core": "1.43.0",
|
|
22
22
|
"@salt-ds/styles": "0.2.1",
|
|
23
23
|
"@salt-ds/window": "0.1.1"
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var vuuDataRemote = require('@vuu-ui/vuu-data-remote');
|
|
5
|
-
var vuuUtils = require('@vuu-ui/vuu-utils');
|
|
6
|
-
|
|
7
|
-
const serverAPI = (schemas) => ({
|
|
8
|
-
getTableList: async () => {
|
|
9
|
-
if (schemas) {
|
|
10
|
-
return {
|
|
11
|
-
tables: Object.keys(schemas).map((key) => {
|
|
12
|
-
const [module, table] = key.split(":");
|
|
13
|
-
return { module, table };
|
|
14
|
-
})
|
|
15
|
-
};
|
|
16
|
-
} else {
|
|
17
|
-
console.log(`Rest data source does not yet support table list`);
|
|
18
|
-
return { tables: [] };
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
getTableSchema: async ({ module, table }) => {
|
|
22
|
-
const schema = schemas?.[`${module}:${table}`];
|
|
23
|
-
if (schema) {
|
|
24
|
-
return schema;
|
|
25
|
-
} else {
|
|
26
|
-
throw Error(
|
|
27
|
-
`Rest data source does not yet support table schema (${table})`
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
rpcCall: async (message) => Promise.reject(
|
|
32
|
-
Error(`Rest data source does not yet support RPC (${message.type})`)
|
|
33
|
-
)
|
|
34
|
-
});
|
|
35
|
-
const getServerAPI = (schemas) => async () => serverAPI(schemas);
|
|
36
|
-
const isRestDataSourceExtension = (o) => {
|
|
37
|
-
return vuuUtils.isObject(o) && "createHttpHeaders" in o && typeof o["createHttpHeaders"] === "function";
|
|
38
|
-
};
|
|
39
|
-
const getRestDataSourceClass = ({
|
|
40
|
-
createHttpHeaders
|
|
41
|
-
}) => {
|
|
42
|
-
if (createHttpHeaders) {
|
|
43
|
-
return class ExtendedClass extends vuuDataRemote.RestDataSource {
|
|
44
|
-
constructor(props) {
|
|
45
|
-
super(props);
|
|
46
|
-
}
|
|
47
|
-
get httpHeaders() {
|
|
48
|
-
return createHttpHeaders();
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
} else {
|
|
52
|
-
return vuuDataRemote.RestDataSource;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
const RestDataSourceProvider = ({
|
|
56
|
-
children,
|
|
57
|
-
createHttpHeaders,
|
|
58
|
-
tableSchemas,
|
|
59
|
-
url
|
|
60
|
-
}) => {
|
|
61
|
-
vuuDataRemote.RestDataSource.api = url;
|
|
62
|
-
const restDataSourceClass = getRestDataSourceClass({ createHttpHeaders });
|
|
63
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
-
vuuUtils.DataProvider,
|
|
65
|
-
{
|
|
66
|
-
VuuDataSource: restDataSourceClass,
|
|
67
|
-
dataSourceExtensions: { createHttpHeaders },
|
|
68
|
-
getServerAPI: getServerAPI(tableSchemas),
|
|
69
|
-
isLocalData: false,
|
|
70
|
-
tableSchemas,
|
|
71
|
-
children
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
exports.RestDataSourceProvider = RestDataSourceProvider;
|
|
77
|
-
exports.isRestDataSourceExtension = isRestDataSourceExtension;
|
|
78
|
-
//# sourceMappingURL=RestDataSourceProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RestDataSourceProvider.js","sources":["../../src/datasource-provider/RestDataSourceProvider.tsx"],"sourcesContent":["import { RestDataSource } from \"@vuu-ui/vuu-data-remote\";\nimport {\n DataSourceConstructorProps,\n ServerAPI,\n TableSchema,\n} from \"@vuu-ui/vuu-data-types\";\nimport {\n VuuCreateVisualLink,\n VuuRemoveVisualLink,\n VuuRpcMenuRequest,\n VuuRpcServiceRequest,\n VuuRpcViewportRequest,\n VuuTable,\n} from \"@vuu-ui/vuu-protocol-types\";\nimport { DataProvider, isObject } from \"@vuu-ui/vuu-utils\";\nimport { ReactNode } from \"react\";\n\nconst serverAPI = (\n schemas?: Record<string, TableSchema>,\n): Pick<ServerAPI, \"getTableList\" | \"getTableSchema\" | \"rpcCall\"> => ({\n getTableList: async () => {\n if (schemas) {\n return {\n tables: Object.keys(schemas).map((key) => {\n const [module, table] = key.split(\":\");\n return { module, table };\n }),\n };\n } else {\n console.log(`Rest data source does not yet support table list`);\n return { tables: [] };\n }\n },\n getTableSchema: async ({ module, table }: VuuTable) => {\n const schema = schemas?.[`${module}:${table}`];\n if (schema) {\n return schema;\n } else {\n throw Error(\n `Rest data source does not yet support table schema (${table})`,\n );\n }\n },\n rpcCall: async (\n message:\n | VuuRpcServiceRequest\n | VuuRpcMenuRequest\n | VuuRpcViewportRequest\n | VuuCreateVisualLink\n | VuuRemoveVisualLink,\n ) =>\n Promise.reject(\n Error(`Rest data source does not yet support RPC (${message.type})`),\n ),\n});\n\nconst getServerAPI = (schemas?: Record<string, TableSchema>) => async () =>\n serverAPI(schemas);\n\nexport type RestDataSourceExtension = {\n createHttpHeaders?: () => Headers;\n};\n\nexport const isRestDataSourceExtension = (\n o?: unknown,\n): o is RestDataSourceExtension => {\n return (\n isObject(o) &&\n \"createHttpHeaders\" in o &&\n typeof o[\"createHttpHeaders\"] === \"function\"\n );\n};\n\nconst getRestDataSourceClass = ({\n createHttpHeaders,\n}: RestDataSourceExtension) => {\n if (createHttpHeaders) {\n return class ExtendedClass extends RestDataSource {\n constructor(props: DataSourceConstructorProps) {\n super(props);\n }\n get httpHeaders(): Headers | undefined {\n return createHttpHeaders();\n }\n };\n } else {\n return RestDataSource;\n }\n};\n\nexport const RestDataSourceProvider = ({\n children,\n createHttpHeaders,\n tableSchemas,\n url,\n}: {\n children: ReactNode;\n tableSchemas?: Record<string, TableSchema>;\n url: string;\n} & RestDataSourceExtension) => {\n RestDataSource.api = url;\n\n const restDataSourceClass = getRestDataSourceClass({ createHttpHeaders });\n\n return (\n <DataProvider\n VuuDataSource={restDataSourceClass}\n dataSourceExtensions={{ createHttpHeaders }}\n getServerAPI={getServerAPI(tableSchemas)}\n isLocalData={false}\n tableSchemas={tableSchemas}\n >\n {children}\n </DataProvider>\n );\n};\n"],"names":["isObject","RestDataSource","jsx","DataProvider"],"mappings":";;;;;;AAiBA,MAAM,SAAA,GAAY,CAChB,OACoE,MAAA;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AAC7B,EAAA,IAAI,iBAAmB,EAAA;AACrB,IAAO,OAAA,MAAM,sBAAsBC,4BAAe,CAAA;AAAA,MAChD,YAAY,KAAmC,EAAA;AAC7C,QAAA,KAAA,CAAM,KAAK,CAAA;AAAA;AACb,MACA,IAAI,WAAmC,GAAA;AACrC,QAAA,OAAO,iBAAkB,EAAA;AAAA;AAC3B,KACF;AAAA,GACK,MAAA;AACL,IAAO,OAAAA,4BAAA;AAAA;AAEX,CAAA;AAEO,MAAM,yBAAyB,CAAC;AAAA,EACrC,QAAA;AAAA,EACA,iBAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAIgC,KAAA;AAC9B,EAAAA,4BAAA,CAAe,GAAM,GAAA,GAAA;AAErB,EAAA,MAAM,mBAAsB,GAAA,sBAAA,CAAuB,EAAE,iBAAA,EAAmB,CAAA;AAExE,EACE,uBAAAC,cAAA;AAAA,IAACC,qBAAA;AAAA,IAAA;AAAA,MACC,aAAe,EAAA,mBAAA;AAAA,MACf,oBAAA,EAAsB,EAAE,iBAAkB,EAAA;AAAA,MAC1C,YAAA,EAAc,aAAa,YAAY,CAAA;AAAA,MACvC,WAAa,EAAA,KAAA;AAAA,MACb,YAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ;;;;;"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { RestDataSource } from '@vuu-ui/vuu-data-remote';
|
|
3
|
-
import { isObject, DataProvider } from '@vuu-ui/vuu-utils';
|
|
4
|
-
|
|
5
|
-
const serverAPI = (schemas) => ({
|
|
6
|
-
getTableList: async () => {
|
|
7
|
-
if (schemas) {
|
|
8
|
-
return {
|
|
9
|
-
tables: Object.keys(schemas).map((key) => {
|
|
10
|
-
const [module, table] = key.split(":");
|
|
11
|
-
return { module, table };
|
|
12
|
-
})
|
|
13
|
-
};
|
|
14
|
-
} else {
|
|
15
|
-
console.log(`Rest data source does not yet support table list`);
|
|
16
|
-
return { tables: [] };
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
getTableSchema: async ({ module, table }) => {
|
|
20
|
-
const schema = schemas?.[`${module}:${table}`];
|
|
21
|
-
if (schema) {
|
|
22
|
-
return schema;
|
|
23
|
-
} else {
|
|
24
|
-
throw Error(
|
|
25
|
-
`Rest data source does not yet support table schema (${table})`
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
rpcCall: async (message) => Promise.reject(
|
|
30
|
-
Error(`Rest data source does not yet support RPC (${message.type})`)
|
|
31
|
-
)
|
|
32
|
-
});
|
|
33
|
-
const getServerAPI = (schemas) => async () => serverAPI(schemas);
|
|
34
|
-
const isRestDataSourceExtension = (o) => {
|
|
35
|
-
return isObject(o) && "createHttpHeaders" in o && typeof o["createHttpHeaders"] === "function";
|
|
36
|
-
};
|
|
37
|
-
const getRestDataSourceClass = ({
|
|
38
|
-
createHttpHeaders
|
|
39
|
-
}) => {
|
|
40
|
-
if (createHttpHeaders) {
|
|
41
|
-
return class ExtendedClass extends RestDataSource {
|
|
42
|
-
constructor(props) {
|
|
43
|
-
super(props);
|
|
44
|
-
}
|
|
45
|
-
get httpHeaders() {
|
|
46
|
-
return createHttpHeaders();
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
} else {
|
|
50
|
-
return RestDataSource;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const RestDataSourceProvider = ({
|
|
54
|
-
children,
|
|
55
|
-
createHttpHeaders,
|
|
56
|
-
tableSchemas,
|
|
57
|
-
url
|
|
58
|
-
}) => {
|
|
59
|
-
RestDataSource.api = url;
|
|
60
|
-
const restDataSourceClass = getRestDataSourceClass({ createHttpHeaders });
|
|
61
|
-
return /* @__PURE__ */ jsx(
|
|
62
|
-
DataProvider,
|
|
63
|
-
{
|
|
64
|
-
VuuDataSource: restDataSourceClass,
|
|
65
|
-
dataSourceExtensions: { createHttpHeaders },
|
|
66
|
-
getServerAPI: getServerAPI(tableSchemas),
|
|
67
|
-
isLocalData: false,
|
|
68
|
-
tableSchemas,
|
|
69
|
-
children
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export { RestDataSourceProvider, isRestDataSourceExtension };
|
|
75
|
-
//# sourceMappingURL=RestDataSourceProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RestDataSourceProvider.js","sources":["../../src/datasource-provider/RestDataSourceProvider.tsx"],"sourcesContent":["import { RestDataSource } from \"@vuu-ui/vuu-data-remote\";\nimport {\n DataSourceConstructorProps,\n ServerAPI,\n TableSchema,\n} from \"@vuu-ui/vuu-data-types\";\nimport {\n VuuCreateVisualLink,\n VuuRemoveVisualLink,\n VuuRpcMenuRequest,\n VuuRpcServiceRequest,\n VuuRpcViewportRequest,\n VuuTable,\n} from \"@vuu-ui/vuu-protocol-types\";\nimport { DataProvider, isObject } from \"@vuu-ui/vuu-utils\";\nimport { ReactNode } from \"react\";\n\nconst serverAPI = (\n schemas?: Record<string, TableSchema>,\n): Pick<ServerAPI, \"getTableList\" | \"getTableSchema\" | \"rpcCall\"> => ({\n getTableList: async () => {\n if (schemas) {\n return {\n tables: Object.keys(schemas).map((key) => {\n const [module, table] = key.split(\":\");\n return { module, table };\n }),\n };\n } else {\n console.log(`Rest data source does not yet support table list`);\n return { tables: [] };\n }\n },\n getTableSchema: async ({ module, table }: VuuTable) => {\n const schema = schemas?.[`${module}:${table}`];\n if (schema) {\n return schema;\n } else {\n throw Error(\n `Rest data source does not yet support table schema (${table})`,\n );\n }\n },\n rpcCall: async (\n message:\n | VuuRpcServiceRequest\n | VuuRpcMenuRequest\n | VuuRpcViewportRequest\n | VuuCreateVisualLink\n | VuuRemoveVisualLink,\n ) =>\n Promise.reject(\n Error(`Rest data source does not yet support RPC (${message.type})`),\n ),\n});\n\nconst getServerAPI = (schemas?: Record<string, TableSchema>) => async () =>\n serverAPI(schemas);\n\nexport type RestDataSourceExtension = {\n createHttpHeaders?: () => Headers;\n};\n\nexport const isRestDataSourceExtension = (\n o?: unknown,\n): o is RestDataSourceExtension => {\n return (\n isObject(o) &&\n \"createHttpHeaders\" in o &&\n typeof o[\"createHttpHeaders\"] === \"function\"\n );\n};\n\nconst getRestDataSourceClass = ({\n createHttpHeaders,\n}: RestDataSourceExtension) => {\n if (createHttpHeaders) {\n return class ExtendedClass extends RestDataSource {\n constructor(props: DataSourceConstructorProps) {\n super(props);\n }\n get httpHeaders(): Headers | undefined {\n return createHttpHeaders();\n }\n };\n } else {\n return RestDataSource;\n }\n};\n\nexport const RestDataSourceProvider = ({\n children,\n createHttpHeaders,\n tableSchemas,\n url,\n}: {\n children: ReactNode;\n tableSchemas?: Record<string, TableSchema>;\n url: string;\n} & RestDataSourceExtension) => {\n RestDataSource.api = url;\n\n const restDataSourceClass = getRestDataSourceClass({ createHttpHeaders });\n\n return (\n <DataProvider\n VuuDataSource={restDataSourceClass}\n dataSourceExtensions={{ createHttpHeaders }}\n getServerAPI={getServerAPI(tableSchemas)}\n isLocalData={false}\n tableSchemas={tableSchemas}\n >\n {children}\n </DataProvider>\n );\n};\n"],"names":[],"mappings":";;;;AAiBA,MAAM,SAAA,GAAY,CAChB,OACoE,MAAA;AAAA,EACpE,cAAc,YAAY;AACxB,IAAA,IAAI,OAAS,EAAA;AACX,MAAO,OAAA;AAAA,QACL,QAAQ,MAAO,CAAA,IAAA,CAAK,OAAO,CAAE,CAAA,GAAA,CAAI,CAAC,GAAQ,KAAA;AACxC,UAAA,MAAM,CAAC,MAAQ,EAAA,KAAK,CAAI,GAAA,GAAA,CAAI,MAAM,GAAG,CAAA;AACrC,UAAO,OAAA,EAAE,QAAQ,KAAM,EAAA;AAAA,SACxB;AAAA,OACH;AAAA,KACK,MAAA;AACL,MAAA,OAAA,CAAQ,IAAI,CAAkD,gDAAA,CAAA,CAAA;AAC9D,MAAO,OAAA,EAAE,MAAQ,EAAA,EAAG,EAAA;AAAA;AACtB,GACF;AAA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BAAsB,GAAA,sBAAA,CAAuB,EAAE,iBAAA,EAAmB,CAAA;AAExE,EACE,uBAAA,GAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,aAAe,EAAA,mBAAA;AAAA,MACf,oBAAA,EAAsB,EAAE,iBAAkB,EAAA;AAAA,MAC1C,YAAA,EAAc,aAAa,YAAY,CAAA;AAAA,MACvC,WAAa,EAAA,KAAA;AAAA,MACb,YAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { TableSchema } from "@vuu-ui/vuu-data-types";
|
|
2
|
-
import { ReactNode } from "react";
|
|
3
|
-
export type RestDataSourceExtension = {
|
|
4
|
-
createHttpHeaders?: () => Headers;
|
|
5
|
-
};
|
|
6
|
-
export declare const isRestDataSourceExtension: (o?: unknown) => o is RestDataSourceExtension;
|
|
7
|
-
export declare const RestDataSourceProvider: ({ children, createHttpHeaders, tableSchemas, url, }: {
|
|
8
|
-
children: ReactNode;
|
|
9
|
-
tableSchemas?: Record<string, TableSchema>;
|
|
10
|
-
url: string;
|
|
11
|
-
} & RestDataSourceExtension) => import("react/jsx-runtime").JSX.Element;
|