@plyaz/types 1.46.0 → 1.46.1

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.
@@ -12,6 +12,7 @@ import type { CoreBaseDomainServiceConfig } from '../domain';
12
12
  import type { CoreBaseServiceConfig, CoreBaseMapperInstance, CoreBaseValidatorInstance } from '../domain';
13
13
  import type { CoreDomainServiceInstance, CoreObservabilityConfig, CoreServiceEntry } from '../init';
14
14
  import type { PackageErrorLike } from '../../errors';
15
+ import type { DevtoolsConfig } from '../../devtools';
15
16
  /**
16
17
  * Base store interface for frontend services.
17
18
  *
@@ -1102,6 +1103,8 @@ export interface CorePlyazConfig {
1102
1103
  observability?: CoreObservabilityConfig;
1103
1104
  /** Enable verbose logging */
1104
1105
  verbose?: boolean;
1106
+ /** DevTools configuration */
1107
+ devtools?: DevtoolsConfig;
1105
1108
  }
1106
1109
  /**
1107
1110
  * Interface for services that can provide feature flags.
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=index.cjs.map
4
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * DevTools Types Module
3
+ *
4
+ * @module devtools
5
+ */
6
+ export type * from './types';
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,238 @@
1
+ /**
2
+ * DevTools Types
3
+ *
4
+ * Type definitions for PlyazDevtools configuration and state.
5
+ * These types are used by @plyaz/core/devtools.
6
+ *
7
+ * @module devtools
8
+ */
9
+ import type { ComponentType, ReactNode } from 'react';
10
+ import type { CorePlyazConfig } from '../core';
11
+ /**
12
+ * Available devtools tab identifiers
13
+ */
14
+ export type DevtoolsTab = 'stores' | 'actions' | 'api' | 'streaming' | 'security' | 'compliance' | 'accessibility' | 'services' | 'errors' | 'events' | 'uploads' | 'observability' | 'config' | 'storage' | 'playground' | 'runner' | 'flags' | 'mocking' | 'explorer' | 'ssr' | 'routes' | 'i18n' | 'react' | 'console' | 'shortcuts';
15
+ /**
16
+ * Tab group configuration
17
+ */
18
+ export interface TabGroupConfig {
19
+ /** Group identifier */
20
+ id: string;
21
+ /** Display name */
22
+ name: string;
23
+ /** Short name for compact displays */
24
+ shortName: string;
25
+ /** Icon (emoji or component) */
26
+ icon: string;
27
+ /** Color theme for the group */
28
+ color: string;
29
+ /** Tabs in this group */
30
+ tabs: DevtoolsTab[];
31
+ /** Description for tooltips */
32
+ description?: string;
33
+ }
34
+ /**
35
+ * Tab plugin definition for custom tabs
36
+ */
37
+ export interface TabPlugin {
38
+ /** Unique identifier for the tab */
39
+ id: string;
40
+ /** Tab metadata */
41
+ metadata: {
42
+ /** Full display name */
43
+ name: string;
44
+ /** Short name for compact displays */
45
+ shortName: string;
46
+ /** Icon (emoji or component) */
47
+ icon: ReactNode;
48
+ /** Group to place this tab in */
49
+ group?: string;
50
+ /** Keywords for search */
51
+ keywords?: string[];
52
+ /** Description for tooltips/search */
53
+ description?: string;
54
+ };
55
+ /** Tab component */
56
+ component: ComponentType;
57
+ /** Optional lifecycle hooks */
58
+ onMount?: () => void;
59
+ onUnmount?: () => void;
60
+ /** Required adapters for this tab to work */
61
+ requiredAdapters?: string[];
62
+ }
63
+ /**
64
+ * Keyboard shortcut configuration
65
+ */
66
+ export interface ShortcutConfig {
67
+ /** Shortcut key combination (e.g., 'Ctrl+K') */
68
+ key: string;
69
+ /** Action identifier */
70
+ action: string;
71
+ /** Description for help */
72
+ description?: string;
73
+ /** Whether this shortcut is enabled */
74
+ enabled?: boolean;
75
+ }
76
+ /**
77
+ * Storage adapter interface for custom storage implementations
78
+ */
79
+ export interface DevtoolsStorageAdapter {
80
+ get<T>(key: string): Promise<T | null>;
81
+ set<T>(key: string, value: T): Promise<void>;
82
+ delete(key: string): Promise<void>;
83
+ clear(): Promise<void>;
84
+ }
85
+ /**
86
+ * Core adapter configuration for @plyaz/core integration
87
+ */
88
+ export interface CoreAdapterConfig {
89
+ /** Hook to check if core is ready */
90
+ useReady?: () => boolean;
91
+ /** Hook to get core context */
92
+ useContext?: () => unknown;
93
+ /** Hook to get event manager */
94
+ useEvents?: () => unknown;
95
+ }
96
+ /**
97
+ * Store adapter configuration for @plyaz/store integration
98
+ */
99
+ export interface StoreAdapterConfig {
100
+ /** Hook to get root store */
101
+ useRootStore?: () => unknown;
102
+ /** Hook to get errors */
103
+ useErrors?: () => unknown[];
104
+ /** Hook to check stream connection */
105
+ useStreamConnected?: () => boolean;
106
+ /** Hook to get stream messages */
107
+ useStreamMessages?: () => unknown[];
108
+ /** Custom store hooks */
109
+ [key: string]: (() => unknown) | undefined;
110
+ }
111
+ /**
112
+ * App config adapter for accessing application configuration
113
+ */
114
+ export interface ConfigAdapterConfig {
115
+ /** Get frontend configuration */
116
+ getFrontendConfig?: () => unknown;
117
+ /** Get environment variables */
118
+ getEnv?: () => Record<string, unknown>;
119
+ /** Get feature flags */
120
+ getFeatureFlags?: () => Record<string, boolean>;
121
+ }
122
+ /**
123
+ * Package export configuration for ExplorerTab
124
+ */
125
+ export interface PackageExport {
126
+ name: string;
127
+ displayName: string;
128
+ color: string;
129
+ exports: Record<string, unknown>;
130
+ }
131
+ /**
132
+ * App-specific configuration passed to devtools
133
+ * This allows devtools to work generically across different Plyaz apps
134
+ *
135
+ * @template TConfig - The frontend config type (defaults to CorePlyazConfig)
136
+ */
137
+ export interface DevtoolsAppConfig<TConfig = CorePlyazConfig> {
138
+ /** Frontend configuration object (from app's plyaz.frontend.ts) */
139
+ frontendConfig?: TConfig;
140
+ /** Package exports for ExplorerTab */
141
+ packageExports?: PackageExport[];
142
+ }
143
+ /**
144
+ * Main DevTools configuration interface
145
+ */
146
+ export interface DevtoolsConfig {
147
+ /** Whether devtools is enabled */
148
+ enabled?: boolean;
149
+ /** Panel position */
150
+ position?: 'bottom' | 'left' | 'right';
151
+ /** Default panel height (in pixels) */
152
+ defaultHeight?: number;
153
+ /** Default panel width (in pixels, for left/right positions) */
154
+ defaultWidth?: number;
155
+ /** Color theme */
156
+ theme?: 'dark' | 'light';
157
+ /** Tab configuration */
158
+ tabs?: {
159
+ /** Which tabs to enable (use ['*'] for all) */
160
+ enabled?: string[];
161
+ /** Which tabs to explicitly disable */
162
+ disabled?: string[];
163
+ /** Custom tab groups configuration */
164
+ groups?: TabGroupConfig[];
165
+ /** Default pinned/favorite tabs */
166
+ favorites?: string[];
167
+ /** Custom tabs to register */
168
+ custom?: TabPlugin[];
169
+ /** Default active tab */
170
+ defaultTab?: DevtoolsTab;
171
+ };
172
+ /** Storage configuration */
173
+ storage?: {
174
+ /** Storage adapter type or custom implementation */
175
+ adapter?: 'indexeddb' | 'memory' | DevtoolsStorageAdapter;
176
+ /** How many days to retain data */
177
+ retentionDays?: number;
178
+ /** Maximum items to store per category */
179
+ maxItems?: number;
180
+ };
181
+ /** Keyboard shortcuts configuration */
182
+ shortcuts?: {
183
+ /** Toggle devtools shortcut */
184
+ toggle?: string;
185
+ /** Open search shortcut */
186
+ search?: string;
187
+ /** Close shortcut */
188
+ close?: string;
189
+ /** Custom shortcuts */
190
+ custom?: ShortcutConfig[];
191
+ };
192
+ /** Adapter configuration for external dependencies */
193
+ adapters?: {
194
+ core?: CoreAdapterConfig;
195
+ store?: StoreAdapterConfig;
196
+ config?: ConfigAdapterConfig;
197
+ };
198
+ /** App-specific configuration (env, frontendConfig, etc.) */
199
+ appConfig?: DevtoolsAppConfig<CorePlyazConfig>;
200
+ /** Security configuration */
201
+ security?: {
202
+ /** Read-only mode (disable mutations) */
203
+ readOnly?: boolean;
204
+ /** Keys to mask in display (e.g., tokens, passwords) */
205
+ sensitiveKeys?: string[];
206
+ };
207
+ /** Event hooks */
208
+ hooks?: {
209
+ onOpen?: () => void;
210
+ onClose?: () => void;
211
+ onTabChange?: (tab: string) => void;
212
+ onError?: (error: Error) => void;
213
+ };
214
+ }
215
+ /**
216
+ * Date range filter for data queries
217
+ */
218
+ export interface DateRange {
219
+ start: number;
220
+ end: number;
221
+ label: string;
222
+ }
223
+ /**
224
+ * Devtools settings persisted to storage
225
+ */
226
+ export interface DevtoolsSettings {
227
+ isOpen: boolean;
228
+ activeTab: DevtoolsTab;
229
+ position: 'bottom' | 'left' | 'right';
230
+ height: number;
231
+ width: number;
232
+ theme: 'dark' | 'light';
233
+ maxMessages: number;
234
+ hideHeartbeats: boolean;
235
+ pinnedTabs: DevtoolsTab[];
236
+ recentTabs: DevtoolsTab[];
237
+ collapsedGroups: Record<string, boolean>;
238
+ }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './auth';
2
2
  export type * from './common';
3
3
  export * from './core';
4
+ export type * from './devtools';
4
5
  export type * from './store';
5
6
  export type * from './entities';
6
7
  export * from './errors';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plyaz/types",
3
- "version": "1.46.0",
3
+ "version": "1.46.1",
4
4
  "author": "Redeemer Pace",
5
5
  "license": "ISC",
6
6
  "description": "Provides shared TypeScript types and schema utilities for validation and parsing in the @playz ecosystem.",
@@ -205,6 +205,11 @@
205
205
  "import": "./dist/db/index.js",
206
206
  "require": "./dist/db/index.cjs"
207
207
  },
208
+ "./devtools": {
209
+ "types": "./dist/devtools/index.d.ts",
210
+ "import": "./dist/devtools/index.js",
211
+ "require": "./dist/devtools/index.cjs"
212
+ },
208
213
  "./user": {
209
214
  "types": "./dist/user/index.d.ts",
210
215
  "import": "./dist/user/index.js",