@trigger.dev/core 4.1.2 → 4.3.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.
@@ -1967,6 +1967,28 @@ export declare const ExternalBuildData: z.ZodObject<{
1967
1967
  buildToken: string;
1968
1968
  }>;
1969
1969
  export type ExternalBuildData = z.infer<typeof ExternalBuildData>;
1970
+ export declare const DeploymentTriggeredVia: z.ZodUnion<[z.ZodEnum<["cli:manual", "cli:ci_other", "cli:github_actions", "cli:gitlab_ci", "cli:circleci", "cli:jenkins", "cli:azure_pipelines", "cli:bitbucket_pipelines", "cli:travis_ci", "cli:buildkite", "git_integration:github", "dashboard"]>, z.ZodType<string & {}, z.ZodTypeDef, string & {}>]>;
1971
+ export type DeploymentTriggeredVia = z.infer<typeof DeploymentTriggeredVia>;
1972
+ export declare const BuildServerMetadata: z.ZodObject<{
1973
+ buildId: z.ZodOptional<z.ZodString>;
1974
+ isNativeBuild: z.ZodOptional<z.ZodBoolean>;
1975
+ artifactKey: z.ZodOptional<z.ZodString>;
1976
+ skipPromotion: z.ZodOptional<z.ZodBoolean>;
1977
+ configFilePath: z.ZodOptional<z.ZodString>;
1978
+ }, "strip", z.ZodTypeAny, {
1979
+ skipPromotion?: boolean | undefined;
1980
+ buildId?: string | undefined;
1981
+ isNativeBuild?: boolean | undefined;
1982
+ artifactKey?: string | undefined;
1983
+ configFilePath?: string | undefined;
1984
+ }, {
1985
+ skipPromotion?: boolean | undefined;
1986
+ buildId?: string | undefined;
1987
+ isNativeBuild?: boolean | undefined;
1988
+ artifactKey?: string | undefined;
1989
+ configFilePath?: string | undefined;
1990
+ }>;
1991
+ export type BuildServerMetadata = z.infer<typeof BuildServerMetadata>;
1970
1992
  export declare const UpsertBranchRequestBody: z.ZodObject<{
1971
1993
  git: z.ZodOptional<z.ZodObject<{
1972
1994
  provider: z.ZodOptional<z.ZodString>;
@@ -2059,6 +2081,37 @@ export declare const UpsertBranchResponseBody: z.ZodObject<{
2059
2081
  id: string;
2060
2082
  }>;
2061
2083
  export type UpsertBranchResponseBody = z.infer<typeof UpsertBranchResponseBody>;
2084
+ export declare const CreateArtifactRequestBody: z.ZodObject<{
2085
+ type: z.ZodDefault<z.ZodEnum<["deployment_context"]>>;
2086
+ contentType: z.ZodDefault<z.ZodString>;
2087
+ contentLength: z.ZodOptional<z.ZodNumber>;
2088
+ }, "strip", z.ZodTypeAny, {
2089
+ type: "deployment_context";
2090
+ contentType: string;
2091
+ contentLength?: number | undefined;
2092
+ }, {
2093
+ type?: "deployment_context" | undefined;
2094
+ contentType?: string | undefined;
2095
+ contentLength?: number | undefined;
2096
+ }>;
2097
+ export type CreateArtifactRequestBody = z.infer<typeof CreateArtifactRequestBody>;
2098
+ export declare const CreateArtifactResponseBody: z.ZodObject<{
2099
+ artifactKey: z.ZodString;
2100
+ uploadUrl: z.ZodString;
2101
+ uploadFields: z.ZodRecord<z.ZodString, z.ZodString>;
2102
+ expiresAt: z.ZodString;
2103
+ }, "strip", z.ZodTypeAny, {
2104
+ artifactKey: string;
2105
+ uploadUrl: string;
2106
+ uploadFields: Record<string, string>;
2107
+ expiresAt: string;
2108
+ }, {
2109
+ artifactKey: string;
2110
+ uploadUrl: string;
2111
+ uploadFields: Record<string, string>;
2112
+ expiresAt: string;
2113
+ }>;
2114
+ export type CreateArtifactResponseBody = z.infer<typeof CreateArtifactResponseBody>;
2062
2115
  export declare const InitializeDeploymentResponseBody: z.ZodObject<{
2063
2116
  id: z.ZodString;
2064
2117
  contentHash: z.ZodString;
@@ -2079,6 +2132,33 @@ export declare const InitializeDeploymentResponseBody: z.ZodObject<{
2079
2132
  buildId: string;
2080
2133
  buildToken: string;
2081
2134
  }>>>;
2135
+ eventStream: z.ZodOptional<z.ZodObject<{
2136
+ s2: z.ZodObject<{
2137
+ basin: z.ZodString;
2138
+ stream: z.ZodString;
2139
+ accessToken: z.ZodString;
2140
+ }, "strip", z.ZodTypeAny, {
2141
+ basin: string;
2142
+ stream: string;
2143
+ accessToken: string;
2144
+ }, {
2145
+ basin: string;
2146
+ stream: string;
2147
+ accessToken: string;
2148
+ }>;
2149
+ }, "strip", z.ZodTypeAny, {
2150
+ s2: {
2151
+ basin: string;
2152
+ stream: string;
2153
+ accessToken: string;
2154
+ };
2155
+ }, {
2156
+ s2: {
2157
+ basin: string;
2158
+ stream: string;
2159
+ accessToken: string;
2160
+ };
2161
+ }>>;
2082
2162
  }, "strip", z.ZodTypeAny, {
2083
2163
  id: string;
2084
2164
  version: string;
@@ -2091,6 +2171,13 @@ export declare const InitializeDeploymentResponseBody: z.ZodObject<{
2091
2171
  buildId: string;
2092
2172
  buildToken: string;
2093
2173
  } | null | undefined;
2174
+ eventStream?: {
2175
+ s2: {
2176
+ basin: string;
2177
+ stream: string;
2178
+ accessToken: string;
2179
+ };
2180
+ } | undefined;
2094
2181
  }, {
2095
2182
  id: string;
2096
2183
  version: string;
@@ -2103,9 +2190,16 @@ export declare const InitializeDeploymentResponseBody: z.ZodObject<{
2103
2190
  buildId: string;
2104
2191
  buildToken: string;
2105
2192
  } | null | undefined;
2193
+ eventStream?: {
2194
+ s2: {
2195
+ basin: string;
2196
+ stream: string;
2197
+ accessToken: string;
2198
+ };
2199
+ } | undefined;
2106
2200
  }>;
2107
2201
  export type InitializeDeploymentResponseBody = z.infer<typeof InitializeDeploymentResponseBody>;
2108
- export declare const InitializeDeploymentRequestBody: z.ZodObject<{
2202
+ export declare const InitializeDeploymentRequestBody: z.ZodIntersection<z.ZodObject<{
2109
2203
  contentHash: z.ZodString;
2110
2204
  userId: z.ZodOptional<z.ZodString>;
2111
2205
  /** @deprecated This is now determined by the webapp. This is only used to warn users with old CLI versions. */
@@ -2156,6 +2250,8 @@ export declare const InitializeDeploymentRequestBody: z.ZodObject<{
2156
2250
  type: z.ZodOptional<z.ZodEnum<["MANAGED", "UNMANAGED", "V1"]>>;
2157
2251
  runtime: z.ZodOptional<z.ZodString>;
2158
2252
  initialStatus: z.ZodOptional<z.ZodEnum<["PENDING", "BUILDING"]>>;
2253
+ triggeredVia: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["cli:manual", "cli:ci_other", "cli:github_actions", "cli:gitlab_ci", "cli:circleci", "cli:jenkins", "cli:azure_pipelines", "cli:bitbucket_pipelines", "cli:travis_ci", "cli:buildkite", "git_integration:github", "dashboard"]>, z.ZodType<string & {}, z.ZodTypeDef, string & {}>]>>;
2254
+ buildId: z.ZodOptional<z.ZodString>;
2159
2255
  }, "strip", z.ZodTypeAny, {
2160
2256
  contentHash: string;
2161
2257
  type?: "V1" | "MANAGED" | "UNMANAGED" | undefined;
@@ -2177,7 +2273,9 @@ export declare const InitializeDeploymentRequestBody: z.ZodObject<{
2177
2273
  pullRequestTitle?: string | undefined;
2178
2274
  pullRequestState?: "open" | "closed" | "merged" | undefined;
2179
2275
  } | undefined;
2276
+ buildId?: string | undefined;
2180
2277
  initialStatus?: "PENDING" | "BUILDING" | undefined;
2278
+ triggeredVia?: (string & {}) | "cli:manual" | "cli:ci_other" | "cli:github_actions" | "cli:gitlab_ci" | "cli:circleci" | "cli:jenkins" | "cli:azure_pipelines" | "cli:bitbucket_pipelines" | "cli:travis_ci" | "cli:buildkite" | "git_integration:github" | "dashboard" | undefined;
2181
2279
  }, {
2182
2280
  contentHash: string;
2183
2281
  type?: "V1" | "MANAGED" | "UNMANAGED" | undefined;
@@ -2199,8 +2297,38 @@ export declare const InitializeDeploymentRequestBody: z.ZodObject<{
2199
2297
  pullRequestTitle?: string | undefined;
2200
2298
  pullRequestState?: "open" | "closed" | "merged" | undefined;
2201
2299
  } | undefined;
2300
+ buildId?: string | undefined;
2202
2301
  initialStatus?: "PENDING" | "BUILDING" | undefined;
2203
- }>;
2302
+ triggeredVia?: (string & {}) | "cli:manual" | "cli:ci_other" | "cli:github_actions" | "cli:gitlab_ci" | "cli:circleci" | "cli:jenkins" | "cli:azure_pipelines" | "cli:bitbucket_pipelines" | "cli:travis_ci" | "cli:buildkite" | "git_integration:github" | "dashboard" | undefined;
2303
+ }>, z.ZodEffects<z.ZodDiscriminatedUnion<"isNativeBuild", [z.ZodObject<{
2304
+ isNativeBuild: z.ZodLiteral<true>;
2305
+ skipPromotion: z.ZodBoolean;
2306
+ artifactKey: z.ZodString;
2307
+ configFilePath: z.ZodOptional<z.ZodString>;
2308
+ }, "strip", z.ZodTypeAny, {
2309
+ skipPromotion: boolean;
2310
+ isNativeBuild: true;
2311
+ artifactKey: string;
2312
+ configFilePath?: string | undefined;
2313
+ }, {
2314
+ skipPromotion: boolean;
2315
+ isNativeBuild: true;
2316
+ artifactKey: string;
2317
+ configFilePath?: string | undefined;
2318
+ }>, z.ZodObject<{
2319
+ isNativeBuild: z.ZodLiteral<false>;
2320
+ }, "strip", z.ZodTypeAny, {
2321
+ isNativeBuild: false;
2322
+ }, {
2323
+ isNativeBuild: false;
2324
+ }>]>, {
2325
+ skipPromotion: boolean;
2326
+ isNativeBuild: true;
2327
+ artifactKey: string;
2328
+ configFilePath?: string | undefined;
2329
+ } | {
2330
+ isNativeBuild: false;
2331
+ }, unknown>>;
2204
2332
  export type InitializeDeploymentRequestBody = z.infer<typeof InitializeDeploymentRequestBody>;
2205
2333
  export declare const RemoteBuildProviderStatusResponseBody: z.ZodObject<{
2206
2334
  status: z.ZodEnum<["operational", "degraded", "unknown"]>;
@@ -2219,14 +2347,14 @@ export declare const GenerateRegistryCredentialsResponseBody: z.ZodObject<{
2219
2347
  expiresAt: z.ZodString;
2220
2348
  repositoryUri: z.ZodString;
2221
2349
  }, "strip", z.ZodTypeAny, {
2350
+ expiresAt: string;
2222
2351
  username: string;
2223
2352
  password: string;
2224
- expiresAt: string;
2225
2353
  repositoryUri: string;
2226
2354
  }, {
2355
+ expiresAt: string;
2227
2356
  username: string;
2228
2357
  password: string;
2229
- expiresAt: string;
2230
2358
  repositoryUri: string;
2231
2359
  }>;
2232
2360
  export type GenerateRegistryCredentialsResponseBody = z.infer<typeof GenerateRegistryCredentialsResponseBody>;
@@ -2552,6 +2680,157 @@ export declare const GetLatestDeploymentResponseBody: z.ZodObject<Omit<{
2552
2680
  } | null | undefined;
2553
2681
  }>;
2554
2682
  export type GetLatestDeploymentResponseBody = z.infer<typeof GetLatestDeploymentResponseBody>;
2683
+ export declare const DeploymentLogEvent: z.ZodObject<{
2684
+ type: z.ZodLiteral<"log">;
2685
+ data: z.ZodObject<{
2686
+ level: z.ZodDefault<z.ZodOptional<z.ZodEnum<["debug", "info", "warn", "error"]>>>;
2687
+ message: z.ZodString;
2688
+ }, "strip", z.ZodTypeAny, {
2689
+ message: string;
2690
+ level: "error" | "warn" | "info" | "debug";
2691
+ }, {
2692
+ message: string;
2693
+ level?: "error" | "warn" | "info" | "debug" | undefined;
2694
+ }>;
2695
+ }, "strip", z.ZodTypeAny, {
2696
+ type: "log";
2697
+ data: {
2698
+ message: string;
2699
+ level: "error" | "warn" | "info" | "debug";
2700
+ };
2701
+ }, {
2702
+ type: "log";
2703
+ data: {
2704
+ message: string;
2705
+ level?: "error" | "warn" | "info" | "debug" | undefined;
2706
+ };
2707
+ }>;
2708
+ export declare const DeploymentFinalizedEvent: z.ZodObject<{
2709
+ type: z.ZodLiteral<"finalized">;
2710
+ data: z.ZodObject<{
2711
+ result: z.ZodUnion<[z.ZodEnum<["succeeded", "failed", "timed_out", "canceled"]>, z.ZodType<string & {}, z.ZodTypeDef, string & {}>]>;
2712
+ message: z.ZodOptional<z.ZodString>;
2713
+ }, "strip", z.ZodTypeAny, {
2714
+ result: (string & {}) | "succeeded" | "failed" | "timed_out" | "canceled";
2715
+ message?: string | undefined;
2716
+ }, {
2717
+ result: (string & {}) | "succeeded" | "failed" | "timed_out" | "canceled";
2718
+ message?: string | undefined;
2719
+ }>;
2720
+ }, "strip", z.ZodTypeAny, {
2721
+ type: "finalized";
2722
+ data: {
2723
+ result: (string & {}) | "succeeded" | "failed" | "timed_out" | "canceled";
2724
+ message?: string | undefined;
2725
+ };
2726
+ }, {
2727
+ type: "finalized";
2728
+ data: {
2729
+ result: (string & {}) | "succeeded" | "failed" | "timed_out" | "canceled";
2730
+ message?: string | undefined;
2731
+ };
2732
+ }>;
2733
+ export declare const DeploymentEvent: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2734
+ type: z.ZodLiteral<"log">;
2735
+ data: z.ZodObject<{
2736
+ level: z.ZodDefault<z.ZodOptional<z.ZodEnum<["debug", "info", "warn", "error"]>>>;
2737
+ message: z.ZodString;
2738
+ }, "strip", z.ZodTypeAny, {
2739
+ message: string;
2740
+ level: "error" | "warn" | "info" | "debug";
2741
+ }, {
2742
+ message: string;
2743
+ level?: "error" | "warn" | "info" | "debug" | undefined;
2744
+ }>;
2745
+ }, "strip", z.ZodTypeAny, {
2746
+ type: "log";
2747
+ data: {
2748
+ message: string;
2749
+ level: "error" | "warn" | "info" | "debug";
2750
+ };
2751
+ }, {
2752
+ type: "log";
2753
+ data: {
2754
+ message: string;
2755
+ level?: "error" | "warn" | "info" | "debug" | undefined;
2756
+ };
2757
+ }>, z.ZodObject<{
2758
+ type: z.ZodLiteral<"finalized">;
2759
+ data: z.ZodObject<{
2760
+ result: z.ZodUnion<[z.ZodEnum<["succeeded", "failed", "timed_out", "canceled"]>, z.ZodType<string & {}, z.ZodTypeDef, string & {}>]>;
2761
+ message: z.ZodOptional<z.ZodString>;
2762
+ }, "strip", z.ZodTypeAny, {
2763
+ result: (string & {}) | "succeeded" | "failed" | "timed_out" | "canceled";
2764
+ message?: string | undefined;
2765
+ }, {
2766
+ result: (string & {}) | "succeeded" | "failed" | "timed_out" | "canceled";
2767
+ message?: string | undefined;
2768
+ }>;
2769
+ }, "strip", z.ZodTypeAny, {
2770
+ type: "finalized";
2771
+ data: {
2772
+ result: (string & {}) | "succeeded" | "failed" | "timed_out" | "canceled";
2773
+ message?: string | undefined;
2774
+ };
2775
+ }, {
2776
+ type: "finalized";
2777
+ data: {
2778
+ result: (string & {}) | "succeeded" | "failed" | "timed_out" | "canceled";
2779
+ message?: string | undefined;
2780
+ };
2781
+ }>]>;
2782
+ export type DeploymentEvent = z.infer<typeof DeploymentEvent>;
2783
+ export type DeploymentLogEvent = z.infer<typeof DeploymentLogEvent>;
2784
+ export type DeploymentFinalizedEvent = z.infer<typeof DeploymentFinalizedEvent>;
2785
+ export declare const DeploymentEventFromString: z.ZodPipeline<z.ZodEffects<z.ZodString, any, string>, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2786
+ type: z.ZodLiteral<"log">;
2787
+ data: z.ZodObject<{
2788
+ level: z.ZodDefault<z.ZodOptional<z.ZodEnum<["debug", "info", "warn", "error"]>>>;
2789
+ message: z.ZodString;
2790
+ }, "strip", z.ZodTypeAny, {
2791
+ message: string;
2792
+ level: "error" | "warn" | "info" | "debug";
2793
+ }, {
2794
+ message: string;
2795
+ level?: "error" | "warn" | "info" | "debug" | undefined;
2796
+ }>;
2797
+ }, "strip", z.ZodTypeAny, {
2798
+ type: "log";
2799
+ data: {
2800
+ message: string;
2801
+ level: "error" | "warn" | "info" | "debug";
2802
+ };
2803
+ }, {
2804
+ type: "log";
2805
+ data: {
2806
+ message: string;
2807
+ level?: "error" | "warn" | "info" | "debug" | undefined;
2808
+ };
2809
+ }>, z.ZodObject<{
2810
+ type: z.ZodLiteral<"finalized">;
2811
+ data: z.ZodObject<{
2812
+ result: z.ZodUnion<[z.ZodEnum<["succeeded", "failed", "timed_out", "canceled"]>, z.ZodType<string & {}, z.ZodTypeDef, string & {}>]>;
2813
+ message: z.ZodOptional<z.ZodString>;
2814
+ }, "strip", z.ZodTypeAny, {
2815
+ result: (string & {}) | "succeeded" | "failed" | "timed_out" | "canceled";
2816
+ message?: string | undefined;
2817
+ }, {
2818
+ result: (string & {}) | "succeeded" | "failed" | "timed_out" | "canceled";
2819
+ message?: string | undefined;
2820
+ }>;
2821
+ }, "strip", z.ZodTypeAny, {
2822
+ type: "finalized";
2823
+ data: {
2824
+ result: (string & {}) | "succeeded" | "failed" | "timed_out" | "canceled";
2825
+ message?: string | undefined;
2826
+ };
2827
+ }, {
2828
+ type: "finalized";
2829
+ data: {
2830
+ result: (string & {}) | "succeeded" | "failed" | "timed_out" | "canceled";
2831
+ message?: string | undefined;
2832
+ };
2833
+ }>]>>;
2555
2834
  export declare const CreateUploadPayloadUrlResponseBody: z.ZodObject<{
2556
2835
  presignedUrl: z.ZodString;
2557
2836
  }, "strip", z.ZodTypeAny, {
@@ -6081,10 +6360,10 @@ export declare const RetrieveRunTraceSpanSchema: z.ZodObject<{
6081
6360
  message: string;
6082
6361
  duration: number;
6083
6362
  isCancelled: boolean;
6363
+ level: string;
6084
6364
  startTime: Date;
6085
6365
  isError: boolean;
6086
6366
  isPartial: boolean;
6087
- level: string;
6088
6367
  output?: unknown;
6089
6368
  properties?: Record<string, any> | undefined;
6090
6369
  taskSlug?: string | undefined;
@@ -6097,10 +6376,10 @@ export declare const RetrieveRunTraceSpanSchema: z.ZodObject<{
6097
6376
  message: string;
6098
6377
  duration: number;
6099
6378
  isCancelled: boolean;
6379
+ level: string;
6100
6380
  startTime: Date;
6101
6381
  isError: boolean;
6102
6382
  isPartial: boolean;
6103
- level: string;
6104
6383
  output?: unknown;
6105
6384
  properties?: Record<string, any> | undefined;
6106
6385
  taskSlug?: string | undefined;
@@ -6116,10 +6395,10 @@ export declare const RetrieveRunTraceSpanSchema: z.ZodObject<{
6116
6395
  message: string;
6117
6396
  duration: number;
6118
6397
  isCancelled: boolean;
6398
+ level: string;
6119
6399
  startTime: Date;
6120
6400
  isError: boolean;
6121
6401
  isPartial: boolean;
6122
- level: string;
6123
6402
  output?: unknown;
6124
6403
  properties?: Record<string, any> | undefined;
6125
6404
  taskSlug?: string | undefined;
@@ -6137,10 +6416,10 @@ export declare const RetrieveRunTraceSpanSchema: z.ZodObject<{
6137
6416
  message: string;
6138
6417
  duration: number;
6139
6418
  isCancelled: boolean;
6419
+ level: string;
6140
6420
  startTime: Date;
6141
6421
  isError: boolean;
6142
6422
  isPartial: boolean;
6143
- level: string;
6144
6423
  output?: unknown;
6145
6424
  properties?: Record<string, any> | undefined;
6146
6425
  taskSlug?: string | undefined;
@@ -6169,10 +6448,10 @@ export declare const RetrieveRunTraceResponseBody: z.ZodObject<{
6169
6448
  message: string;
6170
6449
  duration: number;
6171
6450
  isCancelled: boolean;
6451
+ level: string;
6172
6452
  startTime: Date;
6173
6453
  isError: boolean;
6174
6454
  isPartial: boolean;
6175
- level: string;
6176
6455
  output?: unknown;
6177
6456
  properties?: Record<string, any> | undefined;
6178
6457
  taskSlug?: string | undefined;
@@ -6195,10 +6474,10 @@ export declare const RetrieveRunTraceResponseBody: z.ZodObject<{
6195
6474
  message: string;
6196
6475
  duration: number;
6197
6476
  isCancelled: boolean;
6477
+ level: string;
6198
6478
  startTime: Date;
6199
6479
  isError: boolean;
6200
6480
  isPartial: boolean;
6201
- level: string;
6202
6481
  output?: unknown;
6203
6482
  properties?: Record<string, any> | undefined;
6204
6483
  taskSlug?: string | undefined;
@@ -6223,10 +6502,10 @@ export declare const RetrieveRunTraceResponseBody: z.ZodObject<{
6223
6502
  message: string;
6224
6503
  duration: number;
6225
6504
  isCancelled: boolean;
6505
+ level: string;
6226
6506
  startTime: Date;
6227
6507
  isError: boolean;
6228
6508
  isPartial: boolean;
6229
- level: string;
6230
6509
  output?: unknown;
6231
6510
  properties?: Record<string, any> | undefined;
6232
6511
  taskSlug?: string | undefined;
@@ -6251,10 +6530,10 @@ export declare const RetrieveRunTraceResponseBody: z.ZodObject<{
6251
6530
  message: string;
6252
6531
  duration: number;
6253
6532
  isCancelled: boolean;
6533
+ level: string;
6254
6534
  startTime: Date;
6255
6535
  isError: boolean;
6256
6536
  isPartial: boolean;
6257
- level: string;
6258
6537
  output?: unknown;
6259
6538
  properties?: Record<string, any> | undefined;
6260
6539
  taskSlug?: string | undefined;
@@ -285,6 +285,30 @@ export const ExternalBuildData = z.object({
285
285
  buildToken: z.string(),
286
286
  projectId: z.string(),
287
287
  });
288
+ const anyString = z.custom((v) => typeof v === "string");
289
+ export const DeploymentTriggeredVia = z
290
+ .enum([
291
+ "cli:manual",
292
+ "cli:ci_other",
293
+ "cli:github_actions",
294
+ "cli:gitlab_ci",
295
+ "cli:circleci",
296
+ "cli:jenkins",
297
+ "cli:azure_pipelines",
298
+ "cli:bitbucket_pipelines",
299
+ "cli:travis_ci",
300
+ "cli:buildkite",
301
+ "git_integration:github",
302
+ "dashboard",
303
+ ])
304
+ .or(anyString);
305
+ export const BuildServerMetadata = z.object({
306
+ buildId: z.string().optional(),
307
+ isNativeBuild: z.boolean().optional(),
308
+ artifactKey: z.string().optional(),
309
+ skipPromotion: z.boolean().optional(),
310
+ configFilePath: z.string().optional(),
311
+ });
288
312
  export const UpsertBranchRequestBody = z.object({
289
313
  git: GitMeta.optional(),
290
314
  env: z.enum(["preview"]),
@@ -293,6 +317,17 @@ export const UpsertBranchRequestBody = z.object({
293
317
  export const UpsertBranchResponseBody = z.object({
294
318
  id: z.string(),
295
319
  });
320
+ export const CreateArtifactRequestBody = z.object({
321
+ type: z.enum(["deployment_context"]).default("deployment_context"),
322
+ contentType: z.string().default("application/gzip"),
323
+ contentLength: z.number().optional(),
324
+ });
325
+ export const CreateArtifactResponseBody = z.object({
326
+ artifactKey: z.string(),
327
+ uploadUrl: z.string(),
328
+ uploadFields: z.record(z.string()),
329
+ expiresAt: z.string().datetime(),
330
+ });
296
331
  export const InitializeDeploymentResponseBody = z.object({
297
332
  id: z.string(),
298
333
  contentHash: z.string(),
@@ -301,8 +336,18 @@ export const InitializeDeploymentResponseBody = z.object({
301
336
  imageTag: z.string(),
302
337
  imagePlatform: z.string(),
303
338
  externalBuildData: ExternalBuildData.optional().nullable(),
339
+ eventStream: z
340
+ .object({
341
+ s2: z.object({
342
+ basin: z.string(),
343
+ stream: z.string(),
344
+ accessToken: z.string(),
345
+ }),
346
+ })
347
+ .optional(),
304
348
  });
305
- export const InitializeDeploymentRequestBody = z.object({
349
+ export const InitializeDeploymentRequestBody = z
350
+ .object({
306
351
  contentHash: z.string(),
307
352
  userId: z.string().optional(),
308
353
  /** @deprecated This is now determined by the webapp. This is only used to warn users with old CLI versions. */
@@ -311,7 +356,26 @@ export const InitializeDeploymentRequestBody = z.object({
311
356
  type: z.enum(["MANAGED", "UNMANAGED", "V1"]).optional(),
312
357
  runtime: z.string().optional(),
313
358
  initialStatus: z.enum(["PENDING", "BUILDING"]).optional(),
314
- });
359
+ triggeredVia: DeploymentTriggeredVia.optional(),
360
+ buildId: z.string().optional(),
361
+ })
362
+ .and(z.preprocess((val) => {
363
+ const obj = val;
364
+ if (!obj || !obj.isNativeBuild) {
365
+ return { ...obj, isNativeBuild: false };
366
+ }
367
+ return obj;
368
+ }, z.discriminatedUnion("isNativeBuild", [
369
+ z.object({
370
+ isNativeBuild: z.literal(true),
371
+ skipPromotion: z.boolean(),
372
+ artifactKey: z.string(),
373
+ configFilePath: z.string().optional(),
374
+ }),
375
+ z.object({
376
+ isNativeBuild: z.literal(false),
377
+ }),
378
+ ])));
315
379
  export const RemoteBuildProviderStatusResponseBody = z.object({
316
380
  status: z.enum(["operational", "degraded", "unknown"]),
317
381
  message: z.string(),
@@ -374,6 +438,36 @@ export const GetDeploymentResponseBody = z.object({
374
438
  export const GetLatestDeploymentResponseBody = GetDeploymentResponseBody.omit({
375
439
  worker: true,
376
440
  });
441
+ export const DeploymentLogEvent = z.object({
442
+ type: z.literal("log"),
443
+ data: z.object({
444
+ level: z.enum(["debug", "info", "warn", "error"]).optional().default("info"),
445
+ message: z.string(),
446
+ }),
447
+ });
448
+ export const DeploymentFinalizedEvent = z.object({
449
+ type: z.literal("finalized"),
450
+ data: z.object({
451
+ result: z.enum(["succeeded", "failed", "timed_out", "canceled"]).or(anyString),
452
+ message: z.string().optional(),
453
+ }),
454
+ });
455
+ export const DeploymentEvent = z.discriminatedUnion("type", [
456
+ DeploymentLogEvent,
457
+ DeploymentFinalizedEvent,
458
+ ]);
459
+ export const DeploymentEventFromString = z
460
+ .string()
461
+ .transform((s, ctx) => {
462
+ try {
463
+ return JSON.parse(s);
464
+ }
465
+ catch {
466
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: "Invalid JSON" });
467
+ return z.NEVER;
468
+ }
469
+ })
470
+ .pipe(DeploymentEvent);
377
471
  export const CreateUploadPayloadUrlResponseBody = z.object({
378
472
  presignedUrl: z.string(),
379
473
  });