@vrplatform/kysely 1.3.1 → 1.3.3
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/main/index.d.ts +7 -5
- package/build/main/index.js +13 -6
- package/build/main/index.js.map +1 -1
- package/build/main/local/index.d.ts +6 -2
- package/build/main/local/index.js +9 -2
- package/build/main/local/index.js.map +1 -1
- package/build/main/pganalyze-comment-plugin/comment-transformer.d.ts +21 -0
- package/build/main/pganalyze-comment-plugin/comment-transformer.js +90 -0
- package/build/main/pganalyze-comment-plugin/comment-transformer.js.map +1 -0
- package/build/main/pganalyze-comment-plugin/index.d.ts +9 -0
- package/build/main/pganalyze-comment-plugin/index.js +31 -0
- package/build/main/pganalyze-comment-plugin/index.js.map +1 -0
- package/build/main/test/index.d.ts +15 -0
- package/build/main/test/index.js +47 -0
- package/build/main/test/index.js.map +1 -0
- package/build/main/tsconfig.main.tsbuildinfo +1 -1
- package/build/main/v1.generated.d.ts +1 -0
- package/build/main/v1.generated.js.map +1 -1
- package/build/module/index.d.ts +7 -5
- package/build/module/index.js +14 -7
- package/build/module/index.js.map +1 -1
- package/build/module/local/index.d.ts +6 -2
- package/build/module/local/index.js +9 -2
- package/build/module/local/index.js.map +1 -1
- package/build/module/pganalyze-comment-plugin/comment-transformer.d.ts +21 -0
- package/build/module/pganalyze-comment-plugin/comment-transformer.js +87 -0
- package/build/module/pganalyze-comment-plugin/comment-transformer.js.map +1 -0
- package/build/module/pganalyze-comment-plugin/index.d.ts +9 -0
- package/build/module/pganalyze-comment-plugin/index.js +14 -0
- package/build/module/pganalyze-comment-plugin/index.js.map +1 -0
- package/build/module/test/index.d.ts +15 -0
- package/build/module/test/index.js +42 -0
- package/build/module/test/index.js.map +1 -0
- package/build/module/tsconfig.esm.tsbuildinfo +1 -1
- package/build/module/v1.generated.d.ts +1 -0
- package/build/module/v1.generated.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +31 -8
- package/src/local/index.ts +14 -3
- package/src/pganalyze-comment-plugin/comment-transformer.ts +117 -0
- package/src/pganalyze-comment-plugin/index.ts +27 -0
- package/src/test/index.ts +63 -0
- package/src/v1.generated.ts +1 -0
- package/src/test.ts +0 -19
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
KyselyPlugin,
|
|
3
|
+
PluginTransformQueryArgs,
|
|
4
|
+
PluginTransformResultArgs,
|
|
5
|
+
QueryResult,
|
|
6
|
+
RootOperationNode,
|
|
7
|
+
UnknownRow,
|
|
8
|
+
} from 'kysely';
|
|
9
|
+
import { CommentTransformer } from './comment-transformer';
|
|
10
|
+
|
|
11
|
+
export class KyselyPganalyzeCommentPlugin implements KyselyPlugin {
|
|
12
|
+
readonly #transformer: CommentTransformer;
|
|
13
|
+
|
|
14
|
+
constructor(options: { repository: string }) {
|
|
15
|
+
this.#transformer = new CommentTransformer(options.repository);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
transformQuery(args: PluginTransformQueryArgs): RootOperationNode {
|
|
19
|
+
return this.#transformer.transformRootNode(args.node);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async transformResult(
|
|
23
|
+
args: PluginTransformResultArgs
|
|
24
|
+
): Promise<QueryResult<UnknownRow>> {
|
|
25
|
+
return args.result;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
if (prop === Symbol.dispose) {
|
|
49
|
+
return async () => {
|
|
50
|
+
await kysely.destroy();
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (prop === 'kysely') {
|
|
54
|
+
return kysely;
|
|
55
|
+
}
|
|
56
|
+
if (typeof kysely[prop] === 'function') {
|
|
57
|
+
return kysely[prop].bind(kysely);
|
|
58
|
+
}
|
|
59
|
+
return kysely[prop];
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
) as ReturnType;
|
|
63
|
+
}
|
package/src/v1.generated.ts
CHANGED
|
@@ -1342,6 +1342,7 @@ export interface PublicReservation {
|
|
|
1342
1342
|
lineMap: Json | null;
|
|
1343
1343
|
listingConnectionId: string | null;
|
|
1344
1344
|
listingId: string | null;
|
|
1345
|
+
matchPaymentCustomerRef: string | null;
|
|
1345
1346
|
metadata: Json | null;
|
|
1346
1347
|
nights: number | null;
|
|
1347
1348
|
otaReservationId: string | null;
|
package/src/test.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { afterAll } from 'bun:test';
|
|
2
|
-
import { useLocalKysely } from './local';
|
|
3
|
-
|
|
4
|
-
export async function useTestKysely(
|
|
5
|
-
cleanupStrategy: 'afterAll' | 'using' | 'manual'
|
|
6
|
-
) {
|
|
7
|
-
const kysely = await useLocalKysely();
|
|
8
|
-
|
|
9
|
-
if (cleanupStrategy === 'afterAll')
|
|
10
|
-
afterAll(async () => {
|
|
11
|
-
await kysely.destroy();
|
|
12
|
-
});
|
|
13
|
-
return {
|
|
14
|
-
kysely,
|
|
15
|
-
[Symbol.dispose]: async () => {
|
|
16
|
-
await kysely.destroy();
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
}
|