@vrplatform/kysely 1.3.20 → 1.3.21
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/build/.data.tar +0 -0
- package/package.json +5 -6
- package/src/camel-case/index.ts +0 -68
- package/src/error.ts +0 -6
- package/src/index.ts +0 -145
- package/src/isomorphic.ts +0 -33
- package/src/local/digest.ts +0 -44
- package/src/local/generate.ts +0 -137
- package/src/local/index.ts +0 -48
- package/src/pganalyze-comment-plugin/comment-transformer.ts +0 -117
- package/src/pganalyze-comment-plugin/index.ts +0 -27
- package/src/plugins.ts +0 -30
- package/src/query/index.ts +0 -1
- package/src/query/listing/index.ts +0 -1
- package/src/query/listing/is-active-or-at-least-one-ownership-period-active.ts +0 -29
- package/src/test/index.ts +0 -64
- package/src/v1.generated.ts +0 -1917
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './is-active-or-at-least-one-ownership-period-active';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { DB, ExpressionBuilder, PublicListing } from '../../isomorphic';
|
|
2
|
-
|
|
3
|
-
export function isActiveOrAtLeastOneOwnershipPeriodActive(
|
|
4
|
-
eb: ExpressionBuilder<DB & { listing: PublicListing }, 'listing'>,
|
|
5
|
-
today: string
|
|
6
|
-
) {
|
|
7
|
-
return eb.or([
|
|
8
|
-
eb('listing.status', '=', 'active'),
|
|
9
|
-
eb.exists(
|
|
10
|
-
eb
|
|
11
|
-
.selectFrom('public.listingOwnershipPeriod as period')
|
|
12
|
-
.select(eb.lit(1).as('one'))
|
|
13
|
-
.whereRef('period.listingId', '=', 'listing.id')
|
|
14
|
-
.where('period.setListingInactive', '=', false)
|
|
15
|
-
.where((eb2) =>
|
|
16
|
-
eb2.or([
|
|
17
|
-
eb2.and([
|
|
18
|
-
eb2('period.startAt', '<=', today),
|
|
19
|
-
eb2('period.endAt', '>=', today),
|
|
20
|
-
]),
|
|
21
|
-
eb2.and([
|
|
22
|
-
eb2('period.startAt', '<=', today),
|
|
23
|
-
eb2('period.endAt', 'is', null),
|
|
24
|
-
]),
|
|
25
|
-
])
|
|
26
|
-
)
|
|
27
|
-
),
|
|
28
|
-
]);
|
|
29
|
-
}
|
package/src/test/index.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { afterAll } from 'bun:test';
|
|
2
|
-
import type { Kysely } from 'kysely';
|
|
3
|
-
import { type UseLocalKyselyOptions, useLocalKysely } from '../local';
|
|
4
|
-
import type { DB } from '../v1.generated';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Use `useLocalKyselyResource` instead.
|
|
8
|
-
*/
|
|
9
|
-
export async function useTestKysely(
|
|
10
|
-
cleanupStrategy: 'afterAll',
|
|
11
|
-
args?: UseLocalKyselyOptions
|
|
12
|
-
) {
|
|
13
|
-
const kysely = await useLocalKysely(args);
|
|
14
|
-
|
|
15
|
-
if (cleanupStrategy === 'afterAll')
|
|
16
|
-
afterAll(async () => {
|
|
17
|
-
await kysely.destroy();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
kysely,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export async function useTestAutoCleanupKysely(args?: UseLocalKyselyOptions) {
|
|
26
|
-
const kysely = await useLocalKysely(args);
|
|
27
|
-
|
|
28
|
-
afterAll(async () => {
|
|
29
|
-
await kysely.destroy();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
return kysely;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
type ReturnType = Kysely<DB> & {
|
|
36
|
-
[Symbol.dispose]: () => Promise<void>;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export async function useLocalKyselyResource(
|
|
40
|
-
args?: UseLocalKyselyOptions
|
|
41
|
-
): Promise<ReturnType> {
|
|
42
|
-
const kysely = await useLocalKysely(args);
|
|
43
|
-
|
|
44
|
-
return new Proxy(
|
|
45
|
-
{},
|
|
46
|
-
{
|
|
47
|
-
get(_target, prop) {
|
|
48
|
-
// somehow not working if using Symbol.dispose
|
|
49
|
-
if (prop === Symbol.asyncDispose) {
|
|
50
|
-
return async () => {
|
|
51
|
-
await kysely.destroy();
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
if (prop === 'kysely') {
|
|
55
|
-
return kysely;
|
|
56
|
-
}
|
|
57
|
-
if (typeof kysely[prop] === 'function') {
|
|
58
|
-
return kysely[prop].bind(kysely);
|
|
59
|
-
}
|
|
60
|
-
return kysely[prop];
|
|
61
|
-
},
|
|
62
|
-
}
|
|
63
|
-
) as ReturnType;
|
|
64
|
-
}
|