Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kmore

Package Overview
Dependencies
Maintainers
0
Versions
271
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kmore - npm Package Compare versions

Comparing version 67.0.0 to 67.0.1

3

dist/lib/builder/builder.index.js

@@ -1,3 +0,1 @@

/* eslint-disable max-params */
/* eslint-disable @typescript-eslint/ban-types */
import assert from 'node:assert';

@@ -43,3 +41,2 @@ import { defaultPropDescriptor } from '../config.js';

// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
let builder = kmore.dbh(refName);

@@ -46,0 +43,0 @@ updateBuilderProperties(builder, caseConvert, kmoreQueryId, kmore.dict, kmore.dbId, void 0);

2

dist/lib/builder/builder.types.d.ts

@@ -49,3 +49,3 @@ import type { ScopeType } from '@mwcp/share';

}
export type SmartJoin<D extends {} = {}, CaseConvert extends CaseType = CaseType, TResult = unknown[]> = <TRecord1 = UnwrapArrayMember<TResult>, C2 extends DbScopedColsByKey<D> = DbScopedColsByKey<D>, C1 extends DbScopedColsByKey<D> = DbScopedColsByTableType<D, TRecord1>, TTable2 extends StrKey<D> = SplitScopedColumn<D, C2>[0], TRecord2 extends D[TTable2] = D[TTable2], TResult2 = JoinTableWithCaseConvert<TRecord1, TRecord2 extends any ? D[TTable2] : TRecord2, TTable2, CaseConvert>>(
export type SmartJoin<D extends object = object, CaseConvert extends CaseType = CaseType, TResult = unknown[]> = <TRecord1 = UnwrapArrayMember<TResult>, C2 extends DbScopedColsByKey<D> = DbScopedColsByKey<D>, C1 extends DbScopedColsByKey<D> = DbScopedColsByTableType<D, TRecord1>, TTable2 extends StrKey<D> = SplitScopedColumn<D, C2>[0], TRecord2 extends D[TTable2] = D[TTable2], TResult2 = JoinTableWithCaseConvert<TRecord1, TRecord2 extends any ? D[TTable2] : TRecord2, TTable2, CaseConvert>>(
/**

@@ -52,0 +52,0 @@ * scoped column name, e.g. 'tb_name.col_name',

@@ -9,3 +9,2 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */

// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const scopedCols = dbDict.scoped[tableName];

@@ -12,0 +11,0 @@ if (typeof scopedCols === 'object') {

@@ -1,2 +0,1 @@

/* eslint-disable @typescript-eslint/no-explicit-any */
import assert from 'node:assert';

@@ -3,0 +2,0 @@ import { processJoinTableColumnAlias } from './builder/smart-join.js';

@@ -0,4 +1,5 @@

/* eslint-disable @typescript-eslint/no-unnecessary-type-parameters */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import assert from 'node:assert';
import { camelToSnake, camelKeys, snakeKeys, snakeToCamel, } from '@waiting/shared-core';
import { camelKeys, camelToSnake, snakeKeys, snakeToCamel, } from '@waiting/shared-core';
import { CaseType, EnumClient, } from './types.js';

@@ -116,3 +117,3 @@ export async function getCurrentTime(dbh, clientType) {

case CaseType.pascal:
throw Error('Not implemented yet for pascal case conversion');
throw new Error('Not implemented yet for pascal case conversion');
// return postProcessResponseToPascal(result, queryContext)

@@ -119,0 +120,0 @@ case CaseType.snake:

import type { HookList } from './hook.types.js';
export declare const initHookList: HookList;
export declare function genHookList(input?: Partial<HookList> | undefined): HookList;
export declare function genHookList(input?: Partial<HookList>): HookList;
//# sourceMappingURL=hook.helper.d.ts.map

@@ -31,3 +31,2 @@ import assert from 'node:assert';

// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
// const pagingOptions: _PagingOptions = builder[KmorePageKey.PagingOptions]

@@ -119,3 +118,3 @@ assert(pagingOptions, 'pagingOptions should be set');

: total < Number.MAX_SAFE_INTEGER ? Number(total) : Number.MAX_SAFE_INTEGER;
void builderPager.limit(limit).offset(offset >= 0 ? offset : 0);
void builderPager.limit(limit).offset(Math.max(offset, 0));
ret.builderPager = builderPager;

@@ -122,0 +121,0 @@ return ret;

@@ -6,4 +6,4 @@ export * from './kmore.js';

export type { QueryBuilderExtMethod } from './knex.patch.types.js';
export type { PagingOptions, PageRawType, PageWrapType, PagingMeta, } from './paging.types.js';
export * from './hook/hook.types.js';
export type { PageRawType, PageWrapType, PagingMeta, PagingOptions, } from './paging.types.js';
export type * from './hook/hook.types.js';
export * from './propagation.types.js';

@@ -10,0 +10,0 @@ export { wrapIdentifier } from './helper.js';

@@ -5,3 +5,2 @@ export * from './kmore.js';

export * from './builder/builder.types.js';
export * from './hook/hook.types.js';
export * from './propagation.types.js';

@@ -8,0 +7,0 @@ export { wrapIdentifier } from './helper.js';

@@ -84,3 +84,3 @@ import type { ScopeType } from '@mwcp/share';

removeTrxIdFromTrxIdQueryIdList(trxId: symbol): void;
getTrxByQueryId(queryId: symbol, scope?: ScopeType | undefined): KmoreTransaction | undefined;
getTrxByQueryId(queryId: symbol, scope?: ScopeType): KmoreTransaction | undefined;
removeTrxIdCache(trxId: symbol, scope: ScopeType | undefined): void;

@@ -87,0 +87,0 @@ /**

@@ -1,6 +0,5 @@

/* eslint-disable max-lines-per-function */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable import/no-extraneous-dependencies */
import assert from 'node:assert';
// eslint-disable-next-line import/no-extraneous-dependencies, import/no-named-default
// eslint-disable-next-line import/no-named-default
import { default as _knex } from 'knex';

@@ -239,3 +238,2 @@ import { createRefTables } from './builder/builder.index.js';

for (const fn of transactionPreHooks) {
// eslint-disable-next-line no-await-in-loop
await fn(opts);

@@ -258,3 +256,2 @@ }

for (const fn of transactionPostHooks) {
// eslint-disable-next-line no-await-in-loop
await fn(opts2);

@@ -261,0 +258,0 @@ }

@@ -35,6 +35,6 @@ import type { CaseType, UnwrapArrayMember } from '@waiting/shared-types';

(): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
<TResult2 = ArrayIfAlready<TResult, any>, TInnerRecord extends {} = any, TInnerResult = any>(...subQueryBuilders: readonly KmoreQueryBuilder<D, CaseConvert, TInnerRecord, TInnerResult>[]): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult2>;
<TResult2 = ArrayIfAlready<TResult, any>, TInnerRecord extends {} = any, TInnerResult = any>(subQueryBuilders: readonly KmoreQueryBuilder<D, CaseConvert, TInnerRecord, TInnerResult>[]): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult2>;
<TResult2 = ArrayIfAlready<TResult, any>, TInnerRecord extends object = any, TInnerResult = any>(...subQueryBuilders: readonly KmoreQueryBuilder<D, CaseConvert, TInnerRecord, TInnerResult>[]): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult2>;
<TResult2 = ArrayIfAlready<TResult, any>, TInnerRecord extends object = any, TInnerResult = any>(subQueryBuilders: readonly KmoreQueryBuilder<D, CaseConvert, TInnerRecord, TInnerResult>[]): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult2>;
}
interface AliasQueryBuilder<D extends {} = {}, CaseConvert extends CaseType = CaseType, TRecord extends {} = any, TResult = unknown[]> {
interface AliasQueryBuilder<D extends object = object, CaseConvert extends CaseType = CaseType, TRecord extends object = any, TResult = unknown[]> {
<AliasUT extends Knex.InferrableColumnDescriptor<Knex.ResolveTableType<TRecord>>[], TResult2 = ArrayIfAlready<TResult, DeferredKeySelectionNS.Augment<UnwrapArrayMember<TResult>, Knex.ResolveTableType<TRecord>, IncompatibleToAlt<ArrayMember<AliasUT>, string, never>, Knex.IntersectAliases<AliasUT>>>>(...aliases: AliasUT): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult2>;

@@ -45,3 +45,3 @@ <AliasUT extends Knex.InferrableColumnDescriptor<Knex.ResolveTableType<TRecord>>[], TResult2 = ArrayIfAlready<TResult, DeferredKeySelectionNS.Augment<UnwrapArrayMember<TResult>, Knex.ResolveTableType<TRecord>, IncompatibleToAlt<ArrayMember<AliasUT>, string, never>, Knex.IntersectAliases<AliasUT>>>>(aliases: AliasUT): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult2>;

}
interface ColumnNameQueryBuilder<D extends {} = {}, CaseConvert extends CaseType = CaseType, TRecord extends {} = any, TResult = unknown[]> {
interface ColumnNameQueryBuilder<D extends object = object, CaseConvert extends CaseType = CaseType, TRecord extends object = any, TResult = unknown[]> {
(columnName: '*'): KmoreQueryBuilder<D, CaseConvert, TRecord, ArrayIfAlready<TResult, DeferredKeySelectionNS.DeferredKeySelection<TRecord, string>>>;

@@ -53,5 +53,5 @@ <ColNameUT extends keyof Knex.ResolveTableType<TRecord>, TResult2 = DeferredKeySelectionNS.Augment<UnwrapArrayMember<TResult>, Knex.ResolveTableType<TRecord>, ColNameUT & string>[]>(...columnNames: readonly ColNameUT[]): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult2>;

}
interface OrderBy<D extends {} = {}, CaseConvert extends CaseType = CaseType, TRecord extends {} = any, TResult = unknown[]> {
(columnName: keyof TRecord | QueryBuilder, order?: 'asc' | 'desc' | undefined, nulls?: 'first' | 'last' | undefined): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
(columnName: string | QueryBuilder, order?: string | undefined, nulls?: string | undefined): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
interface OrderBy<D extends object = object, CaseConvert extends CaseType = CaseType, TRecord extends object = any, TResult = unknown[]> {
(columnName: keyof TRecord | QueryBuilder, order?: 'asc' | 'desc', nulls?: 'first' | 'last'): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
(columnName: string | QueryBuilder, order?: string, nulls?: string): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
(columnDefs: (keyof TRecord | Readonly<{

@@ -68,7 +68,7 @@ column: keyof TRecord | QueryBuilder;

}
interface Where<D extends {} = {}, CaseConvert extends CaseType = CaseType, TRecord extends {} = any, TResult = any> extends WhereRaw<D, CaseConvert, TRecord, TResult> {
interface Where<D extends object = object, CaseConvert extends CaseType = CaseType, TRecord extends object = any, TResult = any> extends WhereRaw<D, CaseConvert, TRecord, TResult> {
(raw: Knex.Raw): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
(callback: Knex.QueryCallback<TRecord, TResult>): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
(object: Knex.DbRecord<Knex.ResolveTableType<TRecord>>): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
(object: Readonly<Object>): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
(object: Readonly<object>): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
<T extends keyof Knex.ResolveTableType<TRecord>>(columnName: T, value: Knex.DbColumn<Knex.ResolveTableType<TRecord>[T]> | null): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;

@@ -78,8 +78,8 @@ (columnName: string, value: Knex.Value | null): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;

(columnName: string, operator: string, value: Knex.Value | null): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
<T extends keyof Knex.ResolveTableType<TRecord>, TRecordInner extends {}, TResultInner>(columnName: T, operator: ComparisonOperator, value: Knex.QueryBuilder<TRecordInner, TResultInner>): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
<TRecordInner extends {}, TResultInner>(columnName: string, operator: string, value: Knex.QueryBuilder<TRecordInner, TResultInner>): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
<T extends keyof Knex.ResolveTableType<TRecord>, TRecordInner extends object, TResultInner>(columnName: T, operator: ComparisonOperator, value: Knex.QueryBuilder<TRecordInner, TResultInner>): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
<TRecordInner extends object, TResultInner>(columnName: string, operator: string, value: Knex.QueryBuilder<TRecordInner, TResultInner>): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
(left: Knex.Raw, operator: string, right: Knex.Value | null): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
<TRecordInner extends {}, TResultInner>(left: Knex.Raw, operator: string, right: Knex.QueryBuilder<TRecordInner, TResultInner>): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
<TRecordInner extends object, TResultInner>(left: Knex.Raw, operator: string, right: Knex.QueryBuilder<TRecordInner, TResultInner>): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;
}
interface WhereRaw<D extends {} = {}, CaseConvert extends CaseType = CaseType, TRecord extends {} = any, TResult = unknown[]> extends Knex.RawQueryBuilder<TRecord, TResult> {
interface WhereRaw<D extends object = object, CaseConvert extends CaseType = CaseType, TRecord extends object = any, TResult = unknown[]> extends Knex.RawQueryBuilder<TRecord, TResult> {
(condition: boolean): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>;

@@ -86,0 +86,0 @@ }

export type ArrayIfAlready<T1, T2> = AnyToUnknown<T1> extends any[] ? T2[] : T2;
export type ArrayMember<T> = T extends (infer M)[] ? M : never;
export type AnyToUnknown<T> = unknown extends T ? unknown : T;
export type CurlyCurlyToAny<T> = T extends unknown ? (<U>() => U extends T ? 0 : 1) extends <U>() => U extends {} ? 0 : 1 ? any : T : never;
export type CurlyCurlyToAny<T> = T extends unknown ? (<U>() => U extends T ? 0 : 1) extends <U>() => U extends object ? 0 : 1 ? any : T : never;
export type Dict<T = any> = Record<string, T>;

@@ -12,11 +12,11 @@ export type IncompatibleToAlt<T, TBase, TAlt> = T extends TBase ? T : TAlt;

export type UnknownToAny<T> = unknown extends T ? any : T;
export type AugmentParams<TTarget, TParams> = TParams extends {} ? keyof TParams extends never ? TTarget : {} & TTarget & TParams : TTarget;
export type PartialOrAny<TBase, TKeys> = Boxed<TKeys> extends Boxed<never> ? {} : Boxed<TKeys> extends Boxed<keyof TBase> ? SafePick<TBase, TKeys & keyof TBase> : any;
export type AugmentParams<TTarget, TParams> = TParams extends object ? keyof TParams extends never ? TTarget : {} & TTarget & TParams : TTarget;
export type PartialOrAny<TBase, TKeys> = Boxed<TKeys> extends Boxed<never> ? object : Boxed<TKeys> extends Boxed<keyof TBase> ? SafePick<TBase, TKeys & keyof TBase> : any;
export interface Boxed<T> {
_value: T;
}
export type SafePick<T, K extends keyof T> = T extends {} ? Pick<T, K> : any;
export type SafePartial<T> = Partial<AnyOrUnknownToOther<T, {}>>;
export type SafePick<T, K extends keyof T> = T extends object ? Pick<T, K> : any;
export type SafePartial<T> = Partial<AnyOrUnknownToOther<T, object>>;
export type AnyOrUnknownToOther<T1, T2> = unknown extends T1 ? T2 : T1;
export type ComparisonOperator = '=' | '>' | '>=' | '<' | '<=' | '<>';
//# sourceMappingURL=knex.types.d.ts.map

@@ -1,4 +0,4 @@

/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/no-unnecessary-type-parameters */
/* eslint-disable @typescript-eslint/no-explicit-any */
export {};
//# sourceMappingURL=knex.types.js.map

@@ -1,4 +0,2 @@

/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
export {};
//# sourceMappingURL=paging.types.js.map

@@ -1,2 +0,1 @@

/* eslint-disable @typescript-eslint/no-explicit-any */
import assert from 'node:assert';

@@ -34,3 +33,2 @@ import { defaultPropDescriptor } from '../config.js';

transaction.processingHooks.add(hook);
// eslint-disable-next-line no-await-in-loop
await hook(opts);

@@ -49,3 +47,2 @@ }

transaction.processingHooks.add(hook);
// eslint-disable-next-line no-await-in-loop
await hook(opts);

@@ -52,0 +49,0 @@ }

@@ -1,2 +0,2 @@

import type { CreateProxyTrxOptions, CreateProxyThenOptions } from '../kmore.js';
import type { CreateProxyThenOptions, CreateProxyTrxOptions } from '../kmore.js';
import type { KmoreTransaction } from '../types.js';

@@ -3,0 +3,0 @@ export declare function createQueryBuilderProxy(options: CreateProxyThenOptions): void;

@@ -1,2 +0,1 @@

/* eslint-disable @typescript-eslint/no-explicit-any */
import assert from 'node:assert';

@@ -36,3 +35,2 @@ import { defaultPropDescriptor } from '../config.js';

transaction.processingHooks.add(hook);
// eslint-disable-next-line no-await-in-loop
await hook(opts);

@@ -50,3 +48,2 @@ }

transaction.processingHooks.add(hook);
// eslint-disable-next-line no-await-in-loop
await hook(opts);

@@ -63,3 +60,2 @@ }

for (const hook of afterRollbackHooks) {
// eslint-disable-next-line no-await-in-loop
await hook(opts);

@@ -66,0 +62,0 @@ }

@@ -1,2 +0,1 @@

/* eslint-disable @typescript-eslint/no-explicit-any */
import assert from 'node:assert';

@@ -16,3 +15,2 @@ import { createTrxProxy } from '../../lib/proxy/proxy.index.js'; // use ## alias prevent from circular dependency checking

...defaultPropDescriptor,
// eslint-disable-next-line @typescript-eslint/unbound-method
value: transaction.savepoint,

@@ -19,0 +17,0 @@ });

@@ -1,3 +0,1 @@

/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
/* eslint-disable @typescript-eslint/no-explicit-any */
import assert from 'node:assert';

@@ -18,3 +16,2 @@ import { defaultPropDescriptor } from '../config.js';

for (const processor of responsePreHook) {
// eslint-disable-next-line no-await-in-loop
await processor(opts);

@@ -21,0 +18,0 @@ }

@@ -1,2 +0,1 @@

/* eslint-disable @typescript-eslint/no-explicit-any */
import assert from 'node:assert';

@@ -44,3 +43,2 @@ import { isPromise } from 'node:util/types';

assert(typeof hook === 'function', 'builderPostHook should be an array of functions');
// eslint-disable-next-line no-await-in-loop
await hook(opts);

@@ -100,3 +98,2 @@ }

try {
// eslint-disable-next-line no-await-in-loop
await processor(opts2);

@@ -103,0 +100,0 @@ }

@@ -1,2 +0,1 @@

/* eslint-disable @typescript-eslint/no-explicit-any */
import assert from 'node:assert';

@@ -3,0 +2,0 @@ import { defaultPropDescriptor } from '../config.js';

@@ -15,3 +15,3 @@ import assert from 'node:assert';

if (str.startsWith('Symbol(')) {
const key = str.match(/Symbol\((\S+)\)/u)?.[1];
const key = /Symbol\((\S+)\)/u.exec(str)?.[1];
assert(key, 'retrieve key from id failed, input should like "Symbol(***-1234567890)"');

@@ -18,0 +18,0 @@ key2 = `${key}-${Date.now().toString()}`;

{
"name": "kmore",
"author": "waiting",
"version": "67.0.0",
"version": "67.0.1",
"description": "A SQL query builder based on knex with powerful TypeScript type support",

@@ -46,7 +46,7 @@ "keywords": [

"devDependencies": {
"@mwcp/otel": "^38.2.0",
"kmore-cli": "^67.0.0",
"kmore-types": "^67.0.0",
"@mwcp/otel": "^38.2.1",
"kmore-cli": "^67.0.1",
"kmore-types": "^67.0.1",
"knex": "^3.1.0",
"pg": "^8.12.0"
"pg": "^8.13.0"
},

@@ -89,3 +89,3 @@ "engines": {

},
"gitHead": "1e77d5aee9880854550a0bac9fd2bf4145b24aec"
"gitHead": "3914d3e23d445481cd99ad58924d5c1c39814bf6"
}

@@ -1,3 +0,1 @@

/* eslint-disable max-params */
/* eslint-disable @typescript-eslint/ban-types */
import assert from 'node:assert'

@@ -76,3 +74,3 @@

// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
let builder = kmore.dbh(refName) as KmoreQueryBuilder

@@ -79,0 +77,0 @@

@@ -8,3 +8,3 @@ import assert from 'node:assert'

import { initPagingOptions } from '../proxy/proxy.auto-paging.js'
import { KmorePageKey, type CaseType } from '../types.js'
import { type CaseType, KmorePageKey } from '../types.js'

@@ -11,0 +11,0 @@ import type { KmoreQueryBuilder } from './builder.types.js'

@@ -1,6 +0,2 @@

/* eslint-disable @typescript-eslint/unified-signatures */
/* eslint-disable max-len */
/* eslint-disable @typescript-eslint/no-namespace */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/ban-types */
import type { ScopeType } from '@mwcp/share'

@@ -93,3 +89,3 @@ import type {

export type SmartJoin<
D extends {} = {},
D extends object = object,
CaseConvert extends CaseType = CaseType,

@@ -155,3 +151,3 @@ TResult = unknown[],

// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
on(event: string, callback: Function): QueryBuilder<D, CaseConvert, TRecord, TResult>

@@ -158,0 +154,0 @@

@@ -20,3 +20,3 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */

// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const scopedCols = dbDict.scoped[tableName]

@@ -23,0 +23,0 @@ if (typeof scopedCols === 'object') {

@@ -1,2 +0,2 @@

/* eslint-disable @typescript-eslint/no-explicit-any */
import assert from 'node:assert'

@@ -3,0 +3,0 @@

@@ -0,1 +1,2 @@

/* eslint-disable @typescript-eslint/no-unnecessary-type-parameters */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */

@@ -5,4 +6,4 @@ import assert from 'node:assert'

import {
camelKeys,
camelToSnake,
camelKeys,
snakeKeys,

@@ -12,3 +13,2 @@ snakeToCamel,

import type { RecordCamelKeys, RecordPascalKeys, RecordSnakeKeys } from '@waiting/shared-types'
// eslint-disable-next-line import/no-extraneous-dependencies
import type { Knex } from 'knex'

@@ -179,3 +179,3 @@

case CaseType.pascal:
throw Error('Not implemented yet for pascal case conversion')
throw new Error('Not implemented yet for pascal case conversion')

@@ -182,0 +182,0 @@ // return postProcessResponseToPascal(result, queryContext)

@@ -22,3 +22,3 @@ import { trxOnExceptionProcessor } from './exception.hook.js'

export function genHookList(input?: Partial<HookList> | undefined): HookList {
export function genHookList(input?: Partial<HookList>): HookList {
const ret: HookList = { ...initHookList }

@@ -25,0 +25,0 @@

@@ -9,3 +9,3 @@ import assert from 'node:assert'

} from '##/lib/paging.types.js'
import { initPageTypeMapping, type _PagingOptions } from '##/lib/proxy/proxy.auto-paging.js'
import { type _PagingOptions, initPageTypeMapping } from '##/lib/proxy/proxy.auto-paging.js'
import { KmoreBuilderType, KmorePageKey } from '##/lib/types.js'

@@ -12,0 +12,0 @@

@@ -10,3 +10,3 @@ import assert from 'node:assert'

import type { PagingOptions } from '##/lib/paging.types.js'
import { initPagingOptions, type _PagingOptions } from '##/lib/proxy/proxy.auto-paging.js'
import { type _PagingOptions, initPagingOptions } from '##/lib/proxy/proxy.auto-paging.js'
import { createQueryBuilderProxy } from '##/lib/proxy/proxy.index.js'

@@ -57,3 +57,3 @@ import { KmoreBuilderType, KmorePageKey } from '##/lib/types.js'

// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
// const pagingOptions: _PagingOptions = builder[KmorePageKey.PagingOptions]

@@ -154,3 +154,3 @@ assert(pagingOptions, 'pagingOptions should be set')

: total < Number.MAX_SAFE_INTEGER ? Number(total) : Number.MAX_SAFE_INTEGER
void builderPager.limit(limit).offset(offset >= 0 ? offset : 0)
void builderPager.limit(limit).offset(Math.max(offset, 0))

@@ -157,0 +157,0 @@ ret.builderPager = builderPager

@@ -8,8 +8,8 @@

export type {
PagingOptions,
PageRawType,
PageWrapType,
PagingMeta,
PagingOptions,
} from './paging.types.js'
export * from './hook/hook.types.js'
export type * from './hook/hook.types.js'
export * from './propagation.types.js'

@@ -16,0 +16,0 @@ export { wrapIdentifier } from './helper.js'

@@ -1,2 +0,2 @@

/* eslint-disable max-lines-per-function */
/* eslint-disable @typescript-eslint/no-explicit-any */

@@ -9,3 +9,3 @@ /* eslint-disable import/no-extraneous-dependencies */

import type { Knex } from 'knex'
// eslint-disable-next-line import/no-extraneous-dependencies, import/no-named-default
// eslint-disable-next-line import/no-named-default
import { default as _knex } from 'knex'

@@ -256,3 +256,3 @@

getTrxByQueryId(queryId: symbol, scope?: ScopeType | undefined): KmoreTransaction | undefined {
getTrxByQueryId(queryId: symbol, scope?: ScopeType): KmoreTransaction | undefined {
if (scope) {

@@ -304,3 +304,3 @@ const st = this.getTrxIdsByScope(scope)

for (const fn of transactionPreHooks) {
// eslint-disable-next-line no-await-in-loop
await fn(opts)

@@ -325,3 +325,3 @@ }

for (const fn of transactionPostHooks) {
// eslint-disable-next-line no-await-in-loop
await fn(opts2)

@@ -328,0 +328,0 @@ }

@@ -1,2 +0,2 @@

/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/no-empty-object-type */
/* eslint-disable @typescript-eslint/no-explicit-any */

@@ -3,0 +3,0 @@ import type { UnwrapArrayMember } from '@waiting/shared-types'

@@ -0,6 +1,5 @@

/* eslint-disable @typescript-eslint/no-unnecessary-type-parameters */
/* eslint-disable @typescript-eslint/unified-signatures */
/* eslint-disable max-len */
/* eslint-disable @typescript-eslint/no-namespace */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/ban-types */
import type { CaseType, UnwrapArrayMember } from '@waiting/shared-types'

@@ -99,3 +98,3 @@ import type { Knex } from 'knex'

TResult2 = ArrayIfAlready<TResult, any>,
TInnerRecord extends {} = any,
TInnerRecord extends object = any,
TInnerResult = any,

@@ -108,3 +107,3 @@ >(

TResult2 = ArrayIfAlready<TResult, any>,
TInnerRecord extends {} = any,
TInnerRecord extends object = any,
TInnerResult = any,

@@ -118,5 +117,5 @@ >(

interface AliasQueryBuilder<
D extends {} = {},
D extends object = object,
CaseConvert extends CaseType = CaseType,
TRecord extends {} = any,
TRecord extends object = any,
TResult = unknown[],

@@ -180,5 +179,5 @@ > {

interface ColumnNameQueryBuilder<
D extends {} = {},
D extends object = object,
CaseConvert extends CaseType = CaseType,
TRecord extends {} = any,
TRecord extends object = any,
TResult = unknown[],

@@ -243,5 +242,5 @@ > {

interface OrderBy<
D extends {} = {},
D extends object = object,
CaseConvert extends CaseType = CaseType,
TRecord extends {} = any,
TRecord extends object = any,
TResult = unknown[],

@@ -252,4 +251,4 @@ > {

columnName: keyof TRecord | QueryBuilder,
order?: 'asc' | 'desc' | undefined,
nulls?: 'first' | 'last' | undefined
order?: 'asc' | 'desc',
nulls?: 'first' | 'last'
): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>

@@ -259,4 +258,4 @@

columnName: string | QueryBuilder,
order?: string | undefined,
nulls?: string | undefined
order?: string,
nulls?: string
): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>

@@ -288,5 +287,5 @@

interface Where<
D extends {} = {},
D extends object = object,
CaseConvert extends CaseType = CaseType,
TRecord extends {} = any,
TRecord extends object = any,
TResult = any,

@@ -301,3 +300,3 @@ > extends WhereRaw<D, CaseConvert, TRecord, TResult> {

(object: Readonly<Object>): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>
(object: Readonly<object>): KmoreQueryBuilder<D, CaseConvert, TRecord, TResult>

@@ -322,3 +321,3 @@ <T extends keyof Knex.ResolveTableType<TRecord>>(

T extends keyof Knex.ResolveTableType<TRecord>,
TRecordInner extends {},
TRecordInner extends object,
TResultInner,

@@ -331,3 +330,3 @@ >(

<TRecordInner extends {}, TResultInner>(
<TRecordInner extends object, TResultInner>(
columnName: string,

@@ -340,3 +339,3 @@ operator: string,

<TRecordInner extends {}, TResultInner>(
<TRecordInner extends object, TResultInner>(
left: Knex.Raw,

@@ -349,5 +348,5 @@ operator: string,

interface WhereRaw<
D extends {} = {},
D extends object = object,
CaseConvert extends CaseType = CaseType,
TRecord extends {} = any,
TRecord extends object = any,
TResult = unknown[],

@@ -354,0 +353,0 @@ >

@@ -1,5 +0,4 @@

/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/no-unnecessary-type-parameters */
/* eslint-disable @typescript-eslint/no-explicit-any */
export type ArrayIfAlready<T1, T2> = AnyToUnknown<T1> extends any[] ? T2[] : T2

@@ -10,3 +9,3 @@ // If T is an array, get the type of member, else fall back to never

export type CurlyCurlyToAny<T> = T extends unknown // distribute
? (<U>() => U extends T ? 0 : 1) extends <U>() => U extends {} ? 0 : 1
? (<U>() => U extends T ? 0 : 1) extends <U>() => U extends object ? 0 : 1
? any

@@ -31,3 +30,3 @@ : T

// This is primarily to keep the signatures more intuitive.
export type AugmentParams<TTarget, TParams> = TParams extends {}
export type AugmentParams<TTarget, TParams> = TParams extends object
? keyof TParams extends never

@@ -40,3 +39,3 @@ ? TTarget

export type PartialOrAny<TBase, TKeys> = Boxed<TKeys> extends Boxed<never>
? {}
? object
: Boxed<TKeys> extends Boxed<keyof TBase>

@@ -50,6 +49,6 @@ ? SafePick<TBase, TKeys & keyof TBase>

}
export type SafePick<T, K extends keyof T> = T extends {} ? Pick<T, K> : any
export type SafePick<T, K extends keyof T> = T extends object ? Pick<T, K> : any
// This is primarily to prevent type incompatibilities where target can be unknown.
// While unknown can be assigned to any, Partial<unknown> can't be.
export type SafePartial<T> = Partial<AnyOrUnknownToOther<T, {}>>
export type SafePartial<T> = Partial<AnyOrUnknownToOther<T, object>>
export type AnyOrUnknownToOther<T1, T2> = unknown extends T1 ? T2 : T1

@@ -56,0 +55,0 @@

@@ -1,5 +0,2 @@

/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
export interface PagingOptions {

@@ -6,0 +3,0 @@ /**

@@ -1,2 +0,2 @@

/* eslint-disable @typescript-eslint/no-explicit-any */
import assert from 'node:assert'

@@ -49,3 +49,3 @@

transaction.processingHooks.add(hook)
// eslint-disable-next-line no-await-in-loop
await hook(opts)

@@ -64,3 +64,3 @@ }

transaction.processingHooks.add(hook)
// eslint-disable-next-line no-await-in-loop
await hook(opts)

@@ -67,0 +67,0 @@ }

@@ -1,2 +0,2 @@

import type { CreateProxyTrxOptions, CreateProxyThenOptions } from '../kmore.js'
import type { CreateProxyThenOptions, CreateProxyTrxOptions } from '../kmore.js'
import type { KmoreTransaction } from '../types.js'

@@ -3,0 +3,0 @@

@@ -1,2 +0,2 @@

/* eslint-disable @typescript-eslint/no-explicit-any */
import assert from 'node:assert'

@@ -50,3 +50,3 @@

transaction.processingHooks.add(hook)
// eslint-disable-next-line no-await-in-loop
await hook(opts)

@@ -64,3 +64,3 @@ }

transaction.processingHooks.add(hook)
// eslint-disable-next-line no-await-in-loop
await hook(opts)

@@ -78,3 +78,3 @@ }

for (const hook of afterRollbackHooks) {
// eslint-disable-next-line no-await-in-loop
await hook(opts)

@@ -81,0 +81,0 @@ }

@@ -1,2 +0,2 @@

/* eslint-disable @typescript-eslint/no-explicit-any */
import assert from 'node:assert'

@@ -26,3 +26,3 @@

...defaultPropDescriptor,
// eslint-disable-next-line @typescript-eslint/unbound-method
value: transaction.savepoint,

@@ -29,0 +29,0 @@ })

@@ -1,3 +0,2 @@

/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
/* eslint-disable @typescript-eslint/no-explicit-any */
import assert from 'node:assert'

@@ -30,3 +29,3 @@

for (const processor of responsePreHook) {
// eslint-disable-next-line no-await-in-loop
await processor(opts)

@@ -33,0 +32,0 @@ }

@@ -1,2 +0,2 @@

/* eslint-disable @typescript-eslint/no-explicit-any */
import assert from 'node:assert'

@@ -62,3 +62,3 @@ import { isPromise } from 'node:util/types'

assert(typeof hook === 'function', 'builderPostHook should be an array of functions')
// eslint-disable-next-line no-await-in-loop
await hook(opts)

@@ -122,3 +122,3 @@ }

try {
// eslint-disable-next-line no-await-in-loop
await processor(opts2)

@@ -125,0 +125,0 @@ }

@@ -1,2 +0,2 @@

/* eslint-disable @typescript-eslint/no-explicit-any */
import assert from 'node:assert'

@@ -3,0 +3,0 @@

/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/ban-types */
import type { ScopeType } from '@mwcp/share'

@@ -4,0 +3,0 @@ import { CaseType } from '@waiting/shared-types'

@@ -21,3 +21,3 @@ import assert from 'node:assert'

if (str.startsWith('Symbol(')) {
const key = str.match(/Symbol\((\S+)\)/u)?.[1]
const key = /Symbol\((\S+)\)/u.exec(str)?.[1]
assert(key, 'retrieve key from id failed, input should like "Symbol(***-1234567890)"')

@@ -24,0 +24,0 @@ key2 = `${key}-${Date.now().toString()}`

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc