@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.
Files changed (44) hide show
  1. package/build/main/index.d.ts +7 -5
  2. package/build/main/index.js +13 -6
  3. package/build/main/index.js.map +1 -1
  4. package/build/main/local/index.d.ts +6 -2
  5. package/build/main/local/index.js +9 -2
  6. package/build/main/local/index.js.map +1 -1
  7. package/build/main/pganalyze-comment-plugin/comment-transformer.d.ts +21 -0
  8. package/build/main/pganalyze-comment-plugin/comment-transformer.js +90 -0
  9. package/build/main/pganalyze-comment-plugin/comment-transformer.js.map +1 -0
  10. package/build/main/pganalyze-comment-plugin/index.d.ts +9 -0
  11. package/build/main/pganalyze-comment-plugin/index.js +31 -0
  12. package/build/main/pganalyze-comment-plugin/index.js.map +1 -0
  13. package/build/main/test/index.d.ts +15 -0
  14. package/build/main/test/index.js +47 -0
  15. package/build/main/test/index.js.map +1 -0
  16. package/build/main/tsconfig.main.tsbuildinfo +1 -1
  17. package/build/main/v1.generated.d.ts +1 -0
  18. package/build/main/v1.generated.js.map +1 -1
  19. package/build/module/index.d.ts +7 -5
  20. package/build/module/index.js +14 -7
  21. package/build/module/index.js.map +1 -1
  22. package/build/module/local/index.d.ts +6 -2
  23. package/build/module/local/index.js +9 -2
  24. package/build/module/local/index.js.map +1 -1
  25. package/build/module/pganalyze-comment-plugin/comment-transformer.d.ts +21 -0
  26. package/build/module/pganalyze-comment-plugin/comment-transformer.js +87 -0
  27. package/build/module/pganalyze-comment-plugin/comment-transformer.js.map +1 -0
  28. package/build/module/pganalyze-comment-plugin/index.d.ts +9 -0
  29. package/build/module/pganalyze-comment-plugin/index.js +14 -0
  30. package/build/module/pganalyze-comment-plugin/index.js.map +1 -0
  31. package/build/module/test/index.d.ts +15 -0
  32. package/build/module/test/index.js +42 -0
  33. package/build/module/test/index.js.map +1 -0
  34. package/build/module/tsconfig.esm.tsbuildinfo +1 -1
  35. package/build/module/v1.generated.d.ts +1 -0
  36. package/build/module/v1.generated.js.map +1 -1
  37. package/package.json +1 -1
  38. package/src/index.ts +31 -8
  39. package/src/local/index.ts +14 -3
  40. package/src/pganalyze-comment-plugin/comment-transformer.ts +117 -0
  41. package/src/pganalyze-comment-plugin/index.ts +27 -0
  42. package/src/test/index.ts +63 -0
  43. package/src/v1.generated.ts +1 -0
  44. 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
+ }
@@ -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
- }