@modelence/react-query 1.0.1 → 1.2.0

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 (46) hide show
  1. package/.yalc/modelence/README.md +86 -0
  2. package/.yalc/modelence/dist/bin/modelence.js +5 -0
  3. package/.yalc/modelence/dist/bin/modelence.js.map +1 -0
  4. package/.yalc/modelence/dist/chunk-3S2FFBNS.js +2 -0
  5. package/.yalc/modelence/dist/chunk-3S2FFBNS.js.map +1 -0
  6. package/.yalc/modelence/dist/chunk-3YAV3UUU.js +3 -0
  7. package/.yalc/modelence/dist/chunk-3YAV3UUU.js.map +1 -0
  8. package/.yalc/modelence/dist/chunk-55J6XMHW.js +2 -0
  9. package/.yalc/modelence/dist/chunk-55J6XMHW.js.map +1 -0
  10. package/.yalc/modelence/dist/chunk-C3UESBRX.js +2 -0
  11. package/.yalc/modelence/dist/chunk-C3UESBRX.js.map +1 -0
  12. package/.yalc/modelence/dist/chunk-DO5TZLF5.js +2 -0
  13. package/.yalc/modelence/dist/chunk-DO5TZLF5.js.map +1 -0
  14. package/.yalc/modelence/dist/chunk-DVECB2TP.js +3 -0
  15. package/.yalc/modelence/dist/chunk-DVECB2TP.js.map +1 -0
  16. package/.yalc/modelence/dist/client.d.ts +135 -0
  17. package/.yalc/modelence/dist/client.js +2 -0
  18. package/.yalc/modelence/dist/client.js.map +1 -0
  19. package/.yalc/modelence/dist/index-CwdohC5n.d.ts +15 -0
  20. package/.yalc/modelence/dist/index.d.ts +31 -0
  21. package/.yalc/modelence/dist/index.js +2 -0
  22. package/.yalc/modelence/dist/index.js.map +1 -0
  23. package/.yalc/modelence/dist/mongo.d.ts +5 -0
  24. package/.yalc/modelence/dist/mongo.js +2 -0
  25. package/.yalc/modelence/dist/mongo.js.map +1 -0
  26. package/.yalc/modelence/dist/package-3YQBVIVQ.js +2 -0
  27. package/.yalc/modelence/dist/package-3YQBVIVQ.js.map +1 -0
  28. package/.yalc/modelence/dist/server.d.ts +569 -0
  29. package/.yalc/modelence/dist/server.js +19 -0
  30. package/.yalc/modelence/dist/server.js.map +1 -0
  31. package/.yalc/modelence/dist/telemetry.d.ts +11 -0
  32. package/.yalc/modelence/dist/telemetry.js +2 -0
  33. package/.yalc/modelence/dist/telemetry.js.map +1 -0
  34. package/.yalc/modelence/dist/types-Ds1ESQSs.d.ts +106 -0
  35. package/.yalc/modelence/dist/types-WgRbQ-tj.d.ts +645 -0
  36. package/.yalc/modelence/dist/types.d.ts +7 -0
  37. package/.yalc/modelence/dist/types.js +2 -0
  38. package/.yalc/modelence/dist/types.js.map +1 -0
  39. package/.yalc/modelence/package.json +80 -0
  40. package/.yalc/modelence/yalc.sig +1 -0
  41. package/dist/index.d.ts +68 -1
  42. package/dist/index.js +1 -1
  43. package/dist/index.js.map +1 -1
  44. package/package.json +3 -2
  45. package/src/index.ts +158 -1
  46. package/yalc.lock +10 -0
@@ -0,0 +1,11 @@
1
+ declare function logDebug(message: string, args: object): void;
2
+ declare function logInfo(message: string, args: object): void;
3
+ declare function logError(message: string, args: object): void;
4
+ interface WrappedTransaction {
5
+ end(result?: string, context?: Record<string, unknown>): void;
6
+ setContext(context: Record<string, unknown>): void;
7
+ }
8
+ declare function startTransaction(type: 'method' | 'cron' | 'ai' | 'custom' | 'route', name: string, context?: Record<string, unknown>): WrappedTransaction;
9
+ declare function captureError(error: Error): void;
10
+
11
+ export { captureError, logDebug, logError, logInfo, startTransaction };
@@ -0,0 +1,2 @@
1
+ export{l as captureError,h as logDebug,j as logError,i as logInfo,k as startTransaction}from'./chunk-DVECB2TP.js';//# sourceMappingURL=telemetry.js.map
2
+ //# sourceMappingURL=telemetry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"telemetry.js"}
@@ -0,0 +1,106 @@
1
+ import { Server } from 'http';
2
+ import { Document, ObjectId } from 'mongodb';
3
+
4
+ type ConfigType = 'text' | 'string' | 'number' | 'boolean' | 'secret';
5
+ type ConfigKey = string;
6
+ type ConfigParams = {
7
+ type: ConfigType;
8
+ default: ValueType<ConfigType>;
9
+ isPublic: boolean;
10
+ };
11
+ type AppConfig = {
12
+ key: ConfigKey;
13
+ value: ValueType<ConfigType>;
14
+ type: ConfigType;
15
+ };
16
+ type ConfigSchema = {
17
+ [key: string]: ConfigParams;
18
+ };
19
+ type Configs = Record<ConfigKey, AppConfig>;
20
+ type ValueType<T> = T extends 'number' ? number : T extends 'string' ? string : T extends 'text' ? string : T extends 'boolean' ? boolean : T extends 'secret' ? string : never;
21
+
22
+ type User = Document;
23
+ type UserInfo = {
24
+ id: string;
25
+ handle: string;
26
+ roles: string[];
27
+ hasRole: (role: string) => boolean;
28
+ requireRole: (role: string) => void;
29
+ };
30
+ type Role = string;
31
+ type DefaultRoles = Record<'authenticated' | 'unauthenticated', Role | null>;
32
+ type Session = {
33
+ authToken: string;
34
+ expiresAt: Date;
35
+ userId: ObjectId | null;
36
+ };
37
+ type Permission = string;
38
+ type RoleDefinition = {
39
+ description?: string;
40
+ permissions: Permission[];
41
+ };
42
+
43
+ type canAccessChannel = (props: {
44
+ user: User | null;
45
+ session: Session | null;
46
+ roles: string[];
47
+ }) => Promise<boolean>;
48
+ declare class ServerChannel<T = unknown> {
49
+ readonly category: string;
50
+ readonly canAccessChannel: canAccessChannel | null;
51
+ constructor(category: string, canAccessChannel?: canAccessChannel);
52
+ broadcast(id: string, data: T): void;
53
+ }
54
+
55
+ declare class ClientChannel<T = unknown> {
56
+ readonly category: string;
57
+ private readonly onMessage;
58
+ constructor(category: string, onMessage: (data: T) => void);
59
+ init(): void;
60
+ joinChannel(id: string): void;
61
+ leaveChannel(id: string): void;
62
+ }
63
+
64
+ interface WebsocketServerProvider {
65
+ init(props: {
66
+ httpServer: Server;
67
+ channels: ServerChannel[];
68
+ }): Promise<void>;
69
+ broadcast<T>(props: {
70
+ category: string;
71
+ id: string;
72
+ data: T;
73
+ }): void;
74
+ }
75
+ interface WebsocketClientProvider {
76
+ init(props: {
77
+ channels?: ClientChannel[];
78
+ }): void;
79
+ on<T>(props: {
80
+ category: string;
81
+ listener: (data: T) => void;
82
+ }): void;
83
+ once<T>(props: {
84
+ category: string;
85
+ listener: (data: T) => void;
86
+ }): void;
87
+ off<T>(props: {
88
+ category: string;
89
+ listener: (data: T) => void;
90
+ }): void;
91
+ emit(props: {
92
+ eventName: string;
93
+ category: string;
94
+ id: string;
95
+ }): void;
96
+ joinChannel(props: {
97
+ category: string;
98
+ id: string;
99
+ }): void;
100
+ leaveChannel(props: {
101
+ category: string;
102
+ id: string;
103
+ }): void;
104
+ }
105
+
106
+ export { type AppConfig as A, type ConfigSchema as C, type DefaultRoles as D, type Permission as P, type RoleDefinition as R, ServerChannel as S, type User as U, type WebsocketServerProvider as W, type WebsocketClientProvider as a, type ConfigKey as b, ClientChannel as c, type Session as d, type UserInfo as e, type Role as f, type ConfigType as g, type Configs as h };