@objectstack/objectql 2.0.6 → 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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @objectstack/objectql@2.0.6 build /home/runner/work/spec/spec/packages/objectql
2
+ > @objectstack/objectql@3.0.0 build /home/runner/work/spec/spec/packages/objectql
3
3
  > tsup --config ../../tsup.config.ts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -10,13 +10,13 @@
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
- ESM dist/index.mjs 71.78 KB
14
- ESM dist/index.mjs.map 145.78 KB
15
- ESM ⚡️ Build success in 80ms
16
- CJS dist/index.js 73.33 KB
17
- CJS dist/index.js.map 146.65 KB
18
- CJS ⚡️ Build success in 82ms
13
+ ESM dist/index.mjs 75.55 KB
14
+ ESM dist/index.mjs.map 152.89 KB
15
+ ESM ⚡️ Build success in 120ms
16
+ CJS dist/index.js 77.09 KB
17
+ CJS dist/index.js.map 153.77 KB
18
+ CJS ⚡️ Build success in 127ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 12684ms
21
- DTS dist/index.d.mts 70.72 KB
22
- DTS dist/index.d.ts 70.72 KB
20
+ DTS ⚡️ Build success in 13686ms
21
+ DTS dist/index.d.mts 75.15 KB
22
+ DTS dist/index.d.ts 75.15 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @objectstack/objectql
2
2
 
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Release v3.0.0 — unified version bump for all ObjectStack packages.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @objectstack/spec@3.0.0
13
+ - @objectstack/core@3.0.0
14
+ - @objectstack/types@3.0.0
15
+
16
+ ## 2.0.7
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+ - @objectstack/spec@2.0.7
22
+ - @objectstack/core@2.0.7
23
+ - @objectstack/types@2.0.7
24
+
3
25
  ## 2.0.6
4
26
 
5
27
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -353,6 +353,8 @@ declare class SchemaRegistry {
353
353
  threshold: number;
354
354
  } | undefined;
355
355
  } | undefined;
356
+ group?: string | undefined;
357
+ conditionalRequired?: string | undefined;
356
358
  inlineHelpText?: string | undefined;
357
359
  trackFeedHistory?: boolean | undefined;
358
360
  caseSensitive?: boolean | undefined;
@@ -430,6 +432,12 @@ declare class SchemaRegistry {
430
432
  description?: string | undefined;
431
433
  }[]> | undefined;
432
434
  }> | undefined;
435
+ displayNameField?: string | undefined;
436
+ recordName?: {
437
+ type: "text" | "autonumber";
438
+ displayFormat?: string | undefined;
439
+ startNumber?: number | undefined;
440
+ } | undefined;
433
441
  titleFormat?: string | undefined;
434
442
  compactLayout?: string[] | undefined;
435
443
  search?: {
@@ -454,11 +462,19 @@ declare class SchemaRegistry {
454
462
  keyPrefix?: string | undefined;
455
463
  } | {
456
464
  name: string;
457
- label: string;
465
+ label: string | {
466
+ key: string;
467
+ defaultValue?: string | undefined;
468
+ params?: Record<string, string | number | boolean> | undefined;
469
+ };
458
470
  active: boolean;
459
471
  isDefault: boolean;
460
472
  version?: string | undefined;
461
- description?: string | undefined;
473
+ description?: string | {
474
+ key: string;
475
+ defaultValue?: string | undefined;
476
+ params?: Record<string, string | number | boolean> | undefined;
477
+ } | undefined;
462
478
  icon?: string | undefined;
463
479
  branding?: {
464
480
  primaryColor?: string | undefined;
@@ -470,11 +486,24 @@ declare class SchemaRegistry {
470
486
  requiredPermissions?: string[] | undefined;
471
487
  objects?: unknown[] | undefined;
472
488
  apis?: unknown[] | undefined;
489
+ mobileNavigation?: {
490
+ mode: "drawer" | "bottom_nav" | "hamburger";
491
+ bottomNavItems?: string[] | undefined;
492
+ } | undefined;
493
+ aria?: {
494
+ ariaLabel?: string | {
495
+ key: string;
496
+ defaultValue?: string | undefined;
497
+ params?: Record<string, string | number | boolean> | undefined;
498
+ } | undefined;
499
+ ariaDescribedBy?: string | undefined;
500
+ role?: string | undefined;
501
+ } | undefined;
473
502
  } | {
474
503
  manifest: {
475
504
  id: string;
476
505
  version: string;
477
- type: "theme" | "driver" | "app" | "server" | "ui" | "agent" | "objectql" | "plugin" | "module" | "gateway" | "adapter";
506
+ type: "theme" | "driver" | "app" | "server" | "ui" | "module" | "agent" | "objectql" | "plugin" | "gateway" | "adapter";
478
507
  name: string;
479
508
  namespace?: string | undefined;
480
509
  description?: string | undefined;
@@ -542,6 +571,11 @@ declare class SchemaRegistry {
542
571
  service: string;
543
572
  methods?: string[] | undefined;
544
573
  }[] | undefined;
574
+ commands?: {
575
+ name: string;
576
+ description?: string | undefined;
577
+ module?: string | undefined;
578
+ }[] | undefined;
545
579
  } | undefined;
546
580
  data?: {
547
581
  object: string;
@@ -636,7 +670,7 @@ declare class SchemaRegistry {
636
670
  preload?: {
637
671
  enabled: boolean;
638
672
  priority: number;
639
- resources?: ("dependencies" | "code" | "metadata" | "assets" | "services")[] | undefined;
673
+ resources?: ("dependencies" | "code" | "metadata" | "services" | "assets")[] | undefined;
640
674
  conditions?: {
641
675
  routes?: string[] | undefined;
642
676
  roles?: string[] | undefined;
@@ -680,7 +714,7 @@ declare class SchemaRegistry {
680
714
  healthCheckInterval?: number | undefined;
681
715
  } | undefined;
682
716
  dependencyResolution?: {
683
- strategy: "strict" | "latest" | "compatible" | "pinned";
717
+ strategy: "strict" | "pinned" | "latest" | "compatible";
684
718
  conflictResolution: "latest" | "manual" | "fail" | "oldest";
685
719
  circularDependencies: "warn" | "error" | "allow";
686
720
  peerDependencies?: {
@@ -722,7 +756,7 @@ declare class SchemaRegistry {
722
756
  } | undefined;
723
757
  caching?: {
724
758
  enabled: boolean;
725
- storage: "hybrid" | "memory" | "disk" | "indexeddb";
759
+ storage: "hybrid" | "indexeddb" | "memory" | "disk";
726
760
  keyStrategy: "hash" | "version" | "timestamp";
727
761
  ttl?: number | undefined;
728
762
  maxSize?: number | undefined;
@@ -771,17 +805,19 @@ declare class SchemaRegistry {
771
805
  } | undefined;
772
806
  } | undefined;
773
807
  };
774
- status: "error" | "disabled" | "installed" | "installing" | "uninstalling";
808
+ status: "error" | "disabled" | "installed" | "installing" | "upgrading" | "uninstalling";
775
809
  enabled: boolean;
776
810
  installedAt?: string | undefined;
777
811
  updatedAt?: string | undefined;
812
+ installedVersion?: string | undefined;
813
+ previousVersion?: string | undefined;
778
814
  statusChangedAt?: string | undefined;
779
815
  errorMessage?: string | undefined;
780
816
  settings?: Record<string, unknown> | undefined;
781
817
  } | {
782
818
  id: string;
783
819
  version: string;
784
- type: "theme" | "driver" | "app" | "server" | "ui" | "agent" | "objectql" | "plugin" | "module" | "gateway" | "adapter";
820
+ type: "theme" | "driver" | "app" | "server" | "ui" | "module" | "agent" | "objectql" | "plugin" | "gateway" | "adapter";
785
821
  name: string;
786
822
  namespace?: string | undefined;
787
823
  description?: string | undefined;
@@ -849,6 +885,11 @@ declare class SchemaRegistry {
849
885
  service: string;
850
886
  methods?: string[] | undefined;
851
887
  }[] | undefined;
888
+ commands?: {
889
+ name: string;
890
+ description?: string | undefined;
891
+ module?: string | undefined;
892
+ }[] | undefined;
852
893
  } | undefined;
853
894
  data?: {
854
895
  object: string;
@@ -943,7 +984,7 @@ declare class SchemaRegistry {
943
984
  preload?: {
944
985
  enabled: boolean;
945
986
  priority: number;
946
- resources?: ("dependencies" | "code" | "metadata" | "assets" | "services")[] | undefined;
987
+ resources?: ("dependencies" | "code" | "metadata" | "services" | "assets")[] | undefined;
947
988
  conditions?: {
948
989
  routes?: string[] | undefined;
949
990
  roles?: string[] | undefined;
@@ -987,7 +1028,7 @@ declare class SchemaRegistry {
987
1028
  healthCheckInterval?: number | undefined;
988
1029
  } | undefined;
989
1030
  dependencyResolution?: {
990
- strategy: "strict" | "latest" | "compatible" | "pinned";
1031
+ strategy: "strict" | "pinned" | "latest" | "compatible";
991
1032
  conflictResolution: "latest" | "manual" | "fail" | "oldest";
992
1033
  circularDependencies: "warn" | "error" | "allow";
993
1034
  peerDependencies?: {
@@ -1029,7 +1070,7 @@ declare class SchemaRegistry {
1029
1070
  } | undefined;
1030
1071
  caching?: {
1031
1072
  enabled: boolean;
1032
- storage: "hybrid" | "memory" | "disk" | "indexeddb";
1073
+ storage: "hybrid" | "indexeddb" | "memory" | "disk";
1033
1074
  keyStrategy: "hash" | "version" | "timestamp";
1034
1075
  ttl?: number | undefined;
1035
1076
  maxSize?: number | undefined;
@@ -1126,18 +1167,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
1126
1167
  getDiscovery(): Promise<{
1127
1168
  version: string;
1128
1169
  apiName: string;
1129
- capabilities: {
1130
- graphql: boolean;
1131
- search: boolean;
1132
- websockets: boolean;
1133
- files: boolean;
1134
- analytics: boolean;
1135
- ai: boolean;
1136
- workflow: boolean;
1137
- notifications: boolean;
1138
- i18n: boolean;
1139
- };
1140
- endpoints: {
1170
+ routes: {
1141
1171
  data: string;
1142
1172
  metadata: string;
1143
1173
  ui?: string | undefined;
@@ -1155,7 +1185,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
1155
1185
  };
1156
1186
  services: Record<string, {
1157
1187
  enabled: boolean;
1158
- status: "degraded" | "available" | "unavailable" | "stub";
1188
+ status: "degraded" | "stub" | "available" | "unavailable";
1159
1189
  route?: string | undefined;
1160
1190
  provider?: string | undefined;
1161
1191
  message?: string | undefined;
@@ -1336,6 +1366,7 @@ declare class ObjectQL implements IDataEngine {
1336
1366
  private logger;
1337
1367
  private hooks;
1338
1368
  private middlewares;
1369
+ private actions;
1339
1370
  private hostContext;
1340
1371
  constructor(hostContext?: Record<string, any>);
1341
1372
  /**
@@ -1367,6 +1398,24 @@ declare class ObjectQL implements IDataEngine {
1367
1398
  priority?: number;
1368
1399
  }): void;
1369
1400
  triggerHooks(event: string, context: HookContext): Promise<void>;
1401
+ /**
1402
+ * Register a named action on an object.
1403
+ * Actions are custom business logic callable via `repo.execute(actionName, params)`.
1404
+ *
1405
+ * @param objectName Target object
1406
+ * @param actionName Unique action name within the object
1407
+ * @param handler Handler function
1408
+ * @param packageName Optional package owner (for cleanup)
1409
+ */
1410
+ registerAction(objectName: string, actionName: string, handler: (ctx: any) => Promise<any> | any, packageName?: string): void;
1411
+ /**
1412
+ * Execute a named action on an object.
1413
+ */
1414
+ executeAction(objectName: string, actionName: string, ctx: any): Promise<any>;
1415
+ /**
1416
+ * Remove all actions registered by a specific package.
1417
+ */
1418
+ removeActionsByPackage(packageName: string): void;
1370
1419
  /**
1371
1420
  * Register a middleware function
1372
1421
  * Middlewares execute in onion model around every data operation.
@@ -1570,6 +1619,8 @@ declare class ObjectQL implements IDataEngine {
1570
1619
  threshold: number;
1571
1620
  } | undefined;
1572
1621
  } | undefined;
1622
+ group?: string | undefined;
1623
+ conditionalRequired?: string | undefined;
1573
1624
  inlineHelpText?: string | undefined;
1574
1625
  trackFeedHistory?: boolean | undefined;
1575
1626
  caseSensitive?: boolean | undefined;
@@ -1647,6 +1698,12 @@ declare class ObjectQL implements IDataEngine {
1647
1698
  description?: string | undefined;
1648
1699
  }[]> | undefined;
1649
1700
  }> | undefined;
1701
+ displayNameField?: string | undefined;
1702
+ recordName?: {
1703
+ type: "text" | "autonumber";
1704
+ displayFormat?: string | undefined;
1705
+ startNumber?: number | undefined;
1706
+ } | undefined;
1650
1707
  titleFormat?: string | undefined;
1651
1708
  compactLayout?: string[] | undefined;
1652
1709
  search?: {
@@ -1711,21 +1768,41 @@ declare class ObjectQL implements IDataEngine {
1711
1768
  }
1712
1769
  /**
1713
1770
  * Repository scoped to a single object, bound to an execution context.
1771
+ *
1772
+ * Provides both IDataEngine-style methods (find, insert, update, delete)
1773
+ * and convenience aliases (create, updateById, deleteById) matching
1774
+ * the @objectql/core ObjectRepository API.
1714
1775
  */
1715
1776
  declare class ObjectRepository {
1716
1777
  private objectName;
1717
1778
  private context;
1718
1779
  private engine;
1719
- constructor(objectName: string, context: ExecutionContext, engine: IDataEngine);
1780
+ constructor(objectName: string, context: ExecutionContext, engine: IDataEngine & {
1781
+ executeAction?: (o: string, a: string, c: any) => Promise<any>;
1782
+ });
1720
1783
  find(query?: any): Promise<any[]>;
1721
1784
  findOne(query?: any): Promise<any>;
1722
1785
  insert(data: any): Promise<any>;
1786
+ /** Alias for insert() — matches @objectql/core convention */
1787
+ create(data: any): Promise<any>;
1723
1788
  update(data: any, options?: any): Promise<any>;
1789
+ /** Update a single record by ID */
1790
+ updateById(id: string | number, data: any): Promise<any>;
1724
1791
  delete(options?: any): Promise<any>;
1792
+ /** Delete a single record by ID */
1793
+ deleteById(id: string | number): Promise<any>;
1725
1794
  count(query?: any): Promise<number>;
1795
+ /** Aggregate query */
1796
+ aggregate(query?: any): Promise<any[]>;
1797
+ /** Execute a named action registered on this object */
1798
+ execute(actionName: string, params?: any): Promise<any>;
1726
1799
  }
1727
1800
  /**
1728
1801
  * Scoped execution context with object() accessor.
1802
+ *
1803
+ * Provides identity (userId, tenantId/spaceId, roles),
1804
+ * repository access via object(), privilege escalation via sudo(),
1805
+ * and transactional execution via transaction().
1729
1806
  */
1730
1807
  declare class ScopedContext {
1731
1808
  private executionContext;
@@ -1735,9 +1812,25 @@ declare class ScopedContext {
1735
1812
  object(name: string): ObjectRepository;
1736
1813
  /** Create an elevated (system) context */
1737
1814
  sudo(): ScopedContext;
1815
+ /**
1816
+ * Execute a callback within a database transaction.
1817
+ *
1818
+ * The callback receives a new ScopedContext whose operations
1819
+ * share the same transaction handle. If the callback throws,
1820
+ * the transaction is rolled back; otherwise it is committed.
1821
+ *
1822
+ * Falls back to non-transactional execution if the driver
1823
+ * does not support transactions.
1824
+ */
1825
+ transaction(callback: (trxCtx: ScopedContext) => Promise<any>): Promise<any>;
1738
1826
  get userId(): string | undefined;
1739
1827
  get tenantId(): string | undefined;
1828
+ /** Alias for tenantId — matches ObjectQLContext.spaceId convention */
1829
+ get spaceId(): string | undefined;
1740
1830
  get roles(): string[];
1831
+ get isSystem(): boolean;
1832
+ /** Internal: expose the transaction handle for driver-level access */
1833
+ get transactionHandle(): unknown;
1741
1834
  }
1742
1835
 
1743
1836
  /**
@@ -1746,16 +1839,19 @@ declare class ScopedContext {
1746
1839
  * Provides a clean, injectable interface over SchemaRegistry.
1747
1840
  * Registered as the 'metadata' kernel service to eliminate
1748
1841
  * downstream packages needing to manually wrap SchemaRegistry.
1842
+ *
1843
+ * Implements the async IMetadataService interface.
1844
+ * Internally delegates to SchemaRegistry (in-memory) with Promise wrappers.
1749
1845
  */
1750
1846
  declare class MetadataFacade {
1751
1847
  /**
1752
1848
  * Register a metadata item
1753
1849
  */
1754
- register(type: string, definition: any): void;
1850
+ register(type: string, name: string, data: any): Promise<void>;
1755
1851
  /**
1756
1852
  * Get a metadata item by type and name
1757
1853
  */
1758
- get(type: string, name: string): any;
1854
+ get(type: string, name: string): Promise<any>;
1759
1855
  /**
1760
1856
  * Get the raw entry (with metadata wrapper)
1761
1857
  */
@@ -1763,23 +1859,31 @@ declare class MetadataFacade {
1763
1859
  /**
1764
1860
  * List all items of a type
1765
1861
  */
1766
- list(type: string): any[];
1862
+ list(type: string): Promise<any[]>;
1767
1863
  /**
1768
1864
  * Unregister a metadata item
1769
1865
  */
1770
- unregister(type: string, name: string): void;
1866
+ unregister(type: string, name: string): Promise<void>;
1867
+ /**
1868
+ * Check if a metadata item exists
1869
+ */
1870
+ exists(type: string, name: string): Promise<boolean>;
1871
+ /**
1872
+ * List all names of metadata items of a given type
1873
+ */
1874
+ listNames(type: string): Promise<string[]>;
1771
1875
  /**
1772
1876
  * Unregister all metadata from a package
1773
1877
  */
1774
- unregisterPackage(packageName: string): void;
1878
+ unregisterPackage(packageName: string): Promise<void>;
1775
1879
  /**
1776
1880
  * Convenience: get object definition
1777
1881
  */
1778
- getObject(name: string): any;
1882
+ getObject(name: string): Promise<any>;
1779
1883
  /**
1780
1884
  * Convenience: list all objects
1781
1885
  */
1782
- listObjects(): any[];
1886
+ listObjects(): Promise<any[]>;
1783
1887
  }
1784
1888
 
1785
1889
  declare class ObjectQLPlugin implements Plugin {