@tinycloud/sdk-core 2.0.4-beta.0 → 2.1.0-beta.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.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { InvokeFunction, ServiceError, Result as Result$1, ServiceSession, FetchFunction, ServiceConstructor, RetryPolicy, IServiceContext, IService, IKVService, ISQLService, IDuckDbService, IDataVaultService } from '@tinycloud/sdk-services';
3
- export { BatchOptions, BatchResponse, ColumnInfo, DataVaultConfig, DataVaultService, DatabaseHandle, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ErrorCode, ErrorCodes, ExecuteOptions, ExecuteResponse, FetchFunction, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IKVService, IPrefixedKVService, ISQLService, IService, IServiceContext, InvokeFunction, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, PrefixedKVService, QueryOptions, QueryResponse, Result, RetryPolicy, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, ServiceContext, ServiceContextConfig, ServiceError, ServiceSession, SqlStatement, SqlValue, TableInfo, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, ViewInfo, WasmVaultFunctions, createVaultCrypto, defaultRetryPolicy, err, ok, serviceError } from '@tinycloud/sdk-services';
2
+ import { InvokeFunction, InvokeAnyFunction, ServiceError, Result as Result$1, ServiceSession, FetchFunction, ServiceConstructor, RetryPolicy, IServiceContext, IService, IKVService, ISQLService, IDuckDbService, IHooksService, IDataVaultService } from '@tinycloud/sdk-services';
3
+ export { BatchOptions, BatchResponse, ColumnInfo, DataVaultConfig, DataVaultService, DatabaseHandle, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ErrorCode, ErrorCodes, ExecuteOptions, ExecuteResponse, FetchFunction, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IHooksService, IKVService, IPrefixedKVService, ISQLService, IService, IServiceContext, InvokeAnyEntry, InvokeAnyFunction, InvokeFunction, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, PrefixedKVService, QueryOptions, QueryResponse, Result, RetryPolicy, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, ServiceContext, ServiceContextConfig, ServiceError, ServiceSession, SqlStatement, SqlValue, SubscribeOptions, TableInfo, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, ViewInfo, WasmVaultFunctions, createVaultCrypto, defaultRetryPolicy, err, ok, serviceError } from '@tinycloud/sdk-services';
4
4
  export { SiweMessage } from 'siwe';
5
5
 
6
6
  /**
@@ -198,6 +198,8 @@ interface IENSResolver {
198
198
  interface IWasmBindings {
199
199
  /** Invoke a TinyCloud action */
200
200
  invoke: InvokeFunction;
201
+ /** Invoke multiple TinyCloud capabilities in one authorization header */
202
+ invokeAny?: InvokeAnyFunction;
201
203
  /** Prepare a session (generate session key, build SIWE message) */
202
204
  prepareSession: (params: any) => any;
203
205
  /** Complete session setup (create delegation) */
@@ -2569,6 +2571,10 @@ interface TinyCloudConfig {
2569
2571
  * Required when using services.
2570
2572
  */
2571
2573
  invoke?: InvokeFunction;
2574
+ /**
2575
+ * Optional multi-resource invoke function for aggregated capability requests.
2576
+ */
2577
+ invokeAny?: InvokeAnyFunction;
2572
2578
  /**
2573
2579
  * Custom fetch implementation.
2574
2580
  * Defaults to globalThis.fetch.
@@ -2706,6 +2712,11 @@ declare class TinyCloud {
2706
2712
  * @throws Error if services are not initialized
2707
2713
  */
2708
2714
  get duckdb(): IDuckDbService;
2715
+ /**
2716
+ * Get the Hooks service.
2717
+ * @throws Error if services are not initialized
2718
+ */
2719
+ get hooks(): IHooksService;
2709
2720
  /**
2710
2721
  * Get the Data Vault service.
2711
2722
  * @throws Error if services are not initialized or vault service is not registered
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { InvokeFunction, ServiceError, Result as Result$1, ServiceSession, FetchFunction, ServiceConstructor, RetryPolicy, IServiceContext, IService, IKVService, ISQLService, IDuckDbService, IDataVaultService } from '@tinycloud/sdk-services';
3
- export { BatchOptions, BatchResponse, ColumnInfo, DataVaultConfig, DataVaultService, DatabaseHandle, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ErrorCode, ErrorCodes, ExecuteOptions, ExecuteResponse, FetchFunction, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IKVService, IPrefixedKVService, ISQLService, IService, IServiceContext, InvokeFunction, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, PrefixedKVService, QueryOptions, QueryResponse, Result, RetryPolicy, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, ServiceContext, ServiceContextConfig, ServiceError, ServiceSession, SqlStatement, SqlValue, TableInfo, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, ViewInfo, WasmVaultFunctions, createVaultCrypto, defaultRetryPolicy, err, ok, serviceError } from '@tinycloud/sdk-services';
2
+ import { InvokeFunction, InvokeAnyFunction, ServiceError, Result as Result$1, ServiceSession, FetchFunction, ServiceConstructor, RetryPolicy, IServiceContext, IService, IKVService, ISQLService, IDuckDbService, IHooksService, IDataVaultService } from '@tinycloud/sdk-services';
3
+ export { BatchOptions, BatchResponse, ColumnInfo, DataVaultConfig, DataVaultService, DatabaseHandle, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ErrorCode, ErrorCodes, ExecuteOptions, ExecuteResponse, FetchFunction, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IHooksService, IKVService, IPrefixedKVService, ISQLService, IService, IServiceContext, InvokeAnyEntry, InvokeAnyFunction, InvokeFunction, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, PrefixedKVService, QueryOptions, QueryResponse, Result, RetryPolicy, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, ServiceContext, ServiceContextConfig, ServiceError, ServiceSession, SqlStatement, SqlValue, SubscribeOptions, TableInfo, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, ViewInfo, WasmVaultFunctions, createVaultCrypto, defaultRetryPolicy, err, ok, serviceError } from '@tinycloud/sdk-services';
4
4
  export { SiweMessage } from 'siwe';
5
5
 
6
6
  /**
@@ -198,6 +198,8 @@ interface IENSResolver {
198
198
  interface IWasmBindings {
199
199
  /** Invoke a TinyCloud action */
200
200
  invoke: InvokeFunction;
201
+ /** Invoke multiple TinyCloud capabilities in one authorization header */
202
+ invokeAny?: InvokeAnyFunction;
201
203
  /** Prepare a session (generate session key, build SIWE message) */
202
204
  prepareSession: (params: any) => any;
203
205
  /** Complete session setup (create delegation) */
@@ -2569,6 +2571,10 @@ interface TinyCloudConfig {
2569
2571
  * Required when using services.
2570
2572
  */
2571
2573
  invoke?: InvokeFunction;
2574
+ /**
2575
+ * Optional multi-resource invoke function for aggregated capability requests.
2576
+ */
2577
+ invokeAny?: InvokeAnyFunction;
2572
2578
  /**
2573
2579
  * Custom fetch implementation.
2574
2580
  * Defaults to globalThis.fetch.
@@ -2706,6 +2712,11 @@ declare class TinyCloud {
2706
2712
  * @throws Error if services are not initialized
2707
2713
  */
2708
2714
  get duckdb(): IDuckDbService;
2715
+ /**
2716
+ * Get the Hooks service.
2717
+ * @throws Error if services are not initialized
2718
+ */
2719
+ get hooks(): IHooksService;
2709
2720
  /**
2710
2721
  * Get the Data Vault service.
2711
2722
  * @throws Error if services are not initialized or vault service is not registered
package/dist/index.js CHANGED
@@ -133,6 +133,7 @@ import {
133
133
  KVService,
134
134
  SQLService,
135
135
  DuckDbService,
136
+ HooksService,
136
137
  ok as ok2,
137
138
  err as err2,
138
139
  serviceError as serviceError2,
@@ -1488,6 +1489,7 @@ var TinyCloud = class _TinyCloud {
1488
1489
  }
1489
1490
  this._serviceContext = new ServiceContext({
1490
1491
  invoke: effectiveInvoke,
1492
+ invokeAny: this.config.invokeAny,
1491
1493
  fetch: fetchFn ?? this.config.fetch ?? globalThis.fetch.bind(globalThis),
1492
1494
  hosts: effectiveHosts,
1493
1495
  retryPolicy: this.config.retryPolicy
@@ -1496,6 +1498,7 @@ var TinyCloud = class _TinyCloud {
1496
1498
  kv: KVService,
1497
1499
  sql: SQLService,
1498
1500
  duckdb: DuckDbService,
1501
+ hooks: HooksService,
1499
1502
  ...this.config.services
1500
1503
  };
1501
1504
  for (const [name, ServiceClass] of Object.entries(serviceConstructors)) {
@@ -1576,6 +1579,22 @@ var TinyCloud = class _TinyCloud {
1576
1579
  }
1577
1580
  return service;
1578
1581
  }
1582
+ /**
1583
+ * Get the Hooks service.
1584
+ * @throws Error if services are not initialized
1585
+ */
1586
+ get hooks() {
1587
+ if (!this._servicesInitialized) {
1588
+ throw new Error(
1589
+ "Services not initialized. Call initializeServices() first, or use TinyCloudWeb/TinyCloudNode which handles this automatically."
1590
+ );
1591
+ }
1592
+ const service = this._services.get("hooks");
1593
+ if (!service) {
1594
+ throw new Error("Hooks service is not registered.");
1595
+ }
1596
+ return service;
1597
+ }
1579
1598
  /**
1580
1599
  * Get the Data Vault service.
1581
1600
  * @throws Error if services are not initialized or vault service is not registered
@@ -1941,6 +1960,7 @@ import {
1941
1960
  DuckDbService as DuckDbService2,
1942
1961
  DuckDbDatabaseHandle,
1943
1962
  DuckDbAction,
1963
+ HooksService as HooksService2,
1944
1964
  DataVaultService,
1945
1965
  VaultHeaders,
1946
1966
  VaultPublicSpaceKVActions,
@@ -3727,6 +3747,7 @@ export {
3727
3747
  DuckDbService2 as DuckDbService,
3728
3748
  EnsDataSchema,
3729
3749
  ErrorCodes2 as ErrorCodes,
3750
+ HooksService2 as HooksService,
3730
3751
  KVService2 as KVService,
3731
3752
  PrefixedKVService,
3732
3753
  ProtocolMismatchError,