@object-ui/data-objectstack 2.0.0 → 3.0.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.
package/dist/index.d.ts CHANGED
@@ -159,6 +159,485 @@ interface CacheStats {
159
159
  hitRate: number;
160
160
  }
161
161
 
162
+ /**
163
+ * ObjectUI
164
+ * Copyright (c) 2024-present ObjectStack Inc.
165
+ *
166
+ * This source code is licensed under the MIT license found in the
167
+ * LICENSE file in the root directory of this source tree.
168
+ */
169
+ /**
170
+ * Cloud namespace integration for @objectstack/spec v3.0.0
171
+ * Replaces the legacy Hub namespace for cloud deployment, hosting, and marketplace schemas.
172
+ */
173
+ interface CloudDeploymentConfig {
174
+ /** Target environment */
175
+ environment: 'development' | 'staging' | 'production';
176
+ /** Cloud region */
177
+ region?: string;
178
+ /** Auto-scaling configuration */
179
+ scaling?: {
180
+ minInstances: number;
181
+ maxInstances: number;
182
+ targetCPU?: number;
183
+ };
184
+ /** Environment variables */
185
+ envVars?: Record<string, string>;
186
+ }
187
+ interface CloudHostingConfig {
188
+ /** Custom domain */
189
+ customDomain?: string;
190
+ /** SSL configuration */
191
+ ssl?: {
192
+ enabled: boolean;
193
+ autoRenew: boolean;
194
+ };
195
+ /** CDN configuration */
196
+ cdn?: {
197
+ enabled: boolean;
198
+ regions?: string[];
199
+ };
200
+ }
201
+ interface CloudMarketplaceEntry {
202
+ /** Plugin or app ID */
203
+ id: string;
204
+ /** Display name */
205
+ name: string;
206
+ /** Description */
207
+ description: string;
208
+ /** Version */
209
+ version: string;
210
+ /** Author */
211
+ author: string;
212
+ /** Category */
213
+ category: string;
214
+ /** Tags */
215
+ tags: string[];
216
+ /** Rating (1-5) */
217
+ rating?: number;
218
+ /** Install count */
219
+ installCount?: number;
220
+ /** Price (0 = free) */
221
+ price?: number;
222
+ }
223
+ /**
224
+ * Cloud operations helper for ObjectStack adapter.
225
+ * Provides methods for cloud deployment, hosting, and marketplace operations.
226
+ */
227
+ declare class CloudOperations {
228
+ private getClient;
229
+ constructor(getClient: () => any);
230
+ /**
231
+ * Deploy an application to the cloud.
232
+ */
233
+ deploy(appId: string, config: CloudDeploymentConfig): Promise<{
234
+ deploymentId: string;
235
+ status: string;
236
+ }>;
237
+ /**
238
+ * Get deployment status.
239
+ */
240
+ getDeploymentStatus(deploymentId: string): Promise<{
241
+ status: string;
242
+ url?: string;
243
+ }>;
244
+ /**
245
+ * Search marketplace entries.
246
+ */
247
+ searchMarketplace(query?: string, category?: string): Promise<CloudMarketplaceEntry[]>;
248
+ /**
249
+ * Install a marketplace plugin.
250
+ */
251
+ installPlugin(pluginId: string): Promise<{
252
+ success: boolean;
253
+ }>;
254
+ }
255
+
256
+ /**
257
+ * ObjectUI
258
+ * Copyright (c) 2024-present ObjectStack Inc.
259
+ *
260
+ * This source code is licensed under the MIT license found in the
261
+ * LICENSE file in the root directory of this source tree.
262
+ */
263
+ /**
264
+ * Contracts module integration for @objectstack/spec v3.0.0
265
+ * Provides plugin contract validation and marketplace publishing utilities.
266
+ */
267
+ interface PluginContract {
268
+ /** Plugin name */
269
+ name: string;
270
+ /** Plugin version */
271
+ version: string;
272
+ /** Required peer dependencies */
273
+ peerDependencies?: Record<string, string>;
274
+ /** Exported component types */
275
+ exports: PluginExport[];
276
+ /** Required permissions */
277
+ permissions?: string[];
278
+ /** API surface contract */
279
+ api?: PluginAPIContract;
280
+ }
281
+ interface PluginExport {
282
+ /** Export name */
283
+ name: string;
284
+ /** Export type */
285
+ type: 'component' | 'hook' | 'utility' | 'provider';
286
+ /** Description */
287
+ description?: string;
288
+ }
289
+ interface PluginAPIContract {
290
+ /** Consumed data sources */
291
+ dataSources?: string[];
292
+ /** Required object schemas */
293
+ requiredSchemas?: string[];
294
+ /** Event subscriptions */
295
+ events?: string[];
296
+ }
297
+ interface ContractValidationResult {
298
+ valid: boolean;
299
+ errors: ContractValidationError[];
300
+ warnings: string[];
301
+ }
302
+ interface ContractValidationError {
303
+ field: string;
304
+ message: string;
305
+ code: string;
306
+ }
307
+ /**
308
+ * Validate a plugin contract against the ObjectStack spec.
309
+ */
310
+ declare function validatePluginContract(contract: PluginContract): ContractValidationResult;
311
+ /**
312
+ * Generate a plugin contract manifest for marketplace publishing.
313
+ */
314
+ declare function generateContractManifest(contract: PluginContract): Record<string, unknown>;
315
+
316
+ /**
317
+ * ObjectUI
318
+ * Copyright (c) 2024-present ObjectStack Inc.
319
+ *
320
+ * This source code is licensed under the MIT license found in the
321
+ * LICENSE file in the root directory of this source tree.
322
+ */
323
+ /**
324
+ * Integration module for @objectstack/spec v3.0.0
325
+ * Provides third-party service connectors for Slack, email, webhooks.
326
+ */
327
+ type IntegrationProvider = 'slack' | 'email' | 'webhook' | 'teams' | 'discord';
328
+ interface IntegrationConfig {
329
+ /** Integration provider type */
330
+ provider: IntegrationProvider;
331
+ /** Whether this integration is enabled */
332
+ enabled: boolean;
333
+ /** Provider-specific configuration */
334
+ config: Record<string, unknown>;
335
+ /** Event triggers */
336
+ triggers?: IntegrationTrigger[];
337
+ }
338
+ interface IntegrationTrigger {
339
+ /** Event name (e.g. 'record.created', 'record.updated') */
340
+ event: string;
341
+ /** Filter condition */
342
+ filter?: string;
343
+ /** Template for the message/payload */
344
+ template?: string;
345
+ }
346
+ interface SlackIntegrationConfig extends IntegrationConfig {
347
+ provider: 'slack';
348
+ config: {
349
+ webhookUrl: string;
350
+ channel?: string;
351
+ username?: string;
352
+ iconEmoji?: string;
353
+ };
354
+ }
355
+ interface EmailIntegrationConfig extends IntegrationConfig {
356
+ provider: 'email';
357
+ config: {
358
+ smtpHost: string;
359
+ smtpPort: number;
360
+ secure: boolean;
361
+ from: string;
362
+ to: string[];
363
+ subject?: string;
364
+ };
365
+ }
366
+ interface WebhookIntegrationConfig extends IntegrationConfig {
367
+ provider: 'webhook';
368
+ config: {
369
+ url: string;
370
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH';
371
+ headers?: Record<string, string>;
372
+ retryCount?: number;
373
+ retryDelay?: number;
374
+ };
375
+ }
376
+ /**
377
+ * Integration service manager.
378
+ * Manages third-party service connections and event dispatching.
379
+ */
380
+ declare class IntegrationManager {
381
+ private integrations;
382
+ /**
383
+ * Register a new integration.
384
+ */
385
+ register(id: string, config: IntegrationConfig): void;
386
+ /**
387
+ * Remove an integration.
388
+ */
389
+ unregister(id: string): void;
390
+ /**
391
+ * Get all registered integrations.
392
+ */
393
+ getAll(): Map<string, IntegrationConfig>;
394
+ /**
395
+ * Get integrations that match a specific event.
396
+ */
397
+ getForEvent(event: string): IntegrationConfig[];
398
+ /**
399
+ * Dispatch an event to all matching integrations.
400
+ * Returns results for each integration.
401
+ */
402
+ dispatch(event: string, payload: Record<string, unknown>): Promise<Array<{
403
+ id: string;
404
+ success: boolean;
405
+ error?: string;
406
+ }>>;
407
+ /**
408
+ * Send payload to a specific integration.
409
+ */
410
+ private send;
411
+ }
412
+
413
+ /**
414
+ * ObjectUI
415
+ * Copyright (c) 2024-present ObjectStack Inc.
416
+ *
417
+ * This source code is licensed under the MIT license found in the
418
+ * LICENSE file in the root directory of this source tree.
419
+ */
420
+ /**
421
+ * Security module integration for @objectstack/spec v3.0.0
422
+ * Provides advanced security policies: CSP config, audit logging, data masking.
423
+ */
424
+ interface SecurityPolicy {
425
+ /** Content Security Policy configuration */
426
+ csp?: CSPConfig;
427
+ /** Audit logging configuration */
428
+ auditLog?: AuditLogConfig;
429
+ /** Data masking rules */
430
+ dataMasking?: DataMaskingConfig;
431
+ }
432
+ interface CSPConfig {
433
+ /** Script sources */
434
+ scriptSrc: string[];
435
+ /** Style sources */
436
+ styleSrc: string[];
437
+ /** Image sources */
438
+ imgSrc: string[];
439
+ /** Connect sources (APIs, WebSockets) */
440
+ connectSrc: string[];
441
+ /** Font sources */
442
+ fontSrc: string[];
443
+ /** Frame sources */
444
+ frameSrc?: string[];
445
+ /** Report URI for violations */
446
+ reportUri?: string;
447
+ }
448
+ interface AuditLogConfig {
449
+ /** Whether audit logging is enabled */
450
+ enabled: boolean;
451
+ /** Events to audit */
452
+ events: AuditEventType[];
453
+ /** Log retention days */
454
+ retentionDays?: number;
455
+ /** External log destination */
456
+ destination?: 'console' | 'server' | 'both';
457
+ }
458
+ type AuditEventType = 'auth.login' | 'auth.logout' | 'auth.failed' | 'data.create' | 'data.read' | 'data.update' | 'data.delete' | 'admin.config' | 'admin.user' | 'admin.role';
459
+ interface DataMaskingConfig {
460
+ /** Fields to mask */
461
+ rules: DataMaskingRule[];
462
+ /** Default masking character */
463
+ maskChar?: string;
464
+ }
465
+ interface DataMaskingRule {
466
+ /** Field name or pattern */
467
+ field: string;
468
+ /** Masking strategy */
469
+ strategy: 'full' | 'partial' | 'hash' | 'redact';
470
+ /** Number of visible characters (for partial masking) */
471
+ visibleChars?: number;
472
+ /** Roles that can see unmasked data */
473
+ exemptRoles?: string[];
474
+ }
475
+ interface AuditLogEntry {
476
+ /** Event timestamp */
477
+ timestamp: string;
478
+ /** Event type */
479
+ event: AuditEventType;
480
+ /** User who triggered the event */
481
+ userId: string;
482
+ /** Target resource */
483
+ resource?: string;
484
+ /** Record ID */
485
+ recordId?: string;
486
+ /** Additional details */
487
+ details?: Record<string, unknown>;
488
+ /** IP address */
489
+ ipAddress?: string;
490
+ }
491
+ /**
492
+ * Security policy manager.
493
+ * Handles CSP generation, audit logging, and data masking.
494
+ */
495
+ declare class SecurityManager {
496
+ private policy;
497
+ private auditLog;
498
+ constructor(policy?: SecurityPolicy);
499
+ /**
500
+ * Generate a CSP header string from the configuration.
501
+ */
502
+ generateCSPHeader(): string;
503
+ /**
504
+ * Record an audit log entry.
505
+ */
506
+ recordAudit(entry: Omit<AuditLogEntry, 'timestamp'>): void;
507
+ /**
508
+ * Get audit log entries.
509
+ */
510
+ getAuditLog(filter?: {
511
+ event?: AuditEventType;
512
+ userId?: string;
513
+ since?: string;
514
+ }): AuditLogEntry[];
515
+ /**
516
+ * Apply data masking to a record.
517
+ */
518
+ maskRecord(record: Record<string, unknown>, userRoles?: string[]): Record<string, unknown>;
519
+ /**
520
+ * Update the security policy.
521
+ */
522
+ updatePolicy(policy: Partial<SecurityPolicy>): void;
523
+ /**
524
+ * Get current security policy.
525
+ */
526
+ getPolicy(): SecurityPolicy;
527
+ }
528
+
529
+ /**
530
+ * ObjectUI
531
+ * Copyright (c) 2024-present ObjectStack Inc.
532
+ *
533
+ * This source code is licensed under the MIT license found in the
534
+ * LICENSE file in the root directory of this source tree.
535
+ */
536
+ /**
537
+ * Studio module integration for @objectstack/spec v3.0.0
538
+ * Provides visual designer schema improvements: canvas, property editors, theme builder.
539
+ */
540
+ interface StudioCanvasConfig {
541
+ /** Canvas width */
542
+ width: number;
543
+ /** Canvas height */
544
+ height: number;
545
+ /** Background type */
546
+ background: 'grid' | 'dots' | 'lines' | 'none';
547
+ /** Grid size in pixels */
548
+ gridSize: number;
549
+ /** Snap to grid */
550
+ snapToGrid: boolean;
551
+ /** Zoom range */
552
+ zoom: {
553
+ min: number;
554
+ max: number;
555
+ step: number;
556
+ current: number;
557
+ };
558
+ /** Pan offset */
559
+ panOffset: {
560
+ x: number;
561
+ y: number;
562
+ };
563
+ /** Show minimap */
564
+ showMinimap: boolean;
565
+ /** Minimap position */
566
+ minimapPosition: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
567
+ }
568
+ interface StudioPropertyEditor {
569
+ /** Property name */
570
+ name: string;
571
+ /** Display label */
572
+ label: string;
573
+ /** Editor type */
574
+ type: 'text' | 'number' | 'boolean' | 'select' | 'color' | 'code' | 'expression';
575
+ /** Default value */
576
+ defaultValue?: unknown;
577
+ /** Options for select type */
578
+ options?: Array<{
579
+ label: string;
580
+ value: string;
581
+ }>;
582
+ /** Group/category */
583
+ group?: string;
584
+ /** Description */
585
+ description?: string;
586
+ /** Whether the property supports live preview */
587
+ livePreview?: boolean;
588
+ }
589
+ interface StudioThemeBuilderConfig {
590
+ /** Available color palettes */
591
+ palettes: StudioColorPalette[];
592
+ /** Typography presets */
593
+ typography: StudioTypographyPreset[];
594
+ /** Spacing scale */
595
+ spacing: number[];
596
+ /** Border radius options */
597
+ borderRadius: number[];
598
+ /** Shadow presets */
599
+ shadows: StudioShadowPreset[];
600
+ }
601
+ interface StudioColorPalette {
602
+ name: string;
603
+ colors: Record<string, string>;
604
+ }
605
+ interface StudioTypographyPreset {
606
+ name: string;
607
+ fontFamily: string;
608
+ fontSize: Record<string, string>;
609
+ fontWeight: Record<string, number>;
610
+ lineHeight: Record<string, string>;
611
+ }
612
+ interface StudioShadowPreset {
613
+ name: string;
614
+ value: string;
615
+ }
616
+ /**
617
+ * Default canvas configuration for designers.
618
+ */
619
+ declare function createDefaultCanvasConfig(overrides?: Partial<StudioCanvasConfig>): StudioCanvasConfig;
620
+ /**
621
+ * Snap a position to the grid.
622
+ */
623
+ declare function snapToGrid(x: number, y: number, gridSize: number): {
624
+ x: number;
625
+ y: number;
626
+ };
627
+ /**
628
+ * Calculate auto-layout positions for a set of items.
629
+ * Uses a simple grid-based layout algorithm.
630
+ */
631
+ declare function calculateAutoLayout(items: Array<{
632
+ id: string;
633
+ width: number;
634
+ height: number;
635
+ }>, canvasWidth: number, padding?: number, gap?: number): Array<{
636
+ id: string;
637
+ x: number;
638
+ y: number;
639
+ }>;
640
+
162
641
  /**
163
642
  * Connection state for monitoring
164
643
  */
@@ -356,6 +835,22 @@ declare class ObjectStackAdapter<T = unknown> implements DataSource<T> {
356
835
  * @returns Promise resolving to the app definition or null
357
836
  */
358
837
  getApp(appId: string): Promise<unknown | null>;
838
+ /**
839
+ * Get a page definition from ObjectStack.
840
+ * Uses the metadata API to fetch page layouts.
841
+ * Returns null if the server doesn't support page metadata.
842
+ */
843
+ getPage(pageId: string): Promise<unknown | null>;
844
+ /**
845
+ * Get multiple metadata items from ObjectStack.
846
+ * Uses v3.0.0 metadata API pattern: getItems for batch retrieval.
847
+ */
848
+ getItems(category: string, names: string[]): Promise<unknown[]>;
849
+ /**
850
+ * Get cached metadata if available, without triggering a fetch.
851
+ * Uses v3.0.0 metadata API pattern: getCached for synchronous cache access.
852
+ */
853
+ getCached(key: string): unknown | undefined;
359
854
  /**
360
855
  * Get cache statistics for monitoring performance.
361
856
  */
@@ -432,4 +927,4 @@ declare function createObjectStackAdapter<T = unknown>(config: {
432
927
  reconnectDelay?: number;
433
928
  }): DataSource<T>;
434
929
 
435
- export { AuthenticationError, type BatchProgressEvent, type BatchProgressListener, BulkOperationError, type CacheStats, ConnectionError, type ConnectionState, type ConnectionStateEvent, type ConnectionStateListener, MetadataNotFoundError, ObjectStackAdapter, ObjectStackError, ValidationError, createErrorFromResponse, createObjectStackAdapter, isErrorType, isObjectStackError };
930
+ export { type AuditEventType, type AuditLogConfig, type AuditLogEntry, AuthenticationError, type BatchProgressEvent, type BatchProgressListener, BulkOperationError, type CSPConfig, type CacheStats, type CloudDeploymentConfig, type CloudHostingConfig, type CloudMarketplaceEntry, CloudOperations, ConnectionError, type ConnectionState, type ConnectionStateEvent, type ConnectionStateListener, type ContractValidationError, type ContractValidationResult, type DataMaskingConfig, type DataMaskingRule, type EmailIntegrationConfig, type IntegrationConfig, IntegrationManager, type IntegrationProvider, type IntegrationTrigger, MetadataNotFoundError, ObjectStackAdapter, ObjectStackError, type PluginAPIContract, type PluginContract, type PluginExport, SecurityManager, type SecurityPolicy, type SlackIntegrationConfig, type StudioCanvasConfig, type StudioColorPalette, type StudioPropertyEditor, type StudioShadowPreset, type StudioThemeBuilderConfig, type StudioTypographyPreset, ValidationError, type WebhookIntegrationConfig, calculateAutoLayout, createDefaultCanvasConfig, createErrorFromResponse, createObjectStackAdapter, generateContractManifest, isErrorType, isObjectStackError, snapToGrid, validatePluginContract };