xmlui 0.9.21 → 0.9.25
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/apiInterceptorWorker-CFF3bC6o.mjs +818 -0
- package/dist/{index-B3CWFAxa.mjs → index-DtxDGaqF.mjs} +11942 -3291
- package/dist/index.css +1301 -564
- package/dist/language-server-web-worker.mjs +1 -1
- package/dist/language-server.mjs +1 -1
- package/dist/lint-CYAUfk0_.mjs +168 -0
- package/dist/metadata-utils-CCIMqe69.mjs +466 -0
- package/dist/scripts/package.json +252 -0
- package/dist/scripts/src/components/App/AppLayoutContext.js +0 -1
- package/dist/scripts/src/components/App/AppNative.js +21 -9
- package/dist/scripts/src/components/AppHeader/AppHeader.js +1 -1
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +5 -2
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +13 -10
- package/dist/scripts/src/components/Bookmark/BookmarkNative.js +5 -1
- package/dist/scripts/src/components/CodeBlock/CodeBlock.js +31 -0
- package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +82 -0
- package/dist/scripts/src/components/ComponentProvider.js +5 -0
- package/dist/scripts/src/components/DatePicker/DatePickerNative.js +1 -0
- package/dist/scripts/src/components/Form/FormContext.js +5 -4
- package/dist/scripts/src/components/Form/FormNative.js +41 -43
- package/dist/scripts/src/components/Form/formActions.js +1 -1
- package/dist/scripts/src/components/FormItem/FormItem.js +6 -3
- package/dist/scripts/src/components/FormItem/FormItemNative.js +56 -15
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +1 -1
- package/dist/scripts/src/components/Heading/Heading.js +13 -0
- package/dist/scripts/src/components/Heading/HeadingNative.js +1 -1
- package/dist/scripts/src/components/HtmlTags/HtmlTags.js +7 -3
- package/dist/scripts/src/components/Icon/DarkToLightIcon.js +10 -0
- package/dist/scripts/src/components/Icon/LightToDark.js +10 -0
- package/dist/scripts/src/components/IconProvider.js +4 -0
- package/dist/scripts/src/components/Image/ImageNative.js +1 -1
- package/dist/scripts/src/components/Items/ItemsNative.js +8 -6
- package/dist/scripts/src/components/Link/Link.js +5 -5
- package/dist/scripts/src/components/List/ListNative.js +1 -1
- package/dist/scripts/src/components/Markdown/Markdown.js +52 -16
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +34 -73
- package/dist/scripts/src/components/Markdown/highlight-code.js +160 -0
- package/dist/scripts/src/components/Markdown/parse-binding-expr.js +60 -0
- package/dist/scripts/src/components/Markdown/utils.js +282 -0
- package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +116 -0
- package/dist/scripts/src/components/ModalDialog/Dialog.js +20 -0
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +4 -5
- package/dist/scripts/src/components/NestedApp/NestedApp.js +61 -0
- package/dist/scripts/src/components/NestedApp/NestedAppNative.js +125 -0
- package/dist/scripts/src/components/NestedApp/Tooltip.js +46 -0
- package/dist/scripts/src/components/NumberBox/NumberBox.js +4 -1
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +2 -2
- package/dist/scripts/src/components/Option/Option.js +3 -2
- package/dist/scripts/src/components/Select/Select.js +5 -3
- package/dist/scripts/src/components/Select/SelectNative.js +53 -40
- package/dist/scripts/src/components/SelectionStore/SelectionStore.js +1 -1
- package/dist/scripts/src/components/Spinner/Spinner.js +0 -1
- package/dist/scripts/src/components/TableOfContents/TableOfContents.js +1 -0
- package/dist/scripts/src/components/Text/Text.js +12 -1
- package/dist/scripts/src/components/Text/TextNative.js +5 -1
- package/dist/scripts/src/components/TextBox/TextBox.js +6 -1
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +2 -2
- package/dist/scripts/src/components/Theme/ThemeNative.js +7 -3
- package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.js +1 -3
- package/dist/scripts/src/components-core/RestApiProxy.js +10 -7
- package/dist/scripts/src/components-core/TableOfContentsContext.js +1 -1
- package/dist/scripts/src/components-core/appContext/date-functions.js +23 -0
- package/dist/scripts/src/components-core/appContext/math-function.js +27 -0
- package/dist/scripts/src/components-core/appContext/misc-utils.js +13 -0
- package/dist/scripts/src/components-core/interception/ApiInterceptor.js +199 -0
- package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +94 -0
- package/dist/scripts/src/components-core/interception/Backend.js +128 -0
- package/dist/scripts/src/components-core/interception/Errors.js +129 -0
- package/dist/scripts/src/components-core/interception/InMemoryDb.js +41 -0
- package/dist/scripts/src/components-core/interception/IndexedDb.js +207 -0
- package/dist/scripts/src/components-core/interception/ReadonlyCollection.js +145 -0
- package/dist/scripts/src/components-core/interception/abstractions.js +2 -0
- package/dist/scripts/src/components-core/interception/apiInterceptorWorker.js +46 -0
- package/dist/scripts/src/components-core/interception/useApiInterceptorContext.js +9 -0
- package/dist/scripts/src/components-core/rendering/AppContent.js +336 -0
- package/dist/scripts/src/components-core/rendering/AppRoot.js +84 -0
- package/dist/scripts/src/components-core/rendering/AppWrapper.js +49 -0
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +17 -7
- package/dist/scripts/src/components-core/rendering/Container.js +2 -1
- package/dist/scripts/src/components-core/theming/ThemeProvider.js +2 -7
- package/dist/scripts/src/components-core/theming/themes/root.js +1 -0
- package/dist/scripts/src/components-core/utils/date-utils.js +78 -0
- package/dist/scripts/src/components-core/utils/hooks.js +26 -0
- package/dist/scripts/src/components-core/utils/misc.js +1 -1
- package/dist/scripts/src/components-core/utils/request-params.js +70 -0
- package/dist/scripts/src/logging/LoggerContext.js +22 -0
- package/dist/scripts/src/logging/LoggerInitializer.js +14 -0
- package/dist/scripts/src/logging/LoggerService.js +60 -0
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +7 -0
- package/dist/{server-common-DW5h7Q34.mjs → server-common-9TiLMTJj.mjs} +106 -98
- package/dist/style.css +3314 -2823
- package/dist/{lint-EcgF-9Wr.mjs → transform-DC0Gy6qw.mjs} +1246 -540
- package/dist/xmlui-metadata.mjs +2850 -2665
- package/dist/xmlui-metadata.umd.js +2850 -2665
- package/dist/xmlui-parser.d.ts +49 -4
- package/dist/xmlui-parser.mjs +49 -48
- package/dist/xmlui-standalone.umd.js +34674 -31457
- package/dist/xmlui.d.ts +3 -1
- package/dist/xmlui.mjs +10 -10
- package/package.json +3 -1
- package/dist/apiInterceptorWorker-7aKQ2rBj.mjs +0 -8447
- package/dist/parser-CBXS8ft2.mjs +0 -1196
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mathFunctions = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* This function calculates the average of the specified values and returns it.
|
|
6
|
+
* @param values Values to calculate the average
|
|
7
|
+
* @param decimals Number of decimal places to round the result
|
|
8
|
+
*/
|
|
9
|
+
function avg(values, decimals) {
|
|
10
|
+
if (values.length === 0) {
|
|
11
|
+
return 0;
|
|
12
|
+
}
|
|
13
|
+
const sumValues = sum(values);
|
|
14
|
+
const result = sumValues / values.length;
|
|
15
|
+
return decimals ? Number(result.toFixed(decimals)) : result;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* This function calculates the sum of the specified values and returns it.
|
|
19
|
+
* @param values Values to calculate the sum
|
|
20
|
+
*/
|
|
21
|
+
function sum(values) {
|
|
22
|
+
return values.reduce((acc, val) => acc + val, 0);
|
|
23
|
+
}
|
|
24
|
+
exports.mathFunctions = {
|
|
25
|
+
avg,
|
|
26
|
+
sum
|
|
27
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.miscellaneousUtils = void 0;
|
|
4
|
+
const lodash_es_1 = require("lodash-es");
|
|
5
|
+
const misc_1 = require("../utils/misc");
|
|
6
|
+
exports.miscellaneousUtils = {
|
|
7
|
+
capitalize: lodash_es_1.capitalize,
|
|
8
|
+
pluralize: misc_1.pluralize,
|
|
9
|
+
defaultTo: lodash_es_1.defaultTo,
|
|
10
|
+
toHashObject: misc_1.toHashObject,
|
|
11
|
+
findByField: misc_1.findByField,
|
|
12
|
+
distinct: misc_1.distinct
|
|
13
|
+
};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ApiInterceptor = exports.AuthService = void 0;
|
|
13
|
+
const msw_1 = require("msw");
|
|
14
|
+
const lodash_es_1 = require("lodash-es");
|
|
15
|
+
const Backend_1 = require("../interception/Backend");
|
|
16
|
+
const IndexedDb_1 = require("../interception/IndexedDb");
|
|
17
|
+
const request_params_1 = require("../utils/request-params");
|
|
18
|
+
const Errors_1 = require("../interception/Errors");
|
|
19
|
+
const EngineError_1 = require("../EngineError");
|
|
20
|
+
const InMemoryDb_1 = require("../interception/InMemoryDb");
|
|
21
|
+
function mergeHeaders(...sources) {
|
|
22
|
+
const result = {};
|
|
23
|
+
for (const source of sources) {
|
|
24
|
+
if (!(0, lodash_es_1.isObject)(source)) {
|
|
25
|
+
throw new TypeError("All arguments must be of type object");
|
|
26
|
+
}
|
|
27
|
+
const headers = new Headers(source);
|
|
28
|
+
for (const [key, value] of headers.entries()) {
|
|
29
|
+
if (value === undefined || value === "undefined") {
|
|
30
|
+
delete result[key];
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
result[key] = value;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return new Headers(result);
|
|
38
|
+
}
|
|
39
|
+
// Represents the authentication service used within an API interceptor
|
|
40
|
+
class AuthService {
|
|
41
|
+
constructor(auth) {
|
|
42
|
+
const cachedLoggedInUser = JSON.parse(sessionStorage.getItem("session-logged-in-user"));
|
|
43
|
+
this.loggedInUser = cachedLoggedInUser || (auth === null || auth === void 0 ? void 0 : auth.defaultLoggedInUser);
|
|
44
|
+
}
|
|
45
|
+
login(newLoggedInUser) {
|
|
46
|
+
this.loggedInUser = newLoggedInUser;
|
|
47
|
+
sessionStorage.setItem("session-logged-in-user", JSON.stringify(newLoggedInUser));
|
|
48
|
+
}
|
|
49
|
+
logout() {
|
|
50
|
+
this.loggedInUser = null;
|
|
51
|
+
sessionStorage.removeItem("session-logged-in-user");
|
|
52
|
+
}
|
|
53
|
+
getCookieToken() {
|
|
54
|
+
return sessionStorage.getItem("session-anonymous-token");
|
|
55
|
+
}
|
|
56
|
+
setCookieToken(token) {
|
|
57
|
+
sessionStorage.setItem("session-anonymous-token", token);
|
|
58
|
+
}
|
|
59
|
+
getLoggedInUser() {
|
|
60
|
+
return this.loggedInUser;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.AuthService = AuthService;
|
|
64
|
+
function initDb(apiDef) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
switch (apiDef.type) {
|
|
68
|
+
case "in-memory":
|
|
69
|
+
return new InMemoryDb_1.InMemoryDb((_a = apiDef.schemaDescriptor) === null || _a === void 0 ? void 0 : _a.tables, apiDef.initialData, apiDef.config);
|
|
70
|
+
default:
|
|
71
|
+
const indexedDb = new IndexedDb_1.IndexedDb((_b = apiDef.schemaDescriptor) === null || _b === void 0 ? void 0 : _b.tables, apiDef.initialData, apiDef.config);
|
|
72
|
+
yield indexedDb.initialize();
|
|
73
|
+
return indexedDb;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
// An API interceptor implementation
|
|
78
|
+
class ApiInterceptor {
|
|
79
|
+
constructor(apiDef) {
|
|
80
|
+
this.apiDef = apiDef;
|
|
81
|
+
this.backend = null;
|
|
82
|
+
}
|
|
83
|
+
initialize() {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
// --- Transfer the handlers of API operations to the backend implementation
|
|
86
|
+
const backendOperations = {};
|
|
87
|
+
Object.entries(this.apiDef.operations || {}).forEach(([key, value]) => {
|
|
88
|
+
backendOperations[key] = value.handler;
|
|
89
|
+
});
|
|
90
|
+
const db = yield initDb(this.apiDef);
|
|
91
|
+
const authService = new AuthService(this.apiDef.auth);
|
|
92
|
+
const definition = {
|
|
93
|
+
operations: backendOperations,
|
|
94
|
+
initialize: this.apiDef.initialize,
|
|
95
|
+
helpers: this.apiDef.helpers,
|
|
96
|
+
};
|
|
97
|
+
this.backend = new Backend_1.Backend(definition, db, authService);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
getOperations() {
|
|
101
|
+
return this.apiDef.operations || {};
|
|
102
|
+
}
|
|
103
|
+
getApiUrl() {
|
|
104
|
+
return this.apiDef.apiUrl || "";
|
|
105
|
+
}
|
|
106
|
+
// Use the "msw" package to execute the interceptor operation
|
|
107
|
+
executeOperation(operationId, req, cookies, params) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
var _a, _b;
|
|
110
|
+
if (this.backend === null) {
|
|
111
|
+
throw new Error("Interceptor not initialized");
|
|
112
|
+
}
|
|
113
|
+
const operation = (_a = this.apiDef.operations) === null || _a === void 0 ? void 0 : _a[operationId];
|
|
114
|
+
if (!operation) {
|
|
115
|
+
throw new Error(`Unknown API interceptor operation: ${operationId}`);
|
|
116
|
+
}
|
|
117
|
+
let reqBody;
|
|
118
|
+
try {
|
|
119
|
+
if (operation.requestShape === "formData") {
|
|
120
|
+
const formData = yield req.formData();
|
|
121
|
+
const obj = {};
|
|
122
|
+
for (const key of formData.keys()) {
|
|
123
|
+
const all = formData.getAll(key);
|
|
124
|
+
if (all.length === 1) {
|
|
125
|
+
obj[key] = all[0];
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
obj[key] = all;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
reqBody = obj;
|
|
132
|
+
}
|
|
133
|
+
else if (operation.requestShape === "blob") {
|
|
134
|
+
reqBody = yield req.blob();
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
reqBody = yield req.json();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
catch (e) { }
|
|
141
|
+
// --- Map path parameters
|
|
142
|
+
const mappedParams = this.convertRequestParams({
|
|
143
|
+
pathParams: params,
|
|
144
|
+
queryParams: Object.fromEntries(new URL(req.url).searchParams),
|
|
145
|
+
requestBody: reqBody,
|
|
146
|
+
cookies: cookies,
|
|
147
|
+
requestHeaders: Object.fromEntries(req.headers.entries()) || {},
|
|
148
|
+
}, operation);
|
|
149
|
+
//artificial delay for http requests
|
|
150
|
+
yield (0, msw_1.delay)();
|
|
151
|
+
const cookieService = new Backend_1.CookieService();
|
|
152
|
+
const headerService = new Backend_1.HeaderService();
|
|
153
|
+
try {
|
|
154
|
+
const ret = yield this.backend.executeOperation(operationId, mappedParams, cookieService, headerService);
|
|
155
|
+
const emptyBody = ret === undefined || ret === null;
|
|
156
|
+
const successStatusCode = (_b = operation.successStatusCode) !== null && _b !== void 0 ? _b : (emptyBody ? Errors_1.HttpStatusCode.NoContent : Errors_1.HttpStatusCode.Ok);
|
|
157
|
+
const headers = mergeHeaders(cookieService.getCookieHeader(), headerService.getHeaders());
|
|
158
|
+
if (ret instanceof File) {
|
|
159
|
+
headers.append("Content-type", ret.type);
|
|
160
|
+
headers.append("Content-Length", ret.size + "");
|
|
161
|
+
headers.append("Content-Disposition", `attachment; filename="${ret.name}"; filename*=utf-8''${ret.name}`);
|
|
162
|
+
return msw_1.HttpResponse.arrayBuffer(yield ret.arrayBuffer(), {
|
|
163
|
+
headers: headers,
|
|
164
|
+
status: successStatusCode,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
if (emptyBody) {
|
|
168
|
+
return new msw_1.HttpResponse(null, {
|
|
169
|
+
headers: headers,
|
|
170
|
+
status: successStatusCode,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
console.log(operationId, ret);
|
|
174
|
+
return msw_1.HttpResponse.json(ret, {
|
|
175
|
+
headers: headers,
|
|
176
|
+
status: successStatusCode,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
catch (e) {
|
|
180
|
+
console.error(e);
|
|
181
|
+
if (e instanceof EngineError_1.ThrowStatementError && e.errorObject instanceof Errors_1.HttpError) {
|
|
182
|
+
return msw_1.HttpResponse.json(e.errorObject.details, {
|
|
183
|
+
headers: cookieService.getCookieHeader(),
|
|
184
|
+
status: e.errorObject.status,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
return msw_1.HttpResponse.json({ message: e === null || e === void 0 ? void 0 : e.message }, {
|
|
188
|
+
headers: cookieService.getCookieHeader(),
|
|
189
|
+
status: Errors_1.HttpStatusCode.InternalServerError,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
// Ensures that type path and query params are converted according to the operation definition
|
|
195
|
+
convertRequestParams(params, operation) {
|
|
196
|
+
return Object.assign(Object.assign({}, params), { pathParams: (0, request_params_1.convertRequestParamPart)(params.pathParams, operation.pathParamTypes), queryParams: (0, request_params_1.convertRequestParamPart)(params.queryParams, operation.queryParamTypes) });
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
exports.ApiInterceptor = ApiInterceptor;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.ApiInterceptorProvider = ApiInterceptorProvider;
|
|
46
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
47
|
+
const react_1 = require("react");
|
|
48
|
+
const misc_1 = require("../utils/misc");
|
|
49
|
+
const useApiInterceptorContext_1 = require("./useApiInterceptorContext");
|
|
50
|
+
// This React component injects the API interceptor into the application's context
|
|
51
|
+
function ApiInterceptorProvider({ interceptor, children, apiWorker, useHashBasedRouting, }) {
|
|
52
|
+
const [initialized, setInitialized] = (0, react_1.useState)(!interceptor);
|
|
53
|
+
// --- Whenever the interceptor changes, update the provider accordingly
|
|
54
|
+
(0, react_1.useEffect)(() => {
|
|
55
|
+
if (interceptor) {
|
|
56
|
+
setInitialized(false);
|
|
57
|
+
// --- We use "msw" to manage the API interception
|
|
58
|
+
let interceptorWorker;
|
|
59
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
// --- Create the worker on the fly
|
|
61
|
+
if (process.env.VITE_MOCK_ENABLED) {
|
|
62
|
+
const { createApiInterceptorWorker } = yield Promise.resolve().then(() => __importStar(require("./apiInterceptorWorker")));
|
|
63
|
+
if (interceptor) {
|
|
64
|
+
interceptorWorker = yield createApiInterceptorWorker(interceptor, apiWorker);
|
|
65
|
+
// if the apiWorker comes from the outside, we don't handle the lifecycle here
|
|
66
|
+
if (!apiWorker) {
|
|
67
|
+
const workerFileLocation = (0, misc_1.normalizePath)(process.env.VITE_MOCK_WORKER_LOCATION || "mockServiceWorker.js");
|
|
68
|
+
yield interceptorWorker.start({
|
|
69
|
+
onUnhandledRequest: "bypass",
|
|
70
|
+
quiet: true,
|
|
71
|
+
serviceWorker: {
|
|
72
|
+
url: workerFileLocation,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
setInitialized(true);
|
|
79
|
+
}))();
|
|
80
|
+
return () => {
|
|
81
|
+
// if the apiWorker comes from the outside, we don't handle the lifecycle here
|
|
82
|
+
if (!apiWorker) {
|
|
83
|
+
interceptorWorker === null || interceptorWorker === void 0 ? void 0 : interceptorWorker.stop();
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}, [apiWorker, interceptor, useHashBasedRouting]);
|
|
88
|
+
const contextValue = (0, react_1.useMemo)(() => {
|
|
89
|
+
return {
|
|
90
|
+
isMocked: (url) => interceptor !== undefined && !!process.env.VITE_MOCK_ENABLED,
|
|
91
|
+
};
|
|
92
|
+
}, [interceptor]);
|
|
93
|
+
return ((0, jsx_runtime_1.jsx)(useApiInterceptorContext_1.ApiInterceptorContext.Provider, { value: contextValue, children: initialized ? children || null : null }));
|
|
94
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.Backend = exports.HeaderService = exports.CookieService = exports.defaultBackendEnvironment = void 0;
|
|
16
|
+
const lodash_es_1 = require("lodash-es");
|
|
17
|
+
const misc_1 = require("../utils/misc");
|
|
18
|
+
const statementUtils_1 = require("../utils/statementUtils");
|
|
19
|
+
const date_functions_1 = require("../appContext/date-functions");
|
|
20
|
+
const misc_utils_1 = require("../appContext/misc-utils");
|
|
21
|
+
const date_utils_1 = require("../utils/date-utils");
|
|
22
|
+
const Errors_1 = __importDefault(require("../interception/Errors"));
|
|
23
|
+
// Use this backend environment as the default
|
|
24
|
+
exports.defaultBackendEnvironment = {
|
|
25
|
+
getDate: (date) => (date ? new Date(date) : new Date()),
|
|
26
|
+
};
|
|
27
|
+
const mapValuesDeep = (obj, cb) => {
|
|
28
|
+
if ((0, lodash_es_1.isArray)(obj)) {
|
|
29
|
+
return obj.map((innerObj) => mapValuesDeep(innerObj, cb));
|
|
30
|
+
}
|
|
31
|
+
else if ((0, lodash_es_1.isObject)(obj)) {
|
|
32
|
+
return (0, lodash_es_1.mapValues)(obj, (val) => mapValuesDeep(val, cb));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return cb(obj);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
class CookieService {
|
|
39
|
+
constructor() {
|
|
40
|
+
this.cookies = {};
|
|
41
|
+
}
|
|
42
|
+
setCookie(key, value) {
|
|
43
|
+
this.cookies[key] = value;
|
|
44
|
+
}
|
|
45
|
+
getCookieHeader() {
|
|
46
|
+
const cookieArrays = [];
|
|
47
|
+
Object.entries(this.cookies).forEach(([key, value]) => {
|
|
48
|
+
if (Array.isArray(value)) {
|
|
49
|
+
value.forEach((val) => cookieArrays.push(["Set-Cookie", `${key}=${val}`]));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
cookieArrays.push(["Set-Cookie", `${key}=${value}`]);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return new Headers(cookieArrays);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.CookieService = CookieService;
|
|
59
|
+
class HeaderService {
|
|
60
|
+
constructor() {
|
|
61
|
+
this.headers = {};
|
|
62
|
+
}
|
|
63
|
+
setHeader(key, value) {
|
|
64
|
+
this.headers[key] = value;
|
|
65
|
+
}
|
|
66
|
+
getHeaders() {
|
|
67
|
+
const headersArray = [];
|
|
68
|
+
Object.entries(this.headers).forEach(([key, value]) => {
|
|
69
|
+
headersArray.push([key, value]);
|
|
70
|
+
});
|
|
71
|
+
return new Headers(headersArray);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.HeaderService = HeaderService;
|
|
75
|
+
class Backend {
|
|
76
|
+
constructor(definition, db, authService) {
|
|
77
|
+
this.definition = definition;
|
|
78
|
+
this.db = db;
|
|
79
|
+
this.authService = authService;
|
|
80
|
+
this.apiStateHash = {};
|
|
81
|
+
this.resolvedHelpers = mapValuesDeep(definition.helpers, (helper) => {
|
|
82
|
+
if (typeof helper === "string") {
|
|
83
|
+
return (...params) => this.runFn(helper, ...params);
|
|
84
|
+
}
|
|
85
|
+
return helper;
|
|
86
|
+
});
|
|
87
|
+
if (definition.initialize) {
|
|
88
|
+
this.runFn(definition.initialize);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
executeOperation(operationId, requestParams, cookieService, headerService) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
var _a;
|
|
94
|
+
const handler = (_a = this.definition.operations) === null || _a === void 0 ? void 0 : _a[operationId];
|
|
95
|
+
if (!handler) {
|
|
96
|
+
throw new Error(`Unknown backend operation: ${operationId}`);
|
|
97
|
+
}
|
|
98
|
+
return yield this.runFn(handler, requestParams, cookieService, headerService);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
runFn(src, ...args) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
104
|
+
let localContext = Object.assign(Object.assign({}, this.resolvedHelpers), { $db: this.db, $state: this.apiStateHash, $authService: this.authService, $env: exports.defaultBackendEnvironment, $loggedInUser: this.authService.getLoggedInUser(), $pathParams: (_a = args[0]) === null || _a === void 0 ? void 0 : _a.pathParams, $queryParams: (_b = args[0]) === null || _b === void 0 ? void 0 : _b.queryParams, $requestBody: (_c = args[0]) === null || _c === void 0 ? void 0 : _c.requestBody, $cookies: (_d = args[0]) === null || _d === void 0 ? void 0 : _d.cookies, $requestHeaders: (_e = args[0]) === null || _e === void 0 ? void 0 : _e.requestHeaders, $cookieService: args[1], $headerService: args[2] });
|
|
105
|
+
const evalContext = createEvalContext({
|
|
106
|
+
localContext: localContext,
|
|
107
|
+
eventArgs: args,
|
|
108
|
+
appContext: Object.assign(Object.assign(Object.assign({}, date_functions_1.dateFunctions), misc_utils_1.miscellaneousUtils), { delay: misc_1.delay,
|
|
109
|
+
Errors: Errors_1.default, createFile: (...args) => new File(args[0], args[1], args[2]), getDate: date_utils_1.getDate }),
|
|
110
|
+
});
|
|
111
|
+
yield (0, statementUtils_1.runEventHandlerCode)(src, evalContext);
|
|
112
|
+
return ((_g = (_f = evalContext.mainThread) === null || _f === void 0 ? void 0 : _f.blocks) === null || _g === void 0 ? void 0 : _g.length)
|
|
113
|
+
? evalContext.mainThread.blocks[evalContext.mainThread.blocks.length - 1].returnValue
|
|
114
|
+
: undefined;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.Backend = Backend;
|
|
119
|
+
function createEvalContext(parts) {
|
|
120
|
+
return Object.assign({
|
|
121
|
+
mainThread: {
|
|
122
|
+
childThreads: [],
|
|
123
|
+
blocks: [{ vars: {} }],
|
|
124
|
+
loops: [],
|
|
125
|
+
breakLabelValue: -1,
|
|
126
|
+
},
|
|
127
|
+
}, parts);
|
|
128
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConflictError = exports.UnauthorizedError = exports.NotFoundError = exports.HttpError = exports.HttpStatusCode = void 0;
|
|
4
|
+
//stolen from axios
|
|
5
|
+
var HttpStatusCode;
|
|
6
|
+
(function (HttpStatusCode) {
|
|
7
|
+
HttpStatusCode[HttpStatusCode["Continue"] = 100] = "Continue";
|
|
8
|
+
HttpStatusCode[HttpStatusCode["SwitchingProtocols"] = 101] = "SwitchingProtocols";
|
|
9
|
+
HttpStatusCode[HttpStatusCode["Processing"] = 102] = "Processing";
|
|
10
|
+
HttpStatusCode[HttpStatusCode["EarlyHints"] = 103] = "EarlyHints";
|
|
11
|
+
HttpStatusCode[HttpStatusCode["Ok"] = 200] = "Ok";
|
|
12
|
+
HttpStatusCode[HttpStatusCode["Created"] = 201] = "Created";
|
|
13
|
+
HttpStatusCode[HttpStatusCode["Accepted"] = 202] = "Accepted";
|
|
14
|
+
HttpStatusCode[HttpStatusCode["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
|
|
15
|
+
HttpStatusCode[HttpStatusCode["NoContent"] = 204] = "NoContent";
|
|
16
|
+
HttpStatusCode[HttpStatusCode["ResetContent"] = 205] = "ResetContent";
|
|
17
|
+
HttpStatusCode[HttpStatusCode["PartialContent"] = 206] = "PartialContent";
|
|
18
|
+
HttpStatusCode[HttpStatusCode["MultiStatus"] = 207] = "MultiStatus";
|
|
19
|
+
HttpStatusCode[HttpStatusCode["AlreadyReported"] = 208] = "AlreadyReported";
|
|
20
|
+
HttpStatusCode[HttpStatusCode["ImUsed"] = 226] = "ImUsed";
|
|
21
|
+
HttpStatusCode[HttpStatusCode["MultipleChoices"] = 300] = "MultipleChoices";
|
|
22
|
+
HttpStatusCode[HttpStatusCode["MovedPermanently"] = 301] = "MovedPermanently";
|
|
23
|
+
HttpStatusCode[HttpStatusCode["Found"] = 302] = "Found";
|
|
24
|
+
HttpStatusCode[HttpStatusCode["SeeOther"] = 303] = "SeeOther";
|
|
25
|
+
HttpStatusCode[HttpStatusCode["NotModified"] = 304] = "NotModified";
|
|
26
|
+
HttpStatusCode[HttpStatusCode["UseProxy"] = 305] = "UseProxy";
|
|
27
|
+
HttpStatusCode[HttpStatusCode["Unused"] = 306] = "Unused";
|
|
28
|
+
HttpStatusCode[HttpStatusCode["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
|
29
|
+
HttpStatusCode[HttpStatusCode["PermanentRedirect"] = 308] = "PermanentRedirect";
|
|
30
|
+
HttpStatusCode[HttpStatusCode["BadRequest"] = 400] = "BadRequest";
|
|
31
|
+
HttpStatusCode[HttpStatusCode["Unauthorized"] = 401] = "Unauthorized";
|
|
32
|
+
HttpStatusCode[HttpStatusCode["PaymentRequired"] = 402] = "PaymentRequired";
|
|
33
|
+
HttpStatusCode[HttpStatusCode["Forbidden"] = 403] = "Forbidden";
|
|
34
|
+
HttpStatusCode[HttpStatusCode["NotFound"] = 404] = "NotFound";
|
|
35
|
+
HttpStatusCode[HttpStatusCode["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
|
36
|
+
HttpStatusCode[HttpStatusCode["NotAcceptable"] = 406] = "NotAcceptable";
|
|
37
|
+
HttpStatusCode[HttpStatusCode["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
|
38
|
+
HttpStatusCode[HttpStatusCode["RequestTimeout"] = 408] = "RequestTimeout";
|
|
39
|
+
HttpStatusCode[HttpStatusCode["Conflict"] = 409] = "Conflict";
|
|
40
|
+
HttpStatusCode[HttpStatusCode["Gone"] = 410] = "Gone";
|
|
41
|
+
HttpStatusCode[HttpStatusCode["LengthRequired"] = 411] = "LengthRequired";
|
|
42
|
+
HttpStatusCode[HttpStatusCode["PreconditionFailed"] = 412] = "PreconditionFailed";
|
|
43
|
+
HttpStatusCode[HttpStatusCode["PayloadTooLarge"] = 413] = "PayloadTooLarge";
|
|
44
|
+
HttpStatusCode[HttpStatusCode["UriTooLong"] = 414] = "UriTooLong";
|
|
45
|
+
HttpStatusCode[HttpStatusCode["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
|
|
46
|
+
HttpStatusCode[HttpStatusCode["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
|
|
47
|
+
HttpStatusCode[HttpStatusCode["ExpectationFailed"] = 417] = "ExpectationFailed";
|
|
48
|
+
HttpStatusCode[HttpStatusCode["ImATeapot"] = 418] = "ImATeapot";
|
|
49
|
+
HttpStatusCode[HttpStatusCode["MisdirectedRequest"] = 421] = "MisdirectedRequest";
|
|
50
|
+
HttpStatusCode[HttpStatusCode["UnprocessableEntity"] = 422] = "UnprocessableEntity";
|
|
51
|
+
HttpStatusCode[HttpStatusCode["Locked"] = 423] = "Locked";
|
|
52
|
+
HttpStatusCode[HttpStatusCode["FailedDependency"] = 424] = "FailedDependency";
|
|
53
|
+
HttpStatusCode[HttpStatusCode["TooEarly"] = 425] = "TooEarly";
|
|
54
|
+
HttpStatusCode[HttpStatusCode["UpgradeRequired"] = 426] = "UpgradeRequired";
|
|
55
|
+
HttpStatusCode[HttpStatusCode["PreconditionRequired"] = 428] = "PreconditionRequired";
|
|
56
|
+
HttpStatusCode[HttpStatusCode["TooManyRequests"] = 429] = "TooManyRequests";
|
|
57
|
+
HttpStatusCode[HttpStatusCode["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
|
|
58
|
+
HttpStatusCode[HttpStatusCode["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
|
|
59
|
+
HttpStatusCode[HttpStatusCode["InternalServerError"] = 500] = "InternalServerError";
|
|
60
|
+
HttpStatusCode[HttpStatusCode["NotImplemented"] = 501] = "NotImplemented";
|
|
61
|
+
HttpStatusCode[HttpStatusCode["BadGateway"] = 502] = "BadGateway";
|
|
62
|
+
HttpStatusCode[HttpStatusCode["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|
63
|
+
HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
64
|
+
HttpStatusCode[HttpStatusCode["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
|
|
65
|
+
HttpStatusCode[HttpStatusCode["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
|
|
66
|
+
HttpStatusCode[HttpStatusCode["InsufficientStorage"] = 507] = "InsufficientStorage";
|
|
67
|
+
HttpStatusCode[HttpStatusCode["LoopDetected"] = 508] = "LoopDetected";
|
|
68
|
+
HttpStatusCode[HttpStatusCode["NotExtended"] = 510] = "NotExtended";
|
|
69
|
+
HttpStatusCode[HttpStatusCode["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
|
|
70
|
+
})(HttpStatusCode || (exports.HttpStatusCode = HttpStatusCode = {}));
|
|
71
|
+
class HttpError extends Error {
|
|
72
|
+
constructor(status, details) {
|
|
73
|
+
super((details === null || details === void 0 ? void 0 : details.message) || "Not found");
|
|
74
|
+
this.details = details;
|
|
75
|
+
this.status = status;
|
|
76
|
+
Object.setPrototypeOf(this, HttpError.prototype);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.HttpError = HttpError;
|
|
80
|
+
class NotFoundError extends HttpError {
|
|
81
|
+
constructor(details) {
|
|
82
|
+
super(HttpStatusCode.NotFound, details);
|
|
83
|
+
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.NotFoundError = NotFoundError;
|
|
87
|
+
class UnauthorizedError extends HttpError {
|
|
88
|
+
constructor(details) {
|
|
89
|
+
super(HttpStatusCode.Unauthorized, details);
|
|
90
|
+
Object.setPrototypeOf(this, UnauthorizedError.prototype);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
94
|
+
class ConflictError extends HttpError {
|
|
95
|
+
constructor(details) {
|
|
96
|
+
super(HttpStatusCode.Conflict, details);
|
|
97
|
+
Object.setPrototypeOf(this, ConflictError.prototype);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.ConflictError = ConflictError;
|
|
101
|
+
function convertErrorDetails(messageOrDetails) {
|
|
102
|
+
let details;
|
|
103
|
+
if (messageOrDetails) {
|
|
104
|
+
if (typeof messageOrDetails === "string") {
|
|
105
|
+
details = {
|
|
106
|
+
message: messageOrDetails,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
details = messageOrDetails;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return details;
|
|
114
|
+
}
|
|
115
|
+
const Errors = {
|
|
116
|
+
NotFound404: (messageOrDetails) => {
|
|
117
|
+
return new NotFoundError(convertErrorDetails(messageOrDetails));
|
|
118
|
+
},
|
|
119
|
+
Unauthorized401: (messageOrDetails) => {
|
|
120
|
+
return new UnauthorizedError(convertErrorDetails(messageOrDetails));
|
|
121
|
+
},
|
|
122
|
+
HttpError: (errorCode, messageOrDetails) => {
|
|
123
|
+
return new HttpError(errorCode, convertErrorDetails(messageOrDetails));
|
|
124
|
+
},
|
|
125
|
+
Conflict409: (messageOrDetails) => {
|
|
126
|
+
return new ConflictError(convertErrorDetails(messageOrDetails));
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
exports.default = Errors;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.InMemoryDb = void 0;
|
|
13
|
+
class InMemoryDb {
|
|
14
|
+
constructor(tables, initialData = {}, config) {
|
|
15
|
+
this.tables = tables;
|
|
16
|
+
this.initialData = initialData;
|
|
17
|
+
this.config = config;
|
|
18
|
+
}
|
|
19
|
+
getItems(collectionName) {
|
|
20
|
+
throw new Error("Method not implemented.");
|
|
21
|
+
}
|
|
22
|
+
getItem(collectionName, predicate) {
|
|
23
|
+
throw new Error("Method not implemented.");
|
|
24
|
+
}
|
|
25
|
+
getItemById(collectionName, id) {
|
|
26
|
+
throw new Error("Method not implemented.");
|
|
27
|
+
}
|
|
28
|
+
deleteItems(collectionName, predicate) {
|
|
29
|
+
throw new Error("Method not implemented.");
|
|
30
|
+
}
|
|
31
|
+
insertItem(collectionName, item) {
|
|
32
|
+
throw new Error("Method not implemented.");
|
|
33
|
+
}
|
|
34
|
+
updateItem(collectionName, item) {
|
|
35
|
+
throw new Error("Method not implemented.");
|
|
36
|
+
}
|
|
37
|
+
initialize() {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.InMemoryDb = InMemoryDb;
|