@qwickapps/server 1.5.1 → 1.6.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 (135) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/core/control-panel.d.ts.map +1 -1
  3. package/dist/core/control-panel.js +41 -0
  4. package/dist/core/control-panel.js.map +1 -1
  5. package/dist/core/guards.d.ts.map +1 -1
  6. package/dist/core/guards.js +77 -0
  7. package/dist/core/guards.js.map +1 -1
  8. package/dist/core/health-manager.d.ts +4 -0
  9. package/dist/core/health-manager.d.ts.map +1 -1
  10. package/dist/core/health-manager.js +6 -1
  11. package/dist/core/health-manager.js.map +1 -1
  12. package/dist/core/plugin-registry.d.ts +55 -5
  13. package/dist/core/plugin-registry.d.ts.map +1 -1
  14. package/dist/core/plugin-registry.js +57 -19
  15. package/dist/core/plugin-registry.js.map +1 -1
  16. package/dist/core/types.d.ts +2 -0
  17. package/dist/core/types.d.ts.map +1 -1
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +3 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/plugins/api-keys/api-keys-plugin.d.ts +46 -0
  23. package/dist/plugins/api-keys/api-keys-plugin.d.ts.map +1 -0
  24. package/dist/plugins/api-keys/api-keys-plugin.js +329 -0
  25. package/dist/plugins/api-keys/api-keys-plugin.js.map +1 -0
  26. package/dist/plugins/api-keys/index.d.ts +14 -0
  27. package/dist/plugins/api-keys/index.d.ts.map +1 -0
  28. package/dist/plugins/api-keys/index.js +17 -0
  29. package/dist/plugins/api-keys/index.js.map +1 -0
  30. package/dist/plugins/api-keys/middleware/bearer-token-auth.d.ts +74 -0
  31. package/dist/plugins/api-keys/middleware/bearer-token-auth.d.ts.map +1 -0
  32. package/dist/plugins/api-keys/middleware/bearer-token-auth.js +201 -0
  33. package/dist/plugins/api-keys/middleware/bearer-token-auth.js.map +1 -0
  34. package/dist/plugins/api-keys/middleware/index.d.ts +7 -0
  35. package/dist/plugins/api-keys/middleware/index.d.ts.map +1 -0
  36. package/dist/plugins/api-keys/middleware/index.js +7 -0
  37. package/dist/plugins/api-keys/middleware/index.js.map +1 -0
  38. package/dist/plugins/api-keys/stores/index.d.ts +7 -0
  39. package/dist/plugins/api-keys/stores/index.d.ts.map +1 -0
  40. package/dist/plugins/api-keys/stores/index.js +7 -0
  41. package/dist/plugins/api-keys/stores/index.js.map +1 -0
  42. package/dist/plugins/api-keys/stores/postgres-store.d.ts +34 -0
  43. package/dist/plugins/api-keys/stores/postgres-store.d.ts.map +1 -0
  44. package/dist/plugins/api-keys/stores/postgres-store.js +360 -0
  45. package/dist/plugins/api-keys/stores/postgres-store.js.map +1 -0
  46. package/dist/plugins/api-keys/types.d.ts +268 -0
  47. package/dist/plugins/api-keys/types.d.ts.map +1 -0
  48. package/dist/plugins/api-keys/types.js +56 -0
  49. package/dist/plugins/api-keys/types.js.map +1 -0
  50. package/dist/plugins/auth/auth-plugin.d.ts.map +1 -1
  51. package/dist/plugins/auth/auth-plugin.js +17 -1
  52. package/dist/plugins/auth/auth-plugin.js.map +1 -1
  53. package/dist/plugins/auth/auth-plugin.test.js +133 -0
  54. package/dist/plugins/auth/auth-plugin.test.js.map +1 -1
  55. package/dist/plugins/auth/env-config.d.ts.map +1 -1
  56. package/dist/plugins/auth/env-config.js +6 -2
  57. package/dist/plugins/auth/env-config.js.map +1 -1
  58. package/dist/plugins/auth/types.d.ts +10 -0
  59. package/dist/plugins/auth/types.d.ts.map +1 -1
  60. package/dist/plugins/auth/types.js.map +1 -1
  61. package/dist/plugins/devices/__tests__/token-utils.test.js +4 -2
  62. package/dist/plugins/devices/__tests__/token-utils.test.js.map +1 -1
  63. package/dist/plugins/frontend-app-plugin.d.ts.map +1 -1
  64. package/dist/plugins/frontend-app-plugin.js +21 -4
  65. package/dist/plugins/frontend-app-plugin.js.map +1 -1
  66. package/dist/plugins/index.d.ts +2 -0
  67. package/dist/plugins/index.d.ts.map +1 -1
  68. package/dist/plugins/index.js +2 -0
  69. package/dist/plugins/index.js.map +1 -1
  70. package/dist/plugins/qwickbrain/index.d.ts +25 -0
  71. package/dist/plugins/qwickbrain/index.d.ts.map +1 -0
  72. package/dist/plugins/qwickbrain/index.js +24 -0
  73. package/dist/plugins/qwickbrain/index.js.map +1 -0
  74. package/dist/plugins/qwickbrain/qwickbrain-plugin.d.ts +23 -0
  75. package/dist/plugins/qwickbrain/qwickbrain-plugin.d.ts.map +1 -0
  76. package/dist/plugins/qwickbrain/qwickbrain-plugin.js +528 -0
  77. package/dist/plugins/qwickbrain/qwickbrain-plugin.js.map +1 -0
  78. package/dist/plugins/qwickbrain/types.d.ts +131 -0
  79. package/dist/plugins/qwickbrain/types.d.ts.map +1 -0
  80. package/dist/plugins/qwickbrain/types.js +9 -0
  81. package/dist/plugins/qwickbrain/types.js.map +1 -0
  82. package/dist/plugins/users/__tests__/postgres-store.test.js +1 -0
  83. package/dist/plugins/users/__tests__/postgres-store.test.js.map +1 -1
  84. package/dist/plugins/users/__tests__/users-plugin.test.js +3 -0
  85. package/dist/plugins/users/__tests__/users-plugin.test.js.map +1 -1
  86. package/dist/plugins/users/stores/postgres-store.d.ts.map +1 -1
  87. package/dist/plugins/users/stores/postgres-store.js +59 -1
  88. package/dist/plugins/users/stores/postgres-store.js.map +1 -1
  89. package/dist/plugins/users/types.d.ts +22 -0
  90. package/dist/plugins/users/types.d.ts.map +1 -1
  91. package/dist-ui/assets/index-5nX8fM1a.js +469 -0
  92. package/dist-ui/assets/index-5nX8fM1a.js.map +1 -0
  93. package/dist-ui/index.html +1 -1
  94. package/dist-ui-lib/api/controlPanelApi.d.ts +68 -0
  95. package/dist-ui-lib/components/index.d.ts +2 -1
  96. package/dist-ui-lib/index.js +2642 -2281
  97. package/dist-ui-lib/index.js.map +1 -1
  98. package/dist-ui-lib/pages/APIKeysPage.d.ts +13 -0
  99. package/dist-ui-lib/pages/AcceptInvitationPage.d.ts +28 -0
  100. package/package.json +3 -2
  101. package/src/core/control-panel.ts +47 -0
  102. package/src/core/guards.ts +89 -0
  103. package/src/core/health-manager.ts +6 -1
  104. package/src/core/plugin-registry.ts +123 -25
  105. package/src/core/types.ts +2 -0
  106. package/src/index.ts +11 -0
  107. package/src/plugins/api-keys/api-keys-plugin.ts +397 -0
  108. package/src/plugins/api-keys/index.ts +49 -0
  109. package/src/plugins/api-keys/middleware/bearer-token-auth.ts +250 -0
  110. package/src/plugins/api-keys/middleware/index.ts +12 -0
  111. package/src/plugins/api-keys/stores/index.ts +7 -0
  112. package/src/plugins/api-keys/stores/postgres-store.ts +487 -0
  113. package/src/plugins/api-keys/types.ts +243 -0
  114. package/src/plugins/auth/auth-plugin.test.ts +167 -0
  115. package/src/plugins/auth/auth-plugin.ts +17 -1
  116. package/src/plugins/auth/env-config.ts +6 -2
  117. package/src/plugins/auth/types.ts +10 -0
  118. package/src/plugins/devices/__tests__/token-utils.test.ts +4 -2
  119. package/src/plugins/frontend-app-plugin.ts +24 -4
  120. package/src/plugins/index.ts +15 -0
  121. package/src/plugins/qwickbrain/index.ts +33 -0
  122. package/src/plugins/qwickbrain/qwickbrain-plugin.ts +642 -0
  123. package/src/plugins/qwickbrain/types.ts +146 -0
  124. package/src/plugins/users/__tests__/postgres-store.test.ts +1 -0
  125. package/src/plugins/users/__tests__/users-plugin.test.ts +3 -0
  126. package/src/plugins/users/stores/postgres-store.ts +69 -0
  127. package/src/plugins/users/types.ts +25 -0
  128. package/ui/src/App.tsx +6 -1
  129. package/ui/src/api/controlPanelApi.ts +206 -37
  130. package/ui/src/components/index.ts +6 -0
  131. package/ui/src/pages/APIKeysPage.tsx +661 -0
  132. package/ui/src/pages/AcceptInvitationPage.tsx +169 -0
  133. package/ui/src/pages/UsersPage.tsx +225 -2
  134. package/dist-ui/assets/index-CynOqPkb.js +0 -469
  135. package/dist-ui/assets/index-CynOqPkb.js.map +0 -1
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Control Panel</title>
7
- <script type="module" crossorigin src="/assets/index-CynOqPkb.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-5nX8fM1a.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-CiizQQnb.css">
9
9
  </head>
10
10
  <body>
@@ -73,10 +73,14 @@ export interface LogSource {
73
73
  type: 'file' | 'api';
74
74
  available: boolean;
75
75
  }
76
+ export type UserStatus = 'invited' | 'active' | 'suspended';
76
77
  export interface User {
77
78
  id: string;
78
79
  email: string;
79
80
  name?: string;
81
+ status: UserStatus;
82
+ invitation_token?: string;
83
+ invitation_expires_at?: string;
80
84
  created_at?: string;
81
85
  updated_at?: string;
82
86
  last_login?: string;
@@ -88,6 +92,26 @@ export interface UsersResponse {
88
92
  page: number;
89
93
  limit: number;
90
94
  }
95
+ export interface InviteUserRequest {
96
+ email: string;
97
+ name?: string;
98
+ role?: string;
99
+ metadata?: Record<string, unknown>;
100
+ expiresInDays?: number;
101
+ }
102
+ export interface InvitationResponse {
103
+ user: User;
104
+ token: string;
105
+ inviteLink: string;
106
+ expiresAt: string;
107
+ }
108
+ export interface AcceptInvitationRequest {
109
+ token: string;
110
+ }
111
+ export interface AcceptInvitationResponse {
112
+ success: boolean;
113
+ user: User;
114
+ }
91
115
  export interface Ban {
92
116
  id: string;
93
117
  user_id?: string;
@@ -101,6 +125,36 @@ export interface BansResponse {
101
125
  bans: Ban[];
102
126
  total: number;
103
127
  }
128
+ export interface ApiKey {
129
+ id: string;
130
+ name: string;
131
+ key_prefix: string;
132
+ key_type: 'm2m' | 'pat';
133
+ scopes: Array<'read' | 'write' | 'admin'>;
134
+ last_used_at: string | null;
135
+ expires_at: string | null;
136
+ is_active: boolean;
137
+ created_at: string;
138
+ updated_at: string;
139
+ }
140
+ export interface ApiKeyWithPlaintext extends ApiKey {
141
+ key: string;
142
+ }
143
+ export interface ApiKeysResponse {
144
+ keys: ApiKey[];
145
+ }
146
+ export interface CreateApiKeyRequest {
147
+ name: string;
148
+ key_type: 'm2m' | 'pat';
149
+ scopes: Array<'read' | 'write' | 'admin'>;
150
+ expires_at?: string;
151
+ }
152
+ export interface UpdateApiKeyRequest {
153
+ name?: string;
154
+ scopes?: Array<'read' | 'write' | 'admin'>;
155
+ expires_at?: string;
156
+ is_active?: boolean;
157
+ }
104
158
  export interface EntitlementDefinition {
105
159
  id: string;
106
160
  name: string;
@@ -377,6 +431,12 @@ declare class ControlPanelApi {
377
431
  * Get the base URL for API requests.
378
432
  */
379
433
  getBaseUrl(): string;
434
+ /**
435
+ * Internal fetch wrapper that includes credentials for Basic Auth support.
436
+ * Using 'same-origin' ensures the browser sends stored Basic Auth credentials
437
+ * without embedding them in the URL (which would cause fetch to fail).
438
+ */
439
+ private _fetch;
380
440
  /**
381
441
  * Generic fetch method for API requests.
382
442
  * Automatically prepends the base URL and /api prefix.
@@ -393,6 +453,9 @@ declare class ControlPanelApi {
393
453
  search?: string;
394
454
  }): Promise<UsersResponse>;
395
455
  getUserById(id: string): Promise<User>;
456
+ inviteUser(request: InviteUserRequest): Promise<InvitationResponse>;
457
+ acceptInvitation(token: string): Promise<AcceptInvitationResponse>;
458
+ getInvitations(): Promise<UsersResponse>;
396
459
  getBans(): Promise<BansResponse>;
397
460
  banUser(email: string, reason: string, expiresAt?: string): Promise<void>;
398
461
  unbanUser(email: string): Promise<void>;
@@ -460,6 +523,11 @@ declare class ControlPanelApi {
460
523
  success: boolean;
461
524
  message: string;
462
525
  }>;
526
+ getApiKeys(): Promise<ApiKeysResponse>;
527
+ createApiKey(request: CreateApiKeyRequest): Promise<ApiKeyWithPlaintext>;
528
+ getApiKey(keyId: string): Promise<ApiKey>;
529
+ updateApiKey(keyId: string, updates: UpdateApiKeyRequest): Promise<ApiKey>;
530
+ deleteApiKey(keyId: string): Promise<void>;
463
531
  }
464
532
  export declare const api: ControlPanelApi;
465
533
  export {};
@@ -13,6 +13,7 @@ export { SystemPage } from '../pages/SystemPage';
13
13
  export { NotFoundPage } from '../pages/NotFoundPage';
14
14
  export { UsersPage, type UsersPageProps } from '../pages/UsersPage';
15
15
  export { EntitlementsPage, type EntitlementsPageProps } from '../pages/EntitlementsPage';
16
+ export { AcceptInvitationPage, type AcceptInvitationPageProps } from '../pages/AcceptInvitationPage';
16
17
  export { DashboardWidgetProvider, useDashboardWidgets, useRegisterWidget, DashboardWidgetRenderer, type DashboardWidget, type DashboardWidgetProviderProps, WidgetComponentRegistryProvider, useWidgetComponentRegistry, PluginWidgetRenderer, getBuiltInWidgetComponents, ServiceHealthWidget, type WidgetComponent, type WidgetComponentRegistryProviderProps, } from '../dashboard';
17
18
  export { api } from '../api/controlPanelApi';
18
- export type { HealthCheck, HealthResponse, InfoResponse, DiagnosticsResponse, ConfigResponse, LogEntry, LogsResponse, LogSource, User, UsersResponse, Ban, BansResponse, EntitlementDefinition, EntitlementResult, EntitlementSourceInfo, EntitlementsStatus, PluginFeatures, } from '../api/controlPanelApi';
19
+ export type { HealthCheck, HealthResponse, InfoResponse, DiagnosticsResponse, ConfigResponse, LogEntry, LogsResponse, LogSource, UserStatus, User, UsersResponse, InviteUserRequest, InvitationResponse, AcceptInvitationRequest, AcceptInvitationResponse, Ban, BansResponse, EntitlementDefinition, EntitlementResult, EntitlementSourceInfo, EntitlementsStatus, PluginFeatures, } from '../api/controlPanelApi';