@boltic/sdk 0.1.3 → 0.1.5

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.
@@ -172,6 +172,8 @@ export declare class BolticClient {
172
172
  private indexResource;
173
173
  private databaseResource;
174
174
  private workflowResource;
175
+ private serverlessResource;
176
+ private storageResource;
175
177
  private currentDatabase;
176
178
  private clientOptions;
177
179
  constructor(apiKey: string, options?: ClientOptions);
@@ -311,6 +313,59 @@ export declare class BolticClient {
311
313
  getIntegrationResource: (params: GetIntegrationResourceParams) => Promise<BolticErrorResponse | BolticSuccessResponse<IntegrationResourceData>>;
312
314
  getIntegrationForm: (params: GetIntegrationFormParams) => Promise<BolticErrorResponse | BolticSuccessResponse<Record<string, unknown> | IntegrationFormJsonSchema>>;
313
315
  };
316
+ /**
317
+ * Serverless function operations.
318
+ *
319
+ * @example
320
+ * ```typescript
321
+ * // List all serverless functions
322
+ * const list = await client.serverless.list();
323
+ *
324
+ * // Create a new serverless function
325
+ * const fn = await client.serverless.create({
326
+ * Name: 'my-api',
327
+ * Runtime: 'code',
328
+ * CodeOpts: { Language: 'nodejs/20', Code: '...' },
329
+ * Resources: { CPU: 0.1, MemoryMB: 128, MemoryMaxMB: 128 },
330
+ * Scaling: { AutoStop: false, Min: 1, Max: 1, MaxIdleTime: 0 },
331
+ * });
332
+ *
333
+ * // Get a serverless function by ID
334
+ * const details = await client.serverless.get('serverless-id');
335
+ *
336
+ * // Get builds
337
+ * const builds = await client.serverless.getBuilds({ appId: 'id' });
338
+ *
339
+ * // Get runtime logs
340
+ * const logs = await client.serverless.getLogs({ appId: 'id' });
341
+ * ```
342
+ */
343
+ get serverless(): {
344
+ list: (params?: ListServerlessParams) => Promise<BolticErrorResponse | BolticSuccessResponse<ListServerlessData>>;
345
+ get: (appId: string) => Promise<BolticErrorResponse | BolticSuccessResponse<ServerlessData>>;
346
+ create: (params: CreateServerlessParams) => Promise<BolticErrorResponse | BolticSuccessResponse<ServerlessData>>;
347
+ createAndWait: (params: CreateServerlessParams) => Promise<BolticErrorResponse | BolticSuccessResponse<ServerlessData>>;
348
+ update: (params: UpdateServerlessParams) => Promise<BolticErrorResponse | BolticSuccessResponse<ServerlessData>>;
349
+ updateAndWait: (params: UpdateServerlessParams) => Promise<BolticErrorResponse | BolticSuccessResponse<ServerlessData>>;
350
+ getBuilds: (params: GetBuildsParams) => Promise<BolticErrorResponse | BolticSuccessResponse<GetBuildsData>>;
351
+ getLogs: (params: GetLogsParams) => Promise<BolticErrorResponse | BolticSuccessResponse<GetLogsData>>;
352
+ getBuildLogs: (params: GetBuildLogsParams) => Promise<BolticErrorResponse | BolticSuccessResponse<GetBuildLogsData>>;
353
+ pollStatus: (appId: string, options?: {
354
+ intervalMs?: number;
355
+ maxAttempts?: number;
356
+ }) => Promise<BolticErrorResponse | BolticSuccessResponse<ServerlessData>>;
357
+ };
358
+ get storage(): {
359
+ list: (params?: ListStorageParams) => Promise<BolticErrorResponse | ListStorageData>;
360
+ upload: (params: UploadParams) => Promise<BolticErrorResponse | UploadData>;
361
+ createFolder: (params: CreateFolderParams) => Promise<BolticErrorResponse | CreateFolderData>;
362
+ deleteFile: (params: DeleteFileParams) => Promise<BolticErrorResponse | {
363
+ message: unknown;
364
+ }>;
365
+ makePublic: (filePath: string) => Promise<BolticErrorResponse | ObjectAccessSummary>;
366
+ makePrivate: (filePath: string) => Promise<BolticErrorResponse | ObjectAccessSummary>;
367
+ downloadFile: (params: DownloadFileParams) => Promise<BolticErrorResponse | DownloadFileData>;
368
+ };
314
369
  getSqlResource(): SqlResource;
315
370
  updateApiKey(newApiKey: string): void;
316
371
  updateConfig(updates: Partial<ClientConfig>): void;
@@ -371,6 +426,15 @@ export declare interface BolticSuccessResponse<T> {
371
426
  };
372
427
  }
373
428
 
429
+ export declare function buildStorageEndpointPath(endpoint: StorageApiEndpoint): string;
430
+
431
+ export declare interface ChangeObjectAccessParams {
432
+ /** Full file path in bucket */
433
+ file_path: string;
434
+ /** `true` = public, `false` = private */
435
+ public: boolean;
436
+ }
437
+
374
438
  export declare interface ClientConfig extends EnvironmentConfig {
375
439
  apiKey: string;
376
440
  environment: Environment;
@@ -482,6 +546,32 @@ export declare function createClient(apiKey: string, options?: ClientOptions): B
482
546
  */
483
547
  export declare function createErrorWithContext(message: string, context?: Record<string, unknown>): Error;
484
548
 
549
+ export declare interface CreateFolderData {
550
+ message: string;
551
+ }
552
+
553
+ export declare interface CreateFolderParams {
554
+ storageType?: string;
555
+ /** Target folder path (`folder_path` body field). */
556
+ folder_path: string;
557
+ }
558
+
559
+ export declare type CreateServerlessData = ServerlessData;
560
+
561
+ export declare interface CreateServerlessParams {
562
+ Name: string;
563
+ Description?: string;
564
+ Runtime: ServerlessRuntime;
565
+ Env?: Record<string, string>;
566
+ PortMap?: ServerlessPortMap[];
567
+ Scaling?: ServerlessScaling;
568
+ Resources?: ServerlessResources;
569
+ Timeout?: number;
570
+ Validations?: unknown;
571
+ CodeOpts?: ServerlessCodeOpts;
572
+ ContainerOpts?: ServerlessContainerOpts;
573
+ }
574
+
485
575
  /** Data returned from the get-credentials API */
486
576
  export declare type CredentialsListData = Record<string, unknown>;
487
577
 
@@ -623,10 +713,60 @@ declare const DateFormatEnum: Readonly<{
623
713
 
624
714
  declare type DecimalType = '00' | '0.0' | '0.00' | '0.000' | '0.0000' | '0.00000' | '0.000000';
625
715
 
716
+ /** Default resource allocation for new serverless functions */
717
+ export declare const DEFAULT_RESOURCES: {
718
+ readonly CPU: 0.1;
719
+ readonly MemoryMB: 128;
720
+ readonly MemoryMaxMB: 128;
721
+ };
722
+
723
+ /** Default scaling configuration for new serverless functions */
724
+ export declare const DEFAULT_SCALING: {
725
+ readonly AutoStop: false;
726
+ readonly Min: 1;
727
+ readonly Max: 1;
728
+ readonly MaxIdleTime: 0;
729
+ };
730
+
731
+ /** Default backend storage driver (GCS). */
732
+ export declare const DEFAULT_STORAGE_TYPE: "gcs";
733
+
734
+ export declare interface DeleteFileData {
735
+ message: unknown;
736
+ }
737
+
738
+ export declare interface DeleteFileParams {
739
+ storageType?: string;
740
+ /** Full object path in bucket */
741
+ filename: string;
742
+ /** Optional metering payload (Zenith sends `totalsize`). */
743
+ filepath?: string;
744
+ totalsize?: number;
745
+ }
746
+
626
747
  declare interface DeleteIndexResponse {
627
748
  message?: string;
628
749
  }
629
750
 
751
+ export declare interface DownloadFileData {
752
+ bytes: ArrayBuffer;
753
+ /** Usually 206 Partial Content for range responses. */
754
+ status: number;
755
+ contentType?: string;
756
+ }
757
+
758
+ /** `POST /file-export` — byte range download; SDK requests full file by default. */
759
+ export declare interface DownloadFileParams {
760
+ storageType?: string;
761
+ /** Full object path in bucket (same as list `fullPath` / delete `filename`). */
762
+ file_name: string;
763
+ /**
764
+ * Size in bytes from `list()` item `size`. If omitted, the SDK lists the parent folder
765
+ * and matches by `fullPath` / `name`.
766
+ */
767
+ sizeBytes?: number | string;
768
+ }
769
+
630
770
  export declare type Environment = 'local' | 'sit' | 'uat' | 'prod';
631
771
 
632
772
  export declare interface EnvironmentConfig {
@@ -755,6 +895,26 @@ export declare interface FormField {
755
895
  };
756
896
  }
757
897
 
898
+ export declare type GetBuildLogsData = ServerlessBuildLogEntry[];
899
+
900
+ export declare interface GetBuildLogsParams {
901
+ /** The serverless function ID. */
902
+ appId: string;
903
+ /** The build ID. */
904
+ buildId: string;
905
+ }
906
+
907
+ export declare type GetBuildsData = ServerlessBuild[];
908
+
909
+ export declare interface GetBuildsParams {
910
+ /** The serverless function ID. */
911
+ appId: string;
912
+ /** Page number (1-based). @defaultValue 1 */
913
+ page?: number;
914
+ /** Items per page. @defaultValue 20 */
915
+ limit?: number;
916
+ }
917
+
758
918
  /** Parameters accepted by `workflow.getCredentials()`. */
759
919
  export declare interface GetCredentialsParams {
760
920
  /** Integration name (e.g. "freshsales"). Automatically uppercased by the SDK. */
@@ -823,6 +983,30 @@ export declare interface GetIntegrationsParams {
823
983
  per_page?: number;
824
984
  }
825
985
 
986
+ export declare type GetLogsData = ServerlessLogEntry[];
987
+
988
+ export declare interface GetLogsParams {
989
+ /** The serverless function ID. */
990
+ appId: string;
991
+ /** Page number (1-based). @defaultValue 1 */
992
+ page?: number;
993
+ /** Items per page. @defaultValue 50 */
994
+ limit?: number;
995
+ /** Sort direction. @defaultValue 'DESC' */
996
+ sortOrder?: 'ASC' | 'DESC';
997
+ /** Unix epoch start (seconds). Defaults to 24h ago. */
998
+ timestampStart?: number;
999
+ /** Unix epoch end (seconds). Defaults to now. */
1000
+ timestampEnd?: number;
1001
+ }
1002
+
1003
+ export declare type GetServerlessData = ServerlessData;
1004
+
1005
+ export declare interface GetServerlessParams {
1006
+ /** The serverless function ID. */
1007
+ appId: string;
1008
+ }
1009
+
826
1010
  declare interface HttpAdapter {
827
1011
  request<T = unknown>(config: HttpRequestConfig): Promise<HttpResponse<T>>;
828
1012
  }
@@ -835,6 +1019,11 @@ declare interface HttpRequestConfig {
835
1019
  data?: unknown;
836
1020
  timeout?: number;
837
1021
  signal?: AbortSignal;
1022
+ /**
1023
+ * Opt-in only. When unset (default), JSON/text parsing is unchanged for all services.
1024
+ * Storage `downloadFile` sets `arraybuffer` for binary bodies.
1025
+ */
1026
+ responseType?: 'arraybuffer';
838
1027
  }
839
1028
 
840
1029
  declare interface HttpResponse<T = unknown> {
@@ -947,6 +1136,54 @@ declare interface ListIndexesResponse {
947
1136
  };
948
1137
  }
949
1138
 
1139
+ export declare type ListServerlessData = ServerlessData[];
1140
+
1141
+ export declare interface ListServerlessParams {
1142
+ /** Page number (1-based). @defaultValue 1 */
1143
+ page?: number;
1144
+ /** Items per page. @defaultValue 20 */
1145
+ limit?: number;
1146
+ /** Field to sort by. @defaultValue 'CreatedAt' */
1147
+ sortBy?: string;
1148
+ /** Sort direction. @defaultValue 'desc' */
1149
+ sortOrder?: 'asc' | 'desc';
1150
+ /** Search query string to filter by name. */
1151
+ query?: string;
1152
+ }
1153
+
1154
+ export declare interface ListStorageData {
1155
+ files: StorageListFilesPayload;
1156
+ }
1157
+
1158
+ /** List query — forwarded to backend object listing. */
1159
+ export declare interface ListStorageParams {
1160
+ storageType?: string;
1161
+ /** Folder prefix to list under */
1162
+ basePath?: string;
1163
+ pageSize?: number | string;
1164
+ nextPageToken?: string;
1165
+ }
1166
+
1167
+ /**
1168
+ * `expire_in` for upload temporary read URLs is **minutes**.
1169
+ * Backend caps TTL to 7 days.
1170
+ */
1171
+ export declare const MAX_SIGNED_URL_EXPIRE_MINUTES: number;
1172
+
1173
+ /** Maximum number of status polling attempts before timeout */
1174
+ export declare const MAX_STATUS_POLLING_ATTEMPTS = 60;
1175
+
1176
+ /** Returned by `makePublic` / `makePrivate` — matches `POST /change-object-access` success body. */
1177
+ export declare interface ObjectAccessSummary {
1178
+ /** Human-readable status from the API. */
1179
+ message: string;
1180
+ /** Full object path in the bucket. */
1181
+ name: string;
1182
+ size: string | null;
1183
+ updated: string | null;
1184
+ public: boolean;
1185
+ }
1186
+
950
1187
  export declare interface PaginationInfo {
951
1188
  total_count: number;
952
1189
  total_pages: number;
@@ -1223,11 +1460,314 @@ export declare interface RetryConfig {
1223
1460
  maximum_interval: number;
1224
1461
  }
1225
1462
 
1463
+ export declare class ServerlessApiClient extends BaseApiClient {
1464
+ constructor(apiKey: string, config?: Omit<BaseApiClientConfig, 'apiKey'>);
1465
+ /**
1466
+ * List all serverless functions with optional pagination and search.
1467
+ */
1468
+ list(params?: ListServerlessParams): Promise<ServerlessResponse<ListServerlessData>>;
1469
+ /**
1470
+ * Get a serverless function by its ID.
1471
+ */
1472
+ get(appId: string): Promise<ServerlessResponse<GetServerlessData>>;
1473
+ /**
1474
+ * Create a new serverless function.
1475
+ */
1476
+ create(payload: CreateServerlessParams): Promise<ServerlessResponse<CreateServerlessData>>;
1477
+ /**
1478
+ * Update an existing serverless function.
1479
+ */
1480
+ update(params: UpdateServerlessParams): Promise<ServerlessResponse<UpdateServerlessData>>;
1481
+ /**
1482
+ * List builds for a serverless function.
1483
+ */
1484
+ getBuilds(params: GetBuildsParams): Promise<ServerlessResponse<GetBuildsData>>;
1485
+ /**
1486
+ * Get runtime logs for a serverless function.
1487
+ */
1488
+ getLogs(params: GetLogsParams): Promise<ServerlessResponse<GetLogsData>>;
1489
+ /**
1490
+ * Get build logs for a specific build of a serverless function.
1491
+ */
1492
+ getBuildLogs(params: GetBuildLogsParams): Promise<ServerlessResponse<GetBuildLogsData>>;
1493
+ }
1494
+
1495
+ export declare interface ServerlessApiEndpoint {
1496
+ path: string;
1497
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
1498
+ authenticated: boolean;
1499
+ }
1500
+
1501
+ export declare interface ServerlessAppDomain {
1502
+ DomainName: string;
1503
+ BaseUrl?: string;
1504
+ }
1505
+
1506
+ export declare interface ServerlessBuild {
1507
+ ID: string;
1508
+ Version?: number;
1509
+ Status?: string;
1510
+ StatusHistory?: ServerlessBuildStatusEntry[];
1511
+ CreatedAt?: string;
1512
+ [key: string]: unknown;
1513
+ }
1514
+
1515
+ export declare interface ServerlessBuildLogEntry {
1516
+ Log?: string;
1517
+ Timestamp?: number;
1518
+ Message?: string;
1519
+ [key: string]: unknown;
1520
+ }
1521
+
1522
+ export declare interface ServerlessBuildStatusEntry {
1523
+ Status: string;
1524
+ Timestamp?: string;
1525
+ }
1526
+
1527
+ export declare interface ServerlessCodeOpts {
1528
+ Language: string;
1529
+ Packages?: string[];
1530
+ Code?: string;
1531
+ }
1532
+
1533
+ export declare interface ServerlessConfig {
1534
+ Name: string;
1535
+ Description?: string;
1536
+ Runtime: ServerlessRuntime;
1537
+ Env?: Record<string, string>;
1538
+ PortMap?: ServerlessPortMap[];
1539
+ Scaling?: ServerlessScaling;
1540
+ Resources?: ServerlessResources;
1541
+ Timeout?: number;
1542
+ Validations?: unknown;
1543
+ CodeOpts?: ServerlessCodeOpts;
1544
+ ContainerOpts?: ServerlessContainerOpts;
1545
+ }
1546
+
1547
+ export declare interface ServerlessContainerOpts {
1548
+ Image: string;
1549
+ Args?: string[];
1550
+ Command?: string;
1551
+ }
1552
+
1553
+ export declare interface ServerlessData {
1554
+ ID: string;
1555
+ ParentID?: string;
1556
+ Status: ServerlessStatus;
1557
+ Config: ServerlessConfig;
1558
+ Links?: {
1559
+ Git?: {
1560
+ Repository?: ServerlessGitRepository;
1561
+ };
1562
+ };
1563
+ AppDomain?: ServerlessAppDomain[];
1564
+ RegionID?: string;
1565
+ CreatedAt?: string;
1566
+ UpdatedAt?: string;
1567
+ [key: string]: unknown;
1568
+ }
1569
+
1570
+ export declare interface ServerlessGitRepository {
1571
+ SshURL?: string;
1572
+ HtmlURL?: string;
1573
+ CloneURL?: string;
1574
+ }
1575
+
1576
+ export declare interface ServerlessLogEntry {
1577
+ Timestamp?: number;
1578
+ Severity?: string;
1579
+ Log?: string;
1580
+ [key: string]: unknown;
1581
+ }
1582
+
1583
+ export declare interface ServerlessPortMap {
1584
+ ContainerPort?: number;
1585
+ HostPort?: number;
1586
+ Protocol?: string;
1587
+ }
1588
+
1589
+ export declare class ServerlessResource extends BaseResource {
1590
+ private apiClient;
1591
+ constructor(client: BaseClient);
1592
+ /**
1593
+ * List all serverless functions with optional pagination and search.
1594
+ *
1595
+ * @param params - Optional pagination and filter parameters
1596
+ * @returns Paginated list of serverless functions
1597
+ *
1598
+ * @example
1599
+ * ```typescript
1600
+ * const list = await client.serverless.list();
1601
+ * const filtered = await client.serverless.list({ query: 'my-func', limit: 10 });
1602
+ * ```
1603
+ */
1604
+ list(params?: ListServerlessParams): Promise<BolticSuccessResponse<ListServerlessData> | BolticErrorResponse>;
1605
+ /**
1606
+ * Get a serverless function by its ID.
1607
+ *
1608
+ * @param appId - The serverless function ID
1609
+ * @returns The serverless function details
1610
+ *
1611
+ * @example
1612
+ * ```typescript
1613
+ * const fn = await client.serverless.get('serverless-id');
1614
+ * ```
1615
+ */
1616
+ get(appId: string): Promise<BolticSuccessResponse<GetServerlessData> | BolticErrorResponse>;
1617
+ /**
1618
+ * Create a new serverless function.
1619
+ *
1620
+ * Supports three runtime types:
1621
+ * - `code` — deploy code directly (blueprint)
1622
+ * - `git` — deploy from a Git repository
1623
+ * - `container` — deploy a Docker container
1624
+ *
1625
+ * @param params - The serverless creation payload
1626
+ * @returns The created serverless function
1627
+ *
1628
+ * @example
1629
+ * ```typescript
1630
+ * const fn = await client.serverless.create({
1631
+ * Name: 'my-api',
1632
+ * Runtime: 'code',
1633
+ * Resources: { CPU: 0.1, MemoryMB: 128, MemoryMaxMB: 128 },
1634
+ * Scaling: { AutoStop: false, Min: 1, Max: 1, MaxIdleTime: 0 },
1635
+ * CodeOpts: { Language: 'nodejs/20', Code: 'module.exports.handler = ...' },
1636
+ * });
1637
+ * ```
1638
+ */
1639
+ create(params: CreateServerlessParams): Promise<BolticSuccessResponse<CreateServerlessData> | BolticErrorResponse>;
1640
+ /**
1641
+ * Create a serverless function and poll until it reaches a terminal state.
1642
+ *
1643
+ * Combines `create()` + `pollStatus()` for a simpler workflow.
1644
+ *
1645
+ * @param params - The serverless creation payload
1646
+ * @returns The final serverless state after reaching a terminal status
1647
+ *
1648
+ * @example
1649
+ * ```typescript
1650
+ * const fn = await client.serverless.createAndWait({
1651
+ * Name: 'my-api',
1652
+ * Runtime: 'code',
1653
+ * CodeOpts: { Language: 'nodejs/20', Code: '...' },
1654
+ * Resources: { CPU: 0.1, MemoryMB: 128, MemoryMaxMB: 128 },
1655
+ * Scaling: { AutoStop: false, Min: 1, Max: 1, MaxIdleTime: 0 },
1656
+ * });
1657
+ * ```
1658
+ */
1659
+ createAndWait(params: CreateServerlessParams): Promise<BolticSuccessResponse<ServerlessData> | BolticErrorResponse>;
1660
+ /**
1661
+ * Update an existing serverless function.
1662
+ *
1663
+ * @param params - The update parameters (appId + partial payload)
1664
+ * @returns The updated serverless function
1665
+ *
1666
+ * @example
1667
+ * ```typescript
1668
+ * const updated = await client.serverless.update({
1669
+ * appId: 'serverless-id',
1670
+ * payload: { Scaling: { AutoStop: true, Min: 0, Max: 3, MaxIdleTime: 300 } },
1671
+ * });
1672
+ * ```
1673
+ */
1674
+ update(params: UpdateServerlessParams): Promise<BolticSuccessResponse<UpdateServerlessData> | BolticErrorResponse>;
1675
+ /**
1676
+ * Update a serverless function and poll until it reaches a terminal state.
1677
+ *
1678
+ * @param params - The update parameters (appId + partial payload)
1679
+ * @returns The final serverless state after reaching a terminal status
1680
+ */
1681
+ updateAndWait(params: UpdateServerlessParams): Promise<BolticSuccessResponse<ServerlessData> | BolticErrorResponse>;
1682
+ /**
1683
+ * List builds for a serverless function.
1684
+ *
1685
+ * @param params - The app ID and optional pagination
1686
+ * @returns List of builds
1687
+ *
1688
+ * @example
1689
+ * ```typescript
1690
+ * const builds = await client.serverless.getBuilds({ appId: 'serverless-id' });
1691
+ * ```
1692
+ */
1693
+ getBuilds(params: GetBuildsParams): Promise<BolticSuccessResponse<GetBuildsData> | BolticErrorResponse>;
1694
+ /**
1695
+ * Get runtime logs for a serverless function.
1696
+ *
1697
+ * @param params - The app ID and optional time range / pagination
1698
+ * @returns Log entries
1699
+ *
1700
+ * @example
1701
+ * ```typescript
1702
+ * const logs = await client.serverless.getLogs({ appId: 'serverless-id' });
1703
+ * const recentLogs = await client.serverless.getLogs({
1704
+ * appId: 'serverless-id',
1705
+ * limit: 100,
1706
+ * sortOrder: 'DESC',
1707
+ * });
1708
+ * ```
1709
+ */
1710
+ getLogs(params: GetLogsParams): Promise<BolticSuccessResponse<GetLogsData> | BolticErrorResponse>;
1711
+ /**
1712
+ * Get build logs for a specific build.
1713
+ *
1714
+ * @param params - The app ID and build ID
1715
+ * @returns Build log entries
1716
+ *
1717
+ * @example
1718
+ * ```typescript
1719
+ * const logs = await client.serverless.getBuildLogs({
1720
+ * appId: 'serverless-id',
1721
+ * buildId: 'build-id',
1722
+ * });
1723
+ * ```
1724
+ */
1725
+ getBuildLogs(params: GetBuildLogsParams): Promise<BolticSuccessResponse<GetBuildLogsData> | BolticErrorResponse>;
1726
+ /**
1727
+ * Poll a serverless function until it reaches a terminal status
1728
+ * (running, failed, degraded, or suspended).
1729
+ *
1730
+ * @param appId - The serverless function ID to poll
1731
+ * @param options - Optional polling configuration overrides
1732
+ * @returns The final serverless state or a timeout error
1733
+ *
1734
+ * @example
1735
+ * ```typescript
1736
+ * const result = await client.serverless.pollStatus('serverless-id');
1737
+ * ```
1738
+ */
1739
+ pollStatus(appId: string, options?: {
1740
+ intervalMs?: number;
1741
+ maxAttempts?: number;
1742
+ }): Promise<BolticSuccessResponse<ServerlessData> | BolticErrorResponse>;
1743
+ }
1744
+
1745
+ export declare interface ServerlessResources {
1746
+ CPU: number;
1747
+ MemoryMB: number;
1748
+ MemoryMaxMB: number;
1749
+ }
1750
+
1751
+ declare type ServerlessResponse<T> = BolticSuccessResponse<T> | BolticErrorResponse;
1752
+
1753
+ export declare type ServerlessRuntime = 'code' | 'git' | 'container';
1754
+
1755
+ export declare interface ServerlessScaling {
1756
+ AutoStop: boolean;
1757
+ Min: number;
1758
+ Max: number;
1759
+ MaxIdleTime: number;
1760
+ }
1761
+
1762
+ export declare type ServerlessStatus = 'running' | 'draft' | 'building' | 'pending' | 'stopped' | 'failed' | 'degraded' | 'suspended';
1763
+
1226
1764
  /** Well-known service paths used across the SDK */
1227
1765
  export declare const SERVICE_PATHS: {
1228
1766
  readonly DATABASES: "/service/sdk/boltic-tables/v1";
1229
1767
  readonly WORKFLOW_TEMPORAL: "/service/panel/temporal/v1.0";
1230
1768
  readonly INTEGRATION: "/service/panel/integration/v1";
1769
+ readonly SERVERLESS: "/service/panel/serverless/v1.0";
1770
+ readonly STORAGE: "/service/panel/storage/v1.0";
1231
1771
  };
1232
1772
 
1233
1773
  export declare interface ServiceAuthConfig extends AuthConfig_2 {
@@ -1266,6 +1806,126 @@ declare class SqlResource {
1266
1806
  executeSQL(query: string, dbId?: string): Promise<ExecuteSQLApiResponse | BolticErrorResponse>;
1267
1807
  }
1268
1808
 
1809
+ /** Polling interval in milliseconds between status checks */
1810
+ export declare const STATUS_POLLING_INTERVAL_MS = 5000;
1811
+
1812
+ export declare const STORAGE_ENDPOINTS: StorageEndpoints;
1813
+
1814
+ export declare class StorageApiClient extends BaseApiClient {
1815
+ constructor(apiKey: string, config?: Omit<BaseApiClientConfig, 'apiKey'>);
1816
+ /** Shared try/catch + http — same idea as inlined blocks in serverless/workflow clients, but DRY for storage. */
1817
+ private requestStorage;
1818
+ private url;
1819
+ private storageTypeQuery;
1820
+ private listQuery;
1821
+ /** `expire_in` is minutes; clamp to max temporary URL lifetime (7 days). */
1822
+ private normalizeExpireInMinutes;
1823
+ private isTruthyFormFlag;
1824
+ /**
1825
+ * `public` shortcut: true + no expire_in → permanent; true + expire_in → temporary signed URL; false → private.
1826
+ * Legacy: omit `public` and pass `is_public` / `is_public_permanent` / `expire_in` as before.
1827
+ */
1828
+ private appendUploadVisibility;
1829
+ private buildUploadForm;
1830
+ private isErrorResult;
1831
+ private isAclErrorResult;
1832
+ private buildObjectAccessSummary;
1833
+ /**
1834
+ * Parses Hawkeye `POST /change-object-access` success JSON
1835
+ * `{ message, name, size, updated, public }`.
1836
+ */
1837
+ private parseChangeObjectAccessResponse;
1838
+ /** Resolves the list row for a full object path (same folder semantics as download size resolution). */
1839
+ private findFileListItem;
1840
+ /** Keep only SDK list fields; flatten metadata to `size` / `updatedAt`. */
1841
+ private normalizeListItem;
1842
+ /** Map wire `shareable_link` to `temporary_sharable_link`. */
1843
+ private normalizeUploadData;
1844
+ private normalizeListResponse;
1845
+ list(params?: ListStorageParams): Promise<StorageResult_2<ListStorageData>>;
1846
+ createFolder(body: CreateFolderParams): Promise<StorageResult_2<CreateFolderData>>;
1847
+ deleteFile(params: DeleteFileParams): Promise<StorageResult_2<{
1848
+ message: unknown;
1849
+ }>>;
1850
+ /**
1851
+ * `POST /change-object-access` — used by `makePublic` / `makePrivate`.
1852
+ * Preferring API body `{ message, name, size, updated, public }`; otherwise falls back to a parent list.
1853
+ */
1854
+ setObjectAccess(body: ChangeObjectAccessParams): Promise<StorageResult_2<ObjectAccessSummary>>;
1855
+ upload(params: UploadParams): Promise<StorageResult_2<UploadData>>;
1856
+ private resolveFileSizeBytes;
1857
+ /**
1858
+ * Download file bytes via `POST /file-export` (range 0..size-1).
1859
+ */
1860
+ downloadFile(params: DownloadFileParams): Promise<StorageResult_2<DownloadFileData>>;
1861
+ }
1862
+
1863
+ export declare type StorageApiEndpoint = {
1864
+ path: string;
1865
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
1866
+ authenticated: boolean;
1867
+ };
1868
+
1869
+ declare interface StorageEndpoints {
1870
+ list: StorageApiEndpoint;
1871
+ upload: StorageApiEndpoint;
1872
+ directory: StorageApiEndpoint;
1873
+ deleteFile: StorageApiEndpoint;
1874
+ objectAccess: StorageApiEndpoint;
1875
+ /** Range download (`POST /file-export`). */
1876
+ fileExport: StorageApiEndpoint;
1877
+ }
1878
+
1879
+ /** Response shape from `GET .../list` — `{ files: listResult }`. */
1880
+ export declare interface StorageListFilesPayload {
1881
+ data?: StorageListItem[];
1882
+ next_page_token?: string;
1883
+ totalCount?: number;
1884
+ }
1885
+
1886
+ /**
1887
+ * List row — only these fields are returned (size / `updatedAt` flattened from object metadata).
1888
+ */
1889
+ export declare interface StorageListItem {
1890
+ name?: string;
1891
+ path?: string;
1892
+ folderName?: string;
1893
+ parentPath?: string;
1894
+ isDirectory?: boolean;
1895
+ isPublic?: boolean;
1896
+ cdnUrl?: string | null;
1897
+ /** Full object path in the bucket: `parentPath/name` for files, when derivable. */
1898
+ fullPath?: string;
1899
+ /** Byte size as string (from object metadata). */
1900
+ size?: string;
1901
+ /** Last update time (from `updated` / `timeUpdated` in raw metadata). */
1902
+ updatedAt?: string;
1903
+ }
1904
+
1905
+ export declare class StorageResource extends BaseResource {
1906
+ private apiClient;
1907
+ constructor(client: BaseClient);
1908
+ list(params?: ListStorageParams): Promise<StorageResult<ListStorageData>>;
1909
+ /** Direct upload — `POST /upload` (multipart); server persists the object. */
1910
+ upload(params: UploadParams): Promise<StorageResult<UploadData>>;
1911
+ createFolder(params: CreateFolderParams): Promise<StorageResult<CreateFolderData>>;
1912
+ deleteFile(params: DeleteFileParams): Promise<StorageResult<{
1913
+ message: unknown;
1914
+ }>>;
1915
+ makePublic(filePath: string): Promise<StorageResult<ObjectAccessSummary>>;
1916
+ makePrivate(filePath: string): Promise<StorageResult<ObjectAccessSummary>>;
1917
+ /** Download file bytes via `POST /file-export` (full file). */
1918
+ downloadFile(params: DownloadFileParams): Promise<StorageResult<DownloadFileData>>;
1919
+ }
1920
+
1921
+ export declare type StorageResponse<T> = StorageSuccess<T> | BolticErrorResponse;
1922
+
1923
+ declare type StorageResult<T> = StorageResponse<T>;
1924
+
1925
+ declare type StorageResult_2<T> = T | BolticErrorResponse;
1926
+
1927
+ declare type StorageSuccess<T> = T;
1928
+
1269
1929
  /**
1270
1930
  * Table Builder - provides a fluent interface for creating tables
1271
1931
  */
@@ -1541,6 +2201,9 @@ declare interface TableUpdateRequest {
1541
2201
  fields?: Array<keyof TableRecord>;
1542
2202
  }
1543
2203
 
2204
+ /** Serverless statuses that indicate the function has reached a terminal state */
2205
+ export declare const TERMINAL_STATUSES: readonly ["running", "failed", "degraded", "suspended"];
2206
+
1544
2207
  declare interface TextToSQLOptions {
1545
2208
  currentQuery?: string;
1546
2209
  }
@@ -1584,6 +2247,67 @@ export declare function transformFormToDefaults(fields: FormField[], skipFields?
1584
2247
  */
1585
2248
  export declare function transformFormToJsonSchema(fields: FormField[], skipFields?: Set<string>): IntegrationFormJsonSchema;
1586
2249
 
2250
+ export declare type UpdateServerlessData = ServerlessData;
2251
+
2252
+ export declare interface UpdateServerlessParams {
2253
+ /** The serverless function ID to update. */
2254
+ appId: string;
2255
+ /** The update payload — partial config fields to update. */
2256
+ payload: Partial<CreateServerlessParams>;
2257
+ }
2258
+
2259
+ export declare interface UploadData {
2260
+ message: string;
2261
+ path: string;
2262
+ /** Temporary signed read URL (mapped from API `shareable_link` when present). */
2263
+ temporary_sharable_link?: string;
2264
+ public_url?: string;
2265
+ }
2266
+
2267
+ /**
2268
+ * Shared multipart fields for `POST /upload` (direct upload handler).
2269
+ *
2270
+ * **Preferred — `public` (mapped by the SDK):**
2271
+ * - Omitted or `false` → private upload.
2272
+ * - `true` **without** `expire_in` → permanent public (CDN-style `public_url`); sends `is_public_permanent`, not time-limited signed upload.
2273
+ * - `true` **with** `expire_in` → temporary signed read URL (`temporary_sharable_link` on upload response). `expire_in` is **minutes**, max 7 days (SDK clamps to `MAX_SIGNED_URL_EXPIRE_MINUTES`).
2274
+ *
2275
+ * If **`public` is set** (including `false`), it takes precedence over `is_public` / `is_public_permanent` for the wire shape.
2276
+ *
2277
+ * **Legacy (omit `public`):** set `is_public` / `is_public_permanent` / `expire_in` directly as the backend expects.
2278
+ */
2279
+ export declare interface UploadMultipartFields {
2280
+ storageType?: string;
2281
+ file: Blob;
2282
+ filepath?: string;
2283
+ overwrite?: boolean | string;
2284
+ /**
2285
+ * High-level visibility. See interface JSDoc. When present, controls how `is_public` / `is_public_permanent` / `expire_in` are sent.
2286
+ */
2287
+ public?: boolean | string;
2288
+ /** @deprecated Prefer `public` unless you need raw backend fields. */
2289
+ is_public?: boolean | string;
2290
+ /**
2291
+ * Signed URL lifetime in **minutes** when using `public: true` (temporary) or legacy `is_public: true`.
2292
+ * Capped at 7 days; the SDK clamps to `MAX_SIGNED_URL_EXPIRE_MINUTES`.
2293
+ */
2294
+ expire_in?: number | string;
2295
+ /** @deprecated Prefer `public: true` without `expire_in` unless you need raw backend fields. */
2296
+ is_public_permanent?: boolean | string;
2297
+ }
2298
+
2299
+ /**
2300
+ * Direct upload — `POST /upload` (multipart). The handler reads `req.body.filename` (not `file_name`).
2301
+ * Multer: `file` field. Path: `filepath` + `filename`.
2302
+ */
2303
+ export declare type UploadParams = UploadMultipartFields & ({
2304
+ filename: string;
2305
+ file_name?: string;
2306
+ } | {
2307
+ file_name: string;
2308
+ filename?: string;
2309
+ });
2310
+
1587
2311
  export declare const VERSION = "1.0.0";
1588
2312
 
1589
2313
  export declare interface WhereCondition {