@prisma/studio-core 0.2.0 → 0.2.2

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/dist/chunk-BUOKRYKO.js +10 -0
  2. package/dist/chunk-FRW62KTF.js +10 -0
  3. package/dist/chunk-O6LRAFT5.js +10 -0
  4. package/dist/chunk-P5LRZ6C2.js +10 -0
  5. package/dist/data/accelerate/index.cjs +2 -1
  6. package/dist/data/accelerate/index.d.cts +10 -2
  7. package/dist/data/accelerate/index.d.ts +10 -2
  8. package/dist/data/accelerate/index.js +10 -1
  9. package/dist/data/bff/index.cjs +2 -1
  10. package/dist/data/bff/index.d.cts +10 -3
  11. package/dist/data/bff/index.d.ts +10 -3
  12. package/dist/data/bff/index.js +10 -1
  13. package/dist/data/index.cjs +2 -1
  14. package/dist/data/index.d.cts +11 -2
  15. package/dist/data/index.d.ts +11 -2
  16. package/dist/data/index.js +10 -1
  17. package/dist/data/pglite/index.cjs +2 -1
  18. package/dist/data/pglite/index.d.cts +2 -2
  19. package/dist/data/pglite/index.d.ts +2 -2
  20. package/dist/data/pglite/index.js +10 -1
  21. package/dist/data/postgres-core/index.cjs +2 -1
  22. package/dist/data/postgres-core/index.d.cts +80 -20
  23. package/dist/data/postgres-core/index.d.ts +80 -20
  24. package/dist/data/postgres-core/index.js +10 -1
  25. package/dist/metafile-cjs.json +1 -0
  26. package/dist/metafile-esm.json +1 -0
  27. package/dist/{adapter-CKFCHq71.d.cts → query-Q-ZKX_Vr.d.cts} +94 -7
  28. package/dist/{adapter-CKFCHq71.d.ts → query-Q-ZKX_Vr.d.ts} +94 -7
  29. package/dist/ui/index.cjs +258 -1370
  30. package/dist/ui/index.css +1234 -700
  31. package/dist/ui/index.d.cts +69 -3
  32. package/dist/ui/index.d.ts +69 -3
  33. package/dist/ui/index.js +267 -42
  34. package/package.json +36 -32
  35. package/dist/CPIOZS5X-V4BHP4CI.js +0 -1
  36. package/dist/OKF6E45R-XYOIK2NY.js +0 -1
  37. package/dist/chunk-2ZJZX5I7.js +0 -0
  38. package/dist/chunk-5MNS4IJC.js +0 -1332
  39. package/dist/chunk-BMVJYUJW.js +0 -1
  40. package/dist/chunk-N2MLAUEV.js +0 -1
  41. package/dist/chunk-P72NBTYE.js +0 -1
  42. package/dist/chunk-XS52QRY2.js +0 -1
  43. package/dist/index-BDPv5Gnt.d.ts +0 -48
  44. package/dist/index-BNAA6jKD.d.cts +0 -48
@@ -1,13 +1,79 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { A as Adapter } from '../adapter-CKFCHq71.cjs';
2
+ import { A as Adapter, Q as Query, b as AdapterError } from '../query-Q-ZKX_Vr.cjs';
3
+ import { UseQueryStateOptions, UseQueryStateReturn, Options, UseQueryStatesOptions, UseQueryStatesReturn, Parser } from 'nuqs';
4
+ export * from 'nuqs';
5
+ import 'kysely';
3
6
 
7
+ type StudioLaunchedEventBase = {
8
+ name: "studio_launched";
9
+ payload: {
10
+ embeddingType?: string;
11
+ vendorId?: string;
12
+ tableCount: number;
13
+ };
14
+ };
15
+ type StudioOperationErrorEventBase = {
16
+ name: "studio_operation_error";
17
+ payload: {
18
+ operation: string;
19
+ query: Query | undefined;
20
+ error: AdapterError;
21
+ };
22
+ };
23
+ type StudioOperationSuccessEventBase = {
24
+ name: "studio_operation_success";
25
+ payload: {
26
+ operation: string;
27
+ query: Query;
28
+ error: undefined;
29
+ };
30
+ };
31
+ type StudioOperationEventBase = StudioOperationSuccessEventBase | StudioOperationErrorEventBase;
32
+ type StudioEventBase = StudioLaunchedEventBase | StudioOperationEventBase;
33
+ type StudioEvent = StudioEventBase & {
34
+ eventId: string;
35
+ timestamp: string;
36
+ };
4
37
  interface StudioProps {
5
38
  adapter: Adapter;
6
- onError?: (error: Error) => void;
39
+ onEvent?: (error: StudioEvent) => void;
7
40
  }
8
41
  /**
9
42
  * Main Studio component that provides database visualization and management
10
43
  */
11
44
  declare function Studio(props: StudioProps): react_jsx_runtime.JSX.Element;
12
45
 
13
- export { Studio, type StudioProps };
46
+ type StateKey = "pageIndex" | "pageSize" | "table" | "sort" | "schema" | "test" | "filter" | "view";
47
+ type Exact<A, W> = (A extends unknown ? W extends A ? {
48
+ [K in keyof A]: Exact<A[K], W[K]>;
49
+ } : W : never) | (A extends string | number | bigint | boolean | [] ? A : never);
50
+ declare function keyMap<const Map extends Partial<Record<StateKey, any>>>(keyMap: Exact<Map, Partial<Record<StateKey, any>>>): BrandedKeyMap<Map>;
51
+ declare function urlKeys<const Map extends Partial<Record<StateKey, string>>>(urlKeys: Exact<Map, Partial<Record<StateKey, string>>>): BrandedKeyMap<Map>;
52
+ declare const _BRAND_SYMBOL: unique symbol;
53
+ type BrandedKeyMap<Map> = Map & {
54
+ [K in typeof _BRAND_SYMBOL]: never;
55
+ };
56
+ /**
57
+ * @see {@link useQueryStateOriginal}
58
+ */
59
+ declare function useQueryState<T>(key: StateKey, options: UseQueryStateOptions<T> & {
60
+ defaultValue: T;
61
+ }): UseQueryStateReturn<NonNullable<ReturnType<typeof options.parse>>, typeof options.defaultValue>;
62
+ declare function useQueryState<T>(key: StateKey, options: UseQueryStateOptions<T>): UseQueryStateReturn<NonNullable<ReturnType<typeof options.parse>>, undefined>;
63
+ declare function useQueryState(key: StateKey, options: Options & {
64
+ defaultValue: string;
65
+ }): UseQueryStateReturn<string, typeof options.defaultValue>;
66
+ declare function useQueryState(key: StateKey, options: Pick<UseQueryStateOptions<string>, keyof Options>): UseQueryStateReturn<string, undefined>;
67
+ declare function useQueryState(key: StateKey): UseQueryStateReturn<string, undefined>;
68
+ type UseQueryStatesKeysMap<Map extends Partial<Record<StateKey, any>> = Partial<Record<StateKey, any>>> = {
69
+ [Key in keyof Map]: KeyMapValue<Map[Key]>;
70
+ };
71
+ type KeyMapValue<Type> = Parser<Type> & Options & {
72
+ defaultValue?: Type;
73
+ };
74
+ /**
75
+ * @see {@link useQueryStatesOriginal}
76
+ */
77
+ declare function useQueryStates<KeyMap extends UseQueryStatesKeysMap>(keyMap: BrandedKeyMap<KeyMap>, options?: Partial<UseQueryStatesOptions<KeyMap>>): UseQueryStatesReturn<KeyMap>;
78
+
79
+ export { type StateKey, Studio, type StudioProps, keyMap, urlKeys, useQueryState, useQueryStates };
@@ -1,13 +1,79 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { A as Adapter } from '../adapter-CKFCHq71.js';
2
+ import { A as Adapter, Q as Query, b as AdapterError } from '../query-Q-ZKX_Vr.js';
3
+ import { UseQueryStateOptions, UseQueryStateReturn, Options, UseQueryStatesOptions, UseQueryStatesReturn, Parser } from 'nuqs';
4
+ export * from 'nuqs';
5
+ import 'kysely';
3
6
 
7
+ type StudioLaunchedEventBase = {
8
+ name: "studio_launched";
9
+ payload: {
10
+ embeddingType?: string;
11
+ vendorId?: string;
12
+ tableCount: number;
13
+ };
14
+ };
15
+ type StudioOperationErrorEventBase = {
16
+ name: "studio_operation_error";
17
+ payload: {
18
+ operation: string;
19
+ query: Query | undefined;
20
+ error: AdapterError;
21
+ };
22
+ };
23
+ type StudioOperationSuccessEventBase = {
24
+ name: "studio_operation_success";
25
+ payload: {
26
+ operation: string;
27
+ query: Query;
28
+ error: undefined;
29
+ };
30
+ };
31
+ type StudioOperationEventBase = StudioOperationSuccessEventBase | StudioOperationErrorEventBase;
32
+ type StudioEventBase = StudioLaunchedEventBase | StudioOperationEventBase;
33
+ type StudioEvent = StudioEventBase & {
34
+ eventId: string;
35
+ timestamp: string;
36
+ };
4
37
  interface StudioProps {
5
38
  adapter: Adapter;
6
- onError?: (error: Error) => void;
39
+ onEvent?: (error: StudioEvent) => void;
7
40
  }
8
41
  /**
9
42
  * Main Studio component that provides database visualization and management
10
43
  */
11
44
  declare function Studio(props: StudioProps): react_jsx_runtime.JSX.Element;
12
45
 
13
- export { Studio, type StudioProps };
46
+ type StateKey = "pageIndex" | "pageSize" | "table" | "sort" | "schema" | "test" | "filter" | "view";
47
+ type Exact<A, W> = (A extends unknown ? W extends A ? {
48
+ [K in keyof A]: Exact<A[K], W[K]>;
49
+ } : W : never) | (A extends string | number | bigint | boolean | [] ? A : never);
50
+ declare function keyMap<const Map extends Partial<Record<StateKey, any>>>(keyMap: Exact<Map, Partial<Record<StateKey, any>>>): BrandedKeyMap<Map>;
51
+ declare function urlKeys<const Map extends Partial<Record<StateKey, string>>>(urlKeys: Exact<Map, Partial<Record<StateKey, string>>>): BrandedKeyMap<Map>;
52
+ declare const _BRAND_SYMBOL: unique symbol;
53
+ type BrandedKeyMap<Map> = Map & {
54
+ [K in typeof _BRAND_SYMBOL]: never;
55
+ };
56
+ /**
57
+ * @see {@link useQueryStateOriginal}
58
+ */
59
+ declare function useQueryState<T>(key: StateKey, options: UseQueryStateOptions<T> & {
60
+ defaultValue: T;
61
+ }): UseQueryStateReturn<NonNullable<ReturnType<typeof options.parse>>, typeof options.defaultValue>;
62
+ declare function useQueryState<T>(key: StateKey, options: UseQueryStateOptions<T>): UseQueryStateReturn<NonNullable<ReturnType<typeof options.parse>>, undefined>;
63
+ declare function useQueryState(key: StateKey, options: Options & {
64
+ defaultValue: string;
65
+ }): UseQueryStateReturn<string, typeof options.defaultValue>;
66
+ declare function useQueryState(key: StateKey, options: Pick<UseQueryStateOptions<string>, keyof Options>): UseQueryStateReturn<string, undefined>;
67
+ declare function useQueryState(key: StateKey): UseQueryStateReturn<string, undefined>;
68
+ type UseQueryStatesKeysMap<Map extends Partial<Record<StateKey, any>> = Partial<Record<StateKey, any>>> = {
69
+ [Key in keyof Map]: KeyMapValue<Map[Key]>;
70
+ };
71
+ type KeyMapValue<Type> = Parser<Type> & Options & {
72
+ defaultValue?: Type;
73
+ };
74
+ /**
75
+ * @see {@link useQueryStatesOriginal}
76
+ */
77
+ declare function useQueryStates<KeyMap extends UseQueryStatesKeysMap>(keyMap: BrandedKeyMap<KeyMap>, options?: Partial<UseQueryStatesOptions<KeyMap>>): UseQueryStatesReturn<KeyMap>;
78
+
79
+ export { type StateKey, Studio, type StudioProps, keyMap, urlKeys, useQueryState, useQueryStates };