@objectstack/core 3.0.8 → 3.0.9

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.cts CHANGED
@@ -1849,4 +1849,234 @@ declare class DependencyResolver {
1849
1849
  isAcyclic(dependencies: Map<string, string[]>): boolean;
1850
1850
  }
1851
1851
 
1852
- export { ApiRegistry, type ApiRegistryPluginConfig, CORE_FALLBACK_FACTORIES, DependencyResolver, HotReloadManager, type KernelState, LiteKernel, ObjectKernel, ObjectKernelBase, type ObjectKernelConfig, ObjectLogger, type PermissionCheckResult$1 as PermissionCheckResult, type PermissionGrant, type Plugin, PluginConfigValidator, type PluginContext, PluginHealthMonitor, type PluginHealthStatus, type PluginLoadResult, PluginLoader, type PluginMetadata, type PermissionCheckResult as PluginPermissionCheckResult, PluginPermissionEnforcer, PluginPermissionManager, type PluginPermissions, PluginSandboxRuntime, PluginSecurityScanner, type PluginSignatureConfig, PluginSignatureVerifier, type PluginStartupResult, index as QA, type ResourceUsage, type SandboxContext, type ScanTarget, SecurePluginContext, type SecurityIssue, SemanticVersionManager, type ServiceFactory, ServiceLifecycle, type ServiceRegistration, type SignatureVerificationResult, type VersionCompatibility, createApiRegistryPlugin, createLogger, createMemoryCache, createMemoryJob, createMemoryQueue, createPluginConfigValidator, createPluginPermissionEnforcer, getEnv, getMemoryUsage, isNode, safeExit };
1852
+ /**
1853
+ * Namespace entry representing an object/view/flow etc. registered by a package.
1854
+ */
1855
+ interface NamespaceEntry {
1856
+ /** The namespace path (e.g. "objects.project_task", "views.task_list") */
1857
+ namespace: string;
1858
+ /** The package that owns this namespace */
1859
+ packageId: string;
1860
+ /** When this entry was registered */
1861
+ registeredAt: string;
1862
+ }
1863
+ /**
1864
+ * Result of a namespace conflict check.
1865
+ */
1866
+ interface NamespaceConflict {
1867
+ /** The conflicting namespace path */
1868
+ namespace: string;
1869
+ /** The package that currently owns this namespace */
1870
+ existingPackageId: string;
1871
+ /** The package attempting to register the same namespace */
1872
+ incomingPackageId: string;
1873
+ /** A suggested alternative name to avoid the conflict */
1874
+ suggestion?: string;
1875
+ }
1876
+ /**
1877
+ * Result of namespace availability check.
1878
+ */
1879
+ interface NamespaceCheckResult {
1880
+ /** Whether all requested namespaces are available */
1881
+ available: boolean;
1882
+ /** List of conflicts detected */
1883
+ conflicts: NamespaceConflict[];
1884
+ /** Suggested alternatives for each conflict */
1885
+ suggestions: Record<string, string>;
1886
+ }
1887
+ /**
1888
+ * Namespace Resolver
1889
+ *
1890
+ * Manages namespace registration for installed packages and detects collisions
1891
+ * during install-time. Each metadata item (object, view, flow, page, etc.)
1892
+ * produces a namespace like `objects.<name>` or `views.<name>`.
1893
+ *
1894
+ * When a new package declares objects, views, or other metadata that would
1895
+ * collide with an existing package's metadata, this resolver reports the
1896
+ * conflicts and suggests prefixed alternatives.
1897
+ */
1898
+ declare class NamespaceResolver {
1899
+ private logger;
1900
+ private registry;
1901
+ constructor(logger: ObjectLogger);
1902
+ /**
1903
+ * Register namespaces owned by a package.
1904
+ */
1905
+ register(packageId: string, namespaces: string[]): void;
1906
+ /**
1907
+ * Unregister all namespaces belonging to a package.
1908
+ */
1909
+ unregister(packageId: string): string[];
1910
+ /**
1911
+ * Check whether a set of namespaces is available for a given package.
1912
+ */
1913
+ checkAvailability(packageId: string, namespaces: string[]): NamespaceCheckResult;
1914
+ /**
1915
+ * Extract namespace strings from a package's metadata definition.
1916
+ */
1917
+ extractNamespaces(config: Record<string, unknown>): string[];
1918
+ /**
1919
+ * Get all registered entries.
1920
+ */
1921
+ getRegistry(): ReadonlyMap<string, NamespaceEntry>;
1922
+ /**
1923
+ * Get all namespaces belonging to a specific package.
1924
+ */
1925
+ getPackageNamespaces(packageId: string): string[];
1926
+ /**
1927
+ * Generate a prefixed alternative namespace to avoid conflicts.
1928
+ */
1929
+ private suggestAlternative;
1930
+ }
1931
+
1932
+ /**
1933
+ * Installed package record in the runtime registry.
1934
+ */
1935
+ interface InstalledPackageRecord {
1936
+ /** Package identifier */
1937
+ packageId: string;
1938
+ /** Package version */
1939
+ version: string;
1940
+ /** Package manifest */
1941
+ manifest: Record<string, unknown>;
1942
+ /** Installation timestamp */
1943
+ installedAt: string;
1944
+ /** Current status */
1945
+ status: 'installed' | 'disabled' | 'installing' | 'upgrading' | 'uninstalling' | 'error';
1946
+ /** Namespaces registered by this package */
1947
+ namespaces: string[];
1948
+ /** Dependencies of this package */
1949
+ dependencies: string[];
1950
+ }
1951
+ /**
1952
+ * Snapshot of a package's state before upgrade (for rollback).
1953
+ */
1954
+ interface PackageSnapshot {
1955
+ /** Package identifier */
1956
+ packageId: string;
1957
+ /** Version before upgrade */
1958
+ previousVersion: string;
1959
+ /** Full manifest before upgrade */
1960
+ previousManifest: Record<string, unknown>;
1961
+ /** Namespaces before upgrade */
1962
+ previousNamespaces: string[];
1963
+ /** Original installation timestamp */
1964
+ installedAt: string;
1965
+ /** Snapshot timestamp */
1966
+ createdAt: string;
1967
+ }
1968
+ /**
1969
+ * Result of a package installation attempt.
1970
+ */
1971
+ interface InstallResult {
1972
+ success: boolean;
1973
+ packageId: string;
1974
+ version: string;
1975
+ installedDependencies: string[];
1976
+ namespaceConflicts: Array<{
1977
+ namespace: string;
1978
+ existingPackageId: string;
1979
+ }>;
1980
+ errorMessage?: string;
1981
+ }
1982
+ /**
1983
+ * Result of an upgrade attempt.
1984
+ */
1985
+ interface UpgradeResult {
1986
+ success: boolean;
1987
+ packageId: string;
1988
+ fromVersion: string;
1989
+ toVersion: string;
1990
+ snapshot: PackageSnapshot;
1991
+ errorMessage?: string;
1992
+ }
1993
+ /**
1994
+ * Result of a rollback attempt.
1995
+ */
1996
+ interface RollbackResult {
1997
+ success: boolean;
1998
+ packageId: string;
1999
+ restoredVersion: string;
2000
+ errorMessage?: string;
2001
+ }
2002
+ /**
2003
+ * Package Manager
2004
+ *
2005
+ * Runtime implementation for the full package lifecycle:
2006
+ * install → upgrade → rollback → uninstall.
2007
+ *
2008
+ * Consumes the protocol schemas defined in @objectstack/spec:
2009
+ * - DependencyResolutionResultSchema
2010
+ * - NamespaceConflictErrorSchema
2011
+ * - UpgradePlanSchema / UpgradeSnapshotSchema
2012
+ * - PackageArtifactSchema
2013
+ *
2014
+ * Coordinates with:
2015
+ * - DependencyResolver for topological ordering and conflict detection
2016
+ * - NamespaceResolver for metadata collision prevention
2017
+ */
2018
+ declare class PackageManager {
2019
+ private logger;
2020
+ private packages;
2021
+ private snapshots;
2022
+ private dependencyResolver;
2023
+ private namespaceResolver;
2024
+ private platformVersion;
2025
+ constructor(logger: ObjectLogger, options?: {
2026
+ platformVersion?: string;
2027
+ });
2028
+ /**
2029
+ * Install a package with full dependency resolution and namespace checking.
2030
+ */
2031
+ install(packageId: string, version: string, manifest: Record<string, unknown>): Promise<InstallResult>;
2032
+ /**
2033
+ * Uninstall a package, checking for dependents first.
2034
+ */
2035
+ uninstall(packageId: string): Promise<{
2036
+ success: boolean;
2037
+ errorMessage?: string;
2038
+ }>;
2039
+ /**
2040
+ * Upgrade a package: snapshot → update → register.
2041
+ */
2042
+ upgrade(packageId: string, newVersion: string, newManifest: Record<string, unknown>): Promise<UpgradeResult>;
2043
+ /**
2044
+ * Rollback a package to its pre-upgrade snapshot.
2045
+ */
2046
+ rollback(packageId: string): Promise<RollbackResult>;
2047
+ /**
2048
+ * Get an installed package record.
2049
+ */
2050
+ getPackage(packageId: string): InstalledPackageRecord | undefined;
2051
+ /**
2052
+ * List all installed packages.
2053
+ */
2054
+ listPackages(): InstalledPackageRecord[];
2055
+ /**
2056
+ * Resolve dependencies for a set of packages.
2057
+ */
2058
+ resolveDependencies(packages: Map<string, {
2059
+ version?: string;
2060
+ dependencies?: string[];
2061
+ }>): string[];
2062
+ /**
2063
+ * Check namespace availability for a package's metadata.
2064
+ */
2065
+ checkNamespaces(packageId: string, config: Record<string, unknown>): {
2066
+ available: boolean;
2067
+ conflicts: Array<{
2068
+ namespace: string;
2069
+ existingPackageId: string;
2070
+ }>;
2071
+ };
2072
+ /**
2073
+ * Get the namespace resolver instance.
2074
+ */
2075
+ getNamespaceResolver(): NamespaceResolver;
2076
+ /**
2077
+ * Get a snapshot for a given package (if available).
2078
+ */
2079
+ getSnapshot(packageId: string): PackageSnapshot | undefined;
2080
+ }
2081
+
2082
+ export { ApiRegistry, type ApiRegistryPluginConfig, CORE_FALLBACK_FACTORIES, DependencyResolver, HotReloadManager, type InstallResult, type InstalledPackageRecord, type KernelState, LiteKernel, type NamespaceCheckResult, type NamespaceConflict, type NamespaceEntry, NamespaceResolver, ObjectKernel, ObjectKernelBase, type ObjectKernelConfig, ObjectLogger, PackageManager, type PackageSnapshot, type PermissionCheckResult$1 as PermissionCheckResult, type PermissionGrant, type Plugin, PluginConfigValidator, type PluginContext, PluginHealthMonitor, type PluginHealthStatus, type PluginLoadResult, PluginLoader, type PluginMetadata, type PermissionCheckResult as PluginPermissionCheckResult, PluginPermissionEnforcer, PluginPermissionManager, type PluginPermissions, PluginSandboxRuntime, PluginSecurityScanner, type PluginSignatureConfig, PluginSignatureVerifier, type PluginStartupResult, index as QA, type ResourceUsage, type RollbackResult, type SandboxContext, type ScanTarget, SecurePluginContext, type SecurityIssue, SemanticVersionManager, type ServiceFactory, ServiceLifecycle, type ServiceRegistration, type SignatureVerificationResult, type UpgradeResult, type VersionCompatibility, createApiRegistryPlugin, createLogger, createMemoryCache, createMemoryJob, createMemoryQueue, createPluginConfigValidator, createPluginPermissionEnforcer, getEnv, getMemoryUsage, isNode, safeExit };
package/dist/index.d.ts CHANGED
@@ -1849,4 +1849,234 @@ declare class DependencyResolver {
1849
1849
  isAcyclic(dependencies: Map<string, string[]>): boolean;
1850
1850
  }
1851
1851
 
1852
- export { ApiRegistry, type ApiRegistryPluginConfig, CORE_FALLBACK_FACTORIES, DependencyResolver, HotReloadManager, type KernelState, LiteKernel, ObjectKernel, ObjectKernelBase, type ObjectKernelConfig, ObjectLogger, type PermissionCheckResult$1 as PermissionCheckResult, type PermissionGrant, type Plugin, PluginConfigValidator, type PluginContext, PluginHealthMonitor, type PluginHealthStatus, type PluginLoadResult, PluginLoader, type PluginMetadata, type PermissionCheckResult as PluginPermissionCheckResult, PluginPermissionEnforcer, PluginPermissionManager, type PluginPermissions, PluginSandboxRuntime, PluginSecurityScanner, type PluginSignatureConfig, PluginSignatureVerifier, type PluginStartupResult, index as QA, type ResourceUsage, type SandboxContext, type ScanTarget, SecurePluginContext, type SecurityIssue, SemanticVersionManager, type ServiceFactory, ServiceLifecycle, type ServiceRegistration, type SignatureVerificationResult, type VersionCompatibility, createApiRegistryPlugin, createLogger, createMemoryCache, createMemoryJob, createMemoryQueue, createPluginConfigValidator, createPluginPermissionEnforcer, getEnv, getMemoryUsage, isNode, safeExit };
1852
+ /**
1853
+ * Namespace entry representing an object/view/flow etc. registered by a package.
1854
+ */
1855
+ interface NamespaceEntry {
1856
+ /** The namespace path (e.g. "objects.project_task", "views.task_list") */
1857
+ namespace: string;
1858
+ /** The package that owns this namespace */
1859
+ packageId: string;
1860
+ /** When this entry was registered */
1861
+ registeredAt: string;
1862
+ }
1863
+ /**
1864
+ * Result of a namespace conflict check.
1865
+ */
1866
+ interface NamespaceConflict {
1867
+ /** The conflicting namespace path */
1868
+ namespace: string;
1869
+ /** The package that currently owns this namespace */
1870
+ existingPackageId: string;
1871
+ /** The package attempting to register the same namespace */
1872
+ incomingPackageId: string;
1873
+ /** A suggested alternative name to avoid the conflict */
1874
+ suggestion?: string;
1875
+ }
1876
+ /**
1877
+ * Result of namespace availability check.
1878
+ */
1879
+ interface NamespaceCheckResult {
1880
+ /** Whether all requested namespaces are available */
1881
+ available: boolean;
1882
+ /** List of conflicts detected */
1883
+ conflicts: NamespaceConflict[];
1884
+ /** Suggested alternatives for each conflict */
1885
+ suggestions: Record<string, string>;
1886
+ }
1887
+ /**
1888
+ * Namespace Resolver
1889
+ *
1890
+ * Manages namespace registration for installed packages and detects collisions
1891
+ * during install-time. Each metadata item (object, view, flow, page, etc.)
1892
+ * produces a namespace like `objects.<name>` or `views.<name>`.
1893
+ *
1894
+ * When a new package declares objects, views, or other metadata that would
1895
+ * collide with an existing package's metadata, this resolver reports the
1896
+ * conflicts and suggests prefixed alternatives.
1897
+ */
1898
+ declare class NamespaceResolver {
1899
+ private logger;
1900
+ private registry;
1901
+ constructor(logger: ObjectLogger);
1902
+ /**
1903
+ * Register namespaces owned by a package.
1904
+ */
1905
+ register(packageId: string, namespaces: string[]): void;
1906
+ /**
1907
+ * Unregister all namespaces belonging to a package.
1908
+ */
1909
+ unregister(packageId: string): string[];
1910
+ /**
1911
+ * Check whether a set of namespaces is available for a given package.
1912
+ */
1913
+ checkAvailability(packageId: string, namespaces: string[]): NamespaceCheckResult;
1914
+ /**
1915
+ * Extract namespace strings from a package's metadata definition.
1916
+ */
1917
+ extractNamespaces(config: Record<string, unknown>): string[];
1918
+ /**
1919
+ * Get all registered entries.
1920
+ */
1921
+ getRegistry(): ReadonlyMap<string, NamespaceEntry>;
1922
+ /**
1923
+ * Get all namespaces belonging to a specific package.
1924
+ */
1925
+ getPackageNamespaces(packageId: string): string[];
1926
+ /**
1927
+ * Generate a prefixed alternative namespace to avoid conflicts.
1928
+ */
1929
+ private suggestAlternative;
1930
+ }
1931
+
1932
+ /**
1933
+ * Installed package record in the runtime registry.
1934
+ */
1935
+ interface InstalledPackageRecord {
1936
+ /** Package identifier */
1937
+ packageId: string;
1938
+ /** Package version */
1939
+ version: string;
1940
+ /** Package manifest */
1941
+ manifest: Record<string, unknown>;
1942
+ /** Installation timestamp */
1943
+ installedAt: string;
1944
+ /** Current status */
1945
+ status: 'installed' | 'disabled' | 'installing' | 'upgrading' | 'uninstalling' | 'error';
1946
+ /** Namespaces registered by this package */
1947
+ namespaces: string[];
1948
+ /** Dependencies of this package */
1949
+ dependencies: string[];
1950
+ }
1951
+ /**
1952
+ * Snapshot of a package's state before upgrade (for rollback).
1953
+ */
1954
+ interface PackageSnapshot {
1955
+ /** Package identifier */
1956
+ packageId: string;
1957
+ /** Version before upgrade */
1958
+ previousVersion: string;
1959
+ /** Full manifest before upgrade */
1960
+ previousManifest: Record<string, unknown>;
1961
+ /** Namespaces before upgrade */
1962
+ previousNamespaces: string[];
1963
+ /** Original installation timestamp */
1964
+ installedAt: string;
1965
+ /** Snapshot timestamp */
1966
+ createdAt: string;
1967
+ }
1968
+ /**
1969
+ * Result of a package installation attempt.
1970
+ */
1971
+ interface InstallResult {
1972
+ success: boolean;
1973
+ packageId: string;
1974
+ version: string;
1975
+ installedDependencies: string[];
1976
+ namespaceConflicts: Array<{
1977
+ namespace: string;
1978
+ existingPackageId: string;
1979
+ }>;
1980
+ errorMessage?: string;
1981
+ }
1982
+ /**
1983
+ * Result of an upgrade attempt.
1984
+ */
1985
+ interface UpgradeResult {
1986
+ success: boolean;
1987
+ packageId: string;
1988
+ fromVersion: string;
1989
+ toVersion: string;
1990
+ snapshot: PackageSnapshot;
1991
+ errorMessage?: string;
1992
+ }
1993
+ /**
1994
+ * Result of a rollback attempt.
1995
+ */
1996
+ interface RollbackResult {
1997
+ success: boolean;
1998
+ packageId: string;
1999
+ restoredVersion: string;
2000
+ errorMessage?: string;
2001
+ }
2002
+ /**
2003
+ * Package Manager
2004
+ *
2005
+ * Runtime implementation for the full package lifecycle:
2006
+ * install → upgrade → rollback → uninstall.
2007
+ *
2008
+ * Consumes the protocol schemas defined in @objectstack/spec:
2009
+ * - DependencyResolutionResultSchema
2010
+ * - NamespaceConflictErrorSchema
2011
+ * - UpgradePlanSchema / UpgradeSnapshotSchema
2012
+ * - PackageArtifactSchema
2013
+ *
2014
+ * Coordinates with:
2015
+ * - DependencyResolver for topological ordering and conflict detection
2016
+ * - NamespaceResolver for metadata collision prevention
2017
+ */
2018
+ declare class PackageManager {
2019
+ private logger;
2020
+ private packages;
2021
+ private snapshots;
2022
+ private dependencyResolver;
2023
+ private namespaceResolver;
2024
+ private platformVersion;
2025
+ constructor(logger: ObjectLogger, options?: {
2026
+ platformVersion?: string;
2027
+ });
2028
+ /**
2029
+ * Install a package with full dependency resolution and namespace checking.
2030
+ */
2031
+ install(packageId: string, version: string, manifest: Record<string, unknown>): Promise<InstallResult>;
2032
+ /**
2033
+ * Uninstall a package, checking for dependents first.
2034
+ */
2035
+ uninstall(packageId: string): Promise<{
2036
+ success: boolean;
2037
+ errorMessage?: string;
2038
+ }>;
2039
+ /**
2040
+ * Upgrade a package: snapshot → update → register.
2041
+ */
2042
+ upgrade(packageId: string, newVersion: string, newManifest: Record<string, unknown>): Promise<UpgradeResult>;
2043
+ /**
2044
+ * Rollback a package to its pre-upgrade snapshot.
2045
+ */
2046
+ rollback(packageId: string): Promise<RollbackResult>;
2047
+ /**
2048
+ * Get an installed package record.
2049
+ */
2050
+ getPackage(packageId: string): InstalledPackageRecord | undefined;
2051
+ /**
2052
+ * List all installed packages.
2053
+ */
2054
+ listPackages(): InstalledPackageRecord[];
2055
+ /**
2056
+ * Resolve dependencies for a set of packages.
2057
+ */
2058
+ resolveDependencies(packages: Map<string, {
2059
+ version?: string;
2060
+ dependencies?: string[];
2061
+ }>): string[];
2062
+ /**
2063
+ * Check namespace availability for a package's metadata.
2064
+ */
2065
+ checkNamespaces(packageId: string, config: Record<string, unknown>): {
2066
+ available: boolean;
2067
+ conflicts: Array<{
2068
+ namespace: string;
2069
+ existingPackageId: string;
2070
+ }>;
2071
+ };
2072
+ /**
2073
+ * Get the namespace resolver instance.
2074
+ */
2075
+ getNamespaceResolver(): NamespaceResolver;
2076
+ /**
2077
+ * Get a snapshot for a given package (if available).
2078
+ */
2079
+ getSnapshot(packageId: string): PackageSnapshot | undefined;
2080
+ }
2081
+
2082
+ export { ApiRegistry, type ApiRegistryPluginConfig, CORE_FALLBACK_FACTORIES, DependencyResolver, HotReloadManager, type InstallResult, type InstalledPackageRecord, type KernelState, LiteKernel, type NamespaceCheckResult, type NamespaceConflict, type NamespaceEntry, NamespaceResolver, ObjectKernel, ObjectKernelBase, type ObjectKernelConfig, ObjectLogger, PackageManager, type PackageSnapshot, type PermissionCheckResult$1 as PermissionCheckResult, type PermissionGrant, type Plugin, PluginConfigValidator, type PluginContext, PluginHealthMonitor, type PluginHealthStatus, type PluginLoadResult, PluginLoader, type PluginMetadata, type PermissionCheckResult as PluginPermissionCheckResult, PluginPermissionEnforcer, PluginPermissionManager, type PluginPermissions, PluginSandboxRuntime, PluginSecurityScanner, type PluginSignatureConfig, PluginSignatureVerifier, type PluginStartupResult, index as QA, type ResourceUsage, type RollbackResult, type SandboxContext, type ScanTarget, SecurePluginContext, type SecurityIssue, SemanticVersionManager, type ServiceFactory, ServiceLifecycle, type ServiceRegistration, type SignatureVerificationResult, type UpgradeResult, type VersionCompatibility, createApiRegistryPlugin, createLogger, createMemoryCache, createMemoryJob, createMemoryQueue, createPluginConfigValidator, createPluginPermissionEnforcer, getEnv, getMemoryUsage, isNode, safeExit };