@gigadrive/sdk 0.4.0 → 0.6.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/README.md CHANGED
@@ -69,6 +69,29 @@ variables (constructor values take precedence):
69
69
  const client = new GigadriveClient({ bearerToken: 'eyJ...', fetch: myFetch });
70
70
  ```
71
71
 
72
+ ## Sticky sessions
73
+
74
+ Deployed MicroVM functions can mint a routing URL that keeps the same opaque
75
+ application key on one function instance. Workload credentials are injected by
76
+ the platform, so no SDK configuration is required inside a deployment:
77
+
78
+ ```ts
79
+ import { GigadriveClient } from '@gigadrive/sdk';
80
+
81
+ const gigadrive = new GigadriveClient();
82
+ const { url, expiresAt } = await gigadrive.stickySessions.createUrl({
83
+ key: gameId,
84
+ endpoint: '/socket',
85
+ expiresInSeconds: 14_400,
86
+ });
87
+
88
+ const socket = new WebSocket(url);
89
+ ```
90
+
91
+ The URL is routing authority, not user authentication. Applications still own
92
+ authorization and room membership. State remains in one MicroVM's memory, URLs
93
+ expire, and deploys do not migrate that in-memory state to a new version.
94
+
72
95
  ## File uploads
73
96
 
74
97
  The high-level `upload()` computes the required SHA-256 checksum, infers the
package/dist/index.d.mts CHANGED
@@ -2202,6 +2202,44 @@ interface Application {
2202
2202
  /** ISO 8601 last-updated timestamp. */
2203
2203
  updatedAt: string;
2204
2204
  }
2205
+ /** Input accepted when creating a Gigadrive Network application. */
2206
+ interface CreateApplicationInput {
2207
+ /** Organization that will own the application. */
2208
+ organizationId: string;
2209
+ /** Display name. Surrounding whitespace is removed by the API. */
2210
+ name: string;
2211
+ /** Optional lowercase slug. Generated from {@link name} when omitted. */
2212
+ slug?: string;
2213
+ /**
2214
+ * Project directory relative to the repository root. The API normalizes
2215
+ * redundant separators and rejects absolute paths and traversal segments.
2216
+ */
2217
+ rootDirectory?: string;
2218
+ }
2219
+ /**
2220
+ * Application creation result used to start the first deployment without an
2221
+ * additional lookup.
2222
+ */
2223
+ interface CreatedApplication {
2224
+ /** Stable application UUID. */
2225
+ id: string;
2226
+ /** Owning organization UUID. */
2227
+ organizationId: string;
2228
+ /** Normalized display name. */
2229
+ name: string;
2230
+ /** Generated or caller-supplied application slug. */
2231
+ slug: string;
2232
+ /** Application icon URL. */
2233
+ imageUrl: string;
2234
+ /** Normalized project directory, or `null` for the repository root. */
2235
+ rootDirectory: string | null;
2236
+ /** Production environment slug to use for the first deployment. */
2237
+ defaultEnvironmentSlug: string;
2238
+ /** ISO 8601 creation timestamp. */
2239
+ createdAt: string;
2240
+ /** ISO 8601 last-updated timestamp. */
2241
+ updatedAt: string;
2242
+ }
2205
2243
  /** Query filters for listing applications. */
2206
2244
  interface ListApplicationsQuery extends ListQuery {
2207
2245
  /** Only return applications belonging to this organization. */
@@ -2273,6 +2311,27 @@ declare class ApplicationsResource extends BaseResource {
2273
2311
  * ```
2274
2312
  */
2275
2313
  list(query?: ListApplicationsQuery): Promise<Paginated<Application>>;
2314
+ /**
2315
+ * Creates an application with production and preview environments.
2316
+ *
2317
+ * Requires the `network:applications:write` scope and access to the owning
2318
+ * organization. Application-, deployment-, and function-scoped tokens cannot
2319
+ * create applications.
2320
+ *
2321
+ * @param input - Ownership, display name, and optional repository layout.
2322
+ * @returns The persisted application plus the default production environment
2323
+ * slug, ready for an immediate deployment request.
2324
+ *
2325
+ * @example
2326
+ * ```ts
2327
+ * const app = await client.applications.create({
2328
+ * organizationId: 'org-id',
2329
+ * name: 'Next.js Storefront',
2330
+ * });
2331
+ * console.log(app.id, app.defaultEnvironmentSlug);
2332
+ * ```
2333
+ */
2334
+ create(input: CreateApplicationInput): Promise<CreatedApplication>;
2276
2335
  /**
2277
2336
  * List the `*.gigadrive.app` hostnames for an application (production alias
2278
2337
  * and per-branch aliases).
@@ -2615,6 +2674,40 @@ declare class DeploymentsResource extends BaseResource {
2615
2674
  getHostnames(deploymentId: string): Promise<Paginated<Hostname>>;
2616
2675
  }
2617
2676
 
2677
+ /** Input for minting a routing-only sticky session URL. */
2678
+ interface CreateStickySessionUrlInput {
2679
+ /** Opaque application key shared by callers that must reach the same instance. */
2680
+ key: string;
2681
+ /** Relative deployment route, including any application query parameters. */
2682
+ endpoint: string;
2683
+ /** HTTP method used to resolve the target route. Defaults to `GET`. */
2684
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'PATCH';
2685
+ /** URL lifetime in seconds. Defaults to four hours; accepted range is 60–86,400. */
2686
+ expiresInSeconds?: number;
2687
+ }
2688
+ /** A signed sticky URL and its absolute ISO 8601 expiration time. */
2689
+ interface CreateStickySessionUrlResult {
2690
+ url: string;
2691
+ expiresAt: string;
2692
+ }
2693
+ /**
2694
+ * Creates protocol-independent sticky routing URLs for MicroVM functions.
2695
+ *
2696
+ * The URL selects an instance but does not authenticate an application user or
2697
+ * store application state. Reusing the same key and unexpired URL keeps HTTP,
2698
+ * streaming, and WebSocket traffic on the same function instance.
2699
+ */
2700
+ declare class StickySessionsResource extends BaseResource {
2701
+ /**
2702
+ * Mints a signed URL for an opaque application key.
2703
+ *
2704
+ * Deployed Gigadrive workloads can call this with a zero-config
2705
+ * `GigadriveClient`; the platform injects `GIGADRIVE_CLIENT_ID` and
2706
+ * `GIGADRIVE_CLIENT_SECRET` using the SDK's existing credential chain.
2707
+ */
2708
+ createUrl(input: CreateStickySessionUrlInput): Promise<CreateStickySessionUrlResult>;
2709
+ }
2710
+
2618
2711
  /**
2619
2712
  * Configuration for the {@link GigadriveClient}.
2620
2713
  *
@@ -2765,6 +2858,8 @@ declare class GigadriveClient {
2765
2858
  readonly aiGateway: AiGatewayResource;
2766
2859
  /** Application-scoped API key management (create, list, revoke). */
2767
2860
  readonly apiKeys: ApiKeysResource;
2861
+ /** Signed URLs that keep related requests on one MicroVM instance. */
2862
+ readonly stickySessions: StickySessionsResource;
2768
2863
  constructor(config?: GigadriveClientConfig);
2769
2864
  }
2770
2865
 
@@ -2903,4 +2998,4 @@ declare function paginate<T>(fetchPage: (cursor: string | undefined) => Promise<
2903
2998
  */
2904
2999
  declare function parseSSEStream<T = unknown>(response: Response): AsyncGenerator<T>;
2905
3000
 
2906
- export { AiGatewayAudioResource, type AiGatewayBudget, type AiGatewayBudgetInput, AiGatewayBudgetsResource, AiGatewayPoliciesResource, type AiGatewayPolicy, type AiGatewayPolicyInput, type AiGatewayProviderAttempt, type AiGatewayRequestEvent, type AiGatewayRequestsQuery, AiGatewayResource, type AiGatewayUsageBreakdown, type AiGatewayUsageQuery, AiGatewayUsageResource, type AiGatewayUsageSummary, AiGatewayVideosResource, type AiModel, type AiModelCapabilities, type AiModelRoutingProvider, ApiError, type ApiKey, ApiKeysResource, type Application, ApplicationEnvVarsResource, type ApplicationHostnameList, ApplicationRequestsResource, ApplicationStorageResource, ApplicationsResource, AuthenticationError, type ChatCompletionChoice, type ChatCompletionChunk, type ChatCompletionContentPart, type ChatCompletionMessage, type ChatCompletionRequest, type ChatCompletionResponse, type ChatCompletionUsage, type CreateApiKeyInput, type CreateApiKeyResult, type CreateDeploymentInput, type CreateEnvVarInput, type CreateOrganizationInput, type CreateStorageBucketInput, type CreateUploadSessionInput, type CreateUploadSessionResponse, type Deployment, type DeploymentLog, type DeploymentLogPage, type DeploymentLogType, type DeploymentStatus, DeploymentsResource, type EnvVar, type GatewayRequestOptions, type GatewayResult, GigadriveClient, type GigadriveClientConfig, GigadriveError, type Hostname, type HostnameAvailability, type ListApiKeysQuery, type ListApplicationsQuery, type ListDeploymentLogsQuery, type ListDeploymentsQuery, type ListQuery, type ListRequestsQuery, type ListStorageObjectsQuery, type NetworkRequest, type NetworkRequestApplicationRef, type NetworkRequestAssetRef, type NetworkRequestBucketRef, type NetworkRequestDeploymentRef, type NetworkRequestDetails, type NetworkRequestFunctionRef, type NetworkRequestMetrics, type NetworkRequestObjectRef, type NetworkRequestSummary, type NetworkResponseDetails, type NodeReadableLike, type Organization, OrganizationAiGatewayResource, OrganizationEnvVarsResource, type OrganizationMember, OrganizationMembersResource, type OrganizationMembershipRole, type OrganizationProductAccess, type OrganizationProductEntitlement, type OrganizationProductEntitlementCheck, type OrganizationProductSubscription, OrganizationProductsResource, OrganizationsResource, type Paginated, type PresignedUrlResult, type ProductAccessMode, type ProductAccessResolutionSource, type ProductDefaultAccessPolicy, type ProductDefinition, type ProductEntitlementStatus, type ProductPlan, type ProductSubscriptionStatus, type ProviderRouting, type PullEnvVarsQuery, type PullEnvVarsResult, type QueryValue, type ResolvedEnvVar, type ResponsesRequest, type ResponsesResponse, type RunUploadOptions, type SetProductionHostnameResult, type SpeechRequest, type StartUploadResult, type StorageBucket, StorageBucketsResource, type StorageObject, type StorageObjectAccess, type StorageObjectList, StorageObjectsResource, type StorageUploadSession, StorageUploadSessionsResource, type TranscriptionRequest, type TranscriptionResponse, type UpdateEnvVarInput, type UploadBatchItemResult, type UploadBatchOptions, type UploadByteSource, type UploadData, UploadError, type UploadFileInput, type UploadFileResult, type UploadPart, UploadSessionExpiredError, type UploadUrlStorage, type VideoGenerationRequest, type VideoGenerationResponse, type VideoModelList, type WaitForCompletionOptions, paginate, parseSSEStream };
3001
+ export { AiGatewayAudioResource, type AiGatewayBudget, type AiGatewayBudgetInput, AiGatewayBudgetsResource, AiGatewayPoliciesResource, type AiGatewayPolicy, type AiGatewayPolicyInput, type AiGatewayProviderAttempt, type AiGatewayRequestEvent, type AiGatewayRequestsQuery, AiGatewayResource, type AiGatewayUsageBreakdown, type AiGatewayUsageQuery, AiGatewayUsageResource, type AiGatewayUsageSummary, AiGatewayVideosResource, type AiModel, type AiModelCapabilities, type AiModelRoutingProvider, ApiError, type ApiKey, ApiKeysResource, type Application, ApplicationEnvVarsResource, type ApplicationHostnameList, ApplicationRequestsResource, ApplicationStorageResource, ApplicationsResource, AuthenticationError, type ChatCompletionChoice, type ChatCompletionChunk, type ChatCompletionContentPart, type ChatCompletionMessage, type ChatCompletionRequest, type ChatCompletionResponse, type ChatCompletionUsage, type CreateApiKeyInput, type CreateApiKeyResult, type CreateDeploymentInput, type CreateEnvVarInput, type CreateOrganizationInput, type CreateStickySessionUrlInput, type CreateStickySessionUrlResult, type CreateStorageBucketInput, type CreateUploadSessionInput, type CreateUploadSessionResponse, type Deployment, type DeploymentLog, type DeploymentLogPage, type DeploymentLogType, type DeploymentStatus, DeploymentsResource, type EnvVar, type GatewayRequestOptions, type GatewayResult, GigadriveClient, type GigadriveClientConfig, GigadriveError, type Hostname, type HostnameAvailability, type ListApiKeysQuery, type ListApplicationsQuery, type ListDeploymentLogsQuery, type ListDeploymentsQuery, type ListQuery, type ListRequestsQuery, type ListStorageObjectsQuery, type NetworkRequest, type NetworkRequestApplicationRef, type NetworkRequestAssetRef, type NetworkRequestBucketRef, type NetworkRequestDeploymentRef, type NetworkRequestDetails, type NetworkRequestFunctionRef, type NetworkRequestMetrics, type NetworkRequestObjectRef, type NetworkRequestSummary, type NetworkResponseDetails, type NodeReadableLike, type Organization, OrganizationAiGatewayResource, OrganizationEnvVarsResource, type OrganizationMember, OrganizationMembersResource, type OrganizationMembershipRole, type OrganizationProductAccess, type OrganizationProductEntitlement, type OrganizationProductEntitlementCheck, type OrganizationProductSubscription, OrganizationProductsResource, OrganizationsResource, type Paginated, type PresignedUrlResult, type ProductAccessMode, type ProductAccessResolutionSource, type ProductDefaultAccessPolicy, type ProductDefinition, type ProductEntitlementStatus, type ProductPlan, type ProductSubscriptionStatus, type ProviderRouting, type PullEnvVarsQuery, type PullEnvVarsResult, type QueryValue, type ResolvedEnvVar, type ResponsesRequest, type ResponsesResponse, type RunUploadOptions, type SetProductionHostnameResult, type SpeechRequest, type StartUploadResult, StickySessionsResource, type StorageBucket, StorageBucketsResource, type StorageObject, type StorageObjectAccess, type StorageObjectList, StorageObjectsResource, type StorageUploadSession, StorageUploadSessionsResource, type TranscriptionRequest, type TranscriptionResponse, type UpdateEnvVarInput, type UploadBatchItemResult, type UploadBatchOptions, type UploadByteSource, type UploadData, UploadError, type UploadFileInput, type UploadFileResult, type UploadPart, UploadSessionExpiredError, type UploadUrlStorage, type VideoGenerationRequest, type VideoGenerationResponse, type VideoModelList, type WaitForCompletionOptions, paginate, parseSSEStream };
package/dist/index.d.ts CHANGED
@@ -2202,6 +2202,44 @@ interface Application {
2202
2202
  /** ISO 8601 last-updated timestamp. */
2203
2203
  updatedAt: string;
2204
2204
  }
2205
+ /** Input accepted when creating a Gigadrive Network application. */
2206
+ interface CreateApplicationInput {
2207
+ /** Organization that will own the application. */
2208
+ organizationId: string;
2209
+ /** Display name. Surrounding whitespace is removed by the API. */
2210
+ name: string;
2211
+ /** Optional lowercase slug. Generated from {@link name} when omitted. */
2212
+ slug?: string;
2213
+ /**
2214
+ * Project directory relative to the repository root. The API normalizes
2215
+ * redundant separators and rejects absolute paths and traversal segments.
2216
+ */
2217
+ rootDirectory?: string;
2218
+ }
2219
+ /**
2220
+ * Application creation result used to start the first deployment without an
2221
+ * additional lookup.
2222
+ */
2223
+ interface CreatedApplication {
2224
+ /** Stable application UUID. */
2225
+ id: string;
2226
+ /** Owning organization UUID. */
2227
+ organizationId: string;
2228
+ /** Normalized display name. */
2229
+ name: string;
2230
+ /** Generated or caller-supplied application slug. */
2231
+ slug: string;
2232
+ /** Application icon URL. */
2233
+ imageUrl: string;
2234
+ /** Normalized project directory, or `null` for the repository root. */
2235
+ rootDirectory: string | null;
2236
+ /** Production environment slug to use for the first deployment. */
2237
+ defaultEnvironmentSlug: string;
2238
+ /** ISO 8601 creation timestamp. */
2239
+ createdAt: string;
2240
+ /** ISO 8601 last-updated timestamp. */
2241
+ updatedAt: string;
2242
+ }
2205
2243
  /** Query filters for listing applications. */
2206
2244
  interface ListApplicationsQuery extends ListQuery {
2207
2245
  /** Only return applications belonging to this organization. */
@@ -2273,6 +2311,27 @@ declare class ApplicationsResource extends BaseResource {
2273
2311
  * ```
2274
2312
  */
2275
2313
  list(query?: ListApplicationsQuery): Promise<Paginated<Application>>;
2314
+ /**
2315
+ * Creates an application with production and preview environments.
2316
+ *
2317
+ * Requires the `network:applications:write` scope and access to the owning
2318
+ * organization. Application-, deployment-, and function-scoped tokens cannot
2319
+ * create applications.
2320
+ *
2321
+ * @param input - Ownership, display name, and optional repository layout.
2322
+ * @returns The persisted application plus the default production environment
2323
+ * slug, ready for an immediate deployment request.
2324
+ *
2325
+ * @example
2326
+ * ```ts
2327
+ * const app = await client.applications.create({
2328
+ * organizationId: 'org-id',
2329
+ * name: 'Next.js Storefront',
2330
+ * });
2331
+ * console.log(app.id, app.defaultEnvironmentSlug);
2332
+ * ```
2333
+ */
2334
+ create(input: CreateApplicationInput): Promise<CreatedApplication>;
2276
2335
  /**
2277
2336
  * List the `*.gigadrive.app` hostnames for an application (production alias
2278
2337
  * and per-branch aliases).
@@ -2615,6 +2674,40 @@ declare class DeploymentsResource extends BaseResource {
2615
2674
  getHostnames(deploymentId: string): Promise<Paginated<Hostname>>;
2616
2675
  }
2617
2676
 
2677
+ /** Input for minting a routing-only sticky session URL. */
2678
+ interface CreateStickySessionUrlInput {
2679
+ /** Opaque application key shared by callers that must reach the same instance. */
2680
+ key: string;
2681
+ /** Relative deployment route, including any application query parameters. */
2682
+ endpoint: string;
2683
+ /** HTTP method used to resolve the target route. Defaults to `GET`. */
2684
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'PATCH';
2685
+ /** URL lifetime in seconds. Defaults to four hours; accepted range is 60–86,400. */
2686
+ expiresInSeconds?: number;
2687
+ }
2688
+ /** A signed sticky URL and its absolute ISO 8601 expiration time. */
2689
+ interface CreateStickySessionUrlResult {
2690
+ url: string;
2691
+ expiresAt: string;
2692
+ }
2693
+ /**
2694
+ * Creates protocol-independent sticky routing URLs for MicroVM functions.
2695
+ *
2696
+ * The URL selects an instance but does not authenticate an application user or
2697
+ * store application state. Reusing the same key and unexpired URL keeps HTTP,
2698
+ * streaming, and WebSocket traffic on the same function instance.
2699
+ */
2700
+ declare class StickySessionsResource extends BaseResource {
2701
+ /**
2702
+ * Mints a signed URL for an opaque application key.
2703
+ *
2704
+ * Deployed Gigadrive workloads can call this with a zero-config
2705
+ * `GigadriveClient`; the platform injects `GIGADRIVE_CLIENT_ID` and
2706
+ * `GIGADRIVE_CLIENT_SECRET` using the SDK's existing credential chain.
2707
+ */
2708
+ createUrl(input: CreateStickySessionUrlInput): Promise<CreateStickySessionUrlResult>;
2709
+ }
2710
+
2618
2711
  /**
2619
2712
  * Configuration for the {@link GigadriveClient}.
2620
2713
  *
@@ -2765,6 +2858,8 @@ declare class GigadriveClient {
2765
2858
  readonly aiGateway: AiGatewayResource;
2766
2859
  /** Application-scoped API key management (create, list, revoke). */
2767
2860
  readonly apiKeys: ApiKeysResource;
2861
+ /** Signed URLs that keep related requests on one MicroVM instance. */
2862
+ readonly stickySessions: StickySessionsResource;
2768
2863
  constructor(config?: GigadriveClientConfig);
2769
2864
  }
2770
2865
 
@@ -2903,4 +2998,4 @@ declare function paginate<T>(fetchPage: (cursor: string | undefined) => Promise<
2903
2998
  */
2904
2999
  declare function parseSSEStream<T = unknown>(response: Response): AsyncGenerator<T>;
2905
3000
 
2906
- export { AiGatewayAudioResource, type AiGatewayBudget, type AiGatewayBudgetInput, AiGatewayBudgetsResource, AiGatewayPoliciesResource, type AiGatewayPolicy, type AiGatewayPolicyInput, type AiGatewayProviderAttempt, type AiGatewayRequestEvent, type AiGatewayRequestsQuery, AiGatewayResource, type AiGatewayUsageBreakdown, type AiGatewayUsageQuery, AiGatewayUsageResource, type AiGatewayUsageSummary, AiGatewayVideosResource, type AiModel, type AiModelCapabilities, type AiModelRoutingProvider, ApiError, type ApiKey, ApiKeysResource, type Application, ApplicationEnvVarsResource, type ApplicationHostnameList, ApplicationRequestsResource, ApplicationStorageResource, ApplicationsResource, AuthenticationError, type ChatCompletionChoice, type ChatCompletionChunk, type ChatCompletionContentPart, type ChatCompletionMessage, type ChatCompletionRequest, type ChatCompletionResponse, type ChatCompletionUsage, type CreateApiKeyInput, type CreateApiKeyResult, type CreateDeploymentInput, type CreateEnvVarInput, type CreateOrganizationInput, type CreateStorageBucketInput, type CreateUploadSessionInput, type CreateUploadSessionResponse, type Deployment, type DeploymentLog, type DeploymentLogPage, type DeploymentLogType, type DeploymentStatus, DeploymentsResource, type EnvVar, type GatewayRequestOptions, type GatewayResult, GigadriveClient, type GigadriveClientConfig, GigadriveError, type Hostname, type HostnameAvailability, type ListApiKeysQuery, type ListApplicationsQuery, type ListDeploymentLogsQuery, type ListDeploymentsQuery, type ListQuery, type ListRequestsQuery, type ListStorageObjectsQuery, type NetworkRequest, type NetworkRequestApplicationRef, type NetworkRequestAssetRef, type NetworkRequestBucketRef, type NetworkRequestDeploymentRef, type NetworkRequestDetails, type NetworkRequestFunctionRef, type NetworkRequestMetrics, type NetworkRequestObjectRef, type NetworkRequestSummary, type NetworkResponseDetails, type NodeReadableLike, type Organization, OrganizationAiGatewayResource, OrganizationEnvVarsResource, type OrganizationMember, OrganizationMembersResource, type OrganizationMembershipRole, type OrganizationProductAccess, type OrganizationProductEntitlement, type OrganizationProductEntitlementCheck, type OrganizationProductSubscription, OrganizationProductsResource, OrganizationsResource, type Paginated, type PresignedUrlResult, type ProductAccessMode, type ProductAccessResolutionSource, type ProductDefaultAccessPolicy, type ProductDefinition, type ProductEntitlementStatus, type ProductPlan, type ProductSubscriptionStatus, type ProviderRouting, type PullEnvVarsQuery, type PullEnvVarsResult, type QueryValue, type ResolvedEnvVar, type ResponsesRequest, type ResponsesResponse, type RunUploadOptions, type SetProductionHostnameResult, type SpeechRequest, type StartUploadResult, type StorageBucket, StorageBucketsResource, type StorageObject, type StorageObjectAccess, type StorageObjectList, StorageObjectsResource, type StorageUploadSession, StorageUploadSessionsResource, type TranscriptionRequest, type TranscriptionResponse, type UpdateEnvVarInput, type UploadBatchItemResult, type UploadBatchOptions, type UploadByteSource, type UploadData, UploadError, type UploadFileInput, type UploadFileResult, type UploadPart, UploadSessionExpiredError, type UploadUrlStorage, type VideoGenerationRequest, type VideoGenerationResponse, type VideoModelList, type WaitForCompletionOptions, paginate, parseSSEStream };
3001
+ export { AiGatewayAudioResource, type AiGatewayBudget, type AiGatewayBudgetInput, AiGatewayBudgetsResource, AiGatewayPoliciesResource, type AiGatewayPolicy, type AiGatewayPolicyInput, type AiGatewayProviderAttempt, type AiGatewayRequestEvent, type AiGatewayRequestsQuery, AiGatewayResource, type AiGatewayUsageBreakdown, type AiGatewayUsageQuery, AiGatewayUsageResource, type AiGatewayUsageSummary, AiGatewayVideosResource, type AiModel, type AiModelCapabilities, type AiModelRoutingProvider, ApiError, type ApiKey, ApiKeysResource, type Application, ApplicationEnvVarsResource, type ApplicationHostnameList, ApplicationRequestsResource, ApplicationStorageResource, ApplicationsResource, AuthenticationError, type ChatCompletionChoice, type ChatCompletionChunk, type ChatCompletionContentPart, type ChatCompletionMessage, type ChatCompletionRequest, type ChatCompletionResponse, type ChatCompletionUsage, type CreateApiKeyInput, type CreateApiKeyResult, type CreateDeploymentInput, type CreateEnvVarInput, type CreateOrganizationInput, type CreateStickySessionUrlInput, type CreateStickySessionUrlResult, type CreateStorageBucketInput, type CreateUploadSessionInput, type CreateUploadSessionResponse, type Deployment, type DeploymentLog, type DeploymentLogPage, type DeploymentLogType, type DeploymentStatus, DeploymentsResource, type EnvVar, type GatewayRequestOptions, type GatewayResult, GigadriveClient, type GigadriveClientConfig, GigadriveError, type Hostname, type HostnameAvailability, type ListApiKeysQuery, type ListApplicationsQuery, type ListDeploymentLogsQuery, type ListDeploymentsQuery, type ListQuery, type ListRequestsQuery, type ListStorageObjectsQuery, type NetworkRequest, type NetworkRequestApplicationRef, type NetworkRequestAssetRef, type NetworkRequestBucketRef, type NetworkRequestDeploymentRef, type NetworkRequestDetails, type NetworkRequestFunctionRef, type NetworkRequestMetrics, type NetworkRequestObjectRef, type NetworkRequestSummary, type NetworkResponseDetails, type NodeReadableLike, type Organization, OrganizationAiGatewayResource, OrganizationEnvVarsResource, type OrganizationMember, OrganizationMembersResource, type OrganizationMembershipRole, type OrganizationProductAccess, type OrganizationProductEntitlement, type OrganizationProductEntitlementCheck, type OrganizationProductSubscription, OrganizationProductsResource, OrganizationsResource, type Paginated, type PresignedUrlResult, type ProductAccessMode, type ProductAccessResolutionSource, type ProductDefaultAccessPolicy, type ProductDefinition, type ProductEntitlementStatus, type ProductPlan, type ProductSubscriptionStatus, type ProviderRouting, type PullEnvVarsQuery, type PullEnvVarsResult, type QueryValue, type ResolvedEnvVar, type ResponsesRequest, type ResponsesResponse, type RunUploadOptions, type SetProductionHostnameResult, type SpeechRequest, type StartUploadResult, StickySessionsResource, type StorageBucket, StorageBucketsResource, type StorageObject, type StorageObjectAccess, type StorageObjectList, StorageObjectsResource, type StorageUploadSession, StorageUploadSessionsResource, type TranscriptionRequest, type TranscriptionResponse, type UpdateEnvVarInput, type UploadBatchItemResult, type UploadBatchOptions, type UploadByteSource, type UploadData, UploadError, type UploadFileInput, type UploadFileResult, type UploadPart, UploadSessionExpiredError, type UploadUrlStorage, type VideoGenerationRequest, type VideoGenerationResponse, type VideoModelList, type WaitForCompletionOptions, paginate, parseSSEStream };
package/dist/index.js CHANGED
@@ -51,6 +51,7 @@ __export(src_exports, {
51
51
  OrganizationMembersResource: () => OrganizationMembersResource,
52
52
  OrganizationProductsResource: () => OrganizationProductsResource,
53
53
  OrganizationsResource: () => OrganizationsResource,
54
+ StickySessionsResource: () => StickySessionsResource,
54
55
  StorageBucketsResource: () => StorageBucketsResource,
55
56
  StorageObjectsResource: () => StorageObjectsResource,
56
57
  StorageUploadSessionsResource: () => StorageUploadSessionsResource,
@@ -1673,6 +1674,29 @@ var ApplicationsResource = class extends BaseResource {
1673
1674
  query
1674
1675
  });
1675
1676
  }
1677
+ /**
1678
+ * Creates an application with production and preview environments.
1679
+ *
1680
+ * Requires the `network:applications:write` scope and access to the owning
1681
+ * organization. Application-, deployment-, and function-scoped tokens cannot
1682
+ * create applications.
1683
+ *
1684
+ * @param input - Ownership, display name, and optional repository layout.
1685
+ * @returns The persisted application plus the default production environment
1686
+ * slug, ready for an immediate deployment request.
1687
+ *
1688
+ * @example
1689
+ * ```ts
1690
+ * const app = await client.applications.create({
1691
+ * organizationId: 'org-id',
1692
+ * name: 'Next.js Storefront',
1693
+ * });
1694
+ * console.log(app.id, app.defaultEnvironmentSlug);
1695
+ * ```
1696
+ */
1697
+ async create(input) {
1698
+ return this.httpClient.post("/applications", input);
1699
+ }
1676
1700
  /**
1677
1701
  * List the `*.gigadrive.app` hostnames for an application (production alias
1678
1702
  * and per-branch aliases).
@@ -2275,6 +2299,23 @@ var OrganizationsResource = class extends BaseResource {
2275
2299
  }
2276
2300
  };
2277
2301
 
2302
+ // src/resources/sticky-sessions.ts
2303
+ var StickySessionsResource = class extends BaseResource {
2304
+ /**
2305
+ * Mints a signed URL for an opaque application key.
2306
+ *
2307
+ * Deployed Gigadrive workloads can call this with a zero-config
2308
+ * `GigadriveClient`; the platform injects `GIGADRIVE_CLIENT_ID` and
2309
+ * `GIGADRIVE_CLIENT_SECRET` using the SDK's existing credential chain.
2310
+ */
2311
+ async createUrl(input) {
2312
+ return this.httpClient.post("/sticky-sessions/urls", {
2313
+ ...input,
2314
+ method: input.method ?? "GET"
2315
+ });
2316
+ }
2317
+ };
2318
+
2278
2319
  // src/client.ts
2279
2320
  var DEFAULT_BASE_URL2 = "https://api.gigadrive.network";
2280
2321
  var GigadriveClient = class {
@@ -2288,6 +2329,8 @@ var GigadriveClient = class {
2288
2329
  aiGateway;
2289
2330
  /** Application-scoped API key management (create, list, revoke). */
2290
2331
  apiKeys;
2332
+ /** Signed URLs that keep related requests on one MicroVM instance. */
2333
+ stickySessions;
2291
2334
  constructor(config = {}) {
2292
2335
  const baseUrl = config.baseUrl ?? readEnv("GIGADRIVE_API_BASE_URL") ?? DEFAULT_BASE_URL2;
2293
2336
  const fetchFn = config.fetch ?? globalThis.fetch.bind(globalThis);
@@ -2299,6 +2342,7 @@ var GigadriveClient = class {
2299
2342
  this.deployments = new DeploymentsResource(httpClient);
2300
2343
  this.aiGateway = new AiGatewayResource(httpClient);
2301
2344
  this.apiKeys = new ApiKeysResource(httpClient);
2345
+ this.stickySessions = new StickySessionsResource(httpClient);
2302
2346
  }
2303
2347
  };
2304
2348
 
@@ -2336,6 +2380,7 @@ async function* paginate(fetchPage) {
2336
2380
  OrganizationMembersResource,
2337
2381
  OrganizationProductsResource,
2338
2382
  OrganizationsResource,
2383
+ StickySessionsResource,
2339
2384
  StorageBucketsResource,
2340
2385
  StorageObjectsResource,
2341
2386
  StorageUploadSessionsResource,