orange-orm 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/build.js +84 -11
- package/dist/index.browser.mjs +258 -6
- package/dist/index.mjs +276 -15
- package/docs/changelog.md +5 -0
- package/package.json +5 -6
- package/src/bunPg/newDatabase.js +2 -1
- package/src/bunSqlite/newDatabase.js +2 -1
- package/src/client/createProviders.js +2 -1
- package/src/client/index.js +9 -0
- package/src/d1/newDatabase.js +2 -1
- package/src/getTSDefinition.js +68 -2
- package/src/hostHono.js +157 -0
- package/src/hostLocal.js +6 -1
- package/src/index.d.ts +30 -3
- package/src/index.js +3 -1
- package/src/indexBrowser.js +3 -1
- package/src/map2.d.ts +57 -2
- package/src/mssql/newDatabase.js +2 -1
- package/src/mySql/newDatabase.js +2 -1
- package/src/nodeSqlite/newDatabase.js +2 -1
- package/src/oracle/newDatabase.js +2 -1
- package/src/pg/newDatabase.js +2 -1
- package/src/pglite/newDatabase.js +2 -1
- package/src/sap/newDatabase.js +2 -1
- package/src/sqlite3/newDatabase.js +2 -1
- package/src/tedious/newDatabase.js +2 -1
package/dist/index.mjs
CHANGED
|
@@ -122,6 +122,14 @@ export interface ${Name}ExpressConfig {
|
|
|
122
122
|
disableBulkDeletes?: boolean;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
export interface ${Name}HonoConfig {
|
|
126
|
+
baseFilter?: RawFilter | ((context: HonoContext) => RawFilter | Promise<RawFilter>);
|
|
127
|
+
customFilters?: Record<string, (context: HonoContext,...args: any[]) => RawFilter | Promise<RawFilter>>;
|
|
128
|
+
concurrency?: ${Name}Concurrency;
|
|
129
|
+
readonly?: boolean;
|
|
130
|
+
disableBulkDeletes?: boolean;
|
|
131
|
+
}
|
|
132
|
+
|
|
125
133
|
export interface ${Name}CustomFilters {
|
|
126
134
|
${getCustomFilters(customFilters)}
|
|
127
135
|
}
|
|
@@ -383,7 +391,7 @@ ${row}`;
|
|
|
383
391
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
384
392
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
385
393
|
import type { AxiosInterceptorManager, InternalAxiosRequestConfig, AxiosResponse } from 'axios';
|
|
386
|
-
import type { BooleanColumn, JSONColumn, UUIDColumn, DateColumn, NumberColumn, BinaryColumn, StringColumn, Concurrency, Filter, RawFilter, TransactionOptions, Pool, Express, Url, ColumnConcurrency, JsonPatch } from 'orange-orm';
|
|
394
|
+
import type { BooleanColumn, JSONColumn, UUIDColumn, DateColumn, NumberColumn, BinaryColumn, StringColumn, Concurrency, Filter, RawFilter, TransactionOptions, Pool, Express, Hono, Url, ColumnConcurrency, JsonPatch } from 'orange-orm';
|
|
387
395
|
export { RequestHandler } from 'express';
|
|
388
396
|
export { Concurrency, Filter, RawFilter, Config, TransactionOptions, Pool } from 'orange-orm';
|
|
389
397
|
export = r;
|
|
@@ -396,7 +404,7 @@ declare function r(config: Config): r.RdbClient;
|
|
|
396
404
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
397
405
|
import schema from './schema';
|
|
398
406
|
import type { AxiosInterceptorManager, InternalAxiosRequestConfig, AxiosResponse } from 'axios';
|
|
399
|
-
import type { BooleanColumn, JSONColumn, UUIDColumn, DateColumn, NumberColumn, BinaryColumn, StringColumn, Concurrency, Filter, RawFilter, TransactionOptions, Pool, Express, Url, ColumnConcurrency, JsonPatch } from 'orange-orm';
|
|
407
|
+
import type { BooleanColumn, JSONColumn, UUIDColumn, DateColumn, NumberColumn, BinaryColumn, StringColumn, Concurrency, Filter, RawFilter, TransactionOptions, Pool, Express, Hono, Url, ColumnConcurrency, JsonPatch } from 'orange-orm';
|
|
400
408
|
export default schema as RdbClient;`;
|
|
401
409
|
}
|
|
402
410
|
|
|
@@ -426,6 +434,8 @@ declare namespace r {${getTables(isHttp)}
|
|
|
426
434
|
const filter: Filter;
|
|
427
435
|
function express(): Express;
|
|
428
436
|
function express(config: ExpressConfig): Express;
|
|
437
|
+
function hono(): Hono;
|
|
438
|
+
function hono(config: HonoConfig): Hono;
|
|
429
439
|
`;
|
|
430
440
|
else
|
|
431
441
|
result += `
|
|
@@ -469,12 +479,41 @@ export interface ExpressConfig {
|
|
|
469
479
|
hooks?: ExpressHooks;
|
|
470
480
|
}
|
|
471
481
|
|
|
482
|
+
export interface HonoConfig {
|
|
483
|
+
db?: Pool | (() => Pool);
|
|
484
|
+
tables?: HonoTables;
|
|
485
|
+
concurrency?: Concurrency;
|
|
486
|
+
readonly?: boolean;
|
|
487
|
+
disableBulkDeletes?: boolean;
|
|
488
|
+
hooks?: HonoHooks;
|
|
489
|
+
}
|
|
490
|
+
|
|
472
491
|
export interface ExpressContext {
|
|
473
492
|
request: import('express').Request;
|
|
474
493
|
response: import('express').Response;
|
|
475
494
|
client: RdbClient;
|
|
476
495
|
}
|
|
477
496
|
|
|
497
|
+
export interface HonoRequest {
|
|
498
|
+
method: string;
|
|
499
|
+
query: Record<string, string>;
|
|
500
|
+
headers: Record<string, string>;
|
|
501
|
+
json(): Promise<unknown>;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export interface HonoResponse {
|
|
505
|
+
status(code: number): HonoResponse;
|
|
506
|
+
setHeader(name: string, value: string): HonoResponse;
|
|
507
|
+
json(value: unknown): unknown;
|
|
508
|
+
send(value: unknown): unknown;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
export interface HonoContext {
|
|
512
|
+
request: HonoRequest;
|
|
513
|
+
response: HonoResponse;
|
|
514
|
+
client: RdbClient;
|
|
515
|
+
}
|
|
516
|
+
|
|
478
517
|
export interface ExpressTransactionHooks {
|
|
479
518
|
beforeBegin?: (db: Pool, request: import('express').Request, response: import('express').Response) => void | Promise<void>;
|
|
480
519
|
afterBegin?: (db: Pool, request: import('express').Request, response: import('express').Response) => void | Promise<void>;
|
|
@@ -487,8 +526,23 @@ export interface ExpressHooks extends ExpressTransactionHooks {
|
|
|
487
526
|
transaction?: ExpressTransactionHooks;
|
|
488
527
|
}
|
|
489
528
|
|
|
529
|
+
export interface HonoTransactionHooks {
|
|
530
|
+
beforeBegin?: (db: Pool, request: HonoRequest, response: HonoResponse) => void | Promise<void>;
|
|
531
|
+
afterBegin?: (db: Pool, request: HonoRequest, response: HonoResponse) => void | Promise<void>;
|
|
532
|
+
beforeCommit?: (db: Pool, request: HonoRequest, response: HonoResponse) => void | Promise<void>;
|
|
533
|
+
afterCommit?: (db: Pool, request: HonoRequest, response: HonoResponse) => void | Promise<void>;
|
|
534
|
+
afterRollback?: (db: Pool, request: HonoRequest, response: HonoResponse, error?: unknown) => void | Promise<void>;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
export interface HonoHooks extends HonoTransactionHooks {
|
|
538
|
+
transaction?: HonoTransactionHooks;
|
|
539
|
+
}
|
|
540
|
+
|
|
490
541
|
export interface ExpressTables {${getExpressTables()}
|
|
491
542
|
}
|
|
543
|
+
|
|
544
|
+
export interface HonoTables {${getHonoTables()}
|
|
545
|
+
}
|
|
492
546
|
`;
|
|
493
547
|
function getConcurrencyTables() {
|
|
494
548
|
let result = '';
|
|
@@ -538,6 +592,8 @@ export interface ExpressTables {${getExpressTables()}
|
|
|
538
592
|
createPatch(original: any, modified: any): JsonPatch;
|
|
539
593
|
express(): Express;
|
|
540
594
|
express(config: ExpressConfig): Express;
|
|
595
|
+
hono(): Hono;
|
|
596
|
+
hono(config: HonoConfig): Hono;
|
|
541
597
|
readonly metaData: MetaData;`;
|
|
542
598
|
return result;
|
|
543
599
|
}
|
|
@@ -551,6 +607,16 @@ export interface ExpressTables {${getExpressTables()}
|
|
|
551
607
|
}
|
|
552
608
|
return result;
|
|
553
609
|
}
|
|
610
|
+
function getHonoTables() {
|
|
611
|
+
let result = '';
|
|
612
|
+
for (let name in tables) {
|
|
613
|
+
let Name = name.substring(0, 1).toUpperCase() + name.substring(1);
|
|
614
|
+
result +=
|
|
615
|
+
`
|
|
616
|
+
${name}?: boolean | ${Name}HonoConfig;`;
|
|
617
|
+
}
|
|
618
|
+
return result;
|
|
619
|
+
}
|
|
554
620
|
}
|
|
555
621
|
|
|
556
622
|
getTSDefinition_1 = getTSDefinition;
|
|
@@ -742,6 +808,172 @@ function requireHostExpress () {
|
|
|
742
808
|
return hostExpress_1;
|
|
743
809
|
}
|
|
744
810
|
|
|
811
|
+
var hostHono_1;
|
|
812
|
+
var hasRequiredHostHono;
|
|
813
|
+
|
|
814
|
+
function requireHostHono () {
|
|
815
|
+
if (hasRequiredHostHono) return hostHono_1;
|
|
816
|
+
hasRequiredHostHono = 1;
|
|
817
|
+
const getTSDefinition = requireGetTSDefinition();
|
|
818
|
+
const getMeta = requireGetMeta();
|
|
819
|
+
|
|
820
|
+
function hostHono(hostLocal, client, options = {}) {
|
|
821
|
+
if ('db' in options && (options.db ?? undefined) === undefined || !client.db)
|
|
822
|
+
throw new Error('No db specified');
|
|
823
|
+
const dbOptions = { db: options.db || client.db };
|
|
824
|
+
let c = {};
|
|
825
|
+
const readonly = { readonly: options.readonly };
|
|
826
|
+
const sharedHooks = options.hooks;
|
|
827
|
+
for (let tableName in client.tables) {
|
|
828
|
+
const tableOptions = options[tableName] || {};
|
|
829
|
+
const hooks = tableOptions.hooks || sharedHooks;
|
|
830
|
+
c[tableName] = hostLocal({
|
|
831
|
+
...dbOptions,
|
|
832
|
+
...readonly,
|
|
833
|
+
...tableOptions,
|
|
834
|
+
table: client.tables[tableName],
|
|
835
|
+
isHttp: true,
|
|
836
|
+
client,
|
|
837
|
+
hooks
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
async function handler(ctx) {
|
|
842
|
+
const request = createRequest(ctx);
|
|
843
|
+
const response = createResponse();
|
|
844
|
+
|
|
845
|
+
try {
|
|
846
|
+
if (request.method === 'POST')
|
|
847
|
+
return await post(request, response);
|
|
848
|
+
if (request.method === 'PATCH')
|
|
849
|
+
return await patch(request, response);
|
|
850
|
+
if (request.method === 'GET')
|
|
851
|
+
return get(request, response);
|
|
852
|
+
if (request.method === 'OPTIONS')
|
|
853
|
+
return handleOptions(response);
|
|
854
|
+
return response
|
|
855
|
+
.status(405)
|
|
856
|
+
.setHeader('Allow', 'GET, POST, PATCH, OPTIONS')
|
|
857
|
+
.send('Method Not Allowed');
|
|
858
|
+
}
|
|
859
|
+
catch (e) {
|
|
860
|
+
if (e.status === undefined)
|
|
861
|
+
return response.status(500).send(e.message || e);
|
|
862
|
+
return response.status(e.status).send(e.message);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
handler.db = handler;
|
|
867
|
+
handler.dts = get;
|
|
868
|
+
|
|
869
|
+
function get(request, response) {
|
|
870
|
+
if (request.query.table) {
|
|
871
|
+
if (!(request.query.table in c)) {
|
|
872
|
+
let e = new Error('Table is not exposed or does not exist');
|
|
873
|
+
// @ts-ignore
|
|
874
|
+
e.status = 400;
|
|
875
|
+
throw e;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
const result = getMeta(client.tables[request.query.table]);
|
|
879
|
+
response.setHeader('content-type', 'text/plain');
|
|
880
|
+
return response.status(200).send(result);
|
|
881
|
+
}
|
|
882
|
+
const isNamespace = request.query.isNamespace === 'true';
|
|
883
|
+
let tsArg = Object.keys(c).map(x => {
|
|
884
|
+
return { table: client.tables[x], customFilters: options?.tables?.[x].customFilters, name: x };
|
|
885
|
+
});
|
|
886
|
+
response.setHeader('content-type', 'text/plain');
|
|
887
|
+
return response.status(200).send(getTSDefinition(tsArg, { isNamespace, isHttp: true }));
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
async function patch(request, response) {
|
|
891
|
+
const table = request.query.table;
|
|
892
|
+
const body = await request.json();
|
|
893
|
+
return response.json(await c[table].patch(body, request, response));
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
async function post(request, response) {
|
|
897
|
+
if (!request.query.table) {
|
|
898
|
+
let e = new Error('Table not defined');
|
|
899
|
+
// @ts-ignore
|
|
900
|
+
e.status = 400;
|
|
901
|
+
throw e;
|
|
902
|
+
}
|
|
903
|
+
if (!(request.query.table in c)) {
|
|
904
|
+
let e = new Error('Table is not exposed or does not exist');
|
|
905
|
+
// @ts-ignore
|
|
906
|
+
e.status = 400;
|
|
907
|
+
throw e;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
const body = await request.json();
|
|
911
|
+
return response.json(await c[request.query.table].post(body, request, response));
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
function handleOptions(response) {
|
|
915
|
+
response.setHeader('Access-Control-Allow-Origin', '*');
|
|
916
|
+
response.setHeader('Access-Control-Allow-Methods', 'GET, POST, PATCH, OPTIONS');
|
|
917
|
+
response.setHeader('Access-Control-Allow-Headers', 'Content-Type');
|
|
918
|
+
response.setHeader('Access-Control-Max-Age', '86400');
|
|
919
|
+
return response.status(204).send('');
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
function createRequest(ctx) {
|
|
923
|
+
let bodyPromise;
|
|
924
|
+
const query = Object.fromEntries(new URL(ctx.req.url).searchParams.entries());
|
|
925
|
+
const headers = {};
|
|
926
|
+
for (const [name, value] of ctx.req.raw.headers.entries())
|
|
927
|
+
headers[name] = value;
|
|
928
|
+
return {
|
|
929
|
+
method: ctx.req.method,
|
|
930
|
+
query,
|
|
931
|
+
headers,
|
|
932
|
+
json: async () => {
|
|
933
|
+
if (!bodyPromise)
|
|
934
|
+
bodyPromise = ctx.req.json();
|
|
935
|
+
return bodyPromise;
|
|
936
|
+
}
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
function createResponse() {
|
|
941
|
+
let statusCode = 200;
|
|
942
|
+
const headers = new Headers();
|
|
943
|
+
return {
|
|
944
|
+
status(code) {
|
|
945
|
+
statusCode = code;
|
|
946
|
+
return this;
|
|
947
|
+
},
|
|
948
|
+
setHeader(name, value) {
|
|
949
|
+
headers.set(name, value);
|
|
950
|
+
return this;
|
|
951
|
+
},
|
|
952
|
+
json(value) {
|
|
953
|
+
if (!headers.has('content-type'))
|
|
954
|
+
headers.set('content-type', 'application/json');
|
|
955
|
+
return new Response(JSON.stringify(value), { status: statusCode, headers });
|
|
956
|
+
},
|
|
957
|
+
send(value) {
|
|
958
|
+
if (typeof value === 'string') {
|
|
959
|
+
if (!headers.has('content-type'))
|
|
960
|
+
headers.set('content-type', 'text/plain');
|
|
961
|
+
return new Response(value, { status: statusCode, headers });
|
|
962
|
+
}
|
|
963
|
+
if (!headers.has('content-type'))
|
|
964
|
+
headers.set('content-type', 'application/json');
|
|
965
|
+
return new Response(JSON.stringify(value), { status: statusCode, headers });
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
return handler;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
hostHono_1 = hostHono;
|
|
974
|
+
return hostHono_1;
|
|
975
|
+
}
|
|
976
|
+
|
|
745
977
|
var require$$0$4 = /*@__PURE__*/getDefaultExportFromNamespaceIfPresent(fastJsonPatch);
|
|
746
978
|
|
|
747
979
|
var dateToISOString_1;
|
|
@@ -2290,6 +2522,7 @@ function requireHostLocal () {
|
|
|
2290
2522
|
let executeQuery = requireQuery();
|
|
2291
2523
|
let executeSqliteFunction = requireSqliteFunction();
|
|
2292
2524
|
let hostExpress = requireHostExpress();
|
|
2525
|
+
let hostHono = requireHostHono();
|
|
2293
2526
|
const readonlyOps = ['getManyDto', 'getMany', 'aggregate', 'count'];
|
|
2294
2527
|
// { db, table, defaultConcurrency,
|
|
2295
2528
|
// concurrency,
|
|
@@ -2304,7 +2537,7 @@ function requireHostLocal () {
|
|
|
2304
2537
|
const getTransactionHook = (name) =>
|
|
2305
2538
|
(transactionHooks && transactionHooks[name]) || (hooks && hooks[name]);
|
|
2306
2539
|
|
|
2307
|
-
let c = { get, post, patch, query, sqliteFunction, express };
|
|
2540
|
+
let c = { get, post, patch, query, sqliteFunction, express, hono };
|
|
2308
2541
|
|
|
2309
2542
|
function get() {
|
|
2310
2543
|
return getMeta(table);
|
|
@@ -2453,6 +2686,10 @@ function requireHostLocal () {
|
|
|
2453
2686
|
return hostExpress(hostLocal, client, options);
|
|
2454
2687
|
}
|
|
2455
2688
|
|
|
2689
|
+
function hono(client, options) {
|
|
2690
|
+
return hostHono(hostLocal, client, options);
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2456
2693
|
return c;
|
|
2457
2694
|
}
|
|
2458
2695
|
|
|
@@ -2946,6 +3183,7 @@ function requireClient () {
|
|
|
2946
3183
|
client.http = onProvider.bind(null, 'http');//todo
|
|
2947
3184
|
client.mysql = onProvider.bind(null, 'mysql');
|
|
2948
3185
|
client.express = express;
|
|
3186
|
+
client.hono = hono;
|
|
2949
3187
|
client.close = close;
|
|
2950
3188
|
|
|
2951
3189
|
function close() {
|
|
@@ -3033,6 +3271,14 @@ function requireClient () {
|
|
|
3033
3271
|
throw new Error('Cannot host express clientside');
|
|
3034
3272
|
}
|
|
3035
3273
|
|
|
3274
|
+
function hono(arg) {
|
|
3275
|
+
if (providers.hono) {
|
|
3276
|
+
return providers.hono(client, { ...options, ...arg });
|
|
3277
|
+
}
|
|
3278
|
+
else
|
|
3279
|
+
throw new Error('Cannot host hono clientside');
|
|
3280
|
+
}
|
|
3281
|
+
|
|
3036
3282
|
|
|
3037
3283
|
|
|
3038
3284
|
function _createPatch(original, modified, ...restArgs) {
|
|
@@ -12926,6 +13172,7 @@ function requireCreateProviders () {
|
|
|
12926
13172
|
});
|
|
12927
13173
|
|
|
12928
13174
|
dbMap.express = index.express;
|
|
13175
|
+
dbMap.hono = index.hono;
|
|
12929
13176
|
|
|
12930
13177
|
function createPool(providerName, ...args) {
|
|
12931
13178
|
const provider = index[providerName];
|
|
@@ -15163,6 +15410,7 @@ function requireNewDatabase$b () {
|
|
|
15163
15410
|
let rollback = requireRollback();
|
|
15164
15411
|
let newPool = requireNewPool$b();
|
|
15165
15412
|
let express = requireHostExpress();
|
|
15413
|
+
let hono = requireHostHono();
|
|
15166
15414
|
let hostLocal = requireHostLocal();
|
|
15167
15415
|
let doQuery = requireQuery();
|
|
15168
15416
|
let releaseDbClient = requireReleaseDbClient();
|
|
@@ -15173,7 +15421,7 @@ function requireNewDatabase$b () {
|
|
|
15173
15421
|
poolOptions = poolOptions || { min: 1 };
|
|
15174
15422
|
var pool = newPool(connectionString, poolOptions);
|
|
15175
15423
|
|
|
15176
|
-
let c = { poolFactory: pool, hostLocal, express };
|
|
15424
|
+
let c = { poolFactory: pool, hostLocal, express, hono };
|
|
15177
15425
|
|
|
15178
15426
|
c.transaction = function(options, fn) {
|
|
15179
15427
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -15912,6 +16160,7 @@ function requireNewDatabase$a () {
|
|
|
15912
16160
|
let lock = requireLock();
|
|
15913
16161
|
let executeSchema = requireSchema();
|
|
15914
16162
|
let express = requireHostExpress();
|
|
16163
|
+
let hono = requireHostHono();
|
|
15915
16164
|
let hostLocal = requireHostLocal();
|
|
15916
16165
|
let doQuery = requireQuery();
|
|
15917
16166
|
let releaseDbClient = requireReleaseDbClient();
|
|
@@ -15920,7 +16169,7 @@ function requireNewDatabase$a () {
|
|
|
15920
16169
|
poolOptions = poolOptions || { min: 1 };
|
|
15921
16170
|
var pool = newPool(connectionString, poolOptions);
|
|
15922
16171
|
|
|
15923
|
-
let c = { poolFactory: pool, hostLocal, express };
|
|
16172
|
+
let c = { poolFactory: pool, hostLocal, express, hono };
|
|
15924
16173
|
|
|
15925
16174
|
c.transaction = function(options, fn) {
|
|
15926
16175
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -16643,6 +16892,7 @@ function requireNewDatabase$9 () {
|
|
|
16643
16892
|
let lock = requireLock();
|
|
16644
16893
|
let executeSchema = requireSchema();
|
|
16645
16894
|
let express = requireHostExpress();
|
|
16895
|
+
let hono = requireHostHono();
|
|
16646
16896
|
let hostLocal = requireHostLocal();
|
|
16647
16897
|
let doQuery = requireQuery();
|
|
16648
16898
|
let releaseDbClient = requireReleaseDbClient();
|
|
@@ -16653,7 +16903,7 @@ function requireNewDatabase$9 () {
|
|
|
16653
16903
|
poolOptions = poolOptions || { min: 1 };
|
|
16654
16904
|
var pool = newPool(connectionString, poolOptions);
|
|
16655
16905
|
|
|
16656
|
-
let c = { poolFactory: pool, hostLocal, express };
|
|
16906
|
+
let c = { poolFactory: pool, hostLocal, express, hono };
|
|
16657
16907
|
|
|
16658
16908
|
c.transaction = function(options, fn) {
|
|
16659
16909
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -17163,6 +17413,7 @@ function requireNewDatabase$8 () {
|
|
|
17163
17413
|
let lock = requireLock();
|
|
17164
17414
|
let executeSchema = requireSchema();
|
|
17165
17415
|
let express = requireHostExpress();
|
|
17416
|
+
let hono = requireHostHono();
|
|
17166
17417
|
let hostLocal = requireHostLocal();
|
|
17167
17418
|
let doQuery = requireQuery();
|
|
17168
17419
|
let releaseDbClient = requireReleaseDbClient();
|
|
@@ -17173,7 +17424,7 @@ function requireNewDatabase$8 () {
|
|
|
17173
17424
|
poolOptions = poolOptions || { min: 1 };
|
|
17174
17425
|
var pool = newPool(connectionString, poolOptions);
|
|
17175
17426
|
|
|
17176
|
-
let c = { poolFactory: pool, hostLocal, express };
|
|
17427
|
+
let c = { poolFactory: pool, hostLocal, express, hono };
|
|
17177
17428
|
|
|
17178
17429
|
c.transaction = function(options, fn) {
|
|
17179
17430
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -17840,6 +18091,7 @@ function requireNewDatabase$7 () {
|
|
|
17840
18091
|
let rollback = requireRollback();
|
|
17841
18092
|
let newPool = requireNewPool$7();
|
|
17842
18093
|
let express = requireHostExpress();
|
|
18094
|
+
let hono = requireHostHono();
|
|
17843
18095
|
let hostLocal = requireHostLocal();
|
|
17844
18096
|
let doQuery = requireQuery();
|
|
17845
18097
|
let doSqliteFunction = requireSqliteFunction();
|
|
@@ -17851,7 +18103,7 @@ function requireNewDatabase$7 () {
|
|
|
17851
18103
|
poolOptions = poolOptions || { min: 1 };
|
|
17852
18104
|
var pool = newPool(connectionString, poolOptions);
|
|
17853
18105
|
|
|
17854
|
-
let c = {poolFactory: pool, hostLocal, express};
|
|
18106
|
+
let c = { poolFactory: pool, hostLocal, express, hono };
|
|
17855
18107
|
|
|
17856
18108
|
c.transaction = function(options, fn) {
|
|
17857
18109
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -18255,6 +18507,7 @@ function requireNewDatabase$6 () {
|
|
|
18255
18507
|
let rollback = requireRollback();
|
|
18256
18508
|
let newPool = requireNewPool$6();
|
|
18257
18509
|
let express = requireHostExpress();
|
|
18510
|
+
let hono = requireHostHono();
|
|
18258
18511
|
let hostLocal = requireHostLocal();
|
|
18259
18512
|
let doQuery = requireQuery();
|
|
18260
18513
|
let doSqliteFunction = requireSqliteFunction();
|
|
@@ -18266,7 +18519,7 @@ function requireNewDatabase$6 () {
|
|
|
18266
18519
|
poolOptions = poolOptions || { min: 1 };
|
|
18267
18520
|
var pool = newPool(connectionString, poolOptions);
|
|
18268
18521
|
|
|
18269
|
-
let c = {poolFactory: pool, hostLocal, express};
|
|
18522
|
+
let c = { poolFactory: pool, hostLocal, express, hono };
|
|
18270
18523
|
|
|
18271
18524
|
c.transaction = function(options, fn) {
|
|
18272
18525
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -18710,6 +18963,7 @@ function requireNewDatabase$5 () {
|
|
|
18710
18963
|
let rollback = requireRollback();
|
|
18711
18964
|
let newPool = requireNewPool$5();
|
|
18712
18965
|
let express = requireHostExpress();
|
|
18966
|
+
let hono = requireHostHono();
|
|
18713
18967
|
let hostLocal = requireHostLocal();
|
|
18714
18968
|
let doQuery = requireQuery();
|
|
18715
18969
|
let doSqliteFunction = requireSqliteFunction();
|
|
@@ -18721,7 +18975,7 @@ function requireNewDatabase$5 () {
|
|
|
18721
18975
|
poolOptions = poolOptions || { min: 1 };
|
|
18722
18976
|
var pool = newPool(connectionString, poolOptions);
|
|
18723
18977
|
|
|
18724
|
-
let c = {poolFactory: pool, hostLocal, express};
|
|
18978
|
+
let c = { poolFactory: pool, hostLocal, express, hono };
|
|
18725
18979
|
|
|
18726
18980
|
c.transaction = function(options, fn) {
|
|
18727
18981
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -19130,6 +19384,7 @@ function requireNewDatabase$4 () {
|
|
|
19130
19384
|
let rollback = requireRollback();
|
|
19131
19385
|
let newPool = requireNewPool$4();
|
|
19132
19386
|
let express = requireHostExpress();
|
|
19387
|
+
let hono = requireHostHono();
|
|
19133
19388
|
let hostLocal = requireHostLocal();
|
|
19134
19389
|
let doQuery = requireQuery();
|
|
19135
19390
|
let releaseDbClient = requireReleaseDbClient();
|
|
@@ -19140,7 +19395,7 @@ function requireNewDatabase$4 () {
|
|
|
19140
19395
|
poolOptions = poolOptions || { min: 1 };
|
|
19141
19396
|
var pool = newPool(d1Database, poolOptions);
|
|
19142
19397
|
|
|
19143
|
-
let c = {poolFactory: pool, hostLocal, express};
|
|
19398
|
+
let c = { poolFactory: pool, hostLocal, express, hono };
|
|
19144
19399
|
|
|
19145
19400
|
c.transaction = function(options, fn) {
|
|
19146
19401
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -20148,6 +20403,7 @@ function requireNewDatabase$3 () {
|
|
|
20148
20403
|
let rollback = requireRollback();
|
|
20149
20404
|
let newPool = requireNewPool$3();
|
|
20150
20405
|
let express = requireHostExpress();
|
|
20406
|
+
let hono = requireHostHono();
|
|
20151
20407
|
let hostLocal = requireHostLocal();
|
|
20152
20408
|
let doQuery = requireQuery();
|
|
20153
20409
|
let releaseDbClient = requireReleaseDbClient();
|
|
@@ -20158,7 +20414,7 @@ function requireNewDatabase$3 () {
|
|
|
20158
20414
|
poolOptions = poolOptions || { min: 1 };
|
|
20159
20415
|
var pool = newPool(connectionString, poolOptions);
|
|
20160
20416
|
|
|
20161
|
-
let c = { poolFactory: pool, hostLocal, express };
|
|
20417
|
+
let c = { poolFactory: pool, hostLocal, express, hono };
|
|
20162
20418
|
|
|
20163
20419
|
c.transaction = function(options, fn) {
|
|
20164
20420
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -20954,6 +21210,7 @@ function requireNewDatabase$2 () {
|
|
|
20954
21210
|
let rollback = requireRollback();
|
|
20955
21211
|
let newPool = requireNewPool$2();
|
|
20956
21212
|
let express = requireHostExpress();
|
|
21213
|
+
let hono = requireHostHono();
|
|
20957
21214
|
let hostLocal = requireHostLocal();
|
|
20958
21215
|
let doQuery = requireQuery();
|
|
20959
21216
|
let releaseDbClient = requireReleaseDbClient();
|
|
@@ -20964,7 +21221,7 @@ function requireNewDatabase$2 () {
|
|
|
20964
21221
|
poolOptions = poolOptions || { min: 1 };
|
|
20965
21222
|
var pool = newPool(connectionString, poolOptions);
|
|
20966
21223
|
|
|
20967
|
-
let c = { poolFactory: pool, hostLocal, express };
|
|
21224
|
+
let c = { poolFactory: pool, hostLocal, express, hono };
|
|
20968
21225
|
|
|
20969
21226
|
c.transaction = function(options, fn) {
|
|
20970
21227
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -21596,6 +21853,7 @@ function requireNewDatabase$1 () {
|
|
|
21596
21853
|
let rollback = requireRollback();
|
|
21597
21854
|
let newPool = requireNewPool$1();
|
|
21598
21855
|
let express = requireHostExpress();
|
|
21856
|
+
let hono = requireHostHono();
|
|
21599
21857
|
let hostLocal = requireHostLocal();
|
|
21600
21858
|
let doQuery = requireQuery();
|
|
21601
21859
|
let releaseDbClient = requireReleaseDbClient();
|
|
@@ -21606,7 +21864,7 @@ function requireNewDatabase$1 () {
|
|
|
21606
21864
|
poolOptions = poolOptions || { min: 1 };
|
|
21607
21865
|
var pool = newPool(connectionString, poolOptions);
|
|
21608
21866
|
|
|
21609
|
-
let c = {poolFactory: pool, hostLocal, express};
|
|
21867
|
+
let c = { poolFactory: pool, hostLocal, express, hono };
|
|
21610
21868
|
|
|
21611
21869
|
c.transaction = function(options, fn) {
|
|
21612
21870
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -22461,6 +22719,7 @@ function requireNewDatabase () {
|
|
|
22461
22719
|
let rollback = requireRollback();
|
|
22462
22720
|
let newPool = requireNewPool();
|
|
22463
22721
|
let express = requireHostExpress();
|
|
22722
|
+
let hono = requireHostHono();
|
|
22464
22723
|
let hostLocal = requireHostLocal();
|
|
22465
22724
|
let doQuery = requireQuery();
|
|
22466
22725
|
let releaseDbClient = requireReleaseDbClient();
|
|
@@ -22471,7 +22730,7 @@ function requireNewDatabase () {
|
|
|
22471
22730
|
poolOptions = poolOptions || { min: 1 };
|
|
22472
22731
|
var pool = newPool(connectionString, poolOptions);
|
|
22473
22732
|
|
|
22474
|
-
let c = { poolFactory: pool, hostLocal, express };
|
|
22733
|
+
let c = { poolFactory: pool, hostLocal, express, hono };
|
|
22475
22734
|
|
|
22476
22735
|
c.transaction = function(options, fn) {
|
|
22477
22736
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -22568,6 +22827,7 @@ function requireSrc () {
|
|
|
22568
22827
|
if (hasRequiredSrc) return src;
|
|
22569
22828
|
hasRequiredSrc = 1;
|
|
22570
22829
|
const hostExpress = requireHostExpress();
|
|
22830
|
+
const hostHono = requireHostHono();
|
|
22571
22831
|
const hostLocal = requireHostLocal();
|
|
22572
22832
|
const client = requireClient();
|
|
22573
22833
|
const map = requireMap();
|
|
@@ -22711,6 +22971,7 @@ function requireSrc () {
|
|
|
22711
22971
|
});
|
|
22712
22972
|
|
|
22713
22973
|
connectViaPool.express = hostExpress.bind(null, hostLocal);
|
|
22974
|
+
connectViaPool.hono = hostHono.bind(null, hostLocal);
|
|
22714
22975
|
|
|
22715
22976
|
src = connectViaPool;
|
|
22716
22977
|
return src;
|
package/docs/changelog.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
## Changelog
|
|
2
|
+
__5.1.0__
|
|
3
|
+
Support for Hono [#149](https://github.com/alfateam/orange-orm/issues/149)
|
|
4
|
+
Removed dependency `glob`
|
|
5
|
+
Removed dependency `module-definition`
|
|
6
|
+
Removed dependency `findup-sync`
|
|
2
7
|
__5.0.0__
|
|
3
8
|
Breaking: `getAll` was removed. Use `getMany` instead (now with the same signature as the removed `getAll`).
|
|
4
9
|
Breaking: `getOne` no longer accepts a filter as the first argument. Move the filter to the strategy `where` clause (same pattern as `getMany`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orange-orm",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -80,20 +80,17 @@
|
|
|
80
80
|
"ajv": "^8.17.1",
|
|
81
81
|
"axios": "^1.6.2",
|
|
82
82
|
"fast-json-patch": "^3.1.1",
|
|
83
|
-
"findup-sync": "^5.0.0",
|
|
84
|
-
"glob": "^10.3.4 || ^11.0.2",
|
|
85
|
-
"module-definition": "^4.0.0 || ^5.0.0 || || ^6.0.0",
|
|
86
83
|
"rfdc": "^1.2.0",
|
|
87
84
|
"uuid": "^8.3.2 || ^9.0.0 || ^10.0.0 || ^11.1.0"
|
|
88
85
|
},
|
|
89
86
|
"peerDependencies": {
|
|
90
87
|
"@electric-sql/pglite": "^0.3.0",
|
|
88
|
+
"better-sqlite3": "^11.8.1 || ^12.6.2",
|
|
91
89
|
"msnodesqlv8": "^4.1.0 || ^5.0.0",
|
|
92
90
|
"mysql2": "^2.2.5 || ^3.9.4",
|
|
93
91
|
"oracledb": "^6.3.0",
|
|
94
92
|
"pg": "^8.5.1",
|
|
95
93
|
"pg-query-stream": "^3.3.2",
|
|
96
|
-
"better-sqlite3": "^11.8.1",
|
|
97
94
|
"tedious": "^15.1.2 || ^16.0.0 || ^18.1.0 || || ^19.0.0"
|
|
98
95
|
},
|
|
99
96
|
"peerDependenciesMeta": {
|
|
@@ -127,16 +124,19 @@
|
|
|
127
124
|
},
|
|
128
125
|
"devDependencies": {
|
|
129
126
|
"@electric-sql/pglite": "^0.3.0",
|
|
127
|
+
"@hono/node-server": "^1.14.4",
|
|
130
128
|
"@rollup/plugin-commonjs": "^28.0.2",
|
|
131
129
|
"@rollup/plugin-json": "^6.1.0",
|
|
132
130
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
133
131
|
"@typescript-eslint/eslint-plugin": "^6.x",
|
|
134
132
|
"@typescript-eslint/parser": "^6.x",
|
|
135
133
|
"@vitest/coverage-v8": "^3.2.4",
|
|
134
|
+
"better-sqlite3": "^12.6.2",
|
|
136
135
|
"cors": "^2.8.5",
|
|
137
136
|
"eslint": "^8.57.0",
|
|
138
137
|
"eslint-plugin-jest": "^27.1.7",
|
|
139
138
|
"express": "^4.18.2",
|
|
139
|
+
"hono": "^4.8.2",
|
|
140
140
|
"msnodesqlv8": "^4.1.0",
|
|
141
141
|
"mysql2": "^3.9.4",
|
|
142
142
|
"oracledb": "^6.3.0",
|
|
@@ -144,7 +144,6 @@
|
|
|
144
144
|
"pg": "^8.5.1",
|
|
145
145
|
"pg-query-stream": "^3.3.2",
|
|
146
146
|
"rollup": "^2.52.7",
|
|
147
|
-
"better-sqlite3": "^11.8.1",
|
|
148
147
|
"tedious": "^19.0.0",
|
|
149
148
|
"typescript": "^5.4.5",
|
|
150
149
|
"vitest": "^3.2.4"
|
package/src/bunPg/newDatabase.js
CHANGED
|
@@ -7,6 +7,7 @@ let newPool = require('./newPool');
|
|
|
7
7
|
let lock = require('../lock');
|
|
8
8
|
let executeSchema = require('../pg/schema');
|
|
9
9
|
let express = require('../hostExpress');
|
|
10
|
+
let hono = require('../hostHono');
|
|
10
11
|
let hostLocal = require('../hostLocal');
|
|
11
12
|
let doQuery = require('../query');
|
|
12
13
|
let releaseDbClient = require('../table/releaseDbClient');
|
|
@@ -17,7 +18,7 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
17
18
|
poolOptions = poolOptions || { min: 1 };
|
|
18
19
|
var pool = newPool(connectionString, poolOptions);
|
|
19
20
|
|
|
20
|
-
let c = { poolFactory: pool, hostLocal, express };
|
|
21
|
+
let c = { poolFactory: pool, hostLocal, express, hono };
|
|
21
22
|
|
|
22
23
|
c.transaction = function(options, fn) {
|
|
23
24
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -5,6 +5,7 @@ let commit = require('../table/commit');
|
|
|
5
5
|
let rollback = require('../table/rollback');
|
|
6
6
|
let newPool = require('./newPool');
|
|
7
7
|
let express = require('../hostExpress');
|
|
8
|
+
let hono = require('../hostHono');
|
|
8
9
|
let hostLocal = require('../hostLocal');
|
|
9
10
|
let doQuery = require('../query');
|
|
10
11
|
let doSqliteFunction = require('../sqliteFunction');
|
|
@@ -16,7 +17,7 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
16
17
|
poolOptions = poolOptions || { min: 1 };
|
|
17
18
|
var pool = newPool(connectionString, poolOptions);
|
|
18
19
|
|
|
19
|
-
let c = {poolFactory: pool, hostLocal, express};
|
|
20
|
+
let c = { poolFactory: pool, hostLocal, express, hono };
|
|
20
21
|
|
|
21
22
|
c.transaction = function(options, fn) {
|
|
22
23
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -65,6 +65,7 @@ function createProviders(index) {
|
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
dbMap.express = index.express;
|
|
68
|
+
dbMap.hono = index.hono;
|
|
68
69
|
|
|
69
70
|
function createPool(providerName, ...args) {
|
|
70
71
|
const provider = index[providerName];
|
|
@@ -138,4 +139,4 @@ function negotiateCachedPool(fn, providers) {
|
|
|
138
139
|
|
|
139
140
|
|
|
140
141
|
|
|
141
|
-
module.exports = createProviders;
|
|
142
|
+
module.exports = createProviders;
|