modal 0.11.1-dev.14 → 0.11.1-dev.16

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
@@ -3138,6 +3138,8 @@ interface ImageListTagsRequest {
3138
3138
  /** Defaults to 100. Values above 100 are rejected by the server. */
3139
3139
  maxObjects: number;
3140
3140
  pageToken: string;
3141
+ /** Returns only the tags that currently point at this image. Optional. */
3142
+ imageId: string;
3141
3143
  }
3142
3144
  declare const ImageListTagsRequest: MessageFns$1<ImageListTagsRequest>;
3143
3145
  interface ImageListTagsResponse {
@@ -3170,6 +3172,11 @@ interface ImageMetadata {
3170
3172
  imageBuilderVersion?: string | undefined;
3171
3173
  }
3172
3174
  declare const ImageMetadata: MessageFns$1<ImageMetadata>;
3175
+ interface ImageNameDeleteRequest {
3176
+ /** Named image reference: "[environment/]name[:tag]". */
3177
+ tag: string;
3178
+ }
3179
+ declare const ImageNameDeleteRequest: MessageFns$1<ImageNameDeleteRequest>;
3173
3180
  interface ImagePublishRequest {
3174
3181
  imageId: string;
3175
3182
  /**
@@ -3320,7 +3327,7 @@ interface MethodDefinition {
3320
3327
  supportedOutputFormats: DataFormat[];
3321
3328
  }
3322
3329
  declare const MethodDefinition: MessageFns$1<MethodDefinition>;
3323
- interface MetricDefinition {
3330
+ interface MetricDefinition$1 {
3324
3331
  /** Exact series name returned by the metrics RPC. */
3325
3332
  name: string;
3326
3333
  /** Matches FunctionMetricSeries.unit. */
@@ -3328,14 +3335,14 @@ interface MetricDefinition {
3328
3335
  /** Meaning and aggregation semantics of the series. */
3329
3336
  description: string;
3330
3337
  }
3331
- declare const MetricDefinition: MessageFns$1<MetricDefinition>;
3338
+ declare const MetricDefinition$1: MessageFns$1<MetricDefinition$1>;
3332
3339
  interface MetricGroupDefinition {
3333
3340
  /** Group selector, such as "calls". Multiple catalogue rows can share this name. */
3334
3341
  name: string;
3335
3342
  /** Shared description of this catalogue row's series. */
3336
3343
  description: string;
3337
3344
  /** Individual series represented by this row, ordered by name; all have the same unit. */
3338
- metrics: MetricDefinition[];
3345
+ metrics: MetricDefinition$1[];
3339
3346
  /** Display label, such as "execution_time_{p50,p90,p99}". */
3340
3347
  displayName: string;
3341
3348
  }
@@ -6610,6 +6617,14 @@ declare const ModalClientDefinition: {
6610
6617
  readonly responseStream: false;
6611
6618
  readonly options: {};
6612
6619
  };
6620
+ readonly imageNameDelete: {
6621
+ readonly name: "ImageNameDelete";
6622
+ readonly requestType: MessageFns$1<ImageNameDeleteRequest>;
6623
+ readonly requestStream: false;
6624
+ readonly responseType: MessageFns$2<Empty>;
6625
+ readonly responseStream: false;
6626
+ readonly options: {};
6627
+ };
6613
6628
  readonly imagePublish: {
6614
6629
  readonly name: "ImagePublish";
6615
6630
  readonly requestType: MessageFns$1<ImagePublishRequest>;
@@ -8186,7 +8201,12 @@ declare class FunctionCall {
8186
8201
  readonly functionCallId: string;
8187
8202
  /** @ignore */
8188
8203
  constructor(client: ModalClient, functionCallId: string, appId: string, functionId: string);
8189
- /** Get the result of a FunctionCall, optionally waiting with a timeout. */
8204
+ /**
8205
+ * Get the result of a FunctionCall, optionally waiting with a timeout.
8206
+ *
8207
+ * @throws {@link TimeoutError} if `timeoutMs` elapses before the Function finishes.
8208
+ * @throws {@link FunctionTimeoutError} if the Function exceeds its execution timeout.
8209
+ */
8190
8210
  get(params?: FunctionCallGetParams): Promise<any>;
8191
8211
  /** Cancel a running FunctionCall. */
8192
8212
  cancel(params?: FunctionCallCancelParams): Promise<void>;
@@ -8204,6 +8224,91 @@ declare class FunctionCall {
8204
8224
  get logs(): FunctionCallLogsManager;
8205
8225
  }
8206
8226
 
8227
+ /** An observation at a UTC-aligned bucket start. */
8228
+ interface TimeSeriesPoint {
8229
+ time: Date;
8230
+ /** Missing observations are null; observed zeroes remain zero. */
8231
+ value: number | null;
8232
+ }
8233
+ /** An individual metric series with points ordered by time. */
8234
+ interface MetricSeries {
8235
+ name: string;
8236
+ unit: string;
8237
+ aggregation: string;
8238
+ description: string;
8239
+ points: TimeSeriesPoint[];
8240
+ }
8241
+ /** The name, unit, and meaning of an exportable series. */
8242
+ interface MetricDefinition {
8243
+ name: string;
8244
+ unit: string;
8245
+ description: string;
8246
+ }
8247
+ /** A metrics group and its individual series definitions. */
8248
+ interface MetricsSchema {
8249
+ name: string;
8250
+ definitions: MetricDefinition[];
8251
+ }
8252
+ /** Exported metrics over the effective, UTC-aligned [since, until) range. */
8253
+ interface ObjectMetrics {
8254
+ objectId: string;
8255
+ since: Date;
8256
+ until: Date;
8257
+ bucketSizeSecs: number;
8258
+ /** Total points across series, including missing observations. */
8259
+ pointCount: number;
8260
+ series: Record<string, MetricSeries>;
8261
+ }
8262
+ /** Options for discovering metric definitions. */
8263
+ interface MetricsSchemaParams {
8264
+ /** Omit or pass an empty array to select all groups. */
8265
+ groups?: string[];
8266
+ }
8267
+ /** Options for exporting Function metric samples. */
8268
+ interface FunctionMetricsExportParams extends MetricsSchemaParams {
8269
+ /** Defaults to one hour before until. */
8270
+ since?: Date;
8271
+ /** Defaults to the current time. */
8272
+ until?: Date;
8273
+ /** Bucket width in whole seconds. */
8274
+ bucketSizeSecs?: number;
8275
+ /** Include the root Function and all its variants. Defaults to false. */
8276
+ allVariants?: boolean;
8277
+ }
8278
+ /** Namespace for Function metric samples and definitions. */
8279
+ declare class FunctionMetricsManager {
8280
+ #private;
8281
+ /** @hidden */
8282
+ constructor(client: ModalClient, functionId: string);
8283
+ /**
8284
+ * Fetch metric samples, defaulting to all groups over the last hour.
8285
+ *
8286
+ * The maximum range is 31 days, with at most 500 points per series. Omit
8287
+ * bucketSizeSecs to let Modal select a supported width targeting approximately
8288
+ * 100 buckets. Bounds round down to UTC bucket boundaries: data before since
8289
+ * may be included, and the partial bucket at until is excluded.
8290
+ * Missing observations have value null. Use schema() to discover definitions.
8291
+ *
8292
+ * @example
8293
+ * ```typescript
8294
+ * const metrics = await fn.metrics.export({
8295
+ * bucketSizeSecs: 5 * 60,
8296
+ * groups: ["calls"],
8297
+ * });
8298
+ * for (const point of metrics.series["successful_calls_count"].points) {
8299
+ * console.log(point.time, point.value);
8300
+ * }
8301
+ * ```
8302
+ */
8303
+ export(params?: FunctionMetricsExportParams): Promise<ObjectMetrics>;
8304
+ /**
8305
+ * Return metric definitions keyed by group name, without fetching samples.
8306
+ * Omit groups to return all groups. Each group's definitions include all its
8307
+ * individual series.
8308
+ */
8309
+ schema(params?: MetricsSchemaParams): Promise<Record<string, MetricsSchema>>;
8310
+ }
8311
+
8207
8312
  type HeartbeatFunction = () => Promise<any>;
8208
8313
  declare class EphemeralHeartbeatManager {
8209
8314
  private readonly heartbeatFn;
@@ -8217,6 +8322,8 @@ declare class EphemeralHeartbeatManager {
8217
8322
  type VolumeFromNameParams = {
8218
8323
  environment?: string;
8219
8324
  createIfMissing?: boolean;
8325
+ /** Experimental VolumeFS version; omit to accept either version. */
8326
+ version?: 1 | 2;
8220
8327
  };
8221
8328
  /** Optional parameters for {@link VolumeService#ephemeral client.volumes.ephemeral()}. */
8222
8329
  type VolumeEphemeralParams = {
@@ -8440,6 +8547,8 @@ declare class Function_ {
8440
8547
  * for CLI access to logs for an App.
8441
8548
  */
8442
8549
  get logs(): FunctionLogsManager;
8550
+ /** Access metric samples with export() and series definitions with schema(). */
8551
+ get metrics(): FunctionMetricsManager;
8443
8552
  /** Override the static Function configuration at runtime. */
8444
8553
  withOptions(options: FunctionWithOptionsParams): Function_;
8445
8554
  /** Override the static Function concurrency configuration at runtime. */
@@ -10813,9 +10922,17 @@ declare class App {
10813
10922
  declare class TimeoutError extends Error {
10814
10923
  constructor(message?: string);
10815
10924
  }
10816
- /** Function execution exceeds the allowed time limit. */
10925
+ /**
10926
+ * Function execution exceeds the allowed time limit.
10927
+ *
10928
+ * {@link FunctionCall#get FunctionCall.get()} throws {@link TimeoutError}
10929
+ * instead when `timeoutMs` elapses before the Function finishes. Matching that
10930
+ * case with `instanceof FunctionTimeoutError` is deprecated and will stop
10931
+ * working in a future release.
10932
+ */
10817
10933
  declare class FunctionTimeoutError extends Error {
10818
10934
  constructor(message: string);
10935
+ static [Symbol.hasInstance](instance: unknown): boolean;
10819
10936
  }
10820
10937
  /** An error on the Modal server, or a Python exception. */
10821
10938
  declare class RemoteError extends Error {
@@ -10904,4 +11021,4 @@ declare class ClientClosedError extends Error {
10904
11021
 
10905
11022
  declare function checkForRenamedParams(params: any, renames: Record<string, string>): void;
10906
11023
 
10907
- export { AlreadyExistsError, App, type AppFromNameParams, type AppInfo, type AppInfoParams, type AppLifecycle, AppService, type AppState, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, Environment, EnvironmentAppsService, type EnvironmentCreateParams, type EnvironmentFromNameParams, EnvironmentObjectsService, EnvironmentService, ExecutionError, ExperimentalOutboundPolicy, type FileInfo, type FileType, type FileWatchEvent, type FileWatchEventType, type FunctionAutoscalerSettings, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, type FunctionCallLogFetchParams, type FunctionCallLogStreamParams, type FunctionCallLogTailParams, FunctionCallLogsManager, FunctionCallService, type FunctionCurrentStats, type FunctionFromNameParams, type FunctionLogFetchParams, type FunctionLogStreamParams, type FunctionLogTailParams, FunctionLogsManager, FunctionService, type FunctionStats, type FunctionStatsParams, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, type FunctionWithBatchingParams, type FunctionWithConcurrencyParams, type FunctionWithOptionsParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, type ImageFromNameParams, type ImagePublishParams, ImageService, InternalFailure, InvalidError, type LogEntry, type FunctionLogFetchParams as LogFetchParams, type LogLevel, type LogSource, type Logger, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, Probe, type ProbeParams, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, ResourceExhaustedError, Retries, Sandbox, type SandboxCreateConnectCredentials, type SandboxCreateConnectTokenParams, type SandboxCreateParams, type SandboxExecParams, type SandboxExperimentalFromNameParams, type SandboxExperimentalFromSnapshotParams, type SandboxExperimentalGetExitSnapshotParams, type SandboxExperimentalListParams, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, type SandboxLogFetchParams, type SandboxLogTailParams, SandboxLogsManager, type SandboxMountImageParams, type SandboxReloadVolumesParams, type SandboxRuntime, SandboxService, SandboxSnapshot, type SandboxSnapshotDirectoryParams, type SandboxSnapshotFilesystemParams, SandboxSnapshotService, type SandboxTerminateParams, SandboxTimeoutError, type SandboxUpdateNetworkPolicyParams, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, SidecarContainer, type SidecarCreateParams, type SidecarExecParams, type SidecarGetParams, type SidecarListParams, type SidecarMountImageParams, SidecarService, type SidecarSnapshotDirectoryParams, type SidecarSnapshotFilesystemParams, type SidecarTerminateParams, type SidecarUnmountImageParams, SnapshotCreationError, type StatsPercentile, type StatsPercentileDistribution, type StdioBehavior, type StreamMode, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptionsParams, VolumeService, checkForRenamedParams };
11024
+ export { AlreadyExistsError, App, type AppFromNameParams, type AppInfo, type AppInfoParams, type AppLifecycle, AppService, type AppState, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, Environment, EnvironmentAppsService, type EnvironmentCreateParams, type EnvironmentFromNameParams, EnvironmentObjectsService, EnvironmentService, ExecutionError, ExperimentalOutboundPolicy, type FileInfo, type FileType, type FileWatchEvent, type FileWatchEventType, type FunctionAutoscalerSettings, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, type FunctionCallLogFetchParams, type FunctionCallLogStreamParams, type FunctionCallLogTailParams, FunctionCallLogsManager, FunctionCallService, type FunctionCurrentStats, type FunctionFromNameParams, type FunctionLogFetchParams, type FunctionLogStreamParams, type FunctionLogTailParams, FunctionLogsManager, type FunctionMetricsExportParams, FunctionMetricsManager, FunctionService, type FunctionStats, type FunctionStatsParams, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, type FunctionWithBatchingParams, type FunctionWithConcurrencyParams, type FunctionWithOptionsParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, type ImageFromNameParams, type ImagePublishParams, ImageService, InternalFailure, InvalidError, type LogEntry, type FunctionLogFetchParams as LogFetchParams, type LogLevel, type LogSource, type Logger, type MetricDefinition, type MetricSeries, type MetricsSchema, type MetricsSchemaParams, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, type ObjectMetrics, Probe, type ProbeParams, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, ResourceExhaustedError, Retries, Sandbox, type SandboxCreateConnectCredentials, type SandboxCreateConnectTokenParams, type SandboxCreateParams, type SandboxExecParams, type SandboxExperimentalFromNameParams, type SandboxExperimentalFromSnapshotParams, type SandboxExperimentalGetExitSnapshotParams, type SandboxExperimentalListParams, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, type SandboxLogFetchParams, type SandboxLogTailParams, SandboxLogsManager, type SandboxMountImageParams, type SandboxReloadVolumesParams, type SandboxRuntime, SandboxService, SandboxSnapshot, type SandboxSnapshotDirectoryParams, type SandboxSnapshotFilesystemParams, SandboxSnapshotService, type SandboxTerminateParams, SandboxTimeoutError, type SandboxUpdateNetworkPolicyParams, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, SidecarContainer, type SidecarCreateParams, type SidecarExecParams, type SidecarGetParams, type SidecarListParams, type SidecarMountImageParams, SidecarService, type SidecarSnapshotDirectoryParams, type SidecarSnapshotFilesystemParams, type SidecarTerminateParams, type SidecarUnmountImageParams, SnapshotCreationError, type StatsPercentile, type StatsPercentileDistribution, type StdioBehavior, type StreamMode, type TimeSeriesPoint, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptionsParams, VolumeService, checkForRenamedParams };
package/dist/index.d.ts CHANGED
@@ -3138,6 +3138,8 @@ interface ImageListTagsRequest {
3138
3138
  /** Defaults to 100. Values above 100 are rejected by the server. */
3139
3139
  maxObjects: number;
3140
3140
  pageToken: string;
3141
+ /** Returns only the tags that currently point at this image. Optional. */
3142
+ imageId: string;
3141
3143
  }
3142
3144
  declare const ImageListTagsRequest: MessageFns$1<ImageListTagsRequest>;
3143
3145
  interface ImageListTagsResponse {
@@ -3170,6 +3172,11 @@ interface ImageMetadata {
3170
3172
  imageBuilderVersion?: string | undefined;
3171
3173
  }
3172
3174
  declare const ImageMetadata: MessageFns$1<ImageMetadata>;
3175
+ interface ImageNameDeleteRequest {
3176
+ /** Named image reference: "[environment/]name[:tag]". */
3177
+ tag: string;
3178
+ }
3179
+ declare const ImageNameDeleteRequest: MessageFns$1<ImageNameDeleteRequest>;
3173
3180
  interface ImagePublishRequest {
3174
3181
  imageId: string;
3175
3182
  /**
@@ -3320,7 +3327,7 @@ interface MethodDefinition {
3320
3327
  supportedOutputFormats: DataFormat[];
3321
3328
  }
3322
3329
  declare const MethodDefinition: MessageFns$1<MethodDefinition>;
3323
- interface MetricDefinition {
3330
+ interface MetricDefinition$1 {
3324
3331
  /** Exact series name returned by the metrics RPC. */
3325
3332
  name: string;
3326
3333
  /** Matches FunctionMetricSeries.unit. */
@@ -3328,14 +3335,14 @@ interface MetricDefinition {
3328
3335
  /** Meaning and aggregation semantics of the series. */
3329
3336
  description: string;
3330
3337
  }
3331
- declare const MetricDefinition: MessageFns$1<MetricDefinition>;
3338
+ declare const MetricDefinition$1: MessageFns$1<MetricDefinition$1>;
3332
3339
  interface MetricGroupDefinition {
3333
3340
  /** Group selector, such as "calls". Multiple catalogue rows can share this name. */
3334
3341
  name: string;
3335
3342
  /** Shared description of this catalogue row's series. */
3336
3343
  description: string;
3337
3344
  /** Individual series represented by this row, ordered by name; all have the same unit. */
3338
- metrics: MetricDefinition[];
3345
+ metrics: MetricDefinition$1[];
3339
3346
  /** Display label, such as "execution_time_{p50,p90,p99}". */
3340
3347
  displayName: string;
3341
3348
  }
@@ -6610,6 +6617,14 @@ declare const ModalClientDefinition: {
6610
6617
  readonly responseStream: false;
6611
6618
  readonly options: {};
6612
6619
  };
6620
+ readonly imageNameDelete: {
6621
+ readonly name: "ImageNameDelete";
6622
+ readonly requestType: MessageFns$1<ImageNameDeleteRequest>;
6623
+ readonly requestStream: false;
6624
+ readonly responseType: MessageFns$2<Empty>;
6625
+ readonly responseStream: false;
6626
+ readonly options: {};
6627
+ };
6613
6628
  readonly imagePublish: {
6614
6629
  readonly name: "ImagePublish";
6615
6630
  readonly requestType: MessageFns$1<ImagePublishRequest>;
@@ -8186,7 +8201,12 @@ declare class FunctionCall {
8186
8201
  readonly functionCallId: string;
8187
8202
  /** @ignore */
8188
8203
  constructor(client: ModalClient, functionCallId: string, appId: string, functionId: string);
8189
- /** Get the result of a FunctionCall, optionally waiting with a timeout. */
8204
+ /**
8205
+ * Get the result of a FunctionCall, optionally waiting with a timeout.
8206
+ *
8207
+ * @throws {@link TimeoutError} if `timeoutMs` elapses before the Function finishes.
8208
+ * @throws {@link FunctionTimeoutError} if the Function exceeds its execution timeout.
8209
+ */
8190
8210
  get(params?: FunctionCallGetParams): Promise<any>;
8191
8211
  /** Cancel a running FunctionCall. */
8192
8212
  cancel(params?: FunctionCallCancelParams): Promise<void>;
@@ -8204,6 +8224,91 @@ declare class FunctionCall {
8204
8224
  get logs(): FunctionCallLogsManager;
8205
8225
  }
8206
8226
 
8227
+ /** An observation at a UTC-aligned bucket start. */
8228
+ interface TimeSeriesPoint {
8229
+ time: Date;
8230
+ /** Missing observations are null; observed zeroes remain zero. */
8231
+ value: number | null;
8232
+ }
8233
+ /** An individual metric series with points ordered by time. */
8234
+ interface MetricSeries {
8235
+ name: string;
8236
+ unit: string;
8237
+ aggregation: string;
8238
+ description: string;
8239
+ points: TimeSeriesPoint[];
8240
+ }
8241
+ /** The name, unit, and meaning of an exportable series. */
8242
+ interface MetricDefinition {
8243
+ name: string;
8244
+ unit: string;
8245
+ description: string;
8246
+ }
8247
+ /** A metrics group and its individual series definitions. */
8248
+ interface MetricsSchema {
8249
+ name: string;
8250
+ definitions: MetricDefinition[];
8251
+ }
8252
+ /** Exported metrics over the effective, UTC-aligned [since, until) range. */
8253
+ interface ObjectMetrics {
8254
+ objectId: string;
8255
+ since: Date;
8256
+ until: Date;
8257
+ bucketSizeSecs: number;
8258
+ /** Total points across series, including missing observations. */
8259
+ pointCount: number;
8260
+ series: Record<string, MetricSeries>;
8261
+ }
8262
+ /** Options for discovering metric definitions. */
8263
+ interface MetricsSchemaParams {
8264
+ /** Omit or pass an empty array to select all groups. */
8265
+ groups?: string[];
8266
+ }
8267
+ /** Options for exporting Function metric samples. */
8268
+ interface FunctionMetricsExportParams extends MetricsSchemaParams {
8269
+ /** Defaults to one hour before until. */
8270
+ since?: Date;
8271
+ /** Defaults to the current time. */
8272
+ until?: Date;
8273
+ /** Bucket width in whole seconds. */
8274
+ bucketSizeSecs?: number;
8275
+ /** Include the root Function and all its variants. Defaults to false. */
8276
+ allVariants?: boolean;
8277
+ }
8278
+ /** Namespace for Function metric samples and definitions. */
8279
+ declare class FunctionMetricsManager {
8280
+ #private;
8281
+ /** @hidden */
8282
+ constructor(client: ModalClient, functionId: string);
8283
+ /**
8284
+ * Fetch metric samples, defaulting to all groups over the last hour.
8285
+ *
8286
+ * The maximum range is 31 days, with at most 500 points per series. Omit
8287
+ * bucketSizeSecs to let Modal select a supported width targeting approximately
8288
+ * 100 buckets. Bounds round down to UTC bucket boundaries: data before since
8289
+ * may be included, and the partial bucket at until is excluded.
8290
+ * Missing observations have value null. Use schema() to discover definitions.
8291
+ *
8292
+ * @example
8293
+ * ```typescript
8294
+ * const metrics = await fn.metrics.export({
8295
+ * bucketSizeSecs: 5 * 60,
8296
+ * groups: ["calls"],
8297
+ * });
8298
+ * for (const point of metrics.series["successful_calls_count"].points) {
8299
+ * console.log(point.time, point.value);
8300
+ * }
8301
+ * ```
8302
+ */
8303
+ export(params?: FunctionMetricsExportParams): Promise<ObjectMetrics>;
8304
+ /**
8305
+ * Return metric definitions keyed by group name, without fetching samples.
8306
+ * Omit groups to return all groups. Each group's definitions include all its
8307
+ * individual series.
8308
+ */
8309
+ schema(params?: MetricsSchemaParams): Promise<Record<string, MetricsSchema>>;
8310
+ }
8311
+
8207
8312
  type HeartbeatFunction = () => Promise<any>;
8208
8313
  declare class EphemeralHeartbeatManager {
8209
8314
  private readonly heartbeatFn;
@@ -8217,6 +8322,8 @@ declare class EphemeralHeartbeatManager {
8217
8322
  type VolumeFromNameParams = {
8218
8323
  environment?: string;
8219
8324
  createIfMissing?: boolean;
8325
+ /** Experimental VolumeFS version; omit to accept either version. */
8326
+ version?: 1 | 2;
8220
8327
  };
8221
8328
  /** Optional parameters for {@link VolumeService#ephemeral client.volumes.ephemeral()}. */
8222
8329
  type VolumeEphemeralParams = {
@@ -8440,6 +8547,8 @@ declare class Function_ {
8440
8547
  * for CLI access to logs for an App.
8441
8548
  */
8442
8549
  get logs(): FunctionLogsManager;
8550
+ /** Access metric samples with export() and series definitions with schema(). */
8551
+ get metrics(): FunctionMetricsManager;
8443
8552
  /** Override the static Function configuration at runtime. */
8444
8553
  withOptions(options: FunctionWithOptionsParams): Function_;
8445
8554
  /** Override the static Function concurrency configuration at runtime. */
@@ -10813,9 +10922,17 @@ declare class App {
10813
10922
  declare class TimeoutError extends Error {
10814
10923
  constructor(message?: string);
10815
10924
  }
10816
- /** Function execution exceeds the allowed time limit. */
10925
+ /**
10926
+ * Function execution exceeds the allowed time limit.
10927
+ *
10928
+ * {@link FunctionCall#get FunctionCall.get()} throws {@link TimeoutError}
10929
+ * instead when `timeoutMs` elapses before the Function finishes. Matching that
10930
+ * case with `instanceof FunctionTimeoutError` is deprecated and will stop
10931
+ * working in a future release.
10932
+ */
10817
10933
  declare class FunctionTimeoutError extends Error {
10818
10934
  constructor(message: string);
10935
+ static [Symbol.hasInstance](instance: unknown): boolean;
10819
10936
  }
10820
10937
  /** An error on the Modal server, or a Python exception. */
10821
10938
  declare class RemoteError extends Error {
@@ -10904,4 +11021,4 @@ declare class ClientClosedError extends Error {
10904
11021
 
10905
11022
  declare function checkForRenamedParams(params: any, renames: Record<string, string>): void;
10906
11023
 
10907
- export { AlreadyExistsError, App, type AppFromNameParams, type AppInfo, type AppInfoParams, type AppLifecycle, AppService, type AppState, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, Environment, EnvironmentAppsService, type EnvironmentCreateParams, type EnvironmentFromNameParams, EnvironmentObjectsService, EnvironmentService, ExecutionError, ExperimentalOutboundPolicy, type FileInfo, type FileType, type FileWatchEvent, type FileWatchEventType, type FunctionAutoscalerSettings, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, type FunctionCallLogFetchParams, type FunctionCallLogStreamParams, type FunctionCallLogTailParams, FunctionCallLogsManager, FunctionCallService, type FunctionCurrentStats, type FunctionFromNameParams, type FunctionLogFetchParams, type FunctionLogStreamParams, type FunctionLogTailParams, FunctionLogsManager, FunctionService, type FunctionStats, type FunctionStatsParams, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, type FunctionWithBatchingParams, type FunctionWithConcurrencyParams, type FunctionWithOptionsParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, type ImageFromNameParams, type ImagePublishParams, ImageService, InternalFailure, InvalidError, type LogEntry, type FunctionLogFetchParams as LogFetchParams, type LogLevel, type LogSource, type Logger, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, Probe, type ProbeParams, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, ResourceExhaustedError, Retries, Sandbox, type SandboxCreateConnectCredentials, type SandboxCreateConnectTokenParams, type SandboxCreateParams, type SandboxExecParams, type SandboxExperimentalFromNameParams, type SandboxExperimentalFromSnapshotParams, type SandboxExperimentalGetExitSnapshotParams, type SandboxExperimentalListParams, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, type SandboxLogFetchParams, type SandboxLogTailParams, SandboxLogsManager, type SandboxMountImageParams, type SandboxReloadVolumesParams, type SandboxRuntime, SandboxService, SandboxSnapshot, type SandboxSnapshotDirectoryParams, type SandboxSnapshotFilesystemParams, SandboxSnapshotService, type SandboxTerminateParams, SandboxTimeoutError, type SandboxUpdateNetworkPolicyParams, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, SidecarContainer, type SidecarCreateParams, type SidecarExecParams, type SidecarGetParams, type SidecarListParams, type SidecarMountImageParams, SidecarService, type SidecarSnapshotDirectoryParams, type SidecarSnapshotFilesystemParams, type SidecarTerminateParams, type SidecarUnmountImageParams, SnapshotCreationError, type StatsPercentile, type StatsPercentileDistribution, type StdioBehavior, type StreamMode, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptionsParams, VolumeService, checkForRenamedParams };
11024
+ export { AlreadyExistsError, App, type AppFromNameParams, type AppInfo, type AppInfoParams, type AppLifecycle, AppService, type AppState, ClientClosedError, CloudBucketMount, CloudBucketMountService, Cls, type ClsFromNameParams, ClsInstance, ClsService, type ClsWithBatchingParams, type ClsWithConcurrencyParams, type ClsWithOptionsParams, ConflictError, ContainerProcess, Environment, EnvironmentAppsService, type EnvironmentCreateParams, type EnvironmentFromNameParams, EnvironmentObjectsService, EnvironmentService, ExecutionError, ExperimentalOutboundPolicy, type FileInfo, type FileType, type FileWatchEvent, type FileWatchEventType, type FunctionAutoscalerSettings, FunctionCall, type FunctionCallCancelParams, type FunctionCallGetParams, type FunctionCallLogFetchParams, type FunctionCallLogStreamParams, type FunctionCallLogTailParams, FunctionCallLogsManager, FunctionCallService, type FunctionCurrentStats, type FunctionFromNameParams, type FunctionLogFetchParams, type FunctionLogStreamParams, type FunctionLogTailParams, FunctionLogsManager, type FunctionMetricsExportParams, FunctionMetricsManager, FunctionService, type FunctionStats, type FunctionStatsParams, FunctionTimeoutError, type FunctionUpdateAutoscalerParams, type FunctionWithBatchingParams, type FunctionWithConcurrencyParams, type FunctionWithOptionsParams, Function_, Image, type ImageDeleteParams, type ImageDockerfileCommandsParams, type ImageFromNameParams, type ImagePublishParams, ImageService, InternalFailure, InvalidError, type LogEntry, type FunctionLogFetchParams as LogFetchParams, type LogLevel, type LogSource, type Logger, type MetricDefinition, type MetricSeries, type MetricsSchema, type MetricsSchemaParams, ModalClient, type ModalClientParams, type ModalReadStream, type ModalWriteStream, NotFoundError, type ObjectMetrics, Probe, type ProbeParams, type Profile, Proxy, type ProxyFromNameParams, ProxyService, Queue, type QueueClearParams, type QueueDeleteParams, QueueEmptyError, type QueueEphemeralParams, type QueueFromNameParams, QueueFullError, type QueueGetParams, type QueueIterateParams, type QueueLenParams, type QueuePutParams, QueueService, RemoteError, ResourceExhaustedError, Retries, Sandbox, type SandboxCreateConnectCredentials, type SandboxCreateConnectTokenParams, type SandboxCreateParams, type SandboxExecParams, type SandboxExperimentalFromNameParams, type SandboxExperimentalFromSnapshotParams, type SandboxExperimentalGetExitSnapshotParams, type SandboxExperimentalListParams, SandboxFilesystem, SandboxFilesystemDirectoryNotEmptyError, SandboxFilesystemError, SandboxFilesystemFileTooLargeError, SandboxFilesystemIsADirectoryError, SandboxFilesystemNotADirectoryError, SandboxFilesystemNotFoundError, SandboxFilesystemPathAlreadyExistsError, SandboxFilesystemPermissionError, type SandboxFromNameParams, type SandboxListParams, type SandboxLogFetchParams, type SandboxLogTailParams, SandboxLogsManager, type SandboxMountImageParams, type SandboxReloadVolumesParams, type SandboxRuntime, SandboxService, SandboxSnapshot, type SandboxSnapshotDirectoryParams, type SandboxSnapshotFilesystemParams, SandboxSnapshotService, type SandboxTerminateParams, SandboxTimeoutError, type SandboxUpdateNetworkPolicyParams, Secret, type SecretDeleteParams, type SecretFromNameParams, type SecretFromObjectParams, SecretService, SidecarContainer, type SidecarCreateParams, type SidecarExecParams, type SidecarGetParams, type SidecarListParams, type SidecarMountImageParams, SidecarService, type SidecarSnapshotDirectoryParams, type SidecarSnapshotFilesystemParams, type SidecarTerminateParams, type SidecarUnmountImageParams, SnapshotCreationError, type StatsPercentile, type StatsPercentileDistribution, type StdioBehavior, type StreamMode, type TimeSeriesPoint, TimeoutError, Tunnel, Volume, type VolumeDeleteParams, type VolumeEphemeralParams, type VolumeFromNameParams, type VolumeMountOptionsParams, VolumeService, checkForRenamedParams };