remult 2.7.34 → 3.0.0-next.2
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/README.md +2 -2
- package/esm/remult-express.js +3 -1
- package/esm/remult-fastify.js +3 -1
- package/esm/remult-hapi.js +3 -1
- package/esm/remult-hono.js +3 -1
- package/esm/remult-next.js +2 -1
- package/esm/remult-nuxt.js +2 -1
- package/esm/remult-solid-start.js +2 -1
- package/esm/remult-sveltekit.js +2 -1
- package/esm/server/get-remult-admin-html.js +1 -1
- package/esm/src/buildRestDataProvider.js +2 -26
- package/esm/src/context.js +4 -2
- package/esm/src/data-providers/rest-data-provider-using-fetch.js +78 -0
- package/esm/src/data-providers/rest-data-provider.js +1 -78
- package/esm/src/data-providers/retry.js +25 -0
- package/esm/src/filter/entityDbName.js +18 -0
- package/esm/src/filter/fieldDbName.js +40 -0
- package/esm/src/filter/filter-consumer-bridge-to-sql-request.js +2 -58
- package/esm/src/remult3/RepositoryImplementation.js +2 -1
- package/esm/src/validators.js +1 -1
- package/package.json +1 -1
- package/remult-express.d.ts +4 -3
- package/remult-express.js +5 -2
- package/remult-fastify.d.ts +2 -1
- package/remult-fastify.js +5 -2
- package/remult-hapi.d.ts +2 -1
- package/remult-hapi.js +5 -2
- package/remult-hono.d.ts +2 -1
- package/remult-hono.js +5 -2
- package/remult-next.d.ts +2 -1
- package/remult-next.js +4 -2
- package/remult-nuxt.d.ts +2 -1
- package/remult-nuxt.js +4 -2
- package/remult-solid-start.d.ts +2 -1
- package/remult-solid-start.js +4 -2
- package/remult-sveltekit.d.ts +2 -1
- package/remult-sveltekit.js +4 -2
- package/server/get-remult-admin-html.js +1 -1
- package/server/remult-api-server.d.ts +1 -1
- package/src/buildRestDataProvider.d.ts +0 -1
- package/src/buildRestDataProvider.js +6 -46
- package/src/context.js +5 -2
- package/src/data-providers/rest-data-provider-using-fetch.d.ts +13 -0
- package/src/data-providers/rest-data-provider-using-fetch.js +119 -0
- package/src/data-providers/rest-data-provider.d.ts +0 -12
- package/src/data-providers/rest-data-provider.js +1 -115
- package/src/data-providers/retry.d.ts +1 -0
- package/src/data-providers/retry.js +44 -0
- package/src/entity.d.ts +13 -0
- package/src/filter/entityDbName.d.ts +2 -0
- package/src/filter/entityDbName.js +32 -0
- package/src/filter/fieldDbName.d.ts +3 -0
- package/src/filter/fieldDbName.js +58 -0
- package/src/filter/filter-consumer-bridge-to-sql-request.d.ts +0 -2
- package/src/filter/filter-consumer-bridge-to-sql-request.js +4 -86
- package/src/remult3/RepositoryImplementation.js +4 -3
- package/src/validators.js +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RestDataProviderHttpProviderUsingFetch } from './data-providers/rest-data-provider.js';
|
|
2
|
-
import {
|
|
1
|
+
import { RestDataProviderHttpProviderUsingFetch } from './data-providers/rest-data-provider-using-fetch.js';
|
|
2
|
+
import { retry } from './data-providers/retry.js';
|
|
3
3
|
export function buildRestDataProvider(provider) {
|
|
4
4
|
if (!provider)
|
|
5
5
|
return new RestDataProviderHttpProviderUsingFetch();
|
|
@@ -40,30 +40,6 @@ export class HttpProviderBridgeToRestDataProviderHttpProvider {
|
|
|
40
40
|
return await retry(() => toPromise(this.http.get(url)));
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
export async function retry(what) {
|
|
44
|
-
let i = 0;
|
|
45
|
-
while (true) {
|
|
46
|
-
try {
|
|
47
|
-
return await what();
|
|
48
|
-
}
|
|
49
|
-
catch (err) {
|
|
50
|
-
if ((err.message?.startsWith('Error occurred while trying to proxy') ||
|
|
51
|
-
err.message?.startsWith('Error occured while trying to proxy') ||
|
|
52
|
-
err.message?.includes('http proxy error') ||
|
|
53
|
-
err.message?.startsWith('Gateway Timeout') ||
|
|
54
|
-
err.status == 500) &&
|
|
55
|
-
i++ < flags.error500RetryCount) {
|
|
56
|
-
await new Promise((res, req) => {
|
|
57
|
-
setTimeout(() => {
|
|
58
|
-
res({});
|
|
59
|
-
}, 500);
|
|
60
|
-
});
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
throw err;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
43
|
export function toPromise(p) {
|
|
68
44
|
let r;
|
|
69
45
|
if (p['toPromise'] !== undefined) {
|
package/esm/src/context.js
CHANGED
|
@@ -64,14 +64,16 @@ export class Remult {
|
|
|
64
64
|
* @param dataProvider - an optional alternative data provider to use. Useful for writing to offline storage or an alternative data provider
|
|
65
65
|
*/
|
|
66
66
|
repo = (entity, dataProvider) => {
|
|
67
|
+
const info = createOldEntity(entity, this);
|
|
67
68
|
if (dataProvider === undefined)
|
|
68
|
-
dataProvider =
|
|
69
|
+
dataProvider =
|
|
70
|
+
info?.options?.dataProvider?.(this.dataProvider) ?? this.dataProvider;
|
|
69
71
|
let dpCache = this.repCache.get(dataProvider);
|
|
70
72
|
if (!dpCache)
|
|
71
73
|
this.repCache.set(dataProvider, (dpCache = new Map()));
|
|
72
74
|
let r = dpCache.get(entity);
|
|
73
75
|
if (!r) {
|
|
74
|
-
dpCache.set(entity, (r = new RepositoryImplementation(entity, this, dataProvider,
|
|
76
|
+
dpCache.set(entity, (r = new RepositoryImplementation(entity, this, dataProvider, info)));
|
|
75
77
|
verifyFieldRelationInfo(r, this, dataProvider);
|
|
76
78
|
}
|
|
77
79
|
return r;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { retry } from './retry.js';
|
|
2
|
+
export class RestDataProviderHttpProviderUsingFetch {
|
|
3
|
+
fetch;
|
|
4
|
+
constructor(fetch) {
|
|
5
|
+
this.fetch = fetch;
|
|
6
|
+
}
|
|
7
|
+
async get(url) {
|
|
8
|
+
return await retry(async () => this.myFetch(url).then((r) => {
|
|
9
|
+
return r;
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
put(url, data) {
|
|
13
|
+
return this.myFetch(url, {
|
|
14
|
+
method: 'put',
|
|
15
|
+
body: JSON.stringify(data),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
delete(url) {
|
|
19
|
+
return this.myFetch(url, { method: 'delete' });
|
|
20
|
+
}
|
|
21
|
+
async post(url, data) {
|
|
22
|
+
return await retry(() => this.myFetch(url, {
|
|
23
|
+
method: 'post',
|
|
24
|
+
body: JSON.stringify(data),
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
myFetch(url, options) {
|
|
28
|
+
const headers = {};
|
|
29
|
+
if (options?.body)
|
|
30
|
+
headers['Content-type'] = 'application/json';
|
|
31
|
+
if (typeof window !== 'undefined' &&
|
|
32
|
+
typeof window.document !== 'undefined' &&
|
|
33
|
+
typeof (window.document.cookie !== 'undefined'))
|
|
34
|
+
for (const cookie of window.document.cookie.split(';')) {
|
|
35
|
+
if (cookie.trim().startsWith('XSRF-TOKEN=')) {
|
|
36
|
+
headers['X-XSRF-TOKEN'] = cookie.split('=')[1];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return (this.fetch || fetch)(url, {
|
|
40
|
+
credentials: 'include',
|
|
41
|
+
method: options?.method,
|
|
42
|
+
body: options?.body,
|
|
43
|
+
headers,
|
|
44
|
+
})
|
|
45
|
+
.then((response) => {
|
|
46
|
+
return onSuccess(response);
|
|
47
|
+
})
|
|
48
|
+
.catch(async (error) => {
|
|
49
|
+
let r = await error;
|
|
50
|
+
throw r;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function onSuccess(response) {
|
|
55
|
+
if (response.status == 204)
|
|
56
|
+
return;
|
|
57
|
+
if (response.status >= 200 && response.status < 300)
|
|
58
|
+
return response.json();
|
|
59
|
+
else {
|
|
60
|
+
throw response
|
|
61
|
+
.json()
|
|
62
|
+
.then((x) => {
|
|
63
|
+
return {
|
|
64
|
+
...x,
|
|
65
|
+
message: x.message || response.statusText,
|
|
66
|
+
url: response.url,
|
|
67
|
+
status: response.status,
|
|
68
|
+
};
|
|
69
|
+
})
|
|
70
|
+
.catch(() => {
|
|
71
|
+
throw {
|
|
72
|
+
message: response.statusText,
|
|
73
|
+
url: response.url,
|
|
74
|
+
status: response.status,
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UrlBuilder } from '../../urlBuilder.js';
|
|
2
|
-
import { buildRestDataProvider
|
|
2
|
+
import { buildRestDataProvider } from '../buildRestDataProvider.js';
|
|
3
3
|
import { customUrlToken, Filter } from '../filter/filter-interfaces.js';
|
|
4
4
|
import { getRelationFieldInfo } from '../remult3/relationInfoMember.js';
|
|
5
5
|
import { remultStatic } from '../remult-static.js';
|
|
@@ -284,83 +284,6 @@ export class RestEntityDataProvider {
|
|
|
284
284
|
.then((y) => y.map((y) => this.translateFromJson(y)));
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
export class RestDataProviderHttpProviderUsingFetch {
|
|
288
|
-
fetch;
|
|
289
|
-
constructor(fetch) {
|
|
290
|
-
this.fetch = fetch;
|
|
291
|
-
}
|
|
292
|
-
async get(url) {
|
|
293
|
-
return await retry(async () => this.myFetch(url).then((r) => {
|
|
294
|
-
return r;
|
|
295
|
-
}));
|
|
296
|
-
}
|
|
297
|
-
put(url, data) {
|
|
298
|
-
return this.myFetch(url, {
|
|
299
|
-
method: 'put',
|
|
300
|
-
body: JSON.stringify(data),
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
delete(url) {
|
|
304
|
-
return this.myFetch(url, { method: 'delete' });
|
|
305
|
-
}
|
|
306
|
-
async post(url, data) {
|
|
307
|
-
return await retry(() => this.myFetch(url, {
|
|
308
|
-
method: 'post',
|
|
309
|
-
body: JSON.stringify(data),
|
|
310
|
-
}));
|
|
311
|
-
}
|
|
312
|
-
myFetch(url, options) {
|
|
313
|
-
const headers = {};
|
|
314
|
-
if (options?.body)
|
|
315
|
-
headers['Content-type'] = 'application/json';
|
|
316
|
-
if (typeof window !== 'undefined' &&
|
|
317
|
-
typeof window.document !== 'undefined' &&
|
|
318
|
-
typeof (window.document.cookie !== 'undefined'))
|
|
319
|
-
for (const cookie of window.document.cookie.split(';')) {
|
|
320
|
-
if (cookie.trim().startsWith('XSRF-TOKEN=')) {
|
|
321
|
-
headers['X-XSRF-TOKEN'] = cookie.split('=')[1];
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
return (this.fetch || fetch)(url, {
|
|
325
|
-
credentials: 'include',
|
|
326
|
-
method: options?.method,
|
|
327
|
-
body: options?.body,
|
|
328
|
-
headers,
|
|
329
|
-
})
|
|
330
|
-
.then((response) => {
|
|
331
|
-
return onSuccess(response);
|
|
332
|
-
})
|
|
333
|
-
.catch(async (error) => {
|
|
334
|
-
let r = await error;
|
|
335
|
-
throw r;
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
function onSuccess(response) {
|
|
340
|
-
if (response.status == 204)
|
|
341
|
-
return;
|
|
342
|
-
if (response.status >= 200 && response.status < 300)
|
|
343
|
-
return response.json();
|
|
344
|
-
else {
|
|
345
|
-
throw response
|
|
346
|
-
.json()
|
|
347
|
-
.then((x) => {
|
|
348
|
-
return {
|
|
349
|
-
...x,
|
|
350
|
-
message: x.message || response.statusText,
|
|
351
|
-
url: response.url,
|
|
352
|
-
status: response.status,
|
|
353
|
-
};
|
|
354
|
-
})
|
|
355
|
-
.catch(() => {
|
|
356
|
-
throw {
|
|
357
|
-
message: response.statusText,
|
|
358
|
-
url: response.url,
|
|
359
|
-
status: response.status,
|
|
360
|
-
};
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
287
|
export function addFilterToUrlAndReturnTrueIfSuccessful(filter, url) {
|
|
365
288
|
for (const key in filter) {
|
|
366
289
|
if (Object.prototype.hasOwnProperty.call(filter, key)) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { flags } from '../remult3/remult3.js';
|
|
2
|
+
export async function retry(what) {
|
|
3
|
+
let i = 0;
|
|
4
|
+
while (true) {
|
|
5
|
+
try {
|
|
6
|
+
return await what();
|
|
7
|
+
}
|
|
8
|
+
catch (err) {
|
|
9
|
+
if ((err.message?.startsWith('Error occurred while trying to proxy') ||
|
|
10
|
+
err.message?.startsWith('Error occured while trying to proxy') ||
|
|
11
|
+
err.message?.includes('http proxy error') ||
|
|
12
|
+
err.message?.startsWith('Gateway Timeout') ||
|
|
13
|
+
err.status == 500) &&
|
|
14
|
+
i++ < flags.error500RetryCount) {
|
|
15
|
+
await new Promise((res, req) => {
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
res({});
|
|
18
|
+
}, 500);
|
|
19
|
+
});
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
throw err;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export async function entityDbName(metadata, wrapIdentifier = (x) => x) {
|
|
2
|
+
if (metadata.options.sqlExpression) {
|
|
3
|
+
if (typeof metadata.options.sqlExpression === 'string')
|
|
4
|
+
return metadata.options.sqlExpression;
|
|
5
|
+
else if (typeof metadata.options.sqlExpression === 'function') {
|
|
6
|
+
const prev = metadata.options.sqlExpression;
|
|
7
|
+
try {
|
|
8
|
+
metadata.options.sqlExpression =
|
|
9
|
+
"recursive sqlExpression call for entity '" + metadata.key + "'. ";
|
|
10
|
+
return await prev(metadata);
|
|
11
|
+
}
|
|
12
|
+
finally {
|
|
13
|
+
metadata.options.sqlExpression = prev;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return wrapIdentifier(metadata.dbName);
|
|
18
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { getRelationFieldInfo } from '../remult3/relationInfoMember.js';
|
|
2
|
+
const sqlExpressionInProgressKey = Symbol.for(`sqlExpressionInProgressKey`);
|
|
3
|
+
export async function fieldDbName(f, meta, wrapIdentifier = (x) => x, forceSqlExpression = false) {
|
|
4
|
+
try {
|
|
5
|
+
if (f.options.sqlExpression) {
|
|
6
|
+
let result;
|
|
7
|
+
if (typeof f.options.sqlExpression === 'function') {
|
|
8
|
+
if (f[sqlExpressionInProgressKey] && !forceSqlExpression) {
|
|
9
|
+
return "recursive sqlExpression call for field '" + f.key + "'. \0";
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
;
|
|
13
|
+
f[sqlExpressionInProgressKey] = true;
|
|
14
|
+
result = await f.options.sqlExpression(meta);
|
|
15
|
+
if (!result.includes('\0'))
|
|
16
|
+
f.options.sqlExpression = () => result;
|
|
17
|
+
}
|
|
18
|
+
finally {
|
|
19
|
+
delete f[sqlExpressionInProgressKey];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else
|
|
23
|
+
result = f.options.sqlExpression;
|
|
24
|
+
if (!result)
|
|
25
|
+
return f.dbName;
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
const rel = getRelationFieldInfo(f);
|
|
29
|
+
let field = rel?.type === 'toOne' &&
|
|
30
|
+
f.options.field;
|
|
31
|
+
if (field) {
|
|
32
|
+
let fInfo = meta.fields.find(field);
|
|
33
|
+
if (fInfo)
|
|
34
|
+
return fieldDbName(fInfo, meta, wrapIdentifier, forceSqlExpression);
|
|
35
|
+
}
|
|
36
|
+
return wrapIdentifier(f.dbName);
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { SqlDatabase } from '../data-providers/sql-database.js';
|
|
2
2
|
import { remult } from '../remult-proxy.js';
|
|
3
3
|
import { getEntityMetadata } from '../remult3/RepositoryImplementation.js';
|
|
4
|
-
import {
|
|
4
|
+
import { entityDbName } from './entityDbName.js';
|
|
5
|
+
import { fieldDbName } from './fieldDbName.js';
|
|
5
6
|
export class FilterConsumerBridgeToSqlRequest {
|
|
6
7
|
r;
|
|
7
8
|
nameProvider;
|
|
@@ -260,60 +261,3 @@ async function internalDbNamesOf(repo, wrapIdentifierOrOptions, forceSqlExpressi
|
|
|
260
261
|
}
|
|
261
262
|
return result;
|
|
262
263
|
}
|
|
263
|
-
export async function entityDbName(metadata, wrapIdentifier = (x) => x) {
|
|
264
|
-
if (metadata.options.sqlExpression) {
|
|
265
|
-
if (typeof metadata.options.sqlExpression === 'string')
|
|
266
|
-
return metadata.options.sqlExpression;
|
|
267
|
-
else if (typeof metadata.options.sqlExpression === 'function') {
|
|
268
|
-
const prev = metadata.options.sqlExpression;
|
|
269
|
-
try {
|
|
270
|
-
metadata.options.sqlExpression =
|
|
271
|
-
"recursive sqlExpression call for entity '" + metadata.key + "'. ";
|
|
272
|
-
return await prev(metadata);
|
|
273
|
-
}
|
|
274
|
-
finally {
|
|
275
|
-
metadata.options.sqlExpression = prev;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
return wrapIdentifier(metadata.dbName);
|
|
280
|
-
}
|
|
281
|
-
const sqlExpressionInProgressKey = Symbol.for(`sqlExpressionInProgressKey`);
|
|
282
|
-
export async function fieldDbName(f, meta, wrapIdentifier = (x) => x, forceSqlExpression = false) {
|
|
283
|
-
try {
|
|
284
|
-
if (f.options.sqlExpression) {
|
|
285
|
-
let result;
|
|
286
|
-
if (typeof f.options.sqlExpression === 'function') {
|
|
287
|
-
if (f[sqlExpressionInProgressKey] && !forceSqlExpression) {
|
|
288
|
-
return "recursive sqlExpression call for field '" + f.key + "'. \0";
|
|
289
|
-
}
|
|
290
|
-
try {
|
|
291
|
-
;
|
|
292
|
-
f[sqlExpressionInProgressKey] = true;
|
|
293
|
-
result = await f.options.sqlExpression(meta);
|
|
294
|
-
if (!result.includes('\0'))
|
|
295
|
-
f.options.sqlExpression = () => result;
|
|
296
|
-
}
|
|
297
|
-
finally {
|
|
298
|
-
delete f[sqlExpressionInProgressKey];
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
else
|
|
302
|
-
result = f.options.sqlExpression;
|
|
303
|
-
if (!result)
|
|
304
|
-
return f.dbName;
|
|
305
|
-
return result;
|
|
306
|
-
}
|
|
307
|
-
const rel = getRelationFieldInfo(f);
|
|
308
|
-
let field = rel?.type === 'toOne' &&
|
|
309
|
-
f.options.field;
|
|
310
|
-
if (field) {
|
|
311
|
-
let fInfo = meta.fields.find(field);
|
|
312
|
-
if (fInfo)
|
|
313
|
-
return fieldDbName(fInfo, meta, wrapIdentifier, forceSqlExpression);
|
|
314
|
-
}
|
|
315
|
-
return wrapIdentifier(f.dbName);
|
|
316
|
-
}
|
|
317
|
-
finally {
|
|
318
|
-
}
|
|
319
|
-
}
|
|
@@ -14,7 +14,8 @@ import { __updateEntityBasedOnWhere } from './__updateEntityBasedOnWhere.js';
|
|
|
14
14
|
import { getRelationFieldInfo, } from './relationInfoMember.js';
|
|
15
15
|
import { RelationLoader } from './relation-loader.js';
|
|
16
16
|
import { getInternalKey, } from './repository-internals.js';
|
|
17
|
-
import { entityDbName
|
|
17
|
+
import { entityDbName } from '../filter/entityDbName.js';
|
|
18
|
+
import { fieldDbName } from '../filter/fieldDbName.js';
|
|
18
19
|
import { remultStatic } from '../remult-static.js';
|
|
19
20
|
import { Validators } from '../validators.js';
|
|
20
21
|
import { addValidator } from './addValidator.js';
|
package/esm/src/validators.js
CHANGED
package/package.json
CHANGED
package/remult-express.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as express from 'express';
|
|
2
2
|
import type { RemultServer, RemultServerCore, RemultServerOptions } from './server/remult-api-server.js';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function remultApi(options?: RemultServerOptions<express.Request> & {
|
|
4
4
|
bodyParser?: boolean;
|
|
5
5
|
bodySizeLimit?: string;
|
|
6
|
-
}):
|
|
7
|
-
export type
|
|
6
|
+
}): remultApiServer;
|
|
7
|
+
export type remultApiServer = express.RequestHandler & RemultServerCore<express.Request> & {
|
|
8
8
|
withRemult: (req: express.Request, res: express.Response, next: VoidFunction) => void;
|
|
9
9
|
} & Pick<RemultServer<express.Request>, 'withRemultAsync'>;
|
|
10
|
+
export declare const remultExpress: typeof remultApi;
|
package/remult-express.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.remultExpress =
|
|
3
|
+
exports.remultExpress = void 0;
|
|
4
|
+
exports.remultApi = remultApi;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
6
|
var express = tslib_1.__importStar(require("express"));
|
|
6
7
|
var index_js_1 = require("./server/index.js");
|
|
7
|
-
function
|
|
8
|
+
function remultApi(options) {
|
|
8
9
|
var _this = this;
|
|
9
10
|
var app = express.Router();
|
|
10
11
|
if (!options) {
|
|
@@ -33,3 +34,5 @@ function remultExpress(options) {
|
|
|
33
34
|
},
|
|
34
35
|
});
|
|
35
36
|
}
|
|
37
|
+
// @deprecated use remultApi instead
|
|
38
|
+
exports.remultExpress = remultApi;
|
package/remult-fastify.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { FastifyPluginCallback, FastifyRequest } from 'fastify';
|
|
2
2
|
import type { RemultServerCore, RemultServerOptions, RemultServer } from './server/remult-api-server.js';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function remultApi(options: RemultServerOptions<FastifyRequest>): RemultFastifyServer;
|
|
4
4
|
export type RemultFastifyServer = FastifyPluginCallback & RemultServerCore<FastifyRequest> & {
|
|
5
5
|
withRemult: RemultServer<FastifyRequest>['withRemultAsync'];
|
|
6
6
|
};
|
|
7
|
+
export declare const remultFastify: typeof remultApi;
|
package/remult-fastify.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.remultFastify =
|
|
3
|
+
exports.remultFastify = void 0;
|
|
4
|
+
exports.remultApi = remultApi;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
6
|
var index_js_1 = require("./server/index.js");
|
|
6
|
-
function
|
|
7
|
+
function remultApi(options) {
|
|
7
8
|
var _this = this;
|
|
8
9
|
function fastifyHandler(handler) {
|
|
9
10
|
var response = function (req, res) {
|
|
@@ -81,3 +82,5 @@ function remultFastify(options) {
|
|
|
81
82
|
},
|
|
82
83
|
});
|
|
83
84
|
}
|
|
85
|
+
// @deprecated use remultApi instead
|
|
86
|
+
exports.remultFastify = remultApi;
|
package/remult-hapi.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Request, Plugin } from '@hapi/hapi';
|
|
2
2
|
import { type RemultServerCore, type RemultServerOptions, type RemultServer } from './server/index.js';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function remultApi(options: RemultServerOptions<Request>): RemultHapiServer;
|
|
4
4
|
export type RemultHapiServer = Plugin<any, any> & RemultServerCore<Request> & {
|
|
5
5
|
withRemult: RemultServer<Request>['withRemultAsync'];
|
|
6
6
|
};
|
|
7
|
+
export declare const remultHapi: typeof remultApi;
|
package/remult-hapi.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.remultHapi =
|
|
3
|
+
exports.remultHapi = void 0;
|
|
4
|
+
exports.remultApi = remultApi;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
6
|
var index_js_1 = require("./server/index.js");
|
|
6
7
|
var stream_1 = require("stream");
|
|
7
|
-
function
|
|
8
|
+
function remultApi(options) {
|
|
8
9
|
var _this = this;
|
|
9
10
|
var api = (0, index_js_1.createRemultServer)(options, {
|
|
10
11
|
buildGenericRequestInfo: function (req) { return ({
|
|
@@ -125,3 +126,5 @@ function remultHapi(options) {
|
|
|
125
126
|
},
|
|
126
127
|
});
|
|
127
128
|
}
|
|
129
|
+
// @deprecated use remultApi instead
|
|
130
|
+
exports.remultHapi = remultApi;
|
package/remult-hono.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type Context, type Env, Hono } from 'hono';
|
|
2
2
|
import type { BlankInput } from 'hono/types';
|
|
3
3
|
import { type RemultServerOptions, type RemultServerCore } from './server/index.js';
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function remultApi(options: RemultServerOptions<Context<Env, '', BlankInput>>): RemultHonoServer;
|
|
5
5
|
export type RemultHonoServer = Hono & RemultServerCore<Context<Env, '', BlankInput>> & {
|
|
6
6
|
withRemult: <T>(c: Context<Env, '', BlankInput>, what: () => Promise<T>) => Promise<T>;
|
|
7
7
|
};
|
|
8
|
+
export declare const remultHono: typeof remultApi;
|
package/remult-hono.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.remultHono =
|
|
3
|
+
exports.remultHono = void 0;
|
|
4
|
+
exports.remultApi = remultApi;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
6
|
var hono_1 = require("hono");
|
|
6
7
|
var streaming_1 = require("hono/streaming");
|
|
7
8
|
var index_js_1 = require("./server/index.js");
|
|
8
|
-
function
|
|
9
|
+
function remultApi(options) {
|
|
9
10
|
var _this = this;
|
|
10
11
|
var app = new hono_1.Hono();
|
|
11
12
|
var api = (0, index_js_1.createRemultServer)(options, {
|
|
@@ -113,3 +114,5 @@ function remultHono(options) {
|
|
|
113
114
|
}); }); },
|
|
114
115
|
});
|
|
115
116
|
}
|
|
117
|
+
// @deprecated use remultApi instead
|
|
118
|
+
exports.remultHono = remultApi;
|
package/remult-next.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type RemultNextServer = RemultServerCore<NextApiRequest> & NextApiHandler
|
|
|
15
15
|
*/
|
|
16
16
|
handle<T>(handler: NextApiHandler<T>): NextApiHandler<T>;
|
|
17
17
|
};
|
|
18
|
-
export declare function
|
|
18
|
+
export declare function remultApi(options?: RemultServerOptions<Request>): RemultNextAppServer;
|
|
19
19
|
export type RemultNextAppServer = RemultServerCore<Request> & {
|
|
20
20
|
GET: (req: Request) => Promise<Response | undefined>;
|
|
21
21
|
PUT: (req: Request) => Promise<Response | undefined>;
|
|
@@ -23,3 +23,4 @@ export type RemultNextAppServer = RemultServerCore<Request> & {
|
|
|
23
23
|
DELETE: (req: Request) => Promise<Response | undefined>;
|
|
24
24
|
withRemult<T>(what: () => Promise<T>): Promise<T>;
|
|
25
25
|
};
|
|
26
|
+
export declare const remultNextApp: typeof remultApi;
|
package/remult-next.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.remultNextApp = void 0;
|
|
3
4
|
exports.remultNext = remultNext;
|
|
4
|
-
exports.
|
|
5
|
+
exports.remultApi = remultApi;
|
|
5
6
|
var tslib_1 = require("tslib");
|
|
6
7
|
var index_js_1 = require("./server/index.js");
|
|
7
8
|
function remultNext(options) {
|
|
@@ -78,7 +79,7 @@ function remultNext(options) {
|
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
81
|
var encoder = new TextEncoder();
|
|
81
|
-
function
|
|
82
|
+
function remultApi(options) {
|
|
82
83
|
var _this = this;
|
|
83
84
|
var result = (0, index_js_1.createRemultServer)(options, {
|
|
84
85
|
getRequestBody: function (req) { return req.json(); },
|
|
@@ -183,3 +184,4 @@ function remultNextApp(options) {
|
|
|
183
184
|
},
|
|
184
185
|
};
|
|
185
186
|
}
|
|
187
|
+
exports.remultNextApp = remultApi;
|
package/remult-nuxt.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { H3Event } from 'h3';
|
|
2
2
|
import type { RemultServerCore, RemultServerOptions, RemultServer } from './server/index.js';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function remultApi(options: RemultServerOptions<H3Event>): RemultNuxtServer;
|
|
4
4
|
export type RemultNuxtServer = RemultServerCore<H3Event> & ((event: H3Event) => Promise<any>) & {
|
|
5
5
|
withRemult: RemultServer<H3Event>['withRemultAsync'];
|
|
6
6
|
};
|
|
7
|
+
export declare const remultNuxt: typeof remultApi;
|
package/remult-nuxt.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.remultNuxt =
|
|
3
|
+
exports.remultNuxt = void 0;
|
|
4
|
+
exports.remultApi = remultApi;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
6
|
var h3_1 = require("h3");
|
|
6
7
|
var index_js_1 = require("./server/index.js");
|
|
7
|
-
function
|
|
8
|
+
function remultApi(options) {
|
|
8
9
|
var _this = this;
|
|
9
10
|
var result = (0, index_js_1.createRemultServer)(options, {
|
|
10
11
|
buildGenericRequestInfo: function (event) {
|
|
@@ -76,3 +77,4 @@ function remultNuxt(options) {
|
|
|
76
77
|
},
|
|
77
78
|
});
|
|
78
79
|
}
|
|
80
|
+
exports.remultNuxt = remultApi;
|
package/remult-solid-start.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type RequestEvent } from 'solid-js/web';
|
|
2
2
|
import type { RemultServerCore, RemultServerOptions } from './server/index.js';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function remultApi(options: RemultServerOptions<RequestEvent>): RemultSolidStartServer;
|
|
4
4
|
type RequestHandler = (event: RequestEvent) => Promise<Response>;
|
|
5
5
|
export type RemultSolidStartServer = RemultServerCore<RequestEvent> & {
|
|
6
6
|
withRemult<T>(what: () => Promise<T>): Promise<T>;
|
|
@@ -9,4 +9,5 @@ export type RemultSolidStartServer = RemultServerCore<RequestEvent> & {
|
|
|
9
9
|
POST: RequestHandler;
|
|
10
10
|
DELETE: RequestHandler;
|
|
11
11
|
};
|
|
12
|
+
export declare const remultSolidStart: typeof remultApi;
|
|
12
13
|
export {};
|
package/remult-solid-start.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.remultSolidStart =
|
|
3
|
+
exports.remultSolidStart = void 0;
|
|
4
|
+
exports.remultApi = remultApi;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
6
|
var web_1 = require("solid-js/web");
|
|
6
7
|
var index_js_1 = require("./server/index.js");
|
|
7
|
-
function
|
|
8
|
+
function remultApi(options) {
|
|
8
9
|
var _this = this;
|
|
9
10
|
var result = (0, index_js_1.createRemultServer)(options, {
|
|
10
11
|
buildGenericRequestInfo: function (event) { return ({
|
|
@@ -131,3 +132,4 @@ function remultSolidStart(options) {
|
|
|
131
132
|
DELETE: serverHandler,
|
|
132
133
|
});
|
|
133
134
|
}
|
|
135
|
+
exports.remultSolidStart = remultApi;
|
package/remult-sveltekit.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Handle, RequestEvent, RequestHandler } from '@sveltejs/kit';
|
|
2
2
|
import type { RemultServerCore, RemultServerOptions, RemultServer } from './server/index.js';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function remultApi(options: RemultServerOptions<RequestEvent>): RemultSveltekitServer;
|
|
4
4
|
export type RemultSveltekitServer = RemultServerCore<RequestEvent> & Handle & {
|
|
5
5
|
withRemult: RemultServer<RequestEvent>['withRemultAsync'];
|
|
6
6
|
GET: RequestHandler;
|
|
@@ -8,3 +8,4 @@ export type RemultSveltekitServer = RemultServerCore<RequestEvent> & Handle & {
|
|
|
8
8
|
POST: RequestHandler;
|
|
9
9
|
DELETE: RequestHandler;
|
|
10
10
|
};
|
|
11
|
+
export declare const remultSveltekit: typeof remultApi;
|